Developer setting up L2 bridge infrastructure on laptop, architecture diagrams on screen, home office with monitors, technical work session.
Protocols

EIP-155 and CAIP-2 Chain ID Conflict Resolution

A technical implementation guide for building a robust chain resolution layer that maps legacy EIP-155 integer IDs to their canonical CAIP-2 equivalents, preventing user-facing errors when switching networks in multi-chain dapps and wallets.
introduction
THE EIP-155 AND CAIP-2 IDENTIFIER COLLISION PROBLEM

Why Chain ID Resolution Breaks in Multi-Chain Environments

Legacy EIP-155 integer chain IDs are not globally unique, creating deterministic collision risks that break wallet displays, transaction routing, and session scoping in multi-chain dapps.

The Ethereum ecosystem standardized chainId as a uint256 via EIP-155 to prevent cross-chain replay attacks on EVM networks. This integer is embedded in transaction signatures and used by wallets to identify the target network. However, the EIP-155 registry is a voluntary, off-chain list with no on-chain enforcement of uniqueness. As the number of EVM chains, L2s, and appchains has exploded, the probability of two distinct networks selecting the same integer has become a material operational risk. When a collision occurs, a dapp or wallet that relies solely on the integer chainId cannot distinguish between the two networks, leading to user-facing errors such as displaying the wrong token balances, signing transactions for an unintended chain, or failing to establish a WalletConnect session.

WalletConnect and the Chain-Agnostic Improvement Proposals (CAIPs) address this by defining a canonical, globally unique identifier in CAIP-2: namespace:chainId. For EVM chains, the namespace is eip155, making the canonical ID eip155:1 for Ethereum mainnet. This simple prefixing creates a unique, parseable string that prevents collisions between EVM chains and chains from other namespaces like Solana (solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ). The core integration challenge is that most chain data sources—RPC endpoints, community chainlists, and legacy SDKs—still use the bare integer as the primary key. A robust multi-chain application must build and maintain a resolution layer that maps every integer chainId it encounters to its authoritative CAIP-2 identifier before using it as a key in any internal state, session, or UI component.

The operational impact of a collision or mis-resolution is severe. A wallet that uses the integer chainId as a key for cached token balances or NFT metadata will display incorrect assets if a user switches between two colliding networks. A dapp that constructs a CAIP-25 session proposal with an ambiguous integer may cause the wallet to scope the session to the wrong chain, potentially leading to a user signing a transaction on an unintended network. For exchanges and custody providers, a failure in chain ID resolution can result in deposits being credited to the wrong network's accounting system. The fix is not technically complex but requires disciplined engineering: all chain identifiers must be normalized to CAIP-2 at the system boundary, and any legacy integer must be treated as an untrusted input that requires resolution against a curated, conflict-checked registry before use.

CHAIN IDENTIFIER COMPATIBILITY

EIP-155 vs. CAIP-2: Quick Facts

A comparison of legacy EIP-155 integer chain IDs and canonical CAIP-2 identifiers, highlighting the operational risks of relying on a single format and the actions required for multi-chain systems.

AreaWhat changesWho is affectedAction

Identifier Format

Migration from a single integer (e.g., 1) to a namespaced string (e.g., eip155:1).

Multi-chain dapps, wallets, and block explorers.

Audit all internal chain ID representations and update to CAIP-2 format.

Chain Resolution

A single integer is no longer a globally unique key across ecosystems.

Bridge interfaces, cross-chain messaging protocols, and analytics platforms.

Implement a canonical chain registry keyed by CAIP-2 to resolve conflicts.

Network Switching

User-facing errors occur when a dapp requests an integer ID that the wallet interprets in a different namespace.

Wallet SDKs (Web3Modal, RainbowKit) and dapp frontends.

Verify that network switching logic passes the full CAIP-2 identifier, not just the integer reference.

Session Scoping

A WalletConnect session proposal must use CAIP-2 to scope permissions for specific chains.

Wallet developers implementing Sign v2 and CAIP-25.

Reject session proposals that do not include the namespace prefix to prevent ambiguous authorization.

Account Association

A CAIP-10 account ID (e.g., eip155:1:0x...) is derived from the CAIP-2 chain ID, making the chain reference explicit.

Backend services managing user profiles and SIWx sessions.

Use CAIP-10 as the canonical key for user accounts to prevent cross-chain identity confusion.

Legacy Data

Historical data indexed by EIP-155 integer ID may conflict with new chains that reuse the same integer.

Indexers, data pipelines, and compliance tools.

