<p>Since "when you're a developer it's easy" is probably not sufficient for most people, here is the full step-by-step from a Android Bitcoin Wallet to importing the private keys in Electrum which (finally...) worked for me. This solution uses bitcoinj. The approach using the .proto definition file and opening the wallet in Python was also tested, but seems more error-prone.</p>

<p>Requirements:</p>

<ul>
<li>Android Bitcoin Wallet in a new version (to my knowledge, some older versions do not allow a backup).</li>
<li>Bash shell: tested with the Windows Bash, but should work on native Linux or OS X. Basic knowledge (<code>cd</code> etc.) helps.</li>
<li>On my system, maven and openjfx were required. Install them with <code>sudo apt-get install maven</code>, <code>sudo apt-get install openjfx</code></li>
<li>Electrum (current: 2.9.2)</li>
</ul>

<p>Step by step:</p>

<ol>
<li>Backup: save the encrypted wallet (Safety -> Back up wallet) and move the backup file to your computer (e.g. via file transfer, Dropbox, e-mail...).</li>
<li>Decrypt: open the bash, move to your data directory and use <code>openssl enc -d -aes-256-cbc -a -in bitcoin-wallet-backup &gt; bitcoin_decrypted</code> as stated above, which will ask for the encryption password.</li>
<li>Install bitcoinj:

<ul>
<li><code>git clone https://github.com/bitcoinj/bitcoinj.git</code></li>
<li><code>cd bitcoinj</code></li>
<li><code>git fetch --all</code></li>
<li><code>git checkout v0.14.4</code></li>
<li><code>mvn install</code> (fails at GroupTest in Windows bash, but works anyway)</li>
<li><code>cd tools</code></li>
<li><code>./wallet-tool</code></li>
</ul></li>
<li>load the decrypted wallet and dump the private keys:</li>
</ol>

<p><code>./wallet-tool dump --wallet=/mnt/d/path/to/wallet/bitcoin_decrypted --dump-privkeys &gt; /mnt/d/path/to/wallet/bitcoin_decrypted_dump</code>.</p>

<p>Please note that this saves the unencrypted private keys in the file "bitcoin_decrypted_dump". Move this file to a save location (e.g. TrueCrypt/VeraCrypt container) or delete it after use.</p>

<ol start="5">
<li>Create a new wallet with the private keys in Electrum: File - New/Restore - filename - 'Standard wallet' - 'Use public or private keys', then list the 'priv WIF' keys from the dump file.</li>
</ol>

<p>On handling the BTC/BCH question with Electrum and Electron Cash, please read the notes on the Electrum webpage.</p>

<p>If there are any questions, feel free to ask. Good luck!</p>

<p>Sources:</p>

<ul>
<li>This page</li>
<li><a href="https://github.com/bitcoin-wallet/bitcoin-wallet/blob/master/wallet/README.recover.md" rel="noreferrer">https://github.com/bitcoin-wallet/bitcoin-wallet/blob/master/wallet/README.recover.md</a></li>
</ul>

