BitShares Forum

Other => Graveyard => BitShares PTS => Topic started by: Proto on November 12, 2013, 06:39:23 pm

Title: Corrupted wallet.dat
Post by: Proto on November 12, 2013, 06:39:23 pm
Hi,

I'm experiencing serious issues with my wallet.dat. After the mandatory update to the new fork my client kept crashing randomly (just shutting down with no error). Now I can't get it up because it can't open my wallet.dat file. I'm on ubuntu linux.

Will try to replace my wallet.dat with a backup copy I made earlier. Anyone with similar issues? That shouldn't happen just by using the software!

Flush(false)
wallet.dat refcount=0
wallet.dat checkpoint
wallet.dat detach
wallet.dat closed
DBFlush(false) ended               0ms
StopNode()
Committing 0 changed transactions to coin database...
*** System error: CDB() : can't open database file wallet.dat, error -30973
Error: System error: CDB() : can't open database file wallet.dat, error -30973
Error: System error: CDB() : can't open database file wallet.dat, error -30973
ERROR: AcceptBlock() : AddToBlockIndex failed
ERROR: ProcessBlock() : AcceptBlock FAILED
msghand thread interrupt
ProtoSharesMiner terminated
keypool return 15
ProtoSharesMiner terminated
keypool return 5
ProtoSharesMiner terminated
keypool return 7
ProtoSharesMiner terminated
keypool return 11
Flushed 9448 addresses to peers.dat  81ms
terminate called after throwing an instance of 'std::runtime_error'
  what():  CDB() : can't open database file wallet.dat, error -30973
Aborted (core dumped)
Title: Re: Corrupted wallet.dat
Post by: Amazon on November 12, 2013, 06:44:08 pm
Sorry to hear about this. Have you tried to use the wallet file on another machine? The 0.2.0 Linux binary has bug and bytemaster has been trying to fix it.
Title: Re: Corrupted wallet.dat
Post by: Proto on November 12, 2013, 06:52:42 pm
I don't use binaries for new alt-coins... I'm compiling from newest git source.
I have deleted everything except my wallet.dat and try to redownload the blockchain currently. Did a git pull and complete recompile.
I get lots of warnings:

ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
ERROR: mempool transaction missing input
...


Then after a while, with my backup wallet.dat:


*** System error: CDB() : can't open database file wallet.dat, error -30973
Error: System error: CDB() : can't open database file wallet.dat, error -30973
Error: System error: CDB() : can't open database file wallet.dat, error -30973
ERROR: AcceptBlock() : AddToBlockIndex failed
ProcessBlock: ACCEPTED
CreateNewBlock(): total size 1000
bitcoind: main.cpp:1662: bool CBlock::ConnectBlock(CValidationState&, CBlockIndex*, CCoinsViewCache&, bool): Assertion `pindex->pprev == view.GetBestBlock()' failed.
Aborted (core dumped)
Title: Re: Corrupted wallet.dat
Post by: Proto on November 12, 2013, 06:54:30 pm
That really sucks :(
Private key export was also broken with the first version on git... so I didn't do it.
Any other way to extract the private key manually from wallet.dat, if I know the address?
Title: Re: Corrupted wallet.dat
Post by: bobb on November 12, 2013, 06:58:24 pm
Hey Proto,

the same happened to me on some wallets.
I guess you are using the non-qt client?

After _backing up the the wallet_ just try to open the wallet with the qt-client.
If this doesn't work try the -salvagewallet option.

If you have any questions feel free to pm me. I know the feeling when reading that message.
Title: Re: Corrupted wallet.dat
Post by: alphaking on November 12, 2013, 07:01:29 pm
*** System error: CDB() : can't open database file wallet.dat, error -30973

same problem!
Title: Re: Corrupted wallet.dat
Post by: Proto on November 12, 2013, 07:03:12 pm
Yes, I'm using the non qt-client. Nonetheless thanks, I will try loading my wallet.dat with a qt-client and report back. Have multiple backups, so I still have high hopes I didn't loose all that money. 
Title: Re: Corrupted wallet.dat
Post by: Proto on November 12, 2013, 07:07:29 pm
Only difference between my miners and my client wallet is the db version used.

My miners use:
libdb_cxx-4.7.so => /usr/lib64/libdb_cxx-4.7.so

The problematic client is linked against:
libdb_cxx-5.3.so => /usr/lib/x86_64-linux-gnu/libdb_cxx-5.3.so

To anyone with the same problem, please run ldd on your binary and report back what db version you used
Title: Re: Corrupted wallet.dat
Post by: bobb on November 12, 2013, 07:11:35 pm
This happend to almost all of my protoshare-wallets, including the wallets on the miners.
I already started to dump the wallets using db_dump. 
Then I just tried the qt-client and the salvagewallet option.
Title: Re: Corrupted wallet.dat
Post by: Proto on November 12, 2013, 07:16:21 pm
This happend to almost all of my protoshare-wallets, including the wallets on the miners.
I already started to dump the wallets using db_dump. 
Then I just tried the qt-client and the salvagewallet option.

Did you recover your PTS? What DB version are you using?
Title: Re: Corrupted wallet.dat
Post by: bobb on November 12, 2013, 07:18:03 pm
my clients are linked against libdb_cxx-5.1.so.
But so is the qt-client which seem to work fine.

And yes I was able to revcover the PTS.
Title: Re: Corrupted wallet.dat
Post by: Proto on November 12, 2013, 07:29:28 pm
Starting the client with the salvagewallet option + using a backup helped. Thanks!

A remainder to anyone here: MAKE BACKUPS

Does salvagewallet reimport all key pairs, even the unnamed ones? Not that I get into trouble when I try to spend some of that PTS (change address)
Title: Re: Corrupted wallet.dat
Post by: bytemaster on November 12, 2013, 08:30:33 pm
I would love to know the root cause of this problem.  I have also seen it.
Title: Re: Corrupted wallet.dat
Post by: gigawatt on November 12, 2013, 11:55:10 pm
That really sucks :(
Private key export was also broken with the first version on git... so I didn't do it.
Any other way to extract the private key manually from wallet.dat, if I know the address?

Private key export worked fine.  It was private key import that was broken (it was looking for the wrong version bytes).

You might be able to use something like pywallet (https://github.com/jackjack-jj/pywallet) to extract your keys from it.
Title: Re: Corrupted wallet.dat
Post by: super3 on November 13, 2013, 12:04:29 am
If you want my help I can probably recover it. Send me a PM.
Title: Re: Corrupted wallet.dat
Post by: joele on November 13, 2013, 07:04:59 am
Backup not only the wallet but also the private key.

To reveal your private key: dumpprivkey <address>

To import private key: importprivkey <privatekey>