Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Glossary

Chain ID

A Chain ID is a unique integer identifier defined in Ethereum Improvement Proposal 155 (EIP-155) that specifies a distinct Ethereum Virtual Machine (EVM) compatible network.
Chainscore © 2026
definition
BLOCKCHAIN IDENTIFIER

What is Chain ID?

A Chain ID is a unique numerical identifier assigned to a specific blockchain network, enabling wallets and applications to distinguish between different chains and prevent transaction replay attacks.

A Chain ID is a unique integer that acts as a network identifier for a blockchain. Introduced in Ethereum's EIP-155, it is a critical component of a transaction's signature, ensuring that a transaction signed for one network (e.g., Ethereum Mainnet) cannot be replayed on another (e.g., Polygon). This prevents funds from being stolen or duplicated across forked or parallel chains. Each major network has a canonical ID: Ethereum Mainnet is 1, Polygon is 137, and Arbitrum One is 42161.

From a technical perspective, the Chain ID is incorporated into the transaction's signing process. When a user signs a transaction, the Chain ID is included in the data that is cryptographically signed. This creates a signature that is only valid for the intended network. Wallets like MetaMask use the Chain ID to correctly display the network name and currency symbols, while decentralized applications (dApps) use it to connect to the correct smart contract addresses and RPC endpoints. This mechanism is fundamental for network security and user interface clarity.

Developers and users interact with Chain IDs constantly. When adding a custom network to a wallet, you must specify the correct Chain ID. In smart contract development, the block.chainid global variable in Solidity allows contracts to perform logic specific to their deployment network. Common issues, such as the "wrong network" error in a dApp, often stem from a mismatch between the dApp's expected Chain ID and the wallet's currently connected network. Understanding this identifier is essential for secure cross-chain operations and preventing costly user errors.

The Chain ID system also underpins the broader multi-chain ecosystem. With the proliferation of Layer 2s, sidechains, and testnets, a standardized method for network identification is non-negotiable. It works in conjunction with other identifiers like Network ID and Symbol, but the Chain ID is the primary cryptographic safeguard. Forks of existing chains, such as Ethereum Classic (Chain ID 61), must adopt a different Chain ID to ensure transaction replay protection from their parent chain, maintaining the integrity of both networks.

how-it-works
NETWORK IDENTIFIER

How Chain ID Works

A technical breakdown of the Chain ID, the fundamental integer that uniquely identifies and secures a blockchain network.

A Chain ID is a unique integer identifier assigned to a specific blockchain network, serving as its primary fingerprint to prevent transaction replay attacks across different chains. Defined in Ethereum Improvement Proposal 155 (EIP-155), it is cryptographically incorporated into every transaction signature. This ensures that a transaction signed for one network, like Ethereum Mainnet (Chain ID 1), is invalid if broadcast to another, such as the Polygon network (Chain ID 137). The Chain ID is a core component of a network's genesis configuration and cannot be changed after launch.

The primary technical function of the Chain ID is transaction replay protection. Before its implementation, a transaction's signature was only based on its content, making it possible to copy, or 'replay,' a valid transaction from one network (e.g., a testnet) onto another (e.g., the mainnet). By including the Chain ID in the signed data, the signature becomes bound to that specific network. Wallets and nodes use the Chain ID to correctly format transactions and validate signatures, ensuring users cannot accidentally send assets to the wrong chain.

Developers and users interact with Chain IDs constantly. Wallets like MetaMask use it to determine which network RPC endpoint to connect to and to display the correct native currency symbol. Smart contracts, particularly those in cross-chain applications, often check the block.chainid opcode to enforce logic specific to a network. Common examples include Ethereum Mainnet (1), Goerli Testnet (5), Binance Smart Chain (56), and Arbitrum One (42161). Always verifying the Chain ID before signing a transaction is a critical security practice to avoid asset loss.

It is important to distinguish Chain ID from the closely related Network ID. While both are numbers, the Chain ID is used for transaction signing (EIP-155), and the Network ID is used for peer-to-peer networking in the Ethereum devp2p protocol. Although they often have the same value for legacy compatibility, modern clients prioritize the Chain ID. The EIP-155 standard effectively made the Chain ID the authoritative identifier, rendering the older Network ID largely obsolete for transaction validation purposes.

