0
Using Go language, I am trying to create a BTC transaction, using multiple UTXOs.
- I am adding the UTXOs by doing this: Tx.AddTxIn(TxIn)
- creating the TXOuts one for the amount to send out and one for the change to be returned to the sender.
- Calculating the sigScript and each of the TxIn's SignatureScript is set to sigScript.
- Calculating the sourcePkScript, _ := txscript.PayToAddrScript(sourceAddress.AddressPubKeyHash())
- For each of the TxIn, when I do:
vm, err := txscript.NewEngine(sourcePkScript, Tx, index, flags, nil, nil, netAmount) //netAmout is the amount to transfer to the recipient
if err := vm.Execute(); err != nil {
fmt.Println("vm.Execute call errored for index", index)
fmt.Println(err)
return Transaction{}, err
}
For the first UTXO, the vm.Execute() passes but for the 2nd UTXO, the vm.Exeucte() fails with the error msg: vm.Execute call errored for index 1
signature not empty on failed checksig
Even for the 3rd UTXO, it fails with the same error msg.
Any thoughts, suggestions are very much appreciated.
Thank you