Bitcoin
Bitcoin
"bitcoin""btc""Bitcoin"
- Symbol
- BTC · 8 decimals
- Coin type
- 0
- CAIP-2
- bip122:000…1e93
- Checks
- address · txid
Network
- CAIP-2
bip122:000000000019d6689c085ae165831e93 - Magic
f9beb4d9 - PoW
sha256d - RPC
none - Explorerblockstream.info
Access
- Create
create("bitcoin") - Resolve
getChain("btc") - CLI
chains info btc - Tryplayground with a sample address
Address format
Three forms, two checks.
Legacy 1… and 3… addresses decode to 25 Base58Check bytes under version 0x00 or 0x05, and the last four have to match a double SHA-256 of the other 21. One character off fails, the same as on the SegWit branch. A 1… address also passes as Bitcoin SV, which kept the version byte, so identify names both chains for it.
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.