Skip to main content

Module canonical_origin

Module canonical_origin 

Source
Expand description

Canonical-origin map per spec §4 (v0.13 wallet-policy layer).

Given the top-level wrapper of a descriptor template, return the canonical path-from-master for elided origin paths — or None if the wrapper shape is not in the canonical table (in which case the encoder must emit explicit OriginPathOverrides entries for all @N placeholders).

Wrapper shape → canonical:

ShapeCanonical
pkh(@N) single-keym/44'/0'/0'
wpkh(@N) single-keym/84'/0'/0'
tr(@N) key-path only (no TapTree)m/86'/0'/0'
wsh(multi/sortedmulti)m/48'/0'/0'/2'
sh(wsh(multi/sortedmulti))m/48'/0'/0'/1'
sh(sortedmulti) legacy P2SH multiNone (forced explicit)
tr(@N, TapTree)None (forced explicit)
anything elseNone (forced explicit)

Functions§

canonical_origin
Compute the canonical origin path for the top-level wrapper tree, per spec §4. Returns None for shapes that require explicit OriginPathOverrides on the wire.