Skip to content

Add Taproot miniscript (tr()) support#111

Merged
odudex merged 5 commits into
masterfrom
feat/taproot-miniscript
Jul 3, 2026
Merged

Add Taproot miniscript (tr()) support#111
odudex merged 5 commits into
masterfrom
feat/taproot-miniscript

Conversation

@odudex

@odudex odudex commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Enables registering, displaying Taproot miniscript descriptors and signing both key-path (BIP86) and script-path (tr(KEY, )) alongside the existing wsh() miniscript support.

Requires a custom libwally branch, crafted by @pythcoiner, followed by some tweaks.

@odudex odudex force-pushed the feat/taproot-miniscript branch 5 times, most recently from 7918a39 to e767f0e Compare July 3, 2026 16:50
odudex added 5 commits July 3, 2026 14:27
Bump the libwally submodule to the BUILD_STANDARD_SECP-aware amalgamation and pass -DBUILD_STANDARD_SECP=1 from every build (firmware, simulator, host tests) so MuSig2 and the unused ecdsa-s2c/anti-exfil layers are compiled out. Taproot (schnorr/bip341) is unaffected.
Open the registration gate so miniscript wrapped in tr() (taproot script-path) is accepted alongside wsh(); signing and classification were already taproot-aware. Route every descriptor parse through a new wallet_descriptor_parse() wrapper that caps recursion at KERN_DESCRIPTOR_MAX_DEPTH (32), bounding the one unbounded-recursion path on the 16KB LVGL task stack.
The miniscript script-type dropdown now offers Taproot alongside Native SegWit. Selecting it seeds the BIP48-style default path subscript 3h (tr) vs 2h (wsh); the Path button still overrides. Only the suggested origin string changes — key material is identical.
Classify a tr() descriptor's internal (key-path) key as ours / NUMS / external. NUMS detection matches BIP341 H against both bare pubkeys and the xpub form coordinators use (base key == H), mirroring Krux. A bare no-origin non-NUMS internal key is neither provably unspendable nor attributable to a participant and is rejected outright (VALIDATION_TR_INTERNAL_NOT_UNSPENDABLE). The info dialog shows a reassuring NUMS note / discourage-colored external note and skips blank xpub rows for raw keys.
psbt_trim() copied the key-path sig but not taproot_leaf_signatures, so
script-path (tapscript) spends exported with no signature.
@odudex odudex force-pushed the feat/taproot-miniscript branch from e767f0e to bb07065 Compare July 3, 2026 17:30
@odudex odudex merged commit 8b41ddd into master Jul 3, 2026
15 checks passed
@odudex odudex deleted the feat/taproot-miniscript branch July 12, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant