<p>A technique with which I've had success in the past:</p>
<blockquote>
<p>db5.3_dump corrupted_wallet.dat | db5.3_load fresh_wallet.dat</p>
</blockquote>
<p>(obviously replacing <code>corrupted_wallet.dat</code> with the actual filename, and making a backup first).</p>
<p>and then trying to load <code>fresh_wallet.dat</code> into a modern Bitcoin Core</p>
<p>These tools are in the Ubuntu package <code>db5.3-util</code>.</p>
<p>Note: you'll need a Bitcoin Core that is compiled against libdb5.3++-dev to open this file (as it'll be using BDB 5.3, while release builds use BDB 4.8). You can do the equivalent and just use BDB 4.8 tools everywhere, but they're harder to find.</p>

CC BY-SA 4.0
2021-01-21T23:14:00.727Z
2021-01-21T23:14:00.727Z
Pieter Wuille
<blockquote>
<p><strong>how i go more deeper in this to get those private keys and addresses?</strong></p>
</blockquote>
<p>Well the basic process I would start with would be</p>
<ul>
<li>Don't use the computer that contains the damaged file</li>
<li>Use a bootable USB to make a copy of the file onto external media</li>
<li>Lock the computer away until you have repaired the file or extracted keys on a new computer</li>
<li>make copies of the damaged file and work only on those copies.</li>
<li>keep some unaltered copies in some safe places.</li>
<li>make a hex dump of the wallet.dat file</li>
<li>study the defined file format used by Bitcoin core in 2013
<ul>
<li>perhaps by searching for documentation of the file format.</li>
<li>perhaps by studying the source of PyWallet.</li>
<li>perhaps by getting a 2013 set of Bitcoin-core's source code from GitHub.</li>
</ul>
</li>
<li>compare the defined file format with a hex dump of a working wallet.dat of 2013</li>
<li>make small changes to a working 2013 wallet.dat, make new hex dumps and study the differences.</li>
<li>compare the defined file format with a hex dump of your damaged wallet.dat</li>
<li>attempt repair</li>
<li>perform some forensic recovery process of all data in unallocated space on a bitwise copy of the original computer's hard disk(s) or equivalents. Repeat process on data to try to identify fragments of wallet.dat data.</li>
</ul>
<p>This would be slow difficult work. You will find differences that don't make sense and you may have to invent new content to insert and also decide what parts to delete. You may need to find tools, or create tools, that allow you to make the changes to a copy of the wallet.dat to repair it. Or you may be able to identify the private keys in the hex dump and just extract those.</p>
<p>If the wallet contains a small amount I wouldn't bother. If it contains an amount equivalent to a years wages say - then, in your shoes, I would probably spend some time on this.</p>
<hr />
<p>There's no safe way to have someone else work on this. It's easy for a stranger to say they found nothing and walk off with your wallet's money. It's easy for conmen to slowly gain your trust until you pay them various fees for working on this for you.</p>

CC BY-SA 4.0
2021-01-21T23:09:28.740Z
Wallet.dat file have always been BDB (LevelDB is only used for the block/chainstate database). Bitcoin Core 0.21.0 adds an experimental option for SQLite wallet files, but is still compatible with every BDB-based wallet.dat for as long as we know.
Pieter Wuille
CC BY-SA 4.0
2021-01-22T00:51:31.527Z
@Pieter, thanks, updated accordingly (removed mention of LevelDB)
RedGrittyBrick
CC BY-SA 4.0
2020-12-22T22:06:01.337Z
2021-01-22T00:50:00.530Z
2021-01-22T00:50:00.530Z
RedGrittyBrick
<p>If your wallet has't opened then download and install bitcoin core wallet 0.18.1
Open the bitcoin directory, copy and paste your corrupted wallet.dat in bitcoin directory.</p>
<p>Watch the video about how to dump it without passphrase - <a href="https://youtu.be/C_yNMPnnqS0?si=I6SWI87YStbQbgLp" rel="nofollow noreferrer">https://youtu.be/C_yNMPnnqS0?si=I6SWI87YStbQbgLp</a></p>
<p>Hope its helped you.</p>

