I got this error while pushing a bitcoin cash tx. earlier transactions were pushed without any error. please check this : " 010000000365d8109a2a72b184271d91fa42eb979c64c75167ed02f88be4c5d27034e6e8e9000000006b483045022100a0ecffb050a6978816f27c162c77f05a4de2bc597ca5237bbf3603661318d41d022053875a6b98b51724267df8c2cd2cac60e67c50930ed3f8831c214ee18ff65c0d412103a587d9719f78f22781ab04f95132fb9e2ba295d1b22ff4626cf41d21a2b64fd8ffffffff33c7db59054b5b9d73882a600abab64c8fb46ba26f490b8528cbb133af2e97cb000000006a47304402201cd64c1a6269064eda620212410f249618d8f7318849a7b7e0429359b9cf1b83022026d5c455eedbcf152ff508c789963d215429c2143c90e23dbaf4adec75010c30412103a587d9719f78f22781ab04f95132fb9e2ba295d1b22ff4626cf41d21a2b64fd8ffffffff22b7242dca6102190d67a4d2c1a925bd90463e71c683e02666d22333ea3b4a09010000006b483045022100d1ce25aabab793672a4b5b854f79cfc920657cd5c56919ea535670262575164102203dc3bb4310f4acdb7b68988be420d02857ba9e0436533c3a8c7bd652ee87b16b412103a587d9719f78f22781ab04f95132fb9e2ba295d1b22ff4626cf41d21a2b64fd8ffffffff02c2d60000000000001976a914cf452d2b1a416bd3de2a776fd4087bf49641d61f88ac62170000000000001976a9142c4cf9c6666b2cbb93f76ec17183fca6bcec155088ac00000000 "
On Saturday, August 11, 2018 at 5:32:30 PM UTC+5:30, Тимур Панжиев wrote: > > Hi for everyone! Finally I found solution and what i was doing wrong. The > way of signing tx is totally correct, the problem was occurred in the other > thing. Before I want to broadcast tx I calculate fee per kb (not fixed > one). After signing tx - size of raw tx increses and fee amount > increases accordingly. After that I should provide new change for address > for change (value of the second output of tx). And after that I should sign > inputs one more time, because the value of the output for change was > changed. Unfortunately, I didn`t do this before. > > воскресенье, 5 августа 2018 г., 13:49:54 UTC+3 пользователь Тимур Панжиев > написал: >> >> Good day! >> I`m working with low level API to make tx and sign it offline. But after >> all preparations I try to broadcast it and than i get an error from network: >> *16: mandatory-script-verify-flag-failed (signature must be zero for >> failed check(multi)sig operation)* >> >> First of all I create tx without signing inputs, and after that i`m >> trying to sign every input with my priv keys. >> >> *Here is raw tx before signing : * >> >> 01000000018bcf82619e93eb92cc78d5bb0b7b22d6ee419820428402e721fbac1386c9673f0000000000ffffffff02087f0300000000001976a9146fb643fe63bcc6c352899298d6072cc5d4178c0f88ace4570000000000001976a914196e59ee4c151e742af69bca308fc1b4445c577288ac00000000 >> *Parsing tx from the https://live.blockcypher.com/btc/decodetx/ >> <https://live.blockcypher.com/btc/decodetx/> :* >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *{ "addresses": [ "16Yb7QP5jVmjXvHawH2ZA66k1b46FmtmE3", >> "1BBgML68FuyRwU8RzwYn1FvqAXDDSgjVKC", >> "13KU69194fJj13G1SajUWokudsuekhT1kw" ], "block_height": -1, >> "block_index": -1, "confirmations": 0, "double_spend": false, >> "fees": 0, "hash": >> "1e3c06bfc2f2e91db9059a0db6dd78090f635b869feb31c3d51bc4a36ed88891", >> "inputs": [ { "addresses": [ >> "16Yb7QP5jVmjXvHawH2ZA66k1b46FmtmE3" ], "age": >> 534819, "output_index": 0, "output_value": 251628, >> "prev_hash": >> "3f67c98613acfb21e7028442209841eed6227b0bbbd578cc92eb939e6182cf8b", >> "script_type": "pay-to-pubkey-hash", "sequence": >> 4294967295 } ], "outputs": [ { "addresses": >> [ "1BBgML68FuyRwU8RzwYn1FvqAXDDSgjVKC" ], >> "script": "76a9146fb643fe63bcc6c352899298d6072cc5d4178c0f88ac", >> "script_type": "pay-to-pubkey-hash", "value": 229128 >> }, { "addresses": [ >> "13KU69194fJj13G1SajUWokudsuekhT1kw" ], "script": >> "76a914196e59ee4c151e742af69bca308fc1b4445c577288ac", >> "script_type": "pay-to-pubkey-hash", "value": 22500 } >> ], "preference": "low", "received": >> "2018-08-05T10:43:36.984631491Z", "relayed_by": "54.234.76.246", >> "size": 119, "total": 251628, "ver": 1, "vin_sz": 1, >> "vout_sz": 2}* >> >> Here is my code of signing every in: >> >> for (int i = 0; i < transaction.getInputs().size(); i++) { >> >> TransactionInput transactionInput = transaction.getInput(i); >> String addressFromUtxo = mUTXOs.get(i).getAddress(); >> byte[] privKeyBytes = *getPrivKeyBitesForAddress*(addressFromUtxo); >> >> ECKey ecKey = ECKey.fromPrivate(privKeyBytes); >> >> Script scriptPubKey = >> ScriptBuilder.createOutputScript(Address.fromBase58(params, >> mUTXOs.get(i).getAddress())); >> >> Sha256Hash hash = transaction.hashForSignature(i, scriptPubKey, >> Transaction.SigHash.ALL, false); >> ECKey.ECDSASignature ecSig = ecKey.sign(hash); >> TransactionSignature txSig = new TransactionSignature(ecSig, >> Transaction.SigHash.ALL, false); >> transactionInput.setScriptSig(ScriptBuilder.createInputScript(txSig, >> ecKey)); >> } >> >> //serialization and braodcasting >> >> byte[] bytesRawTransaction = transaction.bitcoinSerialize(); >> String rawTransaction3 = HEX.encode(bytesRawTransaction3); >> broadcastTx(rawTransaction3); >> >> >> And here how my raw tx looking after the signing: >> >> >> 01000000028bcf82619e93eb92cc78d5bb0b7b22d6ee419820428402e721fbac1386c9673f000000006a473044022054720cc14562000ed1a6fa7952d2343bef48e2fa4fd0f1c1894579026ae83692022042735beb03c4d53c8d72126e1e4e8bee7acd5530284b05d6707a4e71cc891e9a01210312e1997fc0cb4c037c94885e7e4a8d0eca9d5cff8628cc3d870e5c158c9b0901ffffffffd50ea1cd97af5295cddcd4f0c7c0d531fed5683bde80af45ede25a0571c31add010000006a47304402206a70b6dacea9e9435c21fe920471daccf2edb636592b9d9163b1f5d740e582e102203416f80e9859fcfacc9f41ea3e04774ef47c9b0b9fa5a61f2b77dffee4c2710e012103522a472dd00a929e0f0980b98eb6a0d10a6e5a6ff7d45709cdb9f022b881ca66ffffffff02087f0300000000001976a9146fb643fe63bcc6c352899298d6072cc5d4178c0f88acfa6b0100000000001976a914196e59ee4c151e742af69bca308fc1b4445c577288ac00000000 >> >> *Parsing tx from the https://live.blockcypher.com/btc/decodetx/ >> <https://live.blockcypher.com/btc/decodetx/> :* >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *{ "addresses": [ "16Yb7QP5jVmjXvHawH2ZA66k1b46FmtmE3", >> "13KU69194fJj13G1SajUWokudsuekhT1kw", >> "1BBgML68FuyRwU8RzwYn1FvqAXDDSgjVKC" ], "block_height": -1, >> "block_index": -1, "confirmations": 0, "double_spend": false, >> "fees": 55194, "hash": >> "26859671de7bd5f0ab758517d90dcb2ef7c8a8a331a2d4fc59c7d98e07857d09", >> "inputs": [ { "addresses": [ >> "16Yb7QP5jVmjXvHawH2ZA66k1b46FmtmE3" ], "age": >> 534819, "output_index": 0, "output_value": 251628, >> "prev_hash": >> "3f67c98613acfb21e7028442209841eed6227b0bbbd578cc92eb939e6182cf8b", >> "script": >> "473044022054720cc14562000ed1a6fa7952d2343bef48e2fa4fd0f1c1894579026ae83692022042735beb03c4d53c8d72126e1e4e8bee7acd5530284b05d6707a4e71cc891e9a01210312e1997fc0cb4c037c94885e7e4a8d0eca9d5cff8628cc3d870e5c158c9b0901", >> >> "script_type": "pay-to-pubkey-hash", "sequence": >> 4294967295 }, { "addresses": [ >> "13KU69194fJj13G1SajUWokudsuekhT1kw" ], "age": >> 534818, "output_index": 1, "output_value": 125872, >> "prev_hash": >> "dd1ac371055ae2ed45af80de3b68d5fe31d5c0c7f0d4dccd9552af97cda10ed5", >> "script": >> "47304402206a70b6dacea9e9435c21fe920471daccf2edb636592b9d9163b1f5d740e582e102203416f80e9859fcfacc9f41ea3e04774ef47c9b0b9fa5a61f2b77dffee4c2710e012103522a472dd00a929e0f0980b98eb6a0d10a6e5a6ff7d45709cdb9f022b881ca66", >> >> "script_type": "pay-to-pubkey-hash", "sequence": >> 4294967295 } ], "outputs": [ { "addresses": >> [ "1BBgML68FuyRwU8RzwYn1FvqAXDDSgjVKC" ], >> "script": "76a9146fb643fe63bcc6c352899298d6072cc5d4178c0f88ac", >> "script_type": "pay-to-pubkey-hash", "value": 229128 >> }, { "addresses": [ >> "13KU69194fJj13G1SajUWokudsuekhT1kw" ], "script": >> "76a914196e59ee4c151e742af69bca308fc1b4445c577288ac", >> "script_type": "pay-to-pubkey-hash", "value": 93178 } >> ], "preference": "high", "received": >> "2018-08-05T10:44:42.584042561Z", "relayed_by": "54.162.141.93", >> "size": 372, "total": 322306, "ver": 1, "vin_sz": 2, >> "vout_sz": 2}* >> And after all above I got: *16: mandatory-script-verify-flag-failed >> (signature must be zero for failed check(multi)sig operation)* >> >> Please, help me, what I`m doing wrong??? >> > -- You received this message because you are subscribed to the Google Groups "bitcoinj" group. To unsubscribe from this group and stop receiving emails from it, send an email to bitcoinj+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/bitcoinj/23e30353-70c0-4e7d-ab40-7cde91148ac0%40googlegroups.com.