Ok. So I have a bitcoin core wallet from around August, 2012. I don't think I backed it up "properly" in that I just copied the wallet.dat file, zipped it and stuck it in cloud storage.

I have some change in 2 of the addresses, which I've later learned split into BTC Cash as well.

I've loaded Bitcoin Core 22.0.0 and have completely synced the blockchain. No wallets loaded or new wallets created at this point. Then I tried to restore the old-wallet.dat and after about 20+ minutes, I get this popup error:

Open wallet failed: DB error adding transaction to wallet, write failed

And the db.log in the AppData\Roaming\..\old-wallet\ shows

file wallet.dat has LSN 1/76511, past end of log at 1/476
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
[..... these 4 lines repeat 48 times]

the debug.log

2024-03-02T17:22:43Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2024-03-02T17:22:43Z Using wallet C:\Users\...\AppData\Roaming\Bitcoin\wallets\Old-Wallet\wallet.dat
2024-03-02T17:22:43Z BerkeleyEnvironment::Open: LogDir=C:\Users\...\AppData\Roaming\Bitcoin\wallets\Old-Wallet\database ErrorFile=C:\Users\...\AppData\Roaming\Bitcoin\wallets\Old-Wallet\db.log
2024-03-02T17:22:43Z init message: Loading wallet…
2024-03-02T17:22:43Z [Old-Wallet] Wallet file version = 10500, last client version = 260000
2024-03-02T17:22:43Z [Old-Wallet] Legacy Wallet Keys: 0 plaintext, 206 encrypted, 0 w/ metadata, 206 total.
2024-03-02T17:22:43Z [Old-Wallet] Descriptors: 0, Descriptor Keys: 0 plaintext, 0 encrypted, 0 total.
2024-03-02T17:22:43Z [Old-Wallet] Wallet completed loading in              56ms
2024-03-02T17:22:43Z init message: Rescanning…
2024-03-02T17:22:43Z [Old-Wallet] Rescanning last 493953 blocks (from block 338894)...
2024-03-02T17:22:43Z [Old-Wallet] Rescan started from block 00000000000000000ff6f346bea61d1c87e455e2dd4e1da154e830dcfddba1f9... (slow variant inspecting all blocks)
2024-03-02T17:23:43Z [Old-Wallet] Still rescanning. At block 350638. Progress=0.066077
2024-03-02T17:23:43Z [Old-Wallet] Saving scan progress 350638.
2024-03-02T17:24:43Z [Old-Wallet] Still rescanning. At block 361394. Progress=0.074327
2024-03-02T17:24:43Z [Old-Wallet] Saving scan progress 361394.
2024-03-02T17:25:43Z [Old-Wallet] Still rescanning. At block 368839. Progress=0.081201
2024-03-02T17:25:43Z [Old-Wallet] Saving scan progress 368839.
2024-03-02T17:26:43Z [Old-Wallet] Still rescanning. At block 377874. Progress=0.089103
2024-03-02T17:26:43Z [Old-Wallet] Saving scan progress 377874.
2024-03-02T17:27:43Z [Old-Wallet] Still rescanning. At block 385876. Progress=0.097212
2024-03-02T17:27:43Z [Old-Wallet] Saving scan progress 385876.
2024-03-02T17:28:43Z [Old-Wallet] Still rescanning. At block 392935. Progress=0.105676
2024-03-02T17:28:43Z [Old-Wallet] Saving scan progress 392935.
2024-03-02T17:29:43Z [Old-Wallet] Still rescanning. At block 398759. Progress=0.113347
2024-03-02T17:29:43Z [Old-Wallet] Saving scan progress 398759.
2024-03-02T17:30:43Z [Old-Wallet] Still rescanning. At block 404095. Progress=0.121186
2024-03-02T17:30:43Z [Old-Wallet] Saving scan progress 404095.
2024-03-02T17:31:43Z [Old-Wallet] Still rescanning. At block 410007. Progress=0.129667
2024-03-02T17:31:43Z [Old-Wallet] Saving scan progress 410007.
2024-03-02T17:32:43Z [Old-Wallet] Still rescanning. At block 415252. Progress=0.137660
2024-03-02T17:32:43Z [Old-Wallet] Saving scan progress 415252.
2024-03-02T17:33:43Z [Old-Wallet] Still rescanning. At block 420359. Progress=0.145469
2024-03-02T17:33:43Z [Old-Wallet] Saving scan progress 420359.
2024-03-02T17:34:43Z [Old-Wallet] Still rescanning. At block 424845. Progress=0.152556
2024-03-02T17:34:43Z [Old-Wallet] Saving scan progress 424845.
2024-03-02T17:35:43Z [Old-Wallet] Still rescanning. At block 429990. Progress=0.160343
2024-03-02T17:35:43Z [Old-Wallet] Saving scan progress 429990.
2024-03-02T17:36:43Z [Old-Wallet] Still rescanning. At block 435183. Progress=0.168730
2024-03-02T17:36:44Z [Old-Wallet] Saving scan progress 435183.
2024-03-02T17:37:44Z [Old-Wallet] Still rescanning. At block 439881. Progress=0.176782
2024-03-02T17:37:44Z [Old-Wallet] Saving scan progress 439881.
2024-03-02T17:38:44Z [Old-Wallet] Still rescanning. At block 444238. Progress=0.185090
2024-03-02T17:38:44Z [Old-Wallet] Saving scan progress 444238.
2024-03-02T17:39:44Z [Old-Wallet] Still rescanning. At block 448552. Progress=0.193078
2024-03-02T17:39:44Z [Old-Wallet] Saving scan progress 448552.
2024-03-02T17:40:44Z [Old-Wallet] Still rescanning. At block 453098. Progress=0.201544
2024-03-02T17:40:44Z [Old-Wallet] Saving scan progress 453098.
2024-03-02T17:41:44Z [Old-Wallet] Still rescanning. At block 457196. Progress=0.209873
2024-03-02T17:41:44Z [Old-Wallet] Saving scan progress 457196.
2024-03-02T17:42:44Z [Old-Wallet] Still rescanning. At block 461365. Progress=0.217692
2024-03-02T17:42:44Z [Old-Wallet] Saving scan progress 461365.
2024-03-02T17:43:44Z [Old-Wallet] Still rescanning. At block 465338. Progress=0.225723
2024-03-02T17:43:44Z [Old-Wallet] Saving scan progress 465338.
2024-03-02T17:44:44Z [Old-Wallet] Still rescanning. At block 469048. Progress=0.233615
2024-03-02T17:44:44Z [Old-Wallet] Saving scan progress 469048.
2024-03-02T17:45:44Z [Old-Wallet] Still rescanning. At block 473171. Progress=0.241268
2024-03-02T17:45:44Z [Old-Wallet] Saving scan progress 473171.
2024-03-02T17:46:07Z [Old-Wallet] AddToWallet 4306eb4278cd03af36b9b4bb2bbfceaa2297acad4293c724255c792d8c02d9ac  new Confirmed (block=000000000000000000dc975c23fd082c77d57feef2f98ec23a27f907616101ba, height=475104, index=548)
2024-03-02T17:46:07Z Flushed fee estimates to fee_estimates.dat.
2024-03-02T17:49:13Z New block-relay-only v1 peer connected: version: 70016, blocks=832847, peer=33
  • So I noticed that Bitcoin QT never prompted me for the encryption password when importing this wallet.dat...or at least I never remembered seeing the prompt. Not sure if that means anything.

  • I was able to use this wallet key tool to view the old-wallet.dat file. (I was prompted for the encryption key each time I wanted to decrypt it). So IMO, the database can't be that corrupt if a reader is able to open it.

    It appeared to be a list of strings. One column had addresses, another column had private keys associated with each address, and another column had what appeared to be address labels that I remember giving to some of the addresses. The date created column doesn't appear accurate.

