AptosAptos Network's breakthrough technology and seamless user experience are now available on QuickNode.

Start building today!     

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.

Parameters:

  1. tx_sig - string - The transaction signature as base-58 encoded string
  2. object - (optional) The configuration object with the following fields:

    Commitment - string - (optional) The level of commitment required for the query. The options include:

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

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

    Processed - string - The node will query its most recent block. Note that the block may not be complete

    maxSupportedTransactionVersion - boolean - (optional) The maximum 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

Returns:

  1. result - Null if the specified block is not confirmed otherwise RpcResponse JSON object with the following fields:

    blockTime - The estimated production time, as Unix timestamp (seconds since the Unix epoch). It's null if not available

    meta - The transaction status metadata object, which contains additional information about the block and its transactions. The meta object can be null, or it may contain the following fields:

    err - Error code if the transaction failed or null if the transaction succeeds

    fee - The total fees paid by all transactions in the block encoded as u64 integer

    innerInstructions - An array of objects representing the inner instructions of all transactions in the block (omitted if inner instruction recording is not enabled). Each object has the following fields:

    index - The index of the instruction in the transaction, which determines the order in which the operations were executed

    instructions - An array of instructions that were executed in the block's transactions

    parsed - An array of parsed instructions that were executed in the block's transactions

    info - An array of information objects that provide additional details about the transactions in the block

    lamports - The number of lamports assigned to this account as u64 (64-bit unsigned integer)

    newAccount - The new account created as part of the transaction

    owner - The base-58 encoded Pubkey of the program this account has been assigned to

    source - The source account that funded the transaction

    space - The amount of storage space required to store a specific transaction

    type - The type of the block. It can be used to differentiate between regular blocks and special blocks such as snapshot or transaction confirmation blocks

    program - The data associated with the program that was executed in the block's transactions

    programId - The ID of the program that executed the instruction

    logMessages - An array of strings containing any log messages generated by the block's transactions (omitted if inner instruction recording is not enabled)

    postBalances - An array of lamport balances for each account in the block after the transactions were processed

    postTokenBalances - An array of token balances for each token account in the block after the transactions were processed (omitted if inner instruction recording is not enabled)

    accountIndex - The index of an account within a transaction

    mint - Provides information about the creation of new tokens

    owner - The base-58 encoded Pubkey of the program this account has been assigned to

    uiTokenAmount - The amount of a token transfer in a human-readable format

    amount - The amount of a token transfer

    decimals - The number of decimal places used by the token

    uiAmount - The amount of a token transfer in the smallest unit of the token

    uiAmountString - The amount of a token transfer as a string with the appropriate number of decimal places for the token

    preBalances - An array of lamport balances for each account in the block before the transactions were processed

    preTokenBalances - An array of token balances for each token account in the block before the transactions were processed (omitted if inner instruction recording is not enabled)

    accountIndex - The index of an account within a transaction

    mint - Provides information about the creation of new tokens

    owner - The base-58 encoded Pubkey of the program this account has been assigned to

    uiTokenAmount - The amount of a token transfer in a human-readable format

    amount - The amount of a token transfer

    decimals - The number of decimal places used by the token

    uiAmount - The amount of a token transfer in the smallest unit of the token

    uiAmountString - The amount of a token transfer as a string with the appropriate number of decimal places for the token

    rewards - An object containing information about the rewards earned by the block's validators (only present if the rewards are requested). It has the following fields:

    status - The status of the transaction. If the transaction was successful, returns Ok and if the transaction failed with TransactionError, returns Err

    slot - The slot number to retrieve block production information

    transaction - The transaction object. It could be either JSON format or encoded binary data, depending on the encoding parameter

    message - An array of transactions included in the block

    accountKeys - An array of public keys associated with the accounts that were accessed during the execution of transactions in the block

    pubkey - The Pubkey of program encoded as base-58 string

    signer - Used to sign transactions in the block. Also used to identify the signers involved in the block's transactions and to verify the authenticity of the signatures

    source - The source account that funded the transaction

    writable - A boolean value that indicates whether the accounts associated with the given public keys were modified by the transactions or not

    addressTableLookups - An array of address lookups that were performed during the execution of transactions in the block

    instructions - An array of instructions that were executed in the block's transactions

    parsed - An array of parsed instructions that were executed in the block's transactions

    info - An array of information objects that provide additional details about the transactions in the block

    account - An address on the Solana blockchain that is used to store assets

    mint - Provides information about the creation of new tokens

    source - The source account that funded the transaction

    systemProgram - The system program that executed the transaction

    tokenProgram - Responsible for maintaining the supply and balance of the token, and for executing transfers of the token between accounts

    wallet - Wallet is used for managing and storing assets

    type - The type of the block. It can be used to differentiate between regular blocks and special blocks such as snapshot or transaction confirmation blocks

    program - The data associated with the program that was executed in the block's transactions

    programId - The ID of the program that executed the instruction

    recentBlockhash - The recent block hash for the account's cluster

    signatures - The list of transaction signatures contained within a particular block

    version - The transaction version. It's undefined if maxSupportedTransactionVersion is not set in the requested parameters

Code Examples:

require "uri"
require "json"
require "net/http"

url = URI("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTransaction",
  "params": [
    "D13jTJYXoQBcRY9AfT5xRtsew7ENgCkNs6mwwwAcUCp4ZZCEM7YwZ7en4tVsoDa7Gu75Jjj2FgLXNUz8Zmgedff",
    {
      "encoding": "jsonParsed",
      "maxSupportedTransactionVersion": 0
    }
  ]
})

response = https.request(request)
puts response.read_body
Ready to get started? Create a free account