Skip to content
New issue

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

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

Already on GitHub? # to your account

Add a MuSig2 function to multiwallet. #130

Open
jimmysong opened this issue Feb 25, 2022 · 5 comments
Open

Add a MuSig2 function to multiwallet. #130

jimmysong opened this issue Feb 25, 2022 · 5 comments
Assignees

Comments

@jimmysong
Copy link
Collaborator

Now that MuSig2 is merged, add something to multiwallet to play with it on signet.

@jimmysong jimmysong self-assigned this Feb 25, 2022
@wip-abramson
Copy link

Very much interested in MuSig2 support. Be happy to help make this happen if I could get some direction

@jimmysong
Copy link
Collaborator Author

Awesome! Take a look at taproot.py, particularly the MuSigTapScript class and the tests associated with it (test/test_musig.py). That should give you a good idea of how MuSig is called with multiple parties.

If you have any questions, please ask here. I'll try to be helpful by adding documentation.

@wip-abramson
Copy link

Okay great, I think I understand the MuSig aspect. A bit unsure about the integration with multiwallet and the format for passing the required data around. Will this use a coordinator, or will all parties have to pass data to each other?

I believe the steps are:

  • Round 1
  1. Generate a p2tr private and public key pair
  2. Run nonce_gen to get nonce_secrets and nonce_points
  3. Share public key and nonce_points
  4. Aggregate public keys using a MuSigTapScript to get MuSig p2tr address (fund the address)
  • Round 2
  1. Construct a Tx that spends from MuSig p2tr address
  2. Calculate sum of shared nonce_points
  3. Sign sig_hash of Tx using own nonce_secrets, priv_key and nonce_sums
  4. Share signature
  5. Aggregate signatures
  6. Use signature to finalize spend of MuSig p2tr input.
  7. Broadcast tx

Should this be using PSBTs somehow to store and share the partial signatures between participants?

@jimmysong
Copy link
Collaborator Author

This is a pretty big project, but there's a BIP for PSBT for MuSig2:

https://github.com/achow101/bips/blob/musig2-psbt/bip-musig2-psbt.mediawiki

It makes integration much wider scope, but any other transport to other users is bound to be deprecated.

@wip-abramson
Copy link

I see, interesting. Will take a look

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants