Bitcoin Forum
April 25, 2024, 10:54:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Restore Bitcoin-qt from wallet.dat after crash  (Read 202 times)
Galvatron (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
February 17, 2018, 01:54:46 AM
 #1

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.
Transactions must be included in a block to be properly completed. When you send a transaction, it is broadcast to miners. Miners can then optionally include it in their next blocks. Miners will be more inclined to include your transaction if it has a higher transaction fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714042443
Hero Member
*
Offline Offline

Posts: 1714042443

View Profile Personal Message (Offline)

Ignore
1714042443
Reply with quote  #2

1714042443
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
February 17, 2018, 03:40:11 AM
 #2

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.

Galvatron (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
February 17, 2018, 05:32:31 PM
Last edit: February 17, 2018, 05:44:57 PM by Galvatron
 #3

"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.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
February 17, 2018, 05:36:16 PM
 #4

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.

Galvatron (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
February 17, 2018, 05:58:15 PM
 #5

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?
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
February 17, 2018, 08:55:39 PM
 #6

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.

Galvatron (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
February 18, 2018, 06:38:36 PM
 #7

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.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
February 18, 2018, 08: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.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!