Electrum Bitcoin Wallet

7 minute read

Published:

Wallet Logo

This app was first launched on 2nd March 2016 and currently has more than 100000 downloads, a 3.5 stars rating from 1693 users and the latest APK is version 3.3.7.0.

Our last analysis was done on 11th December 2019 based on data found in their Google Play description and their website and their source repository. We discuss verification with the provider in this issue.

We found these ways of contacting the developers:

Disclaimer

The following Analysis is not a full code review! We plan to make code reviews available in the future but even then it will never be a stamp of approval but rather a list of incidents and bad coding practice. We cannot find and tell you all the dark secrets the wallet providers might have.

Do your own research!

Try out searching for "lost bitcoins", "stole my money" or "scammers" together with the wallet's name, even if you think the wallet is generally trustworthy. For all the bigger wallets you will find accusations. Make sure you understand why they were made and if you are comfortable with the provider's reaction.

The Analysis

Electrum is around since 2011 in its various flavors and many projects came from this open source project.

In the description we are pointed to their repository at this repository where we are referred to this Readme.md.

And there we read:

This script does not produce reproducible output (yet!). Please help us remedy this.

We gave it a try anyway and ran:

git clone git@github.com:spesmilo/electrum.git
cd electrum
git tag
git checkout 3.3.7
docker build -t electrum-android-builder-img electrum/gui/kivy/tools
./contrib/pull_locale
./contrib/make_packages
mkdir --parents $PWD/.buildozer/.gradle
docker run -it --rm --name electrum-android-builder-cont \
  --volume $PWD:/home/user/wspace/electrum \
  --volume $PWD/.buildozer/.gradle:/home/user/.gradle \
  --volume ~/.keystore:/home/user/.keystore \
  --workdir /home/user/wspace/electrum \
  electrum-android-builder-img ./contrib/make_apk
cd bin/
apktool d -o fromPlayStore 'Electrum 3.3.7.0 (org.electrum.electrum).apk'
apktool d -o fromBuild Electrum-3.3.7.0-debug.apk
diff from* -r --brief | wc -l

The apk we got at this point was … a debug build and thus it is no big surprise to find 1362 files to differ.

Running the docker command again but with ./contrib/make_apk release turned out complicated, too. Even after copying a keystore with a known password to ~/.keystore/ and providing the script with the password, we get this kind of cryptic error:

$ docker run -it --rm \
    --name electrum-android-builder-cont \
    -v $PWD:/home/user/wspace/electrum \
    -v $PWD/.buildozer/.gradle:/home/user/.gradle \
    -v ~/.keystore:/home/user/.keystore \
    --workdir /home/user/wspace/electrum \
    electrum-android-builder-img \
    ./contrib/make_apk release
