Optionally pass BIP388 policy to signtx - #792
Draft
Sjors wants to merge 22 commits into
Draft
Conversation
Sjors
force-pushed
the
2025/07/policy-sign
branch
7 times, most recently
from
July 30, 2025 19:02
31a9714 to
dfd11e0
Compare
Member
Author
|
Coldcard CI failure is probably spurious. |
Sjors
force-pushed
the
2025/07/policy-sign
branch
from
September 4, 2025 06:30
dfd11e0 to
b53160a
Compare
Member
Author
|
Rebased after #795 landed. |
Member
Author
Sjors
marked this pull request as draft
July 4, 2026 09:40
Sjors
force-pushed
the
2025/07/policy-sign
branch
from
July 31, 2026 08:00
b53160a to
5efe2fd
Compare
Sjors
marked this pull request as ready for review
July 31, 2026 08:00
Member
Author
|
Rebased after #836. |
Sjors
marked this pull request as draft
August 1, 2026 18:51
Sjors
force-pushed
the
2025/07/policy-sign
branch
from
August 2, 2026 10:15
5efe2fd to
2b7270b
Compare
Member
Author
|
This now uses the same approach as #791, with the first two commits shared, so I'll keep this draft. |
Sjors
force-pushed
the
2025/07/policy-sign
branch
from
August 2, 2026 11:03
2b7270b to
6d541f6
Compare
The sort in sortedmulti occurs only during script expansion. Keep the pubkeys in the order that they were provided to the parser.
For BIP388 policies, we will need to know wht index of each key expression, so keep track of them explicitly with a key expression index stored in each PubkeyProvider. This also mirrors what Bitcoin Core does for descriptors.
The derivation path should be parsed and validated for correctness, not just copied directly into a pubkey provider.
get_bip388_template returns the descriptor as a BIP 388 Wallet Descriptor Template string. get_pubkey_providers returns all of the pubkey providers from the descriptor, in the same order as the placeholders in the bip388 template. Callers can get the strings for the key information vector by calling PubkeyProvider.to_string_no_deriv()
After a descriptor is registered, we want to return to the caller some information about the registration. RegisteredDescriptor is a class that contains the name, the descriptor, the device type, and any data that the device returned in response to the registration. This class can be de/serialized from/to a string.
Adds registerdescriptor CLI command and its handlers. Adds register_descriptor to HardwareWalletClient with boilerplate implementation.
BitBox01, Trezor, and Keepkey do not support registering descriptors. Implement the function as a throw.
Co-authored-by: Codex (GPT-5.6 Sol) <noreply@openai.com>
Accept a serialized registered descriptor with signtx and dispatch policy signing through a dedicated device method.
Extend the generic descriptor registration test to fund, sign, and finalize a transaction spending from the registered policy.
Reconstruct the registered wallet policy and pass its registration HMAC when signing the PSBT.
Sjors
force-pushed
the
2025/07/policy-sign
branch
from
August 6, 2026 08:40
6d541f6 to
b562044
Compare
Member
Author
HWI's Coldcard simulator patch stores multiple derivation paths per fingerprint so one seed can represent several multisig cosigners. get_xfp_paths() iterates fingerprint keys instead of path lists. This breaks descriptor enrollment and later signing fails with "Unknown multisig wallet". Iterate over the mapping values instead.
Sign with the existing PSBT flow after registerdescriptor has stored the policy on the device.
Sign with the existing PSBT flow after registerdescriptor has stored the policy on the device.
Move descriptor-to-policy translation into a reusable helper without changing registration behavior.
Translate the registered descriptor into the policy script configuration and use it for transaction inputs and change outputs.
Sjors
force-pushed
the
2025/07/policy-sign
branch
from
August 6, 2026 12:13
b562044 to
43c0b51
Compare
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Another step toward #785. This builds on #842.
This adds optional registered BIP388 descriptor policy information to
signtx. Existingsigntxusage remains unchanged when no registrationis supplied.
signtxaccepts--registration, containing the serializedRegisteredDescriptorreturned by theregisterdescriptorcommand from#842. The registration contains the policy name, descriptor, device type,
and any device-specific registration data, so separate
--policy-descand
--policy-namearguments are not needed.Example: