Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines CAIP-2, which defines strings that uniquely identify blockchains and provide a basis for referencing assets and contracts across networks.
This explanation translates, summarizes, and expands on the following specification.
For other EIPs, BIPs, SLIPs, and CAIPs, see https://cardene.dev/proposals.
Overview
CAIP-2 provides a format for identifying blockchains that is readable by humans and developers and convenient for transactions. It identifies not only Ethereum mainnet and Görli but also other blockchains such as Bitcoin and Cosmos Hub. Ethereum uses chain IDs defined by EIP-155, which alone do not provide universal identification for other ecosystems. CAIP-2 allows networks to be referenced consistently.
For EIP-155, see the following article.
EIP-155 Explained: Preventing Replay Attacks Across Ethereum Networks
Motivation
CAIP-2 originated from discussions about EIP-2256 on Ethereum Magicians, highlighting the need for wallets and smart contracts to identify their networks precisely in a common format. The Universal Chain Registry, established around the same time, also needed well-defined chain identifiers. Discussions brought together the Ethereum community and ChainAgnostic group, leading to CAIP-2 as a unified cross-chain identification specification.
This helps avoid confusion when referencing assets and contracts across networks and improves development and operational efficiency.
Specification
A chain ID is a developer-friendly string that uniquely identifies a blockchain. Applications and services can use the same rules to distinguish and reference networks.
Syntax
A chain ID is a case-sensitive string with the following format.
chain_id: namespace + ":" + reference
namespace: [-a-z0-9]{3,8}
reference: [-_a-zA-Z0-9]{1,32}The namespace comes first, followed by a colon and the reference.
- The namespace is 3–8 characters long and permits lowercase letters, digits, and hyphens.
- The reference is 1–32 characters long and permits uppercase and lowercase letters, digits, hyphens, and underscores.
Semantics
The namespace categorizes related blockchains, typically identifying an ecosystem or standard such as cosmos or eip155. Each namespace corresponds to a defined method for identifying chains.
The reference identifies a particular blockchain within that namespace, such as eip155:1 for Ethereum mainnet.
Namespace-specific details, including the precise syntax and meaning of references, are defined in separate CAIP documents. This enables extensibility while maintaining common identification rules.
Additional Considerations
The four principal goals are global uniqueness across blockchain ecosystems, sufficient human readability for debugging, bounded length and structure suitable for on-chain storage, and a simple character set that can be safely displayed as transaction information on hardware wallets.
Secondary benefits include use in URL paths and as filenames on case-sensitive UNIX-like filesystems, including Linux and Git environments. Compatibility with filenames on case-insensitive macOS and Windows filesystems is deliberately not guaranteed to preserve the other constraints.
Test Cases
Ethereum mainnet is identified as eip155:1, and Bitcoin mainnet as bip122:000000000019d6689c085ae165831e93. Each combines a namespace and reference.
Cosmos Hub uses identifiers such as cosmos:cosmoshub-2 and cosmos:cosmoshub-3, depending on the network version. Binance Chain similarly uses cosmos:Binance-Chain-Tigris.
Bitcoin-derived networks such as Litecoin and Feathercoin use bip122 with their own references. Other examples are the StarkNet testnet starknet:SN_GOERLI and Lisk mainnet lip9:9ee11e9df416b18b.
The example chainstd:8c3444cf8970a9e41a706fab93e7a6c4 demonstrates the maximum length of 41 characters: eight namespace characters, a colon, and 32 reference characters.
Citation
Copyright and related rights waived via CC0.
Conclusion
CAIP-2 defines a common format for uniquely identifying blockchain networks and supporting consistent cross-chain references to assets and contracts.
Further reading and author links:



