Import wallet.dat into a new Bitcoin-Qt client

45

22

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?

Doug

Posted 2013-05-16T12:06:45.797

Reputation: 451

Answers

38

First, close the Bitcoin-Qt client.

Then you have to locate your Bitcoin folder. For Windows, it should be here:

%APPDATA%\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)

Steven Roose

Posted 2013-05-16T12:06:45.797

Reputation: 10 855

1What do you mean, "localize your Bitcoin folder." ?Jonathan David Finch 2015-05-03T08:27:43.277

@JonathanDavidFinch I mean find the folder that contains your Bitcoin data filesSteven Roose 2015-05-09T23:15:27.473

What happens if I backed up two separate wallets to two separate .dat files?Simon 2015-07-01T13:49:53.353

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 ;))Steven Roose 2015-08-04T10:11:43.860

You can also use the command-line option -wallet otherwallet.dat to use an alternative wallet (in the data directory) without copying/moving over the existing one, this can be useful for juggling wallets with less risk.wumpus 2017-05-24T06:19:39.353

For help on finding the data directory on other operating systems, see https://en.bitcoin.it/wiki/Data_directory (might make sense to add this to the answer)

wumpus 2017-05-24T06:23:19.437

@StevenRoose dude! I just randomly found your post trying to restore a wallet! What a small world!

I'm the dude from Madrid that contacted you through the Dartcoin project, we got beers and a burguer remember? lol – DaniGuardiola 2018-11-19T14:53:30.740

I can't believe an answer would start with "just delete that file" regardless of the "if". NEVER "just delete" a wallet.dat file.user5652 2019-03-30T18:04:13.473

3

For OSX:

  1. 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.
  2. Install Bitcoin Core on a machine with 100s of gigabytes of free space. Allow it to download the blockchain. This could take days.
  3. Replace the wallet.dat file on the new machine with your old one.
  4. 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).
  5. Your wallet should now be imported and working on the new computer.

Adam Millerchip

Posted 2013-05-16T12:06:45.797

Reputation: 925

3

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:

  1. create a folder foo (any name, any directory)
  2. copy the file wallet2.dat into folder foo and rename the wallet to wallet.dat
  3. 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)
  4. type loadwallet /path/to/your/folder/foo (change it to your actual path where folder foo is, on windows eg C:\Users\user\Downloads\foo)
  5. wait, just wait (for me 30min), when done you will see sth like:

    { "name": "/home/user/Downloads/foo/", "warning": "" }

  6. got to File->Open Wallet -> foo (your name should be listed here)

  7. 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)

enter image description here

(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)

qrtLs

Posted 2013-05-16T12:06:45.797

Reputation: 165

This answer is much better than the accepted answer, thank you.Jonah 2019-07-21T20:51:43.460

-1

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..

Tom Stickel

Posted 2013-05-16T12:06:45.797

Reputation: 223

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.Vallieres 2017-12-06T23:46:57.073

good point, added into #1 thxTom Stickel 2017-12-12T08:44:13.817