Chains

Bitcoin

Legacy, Bech32 and Bech32m addresses. SegWit is checked to the letter of BIP-173 and BIP-350, legacy down to its Base58Check checksum.
IDbitcoin14 / 36utxo · BTC
Chain / UTXO

Bitcoin

"bitcoin""btc""Bitcoin"

Symbol
BTC · 8 decimals
Coin type
0
CAIP-2
bip122:000…1e93
Checks
address · txid
fields set 7 / 9

Network

CAIP-2bip122:000000000019d6689c085ae165831e93
Magicf9beb4d9
PoWsha256d
RPCnone
Explorerblockstream.info

Access

Createcreate("bitcoin")
ResolvegetChain("btc")
CLIchains 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.

ts
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.