Chain ID
A number that identifies which chain a transaction belongs to, preventing cross-chain replays.
Basically
A chain ID is a number that identifies a blockchain network. It stops a transaction from one network being copied and accepted on another.
Key Takeaways
- A chain ID is a unique integer that identifies an EVM-compatible blockchain network. It is embedded directly into transaction signatures to provide replay protection across chains.
- EIP-155 introduced chain IDs after the Ethereum hard fork that created Ethereum Classic. Chain IDs cryptographically bind each transaction to a specific network, so it cannot be broadcast on another chain with the same account history.
- Well-known chain IDs include Ethereum mainnet (1), Polygon (137), and Arbitrum One (42161). Bitcoin uses network magic bytes and address version prefixes instead of a transaction-level identifier.
What Is a Chain ID?
A chain ID is a unique numerical identifier assigned to a blockchain network. Every transaction includes it in the cryptographic signature, binding that transaction to a single chain. If you broadcast the same signed transaction on a chain with a different chain ID, the network rejects it because signature verification fails.
Chain IDs solve a specific problem: when two networks share the same transaction format and account history after a hard fork, a transaction signed on one chain is equally valid on the other. An attacker can rebroadcast your legitimate transaction on the sibling chain to steal funds in a replay attack. EIP-155 made each transaction inherently chain-bound by embedding a chain-specific identifier into the signing process.
How It Works
EIP-155, authored by Vitalik Buterin in October 2016 and activated in the Spurious Dragon hard fork at block 2,675,000, modifies how Ethereum transactions are signed. It adds three fields to the data hashed before signing, a subtle but effective change.
Transaction Signing Before EIP-155
Before chain IDs existed, the signing hash was computed over six RLP-encoded fields. Those fields are listed below.
The six fields contained no chain-specific data. The resulting signature was valid on any EVM chain that shared the same account state.
Transaction Signing After EIP-155
EIP-155 appends three fields to the signing payload: the chain ID itself and two zero-value padding fields. The fields are listed below.
The chain ID is also encoded into the v parameter of the ECDSA signature. A verifying node can extract the chain ID using chainId = (v - 35) / 2 with integer division, then reject the transaction if it does not match the node's own chain. Replay protection is therefore cryptographic rather than based on convention.
Chain ID vs. Network ID
Chain ID and network ID are related but distinct: the chain ID is used in transaction signatures for replay protection under EIP-155, while the network ID is used in the peer-to-peer devp2p protocol for node discovery. Most public networks use identical values, but they serve different layers of the stack. EIP-695 introduced the eth_chainId JSON-RPC method so wallets and decentralised applications can programmatically query which chain a node belongs to.
Why Chain IDs Were Created
The direct catalyst for EIP-155 was the Ethereum/Ethereum Classic split in July 2016. After the DAO hack drained approximately 3.6 million ETH through a reentrancy vulnerability, the Ethereum community voted to hard fork at block 1,920,000 to reverse the theft. The portion of the community that rejected the fork continued on the original chain, now called Ethereum Classic.
Both chains shared identical transaction history up to the fork point, so every account existed on both chains with the same private key and balance. A transaction signed on Ethereum mainnet could be replayed on Ethereum Classic, and vice versa, causing users to unintentionally send funds on both chains. The replay attack vulnerability made the split dangerous for ordinary users.
EIP-155 solved this by assigning Ethereum mainnet chain ID 1 and Ethereum Classic chain ID 61. Transactions signed with chain ID 1 are cryptographically invalid on a chain expecting chain ID 61.
Well-Known Chain IDs
Every EVM-compatible network has a registered chain ID. Some of the most widely used are listed below.
The de facto registry for chain IDs is the ethereum-lists/chains GitHub repository, which powers the ChainList directory. Registration is first-come-first-served via pull request. No central authority oversees it, unlike IANA for domain names.
Replay Protection Across Forks
The primary purpose of chain IDs is preventing replay attacks after chain splits. Any time a network undergoes a contentious hard fork that produces two live chains, chain IDs ensure transactions are only valid on the intended network. Without this protection, every transaction on one fork could be copied and executed on the other.
Wallet Network Switching
Wallets use chain IDs to manage multi-chain experiences. The EIP-3085 standard, wallet_addEthereumChain, allows decentralised applications to request that a wallet add a new network by providing its chain ID, RPC endpoints, and native currency details. EIP-3326, wallet_switchEthereumChain, lets applications request a switch to a specific chain ID already known to the wallet.
Smart Contract Chain Verification
Smart contracts can read the current chain ID using the CHAINID opcode introduced by EIP-1344, or Solidity's block.chainid. Contracts can therefore verify they are executing on the correct network, which is useful for cross-chain messaging protocols and bridge security checks.
Multi-Chain Application Routing
Applications that operate across multiple EVM chains use chain IDs as routing keys. Cross-chain bridges, DEX aggregators, and payment orchestration platforms reference chain IDs to determine which network holds your assets and where to route transactions.
Bitcoin's Approach
Bitcoin does not use a chain ID system. It differentiates networks through several complementary mechanisms, listed below.
Bitcoin's replay protection is structural rather than cryptographic: networks are separated at the data level through different UTXOs and addresses, not at the signature level. Ethereum needed chain IDs specifically because account-model blockchains share account state across forks.
No Central Authority
Chain ID assignment relies on a community-maintained GitHub repository with first-come-first-served registration. CI checks prevent collisions, but no formal governance body oversees the registry. ERC-7785, proposed in September 2024, would move to an onchain registration system using Keccak-256 hashes and ENS, but it remains in draft status.
Legacy Transaction Compatibility
EIP-155 was designed with backward compatibility: pre-fork transactions with v values of 27 or 28 and no chain ID are still accepted on most networks. Very old transactions signed without a chain ID could theoretically be replayed. EIP-3788 proposed closing this loophole by rejecting transactions where the derived chain ID is 0, but it has not gained implementation momentum.
Chain ID Spoofing in Wallets
When your wallet adds a new chain via wallet_addEthereumChain, it relies on the provided RPC endpoint returning the correct chain ID. A malicious RPC could serve a different chain's data while claiming to be a trusted network. Wallets mitigate this by verifying that the eth_chainId response matches the declared chain ID, but you should still verify RPC endpoints from trusted sources.
Multi-Chain Complexity
Hundreds of EVM-compatible chains each have their own chain ID, creating increasing complexity for users. Sending tokens to the right address on the wrong chain is a common mistake. Chain abstraction protocols aim to hide this complexity, but the underlying chain ID infrastructure remains necessary for security.
Chain IDs in Context
Chain IDs are one piece of a broader set of network differentiation mechanisms across blockchains. For a deeper look at how transaction replay works and how different protocols defend against it, see the glossary entries on replay attacks and anti-replay protection. For context on how layer-2 networks like Spark handle network identification and asset movement across chains, see the research article on Spark as a Bitcoin layer 2.
The glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.