Bitcoin Forum
May 03, 2024, 07:51:03 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Trouble recovering wallet  (Read 1180 times)
Hawk72 (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
March 02, 2013, 04:07:33 AM
Last edit: March 02, 2013, 07:28:30 PM by Hawk72
 #1

Hi,
Clearly a newbie here.  My situation is I had a Ubuntu virtual machine with my bitcoin-qt client on it.  I backed up the wallet, I do not recall how I backed it up (using "backup" from the menu or just copying the file, I dont recall).

The VM has crashed, unrecoverable.

No biggy I was thinking.  So I have installed the QT client on a windows pc now.  Ran the QT client for a minute, then exited to get my backed-up wallet installed.  Copied the file in, renamed it wallet.dat.  Starting the QT client.  it complained "wallet.dat corrupt, salvage failed".

Is this not supposed to work?  few questions:
1) are linux wallet.dat files compatible in windows
2) do I need to wait for the entire blockchain to load before putting the wallet in?  I wouldnt think so.
3) for my own edification, I have another windows QT client that has the vast majority of my QT coins.  Is there ANY danger in taking that wallet.dat file (from windows machine A) and putting it into my new QT client (on windows machine B).  
4) is there a way to read my private keys off of the "corrupted" wallet.dat?
5) if I do manage to read my private keys off of the "corrupted" wallet, how can I get them into a client (ideally QT client)
6) What is the correct way to import a backed-up wallet?  I'm assuming just copy it into that directory.

Apologies in advance, but I am a noob.

ps love this place.
1714765863
Hero Member
*
Offline Offline

Posts: 1714765863

View Profile Personal Message (Offline)

Ignore
1714765863
Reply with quote  #2

1714765863
Report to moderator
1714765863
Hero Member
*
Offline Offline

Posts: 1714765863

View Profile Personal Message (Offline)

Ignore
1714765863
Reply with quote  #2

1714765863
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714765863
Hero Member
*
Offline Offline

Posts: 1714765863

View Profile Personal Message (Offline)

Ignore
1714765863
Reply with quote  #2

1714765863
Report to moderator
1714765863
Hero Member
*
Offline Offline

Posts: 1714765863

View Profile Personal Message (Offline)

Ignore
1714765863
Reply with quote  #2

1714765863
Report to moderator
1714765863
Hero Member
*
Offline Offline

Posts: 1714765863

View Profile Personal Message (Offline)

Ignore
1714765863
Reply with quote  #2

1714765863
Report to moderator
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
March 02, 2013, 05:04:13 AM
 #2

4) is there a way to read my private keys off of the "corrupted" wallet.dat?

Sometimes when the Bitcoin-Qt client has the wallet open there are crucial pieces of data held in logfiles.  When the client shuts down, that process properly closes the wallet.dat and the file has data integrity.   If the client crashes or has some problem shutting down, the wallet won't have been closed properly.  Normally when that happens the client can be restarted and the data from the log files will be used to recover (rollback) the wallet or clean up, with not even a hiccup noticed by the user.  If you grabbed a copy of the wallet.dat while it was not in a closed state or was in need of recovery, then now when it tries to perform that recovery the needed log data is not accessible.

That may be what happened, or perhaps there was a media error with the backup, or the wallet.dat was already corrupt but the client didn't notice (the more recent releases are more stringent about checking validity) or any number of explanations for why currently the wallet.dat is unreadable.

What you can do is try to salvage the wallet.

Run Bitcoin-Qt manually from the command line and do a -salvagewallet

That moves the bad wallet.dat to wallet.timestamp.bak, then runs a 'salvage' operation to get key/value pairs, and writes them to a new wallet.dat.  Then the client continues from there.  If there was keys in corrupted data that it couldn't recover, those won't be in the new replacement wallet, but if it was able to salvage everything you won't be missing anything.


Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


jsCoin
Newbie
*
Offline Offline

Activity: 32
Merit: 0


View Profile
March 02, 2013, 08:34:11 AM
 #3

Nice tip.  I had not see the salvagewallet option.  You can also use pywallet to fix your wallet or recover your keys.
Hawk72 (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
March 02, 2013, 06:31:12 PM
 #4

4) is there a way to read my private keys off of the "corrupted" wallet.dat?

What you can do is try to salvage the wallet.

Run Bitcoin-Qt manually from the command line and do a -salvagewallet

That moves the bad wallet.dat to wallet.timestamp.bak, then runs a 'salvage' operation to get key/value pairs, and writes them to a new wallet.dat.  Then the client continues from there.  If there was keys in corrupted data that it couldn't recover, those won't be in the new replacement wallet, but if it was able to salvage everything you won't be missing anything.


Thanks for the quick response.  I have tried that on my "new" windows QT client, and the QT just quits out.  No error, but no progress.

So I decided to install a new Ubuntu VM, to see maybe its a Linux/Windows compatibility issue, or if maybe the salvage only works on Linux.

Running the -salvagewallet argument has the same result on my new linux QT client as well.  ie, the client quickly loads and closes without a peep.  It does not appear to attempt creating a backup wallet file that I can see.

