eth_getBlockByNumber
The eth_getBlockByNumber method returns information about a block by block number. This method retrieves detailed block data including transactions, gas used, timestamp, and other metadata.
You can choose to receive full transaction objects or just transaction hashes, making it flexible for different use cases from block explorers to lightweight blockchain monitoring applications. Developers use this to analyze block contents, track blockchain progress, extract transaction data, monitor gas usage patterns, and build blockchain analytics. The method is essential for any application that needs to process blocks sequentially or retrieve historical block information.
Parameters
parameter | type | description |
|---|---|---|
blockParameter | string (required) | Block number in hex format (e.g., '0x10d4f') or one of the string tags: 'latest' for the most recent block, 'earliest' for the genesis block, or 'pending' for pending state/transactions |
fullTransactions | boolean (required) | If true, returns full transaction objects with all fields; if false, returns only an array of transaction hashes for better performance |
Return Object
The method returns a block object, or null if the block is not found:
field | type | description |
|---|---|---|
number | string | The block number encoded as hexadecimal |
hash | string | Hash of the block (32 bytes), null for pending blocks |
parentHash | string | Hash of the parent block (32 bytes) |
nonce | string | Hash of the generated proof-of-work, null for PoS blocks (8 bytes) |
sha3Uncles | string | SHA3 of the uncles data in the block (32 bytes) |
logsBloom | string | The bloom filter for the logs of the block (256 bytes) |
transactionsRoot | string | The root of the transaction trie of the block (32 bytes) |
stateRoot | string | The root of the final state trie of the block (32 bytes) |
receiptsRoot | string | The root of the receipts trie of the block (32 bytes) |
miner | string | The address of the beneficiary to whom the mining/validation rewards were given (20 bytes) |
difficulty | string | Integer of the difficulty for this block (hex), 0 for PoS |
totalDifficulty | string | Integer of the total difficulty of the chain until this block (hex) |
extraData | string | The extra data field of this block (max 32 bytes) |
size | string | The size of this block in bytes (hex) |
gasLimit | string | The maximum gas allowed in this block (hex) |
gasUsed | string | The total gas used by all transactions in this block (hex) |
timestamp | string | The unix timestamp for when the block was collated (hex) |
transactions | array | Array of transaction objects (if fullTransactions=true) or array of transaction hashes (if fullTransactions=false) |
uncles | array | Array of uncle hashes (32 bytes each) |
baseFeePerGas | string | The base fee per gas for this block (hex), introduced in EIP-1559 |
Request Example
Request
Response Example
Response