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:
Solana:
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Ethereum Mainnet:
eip155:1
Optimism:
eip155:10
Polygon:
eip155:137
Arbitrum:
eip155:42161
Tron:
tron:mainnet
Stellar:
stellar:pubnet
Bitcoin:
bip122:000000000019d6689c085ae165831e93-p2wpkh
The only exception to our chains adhering to the CAIP-2 standardized format is Bitcoin networks, which require special consideration due to the variety of address types they support.
Conversion Table
Solana Mainnet
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Solana Devnet
solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1
Ethereum Mainnet
eip155:1
Optimism
eip155:10
Polygon
eip155:137
Arbitrum
eip155:42161
Base
eip155:8453
Base Sepolia
eip155:84532
Stellar
stellar:pubnet
Stellar Testnet
stellar:testnet
Tron
tron:mainnet
Tron Nile Testnet
tron:nile
Tron Shasta Testnet
tron:shasta
Bitcoin (p2wpkh)
bip122:000000000019d6689c085ae165831e93-p2wpkh
Bitcoin Testnet (p2wpkh)
bip122:000000000933ea01ad0ee984209779ba-p2wpkh
Understanding the 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
Was this helpful?