eth_getBlockByNumber
JSON-RPC method returns information about a block by its number. This method is essential for retrieving block data when you know the block number, commonly used for sequential block processing, blockchain synchronization, and historical data analysis.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
The method takes two parameters:- Block number - The number of the block to retrieve
- Full transaction objects - Whether to return full transaction objects or just hashes
Parameter details
blockNumber
(string, required) — Block identifier:"latest"
,"earliest"
,"pending"
, or a specific block number in hexadecimalfullTransactionObjects
(boolean, required) — Iftrue
, returns full transaction objects; iffalse
, returns only transaction hashes
Response
The method returns detailed information about the specified block, ornull
if the block is not found.
Response structure
Block object:number
— Block number as a hexadecimal stringhash
— The 32-byte hash of the blockparentHash
— Hash of the parent blocktimestamp
— Block timestamp as a Unix timestamp in hexadecimalgasLimit
— Maximum gas allowed in this blockgasUsed
— Total gas used by all transactions in the blocktransactions
— Array of transaction hashes or full transaction objectsminer
— Address of the block miner/validatordifficulty
— Block difficulty (may be 0 for some consensus mechanisms)totalDifficulty
— Total difficulty of the chain until this blocksize
— Block size in bytes as a hexadecimal stringextraData
— Extra data field of the blocknonce
— Block nonce (if applicable)receiptsRoot
— Root hash of the receipts triestateRoot
— Root hash of the state trietransactionsRoot
— Root hash of the transactions trie
Block number formats
Special identifiers:"latest"
— Most recent block"earliest"
— Genesis block (block 0)"pending"
— Pending block being mined
"0x0"
— Genesis block"0x1"
— Block 1"0x9d0c37"
— Block 10,291,255 (decimal)
Hyperliquid-specific considerations
System transactions
HyperCore transactions:- Blocks may contain system transactions that originate from HyperCore
- Use
eth_getSystemTxsByBlockNumber
to retrieve system transactions specifically - System transactions are separate from regular user transactions
- Important for complete block analysis and understanding network activity
Block processing
Sequential access:- Process blocks sequentially for complete chain analysis
- Handle missing blocks gracefully in case of gaps
- Use block numbers for efficient sequential processing
- Track last processed block for incremental updates
"latest"
— Most recent block"earliest"
— Genesis block (block 0)"0x1a4"
— Specific block number in hexadecimal (420 in decimal)
Example request
Shell
Use cases
Theeth_getBlockByNumber
method is essential for applications that need to:
- Blockchain synchronization: Download and process blocks sequentially
- Block explorers: Display block information and enable navigation
- Analytics platforms: Collect block data for network analysis
- Transaction monitoring: Track transactions within specific blocks
- Historical analysis: Study past blockchain states and events
- Audit systems: Verify blockchain integrity and transaction history
- Development tools: Debug and test blockchain applications
- System transaction analysis: Analyze both regular and HyperCore system transactions
- Network monitoring: Track block production and network health
- Integration services: Provide block data to external systems
Block numbers are sequential. If a block number doesn’t exist (e.g., future block), the method returns
null
. On Hyperliquid, blocks may contain system transactions from HyperCore - use eth_getSystemTxsByBlockNumber
to retrieve these separately.Body
application/json
JSON-RPC version
Available options:
2.0
The RPC method name
Available options:
eth_getBlockByNumber
Parameters: [blockNumber, fullTransactionObjects]
Request identifier