<p>This is kind of obvious, but have you tried going back through your backups, newest first, and using the first one which works?</p>

<p>You'll need to GPG decrypt the backup of course, but I hope that's not a problem.</p>

<p>Edit: I know you said you tried with just wallet.dat in ~/.bitcoin/ but could it be that you left the ~/.bitcoin/database/ directory with logfiles in it?  If so, old logfiles could be causing the problem.</p>

CC BY-SA 3.0
2012-05-01T04:15:02.543Z
That's sound advice, thank you. Actually, I ended up trying a bunch of older versions of the bitcoin client, and version 0.3.24-beta reads the wallet just fine! What the heck!?! Gotta be a bug in bitcoin. Now I just need to figure out a way to safely "upgrade" my wallet so it works with 0.6, I guess.
Adam Monsen
CC BY-SA 3.0
2012-05-01T08:03:48.977Z
Perhaps you would like to create a new wallet using 0.6 and transfer the contents of the old one to the new one using 0.3.24, then make the old one available for test purposes.  I don't know if this is a known bug, but I've not heard of it before.  You'll lose your transaction history and get a new set of addresses this way, so you'll need to update the people who send you coins.
Chris Moore
CC BY-SA 3.0
2012-05-01T15:04:05.403Z
aye, I think that (or waiting for 0.7.0) might be the only straightforward way out of this mess.
Adam Monsen
CC BY-SA 3.0
2012-05-01T15:11:54.363Z
say I am able to successfully move my bitcoins to another wallet. What happens if someone tries to send money to one of my old addresses?
Adam Monsen
CC BY-SA 3.0
2012-05-01T15:49:07.373Z
It'll go to the old wallet.  That's what I was getting at with "you'll need to update the people who send you coins" - tell them your new address(es).
Chris Moore
CC BY-SA 3.0
2012-05-02T17:42:55.200Z
I was able to transfer my balance to a new wallet. Would you like the old (empty) wallet? Or do you know someone who might? Email me at haircut (gmail) if so.
Adam Monsen
CC BY-SA 3.0
2012-05-02T21:46:35.650Z
It seems, according to Pieter's answer, that this is a known problem, so I guess it's not necessary.
Chris Moore
CC BY-SA 3.0
2012-04-30T22:58:53.917Z
2012-04-30T22:58:53.917Z
Chris Moore
<p>I had the same problem but it has only been a few days since I fired up bitcoin and there had been no changes to my computer. </p>

<p>I have found that you can copy out your wallet.dat,  delete everything in the bitcoin directory/folder, and bitcoin will run with no error. </p>

<p>Then immediately close bitcoin, copy your wallet back to the folder and restart - wallet.dat reads fine and all my coins are there. </p>

