3

I wanted to send a raw testnet transaction and I was doing it like in the bitcoin documentation, but I still get this error:

non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 64) (code -26).

What am I doing wrong?

  1. I take one transaction from my listunspent
{
    "txid": "8ee71fee9e4706100c09fb2da4c3ccdac1a4475981bd893ba1eba9417947abff",
    "vout": 0,
    "address": "2Mw44JvAhBs4hgh5bT3gP2NgbhTbVwngW1m",
    "label": "",
    "redeemScript": "00143b88811e01b3efaa0bcd9da16ef85ef3a1583349",
    "scriptPubKey": "a91429c3d920cd18e34db9035c4322474aae4465792187",
    "amount": 0.02641617,
    "confirmations": 16197,
    "spendable": true,
    "solvable": true,
    "desc": "sh(wpkh([8939dfa5/0'/0'/8']02a44b3dd2f0964048265982156f668c037dfabc140eb98f292dbb723d28b85261))#husuy9tw",
    "safe": true
}
  1. Then I create raw transaction from this:
createrawtransaction '[{"txid":"8ee71fee9e4706100c09fb2da4c3ccdac1a4475981bd893ba1eba9417947abff","vout":0}]' '{"2NCH5HXBwfHegFEUTNrkSKzyYTnTYQKDUjU":0.02}'
  1. dumpprivkey

  2. And signs the transaction like this

signrawtransactionwithkey '0200000001ffab477941a9eba13b89bd815947a4c1daccc3a42dfb090c1006479eee1fe78e0000000000ffffffff0180841e000000000017a914d0c3f50336b5f109207d722c692191ff86263e968700000000' '[" $privKey "]' '[{"txid":"8ee71fee9e4706100c09fb2da4c3ccdac1a4475981bd893ba1eba9417947abff","vout":0,"scriptPubKey":"a91429c3d920cd18e34db9035c4322474aae4465792187","redeemScript":"00143b88811e01b3efaa0bcd9da16ef85ef3a1583349","amount":0.02}]'

{
  "hex": "02000000000101ffab477941a9eba13b89bd815947a4c1daccc3a42dfb090c1006479eee1fe78e00000000171600143b88811e01b3efaa0bcd9da16ef85ef3a1583349ffffffff0180841e000000000017a914d0c3f50336b5f109207d722c692191ff86263e968702473044022010c174b3306cac5ca8ddbb6eadf0de2299c2a216ade25088290c17880aa5bd60022017bc9de608e7ff59ffa09a6a60d848875d37edfc4a4b687f0eb94d4c2cd11b4f012102a44b3dd2f0964048265982156f668c037dfabc140eb98f292dbb723d28b8526100000000",
  "complete": true
}

But when I want to send raw transaction

sendrawtransaction 02000000000101ffab477941a9eba13b89bd815947a4c1daccc3a42dfb090c1006479eee1fe78e00000000171600143b88811e01b3efaa0bcd9da16ef85ef3a1583349ffffffff0180841e000000000017a914d0c3f50336b5f109207d722c692191ff86263e968702473044022010c174b3306cac5ca8ddbb6eadf0de2299c2a216ade25088290c17880aa5bd60022017bc9de608e7ff59ffa09a6a60d848875d37edfc4a4b687f0eb94d4c2cd11b4f012102a44b3dd2f0964048265982156f668c037dfabc140eb98f292dbb723d28b8526100000000

non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation) (code 64) (code -26)

I tried with a lot of transactions but I can't send it and can't see what I'm doing wrong. Normally, the Bitcoin Core send button works fine.

1 Answer 1

2

That error message is irrelevant.
SegWit introduced a new way of producing the hash digest for signing which requires the "amount" being spent to be included during hashing. This "amount" is the value of the output that is being spent not the amount of the new output you create. In your it is 0.02641617 or the actual value 2641617 in satoshi.
Your step 4 should become:

signrawtransactionwithkey '0200000001ffab477941a9eba13b89bd815947a4c1daccc3a42dfb090c1006479eee1fe78e0000000000ffffffff0180841e000000000017a914d0c3f50336b5f109207d722c692191ff86263e968700000000' '[" $privKey "]' '[{"txid":"8ee71fee9e4706100c09fb2da4c3ccdac1a4475981bd893ba1eba9417947abff","vout":0,"scriptPubKey":"a91429c3d920cd18e34db9035c4322474aae4465792187","redeemScript":"00143b88811e01b3efaa0bcd9da16ef85ef3a1583349","amount":0.02641617}]'
1
  • Thanks a lot! It worked :) I just misunderstood the documentation. Have a nice day and I wish You good health!
    – M A
    Mar 28, 2020 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.