For builders, handling Chain IDs correctly is essential for interoperability. Cross-chain bridges and omnichain protocols must meticulously track Chain IDs to route messages and assets. Oracles and indexers use them to partition data correctly. When deploying contracts across multiple networks, developers often use the Chain ID in constructor arguments or configuration files to set network-specific parameters like gateway addresses or fee tokens, ensuring contract behavior is consistent and secure in each environment.

history
ORIGINS AND STANDARDIZATION

History and EIP-155

The concept of a Chain ID evolved from a practical need to prevent transaction replay attacks across different Ethereum-based networks, culminating in its formal standardization through Ethereum Improvement Proposal 155 (EIP-155).

A Chain ID is a unique integer identifier assigned to a specific blockchain network, primarily used to cryptographically separate transactions and signatures between different chains. Before its formal introduction, a user's transaction signed for the Ethereum Mainnet (e.g., sending ETH) could be maliciously replayed on a separate testnet or fork, as the signature did not encode the intended network. The Chain ID acts as a domain separator, binding a transaction's signature exclusively to one network, thereby providing essential security for users and wallet providers operating in a multi-chain ecosystem.

The mechanism was formally proposed and standardized in EIP-155 in October 2016. This critical upgrade modified the transaction signing process to include the Chain ID, the transaction's nonce, gasPrice, and gasLimit in the signed payload. By incorporating these fields, EIP-155 achieved two major goals: it definitively prevented transaction replay across networks, and it introduced the transaction fee burning mechanism on Ethereum. The v component of the transaction signature was repurposed to encode the Chain ID, moving away from a simple recovery identifier to a more robust scheme.

The implementation of EIP-155 and Chain IDs became a foundational requirement for the ecosystem's growth. It enabled the safe coexistence of the Ethereum Mainnet (Chain ID: 1), public testnets like Goerli (Chain ID: 5), and private consortium chains, each with a unique identifier. Wallets like MetaMask use the Chain ID to correctly display network information and prevent users from accidentally signing transactions for the wrong chain. This standardization was a prerequisite for the later explosion of Ethereum Virtual Machine (EVM)-compatible Layer 1 and Layer 2 networks, each requiring a distinct Chain ID for secure interoperability.

key-features
CHAIN ID

Key Features and Purpose

A Chain ID is a unique integer identifier that defines a specific blockchain network, enabling wallets and applications to correctly route transactions and prevent cross-chain replay attacks.

01

Network Isolation

The primary purpose of a Chain ID is to cryptographically isolate one blockchain network from another. This prevents a transaction signed for one network (e.g., Ethereum Mainnet) from being replayed on another (e.g., a testnet), as the signature includes the Chain ID in its calculation. This is a fundamental security mechanism for all EVM-compatible chains.

02

EIP-155 Standard

The modern Chain ID was formalized by Ethereum Improvement Proposal 155 (EIP-155). It introduced the Chain ID into the transaction signature scheme, replacing the simpler 'v' parameter. This upgrade, implemented in 2016, was critical for securing the network against replay attacks after events like the Ethereum Classic hard fork. The Chain ID is now a mandatory field in all type 0 (legacy) and EIP-1559 transactions.

03

Wallet & DApp Routing

Wallets like MetaMask and decentralized applications use the Chain ID to identify the target network. When you connect a wallet, it reads the Chain ID from the connected node to display the correct network name and native currency symbol. This ensures transactions and smart contract calls are broadcast to the intended blockchain, preventing user errors and loss of funds.

04

Common Chain ID Examples

Each major network has a standardized integer identifier:

  • 1: Ethereum Mainnet
  • 56: BNB Smart Chain
  • 137: Polygon (PoS)
  • 42161: Arbitrum One
  • 10: Optimism
  • 8453: Base
  • 11155111: Sepolia Testnet These standardized IDs are registered in community-maintained lists like the Chainlist.
05

Chain ID vs. Network ID

These are distinct but related identifiers. The Chain ID is used in the transaction signing process for replay protection. The Network ID is used during the peer-to-peer networking handshake to identify the chain for node discovery. While they often have the same value (e.g., both are 1 for Ethereum Mainnet), they serve different protocol layers and can theoretically differ.

