sigil-bitcoin-encoding
sigil bitcoin encoding
(sigil bitcoin encoding) — Bitcoin address encoding formats
hex-encode
procedureEncode a bytevector as lowercase hexadecimal text.
hex-decode
procedureDecode an even-length hexadecimal string into a bytevector. Raises an error for odd-length input or invalid hex characters.
base58-encode
procedureEncode a bytevector with Bitcoin's Base58 alphabet. Leading zero bytes are preserved as leading `1` characters.
base58-decode
procedureDecode a Bitcoin Base58 string into a bytevector. Raises an error if the string contains characters outside the Bitcoin Base58 alphabet.
base58check-encode
procedureEncode a Base58Check payload with a one-byte version prefix. The checksum is the first four bytes of HASH256(version || payload).
base58check-decode
procedureDecode a Base58Check string. Returns `(version . payload)` and raises an error on checksum failure.
bech32-encode
procedureEncode a Bech32 string using the BIP173 checksum constant. `hrp` is the human-readable part and `data` is a bytevector of 5-bit values.
bech32-decode
procedureDecode a Bech32 string. Returns `(hrp . data)` where `data` excludes the six checksum values.
bech32m-encode
procedureEncode a Bech32m string using the BIP350 checksum constant.
bech32m-decode
procedureDecode a Bech32m string. Returns `(hrp . data)` where `data` excludes the six checksum values.
segwit-encode
procedureEncode a native SegWit address for a witness version and program. Version 0 uses Bech32. Versions 1 through 16 use Bech32m.
segwit-decode
procedureDecode a native SegWit address. Returns `(hrp version . program)` and validates the checksum variant required by the witness version.