blockchain//chain ID
A chain ID is the unique integer that identifies a blockchain network: Mainnet is 1, Sepolia is 11155111, and a custom network can use any value.
A chain ID is the unique integer that identifies a blockchain network: Mainnet is 1, Sepolia is 11155111, and a custom network can use any value.
It is included in transaction signatures (EIP-155): a tx signed for chainId 1 is invalid on chainId 5, which makes it the main defense against a cross-chain replay attack.
Metamask uses the chainId together with the RPC URL to know which blockchain it is talking to.
It is immutable after the network launches: changing the chainId in genesis.json after the first block breaks everything.
It is part of the P2P handshake: nodes reject peers with different chain IDs during initial connection.