<p>I <a href="http://gary-rowe.com/agilestack/2011/12/28/how-to-recover-lost-bitcoins-from-an-android-wallet/" rel="nofollow">wrote up a detailed answer</a> to this some ago. Essentially, you will need to root your phone and extract the wallet file with apd. </p>

<p>After you've got that you can decode it by looking within the serialized wallet with a Java debugger attached looking for an ECKey reference. Then, once you have the private key you can simply hand it over to MtGox who will do the decode for you and then you can transfer the bitcoins wherever you like. </p>

<p>Also, the BitCoinJ project contains <a href="https://github.com/bitcoinj/bitcoinj/blob/master/examples/src/main/java/org/bitcoinj/examples/DumpWallet.java" rel="nofollow">several useful example tools</a> in the source tree. Perhaps using one of those will help you with the deserialization. </p>

CC BY-SA 3.0
2016-04-05T14:43:52.623Z
Here's a tool that dumps the protobuf format without resorting to a java debugger: https://github.com/lloeki/bitcoinj-wallet-dump
Lloeki
CC BY-SA 3.0
2012-03-21T10:05:23.180Z
**WARNING**: rooting the phone without using exploits wipes its memory. So, unless he's running an already rooted phone, or an exploitable android version, he can't do that.
o0'.
CC BY-SA 3.0
2012-03-21T10:37:46.803Z
@Lohoris Quite so. However, the OP does seem to indicate that the phone is an older ROM, possibly running 2.1, 2.2 which are exploitable. The linked article does provide a tested rooting approach that did not erase the internal memory.
Gary
CC BY-SA 3.0
2012-03-23T21:17:09.293Z
Thanks, this is probably the closest we are to a ready-made recovery solution. (my phones are rooted, so getting/backing up the wallet is not an issue.)
Metal
CC BY-SA 3.0
2012-03-24T00:31:10.890Z
DumpWallet did the trick. I just had to remove "00" from my priv: key field to get Mt.Gox to like my private key. Thanks again!
Metal
CC BY-SA 3.0
2012-03-24T18:29:14.317Z
@Metal No worries - glad to have helped
Gary
CC BY-SA 3.0
2012-03-21T08:47:17.893Z
2016-04-06T09:03:31.543Z
2016-04-06T09:03:31.543Z
Gary
<p>I would try option 1 first, if you can find the right version of the library.  I'd be willing to try making a general purpose tool to do it, but don't have an Android phone.  Is there any way you can make a new, empty wallet and put a copy online somewhere along with a corresponding bitcoin address or two?</p>

<p>If you're attempting option 2, you probably know at least one of the addresses in the wallet, and so wouldn't need to hit blockexplorer for every guess.  You would expect the private keys to be evenly spread through the wallet, so once you've found a few you can make smarter guesses about where the rest are.</p>

CC BY-SA 3.0
2012-03-23T22:00:28.800Z
Yes.. option 1 is the least crazy of the 2. At this point, I've probably spent more time hoping something already exists than I would have spent doing it myself, so I guess I'll just stop being lazy. :)
Metal
CC BY-SA 3.0
2012-03-20T19:34:26.633Z
2012-03-20T19:34:26.633Z
Chris Moore
<p><strong>[Obsolete answer, see below]</strong></p>

<p>As an update: current versions of the Bitcoin app have a "Back up Keys" feature.  This writes a backup of all the keys in the wallet to a file named <code>bitcoin-wallet-keys-YYYY-MM-DD</code> (using the current date) in the phone's storage, which you can then copy or transfer wherever you want.  The file is encrypted with a password you supply; it can be decrypted manually using OpenSSL, by running </p>

<blockquote>
  <p><code>openssl enc -d -aes-256-cbc -a -in bitcoin-wallet-keys-YYYY-MM-DD</code></p>
</blockquote>

<p>After decryption, the file is just a list of private keys, one per line, in the standard base 58 compressed format (starting with K).  You can import those keys into some other wallet.  In bitcoin-qt, you'd use the <code>importprivkey</code> console command.</p>

<p><strong>Further Update</strong>: As of Bitcoin Wallet 3.53, the "Back Up Keys" feature described above apparently no longer exists.</p>

CC BY-SA 3.0
2016-04-05T09:56:49.047Z
This worked great for me with some oldish Litecoin and Dogecoin wallets backed up from Android. The Bitcoin backup created around the same time does decrypt (output starts with a 0x0A 0x16 header followed by a plaintext `org.bitcoin.production`) but the remainder is binary.
Lloeki
CC BY-SA 3.0
2016-04-05T09:57:32.347Z
Also, in Bitcoin Wallet 4.49, backup is done via `Safety` menu entry.
Lloeki
CC BY-SA 3.0
2017-08-11T15:32:57.137Z
what openssl outputs now is in protobuff format. See https://bitcoin.stackexchange.com/questions/29518/problems-decrypting-my-bitcoin-wallet-on-android
Ovidiu Buligan
CC BY-SA 3.0
2013-09-28T16:23:37.607Z
2014-07-16T22:36:54.903Z
2014-07-16T22:36:54.903Z
Nate Eldredge
<p>This script seems to do the work</p>

<p><a href="https://github.com/jleni/wallet-decrypt" rel="nofollow noreferrer">https://github.com/jleni/wallet-decrypt</a></p>

<p>You just need to create a backup and it will give you back a mnemonic that you can use in electrum or electrum cash.</p>

CC BY-SA 3.0
2017-09-27T15:41:05.880Z
2017-09-27T15:41:05.880Z
Juan Leni
<p>A while back, I installed the <a href="https://play.google.com/store/apps/details?id=com.bitcoinandroid">Bitcoin Android app</a> and moved 5 BTC on it. Fast forward to now, new phone, new ROM, and the app seems completely unwilling to update its blockchain, meaning I have no way to move my BTCs  elsewhere.</p>

<p>Looking at the source, it's built on an early version of BitcoinJ, where the wallet file is essentially a serialized Wallet class.</p>

<p>A look at the wallet file itself isn't too friendly, although I'm sure the private key is somewhere in there in a relatively straightforward form.</p>

<p>So, that leaves me with the following possibilities:</p>

<ul>
<li><p>write a little Java app that links against the same version of BitcoinJ, load the Wallet file, grab the private key and print it.</p></li>
<li><p>write a really dumb script that extracts every 32 bytes sequence from the wallet file, treat it as a private key, map it to a public key, check blockexplorer.com for any activity associated with it. Or just import every one of those sequences into a bitcoin client and let it suffer.</p></li>
</ul>

<p>Before I embark on my Quest For Five Bitcoins, is there already something out there that can parse BitcoinJ wallet files and export keys from them?</p>

CC BY-SA 3.0
2013-02-12T01:07:44.823Z
Note that the link to this app (in the question above) is broken. If someone could fix it, that would be great.
Highly Irregular
CC BY-SA 3.0
2012-03-21T10:08:02.177Z
(1) updating the blockchain is not a prerequisite for being able to send away the coins already there, (2) it's slightly unclear what you did: you backupped that application and its data, and re-installed it in the new phone?
o0'.
CC BY-SA 3.0
2012-03-21T17:54:44.100Z
Many clients will not send transactions unless the client knows it has the requisite amount of coins; I suspect that is the case here.
BinaryMage
CC BY-SA 3.0
2012-03-23T21:39:52.993Z
@Lohoris I didn't realize that. Both coin sending and blockchain updating are failing, and I drew a causation link where none existed, both likely failing instead due to a third factor.
Metal
<wallet><bitcoinj><android>
Is there a known way to export my wallet private key from the "Bitcoin Android" app (com.bitcoinandroid)?
Metal
# Is there a known way to export my wallet private key from the "Bitcoin Android" app (com.bitcoinandroid)?

(Asked by: username_0 on 2012-03-20)

