Chain ID formatting
Overview
In the world of blockchain technology, it's common to encounter different formats for representing chain IDs. While the traditional EVM chain ID format, like 1
for Ethereum mainnet, is widely recognized, the CAIP-2 format offers a more comprehensive way to denote chain IDs across multiple curves. At Portal, we primarily use the CAIP-2 format for chain IDs for this reason. This document will clarify the differences and provide examples for Ethereum, Solana, and other EVM chains.
Traditional EVM Chain ID Format
The traditional EVM chain ID format is a straightforward numerical representation used by Ethereum Virtual Machine (EVM) compatible chains. Here are some examples:
Ethereum Mainnet:
1
Optimism:
10
Polygon:
137
Arbitrum:
42161
CAIP-2 Chain ID Format
The CAIP-2 (Chain Agnostic Improvement Proposal 2) format provides a more structured way to represent chain IDs, including the namespace and reference, which helps in uniquely identifying different blockchain networks. The format is namespace:reference
.
Examples:
Ethereum Mainnet:
eip155:1
Optimism:
eip155:10
Polygon:
eip155:137
Arbitrum:
eip155:42161
Solana Devnet:
solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1
Solana Testnet:
solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z
Solana Mainnet:
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Conversion Table
Understanding the Formats
Traditional EVM Chain ID: This format is used in EVM-only environments and is purely numerical.
CAIP-2 Format: This includes the namespace (e.g.
eip155
for Ethereum-based chains) followed by the chain-specific identifier. It is designed to be chain-agnostic and supports a wider variety of blockchain networks beyond just EVM-compatible ones.
Why CAIP-2?
The CAIP-2 format is essential for environments where multiple blockchain networks need to be identified and interacted with. It provides a standardized way to refer to chains, reducing ambiguity and enhancing interoperability across different platforms and applications.
Understanding both the traditional EVM chain ID format and the CAIP-2 format is crucial for interacting with multi-curve environments. If you have any questions or need further clarification, please reach out to our support team!
Last updated