wallet key tool screenshot

But there were more addresses than I created (I had either 6 or 8 addresses, but there were more than 200 rows of addresses/key combinations).

So here are my questions:

-> Is it possible using Bitcoin Core to get this old-wallet.dat file to import properly and addresses show up in the GUI.

-> Is there a way to rebuild the wallet.dat file? It seems to crash as newer transactions may have additional columns that the older database doesn't have.

-> is there another way to force import the addresses/keys? (in Bitcoin core or like using a different wallet) to where I can sweep/access the bitcoins?

-> why was 3rd party tool able to read .dat file (after decrypting) but Bitcoin Core cannot? Or why isn't there a simply way to do this?

2 Answers 2


I doubt there is a canned solution sitting on a shelf somewhere. However there is almost always a way to solve problems like this, if you are willing to invest time and effort.

Since your log says

 Legacy Wallet Keys: 0 plaintext, 206 encrypted, 0 w/ metadata, 206 total.

We know that the wallet db file contains 206 encrypted keys.

I imagine you can use one of the BDB tools such as db_dump to extract those 206 data values.

If you know the password for the wallet, it is possible, in principle, to decrypt each of those data values. Maybe using openssl or other tools. Maybe by writing a short script/program in Python or your preferred language. I believe the keys are encrypted individually so that the password is only needed when spending money, not when merely checking balance or receiving money (creating a new receiving address).

You might then be able to import those unencrypted keys into a legacy wallet or create descriptors for importing into a descriptor-wallet.

I think it would be prudent to sweep the Bitcoin into a new wallet after recovery but that would obviously incur costs.

  • the wallet key tool already generated a list of address/key/description. I don't see any tutorials from the link you provided on how to obtain and use db_dump tool. And no one is telling us how to [re]create a legacy wallet to where we can import our private keys. I could try the create descriptors method; can you please point me to a tutorial or template that has the steps for this? Or update your answer with steps.
    – Jon Grah
    Commented Mar 3 at 14:09
  • See links appended to answer Commented Mar 3 at 19:32

Try running an older version of bitcoin core, like v12.1 or v0.11, these were still in use around 2016/2017 before segwit fork. You might have better luck.

Otherwise if you have the private keys for the addresses, simply import them into the running node. If you import them at the start of syncing (assuming syncing from scratch), it won't have to rescan each time you do an importprivkey.

Good luck, hope there is lots of change for you!!

  • i actually didn't attempt this (older version). But I ended up using blockchain.com which relaxed my mind after I saw how easily they imported the private key. I was typing an answer to the question and then I got distracted.
    – Jon Grah
    Commented Mar 14 at 10:55
  • can you provide step-by-step to the "simply import them into the running node"?
    – Jon Grah
    Commented Mar 14 at 10:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.