CC BY-SA 4.0
2024-12-18T18:06:49.740Z
2024-12-18T18:06:49.740Z
John Peter
<p>I have a corrupted UN-ENCRYPTED bitcoin wallet from 2013.</p>
<p>what I have tried so far with both wallet:</p>
<p>1, with old and new version of bitcoin client the wallet just creating a .bak file and not showing any amount/transaction.</p>
<p>2, i also try bitcoin-qt.exe -salvagewallet - that is creating a bak + epoch time. and the db.log saying</p>
<p><em>file unknown has LSN 91/5547280, past end of log at 1/1042
Commonly caused by moving a database from one database environment
to another without clearing the database LSNs, or by removing all of
the log files from a database environment
wallet.dat.1608587747.bak: DB_VERIFY_BAD: Database verification failed</em></p>
<p>3, pywallet installed correctly and working fine under ubuntu for me with different wallets that not corrupted, (dumping all data just fine)
but when i trying to dump the corrupted once python2 pywallet.py --dumpwallet --datadir=./ im getting the &quot;ERROR:root:Couldn't open wallet.dat/main. Try quitting Bitcoin and running this again.&quot;</p>
<p>4, i have try the python2 dbdump.py --wallet --wallet-tx --datadir=./    (getting &quot;ERROR:root:Couldn't open wallet.dat/main. Try quitting Bitcoin and running this again.&quot;)</p>
<p>Kind of run out of stuff now, how i go more deeper in this to get those private keys and addresses?</p>
<p>If any of you can successfully help me, reward will be issued for sure.</p>

CC BY-SA 4.0
2020-12-22T00:23:29.983Z
Without seeing the wallet file, there really is no way to know what is wrong with it and how to salvage it. Frankly, any automatic salvaging solution is not going to be sufficient because there are so many possible things that could have gone wrong to corrupt the wallet file.
Ava Chow
CC BY-SA 4.0
2020-12-22T10:59:27.653Z
well this is the thing, I'm asking advice how to find out what's wrong with it. Any tools or technik's recommendation. I think you understand sending out unencrypted wallet not an option.
zeroip2
<wallet-recovery><wallet.dat>
Corrupted old bitcoin wallet. !!!file unknown has LSN!
zeroip2
# Corrupted old bitcoin wallet. !!!file unknown has LSN!

(Asked by: username_0 on 2020-12-21)

I have a corrupted UN-ENCRYPTED bitcoin wallet from 2013.

what I have tried so far with both wallet:

1, with old and new version of bitcoin client the wallet just creating a .bak file and not showing any amount/transaction.

2, i also try bitcoin-qt.exe -salvagewallet - that is creating a bak + epoch time. and the db.log saying

*file unknown has LSN 91/5547280, past end of log at 1/1042
Commonly caused by moving a database from one database environment
to another without clearing the database LSNs, or by removing all of
the log files from a database environment
wallet.dat.1608587747.bak: DB\_VERIFY\_BAD: Database verification failed*

3, pywallet installed correctly and working fine under ubuntu for me with different wallets that not corrupted, (dumping all data just fine)
but when i trying to dump the corrupted once python2 pywallet.py --dumpwallet --datadir=./ im getting the "ERROR:root:Couldn't open wallet.dat/main. Try quitting Bitcoin and running this again."

4, i have try the python2 dbdump.py --wallet --wallet-tx --datadir=./ (getting "ERROR:root:Couldn't open wallet.dat/main. Try quitting Bitcoin and running this again.")

Kind of run out of stuff now, how i go more deeper in this to get those private keys and addresses?

If any of you can successfully help me, reward will be issued for sure.

**Tags:** wallet-recovery, wallet.dat

> **Comments:**
> **username_1**: Without seeing the wallet file, there really is no way to know what is wrong with it and how to salvage it. Frankly, any automatic salvaging solution is not going to be sufficient because there are so many possible things that could have gone wrong to corrupt the wallet file.  
> **username_0**: well this is the thing, I'm asking advice how to find out what's wrong with it. Any tools or technik's recommendation. I think you understand sending out unencrypted wallet not an option.  

---

## 3 answers

### Answer by username_2 on 2021-01-21. Score: 2

A technique with which I've had success in the past:

> db5.3\_dump corrupted\_wallet.dat | db5.3\_load fresh\_wallet.dat

(obviously replacing `corrupted_wallet.dat` with the actual filename, and making a backup first).

and then trying to load `fresh_wallet.dat` into a modern Bitcoin Core

These tools are in the Ubuntu package `db5.3-util`.

Note: you'll need a Bitcoin Core that is compiled against libdb5.3++-dev to open this file (as it'll be using BDB 5.3, while release builds use BDB 4.8). You can do the equivalent and just use BDB 4.8 tools everywhere, but they're harder to find.


---

### Answer by username_3 on 2020-12-22. Score: 1

> **how i go more deeper in this to get those private keys and addresses?**

Well the basic process I would start with would be

* Don't use the computer that contains the damaged file
* Use a bootable USB to make a copy of the file onto external media
* Lock the computer away until you have repaired the file or extracted keys on a new computer
* make copies of the damaged file and work only on those copies.
* keep some unaltered copies in some safe places.
* make a hex dump of the wallet.dat file
* study the defined file format used by Bitcoin core in 2013
  + perhaps by searching for documentation of the file format.
  + perhaps by studying the source of PyWallet.
  + perhaps by getting a 2013 set of Bitcoin-core's source code from GitHub.
* compare the defined file format with a hex dump of a working wallet.dat of 2013
* make small changes to a working 2013 wallet.dat, make new hex dumps and study the differences.
* compare the defined file format with a hex dump of your damaged wallet.dat
* attempt repair
* perform some forensic recovery process of all data in unallocated space on a bitwise copy of the original computer's hard disk(s) or equivalents. Repeat process on data to try to identify fragments of wallet.dat data.

This would be slow difficult work. You will find differences that don't make sense and you may have to invent new content to insert and also decide what parts to delete. You may need to find tools, or create tools, that allow you to make the changes to a copy of the wallet.dat to repair it. Or you may be able to identify the private keys in the hex dump and just extract those.

If the wallet contains a small amount I wouldn't bother. If it contains an amount equivalent to a years wages say - then, in your shoes, I would probably spend some time on this.

---

There's no safe way to have someone else work on this. It's easy for a stranger to say they found nothing and walk off with your wallet's money. It's easy for conmen to slowly gain your trust until you pay them various fees for working on this for you.

> **Comments:**
> **username_2**: Wallet.dat file have always been BDB (LevelDB is only used for the block/chainstate database). Bitcoin Core 0.21.0 adds an experimental option for SQLite wallet files, but is still compatible with every BDB-based wallet.dat for as long as we know.  
> **username_3**: @username_2, thanks, updated accordingly (removed mention of LevelDB)  

---

### Answer by username_4 on 2024-12-18. Score: 0

If your wallet has't opened then download and install bitcoin core wallet 0.18.1
Open the bitcoin directory, copy and paste your corrupted wallet.dat in bitcoin directory.

Watch the video about how to dump it without passphrase - <https://youtu.be/C_yNMPnnqS0?si=I6SWI87YStbQbgLp>

Hope its helped you.


---

