Closed robertcc0410 closed 5 months ago
You mean like musig, or using `OP_CHECKSIGADD``?
You mean like musig, or using `OP_CHECKSIGADD``?
github.com/btcsuite/btcd/btcec/v2/schnorr/musig2
I used signer.Sign(msg), but I have been unable to construct the correct transfer msg. Is msg constructed like this?
prevOutFetcher := txscript.NewMultiPrevOutFetcher(map[wire.OutPoint]*wire.TxOut{
*unspentList[0].Outpoint: {
PkScript: changeScript,
Value: unspentList[0].Output.Value,
},
})
sigHashes := txscript.NewTxSigHashes(tx, prevOutFetcher)
witnessArray, _ := txscript.CalcTaprootSignatureHash(sigHashes, txscript.SigHashDefault, tx, 0, prevOutFetcher)
... // sign
finalSig := combiner.FinalSig()
tx.TxIn[0].Witness = wire.TxWitness{finalSig.Serialize()}
it reports an error non-mandatory-script-verify-flag (Invalid Schnorr signature),witnessArray is the transaction msg
give an example