Skip to content

Conversation

@instagibbs
Copy link
Contributor

Code examples are clearer than doc explanations in a few ways, so figured I'd just submit this.

@rage-proof
Copy link

I would like to see in the example secp256k1_musig_extract_adaptor, so to verify that the input and output secret-adaptor are identical.

@instagibbs instagibbs force-pushed the musig_adaptor_example branch from 427ca95 to e502240 Compare February 27, 2023 16:09
@instagibbs
Copy link
Contributor Author

@rage-proof year late, but I came back around to the API and would have found it useful so done.

Copy link
Collaborator

@real-or-random real-or-random left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

I wonder if this example should go to a separate function. Adaptors add quite a lot to the flow and increase the brain power necessary to follow this example, so this is probably confusing for users who want to see a minimal example. If that means duplicating some of the code, this is not a problem, I think.

examples/musig.c Outdated
if (!secp256k1_musig_adapt(ctx, sig64, presig, adaptor_key, nonce_parity)) {
return 0;
}
/* With sig64 "on-chain" now, other party can grab the revealed adaptor secret */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* With sig64 "on-chain" now, other party can grab the revealed adaptor secret */
/* With sig64 "on-chain" now, other party can grab the revealed adaptor secret */

wrong indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed tabs

examples/musig.c Outdated
if (!secp256k1_musig_nonce_parity(ctx, &nonce_parity, &session)) {
return 0;
}
if (!secp256k1_musig_partial_sig_agg(ctx, presig, &session, partial_sigs, N_SIGNERS)){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!secp256k1_musig_partial_sig_agg(ctx, presig, &session, partial_sigs, N_SIGNERS)){
if (!secp256k1_musig_partial_sig_agg(ctx, presig, &session, partial_sigs, N_SIGNERS)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

examples/musig.c Outdated
if (!secp256k1_musig_extract_adaptor(ctx, extracted_adaptor, sig64, presig, nonce_parity)) {
return 0;
}
if (memcmp(extracted_adaptor, adaptor_key, sizeof(adaptor_key)) != 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you assert this? We normally use assert for these comparisons in the other examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

examples/musig.c Outdated
}
printf("ok\n");
printf("Verifying signature.....");
printf("Verifying signature and revealed adaptor.....");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're verifying the adaptor here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errr extracting revealed secret, I guess is the phrase?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only saying that the printf not match the code below, which still only verifies a sig.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I added this in the wrong spot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@instagibbs instagibbs force-pushed the musig_adaptor_example branch from e502240 to 94ab85b Compare October 28, 2025 14:11
@instagibbs
Copy link
Contributor Author

instagibbs commented Oct 28, 2025

a bit of renewed interest in adaptor sigs, so rebased this

granted, this is likely not synced with upstream...

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.

3 participants