TheDocumentation Index
Fetch the complete documentation index at: https://helius-codex-token-transfer-filter-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
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.
Common Use Cases
- Transaction Verification: Confirming that a transaction has been processed and checking its outcome (success or failure).
- Transaction History Display: Showing users the details of their past transactions in a wallet or explorer.
- Auditing and Analysis: Examining the specifics of a transaction, including instructions executed, fees paid, and accounts involved.
- Debugging Failed Transactions: Inspecting
logMessagesanderrfields in the metadata to understand why a transaction failed. - Data Indexing: Extracting specific information from transactions for off-chain storage and analysis.
Request Parameters
-
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 thetransactiondata. 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.- Defaults to
"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.- Set to
0to include versioned transactions (including legacy). - If omitted, some nodes might only return legacy transactions or error if versioned transactions are encountered. It is highly recommended to set this to
0to support all transaction types.
- Set to
Response Structure
The method returnsnull 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 benullif not available.meta(object | null): An object containing metadata about the transaction’s execution. Can benullif the transaction failed before being processed or if metadata is unavailable.err(object | null): An error object if the transaction failed, otherwisenull.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. Containswritableandreadonlyarrays of public keys.returnData(object, optional): Data returned by the transaction viasol_set_return_dataandsol_get_return_data. ContainsprogramId(string) anddata(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 theencodingparameter:- If
encodingis"jsonParsed"or"json": An object withmessage(containingaccountKeys,instructions,recentBlockhash, etc.) andsignatures(array of strings). - If
encodingis"base58","base64": An array[encoded_string, encoding_format_string].
- If
version(“legacy” | number | undefined): The version of the transaction. Can be"legacy"for older transactions or a number (e.g.,0) for versioned transactions.undefinedifmaxSupportedTransactionVersionis not set and the transaction is versioned.
jsonParsed encoding):
Code Examples
Developer Tips
- Transaction Finality: Ensure you query with an appropriate
commitmentlevel. Requesting a transaction that hasn’t reached the specified commitment will result innull. - Data Volume: The response object can be very large, especially for complex transactions with many instructions or detailed logging. Be mindful of this when processing the data.
jsonParsedvs.json: WhilejsonParsedis 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 withjsonParsed.- Versioned Transactions: Always set
maxSupportedTransactionVersion: 0in 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. - RPC Provider Differences: While the core API is standard, some RPC providers might offer enhanced parsing or additional fields. Helius, for example, provides rich transaction parsing.
getTransaction RPC method, empowering you to fetch and understand detailed Solana transaction data.