Scroll

eth_getBlockByHash
The eth_getBlockByHash method returns comprehensive information about a specific block identified by its unique 32-byte hash. This powerful method provides access to all block properties including transactions, gas metrics, miner information, timestamps, and more, making it essential for blockchain explorers and data analysis.
Use Cases
- Block explorers and blockchain analytics platforms
- Transaction verification and historical analysis
- Network monitoring and performance metrics
- Smart contract deployments confirmation and tracking
- Historical data analysis and time-series research
- Consensus verification and chain reorganization detection
- Forensic blockchain analysis
- Cross-chain block verification
Method Details
This method retrieves detailed data about a specific block using its hash as the identifier, with options to include either complete transaction details or just transaction hashes.
Response Example
Key Block Properties Explained
- number: The block number in the chain (height)
- timestamp: Unix timestamp when the block was created (in seconds since epoch)
- transactions: List of transactions included in this block
- gasUsed/gasLimit: Actual gas consumed vs. maximum allowed
- baseFeePerGas: Base fee per gas unit introduced in EIP-1559
- miner: Address that received the block reward (validator in PoS)
- difficulty: Mining difficulty (always 0 after The Merge)
- totalDifficulty: Cumulative difficulty up to this block
- withdrawals: Validator withdrawals available post-Shanghai upgrade
Transaction Detail Flag
The second parameter determines how transaction data is returned:
false: Only transaction hashes are returned (more efficient for block scanning)true: Complete transaction objects are returned (useful when you need transaction details)
Practical Example
See also
- eth_getBlockByNumber - Retrieve block information using block number instead of hash
- eth_getTransactionByHash - Get detailed information about a transaction
- eth_getBlockTransactionCountByHash - Get the number of transactions in a block
- eth_getUncleByBlockHashAndIndex - Get information about uncle blocks
Parameters
The hash (32 bytes) of the block
If true, returns full transaction objects; if false, returns only transaction hashes