Post
Topic
Board Bitcoin Technical Support
Re: Diving into an old BTC wallet from ~2014 and found a nice surprise - what next?
by
NotATether
on 16/02/2021, 15:06:35 UTC
Yeah. I started looking into how to use PyWallet, but as a total Python noob who hasn't coded in any language in quite a few years, I soon became overwhelmed and discouraged.

Is there a straightforward guide to using PyWallet? All the stuff I unearthed online is aimed at a much more Python-savvy audience than someone like me... I would like to invest the time in understanding it, but the nature of my life at present is that I only have an hour here and there, and very few chances to sit at the PC for an extended period and really put my mind to learning something new. Sad, maybe, but that's my reality for now.

You probably already know how to install Python 2 (this is important as Python 3 support is experimental) and clone pywallet from Github, so assuming you already done that, it doesn't need any programming knowledge to run.

Enter the pywallet folder first within a terminal, and then run python pywallet.py  --recover --recov_device=PATH/TO/wallet.dat --recov_size=100kB --recov_outputdir=/folder/to/place/recovered/wallet.dat. What this does is that it reads the wallet file specified by --recov_device, tries to reconstruct the wallet from the first --recov_size bytes and places the recovered wallet file in the --recov_outputdir folder using the name recovered_wallet_CURRENTTIMESTAMP.dat (CURRENTTIMESTAMP is replaced by the the time right now represented as an integer).

It will prompt you to set a password for the newly recovered wallet.dat.

Generally, wallet.dat files are only a few dozen kilobytes large so using 100kB size ensures that you can recover wallets with large numbers of private keys inside.

This is another dumb question perhaps, but how do I actually use bitcoin-wallet? It doesn't appear as a command line option in Bitcoin Core itself. Is there a non-GUI way I should be accessing it? I understand it's an offline tool, which I take to mean it doesn't need to sync the blockchain, but I'm clueless as to where to type those commands to interact with it. Any help appreciated.

btcoin-wallet is also very easy to use, you just pass the name of one of your wallet files in your datadir using -wallet=WALLET_NAME, and then there's a few commands you can type after -wallet and the other options that are listed in its help text:

Quote
  create                         
       Create new wallet file                                                                         
  info   
       Get wallet info           
  salvage                         
       Attempt to recover private keys from a corrupt wallet. Warning: 'salvage' is experimental. .

So the full command to run is bitcoinwallet -wallet=WALLET_NAME salvage.