Chains

Cardano

Shelley and stake addresses decoded under CIP-19 with their Bech32 checksum verified. Byron addresses decoded the way the ledger reads them, CRC-32 verified.
create
create("cardano")
family
UTXO · utxo
symbol
ADA · 6 decimals
bip44
1815
caip2
cip34:1-764824073
explorer
cardanoscan.io

Address format

Shelley addr1… and stake stake1… addresses are read the same way: the Bech32 checksum under addr or stake, past the 90 characters BIP-173 allows because a base address is 103, then CIP-19's header. The network tag has to be mainnet's, the type has to fit the prefix, and the payload has to be what the type carries: two 28-byte credentials for a base address, one for an enterprise or reward address, one plus a pointer for a pointer address. A pointer has to carry the three coordinates the ledger reads, seven bits a byte, within their widths, with nothing left over.

Byron Ae2… and DdzFF… addresses are read the way the Byron ledger's decodeCrcProtected reads them: an array of two, tag 24 over the payload's byte string, then a CRC-32 that has to be the payload's. The payload has to be the array of three the ledger decodes, a 28-byte root, the attribute map and a type it knows, 0 for a verification key and 2 for a redeem key, with nothing after. The attributes are byte strings under small keys the ledger keeps unparsed unless it knows them, and key 2 is the network magic, which only a test network writes: the mainnet ledger reads any value there as a testnet address, so the address fails. That includes the Byron example in CIP-19, which carries the legacy testnet magic.

import { getChain } from "@agntn/chains";

const chain = getChain("ada");
chain.assertAddress("addr1qx2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3n0d3vllmyqwsx5wktcd8cc3sq835lu7drv2xwl2wywfgse35a3x"); // returned unchanged
chain.type; // "utxo"
chain.caip2; // "cip34:1-764824073"

Spellings

cardano, ada, Cardano. The key is cardano, the rest resolve through getChain.

@agntn/chains·MIT license· A format check, not proof an address exists. Nothing on this site talks to a chain.