I am using Bitcoin core 0.14.1 testnet. I created a Segwit address. transfer some coins to this address. Now I want to spend it. I created a raw transaction using console command i.e. createrawtransaction. Now I want to sign it. I tried using usual way i.e

signrawtransaction 'hex_got_from_rawtx' '[{"txid":"","vout": index,"scriptPubkey":"","redeemScript":""}]' '["Private_key_of_address_used_in_segwit_address"]'

I am getting the error is: "witness program hash mismatch"

Any idea how can I get rid of it?

  • How did you create the segwit address? Did you use addwitnessaddress?
    – Andrew Chow
    Jul 24, 2017 at 7:11
  • Yes, exactly.I used the same. Jul 25, 2017 at 7:48
  • But I got to know that, I can't be able to retrieve back the address. I.e. I used addwitnessaddress "Address" then I got one address which is result of above query. Now I forgot the original address and not able to retrieve it. Without this I can't sign rawtx i.e. dumpprivkey is only valisd on address not witness address. Jul 25, 2017 at 9:40
  • Was the address you used in addwitnessaddress an address from the Bitcoin Core wallet or from elsewhere?
    – Andrew Chow
    Jul 25, 2017 at 16:34
  • Yes The address was from bitcoin core wallet of mine only. If I use validateaddress "Multisig_address" then I am getting back all the addresses which I have used to create Multisig_address but if I use validateaddress "Segwit_address" then I am not getting the address which i have used to create Segwit_address. Jul 27, 2017 at 11:32


Your Answer

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

Browse other questions tagged or ask your own question.