Skip to main content

Crate md_codec

Crate md_codec 

Source
Expand description

§md-codec

Reference implementation of the Mnemonic Descriptor (MD) format — an engravable backup format for BIP 388 wallet policies.

v0.30 wire format: bit-aligned payload, sparse per-@N TLV overrides, 5-bit single-payload header (4-bit version=4 + divergent_paths flag), 6-bit bytecode tag space, decoder auto-dispatch between single and chunked payloads via the first 5-bit symbol’s bit 0, symbol-aligned codex32 wrapping with HRP "md". See design/SPEC_v0_30_wire_format.md for the normative spec.

Re-exports§

pub use canonicalize::canonicalize_placeholder_indices;
pub use chunk::ChunkHeader;
pub use chunk::CorrectionDetail;
pub use chunk::decode_with_correction;
pub use chunk::derive_chunk_set_id;
pub use chunk::reassemble;
pub use chunk::split;
pub use decode::decode_md1_string;
pub use decode::decode_payload;
pub use encode::Descriptor;
pub use encode::encode_md1_string;
pub use encode::encode_payload;
pub use error::Error;
pub use header::Header;
pub use identity::Md1EncodingId;
pub use identity::WalletDescriptorTemplateId;
pub use identity::WalletPolicyId;
pub use identity::compute_md1_encoding_id;
pub use identity::compute_wallet_descriptor_template_id;
pub use identity::compute_wallet_policy_id;
pub use identity::validate_presence_byte;
pub use origin_path::OriginPath;
pub use origin_path::PathComponent;
pub use origin_path::PathDecl;
pub use origin_path::PathDeclPaths;
pub use phrase::Phrase;
pub use tag::Tag;
pub use tlv::TlvSection;

Modules§

bch
BIP 93 codex32 BCH primitives for HRP "md" (regular code only).
bch_decode
Syndrome-based BCH decoder for the MD regular code.
bitstream
Bit-aligned reader and writer.
canonical_origin
Canonical-origin map per spec §4 (v0.13 wallet-policy layer).
canonicalize
BIP 388 placeholder-ordering canonicalization per spec v0.13 §6.1, plus per-@N canonical-fill expansion per §5.3 / §6.3.
chunk
Chunk header per SPEC v0.30 §2.2.
codex32
v0.11 ↔ codex32 BCH layer adapter, symbol-aligned per spec §3.1 / D7.
decode
Top-level decoder per spec §13.2.
derive
Address derivation (v0.32).
encode
Top-level encoder per spec §13.3.
error
Error variants for the md-codec wire-format codec.
header
Single-payload header (5 bits) per SPEC v0.30 §2.1.
identity
Identity computation per spec §8.
origin_path
Origin-path-decl block per spec §3.4.
phrase
BIP-39 phrase rendering per spec §8.4.
tag
v0.30 Tag enum per SPEC §3.
test_vectors
Canonical md test-vector corpus.
tlv
TLV section per spec §3.7 (extended in v0.13 §3.2 with Pubkeys and OriginPathOverrides).
to_miniscript
v0.32 AST → miniscript::Descriptor<DescriptorPublicKey> converter.
tree
Tree (operator AST) per spec §3.6 + §6.
use_site_path
Use-site-path-decl block per spec §3.5.
validate
Decoder-side validation per spec §7.
varint
LP4-ext varint per spec §4.1.