Chain ID Registry
Abstract
Currently Cardano has two easily-usable networks: "mainnet" and "testnet". However, in the future, we expect more networks to exist and so we need some way to refer to these networks to be able to write better multi-network applications and systems.
Terminology
Existing network IDs
Cardano currently has three ways to refer to a network:
- The "network ID" included in every address and also optionally present in the transaction body. This only stores 16 possibilities (4 bits)
- The "network magic" used for Byron addresses and in the handshake with other nodes in the network layer. This is a random 32-bit number
- The genesis block hash (a 28-byte number)
Motivation
Blockchains can have multiple deployments of the same codebase. For example:
- Test networks where the base asset has no value (so devs can test at no cost)
- Test networks where the protocol is simplified for ease of testing (ex: Cardano but with a Proof of Authority consensus for stable block production in testing)
- Test networks for new features
- Plutus Application Backend (PAB) testnet
- Shelley incentivized testnet
- Forks that diverge in feature set (the many forks of Bitcoin and Ethereum)
dApps may be deployed on specific testnets that match their criteria and wallets need to know about these networks to know how to behave.
Additionally, having a standardized registry for networks allows easy integration into the broader crypto ecosystem via standards like CAIP-2
Specification
We create a machine-readable registry of networks
All entries in this registry should have the following entries:
- User-friendly name
- Network ID
- Network magic
- Genesis hash
When representing these networks in a human-readable string, the following format shall be used:
cip34:NetworkId-NetworkMagic
Rationale
We pick this format for the following reason:
- The network ID is too small to be used by itself. You can see from chainlist that 16 possibilities is too few
- The genesis hash is too long and user-unfriendly to be used.
Reference implementation
Copyright
This CIP is licensed under CC-BY-4.0