Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: babelfish42 on December 04, 2023, 06:50:04 AM



Title: Electrum wallet to Core wallet
Post by: babelfish42 on December 04, 2023, 06:50:04 AM
Hello, I need to import a wallet that I have in Electrum into Bitcoin Core. 

I have exported the private key from electrum. But when I try importprivkey 'privatekeyfromelextrum'. I get only legacy wallets are supported by this command....

Thanks for your help!


Title: Re: Electrum wallet to Core wallet
Post by: nc50lc on December 04, 2023, 07:03:18 AM
Use importdescriptors command followed by the descriptor containing your WIF private key with checksum and timestamp.
For example (native SegWit):
Code:
importdescriptors "[{\"desc\": \"wpkh(privatekeyfromelextrum)#checksum\", \"timestamp\":0}]"

To get the correct checksum, use the command, getdescriptorinfo.
For example:
Code:
getdescriptorinfo "wpkh(privatekeyfromelextrum)"

If your address is legacy from old version of Electrum, replace "wpkh" with "pkh".

The importprivkey command will work if you create a non-descriptor wallet but Bitcoin Core will soon drop support for such wallet format
so it's better to learn those descriptor wallet-comaptible commands.


Title: Re: Electrum wallet to Core wallet
Post by: DifDrama on December 04, 2023, 09:09:44 AM
nc50lc has already provided a great answer to your question. I just wanted to add that the official Bitcoin Core documentation offers comprehensive insights into commands, usage, and wallet management. You can access it here: https://bitcoincore.org/en/doc/


Title: Re: Electrum wallet to Core wallet
Post by: babelfish42 on December 04, 2023, 01:02:48 PM
The private key appears to be a p2pkh.  Does that change anything?

This wallet was originally a Zelcore wallet that exports the private keys is WIF format.

Thank you!


Title: Re: Electrum wallet to Core wallet
Post by: o_e_l_e_o on December 04, 2023, 01:19:16 PM
Private keys don't specify a script type, but if you want to recover a P2PKH address beginning with "1", then just change from wpkh to pkh in nc50lc's instructions above.

Run getdescriptorinfo to get the checksum, then importdescriptors with the calculated checksum.