Skip to main content

Module encoding

Module encoding 

Source
Expand description

Shared encoding utilities used across all chain modules.

Centralizes Bitcoin compact-size (varint), Bech32/Bech32m, and Base58Check encoding so chain modules don’t duplicate these building blocks.

Functions§

base58check_decode
Decode a Base58Check string. Returns (version, payload).
base58check_encode
Encode data with Base58Check: Base58(version ‖ payload ‖ checksum[0..4]).
bech32_encode
Encode a SegWit/Taproot address using Bech32 (v0) or Bech32m (v1+).
encode_compact_size
Encode a Bitcoin compact-size integer into a buffer.
read_compact_size
Read a Bitcoin compact-size integer from a byte slice at the given offset.