getTransaction
The getTransaction method returns detailed information about a confirmed transaction by its signature. This is one of the most important methods for transaction analysis, providing complete details about what happened in a transaction including all instructions, account changes, logs, and results.
Transactions are the fundamental unit of state change in Solana. Each transaction contains one or more instructions that invoke programs to perform operations like transfers, swaps, NFT mints, or custom program logic. This method retrieves the complete transaction data including the message structure, signatures, account balances before and after execution, compute units consumed, fees paid, logs generated by programs, and any errors that occurred.
This method is essential for transaction explorers, wallet transaction history views, analytics platforms, debugging tools, and any application that needs to understand or display transaction details. It provides the authoritative record of what happened on-chain, enabling reconstruction of state changes, verification of operations, and detailed analysis of program behavior.
Parameters
parameter | type | description |
|---|---|---|
signature | string | Transaction signature as base-58 encoded string |
config | object | Optional configuration object |
config.commitment | string | Level of commitment: 'confirmed' or 'finalized' (default: 'finalized') |
config.encoding | string | Encoding for transaction data: 'json', 'jsonParsed', 'base58' (slow), 'base64' (default: 'json') |
config.maxSupportedTransactionVersion | number | Set to 0 to include versioned transactions. Omitting will exclude all versioned transactions |
Return Object
field | type | description |
|---|---|---|
slot | number | The slot in which the transaction was processed |
transaction | object | Transaction object with message and signatures |
blockTime | number|null | Estimated production time as Unix timestamp |
meta | object | Transaction metadata including status, fees, and account changes |
meta.err | object|null | Error if transaction failed, null if successful |
meta.fee | number | Fee paid by the transaction in lamports |
meta.preBalances | array | Array of account lamport balances before execution |
meta.postBalances | array | Array of account lamport balances after execution |
meta.innerInstructions | array | Inner instructions from cross-program invocations |
meta.preTokenBalances | array | Token balances before execution |
meta.postTokenBalances | array | Token balances after execution |
meta.logMessages | array | Array of log messages generated during execution |
meta.rewards | array | Rewards earned in this transaction, if any |
version | string|number | Transaction version: 'legacy' or number for versioned transactions |
Request Example
Response Example
Tip: Use jsonParsed encoding for human-readable instruction data where available. Set maxSupportedTransactionVersion: 0 to handle versioned transactions. Check meta.err - null means success. logMessages are invaluable for debugging. Historical transactions may not be available on nodes with limited ledger retention.