bitcoinjs-lib
bitcoinjs-lib copied to clipboard
How to make taproot P2TR multiSig wallet
Bitcoinjslib provides us how to make Segwit multisig wallet.
But in my project, I need to provide all of it.
Who can help me?
In taproot there are two ways to make a multisig script. Since CHECKMULTISIG op code was removed for taproot.
- "Musig", a method in which you combine N keys into a single key for signing, is more difficult and error prone. We don't offer a simple API to perform that.
- Currently, the most secure way of doing multisig in taproot is using the CHECKSIG + CHECKSIGADD + NUMEQUAL method. See the example linked below for an example. If all you want is a single multisig, creating a scriptTree with only a single "leaf" (script) is fine. However, the multisig participants should verify that the key spend (internal pubkey) is unspendable.
https://github.com/bitcoinjs/bitcoinjs-lib/blob/8c88016d8f36e5268d6a3de3c5209e8dc29312e0/test/integration/taproot.spec.ts#L443-L529
I think I'll add a new example with just a simple multisig use case.
I added an example for your use case.
Please ask any questions you might have.
https://github.com/bitcoinjs/bitcoinjs-lib/blob/8d9775c20da03ab40ccbb1971251e71d117bcd8b/test/integration/taproot.spec.ts#L531-L593
Thx for ur kind advice
I followed above examples
After generate PSBT, I tried to sign PSBT use Unisat wallet but got below error
"Can not sign for input #0 with the key 025321d780d099750e7fbcec128213184c9ae0a86241eeacc826c37bce7febc0b8"
What kind of problem is this?