Author

Topic: Restore Bitcoin-qt from wallet.dat after crash (Read 204 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
February 18, 2018, 03:18:22 PM
#8
Just curious, when would a forced rescan ( -rescan ) be useful or necessary?
A forced rescan is only necessary if you don't see your expected balance once the wallet has finished syncing.
newbie
Activity: 4
Merit: 0
That's great news. I've been researching the issue for over a week but have only been able to piece together information from related issues. This sounds like the safest and simplest method since I have to reinstall the client regardless. From what I understand, that would be the only drawback-- waiting for  the entire blockchain to download.

Just curious, when would a forced rescan ( -rescan ) be useful or necessary?

Thanks for all of the help. I'll let you know how it goes once I'm synced and restored.
staff
Activity: 3458
Merit: 6793
Just writing some code
That was a quick response. Smiley Thanks for everything. So it doesn't make much of a difference if I wait for the chain to finish loading before switching the wallet.dat, since it won't take long to sync after I switch them?
Yes. Rescanning is not the same as syncing.
newbie
Activity: 4
Merit: 0
That was a quick response. Smiley Thanks for everything. So it doesn't make much of a difference if I wait for the chain to finish loading before switching the wallet.dat, since it won't take long to sync after I switch them?
staff
Activity: 3458
Merit: 6793
Just writing some code
So you're saying I will only need to swap out the wallet.dat file and then restart the client without rescan?
Yes, it will actually perform the rescan itself if it needs to. You don't actually need to force a rescan.

I tried to switch out the wallet.dat file before downloading the blockchain, but since this is a fresh installation there was no new wallet.dat.
You can stop it now and swap out the wallet.dat file. It may actually be better to do that to avoid a longer rescan later. The sync will pick up where it left off.

Once the chain is synced, I simply swap the wallet.dat files, restart Bitcoin-qt normally, and my coins should be restored with no need for dumping the key or rescan?
A rescan is still required, but it will be started automatically by the software.

Will it have to rescan the entire chain (a week) all over again or will it take around 30 minutes or so?
Rescanning is not the same as downloading the blockchain or reindexing the blockchain. It will be much, much, much faster. On the order of tens of minutes rather than days.
newbie
Activity: 4
Merit: 0
"The only actual restoring is the second thing with starting Bitcoin Core with -rescan. But you don't actually have to use -rescan if you are syncing from scratch. If you are syncing from scratch, you can just put your wallet.dat file in the data directory and start Bitcoin Core. It will automatically scan the blockchain for your transactions as it syncs."

"The first option with dumpwallet is only if you want to import your private keys into another wallet."


Thanks for the response. Right now I'm resyncing the blockchain from scratch, it should be a few more days. So you're saying I will only need to swap out the wallet.dat file and then restart the client without rescan? I tried to switch out the wallet.dat file before I synced the blockchain, but since this is a fresh installation there was no new wallet.dat to swap. Once the chain is synced, I simply swap the wallet.dat files, restart Bitcoin-qt normally, and my coins should be restored with no need for dumping the key or using the rescan command? Will it rescan the entire chain again or will it take less time?
Sorry for any questions which seem redundant, I just want to be as specific as possible so I don't run into problems or have to reload the entire blockchain because I made a small mistake. Thanks again.
staff
Activity: 3458
Merit: 6793
Just writing some code
Can anyone tell me what "txtfile_keysfile_path.txt" means?
The dumpwallet command takes a path to a file. It writes the wallet's key data to that file. So "txtfile_keysfile_path.txt" is a string which is the path to the file where you want the key data to go. So you might do something like
Code:
bitcoin-cli dumpwallet C:\Users\user\Documents\wallet_data.txt

Another method I've seen involves a similar swap out of the wallet.dat file but the instructions are to then:

After swapping out wallet.dat
Go to the Windows command prompt and enter

C:\Program Files\Bitcoin>bitcoin-qt.exe -rescan

From what I gathered this would rescan the wallet.dat and my coin would then be restored.
Can anyone elaborate on these methods and tell me if I have the right idea or not? Right now I'm about half done syncing the blockchain.
Really appreciate your help.
The only actual restoring is the second thing with starting Bitcoin Core with -rescan. But you don't actually have to use -rescan if you are syncing from scratch. If you are syncing from scratch, you can just put your wallet.dat file in the data directory and start Bitcoin Core. It will automatically scan the blockchain for your transactions as it syncs.

The first option with dumpwallet is only if you want to import your private keys into another wallet.
newbie
Activity: 4
Merit: 0
Recently, my computer crashed and I had to reinstall everything. I retrieved my original wallet.dat file and have looked at a few options for recovery. I'm not familiar with the console, but have gathered that if I install and sync the Bitcoin-QT client, swap the wallet.dat files, and use the following line in the console, I can retrieve my private key.

bitcoin-cli walletpassphrase "PasswordHere" 600
bitcoin-cli dumpwallet "txtfile_keysFile_path.txt"

I never set up a passphrase and it isn't encrypted, so I assume I skip to the second command.
It would look like this (except for I don't know what is meant by "txtfile_keysfile_path.txt"):

Bitcoin-qt dumpwallet "x?"

Can anyone tell me what "txtfile_keysfile_path.txt" means?

Another method I've seen involves a similar swap out of the wallet.dat file but the instructions are to then:

After swapping out wallet.dat
Go to the Windows command prompt and enter

C:\Program Files\Bitcoin>bitcoin-qt.exe -rescan

From what I gathered this would rescan the wallet.dat and my coin would then be restored.
Can anyone elaborate on these methods and tell me if I have the right idea or not? Right now I'm about half done syncing the blockchain.
Really appreciate your help.
Jump to: