Skip to content

MuSig2 power #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open

MuSig2 power #91

wants to merge 60 commits into from

Conversation

Sjors
Copy link
Owner

@Sjors Sjors commented Jun 25, 2025

Eunovo and others added 13 commits July 22, 2025 08:13
Previously, to determine if a desc is watchonly, `ToPrivateString()`, was used.
It returns `false` if there is at least one pubkey in the descriptor that does not have a private key.

ToPrivateString() behaviour will change in the following commits to only return false if no priv keys could be found for the pub keys in the descriptor.

IsWatchOnly() is added here to replace the use of ToPrivateString() for determining if a descriptor is 'watchonly'.

Co-authored-by: rkrux <[email protected]>
ToPrivateString() behaviour will be modified in the following commits.
This change ensures that wallet migration does not break.
- Refactor Descriptor::ToPrivateString() to allow descriptors with missing private keys to printed. Useful in descriptors with multiple keys e.g tr() etc.
- The existing behaviour of listdescriptors is preserved as much as possible, if no private keys are availablle ToPrivateString will return false
unused() descriptors do not have scriptPubKeys. Instead, the wallet uses
them to store keys without having any scripts to watch for.
A helper method to obtain all unused(key) descriptor SPKMs.
When a wallet contains only an unused(KEY) descriptor, use it. Previously the user would have to call listdescriptors and manually specify it.
achow101 added 10 commits July 31, 2025 15:40
Invert any_key_parsed so that the name matches the behavior.
There will be other functions within MutableTransactionSignatureCreator
that need to compute the same sighash, so make it a separate member
function.
Adds GetMuSig2SecNonces which returns secp256k1_musig_secnonce*, and
DeleteMuSig2Session which removes the MuSig2 secnonce from wherever it
was retrieved. FlatSigningProvider stores it as a pointer to a map of
session id to secnonce so that deletion will actually delete from the
object that actually owns the secnonces.

The session id is just a unique identifier for the caller to determine
what secnonces have been created.
Sjors and others added 26 commits August 1, 2025 12:17
Use derivehdkey instead of extracting each participant xpub (and derivation info) from  the listdescriptors output.

Additionally use the new <0;1> descriptor syntax.

Finally this commits adds a few debug log lines, and expand the explanation for why we use m/44h/1h/0h.
Use derivehdkey instead of extracting each participant xpub
from  the listdescriptors output.

Additionally use the new <0;1> descriptor syntax.

Also use bitcoin rpc instead of bitcoin-cli.
Replace the sign, finalize , bip32derivs and sighash_type arguments which
are passed to FillPSBT() and SignPSBTInput() with a PSBTFillOptions struct.

This makes it easier to add additional options later without large code
churn, such as avoid_script_path proposed in bitcoin#32857. It also makes the
use of default boolean options safer compared to positional arguments
that can easily get mixed up.
Expand taproot tests to cover avoid_script_path in  walletprocesspsbt.

When avoiding script paths, there's no need for the workaround that increases fee_rate to compensate for the wallet's inability to estimate fees for script path spends. We use this to indirectly test that key path was used.

We also check that taproot_script_path_sigs is not set.

Finally, for transactions that can't be signed using their key path, we try again by allowing the script path.

Additional test extended private keys were extracted from other tests.
Conflicts:
	src/script/sign.cpp

Using m_options.sighash_type
Conflicts:
	src/wallet/external_signer_scriptpubkeyman.h
	src/wallet/rpc/wallet.cpp
An earlier merge commit contained an outdated version of this.
@Sjors Sjors force-pushed the 2025/06/musig2-power branch from c524af5 to 66705f3 Compare August 1, 2025 11:04
@Sjors
Copy link
Owner Author

Sjors commented Aug 1, 2025

Fresh rebase after bitcoin#31244 landed.

Sjors added 2 commits August 1, 2025 13:52
External signer enabled wallets should always use the process PSBT flow.
Avoid going through CreateTransaction.

This has no effect until the next commit when WALLET_FLAG_EXTERNAL_SIGNER
no longer implies WALLET_FLAG_DISABLE_PRIVATE_KEYS. Without this change
signing with the GUI would break for external signers with private keys
enabled.
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.

4 participants