Build an ETL step to map legacy integer IDs to their canonical CAIP-2 equivalents before storage.

Hardcoded Constants

Hardcoded chain IDs in smart contracts or SDKs will break when a conflicting chain is added.

Protocol developers and SDK maintainers.

Replace all hardcoded integer IDs with a configurable CAIP-2 mapping. Chainscore can audit this mapping logic.

Governance

New chain registrations require a unique CAIP-2 namespace and reference ID to avoid ecosystem collisions.

Chain founders and governance delegates in namespaced ecosystems.

Verify the proposed CAIP-2 identifier against the canonical registry before launch to prevent user asset loss.

technical-context
CHAIN ID RESOLUTION

The Resolution Architecture: From Integer to Namespace

How to build a robust resolution layer that maps legacy EIP-155 integer IDs to their canonical CAIP-2 equivalents, preventing user-facing errors during network switching.

The core conflict in multi-chain identity stems from a naming collision. EIP-155 introduced a simple integer-based chainId to prevent cross-chain transaction replay on Ethereum, a design that was later adopted by other EVM-compatible networks. However, this flat integer namespace is not globally unique across ecosystems. A dapp or wallet relying solely on an integer chainId cannot distinguish between, for example, the C-Chain on Avalanche (43114) and an entirely different L1 or testnet that might use the same integer. WalletConnect and the Chain-Agnostic Improvement Proposals (CAIPs) resolve this by introducing a hierarchical, namespace-prefixed identifier in CAIP-2, such as eip155:1 for Ethereum mainnet, creating a globally unique and human-readable chain reference.

The operational challenge for builders is that the legacy integer ID remains deeply embedded in JSON-RPC calls, smart contract opcodes, and user interface state. A robust resolution architecture must act as a translation layer, mapping the canonical CAIP-2 identifier to the integer chainId required for RPC communication, and vice-versa. This mapping is not always one-to-one; a single CAIP-2 namespace can contain multiple chains, and a dapp must maintain a registry to resolve a wallet_switchEthereumChain request for an integer ID back to the correct CAIP-2 reference for session management. Failure to implement this mapping correctly leads to 'unknown chain' errors, broken session resumption, and a fragmented user experience where a wallet cannot correctly display the network a dapp is requesting.

For teams integrating WalletConnect's Sign v2 protocol, the resolution layer is not a static configuration file but an active component of session negotiation. During a CAIP-25 handshake, a dapp proposes required and optional namespaces using CAIP-2 identifiers, and the wallet must validate these against its internal list of supported chains. This validation logic must handle edge cases like a dapp requesting an eip155 namespace without specifying a reference integer, or a wallet needing to map a user's manually added custom network RPC to a synthetic CAIP-2 identifier. A poorly designed resolution layer becomes a persistent source of support tickets and integration failures, directly impacting user trust and dapp retention.

Chainscore Labs can audit this critical mapping logic to ensure error-free network switching. Our review covers the completeness of the chain registry, the correctness of the bidirectional mapping between CAIP-2 identifiers and integer chainId values, and the robustness of the validation logic during session proposal and switching flows. We help teams move from a fragile, hardcoded list of integers to a canonical, namespace-aware resolution architecture that is resilient to chain additions and ecosystem evolution.

IMPACTED ACTORS

Who Is Affected by Chain ID Conflicts

Wallet Developers

Wallet teams are the first line of defense against chain ID conflicts. They must maintain an internal registry that maps integer chain IDs to canonical CAIP-2 identifiers before initiating any session or signing operation.

Critical responsibilities:

  • Validate that the chain ID requested in a session proposal matches the expected namespace and reference.
  • Prevent users from signing transactions on a network they did not intend to interact with.
  • Handle edge cases where two chains share the same integer ID but belong to different namespaces.

Action items:

  • Audit your chain resolution layer to ensure every integer ID resolves to exactly one CAIP-2 identifier.
  • Implement user-facing warnings when a dapp requests a chain ID that has known conflicts.
  • Test against the WalletConnect compatibility suite for multi-chain session handling.

Chainscore can review your wallet's chain resolution logic to prevent cross-chain replay and user confusion.

implementation-impact
CHAIN ID RESOLUTION LAYER

Integration Surface and Impact Areas

Mapping legacy EIP-155 integer IDs to canonical CAIP-2 identifiers touches every layer of a multi-chain application. The following areas require explicit design, testing, and monitoring to prevent user-facing errors during network switching.

02

Wallet Session Proposal Handling

