getBlock
The getBlock method returns comprehensive identity and transaction information about a confirmed block in the Solana ledger. This method is essential for block explorers, analytics platforms, and applications that need to process or analyze historical blockchain data at the block level.
Solana's block structure differs from traditional blockchain blocks. Each block contains all transactions that were processed during a specific slot, which is a fixed time period during which a designated leader validator produces blocks. Blocks include detailed information about all transactions, their status, fees consumed, compute units used, and the accounts involved. This method provides access to complete block data including pre and post token balances, inner instructions from program invocations, and detailed transaction metadata.
The method offers multiple encoding options and transaction detail levels, allowing you to optimize for your specific use case. You can retrieve full transaction details with all signatures and account keys, or request minimal information for lighter responses. The rewards data included in blocks shows validator and staker compensation for that slot, which is valuable for staking analytics and validator performance tracking.
Parameters
parameter | type | description |
|---|---|---|
slot | number | The slot number of the block to retrieve |
config | object | Optional configuration object |
config.commitment | string | Level of commitment: 'confirmed' or 'finalized' (default: 'finalized'). 'processed' is not supported |
config.encoding | string | Encoding for transaction data: 'json', 'jsonParsed', 'base58' (slow), 'base64' (default: 'json') |
config.transactionDetails | string | Level of transaction detail: 'full', 'accounts', 'signatures', or 'none' (default: 'full') |
config.rewards | boolean | Whether to populate the rewards array (default: true) |
config.maxSupportedTransactionVersion | number | Set to 0 to include versioned transactions. Omitting will exclude all versioned transactions |
Return Object
field | type | description |
|---|---|---|
blockhash | string | The blockhash of this block, as base-58 encoded string |
previousBlockhash | string | The blockhash of this block's parent, as base-58 encoded string |
parentSlot | number | The slot index of this block's parent |
blockTime | number | Estimated production time as Unix timestamp (seconds since epoch). Null if not available |
blockHeight | number | The number of blocks beneath this block |
transactions | array | Array of transaction objects. Format depends on transactionDetails and encoding parameters |
rewards | array | Block rewards for validators and stakers. Each entry includes pubkey, lamports, postBalance, rewardType, and commission |
signatures | array | Array of transaction signatures as base-58 encoded strings (only if transactionDetails is not 'none') |
Request Example
Response Example
Tip: Use transactionDetails: 'signatures' when you only need transaction signatures for lighter responses. Set maxSupportedTransactionVersion: 0 to include versioned transactions. Historical blocks may not be available on all RPC nodes due to ledger pruning.