Introducing a new way to review your PRs.

Read the announcement

solana-foundation / explorer

Explorer for Solana clusters

View on GitHub

23 documents · Updated Nov 23, 2026

docs / transaction-sharing

Transaction sharing and Open Graph cards

Transaction sharing turns a transaction link into social metadata and a fixed-size image that can be read without opening the full transaction page. It assembles a small, stable view of the transaction, renders either a transaction card or a receipt card, and keeps public share routes separate from private or custom-cluster data. This page extends transaction inspection with the sharing path. The transaction detail route explains the page that the shared links open, while instruction decoding and simulation explains the instruction names that sharing reuses.

Sharing model

Sharing has two related outputs. A transaction share describes the chain record and its instructions, while a receipt share presents a supported transfer in a compact payment-style card. Both outputs use server-side data because a social crawler cannot use the visitor's browser RPC settings.

This diagram shows how a transaction link becomes page metadata and an image response.

flowchart LR
    A[Transaction page or share link] --> B[Resolve public cluster]
    B --> C[Fetch transaction]
    C --> D[Assemble share data]
    D --> E[Transaction card]
    C --> F[Extract receipt]
    F --> G[Receipt card]
    E --> H[PNG image route]
    G --> H
    A --> I[Open Graph metadata]
    I --> H

Share data assembly

getTxShareData creates the small data contract used by the transaction image. It reads the transaction from the resolved server cluster, then formats the date, fee, result, slot, version, fee payer, signature, and instruction summaries before the image renderer sees them. This keeps data loading and display layout separate, and it lets the card use the same instruction naming rules as transaction history.

The assembly path first uses names already present in parsed instructions or known byte patterns. It asks for IDL names only for unnamed programs in the rows that the image can show. Compute Budget setup instructions do not appear in the share list because they do not describe the transaction's main action. A missing block time, fee metadata, status, signer, or version remains an explicit placeholder or absent field instead of becoming an invented value.

References: app/…/get-tx-share-data.ts• L19-40 app/…/get-tx-share-data.ts• L51-64 app/…/get-tx-share-data.ts• L82-112 app/…/get-tx.ts• L11-20

IDL name resolution

IDL name resolution supplies optional names for instruction rows that the transaction data does not name in another way. It removes duplicate program IDs, resolves the remaining programs against the selected server cluster, and applies a short stage budget so a slow name service does not hold up the image.

A failed or late lookup removes only that program's extra name. The share can still render with a generic label, while ordinary failures are logged as errors and budget-driven aborts are treated as expected timeouts. The lookup also stops its outstanding requests when the budget ends, which prevents abandoned work from using connections after the card is ready.

References: app/…/get-idl-names.ts• L9-25 app/…/get-idl-names.ts• L33-55 app/…/get-idl-names.ts• L57-86

Cluster and result boundary

The share data layer accepts a known server cluster from the link. When the link has no cluster, it probes the public cluster list, which currently starts with Mainnet Beta. The layer returns one of three outcomes: usable data, not found, or an error. The route can then give a missing transaction a branded fallback image while keeping a data failure distinct from a missing record.

The request has a short RPC budget because an image unfurl should not wait indefinitely. The transaction fetch and the optional IDL stage each stop within their own budget. The public route rejects custom clusters before this layer runs. Custom clusters use visitor-owned RPC endpoints, so a server-side share route must not accept their URL from an unauthenticated request.

References: app/…/get-tx-share-data.ts• L42-79 app/…/get-idl-names.ts• L33-55 app/…/route.tsx• L26-43 app/…/route.tsx• L84-93

Transaction Open Graph

The transaction page publishes metadata that points social clients to the transaction page and to the transaction image route. Mainnet uses a short canonical URL. A supported non-mainnet cluster appears in both URLs so the preview describes the same network as the page.

Transaction metadata

getTxOpenGraph supplies the Open Graph type, page URL, image URL, image dimensions, and alternative text. The transaction page adds the title and description, then reuses the same image URL for the large Twitter card. The shared image size is 1200 by 630 pixels, which gives social clients an explicit preview shape.

