Skip to content

Instantly share code, notes, and snippets.

@SomberNight
Last active June 16, 2018 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SomberNight/295cd950ee4fb2b3768f1ae538babe7e to your computer and use it in GitHub Desktop.
Save SomberNight/295cd950ee4fb2b3768f1ae538babe7e to your computer and use it in GitHub Desktop.

Instructions for retrieving your wallet files from Android.

Warnings:

  • deleting the Android app deletes the wallet files
  • rooting your phone might format userspace, hence delete the wallet files

Below procedure has been tested on

  • an unrooted phone running Android 8.0; Electrum version 3.0.2.0 from Google Play
  • an unrooted phone running Android 8.1; Electrum version 3.1.3.0 from Google Play

Requirements:

  • you need a working adb (Android Debug Bridge)
  • you need a Java JDK (note: or maybe JRE is enough?)

Step 1

On your computer, run

adb backup "org.electrum.electrum" -f back.ab

Step 2

On your phone, follow the on-screen instructions. You are likely to need to choose a password (backup_password), which will be used to encrypt the backup you are creating now. The backup back.ab will be automatically copied over to your computer over adb.

Find back.ab on your computer. It should be in the current directory where you ran the command from.

Download the android-backup-extractor from https://github.com/nelenkov/android-backup-extractor/releases -- you will need abe-all.jar.

Step 3

Now decrypt back.ab using abe-all.jar. Run:

java -jar abe-all.jar unpack back.ab back.tar <backup_password>

There's a chance you run into the following exception:

WARNING: Maximum allowed key-length seems smaller than needed. Please check that unlimited strength cryptography is available, see README.md for details
Exception in thread "main" java.lang.RuntimeException: java.security.InvalidKeyException: Illegal key size
        at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:233)
        at org.nick.abe.Main.main(Main.java:40)
Caused by: java.security.InvalidKeyException: Illegal key size
        at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)
        at javax.crypto.Cipher.implInit(Cipher.java:805)
        at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
        at javax.crypto.Cipher.init(Cipher.java:1396)
        at javax.crypto.Cipher.init(Cipher.java:1327)
        at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:128)
        ... 1 more

In this case, you will need the "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files".

Download from http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

After you unzip it, there are two important files inside: local_policy.jar and US_export_policy.jar.

You will need to overwrite the respective files in your JAVA HOME folder with these two. Specifically, the files should be in <java-home>/lib/security/

Example JAVA HOME on Linux: /usr/lib/jvm/<jdk_version_installed>/jre/

Example JAVA HOME on Windows: C:\Program Files\Java\<jdk_version_installed>\jre\

Example JAVA HOME on MacOS: /Library/Java/JavaVirtualMachines/<jdk_version_installed>/Contents/Home/jre/

After overwriting the two files, start step 3 again.

Step 4

You should have a file called back.tar. Untar it, or open it in some way. Your wallets should be located in

back.tar/apps/org.electrum.electrum/f/data/wallets

Step 5

Open the wallets using a desktop version of Electrum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment