8

I have some bitcoin stored in the bitcoin wallet android app

I want to transfer my inherited Bitcoin Cash (BCC) to an exchange. The android app doesn't care about BCC.

I tried to decode a backup of my wallet to use the private key in Bitcoin ABC desktop app. openssl enc -d -aes-256-cbc -a -in wallet_backup_file But gibberish comes out. Update looks like the decryption worked because I see the first text as org.bitcoin.production. The problem is that it is encoded in a protobuf format: Problems decrypting my bitcoin-wallet on android

Importing the same backup file on the bitcoin app works , and after some time I can see my funds.

How can I claim my bitcoin cash and transfer them to an exchange ?

3

3 Answers 3

3

The Bitcoin Wallet project recently included detailed instructions on how to extract your key pairs for exactly this purpose. In the section Recovering from protobuf wallet format, skip to the paragraph beginning with

You can also get a list of the private keys...

(Here is a historic version of that guide*, should it ever disappear)

I have now completed the process myself. Here's a summary. Note this works for backups made after 2014 (newer protobuf format). See the article above if your backup is older than this.

# pre-reqs
sudo apt install openjdk-8-jdk openjfx android-tools-adb openssl git maven

# use known version of bitcoinj - HEAD of branch release-0.14 at time of writing
git clone https://github.com/bitcoinj/bitcoinj.git 
(cd bitcoinj && git reset --hard 0e30a3011c42cedfd83f2109d54dd192730dcc45) 

# decrypt the wallet backup (substitute for <BACKUP>)
openssl enc -d -aes-256-cbc -md md5 -a -in <BACKUP> > /tmp/dec

# reset & sync wallet (may take some time, but was necessary in my case)
(cd bitcoinj/tools && \
   ./wallet-tool reset --wallet=/tmp/dec && \
   ./wallet-tool sync --wallet=/tmp/dec --debuglog)

# dump keys You will need to add `--password=<PIN>` if your wallet is pin protected.
(cd bitcoinj/tools && ./wallet-tool dump --wallet=/tmp/dec --dump-privkeys)

# delete your decrypted wallet
rm /tmp/dec
2
  • 1
    Thank you ! it worked. I didn't need to wait for the whole ./wallet-tool sync , I interrupted it after 5 minutes , dumped the keys (./wallet-tool dump) and imported them in Electron BCH. Nov 11, 2017 at 10:48
  • 1
    For getting the WIF's from text private key dump used regex: regex to delete all lines not containing WIF ^(?!.*WIF=).*$ , regex to extract WIF values ^.*WIF=(\w+).*$ Nov 11, 2017 at 10:56
2

I have the same issue. I used OpenSSL to decrypt the file, gave the correct password and got org.bitcoin.production followed by a load of protobuf-serialized gibberish. I then processed the output using the tool mentioned here : https://github.com/lloeki/bitcoinj-wallet-dump, which appears to have worked successfully.

It gave me 271 public keys that my wallet used, that looked like normal bitcoin public keys, and 271 private keys - that were all the same and 7 characters.

So in answer to your question this tool github.com/lloeki/bitcoinj-wallet-dump works - but I'm not sure how to make sense of the output.

The output looked something like this (all values have been changed):

0 Publ: 1V5h7k
0 Priv: FYhAv34
1 Publ: 16wZac2mEc9jEtbdyGsUBeGR8YCVnJMLk4r2SXZ5k6v2HoCaoKY
1 Priv: FYhAv34
2 Publ: 16PBXd5r563xSA8m5bgRQgDGmn7wJBUoA4mfsfike2a66jzdjZU
2 Priv: FYhAv34
3 Publ: 16faRCW3znVawJis7DFnFNZTJ32F4ry5y7HEtnzPF9dKlXt6gVr
3 Priv: FYhAv34
4 Publ: 18CmUT8CTfbwLzD9PmhDlukA5s1KqJK7PTP9NxYYP5wMkeP36PJ
4 Priv: FYhAv34
.....

Anyone know how to make sense of the output? Is that format expected? I was expecting full public and private key pairs.. unless the 7 character constant is a special wallet key? I'm not familiar with wallet details..

8
  • Please delete this answer, go to gist.github.com, paste this answer, choose "create public gist", copy the link of the gist and paste it as a comment.
    – MCCCS
    Aug 15, 2017 at 8:22
  • I would have commented, but I need 50 reputation.. so I can't comment on someone else's question - unless you mean comment on my deleted answer, if that is possible?
    – 0lOl0
    Aug 16, 2017 at 18:13
  • Did you try verifying your addresses on blockchain.info to check if they are valid and have transactions which make sense to you?
    – KOld
    Aug 17, 2017 at 15:38
  • I checked a few, but I couldn't find any that made sense.. I will have a more thorough look. I haven't done 270 transactions though.
    – 0lOl0
    Aug 19, 2017 at 10:22
  • 1
    see answer from @Synesso . Worked for me . I didn't need to wait for the whole ./wallet-tool sync command . I interrupted it after 5 minutes. And still worked eventhoutgh list of transactions was 0 in the dump. Nov 11, 2017 at 10:45
1

Knowing your private key you can transfer/sweep your Bitcoin Cash funds into a offline wallet like Coinomi and then transfer them to an exchange.

More on the process of sweeping your funds is at How to sweep private extended key from mycellium into coinomi for bitcoin cash coins?

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