CC BY-SA 3.0
2017-09-14T23:08:35.477Z
When installint bitcoinj, I get:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project wallettemplate: Compilation failure: Compilation failure:
[ERROR] ~/wallettemplate/src/main/java/wallettemplate/utils/easing/EasingInterpolator.java:[27,24] package javafx.animation does not exist
And many similar errors after that (javax.something does not exist). Any ideas?
Sergei Tikhomirov
CC BY-SA 3.0
2017-09-15T12:55:56.573Z
[This](https://stackoverflow.com/a/34244308) helped.
Sergei Tikhomirov
CC BY-SA 3.0
2017-11-05T08:58:51.143Z
My file `bitcoin_decrypted_dump` contained errors, see [this pastebin](https://pastebin.com/eMY9Wb9W) what should I do now? I don't understand error messages but I can execute/understand terminal commands.
jacob
CC BY-SA 3.0
2017-11-06T21:15:28.330Z
@jacob: the error message states that the Java Development Kit (jdk) is missing. You can install it with "sudo apt-get install openjdk-8-jre". Please confirm if this solves the problem, then I will update the instructions.
Colluphid
CC BY-SA 3.0
2017-11-11T12:30:00.200Z
@Colluphid I got a guy to help me with this to install java and set PATH variable. However, the output file does not contain my private key. It's a large file and it looks like I can see the block that contain the transactions that I my wallet did.
jacob
CC BY-SA 3.0
2017-11-12T20:27:21.447Z
@jacob: If I remember correctly I got the transaction list when using the dump command without '--dump-privkeys'. Can you check that you included that option?
Colluphid
CC BY-SA 3.0
2017-08-03T21:24:43.213Z
2017-08-03T21:24:43.213Z
Colluphid
<p>I tried to dump private keys but i couldn't.
Using wallet-tool, I obtain a text file with public keys, addresses, some other information, and the words: "Seed is encripted".</p>

<p>So I use this phyton script to obtain seed, and it apparentely worked.</p>

<p>Then I use this standalone page: <a href="https://raw.githubusercontent.com/iancoleman/bip39/master/bip39-standalone.html" rel="nofollow noreferrer">https://raw.githubusercontent.com/iancoleman/bip39/master/bip39-standalone.html</a> to obtain private keys to import in a BCH wallet. </p>

<p>I "found" only 85% of BCH that I expected (BTC pre fork). How could be possible ? I tried to import a lot of keys beyond the key associated to the last used address.... </p>

<hr>

<p>Update: I figured out. I had to use as derivative path <code>m/0'/1</code> on the standalone page linked above (with derivation path BIP32). Some BTC were on addresses of this kind. </p>

CC BY-SA 3.0
2017-08-15T21:36:18.513Z
2017-08-16T14:58:17.777Z
2017-08-16T14:58:17.777Z
dar0x
<p>I had a load of trouble, but I got there in the end.  I decided to write it up; see <a href="https://recoverbch.azurewebsites.net" rel="nofollow noreferrer">https://recoverbch.azurewebsites.net</a> for an in-depth guide. Hope this helps!</p>

CC BY-SA 3.0
2017-09-12T18:53:51.413Z
2017-09-22T22:32:03.670Z
2017-09-22T22:32:03.670Z
BCHRecover
<p>To work with bitcoinj wallets (and backups of wallets) you can use <a href="https://github.com/bitcoinj/bitcoinj/tree/master/tools" rel="nofollow noreferrer">wallet-tool</a>. It's part of <a href="https://bitcoinj.github.io/" rel="nofollow noreferrer">bitcoinj</a> and allows you to dump all your deterministically derived private keys.</p>

CC BY-SA 3.0
2017-01-03T21:15:19.960Z
2017-01-03T21:15:19.960Z
Andreas
<p>Protocol Buffer is an open source serialization library from Google.</p>

<p>If you can code, it should not take you too long to create a script (for instance in Python) to get out the content of the field you are interested in. In this case the field containing the private key.</p>

<p>Here is the doc for the Python protocol buffer library: <a href="https://developers.google.com/protocol-buffers/docs/reference/python-generated" rel="nofollow">https://developers.google.com/protocol-buffers/docs/reference/python-generated</a></p>

<p>The protocol buffer library use a .proto file to describe the possible fields in the serialized format. I presume that you do not have access to it. This will have the disadvantage that you will not have the name of the fields when you will deserialize the wallet.</p>

<p>That should however not prevent you from deserializing. You will then need to guess which value is the private key.</p>

CC BY-SA 3.0
2015-02-26T21:16:17.540Z
The schildbach wallet uses BitcoinJ serialization. This is the .proto file https://github.com/bitcoinj/bitcoinj/blob/master/core/src/wallet.proto
Nick ODell
CC BY-SA 3.0
2015-02-26T13:27:32.790Z
2015-02-26T13:27:32.790Z
Pierre-Antoine
<p>I don't know if you are a developer, because you could dump the private keys with very little effort. The app relies on bitcoinj and the protobuf format you mention is bitcoinj serialization format for the wallet. Export the wallet file to your desktop and write a simple Java app that uses bitcoinj to access the wallet, then use the <code>DumpedKey</code> class to output the private keys in the widely used WIF encoding.</p>

CC BY-SA 3.0
2014-08-30T08:30:44.940Z
2014-08-30T08:30:44.940Z
keeshux
<p>Would any of you have an easier way to get at these keys from the protobuf format? I'm trying to help someone get these keys out of the app on their phone (to control their Bitcoin Cash) and we've made it this far in decrypting the backup wallet, but without having any programming knowledge we are stuck here.</p>

CC BY-SA 3.0
2017-09-27T15:43:27.243Z
I just posted an answer. I had the same problem.
Juan Leni
CC BY-SA 3.0
2017-08-03T00:04:32.457Z
2017-08-03T00:04:32.457Z
justabitcoinperson
<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:43:14.223Z
2017-09-27T15:43:14.223Z
Juan Leni
<p>Recent changes to Andreas Schildbach's Bitcoin client for Android have removed the option to export private keys. This has been replaced by an option to back up the entire wallet. Unfortunately, the wallet data of the Schildbach client is stored in an arcane format called protobuf (short presumably for Protocol Buffers). The Schildbach client can restore a protobuf wallet from its AES-encoded backup file. But the protobuf wallet cannot be imported into a different Bitcoin client such as the Bitcoin Core (QT) client.</p>

<p>For emphasis, I'm aware of the command line method of decoding the back-ups created by Schildbach's client, which in the past allowed the private keys to be saved in AES encrypted format to /sdcard/Download. The following command worked in the past to produce a human readable copy of my Bitcoin private keys:</p>

<pre><code>openssl enc -d -aes-256-cbc -a -in encrypted-wallet-keys -out decrypted-wallet-keys
</code></pre>

<p>This no longer works. The following command instead produces a non-AES-encrypted protobuf wallet.</p>

<pre><code>openssl enc -d -aes-256-cbc -a -in bitcoin-wallet-backup-2014-07-19 -out bitcoin-wallet-backup-2014-07-19-decrypted
</code></pre>

<p>The -out file is not an ASCII copy of my private keys but a copy of the protobuf wallet used internally by the Schildbach Bitcoin client (found at /data/data/de.schildbach.wallet/files/wallet-protobuf).</p>

<wallet><private-key><bitcoin-wallet-app>
How do I extract my private keys from a protobuf wallet?
dogzilla
# How do I extract my private keys from a protobuf wallet?

(Asked by: username_0 on 2014-07-19)

Recent changes to username_6 Schildbach's Bitcoin client for Android have removed the option to export private keys. This has been replaced by an option to back up the entire wallet. Unfortunately, the wallet data of the Schildbach client is stored in an arcane format called protobuf (short presumably for Protocol Buffers). The Schildbach client can restore a protobuf wallet from its AES-encoded backup file. But the protobuf wallet cannot be imported into a different Bitcoin client such as the Bitcoin Core (QT) client.

For emphasis, I'm aware of the command line method of decoding the back-ups created by Schildbach's client, which in the past allowed the private keys to be saved in AES encrypted format to /sdcard/Download. The following command worked in the past to produce a human readable copy of my Bitcoin private keys:

```
openssl enc -d -aes-256-cbc -a -in encrypted-wallet-keys -out decrypted-wallet-keys

```

This no longer works. The following command instead produces a non-AES-encrypted protobuf wallet.

```
openssl enc -d -aes-256-cbc -a -in bitcoin-wallet-backup-2014-07-19 -out bitcoin-wallet-backup-2014-07-19-decrypted

```

The -out file is not an ASCII copy of my private keys but a copy of the protobuf wallet used internally by the Schildbach Bitcoin client (found at /data/data/de.schildbach.wallet/files/wallet-protobuf).

**Tags:** wallet, private-key, bitcoin-wallet-app


---

## 8 answers

### Answer by username_1 on 2017-08-03. Score: 6

Since "when you're a developer it's easy" is probably not sufficient for most people, here is the full step-by-step from a Android Bitcoin Wallet to importing the private keys in Electrum which (finally...) worked for me. This solution uses bitcoinj. The approach using the .proto definition file and opening the wallet in Python was also tested, but seems more error-prone.

Requirements:

* Android Bitcoin Wallet in a new version (to my knowledge, some older versions do not allow a backup).
* Bash shell: tested with the Windows Bash, but should work on native Linux or OS X. Basic knowledge (`cd` etc.) helps.
* On my system, maven and openjfx were required. Install them with `sudo apt-get install maven`, `sudo apt-get install openjfx`
* Electrum (current: 2.9.2)

Step by step:

1. Backup: save the encrypted wallet (Safety -> Back up wallet) and move the backup file to your computer (e.g. via file transfer, Dropbox, e-mail...).
2. Decrypt: open the bash, move to your data directory and use `openssl enc -d -aes-256-cbc -a -in bitcoin-wallet-backup > bitcoin_decrypted` as stated above, which will ask for the encryption password.
3. Install bitcoinj:
   * `git clone https://github.com/bitcoinj/bitcoinj.git`
   * `cd bitcoinj`
   * `git fetch --all`
   * `git checkout v0.14.4`
   * `mvn install` (fails at GroupTest in Windows bash, but works anyway)
   * `cd tools`
   * `./wallet-tool`
4. load the decrypted wallet and dump the private keys:

`./wallet-tool dump --wallet=/mnt/d/path/to/wallet/bitcoin_decrypted --dump-privkeys > /mnt/d/path/to/wallet/bitcoin_decrypted_dump`.

Please note that this saves the unencrypted private keys in the file "bitcoin\_decrypted\_dump". Move this file to a save location (e.g. TrueCrypt/VeraCrypt container) or delete it after use.

5. Create a new wallet with the private keys in Electrum: File - New/Restore - filename - 'Standard wallet' - 'Use public or private keys', then list the 'priv WIF' keys from the dump file.

On handling the BTC/BCH question with Electrum and Electron Cash, please read the notes on the Electrum webpage.

If there are any questions, feel free to ask. Good luck!

Sources:

* This page
* <https://github.com/bitcoin-wallet/bitcoin-wallet/blob/master/wallet/README.recover.md>

> **Comments:**
> **username_2**: When installint bitcoinj, I get: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project wallettemplate: Compilation failure: Compilation failure: [ERROR] ~/wallettemplate/src/main/java/wallettemplate/utils/easing/EasingInterpolator.java:[27,24] package javafx.animation does not exist And many similar errors after that (javax.something does not exist). Any ideas?  
> **username_2**: [This](https://stackoverflow.com/a/34244308) helped.  
> **username_3**: My file `bitcoin_decrypted_dump` contained errors, see [this pastebin](https://pastebin.com/eMY9Wb9W) what should I do now? I don't understand error messages but I can execute/understand terminal commands.  
> **username_1**: @username_3: the error message states that the Java Development Kit (jdk) is missing. You can install it with "sudo apt-get install openjdk-8-jre". Please confirm if this solves the problem, then I will update the instructions.  
> **username_3**: @username_1 I got a guy to help me with this to install java and set PATH variable. However, the output file does not contain my private key. It's a large file and it looks like I can see the block that contain the transactions that I my wallet did.  
> **username_1**: @username_3: If I remember correctly I got the transaction list when using the dump command without '--dump-privkeys'. Can you check that you included that option?  

---

### Answer by username_4 on 2017-08-15. Score: 2

I tried to dump private keys but i couldn't.
Using wallet-tool, I obtain a text file with public keys, addresses, some other information, and the words: "Seed is encripted".

So I use this phyton script to obtain seed, and it apparentely worked.

Then I use this standalone page: <https://raw.githubusercontent.com/iancoleman/bip39/master/bip39-standalone.html> to obtain private keys to import in a BCH wallet.

I "found" only 85% of BCH that I expected (BTC pre fork). How could be possible ? I tried to import a lot of keys beyond the key associated to the last used address....

---

Update: I figured out. I had to use as derivative path `m/0'/1` on the standalone page linked above (with derivation path BIP32). Some BTC were on addresses of this kind.


---

### Answer by username_5 on 2017-09-12. Score: 1

I had a load of trouble, but I got there in the end. I decided to write it up; see <https://recoverbch.azurewebsites.net> for an in-depth guide. Hope this helps!


---

### Answer by username_6 on 2017-01-03. Score: 1

To work with bitcoinj wallets (and backups of wallets) you can use [wallet-tool](https://github.com/bitcoinj/bitcoinj/tree/master/tools). It's part of [bitcoinj](https://bitcoinj.github.io/) and allows you to dump all your deterministically derived private keys.


---

### Answer by username_7 on 2015-02-26. Score: 1

Protocol Buffer is an open source serialization library from Google.

If you can code, it should not take you too long to create a script (for instance in Python) to get out the content of the field you are interested in. In this case the field containing the private key.

Here is the doc for the Python protocol buffer library: <https://developers.google.com/protocol-buffers/docs/reference/python-generated>

The protocol buffer library use a .proto file to describe the possible fields in the serialized format. I presume that you do not have access to it. This will have the disadvantage that you will not have the name of the fields when you will deserialize the wallet.

That should however not prevent you from deserializing. You will then need to guess which value is the private key.

> **Comments:**
> **username_8**: The schildbach wallet uses BitcoinJ serialization. This is the .proto file https://github.com/bitcoinj/bitcoinj/blob/master/core/src/wallet.proto  

---

### Answer by username_9 on 2014-08-30. Score: 1

I don't know if you are a developer, because you could dump the private keys with very little effort. The app relies on bitcoinj and the protobuf format you mention is bitcoinj serialization format for the wallet. Export the wallet file to your desktop and write a simple Java app that uses bitcoinj to access the wallet, then use the `DumpedKey` class to output the private keys in the widely used WIF encoding.


---

### Answer by username_10 on 2017-08-03. Score: 0

Would any of you have an easier way to get at these keys from the protobuf format? I'm trying to help someone get these keys out of the app on their phone (to control their Bitcoin Cash) and we've made it this far in decrypting the backup wallet, but without having any programming knowledge we are stuck here.

> **Comments:**
> **username_11**: I just posted an answer. I had the same problem.  

---

### Answer by username_11 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.


---

