Solana Tracker
Solana RPC/Methods

getBlock RPC Method

Description

Returns identity and transaction information about a confirmed block in the ledger.

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

  1. slot (integer) - The slot number of the block to retrieve, encoded as a u64 (64-bit unsigned integer).
  2. object (array) - The configuration object with the following fields:
    • encoding (string, optional) - The encoding format for account data. Options: base58 (slow), json, base64, base64+zstd, or jsonParsed.
    • transactionDetails (string, optional) - (default: full) The level of transaction detail to return. Options: full, accounts, signatures, or none.
    • rewards (boolean, optional) - (default: false) Whether to include reward information in the block response.
    • commitment (string, optional) - The level of commitment required for the query. Options:
      • 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 the supermajority of the cluster.
      • processed - Not supported for this method.
    • maxSupportedTransactionVersion (integer, 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 omitted, only legacy transactions are returned, and versioned transactions prompt an error. Use 0 for versioned transactions or omit for legacy only.

Returns

  • result - null if the specified block is not confirmed; otherwise, an 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). null if not available.
    • blockhash - The hash of the block, encoded as a base-58 string.
    • parentSlot - The slot index of this block’s parent.
    • previousBlockhash - The blockhash of this block’s parent, encoded as a base-58 string. Returns 11111111111111111111111111111111 if the parent block is unavailable due to ledger cleanup.
    • transactions - Present if full transaction details are requested; an array of JSON objects with:
      • meta - Transaction status metadata (can be null):
        • err - Error code if the transaction failed, or null if it succeeds.
        • fee - Total fees paid, encoded as a u64 integer.
        • innerInstructions - Array of inner instructions (omitted if not enabled).
        • logMessages - Array of log messages (omitted if not enabled).
        • postBalances - Array of lamport balances after processing.
        • postTokenBalances - Array of token balances after processing (omitted if not enabled).
        • preBalances - Array of lamport balances before processing.
        • preTokenBalances - Array of token balances before processing (omitted if not enabled).
        • rewards - Reward information (if requested):
          • pubkey - Public key of the rewarded account, encoded as base-58.
          • lamports - Number of reward lamports credited or debited.
          • postBalance - Account balance in lamports after reward.
          • rewardType - Type of reward (fee, rent, voting, staking).
          • commission - Vote account commission for voting/staking rewards.
      • transaction - Transaction object (format depends on encoding):
        • message - Array of transactions:
          • accountKeys - Array of public keys accessed:
            • pubkey - Public key of the block producer.
            • signer - Indicates if the key signed the transaction.
            • source - Identifies accounts providing funds.
            • writable - Boolean indicating if the account was modified.
          • instructions - Array of executed instructions:
            • parsed - Parsed instruction details:
              • info - Additional transaction details:
                • clockSysvar - Blockchain state information.
                • slotHashesSysvar - Recent slot hashes.
                • vote - Vote accounts involved:
                  • hash - Block hash.
                  • slots - Slot numbers.
                  • timestamp - Unix timestamp of block creation.
                • voteAccount - Validator’s vote account.
                • voteAuthority - Authority for the vote account.
              • type - Block type.
            • program - Program data.
            • programId - Public key of the executed program.
            • stackHeight - Execution stack depth.
          • recentBlockhash - Recent block hash for the cluster.
        • signatures - List of transaction signatures.
        • version - Transaction version (undefined if maxSupportedTransactionVersion is not set).

Code Examples

curl "https://rpc-mainnet.solanatracker.io/?api_key=YOUR_API_KEY_HERE" \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc": "2.0","id":1,"method":"getBlock","params":[317175212, {"encoding": "json","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}]}'

On this page