Receipt-view metadata is selected when the transaction page has view=receipt and the receipt feature is enabled. A custom-cluster transaction does not receive a server image URL. The page still has a useful text preview, but it does not expose a server route that cannot reach the visitor's RPC.

References: app/…/get-tx-open-graph.ts• L6-28 app/…/page.tsx• L19-29 app/…/page.tsx• L31-65 app/…/page.tsx• L68-95 app/…/image-size.ts• L1-13

Transaction image route

/og/tx/[signature] validates the signature and the cluster query before it loads chain data. It accepts only the canonical query shape emitted by the metadata helpers. This gives one public URL shape for each card and prevents extra query values from causing repeated RPC and image work.

The route loads the share data, status-specific glow assets, and the fonts needed by the card. It returns a PNG with a longer cache lifetime for resolved data and a shorter lifetime for the not-found fallback. A rendering failure is a server error, while a data-layer failure is reported as a bad upstream response.

References: app/…/route.tsx• L11-18 app/…/route.tsx• L26-66 app/…/route.tsx• L69-93

Receipt Open Graph

Receipt sharing uses the same transaction identity but a different product view. It shows a supported SOL or token transfer as a receipt, then lets the transaction page remain the source for full inspection when no clear receipt can be made.

Receipt route and eligibility

The receipt image route is /og/receipt/[signature]. Its signature segment can carry a version marker and a non-mainnet cluster in a composite form. The route separates those values before it validates the transaction signature and asks createReceipt to fetch and shape the transaction.

Receipt creation is limited to transfer data that can be represented without ambiguity. The receipt model rejects mixed token mints, inner transfers, and transactions with no supported SOL or token transfer. The route still renders a branded fallback image when receipt data is unavailable, while typed receipt errors map to not-found or upstream failure responses.

Receipt Open Graph metadata is built by the transaction page rather than by the image route. It includes the receipt page URL and image URL only when the receipt feature is enabled and the cluster is safe for server access. A version value can be added to the composite image path so a changed card design can use a new cache key.

References: app/…/route.tsx• L24-52 app/…/create-receipt.ts• L7-18 app/…/create-receipt.ts• L16-18 app/…/composite-signature.ts• L5-44 app/…/page.tsx• L29-65 app/…/receipt-data.ts• L1-40

Receipt image composition

BaseReceiptImage turns formatted receipt data into a 1200 by 630 card. A single transfer uses a direct sender, date, amount, receiver, memo, and fee layout. A multi-transfer receipt uses a table and limits visible transfer rows, then reports the remaining count. Long memo text is shortened so it cannot push the main transfer facts out of the image.

When no receipt data exists, the renderer uses a dark Explorer fallback that directs the viewer to the transaction details. This keeps a stale or unsupported share URL useful as an image instead of returning a broken social preview.

References: app/…/BaseReceiptImage.tsx• L9-29 app/…/BaseReceiptImage.tsx• L31-179 app/…/BaseReceiptImage.tsx• L182-283 app/…/BaseReceiptImage.tsx• L385-425

Image composition

The image components are small presentation contracts for Satori, the renderer behind ImageResponse. They receive already formatted data and produce a fixed card. This boundary keeps RPC work, name lookup, transfer rules, and visual layout from becoming one route-level operation.

Transaction card

BaseTxImage presents the Explorer mark, date, result badge, signature, instruction rows, and four footer facts: fee, slot, version, and fee payer. It shows only the first configured number of instruction rows and replaces the rest with an and N more line. Unknown programs keep a short program address beside the generic label so the card does not hide useful identity.

The card selects a green or pink raster glow from the transaction result. A transaction without data uses the success glow only as a neutral background choice and renders the branded fallback message instead of pretending that the transaction resolved.

References: app/…/BaseTxImage.tsx• L52-99 app/…/BaseTxImage.tsx• L102-220 app/…/BaseTxImage.tsx• L224-325 app/…/constants.ts• L1-10

Receipt card

