I was able on Bitcoin cash testnet to receive 1000.000 satoshis to address: miZHp1pJC9iTLQXeDa1VJVkCnfUkG2aMzj

Receiving TX = outpoint in new TX https://www.blocktrail.com/tBCC/tx/9c332fe722ae29d47ecaa36335f16fce2107db2f98636555449aca3d7d4aff8e

Now I am trying to send a raw transaction. I am using bchutil (golang) icm with btcsuite and a private bitcoin abc node in bcc/bch test mode. Receiving went well so I am in the correct network.

Raw data of the tx:


Using https://blockchain.info/decode-tx this becomes:

{ "lock_time":0, "size":259, "inputs":[ { "prev_out":{ "index":0, "hash":"9c332fe722ae29d47ecaa36335f16fce2107db2f98636555449aca3d7d4aff8e" }, "script":"47304402202b5755c855a380521af512b1d4d368ee33fe7af7071975be48a6f188a37fcd280220447407096e1722d5f8232394abd21901f0898c09d5e7f62252b7e21d9563b35441210337e043784b991908225e3f5d6c0fc3b38a0e86370342e2b3aad73501040ac84c" } ], "version":1, "vin_sz":1, "hash":"049d0731b162a303cd13218c4383afc5045ee978d31c3eafaa10c5b90c58d389", "vout_sz":3, "out":[ { "script_string":"OP_DUP OP_HASH160 cc1d800e7f83edd96a0340a4e269b2956f636e3f OP_EQUALVERIFY OP_CHECKSIG", "address":"1KcGBqzc59E7T4u2gitSoMYLeZZDwyrb5q", "value":44000, "script":"76a914cc1d800e7f83edd96a0340a4e269b2956f636e3f88ac" }, { "script_string":"OP_DUP OP_HASH160 208afa2015a3bba18390e8f7fec6560f6fb2005d OP_EQUALVERIFY OP_CHECKSIG", "address":"13y57S95sGNP8FKk7QWDzpc6vUCRbukwBZ", "value":954256, "script":"76a914208afa2015a3bba18390e8f7fec6560f6fb2005d88ac" }, { "script_string":"OP_DUP OP_HASH160 da1bb6aa021fe189285fc928d62f91ddb8e574b6 OP_EQUALVERIFY OP_CHECKSIG", "address":"1LtFWPZUwBvMkpKDBZWxrpc4nvdafKzrfX", "value":1000, "script":"76a914da1bb6aa021fe189285fc928d62f91ddb8e574b688ac" } ] }

Error wehen sending: -26: 16: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)

I have checked that the lib is doing an AND on the SigHashAll Hash with known BCH 0x40. The error suggests the signing went wrong somewhere...? The lib is using Bip143SignatureHash: https://github.com/cpacia/bchutil/blob/master/sign.go A know point with bitcoin cash is that the amount is needed for signing which is done by bchutil's function RawTxInSignature which uses Bip143SignatureHash.

Any help is welcome, thanks a lot


Ok, I went on trying a lot of things and found the problem. It is library related to btcsuite which is for btc only, but the differences are covered by the other library, so it should work...

The problem was that the (with btcsuite ) generated temporary rawtx for signing differed with the rawtx manually filled (same datatype) after signing. So I manually created a rawTX structure which could be passed to the node, before signing. Used it in the signing process, updated tha same with the calculated signatures and send it to the network.

Thanks for reading. Anyone else having problems, see the mentioned points in my post, and keep in mind that if those are covered, it is usasly a difference between what you sign and what you send.

Your Answer

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

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