CAIP-50: Multi-Chain Account ID Specification
Simple Summary
CAIP-50 defines a way to identify blockchain account addresses uniquely across multiple blockchains
Abstract
This proposal aims to facilitate using unique address for accounts on multiple blockchain systems using a multi-codec format that encodes variable integer for chain identifiers complaint with CAIP-2 blockchain id specification. This is useful for both decentralized applications and wallets to communicate user accounts for multiple chains using unique identifiers which are machine veriable and can be decoded to identify the original address and chainId encoded. This proposal aims to standardize these identifiers for accounts to allow inteoperability for multi-chain applications.
Motivation
The motivation for this proposal came from different feedback received from the adoption of CAIP-10 and tackles these to provide a significant improvement in more efficient communication of these identifiers using smaller byte footprint while preserving uniqueness and interoperability.
Specification
In this specifiation we define the Multi-Chain Account Id or MACI for short which is a compactly encoded account identifier that is contextual to a blockchain using a CAIP-2 chainId.
Syntax
Semantics
multibase_prefix
- the prefix which defines which multibase is used to encode the bytes,z
forbase58btc
mcai_code
- a number registered on the multicodec table, makes the multi-chain account id upgradable, encoded as varintchain_namespace
- see table below, encoded as varintid_size
- the length in bytes of thechain_id
, encoded as varintchain_id
- the chain id, encoding is defined by the chain namespaceaddress_size
- the length of the address, encoded as varintaddress
- the address itself, encoding is defined by the chain namespaceparity_byte
- a checksum byte, see section below
MCAI multicodec
Should be a number registered on the multicodec table. In the examples below we use 0xCA
but this is subject to change.
Chain namespaces
Each blockchain namespace needs to be properly defined with a registry table:
Registry Table
Namespace | code |
---|---|
bip122 | 0x00 |
eip155 | 0x01 |
cosmos | 0x02 |
polkadot | 0x03 |
filecoin | 0x04 |
lip9 | 0x05 |
eosio | 0x06 |
tezos | 0x07 |
BIP122 Namespace (CAIP-4)
Chain ID: Convert from hex to bytes
Address: Convert from base58btc to bytes
Example:
In the exammple below we encode 128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6
on bitcoin mainnet.
This means that we use chain_id = 000000000019d6689c085ae165831e93
EIP155 Namespace (CAIP-3)
Chain ID: Convert from integer to bytes
Address: Convert from hex to bytes
Example:
In the exammple below we encode 0xde30da39c46104798bb5aa3fe8b9e0e1f348163f
on ethereum mainnet.
This means that we use chain_id = 1
Cosmos Namespace (CAIP-5)
- TODO
Polkadot Namespace (CAIP-13)
- TODO
Filecoin Namespace (CAIP-23)
- TODO
LIP9 Namespace (CAIP-6)
- TODO
EOSIO Namespace (CAIP-7)
- TODO
Tezos Namespace (CAIP-26)
- TODO
Parity byte
Using the algorithm described on Wikipedia: checksums. XOR each byte word in the mcai, the resulting byte is the parity byte.
Making MCAI human readable
We could easily build tools and UIs that decompose the encoded mcai similar to this: https://cid.ipfs.io/#bagcqcera6wh5laey5njuo2weun46wv4cn2jlbn6qio6mt3bwian4kbp76tdq
Implementation
Below is a PoC implementation in javascript
Test Cases
This is a list of manually composed examples comparing CAIP-10 and CAIP-50 identifiers
Links
- CAIP-2 - Blockchain ID Specification
- CAIP-10 - Account ID Specification
- Multicodec - https://github.com/multiformats/multicodec/
Copyright
Copyright and related rights waived via CC0.