eth_getHeaderByHash
JSON-RPC method returns the block header information for a given block hash. This method provides header data without the transaction list, offering a lightweight way to access block metadata when you have the specific block hash.
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
- block_hash (string) — The hash of the block as a hexadecimal string
Response
The method returns block header information ornull
if the block doesn’t exist.
Response structure
Block header fields:hash
— The block hash (matches the input parameter)parentHash
— Hash of the parent blocknumber
— The block numbertimestamp
— The unix timestamp when the block was collatedgasLimit
— The maximum gas allowed in this blockgasUsed
— The total gas used by all transactions in this blockdifficulty
— The difficulty for this blocktotalDifficulty
— The total difficulty of the chain until this blockminer
— The address of the beneficiary to whom the mining rewards were givennonce
— The nonce used to generate this blocksha3Uncles
— SHA3 of the uncles data in the blocklogsBloom
— The bloom filter for the logs of the blocktransactionsRoot
— The root of the transaction trie of the blockstateRoot
— The root of the final state trie of the blockreceiptsRoot
— The root of the receipts trie of the block
Hash validation
Block hash format:- Must be a valid 32-byte hexadecimal string with “0x” prefix
- Example: “0x2ce91ae0ed242b4b78b432a45b982fb81a414d6b04167762ed3c7446710a4b8e”
- Returns
null
if the hash doesn’t correspond to any existing block
Usage example
Basic implementation
Example request
Shell
Use cases
Theeth_getHeaderByHash
method is useful for applications that need to:
- Block validation: Validate specific blocks by hash without downloading transaction data
- Chain analysis: Analyze blockchain structure and block relationships
- Block verification: Verify block integrity and metadata
- Ancestry tracking: Track parent-child relationships between blocks
- Fork detection: Detect and analyze blockchain forks
- Block comparison: Compare metadata between different blocks
- Historical analysis: Analyze historical block data efficiently
- Mining analytics: Analyze mining patterns and block characteristics
- Network forensics: Investigate specific blocks in network analysis
- Block explorers: Provide detailed block information by hash
- Audit tools: Build blockchain audit tools with block verification
- Chain synchronization: Implement selective chain synchronization
- Performance analysis: Analyze block timing and gas usage patterns
- Security analysis: Analyze suspicious or specific blocks
- Research tools: Support blockchain research with block-level data
Body
application/json