Skip to main content

Module path

Module path 

Source
Expand description

Origin-path codec — standard-table dictionary + 0xFE explicit-path escape hatch.

Per design/SPEC_mk_v0_1.md §3.5 (closure Q-3: cap = 10).

mk1-internal indicator-byte path dictionary. md1 v0.11+ encodes paths explicitly via OriginPath and does not carry a path-dictionary table; mk1’s dictionary is therefore standalone, not a sibling mirror. Historically (md-codec v0.10.x and earlier), md1 carried a compatible table via Tag::SharedPath / Tag::OriginPaths; the v0.11 architectural cleanup retired that table per descriptor-mnemonic/design/SPEC_v0_11_wire_format.md §1.4. The testnet companion 0x16 to mainnet 0x06 (BIP 48 nested-segwit multisig) was added in mk-codec v0.2.0; the addition is wire-additive (v0.1.x decoders reject 0x16 as Error::InvalidPathIndicator(0x16), v0.2+ decoders accept and resolve to m/48'/1'/0'/1').

Explicit-path encoding: indicator 0xFE, 1-byte component count (1..=10), then each component as LEB128-encoded u32 with the BIP 32 hardened-bit in the high bit.

Constants§

EXPLICIT_PATH_INDICATOR
Indicator byte for an explicit (non-standard-table) path.
STANDARD_PATHS
Standard-table dictionary entries — (indicator_byte, path_string).

Functions§

decode_path
Decode a path field starting at *cursor (advances the cursor).
encode_path
Encode a path: 1-byte standard-table indicator if available, else explicit-path escape hatch (0xFE + count + LEB128 components).
lookup_indicator
Look up a standard-table indicator → DerivationPath. Returns None for indicators outside the dictionary (reserved values 0x00, 0x08..=0x10, 0x18..=0xFD, 0xFF).
lookup_path
Look up DerivationPath → standard-table indicator. Returns None if the path is not in the dictionary (encoder falls through to explicit-path encoding). Comparison is structural (parses each table entry to a DerivationPath); this avoids the m/-prefix pitfall in bitcoin::bip32::DerivationPath’s Display.