getBlock

Returns identity and transaction information about a confirmed block with the specified slot.

📘

Note on usage of getBlock

Though getBlock 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 getParsedBlock RPC method.

Parameters

  • slot: integer

    • The slot number of the block to retrieve encoded as u64 (64-bit unsigned integer) integer.
  • object: array

    • The configuration object with the following fields:
      • encoding: string
        • The encoding format for account data. It can be one of base58 (slow), base64, base64+zstd or jsonParsed.
      • transactionDetails: string (default: full)
        • The level of transaction detail to return. It could be full, accounts, signatures, or none.
      • rewards: boolean (default: false)
        • A boolean flag that indicates whether to include reward information in the block response.
      • commitment: string
        • The level of commitment required for the query. The options include:
          • finalized: 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: The node will query the most recent block that has been voted on by supermajority of the cluster.
          • processed: It is not supported for this method.
      • maxSupportedTransactionVersion: boolean
        • 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.
      • legacy: boolean
        • The older transaction format with no additional benefit.
      • 0: boolean
        • The additional support for Address Lookup Tables.

Returns

  • result: Null if the specified block is not confirmed, otherwise RpcResponse JSON object with the following fields:
    • blockHeight: The number of blocks beneath this block.
    • blockTime: The estimated production time, as Unix timestamp (seconds since the Unix epoch). It's null if not available.
    • blockhash: The hash of the block encoded as base-58 string.
    • parentSlot: The slot index of this block's parent.
    • previousBlockhash: The blockhash of this block's parent encoded as base-58 string; if the parent block is not available due to ledger cleanup, the field will return 11111111111111111111111111111111.
    • transactions: It is present if full transaction details are requested; an array of JSON objects with the following fields:
      • 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:
          • 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).
          • 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).
      • 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:
        • pubkey: The public key of the account that received the award encoded as base-58 string.
        • lamports: The number of reward lamports credited or debited by the account.
        • postBalance: The account balance in lamports after the reward was applied.
        • rewardType: The type of reward. It could be fee, rent, voting, staking.
        • commission: The vote account commission when the reward was credited, only present for voting and staking rewards.
      • status: The status of the transaction. It returns Ok if the transaction was successful and Err if the transaction failed with TransactionError.
      • 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
Language
Authorization
Header
Click Try It! to start a request and see the response here!