I had Bitcoin-Qt on my computer with several bitcoins in my wallet, using Vista. Then my computer crashed. Finally I was able to get my computer fixed and download a new version of Bitcoin-Qt. Now I would like to import my original wallet.dat
from the old client which was encrypted into an new version of Bitcoin-Qt. How do I do that?
4 Answers
First, close the Bitcoin-Qt client.
Then you have to locate your Bitcoin folder. For Windows, it should be here:
%APPDATA%\Bitcoin
and for Linux:
~/.bitcoin
In that folder, there should be a wallet.dat
file.
- If you currently have no bitcoins in your wallet, you can just delete that file and replace it with your backup.
- If you have some bitcoins in this wallet as well, backup that wallet file as well, or send all the coins to an address from your backed up wallet.
When you placed the other wallet.dat
file in place, you should run Bitcoin-Qt with the -rescan
option. Here's how to do that in Windows:
Go to
C:\Program Files (x86)\Bitcoin
using Windows Explorer.In that folder, hold shift and right-click and select
Open command window here
(picture).In the command prompt, type
bitcoin-qt.exe -rescan
and hit enter (picture).
Now Bitcoin-Qt should start and rescan the blockchain to calculate the balances of the addresses in your wallet.dat
file.
(Source for pictures: cant see bitcoin after restore of backup)
-
1What do you mean, "localize your Bitcoin folder." ? Commented May 3, 2015 at 8:27
-
@JonathanDavidFinch I mean find the folder that contains your Bitcoin data files Commented May 9, 2015 at 23:15
-
What happens if I backed up two separate wallets to two separate .dat files?– jakcCommented Jul 1, 2015 at 13:49
-
That's more difficult. What I would do is import one of them, generate a new address and copy it. Then back up the wallet.dat file and import the other one. From there send all coins to the copied address from the first wallet file. Finally just continue using the first wallet file. (Keep the second one for a few days for the case that something went wrong ;)) Commented Aug 4, 2015 at 10:11
-
1I can't believe an answer would start with "just delete that file" regardless of the "if". NEVER "just delete" a wallet.dat file.– user5652Commented Mar 30, 2019 at 18:04
For OSX:
- Backup your original wallet.dat file (
~/Library/Application Support/Bitcoin/wallet.dat
by default). This contains the private keys for your bitcoins. If you lose it, you lose your coins. - Install Bitcoin Core on a machine with 100s of gigabytes of free space. Allow it to download the blockchain. This could take days.
- Replace the
wallet.dat
file on the new machine with your old one. - Start Bitcoin Core on the new machine with the
rescan
flag, to scan the blockchain for your newly imported bitcoin. You can do this with the command line/Applications/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -rescan
. This can also take a long time (hours). - Your wallet should now be imported and working on the new computer.
the other answers suggest closing your node copying directories etc, NOT necessary. Here is how i did it starting with an old wallet2.dat
file:
- create a folder
foo
(any name, any directory) - copy the file wallet2.dat into folder
foo
and rename the wallet towallet.dat
- on the GUI click Window->Console and type into the > field:
help loadwallet
which will tell you bunch of stuff (you can read it, or skip to next point) - type
loadwallet /path/to/your/folder/foo
(change it to your actual path where folder foo is, on windows egC:\Users\user\Downloads\foo
) wait, just wait (for me 30min), when done you will see sth like:
{ "name": "/home/user/Downloads/foo/", "warning": "" }
got to File->Open Wallet ->
foo
(your name should be listed here)On the right side there is now a dropdown menu where you can selected your open wallets (if it does not appear you had no other wallet open, also ok)
(Since the wallet is now located in the folder foo and outside the datadir, you might want to close your node and copy the folder into the wallets
directory in your datadir; I just wanted to recover the wallet, clean it and send the funds to the default wallet deleting foo anyway)
-
i added the folder in bitcoindata\wallets\wallet1 etc. somehow bitcoin core detected all wallets automatically Commented Aug 6, 2020 at 7:29
-
1this seems to require a full blockchain. I tried this with a pruned node and it gives error: "Wallet loading failed. Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node) (code -4)" Commented Mar 3, 2021 at 4:19
I think the above answer is good, but I have typically restored a few times with
1. ShutDown BitCoin Client
2. Find your wallet location (%APPDATA%\Bitcoin) OR for example : C:\Users\UserName\AppData\Roaming\Bitcoin
3. Backup, verify, then delete that wallet.dat file
4. Paste your other wallet.dat file into the folder.
5. Open BitCoin Client , blocks get checked and updated, and you should see your amount.
6. I'm not sure that you need to do command prompt with the -rescan... I didn't have to..
-
1Not sure that asking a user to delete the wallet is a good idea. I would back it up in case you get mixed up. Commented Dec 6, 2017 at 23:46
-