Add a MuSig2 function to multiwallet.
Opened this issue · 5 comments
Now that MuSig2 is merged, add something to multiwallet to play with it on signet.
Very much interested in MuSig2 support. Be happy to help make this happen if I could get some direction
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.
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
- Generate a p2tr private and public key pair
- Run nonce_gen to get nonce_secrets and nonce_points
- Share public key and nonce_points
- Aggregate public keys using a MuSigTapScript to get MuSig p2tr address (fund the address)
- Round 2
- Construct a Tx that spends from MuSig p2tr address
- Calculate sum of shared nonce_points
- Sign sig_hash of Tx using own nonce_secrets, priv_key and nonce_sums
- Share signature
- Aggregate signatures
- Use signature to finalize spend of MuSig p2tr input.
- Broadcast tx
Should this be using PSBTs somehow to store and share the partial signatures between participants?
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.
I see, interesting. Will take a look