06

Developer Implementation

For developers, the Chain ID is accessed via the eth_chainId JSON-RPC method. It is crucial for:

  • Contract deployment: Ensuring contracts are deployed to the correct network.
  • Signature verification: Validating that signed messages are for the intended chain.
  • Multi-chain dApps: Programmatically switching RPC endpoints based on the user's selected network.
ecosystem-usage
REFERENCE

Common Chain IDs in the Ecosystem

A Chain ID is a unique integer identifier for a blockchain network, essential for preventing transaction replay attacks across different chains. Below are the standard IDs for major networks.

01

Ethereum Mainnet

The canonical network for the Ethereum Virtual Machine (EVM).

  • Chain ID: 1
  • Network ID: 1
  • This is the primary production network where native ETH is used for gas and execution.
02

Polygon PoS

A leading Ethereum Layer 2 scaling solution using a commit-chain architecture.

  • Chain ID: 137
  • Network ID: 137
  • Uses MATIC (now POL) for gas. A separate Chain ID ensures transactions are not replayed on Ethereum.
03

BNB Smart Chain

An EVM-compatible blockchain launched by Binance, operating as a parallel chain.

  • Chain ID: 56
  • Network ID: 56
  • Uses BNB for gas fees. Its distinct ID separates its transaction space from Ethereum's.
04

Arbitrum One

A dominant Optimistic Rollup scaling solution for Ethereum.

  • Chain ID: 42161
  • Network ID: 42161
  • Transactions are batched and posted to Ethereum Mainnet (Chain ID 1) for finality.
05

Base

An Ethereum Layer 2 built by Coinbase using the Optimism OP Stack.

  • Chain ID: 8453
  • Network ID: 8453
  • Shares security and consensus with Ethereum while providing low-cost transactions.
06

Testnets & Development