When a dapp sends a session proposal with EIP-155 integer IDs, the wallet must resolve these to CAIP-2 identifiers before presenting them to the user. A failure in this resolution can cause the wallet to display an unknown chain, reject the proposal, or silently connect to the wrong network. The resolution layer must handle unrecognized IDs gracefully and provide a clear fallback UX. Chainscore can review the session proposal processing logic for correctness and edge-case handling.

03

dApp Network Switching Logic

dApps that call wallet_switchEthereumChain or wallet_addEthereumChain with integer IDs must internally translate these to their canonical CAIP-2 form for state management, logging, and multi-chain transaction routing. A mismatch between the integer ID used for the RPC call and the CAIP-2 ID stored in the dApp's state leads to broken chain context and failed transactions. Chainscore can assess the dApp's chain-switching flow for consistency and error recovery.

04

Transaction Routing and Signing

Before signing a transaction, the wallet must confirm that the CAIP-2 chain ID in the session scope matches the network the user is currently connected to. If the resolution layer maps an integer ID to the wrong CAIP-2 identifier, the user may sign a transaction intended for one chain on another, leading to replay attacks or loss of funds. Chainscore can perform a threat-modeling review of the signing pipeline to ensure chain context is cryptographically bound.

05

Monitoring and Alerting for ID Conflicts

New chain registrations or namespace collisions can introduce silent resolution errors. Teams should implement monitoring that detects when an integer ID resolves to multiple CAIP-2 identifiers or when a previously valid mapping becomes ambiguous. Alerting on these events allows operators to update the registry before users are impacted. Chainscore can help design a monitoring and alerting specification tailored to the resolution layer's operational context.

06

Backward Compatibility with Legacy Integrations

Existing integrations, SDKs, and partners may still rely on raw integer IDs. The resolution layer must provide a backward-compatible API that accepts integer IDs and returns the correct CAIP-2 equivalent, while also logging deprecated usage to track migration progress. A clean deprecation path prevents fragmentation between old and new integration patterns. Chainscore can review the backward-compatibility shim for security and data-integrity risks.

EIP-155 AND CAIP-2 CONFLICT SCENARIOS

Risk Matrix: Failure Modes in Chain Resolution

Operational risks and failure modes when mapping legacy EIP-155 integer chain IDs to canonical CAIP-2 identifiers, and the affected actors who must mitigate them.

RiskFailure modeSeverityAffected actorsMitigation

Integer collision

Two distinct chains share the same EIP-155 integer ID, causing a CAIP-2 resolver to route transactions to the wrong network.

Critical

Wallets, dApps, bridges, exchanges

Maintain a conflict registry that overrides ambiguous integer IDs with a user-confirmed or admin-curated CAIP-2 namespace.

Namespace ambiguity

A resolver incorrectly assumes the namespace (e.g., 'eip155' vs. 'cosmos') for a bare integer ID, leading to malformed CAIP-2 identifiers.

High

Multi-chain dApps, wallet SDKs

Require explicit namespace configuration per chain origin. Never infer namespace from integer ID alone.

Stale registry data

A resolver uses an outdated chain list where a new chain's CAIP-2 identifier is missing, causing resolution failure or fallback to an unverified RPC.

High

Wallet connection libraries, dApp frontends

Implement a fallback chain that queries a live, multi-source registry (e.g., chainlist.org) with a short TTL cache.

User-facing error on switch

A wallet displays a raw integer ID or an unresolved CAIP-2 string to the user during a network switch, causing confusion and potential phishing success.

Medium

Wallet UI, end-users

Always resolve to a human-readable chain name and a verified CAIP-2 identifier before prompting the user for approval.

RPC endpoint mismatch

The resolved CAIP-2 identifier maps to a default RPC endpoint that is incorrect or rate-limited, causing transaction submission failures.

Medium

dApps, wallets, node operators

Allow operators to override default RPC mappings per CAIP-2 identifier. Validate chain ID at connection time against the RPC's eth_chainId response.

Cross-chain replay

A transaction signed for one chain is replayed on another chain with the same integer ID but a different CAIP-2 namespace, due to missing chain-specific signature binding.

Critical

Bridges, exchanges, custody providers

Enforce CAIP-2 identifier inclusion in signed message payloads. Verify the full CAIP-2 string, not just the integer component, during signature recovery.

Governance fork ID drift

A chain undergoes a governance fork that changes its EIP-155 ID but the CAIP-2 registry is not updated, causing the resolver to point to the deprecated network.

