Repository navigation
docs: Miniscript coordinator pattern reference (draft) - #4
Vibherpunk wants to merge 2 commits into
Conversation
Adds reference material for the coordinator-side Miniscript approach, adapted from TDH-Labs/Bitme. Includes: - Formal invariant tests (generalized from Satochip to generic hardware) - Descriptor construction pattern - Coordinator flow documentation This is reference material for discussion, not the TypeScript implementation. See docs/miniscript-reference/README.md for details.
|
Thanks for opening this as a draft. Before implementation, could you please address these points?
|
|
Thanks for the feedback! I've updated the PR description and added clear disclaimers to the reference files to address all four of your points. The scope, inheritance boundary, and distinction from the actual Keeper policy should be much clearer now. |
|
Thanks, Adam. The updated PR description and Bitme-only warnings make the reference scope clear. Would you be interested in taking a focused Keeper-specific SigningServer implementation step in a separate PR? A good starting point would be one concrete missing server behavior for Keeper’s actual 2-of-3 Mobile + Hardware + Server policy, with the optional inheritance path defined in the wallet’s Miniscript policy: add a runnable TypeScript test that shows the gap, then make the smallest server change needed to pass it. Independent checking of PSBT script and UTXO data against the server-owned policy may be a candidate if a test demonstrates a gap in the current checks. The wallet-app coordinator and hardware signing work are separate. Which first server case would you take? |
Description
Summary
Demonstrates the coordinator-side Miniscript approach for hardware wallets that don't natively understand Miniscript (Satochip, TAPSIGNER).
The coordinator (wallet app) parses the Miniscript descriptor, determines the spending path, and constructs the PSBT with the correct witness script. The hardware device just signs the sighash digest — no policy understanding required on the device.
This keeps simple, durable hardware usable in Miniscript wallets instead of restricting Miniscript to devices that fully understand the policy.
What's included (Reference Only)
This initial draft includes only Rust reference files adapted from Bitme, to aid discussion of the pattern:
docs/miniscript-reference/descriptor-reference.rsdocs/miniscript-reference/invariants-reference.rsdocs/miniscript-reference/coordinator-pattern.mddocs/miniscript-reference/README.mdNote on Bitme vs. Keeper Policies: The provided Rust references and the sequence diagram in
coordinator-pattern.mdencode Bitme's specific policy (exactly one immediate path, older(N) timelocks, server-side hold/veto). These are explicitly marked as Bitme-only reference material. Any implementation for Keeper will strictly use Keeper's actual wallet policy (e.g., 2-of-3 base + Inheritance Key paths).Explicit Inheritance Boundary
It is important to emphasize that the Inheritance Key and the conditions for its spending path belong purely in the wallet's Miniscript policy. They are not an Inheritance Key approval or timelock implemented by SigningServer. The server's notification, delay, and veto mechanics govern only the server's own signature. The server participates in a spend only if the chosen path uses its key.
Planned Follow-up Work (Server-Side Scope)
The actual implementation will be focused entirely on missing server cases (app-side coordinator/Satochip implementation will be a separate app PR).
Since
SigningServeralready has Miniscript descriptor handling and PSBT address checks, the planned TypeScript follow-up work will include:witness_scriptandwitness_utxofrom a server-owned descriptor to ensure the server isn't simply trusting the PSBT's metadata).src/miniscript/descriptor.tsandsrc/miniscript/invariants.ts: To perform semantic analysis and formal policy checks (ensuring no single key can spend alone, exactly one immediate path if applicable, etc.) for Keeper's actual policy.tests/miniscript.test.ts: Runnable invariant tests using Keeper's policy.The coordinator pattern
From Bitme's approach:
witness_scriptfor that pathReferences
Open questions for maintainer (before full implementation)
Miniscript library: Which JS/TS library should we use? Options:
bitcoinjs-lib(has partial Miniscript support)Directory placement: New
src/miniscript/or inside existingsrc/wallet/?