Bitcoin
- create
- create("bitcoin")
- family
- UTXO · utxo
- symbol
- BTC · 8 decimals
- bip44
- 0
- caip2
- bip122:000000000019d6689c085ae165831e93
- explorer
- blockstream.info
Address format
Three forms, two checks.
Legacy 1… and 3… addresses decode to 25 Base58Check bytes under version 0x00 or 0x05. The length and the version are checked, the four checksum bytes aren't, so a typo in a legacy address gets through when it still decodes to 25 bytes.
SegWit bc1… addresses get the full BIP-173 and BIP-350 treatment: Bech32 for witness version 0, Bech32m for versions 1 through 16, a program of 20 or 32 bytes for v0 and 2 to 40 bytes otherwise, zero padding, and the checksum. One character off fails. Both all lowercase and all uppercase pass, mixed case doesn't. A checksum can't rescue an invalid witness program.
Testnet is out on both branches: m…, n…, 2… and tb1… are rejected. So is a Litecoin L… address, its version byte is 0x30.
import { getChain } from "@agntn/chains";
const chain = getChain("btc");
chain.assertAddress("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"); // returned unchanged
chain.type; // "utxo"
chain.caip2; // "bip122:000000000019d6689c085ae165831e93"
Spellings
bitcoin, btc, Bitcoin. The key is bitcoin, the rest resolve through getChain.