A while back, I installed the [Bitcoin Android app](https://play.google.com/store/apps/details?id=com.bitcoinandroid) and moved 5 BTC on it. Fast forward to now, new phone, new ROM, and the app seems completely unwilling to update its blockchain, meaning I have no way to move my BTCs elsewhere.

Looking at the source, it's built on an early version of BitcoinJ, where the wallet file is essentially a serialized Wallet class.

A look at the wallet file itself isn't too friendly, although I'm sure the private key is somewhere in there in a relatively straightforward form.

So, that leaves me with the following possibilities:

* write a little Java app that links against the same version of BitcoinJ, load the Wallet file, grab the private key and print it.
* write a really dumb script that extracts every 32 bytes sequence from the wallet file, treat it as a private key, map it to a public key, check blockexplorer.com for any activity associated with it. Or just import every one of those sequences into a bitcoin client and let it suffer.

Before I embark on my Quest For Five Bitcoins, is there already something out there that can parse BitcoinJ wallet files and export keys from them?

**Tags:** wallet, bitcoinj, android

> **Comments:**
> **username_2**: (1) updating the blockchain is not a prerequisite for being able to send away the coins already there, (2) it's slightly unclear what you did: you backupped that application and its data, and re-installed it in the new phone?  
> **username_3**: Many clients will not send transactions unless the client knows it has the requisite amount of coins; I suspect that is the case here.  
> **username_0**: @Lohoris I didn't realize that. Both coin sending and blockchain updating are failing, and I drew a causation link where none existed, both likely failing instead due to a third factor.  
> **username_1**: Note that the link to this app (in the question above) is broken. If someone could fix it, that would be great.  

---

## 4 answers

### Answer by username_4 on 2012-03-21. Score: 2 | Accepted answer

I [wrote up a detailed answer](http://username_4-rowe.com/agilestack/2011/12/28/how-to-recover-lost-bitcoins-from-an-android-wallet/) to this some ago. Essentially, you will need to root your phone and extract the wallet file with apd.

After you've got that you can decode it by looking within the serialized wallet with a Java debugger attached looking for an ECKey reference. Then, once you have the private key you can simply hand it over to MtGox who will do the decode for you and then you can transfer the bitcoins wherever you like.

Also, the BitCoinJ project contains [several useful example tools](https://github.com/bitcoinj/bitcoinj/blob/master/examples/src/main/java/org/bitcoinj/examples/DumpWallet.java) in the source tree. Perhaps using one of those will help you with the deserialization.

> **Comments:**
> **username_2**: **WARNING**: rooting the phone without using exploits wipes its memory. So, unless he's running an already rooted phone, or an exploitable android version, he can't do that.  
> **username_4**: @Lohoris Quite so. However, the OP does seem to indicate that the phone is an older ROM, possibly running 2.1, 2.2 which are exploitable. The linked article does provide a tested rooting approach that did not erase the internal memory.  
> **username_0**: Thanks, this is probably the closest we are to a ready-made recovery solution. (my phones are rooted, so getting/backing up the wallet is not an issue.)  
> **username_0**: DumpWallet did the trick. I just had to remove "00" from my priv: key field to get Mt.Gox to like my private key. Thanks again!  
> **username_4**: @username_0 No worries - glad to have helped  
> **username_5**: Here's a tool that dumps the protobuf format without resorting to a java debugger: https://github.com/username_5/bitcoinj-wallet-dump  

---

### Answer by username_6 on 2012-03-20. Score: 4

I would try option 1 first, if you can find the right version of the library. I'd be willing to try making a general purpose tool to do it, but don't have an Android phone. Is there any way you can make a new, empty wallet and put a copy online somewhere along with a corresponding bitcoin address or two?

If you're attempting option 2, you probably know at least one of the addresses in the wallet, and so wouldn't need to hit blockexplorer for every guess. You would expect the private keys to be evenly spread through the wallet, so once you've found a few you can make smarter guesses about where the rest are.

> **Comments:**
> **username_0**: Yes.. option 1 is the least crazy of the 2. At this point, I've probably spent more time hoping something already exists than I would have spent doing it myself, so I guess I'll just stop being lazy. :)  

---

### Answer by username_7 on 2013-09-28. Score: 4

**[Obsolete answer, see below]**

As an update: current versions of the Bitcoin app have a "Back up Keys" feature. This writes a backup of all the keys in the wallet to a file named `bitcoin-wallet-keys-YYYY-MM-DD` (using the current date) in the phone's storage, which you can then copy or transfer wherever you want. The file is encrypted with a password you supply; it can be decrypted manually using OpenSSL, by running

> `openssl enc -d -aes-256-cbc -a -in bitcoin-wallet-keys-YYYY-MM-DD`

After decryption, the file is just a list of private keys, one per line, in the standard base 58 compressed format (starting with K). You can import those keys into some other wallet. In bitcoin-qt, you'd use the `importprivkey` console command.

**Further Update**: As of Bitcoin Wallet 3.53, the "Back Up Keys" feature described above apparently no longer exists.

> **Comments:**
> **username_5**: This worked great for me with some oldish Litecoin and Dogecoin wallets backed up from Android. The Bitcoin backup created around the same time does decrypt (output starts with a 0x0A 0x16 header followed by a plaintext `org.bitcoin.production`) but the remainder is binary.  
> **username_5**: Also, in Bitcoin Wallet 4.49, backup is done via `Safety` menu entry.  
> **username_8**: what openssl outputs now is in protobuff format. See https://bitcoin.stackexchange.com/questions/29518/problems-decrypting-my-bitcoin-wallet-on-android  

---

### Answer by username_9 on 2017-09-27. Score: 0

This script seems to do the work

<https://github.com/jleni/wallet-decrypt>

You just need to create a backup and it will give you back a mnemonic that you can use in electrum or electrum cash.


---

