<p>You will receive this error if the value you are signing is not the exact amount of the entire unspent output value. </p>

<p>For example, if your unspent output value is 35,000, and you only want to send 30,000, your output value would be 30,000, and your signing amount would be 35,000. If you sign for only 30,000 (not the full amount of the unspent output) you will receive this error. </p>

<p>Visual Example Using BitcoinJS:    </p>

<pre><code>//add input
txb.addInput(txid, outn, null, scriptPubkey);

//add output
txb.addOutput(receivingAddress, 30000); //amount less the mining fee

//signing
txb.sign(0, keypair, null, null, 35000); //NOTE the amount is the FULL amount of the unspent output, NOT the amount being sent
</code></pre>

CC BY-SA 4.0
2018-05-09T10:21:14.387Z
I've faced the same error and it is very confusing. I'm sure that in my case `sign` gets exact full amount of input, because I walk through UTXOs and pass `utxo[i].satoshis` as `amount`. Can anything else cause this error?
oxfn
CC BY-SA 4.0
2018-05-09T10:56:27.537Z
I'm using `bgoldjs-lib` - fork of `bitcoinjs-lib` for BTG
oxfn
CC BY-SA 4.0
2018-05-06T19:33:38.633Z
2018-05-06T19:33:38.633Z
m1xolyd1an
<p>I have gotten this error not only when specifying an incorrect input amount, as mentioned elsewhere in this thread, but also when sorting signatures incorrectly on a multisig transaction.</p>

CC BY-SA 4.0
2019-12-03T18:25:49.230Z
2019-12-03T18:25:49.230Z
eric
<p>I found out it was because of a precision error in our code. The amount that used to build the input segwit transaction is incorrect leading to this error.</p>

CC BY-SA 3.0
2017-11-21T19:49:27.203Z
2017-11-21T19:49:27.203Z
user3779267
<p>When I try to submit that transaction I don't get that error message. To me it looks like you are only sending 1 satoshi as transaction fee in total. Try to send it with a higher fee.</p>

CC BY-SA 3.0
2017-10-21T17:53:19.740Z
2017-10-21T17:53:19.740Z
Bjarne Magnussen
<p>I got the same error when create transaction via bgoldjs-lib. Say that it's confusing like say nothing. I'd no problem with bitcore-lib, bitcoincashjs to create BTC, BCH, LTC txs. Think it's open source !^_^! or I've not so deep learning in this area. I found one solution <a href="https://github.com/Ayms/bitcoin-transactions" rel="nofollow noreferrer">https://github.com/Ayms/bitcoin-transactions</a>. There're tx.js script, but in min.js format. It's created success broadcasted txs for me. There're one unsuitable output that i'm going to remove in a near time.</p>

CC BY-SA 4.0
2018-07-18T06:42:13.800Z
2018-07-18T06:42:13.800Z
Nick Borodin
<p>I got the above error when submitting this transaction: </p>

<pre><code>010000000001013894a4bdcfa20ef5a6cbfe1d22c5fe5041eab586a5ea2b044f969a02dab6b3d200000000171600141a982a7d2712fc33d47c990cd8cde15c87ca2e07ffffffff015e3f01000000000017a914fb2dc3b4dd0731c8f2559506c7d0cb876b0e71298702483045022100c68dac735a3529d84fdbfc3a8a11d313d59a9791b046fc39bbfc55db71d6d2010220028f2bbfba78c393858e3cb7ad51e24e8dfd2260d4a3cbbf8feb4d4c6005967701210371b63ebaa78a70420bc36159bed610b8f788e9a7b953558f06bb40622d9cbfe400000000
</code></pre>

<p>A previous transaction from the same P2SH-P2WPKH address was successfully spent but I got this error whenever I try to spend this transaction: </p>

<pre><code>d2b3b6da029a964f042beaa586b5ea4150fec5221dfecba6f50ea2cfbda49438
</code></pre>

<p>I already attempted to sign the transaction again a few time but still got the same error.</p>