~/wspace/electrum/electrum/gui/kivy ~/wspace/electrum
python3 -m kivy.atlas theming/light 1024 theming/light/*.png
[WARNING] [Config      ] Older configuration version detected (0 instead of 21)
[WARNING] [Config      ] Upgrading configuration in progress.
[INFO   ] [Logger      ] Record log in /home/user/.kivy/logs/kivy_19-12-11_0.txt
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "/usr/lib/python3/dist-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0]
[INFO   ] [Python      ] Interpreter at "/usr/bin/python3"
[INFO   ] [Atlas       ] create an 1024x1024 rgba image
Atlas created at theming/light.atlas
1 image has been created
Keystore Password:make[1]: Entering directory '/home/user/wspace/electrum/electrum/gui/kivy'
# running pre build setup
# copy electrum to main.py
make[1]: Leaving directory '/home/user/wspace/electrum/electrum/gui/kivy'
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Install platform
# Android ANT is missing, downloading
# Apache ANT installation done.
# Android SDK found at /opt/android/android-sdk
# Android NDK found at /opt/android/android-ndk-r17c
# Check application requirements
# Check garden requirements
# Compile platform
# Build the application #4
# Package the application
# Gradle project detected, copy files /home/user/wspace/electrum/.buildozer/android/platform/build/dists/Electrum/src/main/java
copy electrum/gui/kivy/data/java-classes/ to /home/user/wspace/electrum/.buildozer/android/platform/build/dists/Electrum/src/main/java/
copy electrum/gui/kivy/data/java-classes/org to /home/user/wspace/electrum/.buildozer/android/platform/build/dists/Electrum/src/main/java/org
copy electrum/gui/kivy/data/java-classes/org/electrum to /home/user/wspace/electrum/.buildozer/android/platform/build/dists/Electrum/src/main/java/org/electrum
copy electrum/gui/kivy/data/java-classes/org/electrum/qr to /home/user/wspace/electrum/.buildozer/android/platform/build/dists/Electrum/src/main/java/org/electrum/qr
copy electrum/gui/kivy/data/java-classes/org/electrum/qr/SimpleScannerActivity.java to /home/user/wspace/electrum/.buildozer/android/platform/build/dists/Electrum/src/main/java/org/electrum/qr/SimpleScannerActivity.java
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name Electrum --name Electrum --version 3.3.7.0 --package org.electrum.electrum --android_api 28 --minsdk 21 --ndk-api 21 --private /home/user/wspace/electrum/.buildozer/android/app --permission INTERNET --permission CAMERA --add-activity org.electrum.qr.SimpleScannerActivity --presplash /home/user/wspace/electrum/./electrum/gui/icons/electrum_presplash.png --icon /home/user/wspace/electrum/./electrum/gui/icons/electrum_launcher.png --orientation portrait --window --intent-filters /home/user/wspace/electrum/electrum/gui/kivy/tools/bitcoin_intent.xml --activity-launch-mode singleTask --release --sign --copy-libs --depend me.dm7.barcodescanner:zxing:1.9.8 --arch armeabi-v7a --color=always --storage-dir="/home/user/wspace/electrum/.buildozer/android/platform/build" --ndk-api=21
# ENVIRONMENT:
#     USER = 'user'
#     P4A_RELEASE_KEYSTORE = '/home/user/.keystore'
#     LANGUAGE = 'en_US.UTF-8'
#     ANDROID_SDK_HOME = '/opt/android/android-sdk'
#     HOSTNAME = 'f48b0ed2034d'
#     WORK_DIR = '/home/user/wspace'
#     SHLVL = '1'
#     HOME = '/home/user'
#     P4A_RELEASE_KEYALIAS = 'electrum'
#     OLDPWD = '/home/user/wspace/electrum/electrum/gui/kivy'
#     ANDROID_SDK_BUILD_TOOLS_VERSION = '28.0.3'
#     MAKEFLAGS = ''
#     HOME_DIR = '/home/user'
#     ANDROID_SDK_TOOLS_VERSION = '4333796'
#     MAKE_TERMERR = '/dev/pts/0'
#     ANDROID_SDK_TOOLS_ARCHIVE = 'sdk-tools-linux-4333796.zip'
#     _ = '/usr/bin/make'
#     P4A_RELEASE_KEYSTORE_PASSWD = 'android'
#     ANDROID_NDK_VERSION = '17c'
#     TERM = 'xterm'
#     PATH = '/home/user/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
#     ANDROID_NDK_ARCHIVE = 'android-ndk-r17c-linux-x86_64.zip'
#     P4A_RELEASE_KEYALIAS_PASSWD = 'android'
#     ANDROID_SDK_TOOLS_DL_URL = 'https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip'
#     MAKELEVEL = '1'
#     USE_SDK_WRAPPER = '1'
#     ANDROID_NDK_HOME_V = '/opt/android/android-ndk-r17c'
#     LANG = 'en_US.UTF-8'
#     ANDROID_NDK_DL_URL = 'https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip'
#     MAKE_TERMOUT = '/dev/pts/0'
#     PWD = '/home/user/wspace/electrum'
#     LC_ALL = 'en_US.UTF-8'
#     ANDROID_HOME = '/opt/android'
#     MFLAGS = ''
#     ANDROID_NDK_HOME = '/opt/android/android-ndk'
#     GRADLE_OPTS = "-Xmx1536M -Dorg.gradle.jvmargs='-Xmx1536M'"
#     PACKAGES_PATH = '/home/user/.buildozer/android/packages'
#     ANDROIDSDK = '/opt/android/android-sdk'
#     ANDROIDNDK = '/opt/android/android-ndk-r17c'
#     ANDROIDAPI = '28'
#     ANDROIDMINAPI = '21'
# 
# Buildozer failed to execute the last command
# If the error is not obvious, please raise the log_level to 2
# and retry the latest command.
# In case of a bug report, please add a full log with log_level = 2
Makefile:24: recipe for target 'release' failed
make: [release] Error 1 (ignored)
make[1]: Entering directory '/home/user/wspace/electrum/electrum/gui/kivy'
# Cleaning up
# rename main.py to electrum
# remove buildozer.spec
make[1]: Leaving directory '/home/user/wspace/electrum/electrum/gui/kivy'
~/wspace/electrum

Given the project itself claims to not produce reproducible output, we remain with the same conclusion and decide it is not verifiable.

Verdict Explained

Not verifiable: The provided Source Code could not be verified to match the app released on Google Play.

This verdict means that the provider did share some source code but that we could not verify that this source code matches the released app. This might be due to the source being released later than the app or due to the provided instructions on how to compile the app not being sufficient or due to the provider excluding parts from the public source code. In any case, the result is a discrepancy between the app we can create and the app we can find on GooglePlay and any discrepancy might leak your backup to the server on purpose or by accident.

As we cannot verify that the source provided is the source the app was compiled from, this category is only slightly better than closed source but for now we have hope projects come around and fix verifiability issues.

The app cannot be independently verified. If the provider puts your funds at risk on purpose or by accident, you will probably not know about the issue before people start losing money. If the provider is more criminally inclined he might have collected all the backups of all the wallets, ready to be emptied at the press of a button. The app might have a formidable track record but out of distress or change in management turns out to be evil from some point on, with nobody outside ever knowing before it is too late.