signrawtransactionwithkey for p2pkh failed with error:'redeemScript must be hexadecimal string (not '')' #15640

issue lyhistory opened this issue on March 22, 2019
  1. lyhistory commented at 8:19 AM on March 22, 2019: none

    Version:

    bitcoin core v0.17.1

    Mode:

    regtest

    Detail:

    basically I'm trying to signrawtransactionwithkey for normal p2pkh transactions, according to the doc, redeemScript is only required for P2SH or P2WSH, so I left it empty string, but then got

    1. utxo to spend:

    error code: -8 error message: redeemScript must be hexadecimal string (not '')

    {
        "txid": "8e191e86fcebcc005f7d7f99d57927890e199e5e5f1f6e7ef479c63b3f1d70fa",
        "vout": 0,
        "address": "2N8VWWcWZ3AEkXApwPF3CXHSNZHik2UBN9L",
        "redeemScript": "0014027ee2a1bc4018a399ba46b9c44eb97740361b2e",
        "scriptPubKey": "a914a73d80bb3bd591e6ccb991972951413c1ffb548687",
        "amount": 4.78996640,
        "confirmations": 4,
        "spendable": true,
        "solvable": true,
        "safe": true
      }
    
    1. cli cmd: #bitcoin-cli -regtest createrawtransaction '''[{"txid":"8e191e86fcebcc005f7d7f99d57927890e199e5e5f1f6e7ef479c63b3f1d70fa","vout":'0'}]''' '''{"2MuNg73Nv4abyJurRYR8yRhkYGYykRcJYa1":4.78}'''

    #RAW_TX=0200000001fa701d3f3bc679f47e6e1f5f5e9e190e892779d5997f7d5f00ccebfc861e198e0000000000ffffffff0180b37d1c0000000017a9141758f6da51d146c060ac51e06b9214653bc0e2a28700000000

    # bitcoin-cli -regtest signrawtransactionwithkey $RAW_TX "[\"cSWTjfxp4tPt2zHAVGaGVCcGfM2A45sR7fFL5HiYpiFp8bfZ5Lba\"]" "[{\"txid\":\"8e191e86fcebcc005f7d7f99d57927890e199e5e5f1f6e7ef479c63b3f1d70fa\",\"vout\":0,\"scriptPubKey\":\"a914a73d80bb3bd591e6ccb991972951413c1ffb548687\",\"redeemScript\":\"\",\"amount\":4.78996640}]" "ALL"

    and I also tried remove redeemScript from the params, but got another error "missing redeemScript" instead

  2. lyhistory commented at 8:38 AM on March 22, 2019: none

    and this is the transaction info I referred to:

    root@peter-btc-node:~/workspace# bitcoin-cli -regtest getrawtransaction 8e191e86fcebcc005f7d7f99d57927890e199e5e5f1f6e7ef479c63b3f1d70fa 1 { "txid": "8e191e86fcebcc005f7d7f99d57927890e199e5e5f1f6e7ef479c63b3f1d70fa", "hash": "9510cf56d299b47aca0fbb42e9b1f99fa9f77348cb6c1ecf0834469c40d45b6a", "version": 2, "size": 249, "vsize": 168, "weight": 669, "locktime": 103, "vin": [ { "txid": "a73cad323f42caac6eb72288c2d2ef3ec60a9d0cd7297d98f0047d755471d438", "vout": 1, "scriptSig": { "asm": "001494501ebf9af00d3dda90ddabed43c43e94dda5bf", "hex": "16001494501ebf9af00d3dda90ddabed43c43e94dda5bf" }, "txinwitness": [ "3044022001911ada127dc84b41eba36b3007918956f1fae49b1ec42f398c3eeb950a9881022076f02e15a091b9a1cbfc5e21ae5c16f1f8dda145250088864a305a4c60745a0001", "03d4f69cb78cad2c6ef9eb3e10cf67baa7992be2a4fd5fe0708e34a716ac5dbca1" ], "sequence": 4294967294 } ], "vout": [ { "value": 4.78996640, "n": 0, "scriptPubKey": { "asm": "OP_HASH160 a73d80bb3bd591e6ccb991972951413c1ffb5486 OP_EQUAL", "hex": "a914a73d80bb3bd591e6ccb991972951413c1ffb548687", "reqSigs": 1, "type": "scripthash", "addresses": [ "2N8VWWcWZ3AEkXApwPF3CXHSNZHik2UBN9L" ] } }, { "value": 0.20000000, "n": 1, "scriptPubKey": { "asm": "OP_DUP OP_HASH160 dd79bcd6e2f8925e6f474083a8a07017e3234cb1 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a914dd79bcd6e2f8925e6f474083a8a07017e3234cb188ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": [ "n1i1TvqVVVPEm2nFLZ8ZvnrrpKNiuuWs4Y" ] } } ], "hex": "0200000000010138d47154757d04f0987d29d70c9d0ac63eefd2c28822b76eacca423f32ad3ca7010000001716001494501ebf9af00d3dda90ddabed43c43e94dda5bffeffffff02a0e88c1c0000000017a914a73d80bb3bd591e6ccb991972951413c1ffb548687002d3101000000001976a914dd79bcd6e2f8925e6f474083a8a07017e3234cb188ac02473044022001911ada127dc84b41eba36b3007918956f1fae49b1ec42f398c3eeb950a9881022076f02e15a091b9a1cbfc5e21ae5c16f1f8dda145250088864a305a4c60745a00012103d4f69cb78cad2c6ef9eb3e10cf67baa7992be2a4fd5fe0708e34a716ac5dbca167000000", "blockhash": "202052b2310246579d2ce684937236e60129849674d88fc557faf82d2b156ee0", "confirmations": 4, "time": 1551836912, "blocktime": 1551836912 }

  3. lyhistory commented at 8:44 AM on March 22, 2019: none

    sorry, I just realized this is a script hash address...

  4. lyhistory closed this on Mar 22, 2019

  5. MarcoFalke locked this on Dec 16, 2021
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me