Introducing a new way to review your PRs.

Read the announcement

solana-foundation / solana-go

Go SDK library and RPC client for the Solana Blockchain

View on GitHub

26 documents · Updated Nov 16, 2026

docs / rpc-transaction-introspection

RPC-backed transaction introspection

RPC-backed transaction introspection turns node transaction responses into the same instruction view used for local inspection. It accepts full transaction records from transaction, block, subscription, and address-history flows, keeps the execution context from the response, and exposes top-level and inner activity in explorer order. See Transaction introspection for the wider model and Local transaction inspection for inspection of transaction values that do not come from RPC responses.

RPC transaction sources

RPC responses provide the transaction message and its execution metadata through several product-facing query shapes. The introspection boundary gives each shape one path into the common inspection flow, so callers can inspect a single confirmed transaction or a transaction embedded in a larger result.

Confirmed transaction lookup

The confirmed transaction lookup returns a slot, optional block time, a transaction value, a version, and transaction metadata. Client.GetTransaction can request a raw transaction encoding and a maximum supported version; WalkGetTransactionResult then converts that result into resolved instructions. A missing result means the node did not return a transaction to inspect.

References: rpc/getTransaction.go• L25-75 rpc/getTransaction.go• L79-91 introspection/rpc.go• L26-47

Block and address transaction records

Block results and block subscription notifications carry a transaction with metadata in the same shape as a confirmed lookup. Address-history results carry the same full transaction and metadata when the request uses full transaction details. WalkTransactionWithMeta and WalkTransactionForAddress map these records to the common instruction view without changing the source context.

References: rpc/types.go• L85-99 rpc/getTransactionsForAddress.go• L181-216 introspection/rpc.go• L49-86

Response encoding boundary

The node can return one transaction in several wire encodings. The RPC types retain either decoded bytes or the raw JSON value, and the introspection boundary accepts only forms that still contain the compiled message and raw instruction data needed for inspection.

Supported transaction encodings

Raw JSON, base58, base64, and base64 with zstd compression can supply inspection input. The RPC layer turns the binary forms into a transaction value and turns the JSON form into a transaction value before inspection. The result is independent of which supported encoding supplied it.

References: rpc/getTransaction.go• L45-54 rpc/getTransaction.go• L93-159 rpc/types.go• L388-467 introspection/rpc.go• L99-128

Parsed transaction boundary

The jsonParsed response is not an inspection input. Its instructions may contain decoded fields but do not preserve the raw instruction data required by the common inspection model. Callers must request a raw JSON or binary encoding instead; a response that only has account summaries or signatures also lacks a message and cannot be inspected.

References: introspection/introspection.go• L35-45 introspection/rpc.go• L99-128 introspection/rpc_test.go• L187-227

Transaction context

Instruction bytes alone do not explain how a transaction ran. RPC metadata supplies the address and execution context that lets introspection resolve account indexes, retain cross-program activity, and represent the transaction in the order a reader expects.

Version and lookup context

The response records the transaction version and the addresses loaded by versioned address lookups. Legacy, version 0, and version 1 transactions are supported. For a versioned transaction with unresolved lookups, meta.loadedAddresses is required; without it, account indexes cannot be mapped to public keys.

References: rpc/transaction_version.go• L5-25 rpc/types.go• L230-233 rpc/types.go• L270-278 introspection/rpc.go• L88-97 introspection/introspection.go• L277-301

Execution activity context

Transaction metadata carries inner instruction groups and their parent instruction indexes. The common walk uses that data to place each inner instruction after the top-level instruction that emitted it, while preserving program, account, data, and stack context. This also preserves the inner activity of a transaction that failed on chain when the node recorded it.

References: rpc/types.go• L235-310 introspection/introspection.go• L205-246 introspection/introspection.go• L249-274 introspection/rpc_test.go• L125-132

RPC inspection flow

The RPC path separates fetching from interpretation. A caller chooses a transaction source and a raw encoding, the RPC client decodes the node response, and the introspection adapter supplies the resulting message and metadata to the common walk.

This diagram shows how a node response becomes an instruction stream with account and execution context.

flowchart LR
    A[RPC query] --> B[Transaction response]
    B --> C{Raw JSON or binary encoding}
    C --> D[Decoded transaction message]
    B --> E[Transaction metadata]
    E --> F[Loaded addresses and inner instructions]
    D --> G[Common transaction walk]
    F --> G
    G --> H[Instructions in explorer order]

Inspection input contract

Each RPC adapter validates the presence of a transaction, checks the supported version, decodes the transaction, and passes its message with metadata to the common walk. The returned instructions implement the same inspection contract as locally supplied transactions, so downstream decoders can inspect program activity without depending on the original RPC response shape.

References: introspection/rpc.go• L26-86 introspection/doc.go• L15-45 introspection/introspection.go• L205-220

Change checklist

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

  • Keep every RPC transaction source aligned with the common raw-transaction encoding contract. A new response shape must still provide a compiled message and its metadata.
  • Keep supported RPC transaction versions aligned with the message versions accepted by the common walk and with the maxSupportedTransactionVersion request option.
  • Preserve meta.loadedAddresses and meta.innerInstructions when changing response decoding. Dropping either field can silently change account resolution or instruction order.
  • Keep the rejection of parsed-only and summary-only transaction details explicit. Those responses cannot provide the raw input required by downstream instruction decoders.

Important failure modes

TriggerConsequenceGuard
The request returns jsonParsed dataIntrospection stops because raw instruction data is not availableRequest json, base58, base64, or base64+zstd
The response uses transaction details such as accounts or signatures onlyNo message exists to inspectRequest full transaction details
A version 0 transaction lacks loaded lookup addressesAccount indexes cannot resolve to the correct public keysRetain meta.loadedAddresses or resolve the message before walking it
The response reports a version other than legacy, 0, or 1The adapter rejects the transaction as unsupportedSet and honor the RPC maximum supported version
Metadata has no recorded inner instructionsThe result contains only top-level instructionsTreat the result as incomplete execution activity rather than as evidence that no inner activity occurred

Key files

FileWhy to read it
introspection/rpc.goDefines the RPC response adapters and their shared encoding and version boundary.
introspection/introspection.goDefines how message accounts and RPC metadata become the ordered instruction view.
rpc/getTransaction.goShows the single-transaction request options and response envelope.
rpc/types.goDefines transaction metadata, loaded addresses, inner instructions, and response data encodings.
rpc/getTransactionsForAddress.goDefines the full transaction record returned by address-history queries.
introspection/rpc_test.goShows that supported encodings produce the same inspection result and records the important rejection cases.