The receipt card uses transfer-specific visual rules rather than the transaction card's status layout. It keeps sender and receiver identity, amount and unit, date, memo, and fee readable at the social image size. Its multi-transfer form preserves the table relationship between each transfer and its amount.

Both card types use the shared IMAGE_SIZE contract. This prevents the route metadata, the rendered PNG, and browser checks from drifting to different dimensions.

References: app/…/BaseReceiptImage.tsx• L18-39 app/…/BaseReceiptImage.tsx• L41-177 app/…/BaseReceiptImage.tsx• L182-283 app/…/image-size.ts• L7-13

Reusable rendering helpers

The sharing routes use shared helpers for assets that Satori cannot safely discover at render time. The helpers turn local files into in-memory data that can be passed into one image render.

Font loading

loadOgFonts loads the Rubik and Roboto Mono font families from the public font directory and returns the selected weights in the format accepted by ImageResponse. It caches each file read by path, so repeated cards in one server instance do not read the same font again. A failed read clears its cache entry so a later request can retry.

The transaction route requests the weights used by the card's normal and medium text. Roboto Mono gives signatures and fee-payer addresses a stable character width, while Rubik supplies the main card text.

References: app/…/fonts.ts• L4-17 app/…/fonts.ts• L19-29 app/…/fonts.ts• L35-63 app/…/route.tsx• L11-14

Glow asset loading

loadOgGlows reads the success and failure PNG backgrounds and converts them to base64 data URIs. The transaction card needs data URIs because Satori does not resolve relative image URLs. The PNG form also preserves the noise layer that a CSS gradient would lose and avoids the renderer's WebP limitation.

The two assets load in parallel and share one cached promise per server instance. A failed load resets that promise so the next request can try again.

References: app/…/og-glows.ts• L6-20 app/…/og-glows.ts• L27-54

Sharing tests

Sharing tests protect the contracts that cross data assembly, metadata, route validation, and image rendering. They use focused mocks for external RPC and image rendering in unit tests, then use real image responses and live chain records in end-to-end checks.

Data and metadata contracts

The share-data tests verify cluster selection, not-found and error results, formatted footer fields, status mapping, instruction naming, Compute Budget filtering, and the limit on IDL lookups. They also verify that a transaction timeout becomes a typed result instead of an exception. The transaction API tests verify that the selected cluster becomes the server RPC URL and that the share deadline reaches the fetch. The IDL API tests verify duplicate removal, per-program failure isolation, the time budget, request aborts, and cleanup after fast completion. The Open Graph helper tests verify page and image URL pairing, cluster query rules, image dimensions, and reuse of the image URL for Twitter metadata.

These checks matter because a card can look valid while describing the wrong cluster, stale result, or unnamed instruction. They keep the share contract aligned with the transaction inspection and history naming paths.

References: app/…/get-tx-share-data.spec.ts• L118-198 app/…/get-tx-share-data.spec.ts• L200-330 app/…/get-tx.spec.ts• L15-55 app/…/get-idl-names.spec.ts• L21-149 app/…/get-tx-open-graph.spec.ts• L10-41

Route and browser coverage

The transaction image route tests validate malformed signatures, unsupported clusters, non-canonical queries, resolved and fallback cache headers, data errors, render errors, and the assets passed to the card. The receipt route tests cover feature gating, signature validation, receipt lookup outcomes, typed upstream errors, and unknown failures.

The transaction-share end-to-end suite checks that a real resolved transaction produces a 1200 by 630 PNG, that an unknown signature produces a short-lived fallback, and that the transaction page publishes the expected Open Graph and Twitter tags. It also checks that a non-mainnet cluster reaches the image URL.

