This post discusses the methods for recovering a deleted or corrupt Bitcoin Core Wallet. Many other currencies, such as Bitcoin Cash, Litecoin, Dogecoins and more share Bitcoin Core’s wallet format and can be recovered using the same techniques and tools. I assume that you have the wallet password, or there is no password. (I’ll post later on what to do if you forget your password.)

This information is based on helping dozens of people in similar situations with my Bitcoin wallet recovery service.

The information below is just an outline. I hope to add detailed instructions soon.

Recovering Deleted Wallets

Your wallet could have been deleted in several ways:

Uninstalled Wallet Software

If you removed the Bitcoin Core software, your wallet is still on your computer. Just go to your Bitcoin Core Data Directory:

Windows:

%APPDATA%\Bitcoin
Mac
~/Library/Application Support/Bitcoin/

Deleted Wallet File

If you deleted the wallet file, you should first check for any backups you made. If you don’t have any backups, you can try two things:

1: Undelete Tools

Until the file is overwritten by new data, deleted files stay on your hard drive.  You can get them back with data recovery software:

Windows: Data Recovery Software: Piriform Recova
Mac: Data Recovery Software: Data Rescue 5 ($69)
More Mac options.
Android smartphones: Turn on USB Debugging and connect to PC.  Now run Smartphone-enabled data recovery software.
iPhone: I do not believe deleted application data (unlike photos, messages, etc) can currently be recovered.

2: Volume Shadow Copies (Windows)

Previous versions are copies of files and folders that Windows automatically saves as part of a restore point. Previous versions are sometimes referred to as shadow copiesFollow Microsoft’s instructions to see if there is an older copy of your wallet.

Formatted Hard Drive

If you did a “quick format”, all your data are probably still on the hard drive. Use the tools above. If you did a full format on Windows or Mac, your hard drive sectors have been completely zeroed out, and your data is lost.

Old Wallets

If you want to get into your wallet without waiting for the full bitcoin blockchain to sync, just grab the private key from your wallet. You can do this using the Bitcoin Core API or the pywallet tool below.

Go to “Help” “Debug Windows” “Console”
Now you can display the private key for your wallet with dumpprivkey “address”

Corrupt Wallets

If you wallet is corrupt (perhaps because the wallet file was partially overwritten before data recovery), Bitcoin Core may fail to open it with the message “ERROR: wallet.dat corrupt, salvage failed

In this case, you have three options:

1: Dump the wallet with pywallet to extract the private keys
Run:

python pywallet.py –dumpwallet > wallet.text

Now find the address containing your Bitcoin and sweep the private key.

Warning: some versions of pywallet have been hacked to steal your wallet! Be careful which one you download!

2: Decrypt the wallet and examine the wallet with bitcoinj

Make sure you have all the required packages:

sudo apt-get install openssl maven default-jre default-jdk openjfx

Decrypt the wallet before doing anything with it:

openssl enc -d -aes-256-cbc -a -in /path/to/wallet.dat -out ~/wallet-decrypt.dat

Download bitcoinj:

wget https://github.com/bitcoinj/bitcoinj/archive/master.zip unzip master.zip

Move to the directory:

cd bitcoinj-master

Run Maven

sudo mvn clean install -DskipTests

Move to the tools dir

cd tools

Run the wallet dump

./wallet-tool dump –dump-privkeys –wallet=~/wallet-decrypt.dat > wallet.txt

Then get the seed and private keys

grep “Seed as” wallet.txt > seed.txt grep -o -E “WIF=([a-zA-Z0-9]+)” wallet.txt > private-keys.txt sed -i ‘s/WIF=//g’ private-keys.txt

3: Look for the private key with a hex editor:

Try opening the wallet.dat in a hex editor and searching for this string of bytes 0201010420. The next the thirty-two bytes after that string might be a private key.

Categories: Guides