Try it Live
Run Chain examples in the interactive playground
Conceptual Guide - For API reference and method documentation, see Chain API.
What Are Chain IDs?
A chain ID is a numeric identifier that uniquely identifies an Ethereum network. Every blockchain network (mainnet, testnet, L2, sidechain) has its own chain ID. Common Chain IDs:- Ethereum Mainnet: 1
- Sepolia (testnet): 11155111
- Goerli (testnet, deprecated): 5
- Polygon: 137
- Optimism: 10
- Arbitrum One: 42161
- Base: 8453
Why Chain IDs Exist
Chain IDs solve the replay attack problem introduced by EIP-155. Before EIP-155, a transaction signed on one network could be replayed on another network with identical account state.Replay Attack Scenario (Pre-EIP-155)
EIP-155 Solution
EIP-155 requires chain ID in transaction signatures, preventing cross-chain replay:Chain ID in Transactions
Chain IDs are signed into transactions, making them network-specific:Network Identification
Use chain IDs to identify network type:Validating Network
Check if transaction matches expected network:Testnet Detection
Identify testnet vs mainnet programmatically:Network Identification vs Security
Network identification (chain metadata) and replay protection (chain ID in signature) serve different purposes:Resources
- EIP-155: Simple replay attack protection - Original EIP introducing chain IDs
- chainlist.org - Comprehensive list of Ethereum networks and chain IDs
- @tevm/chains - Chain configuration constants (800+ networks)
Next Steps
- Overview - Type definition and API reference
- Constructors - Creating Chain instances
- Chain Lookup - Looking up chains by ID
- Metadata - Accessing chain properties
- Transaction - Transaction types and signing

