17

I am switching from bitcoin-qt to Electrum, and it seems as if I will need to download the blockchain again. Can I copy and paste my wallet.dat into Electrum's files?

0

5 Answers 5

7
  1. Start Bitcoin Core with the wallet.dat you want to export

  2. Dump all wallet keys via Bitcoin Core's Console using dumpwallet wallet.dump, where wallet.dump is the name of the dump file to be created.

If you get an error, try specifying an absolute file path with a dir to which Bitcoin Core has the permission to write to, e.g. you can specify the same dir as the one where your wallet.dat is located.

  1. You'll get a list of private key to address pairs in the following format:
L4ysibEFMBQc3hfr7tvUyV4nBP1YQ3AgDewszoYq5czMtXotmmro 2020-08-21T14:36:58Z change=1 #addr=bc1qpw40dkvcj23zt3efvdwqr7ddfunwktx11f3tjf
  1. Extract all the private keys (they are in the first column, e.g. L4ysi..mmro).

I remove unnecessary stuff at the beginning and at the end of the dump file manually, then use cut -c 52- wallet.dump > private_keys.dump to leave out everything except of the private keys.

  1. Create a new Electrum wallet, select "Import Bitcoin addresses or private keys", convert your keys according to the rules available by clicking on "Info" button (you may not need to convert them if your wallet.dat is quite old) and you're good to go!

The above is tested on Bitcoin Core 0.21.1.0 and Electrum 4.1.5.

6

According to this FAQ:

In Electrum 2.0, you cannot import private keys in a wallet that has a seed. You should sweep them instead.

If you want to import private keys and not sweep them you need to create a special wallet that does not have a seed. For this, create a new wallet, select “restore”, and instead of typing your seed, type a list of private keys, or a list of addresses if you want to create a watching-only wallet.

You can get the private keys from Bitcoin Core using dumpprivkey as described in Using dumpprivkey to make a paper backup.

4

If you export the private keys for the addresses you want to keep then you are literally your own bank, most wallets allow you to import private keys in some way. I don't know the specifics of doing it on Electrum though.

To export from bitcoin-qt go into the debug console from the menus, and enter

dumpprivkey "1bitcoinaddresshere"

Keep that key safe - it is the key to all coins in that address now, past & future. Don't leave it on your desktop or dropbox, preferably carefully copy and paste it into the other wallet without writing to disk.

3

I have to disagree with the other 2 answers at the time of this writing. While indeed wallet.dat contains all the critical information, and in theory you could just use it with another application, in practice the wallet file format is not consistent between applications, and AFAIK you cannot use that file elsewhere.

Your best course of action depends on your needs, but it's probably to export your private keys, import them elsewhere (such as blockchain.info), and send the coins to the wallet you want to use going forward.

2
  • What do you mean "import them elsewhere (such as blockchain.info)"?
    – Geremia
    Commented Feb 14, 2015 at 21:57
  • 1
    @Geremia: After you've exported your private key, you can import it to another wallet. Once the key is imported, you can spend the coins it controls using this wallet. Every wallet has its own interface for importing. An example for a wallet to which you can import the key is blockchain.info. Commented Feb 15, 2015 at 12:08
3

This question is already answered in the Electrum tutorials http://electrum.org/tutorials.html#switching-to-electrum

What to do with my old addresses and wallet when switching to Electrum?

The best way to switch to Electrum is to send all the bitcoins you have on your old wallet to one of the addresses on your Electrum wallet. This way you'll have all your bitcoins secured with your seed.

You could import the private keys from your old client, but you will have to keep a backup of those keys separately as they won't become part of your Electrum seed.

Remember not to totally delete your wallet.dat if you gave your addresses for the deposite to other people

Not the answer you're looking for? Browse other questions tagged or ask your own question.