Consolidating old Bitcoin Core Wallets

Recently I started digging through old backups to find some coins that people were telling me they were sending but to addresses that weren’t in my wallets anymore. I discovered I had dozens – or even more (i’m discovering more all the time).


  • Hash all wallets that are found in iCloud, DropBox, Google Drive, and other backups so that we can save time loading duplicates (when searching backups for wallets, you’ll often end up with hundreds or thousands of duplicates.
  • Upgrade all old wallet files.
  • Create an encrypted drive containing all of the wallet.dat files for backup purposes.
  • Import private keys from all wallets into bitcoin core’s latest version so that they are all in one master wallet file.
  • Import private keys from all wallets into electrum, in one master keyfile.

Hashing All Wallets

Since many backups will contain identical wallet files, we will first start by renaming all wallet.dat files to an md5 checksum of their content. This will prevent issues with accidentally overwriting a wallet.dat if one has many wallet.dat files. The chances of two md5 hashes being identical are very very low, so unless you’re messing with satoshi’s 1 million bitcoins, probably safe enough for de-duplication of identical wallets.

This is done very simple on osx with the following commands:

spikes-MacBook:~ spike$ md5 wallet.dat
MD5 (wallet.dat) = fdf25759f1c6d450a0f8425284867a3d
spikes-MacBook:~ spike$ mv wallet.dat fdf25759f1c6d450a0f8425284867a3d.wallet.dat

Importing and Upgrading all wallet files

First, we will start by installing the latest bitcoin daemon. Once that’s done, we will create a wallets directory, and put all of our wallets there (since the file names are dependant upon the md5 hash, we can safely overwrite whenever there are two files with the same name – they are both identical).

Within ~/.bitcoin/bitcoin.conf (you can create this if it doesn’t already exist), let’s add a couple of configuration options:


This is going to tell bitcoind to run in the background and to use the listed wallet file. You can list as many wallet files as you like (there are potentially limits of around 300 wallets at once).

Now we start bitcoind and give it some time to sync the blockchain. Now we will have all wallets in the same version of bitcoind and we can start to dump the private keys and then import them all into one new fresh wallet.

Step 1) Create a new wallet:

Step 2) Dump Private keys from each of the wallets we earlier imported.

Step 3) Import private keys from each of the wallets we earlier exported.

Leave a Reply