signrawtransactionwithkey works on testnet but not mainnet with bech32 #15610

issue AdamSEY opened this issue on March 16, 2019
  1. AdamSEY commented at 3:30 PM on March 16, 2019: none

    I'm trying to sign a transaction using signrawtransactionwithkey on bitcoin-core 0.17 but I'm getting the following error:

    {"ERROR":"[{"txid":"c7e5bc9c9662384464182c713a6a6e20a2da72adb2b2a5799457be643d764139","vout":0,"witness":[],"scriptSig":"","sequence":4294967295,"error":"Witness program hash mismatch"}] 

    parameters sent correctly since it's working on the testnet network it's just the mainnet

    anyway the params sent as:

    ["transaction_in_hex",["private_key"],[inputs]

    the inputs are

    [{"txid":"c7e5bc9c9662384464182c713a6a6e20a2da72adb2b2a5799457be643d764139","vout":0,"scriptPubKey":"0014f3dd9523e2a801770513e00ed717fd610ea634af","amount":"0.00099784","address":"bc1q70we2glz4qqhwpgnuq8dw9lavy82vd903k7hpe","redeemScript":""}]]

    I have been reading the bitcoin source code trying to understand what's the problem and it's obvious that the exception been thrown on [here][1]

      if (memcmp(hashScriptPubKey.begin(), program.data(), 32)) {
                    return set_error(serror, SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH);
       }

    and here

    if (witness.stack.size() != 2) {
                    return set_error(serror, SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH); // 2 items in witness
     }

    [1]: https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/script/interpreter.cpp#L1435

  2. AdamSEY closed this on Mar 16, 2019

  3. 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-29 03:15 UTC

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