ChainHead
Current chain head information representing the latest block at the tip of the blockchain.Overview
ChainHead captures essential information about the latest block: number, hash, timestamp, and difficulty. Typically obtained from eth_getBlockByNumber(“latest”).Type Definition
Usage
Getting Chain Head
Post-Merge (PoS)
Post-merge blocks have zero difficulty:Pre-Merge (PoW)
Pre-merge blocks have non-zero difficulty:RPC Integration
eth_getBlockByNumber
Get latest block:eth_blockNumber
Get just the latest block number:Consensus Types
Proof of Stake (Post-Merge)
The Merge (September 15, 2022) transitioned Ethereum to PoS:- Block 15537394+ have
difficulty: 0 - No mining, validators propose blocks
- 12 second slot time
Proof of Work (Pre-Merge)
Pre-merge blocks had mining difficulty:- Variable block times (~13 seconds average)
- Difficulty adjusted every 2016 blocks
- Total difficulty tracked cumulative work
Time Analysis
Block Age
Calculate block age:Network Health
Recent blocks indicate healthy network:Chain Reorganizations
Track reorgs by monitoring chain head changes:Finality
Gasper Finality (PoS)
Blocks finalized after 2 epochs (~12.8 minutes):Safe Block
Safe block is justified (~1 epoch old):Common Patterns
Wait for Block
Wait for specific block number:Block Production Rate
Calculate blocks per second:API Reference
Constructors
ChainHead.from({ number, hash, timestamp, difficulty?, totalDifficulty? })- Create from block data
See Also
- BlockNumber - Block heights
- BlockHash - Block identifiers
- SyncStatus - Node sync progress
- BlockHeader - Full block headers

