I am creating a raw transaction to send amount from from_address to to_address. While sending a transaction I got an error. I posted the detailed process of creating a raw transaction. Could anyone tell me where it was going wrong?
from_address = '2NAvmqmZmodXKDHyWQaRufsFptZ6cDPVaPQ'
to_address = '2MyTfwJFbWYueyFpDjdN8cJ4ZwsSA7UfN8s'
Unspent of from_address
[{'txid': '421ac74f3fb137ea0f65d20e71825abefd463322b4e4a9033057e78e2a27bb69', 'vout': 1, 'address': '2NAvmqmZmodXKDHyWQaRufsFptZ6cDPVaPQ', 'account': '', 'redeemScript': '00140363a5b9ce91754185b3d39d292f262ac3f417c5', 'scriptPubKey': 'a914c1f4f356a6c6d28742dd1e80270edd55e6a5b0c687', 'amount': 0.5455, 'confirmations': 108, 'spendable': True, 'solvable': True, 'safe': True}]
creating rawtransaction
bitcoin-cli createrawtransaction [{'txid': '421ac74f3fb137ea0f65d20e71825abefd463322b4e4a9033057e78e2a27bb69', 'vout': 1}] {'2MyTfwJFbWYueyFpDjdN8cJ4ZwsSA7UfN8s' : 0.0495 ,'2NAvmqmZmodXKDHyWQaRufsFptZ6cDPVaPQ' : 0.4955}
signing the transaction
bitcoin-cli signrawtransaction '020000000169bb272a8ee7573003a9e4b4223346fdbe5a82710ed2650fea37b13f4fc71a420100000000ffffffff02f0874b000000000017a9149ca7d200ee0b4e751d1de0c56fd3cf8defde173d87b012f4020000000017a914c1f4f356a6c6d28742dd1e80270edd55e6a5b0c68700000000' [{'txid': '421ac74f3fb137ea0f65d20e71825abefd463322b4e4a9033057e78e2a27bb69', 'vout': 1, 'redeemScript': '00140363a5b9ce91754185b3d39d292f262ac3f417c5', 'scriptPubKey': 'a914c1f4f356a6c6d28742dd1e80270edd55e6a5b0c687', 'amount': 545500}] ['cR5YAMiTGaAwFgrEHeXK2MpEm8SEBFXm7pf2R2m6SNBx3sRqvPYw']
sendrawtransaction
bitcoin-cli sendrawtransaction '0200000000010169bb272a8ee7573003a9e4b4223346fdbe5a82710ed2650fea37b13f4fc71a4201000000171600140363a5b9ce91754185b3d39d292f262ac3f417c5ffffffff02f0874b000000000017a9149ca7d200ee0b4e751d1de0c56fd3cf8defde173d87b012f4020000000017a914c1f4f356a6c6d28742dd1e80270edd55e6a5b0c68702483045022100ccf694b3439a163ca100743c749ba80e6732d96e2f1dc951ea38c6aba7624cf102203463130bec546cd5cf5d0a18067b51cdd63b879eb34cbecf61b2883ee58021110121034fb6dfc450dd53dcb083cb38ad8ad4d5ad744e3da6c93b579eb19354c3ff2e6600000000'
Error:
raise Exception('Error in RPC call: ' + str(responseJSON['error']))
Exception: Error in RPC call: {'code': -26, 'message': '64: non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)'}