Networks for testing and development before mainnet deployment.

  • Sepolia: 11155111 (Ethereum's primary testnet)
  • Goerli: 5 (deprecated)
  • BNB Testnet: 97
  • Using the correct testnet ID is crucial for faucets and test deployments.
EVM NETWORK IDENTIFIERS

Chain ID vs. Network ID

A comparison of the two primary integer identifiers used to distinguish Ethereum Virtual Machine (EVM) networks, detailing their purpose, scope, and usage in transactions and peer discovery.

FeatureChain IDNetwork ID

Primary Purpose

Transaction signature replay protection

Network-level peer discovery

EIP Standard

EIP-155

Ethereum Yellow Paper (pre-EIP)

Scope & Enforcement

Protocol-level (part of transaction data)

Node client implementation

Value in Transaction

Encoded in v signature component

Not included

Example Value (Ethereum Mainnet)

1

1

Example Value (Polygon PoS)

137

137

Client RPC Method

eth_chainId

net_version

Modern Relevance

Critical for all signed transactions

Largely deprecated for consensus

technical-details
EIP-155 AND SIGNATURE RECOVERY

Technical Details: The v Parameter

The `v` parameter is a critical component of an ECDSA signature on Ethereum, determining both the signer's recovery ID and the transaction's chain context.

In the Elliptic Curve Digital Signature Algorithm (ECDSA) used by Ethereum, a signature is composed of three values: r, s, and v. The v parameter is a 1-byte value that serves a dual purpose. Primarily, it acts as the recovery ID, a value (27 or 28 in pre-EIP-155 signatures) that allows the Ethereum Virtual Machine (EVM) to mathematically recover the public key, and thus the address, of the signer from the r and s components. Without the correct v, the origin of a transaction cannot be cryptographically verified.

The function of v was expanded with EIP-155 (Simple Replay Attack Protection). To prevent a transaction signed for one network (e.g., Ethereum Mainnet) from being replayed on another (e.g., Ethereum Classic), EIP-155 incorporated the chain's unique chainId into the signature. The calculation becomes v = chain_id * 2 + 35 or v = chain_id * 2 + 36. This encodes the network identifier directly into the signature, making it invalid on any other chain. For Ethereum Mainnet (chainId=1), this results in v values of 37 or 38.

When validating a signature, clients and nodes first check the v value. If v is 27 or 28, it is treated as a legacy, pre-EIP-155 signature. If v is greater than or equal to 35, the client extracts the chainId using the formula chainId = (v - 35) / 2 (using integer division) and verifies it matches the network's expected chain ID. This mechanism is foundational for network security and interoperability, ensuring transactions are bound to their intended blockchain.

security-considerations
CHAIN ID

Security Considerations

The Chain ID is a critical security parameter that prevents transaction replay attacks across different blockchain networks. Understanding its role is essential for secure wallet configuration and smart contract deployment.

01

Preventing Replay Attacks

A Chain ID cryptographically signs a transaction, binding it to a specific network. This prevents a transaction broadcast on one network (e.g., Ethereum Mainnet) from being replayed on another (e.g., Ethereum Classic). Without a unique Chain ID, assets could be stolen by replaying signed transactions on a forked chain.

02

Wallet & Network Configuration

Incorrect Chain ID configuration in wallets (like MetaMask) or RPC nodes is a common user error. Connecting to a malicious RPC endpoint with a spoofed Chain ID can lead to:

  • Funds being sent to the wrong network
  • Inability to recover assets
  • Interaction with fraudulent smart contracts Always verify the Chain ID displayed by your wallet matches the intended network.
03

Smart Contract Vulnerabilities

Smart contracts that perform cross-chain logic or verify off-chain signatures must explicitly check the block.chainid. Failing to include the Chain ID in signature schemes (like EIP-712) or bridge contracts can allow signatures to be replayed, leading to fund theft or unauthorized actions.

04

EIP-155: The Standard

EIP-155 introduced the Chain ID to Ethereum's transaction signing process. It transformed the simple v recovery parameter into a chain-specific value, fundamentally improving network security. This standard is now adopted by most EVM-compatible chains (Polygon, Arbitrum, BSC) to ensure isolation.

05

Testing & Deployment Risks

Deploying contracts without specifying the Chain ID for development frameworks (Hardhat, Foundry) can cause bytecode differences between testnets and mainnet. This may introduce subtle bugs. Use block.chainid in constructor or init functions to guard against deployment on incorrect networks.

06

Bridge & Cross-Chain Exploits

Bridges are high-value targets where Chain ID validation is paramount. Exploits have occurred when:

  • Relay mechanisms failed to validate the origin chain's ID.
  • Message formats did not uniquely encode the source and destination Chain IDs. A single validation flaw can lead to the minting of illegitimate wrapped assets on the destination chain.
CHAIN ID

Common Misconceptions

The Chain ID is a fundamental network identifier, yet its purpose and implications are often misunderstood. This section clarifies frequent points of confusion regarding its role in security, compatibility, and network operations.

No, the Chain ID and Network ID are distinct identifiers with different purposes, though they were the same value in early Ethereum networks. The Chain ID, introduced in EIP-155, is a cryptographically secure identifier used for transaction signing to prevent replay attacks across different chains. The Network ID is used for peer-to-peer network discovery in the devp2p protocol. While they often have the same integer value (e.g., 1 for Ethereum Mainnet), they serve separate protocol layers and can theoretically diverge.

CHAIN ID

Frequently Asked Questions (FAQ)

A Chain ID is a fundamental identifier for blockchain networks, crucial for security and interoperability. These questions address its purpose, technical details, and practical use cases.

A Chain ID is a unique identifier, typically an integer, that distinguishes one blockchain network from another. Its primary importance lies in transaction replay protection, preventing a transaction signed for one network (e.g., Ethereum Mainnet) from being validly broadcast and executed on another (e.g., a testnet). It is a critical security parameter in the Ethereum Virtual Machine (EVM) ecosystem and is used by wallets and nodes to ensure users are interacting with the intended network. Without a correct Chain ID, users risk losing funds by signing transactions for the wrong chain.

ENQUIRY

Get In Touch
today.

Our experts will offer a free quote and a 30min call to discuss your project.

NDA Protected
24h Response
Directly to Engineering Team
10+
Protocols Shipped
$20M+
TVL Overall
NDA Protected Directly to Engineering Team
Chain ID: Ethereum Network Identifier (EIP-155) | ChainScore Glossary