Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: BTCProFan on May 30, 2020, 10:22:50 AM



Title: I can't access to my wallet
Post by: BTCProFan on May 30, 2020, 10:22:50 AM
Hello,

I have my wallet in Bitcoin Core old 3 years, and I have some money on my wallet.
I want to make withdrawal, and I can't because... I have my private key also I export wallet.dat.
Problem is if import key to electrum or bitcoin.com I got different public address and in different I dont have money...

I have make one test in another pc and I only replace wallet.dat I got the correct public address.

How is that possible?


Title: Re: I can't access to my wallet
Post by: FatFork on May 30, 2020, 10:35:09 AM
Since you managed to import wallet.dat on another computer, why don't you just send all coins to the new address (new wallet) from there?


Title: Re: I can't access to my wallet
Post by: Thasins61 on May 30, 2020, 01:42:23 PM
The wallet follows the traditional way to derive the public key from the private key, so you will see the address as p2pkh address.
You must define the wallet that you want to derive p2wpkh-p2sh/p2wpkh from the address by adding the appropriate word before importing the private key.
The solution above is correct, as you can try with electrum console:

Code:
key = 'your_key'
txin_type, secret, compressed = bitcoin.deserialize_privkey(key)
wif2 = bitcoin.serialize_privkey(secret, compressed, 'p2wpkh-p2sh')
print(wif2)