Learn getTransaction use cases, code examples, request parameters, response structure, and tips.
getTransaction
RPC method allows you to retrieve detailed information about a confirmed transaction by providing its signature. This includes the transaction’s slot, block time, metadata (like fees, status, and balance changes), and the transaction structure itself.
logMessages
and err
fields in the metadata to understand why a transaction failed.transactionSignature
(string, required): The base-58 encoded transaction signature you want to query.
options
(object, optional): An optional configuration object that can include:
commitment
(string, optional): Specifies the commitment level (e.g., "finalized"
, "confirmed"
). If not provided, the node’s default commitment is used (usually "finalized"
).encoding
(string, optional): The encoding for the transaction
data. Common values:
"json"
: Returns the transaction data in a structured JSON format (but instructions might still be base64 encoded)."jsonParsed"
: Returns the transaction data with program-specific instructions parsed into a human-readable JSON structure where possible. This is often the most useful encoding for analysis."base58"
: Returns the transaction data as a base-58 encoded string."base64"
: Returns the transaction data as a base-64 encoded string."json"
if not specified by Helius, but Solana default might be different. It’s best to specify this.maxSupportedTransactionVersion
(number, optional): The maximum transaction version the RPC endpoint should process.
0
to include versioned transactions (including legacy).0
to support all transaction types.null
if the transaction is not found (e.g., not yet processed or signature is incorrect) or not confirmed to the specified commitment level. Otherwise, it returns an object with the following fields:
slot
(u64): The slot number in which the transaction was included in a block.blockTime
(i64 | null): The estimated Unix timestamp (seconds since epoch) when the block containing the transaction was produced. Can be null
if not available.meta
(object | null): An object containing metadata about the transaction’s execution. Can be null
if the transaction failed before being processed or if metadata is unavailable.
err
(object | null): An error object if the transaction failed, otherwise null
.fee
(u64): The fee in lamports paid for the transaction.preBalances
(array of u64): Lamport balances of accounts involved before the transaction was processed.postBalances
(array of u64): Lamport balances of accounts involved after the transaction was processed.preTokenBalances
(array of objects | null): Token balances of token accounts involved before the transaction.postTokenBalances
(array of objects | null): Token balances of token accounts involved after the transaction.innerInstructions
(array of objects | null): An array of instructions executed as part of CPI (Cross-Program Invocations) within this transaction.logMessages
(array of string | null): An array of log messages emitted by the transaction’s instructions and any inner instructions.loadedAddresses
(object, optional): Specifies the accounts loaded from address lookup tables for this transaction. Contains writable
and readonly
arrays of public keys.returnData
(object, optional): Data returned by the transaction via sol_set_return_data
and sol_get_return_data
. Contains programId
(string) and data
(array: [string, encoding]
).computeUnitsConsumed
(u64, optional): The number of compute units consumed by this transaction.transaction
(object | array): The transaction structure itself. The format depends on the encoding
parameter:
encoding
is "jsonParsed"
or "json"
: An object with message
(containing accountKeys
, instructions
, recentBlockhash
, etc.) and signatures
(array of strings).encoding
is "base58"
, "base64"
: An array [encoded_string, encoding_format_string]
.version
(“legacy” | number | undefined): The version of the transaction. Can be "legacy"
for older transactions or a number (e.g., 0
) for versioned transactions. undefined
if maxSupportedTransactionVersion
is not set and the transaction is versioned.jsonParsed
encoding):
commitment
level. Requesting a transaction that hasn’t reached the specified commitment will result in null
.jsonParsed
vs. json
: While jsonParsed
is very convenient, parsing support depends on the RPC node’s capabilities for specific programs. If a program is not recognized, its instructions might fall back to a less parsed format even with jsonParsed
.maxSupportedTransactionVersion: 0
in your request options to ensure your application can handle both legacy and versioned transactions. Otherwise, you might miss data or encounter errors for newer transaction formats.getTransaction
RPC method, empowering you to fetch and understand detailed Solana transaction data.