Using Go language, I am trying to create a BTC transaction, using multiple UTXOs.

  1. I am adding the UTXOs by doing this: Tx.AddTxIn(TxIn)
  2. creating the TXOuts one for the amount to send out and one for the change to be returned to the sender.
  3. Calculating the sigScript and each of the TxIn's SignatureScript is set to sigScript.
  4. Calculating the sourcePkScript, _ := txscript.PayToAddrScript(sourceAddress.AddressPubKeyHash())
  5. 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)
            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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.