CC BY-SA 3.0
2017-10-21T05:08:19.783Z
How did you create this transaction? What commands did you use? What software?
Ava Chow
CC BY-SA 3.0
2017-10-30T06:16:16.220Z
I used the ruby gem to build and sign this transaction
user3779267
CC BY-SA 3.0
2017-10-30T07:00:31.973Z
I found out it was because of a precision error in our code. The amount that used to build the input segwit transaction is incorrect leading to this error.
user3779267
CC BY-SA 3.0
2017-11-20T18:53:04.780Z
Please write an answer to your own question if you found a solution.
Pieter Wuille
<transactions><segregated-witness><signature>
Got 64: non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation) when submitting segwit transaction
user3779267
# Got 64: non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation) when submitting segwit transaction

(Asked by: username_0 on 2017-10-21)

I got the above error when submitting this transaction: 
010000000001013894a4bdcfa20ef5a6cbfe1d22c5fe5041eab586a5ea2b044f969a02dab6b3d200000000171600141a982a7d2712fc33d47c990cd8cde15c87ca2e07ffffffff015e3f01000000000017a914fb2dc3b4dd0731c8f2559506c7d0cb876b0e71298702483045022100c68dac735a3529d84fdbfc3a8a11d313d59a9791b046fc39bbfc55db71d6d2010220028f2bbfba78c393858e3cb7ad51e24e8dfd2260d4a3cbbf8feb4d4c6005967701210371b63ebaa78a70420bc36159bed610b8f788e9a7b953558f06bb40622d9cbfe400000000

A previous transaction from the same P2SH-P2WPKH address was successfully spent but I got this error whenever I try to spend this transaction: 
d2b3b6da029a964f042beaa586b5ea4150fec5221dfecba6f50ea2cfbda49438

I already attempted to sign the transaction again a few time but still got the same error.

**Tags:** transactions, segregated-witness, signature

> **Comments:**
> **username_1**: How did you create this transaction? What commands did you use? What software?  
> **username_0**: I used the ruby gem to build and sign this transaction  
> **username_0**: I found out it was because of a precision error in our code. The amount that used to build the input segwit transaction is incorrect leading to this error.  
> **username_2**: Please write an answer to your own question if you found a solution.  

---

## 5 answers

### Answer by username_3 on 2018-05-06. Score: 4

You will receive this error if the value you are signing is not the exact amount of the entire unspent output value. 
For example, if your unspent output value is 35,000, and you only want to send 30,000, your output value would be 30,000, and your signing amount would be 35,000. If you sign for only 30,000 (not the full amount of the unspent output) you will receive this error. 
Visual Example Using BitcoinJS:    
//add input
txb.addInput(txid, outn, null, scriptPubkey);

//add output
txb.addOutput(receivingAddress, 30000); //amount less the mining fee

//signing
txb.sign(0, keypair, null, null, 35000); //NOTE the amount is the FULL amount of the unspent output, NOT the amount being sent

> **Comments:**
> **username_4**: I've faced the same error and it is very confusing. I'm sure that in my case `sign` gets exact full amount of input, because I walk through UTXOs and pass `utxo[i].satoshis` as `amount`. Can anything else cause this error?  
> **username_4**: I'm using `bgoldjs-lib` - fork of `bitcoinjs-lib` for BTG  

---

### Answer by username_5 on 2019-12-03. Score: 2

I have gotten this error not only when specifying an incorrect input amount, as mentioned elsewhere in this thread, but also when sorting signatures incorrectly on a multisig transaction.


---

### Answer by username_0 on 2017-11-21. Score: 1

I found out it was because of a precision error in our code. The amount that used to build the input segwit transaction is incorrect leading to this error.


---

### Answer by username_6 on 2017-10-21. Score: 1

When I try to submit that transaction I don't get that error message. To me it looks like you are only sending 1 satoshi as transaction fee in total. Try to send it with a higher fee.


---

### Answer by username_7 on 2018-07-18. Score: 0

I got the same error when create transaction via bgoldjs-lib. Say that it's confusing like say nothing. I'd no problem with bitcore-lib, bitcoincashjs to create BTC, BCH, LTC txs. Think it's open source !^\_^! or I've not so deep learning in this area. I found one solution <https://github.com/Ayms/bitcoin-transactions>. There're tx.js script, but in min.js format. It's created success broadcasted txs for me. There're one unsuitable output that i'm going to remove in a near time.


---

