Encodings
Base58Check
Base58 with four bytes of double SHA-256 on the end. Bitcoin addresses and WIF keys and xpubs
Encoding / Base58
Base58Check
Base58 with four bytes of double SHA-256 on the end.
- Overhead
- +37% on random bytes
- Checksum
- checked on decode
- Standard
- Bitcoin Core base58.cpp (EncodeBase58Check)
- Used by
- Bitcoin, Litecoin, Dogecoin
family 4 / 20
Sample
- Out
- DthHcFYf2SzzprfE7TynLJ
- Back
- "hello world!"
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
Access
- Import
import { base58check } from "@agntn/encodings/base58" - CLI
encodings encode base58check 'hello world!' - Tryplayground with the sample above
- Kinbase58, base58-flickr, base58-ripple
Base58 with a seatbelt. The payload, then the first four bytes of its double SHA-256.
hex.encode(base58check.decode("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"));
// "0062e907b15cbf27d5425399ebf6f0fb50ebb88f18"
The genesis address: version 0x00, then the HASH160 of Satoshi's key. Change one character and decode throws ChecksumError. The double SHA-256 comes from @agntn/hashes, the one dependency this package has.
The version stays in the payload. Is 0x80 a WIF key and 0x05 a P2SH address? Sure, but that's network knowledge, and it lives in @agntn/keys. This codec checks the checksum and hands you the bytes.