wire / encoding / base58check

Base58Check (Bitcoin)

Base58Check wraps a payload in a one-byte version prefix and a 4-byte checksum (the first 4 bytes of SHA-256(SHA-256(version || payload))), then Base58-encodes the whole thing. The checksum lets a decoder detect typos before acting on a value, which is why it encodes Bitcoin addresses, WIF private keys, and extended keys. Decoding it without verifying the checksum is a bug.

encoding kind encoding status de-facto verification verified tier B encoding@1

aka: base58-check · Bitcoin address encoding · Check58

test vectors

Bitcoin Wiki — Base58Check encoding · alphabet: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

inputoutputnote
00010966776006953D5567439E5E39F86A0D273BEE bytes-hex 16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM ascii Canonical Bitcoin Wiki 'Technical background of address' worked example: version 0x00 + HASH160 010966776006953D5567439E5E39F86A0D273BEE, double-SHA-256 checksum appended, base58 -> address 16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM. (For this codec the gate computes the checksum; input is version||payload as hex.)
16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM ascii 00010966776006953D5567439E5E39F86A0D273BEE bytes-hex Round-trip: base58check-decode strips and verifies the 4-byte checksum, yielding version||payload = 00 + HASH160 (hex).

provenance

see also

agent: curl -H 'accept: application/json' wire.phall.io/encoding/base58check or /encoding/base58check.json