4

Whilst moving houses I came across some old HDDs which I've just found contains a wallet.dat from August 2011. The version of Bitcoin-qt must be 0.4.0 as I know the wallet.dat is password encrypted, which was introduced for version 0.4.0. It is 100% *not* >0.4.0, so the vulnerability patched by 0.4.1 is not in place.

What is the best way to go about restoring the encrypted addresses? If I were to install the 0.4.1 Bitcoin-qt update, would there be any problems with current OS dependencies? Should I use Windows, Linux? Any input greatly appreciated. (I will certainly keep a backup)

Wizard Of Ozzie
  • 5,298
  • 4
  • 31
  • 63

1 Answers1

5

Using wallet /import

If you load the wallet file in a modern Bitcoin Core version, you can use the dumpwallet command (to create an unencrypted dump of the keys), and the importwallet command in a fresh instance with a new empty wallet.dat of the dump. You will need to rescan afterwards, though, which may take a while.

Make sure to wipe the dump file afterwards.

Using db dump/load

One way is to use the following command on a Linux install with db4.8-util installed: db4.8_dump wallet.dat | db4.8_load wallet.dat.new

This will create a new wallet.dat.new file, with the same records as the wallet.dat file, but without any old potentially never-overwritten data.

db4.8-util may be hard to install these days, as most distros stopped distributing db4.8, in favor of 5.1 and later. Bitcoin Core however still uses 4.8 for compatibility reasons. You can use db5.1-util as well, but that means that you'll need a Bitcoin Core version compiled with db5.1 support afterwards to use the newly constructed wallet file.

Pieter Wuille
  • 105,497
  • 9
  • 194
  • 308
  • Just for clarity, the rescan which happens after an importwallet doesn't have to be manually initiated, is that correct? – Christopher Gurnee May 05 '15 at 18:34
  • If you are importing multiple keys it's best to add false to the end of the command to prevent the rescan, and then run it manually after you've imported all your keys. Or just import them to a web or SPV wallet and send all the funds to a fresh address which you can import into a newer bitcoin core. – George May 05 '15 at 19:12
  • @ChristopherGurnee yes, it will happen automatically. – Pieter Wuille May 05 '15 at 19:13
  • @George importwallet imports all keys at once already, and only rescans the necessary part intelligently. – Pieter Wuille May 05 '15 at 19:14
  • @PieterWuille Thanks mate. You're right, the db4.8 is the hard part for a relative Ubuntu newb. I run the node with txindex=1 so no dramas on that front, though I will be sure to use the false flag – Wizard Of Ozzie May 06 '15 at 03:05
  • No need to use the false flag, as explained above. And having txindex=1 doesn't help one bit. – Pieter Wuille May 06 '15 at 09:37
  • @PieterWuille sorry yes, I read it as importprivkey for some reason! – George May 06 '15 at 20:13
  • @PieterWuille George yep I read it that way too initially. Hence txindex and false flag comment. UPDATE: did it! What a great surprise to have. Balances out the 16 btc mtgox redeem code I was saving! – Wizard Of Ozzie May 07 '15 at 15:46
  • txindex does not make sense still. It only helps by-txid lookups of historic transactions. It is not used for import or rescan. – Pieter Wuille May 07 '15 at 16:03