To sign raw transaction in Segwit

4

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?

DOLLY PATWA

Posted 2017-07-24T06:17:02.977

Reputation: 505

How did you create the segwit address? Did you use addwitnessaddress?Andrew Chow 2017-07-24T07:11:39.577

Yes, exactly.I used the same.DOLLY PATWA 2017-07-25T07:48:41.623

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.DOLLY PATWA 2017-07-25T09:40:31.437

Was the address you used in addwitnessaddress an address from the Bitcoin Core wallet or from elsewhere?Andrew Chow 2017-07-25T16:34:38.880

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.DOLLY PATWA 2017-07-27T11:32:04.767

No answers