I would appreciate any more ideas you or anyone else may have.
Hawk72 (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
March 02, 2013, 06:41:32 PM
 #5

Nice tip.  I had not see the salvagewallet option.  You can also use pywallet to fix your wallet or recover your keys.

Thanks for tip jsCoin.  I am finding it tough to figure out how to use pywallet, but will press ahead until I am completely stuck before bothering you again.

Thanks.
Hawk72 (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
March 02, 2013, 07:30:40 PM
 #6

I've gotten to a point where I can run pywallet on a new unencrypted wallet.dat file.  But when I try to run it on my backed-up, encrypted file, it doesnt work.  Have tried the "--password" option that I saw somewhere but that appears not to be an option.

Any help recovering keys/fixing an encrypted wallet using pywallet?
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
March 02, 2013, 08:13:30 PM
 #7

But when I try to run it on my backed-up, encrypted file, it doesnt work.  Have tried the "--password" option that I saw somewhere but that appears not to be an option.

Since your wallet.dat is encrypted, you must use the version of pywallet that supports the -password switch.

 - https://github.com/joric/pywallet

Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


Hawk72 (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
March 02, 2013, 10:07:28 PM
 #8

Thanks.  I am now using the joric pywallet.

I've got two problems.  Both of these problems occur on both the jackjack and joric wallet:
1) I am getting an error when running it:  "ERROR:root:Couldn't open wallet.dat/main. Try quitting Bitcoin and running this again."
2) When I try to use the "--password" option, I am getting an error, I think because I have an exclamation point in my password.  I realize the jackjack pywallet doesnt accept the password option, but this also happens on the joric one.  Is there a linux switch (i've tried using \'s) that would allow the syntax?  I am fearful even if I get over this step, I'll be stuck on #1.  An example of this error (assuming my password is "ab!c" is below.  Any guidance please?

=========
Code:
username@Ubuntu64-1204-BC:~/.bitcoin$ ~/pywallet.py --dumpwallet --password="ab!c"
bash: !c": event not found
username@Ubuntu64-1204-BC:~/.bitcoin$
Hawk72 (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
March 02, 2013, 10:11:24 PM
 #9

I think the "\" switch might work to get past #2.  But am stuck on point #1:

Code:
username@Ubuntu64-1204-BC:~/.bitcoin$ pyw --dumpwallet --password="ab\!\c"
ERROR:root:Couldn't open wallet.dat/main. Try quitting Bitcoin and running this again.
username@Ubuntu64-1204-BC:~/.bitcoin$
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
March 03, 2013, 01:08:38 AM
 #10

Running the -salvagewallet argument has the same result on my new linux QT client as well.  ie, the client quickly loads and closes without a peep.  It does not appear to attempt creating a backup wallet file that I can see.

If pywallet can't read it and salvage wallet can't even load it ... that's not good.  You don't have any older backups?  If you had backup media (e.g., flash drive) have you re-tried re-copying from the media with both pywallet and then -salvagewallet  (i.e, not used the same wallet.dat after one failed and then trying the next?)

The last ditch approach might have worked except that it only works for non-encrypted backups:
 - http://bitcointalk.org/index.php?topic=25091.0

But the number one lesson about backups ... if your backup can't be used to recover the database, then you have no backup.

Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1028



View Profile WWW
March 03, 2013, 01:44:32 AM
 #11

In bash on Xnix, you should quote the password with single quotes like --password='this!is!my!password'
Hawk72 (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
March 03, 2013, 10:47:48 PM
 #12

Thanks so much for the continued help.  Here is where I am at now:

A) I've been storing my wallet backups as an embedded object in Microsoft Excel.  I've determined that this does not work.  I've tested this - I take a wallet that can be pywallet'd, embed it as an object in Excel, then copy it out of Excel, and suddenly pywallet complains.  Anyone have an idea how to circumvent this - this would by far be the easiest solution!
B) Trying to recover my Virtualbox VDI drive.  This is a long shot

Clearly I screwed up assuming backing it up in a spreadsheet (that gets backed up automaritally daily).  Lesson learned.

Any ideas?
Hawk72 (OP)
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
March 04, 2013, 12:34:25 AM
 #13

SOLVED.

I found a wallet backup from before I "backed it up properly" in excel.  Nearly &!$%ed my pants when I found it.

Lesson to all - do not trust embedding files into Excel.  Granted I am one of the few foolish people to assume this would work!

Thanks to everyone - particularly Stephen Gornick.  I'll say it again - I love this place!
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
March 04, 2013, 02:28:08 AM
 #14

SOLVED.

I found a wallet backup

\O/ 

+1 for multiple backups using multiple media (e.g., one kept locally like on a flash drive, and one backed up online somewhere like Dropbox (perhaps encrypted using TrueCrypt, even with Bitcoin-Qt's passsphrase encryption)

Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4615



View Profile
March 04, 2013, 02:37:08 AM
 #15

Lesson to all - do not trust embedding files into Excel.  Granted I am one of the few foolish people to assume this would work!

More important lesson to all.  No matter what backup process you choose.  Attempt a recovery from that process at least once before you need it.  This way if there is some unknown issue with the process you've chosen, you can deal with it before it is too late.  This is true of anything important enough to back up, not just bitcoin wallets.

Glad to hear that you found a good backup!
gmaxwell
Staff
Legendary
*
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
March 04, 2013, 02:37:32 AM
 #16

What you can do is try to salvage the wallet.
Salvage doesn't work too well right now, most cases that cause you to need to salvage make the salvage 'fail' (it fails whenever the database layer returns an error). If the wallet is not encrypted I usually recommend people to just use the private key recovery tool: https://bitcointalk.org/index.php?topic=25091.0   if you need to recover an encrypted one, I can give you a patch to make the salvage more robust.
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!