Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: tspacepilot on April 06, 2015, 05:20:40 AM



Title: dump keys from protobuf format [solved]
Post by: tspacepilot on April 06, 2015, 05:20:40 AM
Hi folks,

I've got a backup from my Bitcoin Wallet for Android (Andreas S.) and I've decrypted it using openssl.  So, because of some changes to how Bitcoin Wallet works, I was surprised not to find a plain text file, but instead I have a protobuf file.  What I want to do is export the private keys.  I understand that if I dig around in bitcoinj I can apprantly "write a small app" do to do this (<http://bitcoin.stackexchange.com/questions/29586/how-do-i-extract-my-private-keys-from-a-protobuf-wallet>).  But, given that Java isn't my favorite language, I'll probably take way longer than I should to do this and given that someone must have already solved the problem, I figure it's worth asking here:

Does anyone have any recommendations for getting this done (preferably with GNU/Linux command line tools) quickly?  Or more quickly than writing my own Java app?  Looking for tips on speeding this up for myself.  To give an idea of where I'm starting from if I go the Java rout, I understand the concept that I will need to make a class and make a static main and have my main open my file and then run some static methods somewhere in the guts of the bitcoinj library on my file.  So you can see there's a lot of detail I'm going to have to go searching for.  Can you guys speed me up?


Title: Re: dump keys from protobuf format
Post by: tspacepilot on April 06, 2015, 06:07:51 AM
Actually, it looks like I may be able to use the "wallet-tool" program that comes with bitcoinj to do this job.  I'm currently playing around with that as a first step rather than trying to reinvent a rather complex wheel.


Title: Re: dump keys from protobuf format
Post by: tspacepilot on April 06, 2015, 07:14:56 AM
This is kinda like a conversation with myself, but I'm posting here as I make progress for posterity as I saw many queries like this on google but no easy answers.

It turns out you *can* very easily export your private keys from a protobuf wallet using the wallet-tool from bitcoinj (no need to build your own app).  You say:

$ ./wallet-tool dump --dump-privkeys --wallet=/path/to/protobufwallet

and you'll see a keys block in the output.  Now, the last step in my particular journey is to conver the hex-dumped keys to bitcoinbase58.  But that's another topic so I'm locking this one (solved and closed).