Blocks & Slots
getBlock
Returns identity and transaction information about a confirmed block
Parameters
The slot number of the block to retrieve
Configuration object containing the following optional fields:
Response
Returns null
if the block is not found. Otherwise, returns an object containing:
Code Examples
Basic Request
Request with Parsed Transaction Data
Using web3.js
Notes
- Block production time is an estimate based on genesis block time and slots elapsed.
- Not all blocks include rewards.
- The
jsonParsed
encoding attempts to parse transaction instruction data based on known program layouts. - Some blocks might be skipped (no leader assigned or failed block production).
- Block data may be pruned from the node based on ledger configuration.
Best Practices
- Use
transactionDetails: "signatures"
if you only need transaction signatures. - Set
rewards: false
if reward data is not needed. - Consider using
getBlockHeight
first if you need the latest block. - For real-time updates, consider using websocket subscription instead.
Common Errors
Code | Message | Solution |
---|---|---|
-32004 | Block not available for slot | The block was pruned or skipped |
-32602 | Invalid param: WrongSize | Verify the slot number is valid |
-32602 | Invalid param: Too large | Request a more recent block |
-32009 | Transaction version unsupported | Specify maxSupportedTransactionVersion |