Skip to content
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

Schnorr - combine 2 signature #2712

Open
tinguyen1107 opened this issue Apr 23, 2024 · 5 comments
Open

Schnorr - combine 2 signature #2712

tinguyen1107 opened this issue Apr 23, 2024 · 5 comments

Comments

@tinguyen1107
Copy link

Hi guys, I'm trying to implement the statecoin protocol, I used the schnorr to handle the multisig between the server and user. We create the signature using this one

    let sighash = sighasher
        .taproot_key_spend_signature_hash(input_index, &prevouts, sighash_type)
        .expect("failed to construct sighash");

    let tweaked: TweakedKeypair = keypair.tap_tweak(&secp, None);
    let msg = Message::from(sighash);

    let signature = secp.sign_schnorr(&msg, &tweaked.to_inner());

    let signature = bitcoin::taproot::Signature {
        sig: signature,
        hash_ty: sighash_type,
    };

I wonder that how we can combine 2 sign together and spend the transaction?

@tinguyen1107
Copy link
Author

Hi @apoelstra, sorry I don't know what you mean? You mean I should not try to implement it on my own? This is for study purpose only, if you know please help me with this :(((

@apoelstra
Copy link
Member

I do not know anything about the "statecoin protocol". In general it is not possible to combine two Schnorr signatures.

@tinguyen1107
Copy link
Author

ah it is statechain, sorry, hmmm... never mind, thanks for your time

@storopoli
Copy link
Contributor

storopoli commented Apr 23, 2024

I do not know anything about the "statecoin protocol". In general it is not possible to combine two Schnorr signatures.

The "In general" is not that helpful.
However, you can combine two Schnorr signatures in something called "Naive Schnorr multi-signatures".
The intuition behind it is that Schnorr sig is "linear", i.e. it does not have a mod inverse in signing like DSA (or ECDSA).

Ref: https://blog.blockstream.com/en-musig-key-aggregation-schnorr-signatures/

PS: This is not peer-reviewed but Slide 21 here goes through the Math - https://github.com/storopoli/cryptography-workshop/releases/latest

PS2: Maybe we move this to the Discussions instead of keeping it as an issue?

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

No branches or pull requests

3 participants