Import all private keys in Electrum the right way

Our favorite wallet software Electrum requires a little help when importing a private key to include all its possible four public addresses. In other words the two legacy P2PKH adresses (one uncompressed, one compressed), one segwit P2WPKH-P2SH address, and one native segwit P2WPKH (bech32) address.

Let’s consider this randomly generated private key (never use this exact one, as it has been disclosed here):

================================================================
Private Key (HEX):
c80acedd6050e6bfb952c4c845c818eed684b5294036d3848f36d4431990becb
Private Key Uncompressed (WIF):
5KLPPfHhYcHyNhUUXJCbrZDcfBdokghZFbe6ABNLE17uvYN3UPy
Private Key Compressed (WIF):
L3vZq1zhxWmupmeGUivCqjCgPXwTMpE1MRthmWm9rPXWb2CFoCja
================================================================

In order to make Electrum read and understand all four different public addresses that belong to this one private key, we must prepend the base58 encoded private keys with certain prefixes (“p2pkh:” for both the uncompressed and the compressed private keys, “p2wpkh-p2sh:” once for the compressed private key and finally “p2wpkh:” for the compressed private key). Does it sound complicated? It really isn’t! Simply copy these four lines

p2pkh:5KLPPfHhYcHyNhUUXJCbrZDcfBdokghZFbe6ABNLE17uvYN3UPy
p2pkh:L3vZq1zhxWmupmeGUivCqjCgPXwTMpE1MRthmWm9rPXWb2CFoCja
p2wpkh-p2sh:L3vZq1zhxWmupmeGUivCqjCgPXwTMpE1MRthmWm9rPXWb2CFoCja
p2wpkh:L3vZq1zhxWmupmeGUivCqjCgPXwTMpE1MRthmWm9rPXWb2CFoCja

into Electrum (under Wallet/Private keys/Import).

Finally, look under the Address tab (if needed: View/Show Addresses), and you should see all four public addresses

13yjiyCo8MpKR5WZ8wQHJjUtm9KEEfxMLS
1NunnvramHR4zi7VUwPMtJ6wnCCtqbZK1Q
3EZYXbPp6tLJo3u698m7yimSg7xdPyJy4W
bc1q7pt87g2x2h5ffn5t8974aszj34py5vdjxl4kef

Boom, done! Four public addresses from one private key. (Now, actually using the uncompressed legacy address isn’t a great idea, due to high transaction fees, but that is a topic for another article.)

Comments or questions?

One more thing!

Consider the donation address at the bottom of the page. We re-invest all contributions into new projects for btcleak.com. Help us create new content and remain ad-free forever. Thank you.

One Reply to “Import all private keys in Electrum the right way”

  1. […] You should know this by now. A native segwit address (beginning with “bc1”) is what you are looking for. A lazy person (we like lazy people!) lets their wallet create one for them. We prefer generating a compressed private key WIF and importing it into a fresh Electrum wallet using the proper prefix. […]

    Reply

Leave a Reply

Your email address will not be published.