Signature must be zero for failed CHECK(MULTI)SIG operation


Hi! I need a help to find info. I’ve error after broadcasting raw transaction. There’re input[1], and output[2]. I made simple transaction to transfer money from sender address to receiver address via bgoldjs-lib. By the same way, I had no problem with BTC, LTC & BCH via bitcore-lib, bitcoincashjs. May be someone know a little bit about this error… didn’t help me.


Can you provide a little more information someone can troubleshoot?

  • are you on the latest bgoldjs-lib?
  • what kind of transaction?
  • what type of addresses?
  • testnet, or mainnet?

  1. “bgoldjs-lib”: “^3.3.2”
    2.Create a 1-to-1 Bitcoin Gold Transaction {CODE}
  2. from GYv7tb9o5RrM5WQ3HmeyHEvBgWBc4Ri2rt to GP1aUfPKHCk7Z328vcSVHCj5fQoa5a9vWh
    4.mainnet, (on testnet the same error)

import * as Bitgold from ‘bgoldjs-lib’;
const net = Bitgold.networks[‘bitcoingold’];
const pKey = Bitgold.ECPair.fromWIF(this.keys.private, net);
const pkHash = Bitgold.crypto.hash160(pKey.getPublicKeyBuffer());
const spk = Bitgold.script.pubKeyHash.output.encode(pkHash);
const tx = new Bitgold.TransactionBuilder(net);
tx.addInput(‘22b6baf2f1d48a9a468a36509b60ec2653fde08fb61ce59f9d525a7bdd49698a’, 0, null, spk); tx.addInput(‘5ee2212430d3bbaaa37f5b5988e4c51bd682e97ab62660a81506977b5f0d20cb’, 0, null, spk);
tx.addOutput(‘GP1aUfPKHCk7Z328vcSVHCj5fQoa5a9vWh’, 22000);
const hashType = Bitgold.Transaction.SIGHASH_ALL | Bitgold.Transaction.SIGHASH_FORKID;
tx.sign(0, pKey, null, hashType, value);
tx.sign(1, pKey, null, hashType, value);
const rawTx =;
return rawTx.toHex();
Now I’ve error ‘Transaction has absurd fees’. Is there any info/manual how to calculate/take fee, value to sign? Thanks for help!
Before I tried to broadcast tx with one input and one output and got the signature error. Then I find, but there are min.js script that generate txs with additional vout to Ayms.


The fee should be at least 1sat per byte. This is the minimal relay fee. The fee shouldn’t be too high as well.

You should also specify the value when you add inputs. This is mandatory for the reply protection.


Thank You for reply! But Transaction.prototype.addInput = function (hash, index, sequence, scriptSig){…} Where should I specify the value? I’ve this method to add inputs via bgoldjs-lib. I can’t find info about this one. Where can I insert some fee?


When you write this line you should specify the right value of the input.

tx.sign(0, pKey, null, hashType, value);

As it’s singing the first input, the value should be the amount of the first input in satoshi.


I’d done the same steps. I received utxos, addInputs, check all inputs amounts in satoshi, and got the error: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation). I checked this one with just one input for simplicity.


I redesigned Ayms code and got broadcasted transactions with no errors. ^(_)^ Is it bgoldjs-lib or my bad?


May be problem like this one But I look in tx object and there are no incorrect rounded amounts.


I compare two objects(1-created by Ayms script, 2-created by bgoldjs-lib) It’s the same transaction object before serialization. There are difference in input array elemetn, in field 1)scriptSig(Amys object) and 2)signatures(bgoldjs object) 1)has array[3],total length=107 2) has array[1], total length=72. Do somebody meet this one?


It’s done! My bad, I think. May be example could be more clear for me if there i find some inputs, and two outputs(may be more, not one), where transaction amount spread between first and second outputs without a little difference for some fee. Many thanks everyone for replies!