<p>The downside is having to spend a ton of time to download the entire block chain again :(</p>

<p>But it works.</p>

<p>Louis</p>

<p>I use Linux Mint (Like Ubuntu) - Winblows users may not have the same results.</p>

CC BY-SA 3.0
2012-06-19T17:52:36.893Z
2012-06-19T17:52:36.893Z
Louis
<p>Version 0.6.0 introduced more strict validity checks on the keys when loading a wallet, to prevent silent further corruption. It seems like you have a wallet where one or more keys are corrupted (the private and public one don't match, for example). You can try moving the funds away using an older version, but there is a chance that will fail.</p>

<p>I intend to add a sort of "recovery mode" in 0.7.0 for situations like this.</p>

CC BY-SA 3.0
2012-05-01T19:36:46.827Z
Would "recovery mode" possibly make my old wallet work again with versions of bitcoin later than 0.4.1?
Adam Monsen
CC BY-SA 3.0
2012-05-01T21:53:21.523Z
That's not because of the wallet format, but because of BDB. Their database files are not backward-compatible, and some versions ago we upgraded from bdbd 4.7 to 4.8. You can dump/load them to create an identical wallet file that is compatible with older versions though.
Pieter Wuille
CC BY-SA 3.0
2012-05-01T23:49:24.720Z
I mean, I want to make my old wallet work with **newer** versions of bitcoin... I don't care about older versions. :)
Adam Monsen
CC BY-SA 3.0
2012-05-02T23:07:56.977Z
In normal cases, an old wallet (even down to the earliest releases) will keep working in new clients, there is no problem with compatibility. If your wallet is corrupted, you'll get into problems anyway with it.
Pieter Wuille
CC BY-SA 3.0
2012-05-01T11:34:02.340Z
2012-05-01T11:34:02.340Z
Pieter Wuille
<p>I've been using bitcoin for over a year now without issues. It's been a while since I fired up a bitcoin client though, at least a couple months.</p>

<p>When I try running a bitcoin client (bitcoin-qt version 0.6.0-oneiric0) today, I get the error message</p>

<pre><code>Error loading wallet.dat: Wallet corrupted
</code></pre>

<p>I generally use GPG to encrypt and decrypt wallet.dat, and I only have backups of the encrypted wallet.dat.gpg file. I encrypt and decrypt the file only while bitcoin is not running.</p>

<p>I tried following <a href="https://bitcointalk.org/index.php?topic=11331.0">https://bitcointalk.org/index.php?topic=11331.0</a> . The tools appeared to work (<code>dbdump.py --wallet</code> doesn't throw any errors and spits out what looks like proper wallet contents), but after fixing my wallet with <code>fixwallet.py</code> I get the same "Wallet corrupted" error from the bitcoin client.</p>

<p>The bitcoin client works fine if I blow away my <code>~/.bitcoin</code> directory.</p>

<p>I'm using 32-bit Ubuntu 11.10 desktop.</p>

<p>I also tried installing the latest bitcoin Qt client on Windows, but that also reports wallet.dat is corrupted.</p>

<p>I tried using a Linux binary from bitcoin.org, and I get this error message:</p>

<pre><code>************************
EXCEPTION: 22DbRunRecoveryException       
DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery       
bitcoin in Runaway exception       

terminate called after throwing an instance of 'DbRunRecoveryException'
  what():  DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery
Aborted
</code></pre>

<p>This may be related: <a href="https://github.com/bitcoin/bitcoin/issues/809">https://github.com/bitcoin/bitcoin/issues/809</a></p>

<h1>Update Mon, 30 Apr 2012 21:45:00 -0700</h1>

<p>I ended up trying a bunch of older versions of the bitcoin client, and version 0.3.24-beta reads the wallet just fine! What the heck!?! Gotta be a bug in bitcoin. Now I just need to figure out a way to safely "upgrade" my wallet so it works with 0.6, I guess.</p>

<h1>Update Mon, 30 Apr 2012 22:00:00 -0700</h1>

<p>Bitcoin 0.4.1 is able to work with everything in my <code>~/.bitcoin</code> dir. 0.5.4rc3 and 0.6.0 do <em>not</em> work.</p>

<p>Is there some way to serialize the wallet data as plain text? Man, <a href="http://identi.ca/notice/93238240">I hate BerkeleyDB</a>.</p>

<h1>Update Wed, 02 May 2012 10:43:19 -0700</h1>

<p>Using Bitcoin 0.4.1 with my old wallet (which apparently contains something corrupt), I was able to transfer my balance to a new wallet created from scratch with Bitcoin 0.6.0.</p>

CC BY-SA 3.0
2012-04-30T18:46:15.060Z
Why do you say it is the wallet itself that is giving the error?

Try using just wallet.dat and, for troubleshooting, a copy of the blockchain.  http://eu1.bitcoincharts.com/blockchain
Stephen Gornick
CC BY-SA 3.0
2012-04-30T18:54:44.063Z
@StephenGornick: I've tried starting bitcoin with only wallet.dat in `~/.bitcoin/` and I still get `Error loading wallet.dat: Wallet corrupted`. Would it help to try the same thing but with a blockchain downloaded from the link you specified?
Adam Monsen
CC BY-SA 3.0
2012-04-30T23:01:41.167Z
Having a copy of the blockchain won't help, no.  If you get an error message with no blockchain, you'll get the same error after downloading the blockchain.
Chris Moore
CC BY-SA 3.0
2012-05-02T22:23:43.670Z
Thanks for going to the effort of documenting what you did to fix the problem
Highly Irregular
CC BY-SA 3.0
2012-08-07T09:00:46.850Z
I had the same issue but didn't want to go through the trouble of downgrading, create new wallet, upgrade.. So instead I tried to delete *everything* except for the 'wallet.dat' file. This worked. Although now it has to reprocess all transactions from start
mikabytes
<wallet><ubuntu>
Error loading wallet.dat: Wallet corrupted
Adam Monsen
# Error loading wallet.dat: Wallet corrupted

(Asked by: username_0 on 2012-04-30)

I've been using bitcoin for over a year now without issues. It's been a while since I fired up a bitcoin client though, at least a couple months.

When I try running a bitcoin client (bitcoin-qt version 0.6.0-oneiric0) today, I get the error message

```
Error loading wallet.dat: Wallet corrupted

```

I generally use GPG to encrypt and decrypt wallet.dat, and I only have backups of the encrypted wallet.dat.gpg file. I encrypt and decrypt the file only while bitcoin is not running.

I tried following <https://bitcointalk.org/index.php?topic=11331.0> . The tools appeared to work (`dbdump.py --wallet` doesn't throw any errors and spits out what looks like proper wallet contents), but after fixing my wallet with `fixwallet.py` I get the same "Wallet corrupted" error from the bitcoin client.

The bitcoin client works fine if I blow away my `~/.bitcoin` directory.

I'm using 32-bit Ubuntu 11.10 desktop.

I also tried installing the latest bitcoin Qt client on Windows, but that also reports wallet.dat is corrupted.

I tried using a Linux binary from bitcoin.org, and I get this error message:

```
************************
EXCEPTION: 22DbRunRecoveryException       
DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery       
bitcoin in Runaway exception       

terminate called after throwing an instance of 'DbRunRecoveryException'
  what():  DbEnv::open: DB_RUNRECOVERY: Fatal error, run database recovery
Aborted

```

This may be related: <https://github.com/bitcoin/bitcoin/issues/809>

# Update Mon, 30 Apr 2012 21:45:00 -0700

I ended up trying a bunch of older versions of the bitcoin client, and version 0.3.24-beta reads the wallet just fine! What the heck!?! Gotta be a bug in bitcoin. Now I just need to figure out a way to safely "upgrade" my wallet so it works with 0.6, I guess.

# Update Mon, 30 Apr 2012 22:00:00 -0700

Bitcoin 0.4.1 is able to work with everything in my `~/.bitcoin` dir. 0.5.4rc3 and 0.6.0 do *not* work.

Is there some way to serialize the wallet data as plain text? Man, [I hate BerkeleyDB](http://identi.ca/notice/93238240).

# Update Wed, 02 May 2012 10:43:19 -0700

Using Bitcoin 0.4.1 with my old wallet (which apparently contains something corrupt), I was able to transfer my balance to a new wallet created from scratch with Bitcoin 0.6.0.

**Tags:** wallet, ubuntu

> **Comments:**
> **username_1**: Why do you say it is the wallet itself that is giving the error?  Try using just wallet.dat and, for troubleshooting, a copy of the blockchain.  http://eu1.bitcoincharts.com/blockchain  
> **username_0**: @username_1: I've tried starting bitcoin with only wallet.dat in `~/.bitcoin/` and I still get `Error loading wallet.dat: Wallet corrupted`. Would it help to try the same thing but with a blockchain downloaded from the link you specified?  
> **username_2**: Having a copy of the blockchain won't help, no.  If you get an error message with no blockchain, you'll get the same error after downloading the blockchain.  
> **username_3**: Thanks for going to the effort of documenting what you did to fix the problem  
> **username_4**: I had the same issue but didn't want to go through the trouble of downgrading, create new wallet, upgrade.. So instead I tried to delete *everything* except for the 'wallet.dat' file. This worked. Although now it has to reprocess all transactions from start  

---

## 3 answers

### Answer by username_6 on 2012-05-01. Score: 6 | Accepted answer

Version 0.6.0 introduced more strict validity checks on the keys when loading a wallet, to prevent silent further corruption. It seems like you have a wallet where one or more keys are corrupted (the private and public one don't match, for example). You can try moving the funds away using an older version, but there is a chance that will fail.

I intend to add a sort of "recovery mode" in 0.7.0 for situations like this.

> **Comments:**
> **username_0**: Would "recovery mode" possibly make my old wallet work again with versions of bitcoin later than 0.4.1?  
> **username_6**: That's not because of the wallet format, but because of BDB. Their database files are not backward-compatible, and some versions ago we upgraded from bdbd 4.7 to 4.8. You can dump/load them to create an identical wallet file that is compatible with older versions though.  
> **username_0**: I mean, I want to make my old wallet work with **newer** versions of bitcoin... I don't care about older versions. :)  
> **username_6**: In normal cases, an old wallet (even down to the earliest releases) will keep working in new clients, there is no problem with compatibility. If your wallet is corrupted, you'll get into problems anyway with it.  

---

### Answer by username_2 on 2012-04-30. Score: 3

This is kind of obvious, but have you tried going back through your backups, newest first, and using the first one which works?

You'll need to GPG decrypt the backup of course, but I hope that's not a problem.

Edit: I know you said you tried with just wallet.dat in ~/.bitcoin/ but could it be that you left the ~/.bitcoin/database/ directory with logfiles in it? If so, old logfiles could be causing the problem.

> **Comments:**
> **username_0**: That's sound advice, thank you. Actually, I ended up trying a bunch of older versions of the bitcoin client, and version 0.3.24-beta reads the wallet just fine! What the heck!?! Gotta be a bug in bitcoin. Now I just need to figure out a way to safely "upgrade" my wallet so it works with 0.6, I guess.  
> **username_2**: Perhaps you would like to create a new wallet using 0.6 and transfer the contents of the old one to the new one using 0.3.24, then make the old one available for test purposes.  I don't know if this is a known bug, but I've not heard of it before.  You'll lose your transaction history and get a new set of addresses this way, so you'll need to update the people who send you coins.  
> **username_0**: aye, I think that (or waiting for 0.7.0) might be the only straightforward way out of this mess.  
> **username_0**: say I am able to successfully move my bitcoins to another wallet. What happens if someone tries to send money to one of my old addresses?  
> **username_2**: It'll go to the old wallet.  That's what I was getting at with "you'll need to update the people who send you coins" - tell them your new address(es).  
> **username_0**: I was able to transfer my balance to a new wallet. Would you like the old (empty) wallet? Or do you know someone who might? Email me at haircut (gmail) if so.  
> **username_2**: It seems, according to username_6's answer, that this is a known problem, so I guess it's not necessary.  

---

### Answer by username_5 on 2012-06-19. Score: 1

I had the same problem but it has only been a few days since I fired up bitcoin and there had been no changes to my computer.

I have found that you can copy out your wallet.dat, delete everything in the bitcoin directory/folder, and bitcoin will run with no error.

Then immediately close bitcoin, copy your wallet back to the folder and restart - wallet.dat reads fine and all my coins are there.

The downside is having to spend a ton of time to download the entire block chain again :(

But it works.

username_5

I use Linux Mint (Like Ubuntu) - Winblows users may not have the same results.


---

