Marketplace has launched, further enabling blockchain developers! Learn more

Contents

getTransaction RPC method

The API credit value for this method is 7 . To learn more about API credits and each method's value, visit the API Credits page.

Though getTransaction is supported, Solana Foundation recommends using jsonParsed encoding because it includes all transaction account keys (including those from Lookup Tables). To do this with JavaScript, please refer to the getParsedTransaction RPC method.

Parameters:

tx_sig - transaction signature as base-58 encoded string.

object - (optional) Configuration object containing the following optional fields:

encoding - encoding for each returned Transaction, either "json", "jsonParsed", "base58" (slow), "base64". If parameter not provided, the default encoding is "json".

Commitment - (optional) "processed" is not supported. If parameter not provided, the default is "finalized".

Finalized - the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.

Confirmed - the node will query the most recent block that has been voted on by supermajority of the cluster.

Processed - not supported

maxSupportedTransactionVersion (optional) set the max transaction version to return in responses. If the requested block contains a transaction with a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and a block containing any versioned transaction will prompt an error.

legacy - older transaction format with no additional benefit (default value).

0 - added support for Address Lookup Tables.

Returns:

Result - The result field will be an object with the following fields:

null - if specified transaction is not confirmed.

Object - if transaction is confirmed, an object with the following fields:

slot - the slot this transaction was processed in.

transaction - Transaction object, either in JSON format or encoded binary data, depending on encoding parameter.

blockTime - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available.

meta - transaction status metadata object, containing null or:

err - Error if transaction failed, null if transaction succeeded.

fee - fee this transaction was charged, as u64 integer.

preBalances - array of u64 account balances from before the transaction was processed.

postBalances - array of u64 account balances after the transaction was processed.

innerInstructions - List of inner instructions or omitted if inner instruction recording was not yet enabled during this transaction.

preTokenBalances - List of token balances from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction.

postTokenBalances - List of token balances from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction.

logMessages - array of string log messages or omitted if log message recording was not yet enabled during this transaction.

rewards - present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block.

pubkey - The public key, as base-58 encoded string, of the account that received the reward.

lamports - Number of reward lamports credited or debited by the account, as an i64.

postBalance - Account balance in lamports after the reward was applied

rewardType - Type of reward: currently only "rent", other types may be added in the future

commission - Vote account commission when the reward was credited, only present for voting and staking rewards

loadedAddresses - Transaction addresses loaded from address lookup tables. Undefined if maxSupportedTransactionVersion is not set in request params.

writable - Ordered list of base-58 encoded addresses for writable loaded accounts.

readonly - Ordered list of base-58 encoded addresses for readonly loaded accounts.

version - Transaction version. Undefined if maxSupportedTransactionVersion is not set in request params.

Code Examples:

from solana.rpc.api import Client
from solders.signature import Signature
solana_client = Client("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/")
sig = Signature.from_string("D13jTJYXoQBcRY9AfT5xRtsew7ENgCkNs6mwwwAcUCp4ZZCEM7YwZ7en4tVsoDa7Gu75Jjj2FgLXNUz8Zmgedff")
print(solana_client.get_transaction(sig, "jsonParsed", max_supported_transaction_version=0))
Ready to get started? Create a free account