Wallet.dat corrupted after bitcoin encryption #881

issue krishKM opened this issue on February 21, 2012
  1. krishKM commented at 10:54 PM on February 21, 2012: none

    Hi there,

    Yesterday night I have encrypted my wallet using bitcoin tool. today when I open bitcoin tool It shows "loading block index" and than throws an error "Wallet.dat corrupted". Now I cannot access my wallet. I'm using Win7 64bit.

    I have created new wallet.dat by renaming old wallet.dat to wallet-old.dat. with new wallet the bitcoin tool opens fine, even I can encrypt the new wallet works fine aswell. I just don't know what happened to my original wallet.dat. I'm new to bitcoin topic and I don't understand why the bitcoin folder is 1.3 GB.

    Is there any way I can recover my address back? because I have locked that adress in a mining website (deepbit). it would be very thankful if anyone gives clue how to recover the wallet.dat in windows environment. All I see on google is either linux solutions which I have zero knowledge.

    PS: I dont mind sharing half of the money the wallet has if i get it back.

  2. TheBlueMatt commented at 3:09 AM on February 22, 2012: member
  3. sipa commented at 10:27 PM on February 27, 2012: member

    Were you using 0.6.0rc1? It had a bug that corrupted wallets when encrypting them. If so, nothing is lost. I can send you instructions to recover, if matt's way doesn't work out.

  4. krishKM commented at 8:50 AM on February 28, 2012: none

    hi sipa, i tried his method but didnt help. because my wallet is encrypted it doesnt want to recover/repair it. when i was doing his method i could see my privatkeys and transactions and even my account public keys. his methode gave me an error something like error restoring wallet. do you have any other methods? thx in advance

  5. sipa commented at 12:01 PM on February 28, 2012: member

    First, this will only work if you used the encrypt wallet function of 0.6.0rc1. Second, make a backup.

    • Run: db4.8_dump -p wallet.dat >wallet.txt (to create a human readable wallet dump)
    • Open wallet.txt using your favorite text editor.
    • Search for lines starting with "\03key". There should only be a few of them.
    • Delete those \03key lines, as well as the 1 line that follows each.
    • Now search for lines starting with "\04pool". There should be +- 100.
    • Delete those \04pool lines, as well as the 1 line that follows each.
    • Import the purged dump again: db4.8_load -f wallet.txt wallet.dat.new
    • Replace wallet.dat with wallet.dat.new, and start bitcoin.
  6. sipa closed this on Feb 28, 2012

  7. sipa reopened this on Feb 28, 2012

  8. krishKM commented at 4:05 PM on February 28, 2012: none

    Hi sipa,

    I'm windows user and im at work right now, hence this delayed response ; ) just installed Ubuntu and db4.8 utils.. got the human readable wallet.dat

    im just confused now as I have only one \03key!\03,, and its [junk tail] been found in three different places. One its own \03key!\03 line second in a paragraph with lots of other JUNKS, and third as you said in a \04ckey\04 line,

    Ihave deleted the \03key\03 line and the \04ckey\04 line.. the paragraph between those lines I have left it..

    from my Ubuntu I could not use db4.8_import command, so I used db4.8_load -f command.

    when I restored the wallet.dat and started the bitcoin. it crashed.. "c++ runtime failure.. " any idea?

    here is my wallet.txt junk..

    \03key!\03\b7\06\f7'\c5\c5\98\c3\8c\11\06z\1e\0e\c3\9d\b0\e4TO\be\ee

    [secret]

    \04ckeyA\04\b7\06\f7'\c5\c5\98\c3\8c\11\06z\1e\0e\c3\9d\b0\e4TO\be\eeb4M\9b"\dcBE\87\f3K\b7v.nW\84r%\b3\f9^N\a4\e2f\e6G\af\1f\b4\11\1f 0:6\d9\d5<\c7\f1\c9\8d<\d7\ea)\da\fd\de}\f2.K9c\10\0d\b1@Fl\db\b9\80a\e2\f3\cc+\09VT\e0\1b\1e\e98\fa\94\

  9. krishKM closed this on Feb 28, 2012

  10. krishKM reopened this on Feb 28, 2012

  11. sipa commented at 4:25 PM on February 28, 2012: member

    I edited the instructions above a bit, as I realized it wasn't entirely safe. Could you try again?

    PS: I've edited out a part of your paste above, as it contained a secret key.

  12. krishKM commented at 9:03 PM on February 28, 2012: none

    :((( ive tried all of those you mentioned... somehow it doesn't want to load the wallet

    i have deleted the 03key.. but ont the secret key junk, than deleted 04keypool it was arnd 100 lines.. i deleted those aswell.

    still when i load the bitcoin it gives c++ distribution failed message..

    this seems suspicious for me.. \04mkey\01\00\00\00 0\93n\16\da\03\b8:\e6Q\8c\fd\de\be\a8\d1\ecVxZ\17\9f\a8|\f4[\c9\9b\13\b5\11~\e1\84\ecC\9a;\e1>\ab\94\c0\15;\b1&\a4l\08\17\0d\a1\bd\1fFA\a4\00\00\0 \04name"16BPGYorn55FgRxKFqXT5qWoL XGwqd7LfD9QKZKTS0v7c4C78LpwIU83nDdoWVsYnz4o7K+Jysym60+UFpvDXbPTiqrmKczZp5MmNI/koxn3UfWUc= \04name"1AEpcgigxGn3z7HBAPaJkZQ9W \07krishan \04pool\01\00\00\00\00\00\00\00 `\ea\00\00x2@O\00\00\00\00!\02\d4b\04\a12Q\db\aaW\ec\13p\83\8eV\f5!j\eb?#\1c7\d4\c7d\eee[C\8d\f7 \04pool\02\00\00\00\00\00\00\00

    PS: when I give you the wallet.dat.. would you be able to recover it??

  13. krishKM commented at 9:05 PM on February 28, 2012: none

    PS: i had two accounts/address on that wallet.. somehow I also had signed one of the address. can't remember how I did it. but the tool gave me an option to sign the address with my name.. so I did sign it with my name. than encrypted. than it has crashed..

  14. sipa commented at 9:06 PM on February 28, 2012: member

    I can try; pieter.wuille@gmail.com

  15. krishKM commented at 10:04 PM on February 28, 2012: none

    sent it..

  16. krishKM commented at 10:41 PM on February 28, 2012: none

    thank you very much SIPA. your method working now ;) I forgot to use the correct version of bitcoin-tool ;) thank you so much...

  17. krishKM closed this on Feb 28, 2012

  18. ptschip referenced this in commit b3c021c607 on Jan 5, 2018
  19. mustafadane commented at 4:36 AM on September 3, 2018: none

    Hello! I hope this topic is still active after 6 years :)

    I tried db4.8_dump but getting this error:

    db4.8_dump: Program version 4.8 doesn't match environment version 5.3 db4.8_dump: DB_ENV->open: DB_VERSION_MISMATCH: Database environment version mismatch

    I tried to look it up on google but no chance. Do you know what should I do?

    Some background info: I am trying to recover a corrupt wallet.dat file. This is an xsn(stakenet) wallet. This is very similar to bitcoin core wallets. I tried pywallet.py but no luck.

    Thanks a bunch!

  20. achow101 commented at 5:14 AM on September 3, 2018: member

    @mustafadane First of all, this issue is very much dead, it hasn't been active for years. Secondly, the problem is stated right in your error: Program version 4.8 doesn't match environment version 5.3. You are using a tool for BDB 4.8 while the database format uses BDB 5.3. These are incompatible formats (even though they have the same name). You will have to use a tool for BDB 5.3.

    This is not a general support forum, especially not for altcoins. Issues with altcoins and general support questions (such as yours as it is not a bug in Bitcoin Core) should be asked on https://bitcoin.stackexchange.com or https://bitcointalk.org.

  21. mustafadane commented at 5:28 AM on September 3, 2018: none

    @achow101 thanks for your reply! I will try to find a tool for BDB 5.3. Also another question: does this dumping work with encrypted wallets?

  22. dexX7 referenced this in commit 05fe289268 on Feb 13, 2019
  23. MarcoFalke referenced this in commit 98958c81f5 on Jun 17, 2019
  24. ryanofsky commented at 10:00 PM on December 3, 2019: member

    Dump format is documented https://docs.oracle.com/cd/E17275_01/html/programmer_reference/dumpload_format.html. It's basically a hex encoded list of rows in key/value format.

    The wallet format isn't really documented, but the code that loads wallets can be found https://github.com/bitcoin/bitcoin/blob/master/src/wallet/walletdb.cpp. If you are trying to recover private keys, "key" rows are unencrypted ones "ckey" row are encrypted ones.

    Should probably direct future questions to the bitcoin stackexchange, since this isn't really a bitcoin core bug or feature request.

  25. Losangelosgenetics referenced this in commit 5ee2653d58 on Mar 12, 2020
  26. lateminer referenced this in commit f16125b83d on May 6, 2020
  27. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me