References: app/…/route.spec.ts• L58-171 app/…/route.spec.ts• L27-103 app/…/transaction-share.e2e.ts• L19-95

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to TxShareData must stay aligned with both BaseTxImage footer cells and the transaction share-data tests. An optional field must still have a deliberate placeholder or omission in the card.
  • Changes to instruction row limits must keep IDL lookup selection, visible rows, and the overflow label on the same limit.
  • Changes to IDL retry or time-budget behavior must preserve per-program failure isolation, abort outstanding work, and keep timeout logging below error level.
  • Changes to cluster URL rules must update metadata builders and route validation together. A URL that metadata emits must be accepted by the image route.
  • Changes to custom-cluster handling must keep custom RPC URLs out of all server-side transaction and receipt image paths.
  • Changes to receipt eligibility must keep the transaction page metadata, receipt route result, and no-receipt page reason aligned.
  • Changes to IMAGE_SIZE must preserve the metadata dimensions and the PNG dimensions used by the end-to-end check.
  • Changes to image fonts or local raster assets must preserve the Satori input form and retry behavior after a failed asset read.
  • Changes to cache duration or receipt image versioning must account for stale not-found cards and already-published social URLs.

Important failure modes

TriggerConsequenceGuard
A custom cluster reaches an image routeThe server could be directed to a caller-controlled RPC hostReject custom clusters before transaction or receipt fetches and omit their server image metadata
A valid signature has not propagated yetA social crawler could cache a missing result as if it were permanentRender the branded fallback with a short cache lifetime
The share-data fetch failsThe route returns no trustworthy transaction cardReturn a data error separately from not-found and use a 502 response
Metadata emits a query shape the route rejectsSocial crawlers receive a 400 instead of an imageBuild page and image URLs through the same cluster helper contract
IDL name lookup fails or exceeds its stage budgetThe card keeps a generic program or instruction name, but the image can still renderDeduplicate lookups, isolate each program result, abort late requests, and treat missing names as valid output
IDL lookup runs for hidden instruction rowsImage generation spends extra RPC time without improving the cardLimit lookup IDs to the rows that the renderer can display
Receipt data contains mixed token mints or inner transfersOne receipt card can imply a false single transferKeep those cases unavailable and link viewers to transaction details
A glow or font file cannot loadSatori cannot produce the intended cardUse cached loaders that clear failed entries so later requests can retry
The image size and metadata size divergeSocial clients crop or scale the preview in unexpected waysUse the shared IMAGE_SIZE contract in route rendering and metadata

Key files

FileWhy to read it
app/…/get-tx-share-data.tsDefines the formatted transaction data contract and the public-cluster lookup path.
app/…/get-tx.tsMaps a resolved server cluster and share deadline to the transaction fetch.
app/…/get-idl-names.tsDefines bounded, failure-isolated IDL name lookup for share instruction rows.
app/…/get-tx-open-graph.tsDefines canonical transaction page and image URLs and their Open Graph fields.
app/…/page.tsxConnects transaction-page metadata to transaction and receipt share images.
app/…/route.tsxShows transaction image validation, data loading, caching, and PNG generation.
app/…/route.tsxShows receipt image validation, receipt creation, errors, and caching.
app/…/BaseTxImage.tsxDefines the transaction card's visible facts, truncation, status treatment, and fallback.
app/…/BaseReceiptImage.tsxDefines single-transfer, multi-transfer, and no-receipt card layouts.
app/…/create-receipt.tsConnects server-side transaction lookup to receipt shaping.
app/…/composite-signature.tsDefines the receipt image path format for version and cluster values.
app/…/og-glows.tsDefines loading and caching for status-specific raster backgrounds.
app/…/fonts.tsDefines reusable local font loading for generated Open Graph images.
app/…/image-size.tsDefines the image dimensions shared by metadata and render routes.
app/…/get-tx-share-data.spec.tsCovers data shaping, instruction naming, status, and cluster outcomes.
app/…/get-tx.spec.tsCovers server-cluster URL selection and deadline forwarding for transaction fetches.
app/…/get-idl-names.spec.tsCovers bounded IDL lookup, duplicate handling, aborts, and failure isolation.
app/…/transaction-share.e2e.tsCovers live PNG output and page metadata from the crawler's point of view.
app/…/route.spec.tsCovers transaction image route validation, fallbacks, caching, and failures.
app/…/route.spec.tsCovers receipt image route validation and receipt failure mapping.