High

Validators, indexers, data teams

Monitor governance proposals for chain ID changes. Automate CAIP-2 registry updates as part of the network upgrade activation checklist.

CHAIN ID RESOLUTION LAYER

Implementation Rollout Checklist

A step-by-step checklist for engineering teams building a robust chain resolution layer that maps legacy EIP-155 integer IDs to canonical CAIP-2 identifiers. Each item defines a specific readiness signal to prevent user-facing errors during network switching.

What to check: Confirm that your application's chain registry is derived from a single, canonical source—preferably the official CAIP-2 namespace registries or a well-maintained community source like chainlist.org—rather than a hand-maintained internal mapping.

Why it matters: Hardcoded or stale integer-to-CAIP-2 mappings are the primary cause of 'unknown chain' errors when wallets or dapps add new networks. A canonical registry ensures that newly deployed chains are recognized without requiring application updates.

Readiness signal: Your system can resolve any valid EIP-155 integer to its namespace:chainId string without manual intervention, and the registry is updated automatically on a defined schedule.

Chains We Build On

Looking to build on a specific blockchain?

We build smart contracts, DeFi applications, wallets, tokenization platforms, and blockchain infrastructure across the major ecosystems teams choose today. That includes Ethereum, Arbitrum, Optimism, Polygon, Avalanche, Solana, Sui, Aptos, Hedera, Stellar, and NEAR, with support for additional EVM and non-EVM networks based on your product requirements.

EVM ecosystems

  • Ethereum logo
    Ethereum
  • Arbitrum logo
    Arbitrum
  • Optimism logo
    Optimism
  • Polygon logo
    Polygon
  • Avalanche logo
    Avalanche
  • Cronos logo
    Cronos

Non-EVM ecosystems

  • Solana logo
    Solana
  • Sui logo
    Sui
  • Aptos logo
    Aptos
  • Hedera logo
    Hedera
  • Stellar logo
    Stellar
  • NEAR logo
    NEAR

Additional ecosystems

  • Polkadot logo
    Polkadot
  • Cosmos logo
    Cosmos
  • TON logo
    TON
  • Cardano logo
    Cardano
  • Algorand logo
    Algorand
  • Tempo logo
    Tempo

Also available for Base, appchains, custom EVM networks, and cross-chain product architecture.

CHAIN ID CONFLICT RESOLUTION

Frequently Asked Questions

Common questions from engineering teams building or maintaining a chain resolution layer that maps legacy EIP-155 integer IDs to canonical CAIP-2 identifiers.

EIP-155 integer IDs are not globally unique across ecosystems. Different L1s and L2s can reuse the same integer, leading to user-facing errors when a dapp or wallet interprets a chain ID in the wrong context. For example, chain ID 1 could mean Ethereum mainnet, but it could also be claimed by a testnet or a completely separate L1. CAIP-2 solves this by namespacing the identifier (eip155:1), making it unambiguous. Relying solely on integer IDs creates a collision-prone foundation that breaks network switching, transaction signing, and asset display as you scale across chains.

Trusted by Industry Leaders

Delivering blockchain solutions for 5+ years.

We have partnered with 50+ leading DeFi protocols, NFT ecosystems, and fintech innovators to build secure, scalable, and capital-efficient blockchain products.

Selected Partners & Clients

ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
ChainVote logo
Reax logo
Sokail logo
Swapsicle logo
SyntheX logo
Tekika logo
Telos logo
Zexe logo
“I've been working with Chainscore Labs for last 3+ years, they've consistently delivered with strong ownership across multiple projects. The team is reliable and detail-oriented.”
L
Lee Erswell
CEO, Telos Foundation
how to get started

How to get started?

If you're looking for blockchain integration, ChainScore Labs has 5+ years of experience helping teams build and integrate exchanges, wallets, smart contracts, tokenization solutions, and protocol-connected products, we can help you choose the right path, integrate securely, and get to production faster. Our team consists of experienced blockchain developers and architects who can help you with your blockchain integration needs.

01

Exploration & Strategy

Define your product goals and choose the right blockchain architecture for your use case.

02

Architecture & Design

Design the smart contracts, tokenomics, and security parameters of your system.

03

Development & Integration

Build and integrate with wallets, oracles, and front-end dApps for a seamless experience.

04

Security & Launch

Comprehensive audits followed by a risk-managed mainnet deployment to protect your users.

Start a build

Need a blockchain engineering team?

Send the project context and we will respond with next steps, scope questions, and a practical path to delivery.