Skip to content

Optionally pass BIP388 policy to displayaddress - #841

Draft
Sjors wants to merge 21 commits into
bitcoin-core:masterfrom
Sjors:2026/08/display-address-bip388
Draft

Optionally pass BIP388 policy to displayaddress#841
Sjors wants to merge 21 commits into
bitcoin-core:masterfrom
Sjors:2026/08/display-address-bip388

Conversation

@Sjors

@Sjors Sjors commented Aug 2, 2026

Copy link
Copy Markdown
Member

This builds on #842 and adds address display for registered BIP388
descriptor policies.

displayaddress accepts:

A generic device test registers the simple multisig policy introduced by
#842 and then displays address index 7. Device support is added one
device per commit.

@Sjors Sjors mentioned this pull request Aug 2, 2026
@Sjors
Sjors force-pushed the 2026/08/display-address-bip388 branch 2 times, most recently from 499c52a to 9223771 Compare August 4, 2026 19:56
@Sjors

Sjors commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Rebased to follow the approach in #842.

@Sjors

Sjors commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

This needs a rebase after #819, but I'll wait for #842 to have green CI.

achow101 and others added 21 commits August 5, 2026 10:05
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.
Add a helper that selects a receive or change branch and address
index without mutating the original descriptor.
Accept a serialized registered descriptor, address index, and change
flag, then request that address from the selected device.
Extend the generic descriptor registration test to display address index
7 from the registered policy.
Reconstruct the wallet policy from the registered descriptor, then
display the selected receive or change address.
Derive the selected wsh(sortedmulti()) policy address and display it
through the existing multisig command.

Approve descriptor enrollment in the simulator and iterate over its
multisig path mapping values when confirming enrollment.
Use the registered descriptor name to request the selected receive or
change address.
Move BIP388 policy translation into a helper without changing
registration behavior.
Translate the registered policy into a BitBox02 script
configuration and display the selected receive or change address.
@Sjors
Sjors force-pushed the 2026/08/display-address-bip388 branch from c2ac62c to c2b14d1 Compare August 6, 2026 08:01
@Sjors

Sjors commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

Rebased and now using RegisteredDescriptor from #842. The --desc argument is now mutually exclusive with --registration, which simplifies things slightly.

Note that ColdCard edge firmware has more broad policy support, but this PR doesn't but this PR doesn't switch to that. This might be worth doing once we add MuSig2.

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.

2 participants