Overview
ForkId implements EIP-2124 fork identification for DevP2P network validation. It helps peers determine if they’re on compatible forks before exchanging data.Type Definition
hash- CRC32 checksum of genesis hash + fork block numbersnext- Block number of next known fork (0 if no upcoming forks)
Creating ForkId
from
Create from hash and next block number.hashmust be exactly 4 bytesnextis required (use 0 for no upcoming forks)
Methods
toBytes
Encode to 12-byte binary format for DevP2P handshake.matches
Check if two ForkIds are compatible per EIP-2124.Compatibility Rules
Two ForkIds are compatible if:- Identical - Same hash and next block
- Remote has no future forks - Same hash, remote next is 0
- Local has no future forks - Same hash, local next is 0
- Remote is ahead - Different hash but remote next >= local next
Ethereum Mainnet Fork History
| Fork | Block | CRC32 Hash |
|---|---|---|
| Frontier | 0 | 0xfc64ec04 |
| Homestead | 1,150,000 | 0x97c2c34c |
| DAO Fork | 1,920,000 | 0x91d1f948 |
| Tangerine | 2,463,000 | 0x7a64da13 |
| Spurious | 2,675,000 | 0x3edd5b10 |
| Byzantium | 4,370,000 | 0xa00bc324 |
| Constantinople | 7,280,000 | 0x668db0af |
| Istanbul | 9,069,000 | 0x879d6e30 |
| Berlin | 12,244,000 | 0xe029e991 |
| London | 12,965,000 | 0x0eb440f6 |
| Merge | 15,537,394 | 0xb715077d |
| Shanghai | 17,034,870 | 0xf0afd0e3 |
| Cancun | 19,426,587 | 0xdce96c2d |
DevP2P Handshake
ForkId is exchanged during the DevP2Pstatus message:

