Skip to main content
TypeScript-first: In Zig, build these JSON-RPC payloads with std.json and POST with std.http.Client. Quantities are hex strings; parse with std.fmt.parseInt after trimming 0x.

Block Methods

8 methods for querying block data, receipts, and transaction counts.

Overview

Block methods provide access to block headers, full blocks, transaction receipts, and metadata. Use these methods to query blockchain state at specific block heights or hashes.

Methods

Get the most recent block number.Returns: Quantity
// {"method":"eth_blockNumber","params":[]}
Get block by number with full transactions or hashes.Parameters:
ParameterTypeDescription
blockTagBlockTagBlock to query ('latest', 'earliest', 'pending', or block number)
fullTransactionsbooleantrue for full tx objects, false for hashes only
Returns: Block
// {"method":"eth_getBlockByNumber","params":["latest",true]}
Get block by hash with full transactions or hashes.Parameters:
ParameterTypeDescription
blockHashHashBlock hash to query
fullTransactionsbooleantrue for full tx objects, false for hashes only
Returns: Block
// {"method":"eth_getBlockByHash","params":["0xBLOCK_HASH",false]}
Get all transaction receipts for a block.Parameters:
ParameterTypeDescription
blockTagBlockTagBlock to query
Returns: TransactionReceipt[]
// {"method":"eth_getBlockReceipts","params":["latest"]}
Get transaction count in a block by hash.Parameters:
ParameterTypeDescription
blockHashHashBlock hash to query
Returns: Quantity
// {"method":"eth_getBlockTransactionCountByHash","params":["0xBLOCK_HASH"]}
Get transaction count in a block by number.Parameters:
ParameterTypeDescription
blockTagBlockTagBlock to query
Returns: Quantity
// {"method":"eth_getBlockTransactionCountByNumber","params":["latest"]}
Get uncle count for a block by hash.Parameters:
ParameterTypeDescription
blockHashHashBlock hash to query
Returns: Quantity
// {"method":"eth_getUncleCountByBlockHash","params":["0xBLOCK_HASH"]}
Uncle blocks were removed in Ethereum’s transition to Proof of Stake (The Merge). This method returns 0 for post-merge blocks.
Get uncle count for a block by number.Parameters:
ParameterTypeDescription
blockTagBlockTagBlock to query
Returns: Quantity
// {"method":"eth_getUncleCountByBlockNumber","params":["latest"]}
Uncle blocks were removed in Ethereum’s transition to Proof of Stake (The Merge). This method returns 0 for post-merge blocks.

Usage Patterns

Get Latest Block with Transactions

// {"method":"eth_getBlockByNumber","params":["latest",true]}
// Then: {"method":"eth_getBlockReceipts","params":["latest"]}
// Sum receipt.gasUsed (hex) after parsing

Query Historical Block

// {"method":"eth_getBlockByNumber","params":["0x112A880",false]}
// {"method":"eth_getBlockTransactionCountByNumber","params":["0x112A880"]}

Check Block Finality

// Parallel requests to eth_getBlockByNumber for 'latest' and 'finalized'
// Compute difference between hex numbers after parsing