Linux Kamarada

Installing the Electrum Bitcoin wallet on Linux

Electrum is the Bitcoin wallet recommended by the official Bitcoin website (bitcoin.org) for Linux users who are starting to pĺay with bitcoins, so they are looking for an easy-to-use wallet, but also for those who want some more advanced features, such as Lightning Network support and integration with hardware wallets. Electrum allows you to easily recover your wallet from a secret phrase (seed).

It’s possible to install Electrum in some ways, from the quickest — and safe, but not so safe — for the hurried ones, to the safest rocky road for the cautious. Today I’m going to show you four ways of installing Electrum. See the options, choose your favorite one and hands-on!

At the moment, the latest version of Electrum is 4.0.5, released on November 18, 2020.

Here I use Linux Kamarada 15.2, which is a Linux distro based on openSUSE Leap 15.2.

1) openSUSE’s 1 Click Install

The Electrum Bitcoin wallet is not available on the official openSUSE repositories. But if you search for it at software.opensuse.org, you will find that it is available on the semi-official network:cryptocurrencies repository. If you are an openSUSE (or Linux Kamarada) user, getting the Electrum wallet from this repository is the easiest way to install it.

openSUSE Tumbleweed users are going to get Electrum 4.0.5, while openSUSE Leap 15.2 (and Linux Kamarada 15.2) users are going to get Electrum 4.0.2. That’s because the latest Electrum version depends on a Python library that is not yet available for Leap 15.2, which is python3-aiorpcX. That library is now available for Tumbleweed only.

There are two different methods for installing the Electrum wallet package on openSUSE: from the graphical interface using 1 Click Install or from the terminal using the zypper package manager — choose whichever method you prefer.

To install Electrum using 1 Click Install, just click the following button:

1 Click Install

To install Electrum using the terminal, first add the needed repository:

  • for openSUSE Leap 15.2 or Linux Kamarada 15.2:
1
# zypper addrepo -f https://download.opensuse.org/repositories/network:/cryptocurrencies/openSUSE_Leap_15.2/ cryptocurrencies
  • for openSUSE Tumbleweed:
1
# zypper addrepo -f https://download.opensuse.org/repositories/network:/cryptocurrencies/openSUSE_Tumbleweed/ cryptocurrencies

Then, install the Electrum package itself:

1
# zypper in electrum

The source code of this package can be found on the openSUSE Build Service. I’m familiar with packaging for openSUSE using the OBS — not least because I use that same infrastructure to build Linux Kamarada packages — so I inspected the source files, mainly the electrum.spec file. The files Electrum-4.0.5.tar.gz and Electrum-4.0.5.tar.gz.asc match those available on the official Electrum website. I believe it is safe to install Electrum from that openSUSE repository.

2) Installing Electrum with Flatpak

Flatpak is a distribution-agnostic package manager. Until recently, different Linux distros used different package formats, often incompatible with each other. For example, Debian and Ubuntu use DEB packages, while RedHat, Fedora and openSUSE use RPM packages. Flatpak brought a simpler alternative to install programs on different distros: as long as Flatpak is installed, the same Flatpak package can be installed on any distro.

There is a Flatpak package for the Electrum wallet. At the moment, it brings Electrum version 4.0.4. It is an alternative that allows openSUSE Leap and Linux Kamarada users to get a newer version of the wallet with ease.

First, to install Flatpak on openSUSE, in case you haven’t done it already, run:

1
# zypper in flatpak

After installing Flatpak, add the Flathub repository, which is the main Flatpak repository:

1
# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Finally, to install Electrum using Flatpak, run:

1
# flatpak install org.electrum.electrum

The source code of the Electrum Flatpak package can be found on GitHub. I haven’t inspected this source code because I don’t understand how Flatpak packaging is done. But I believe it’s just as safe to install Electrum using Flatpak.

Note that the Flatpak package, like the openSUSE package, was also contributed by the community. I haven’t found any mention to those packages on the official Electrum website.

3) Download from Electrum website

In fact, this is the recommendation of the Electrum’s creator: “do not download Electrum from another source than electrum.org, and learn to verify GPG signatures”.

However, it is worth noting that Electrum depends on the secp256k1 library, which can be easily installed from the official repositories of Linux distros such as Debian or Ubuntu, but is not available on the official openSUSE repositories.

That creates a problem for openSUSE users, which is installing this library before actually installing Electrum. It could be retrieved from the network:cryptocurrencies repo, but then it would make more sense to also install Electrum from that same repo (option #1). Another option is compiling both the library and the wallet from their source codes.

4) Compiling from source

People concerned about security are going to prefer compiling the Electrum Bitcoin wallet from its source code, because doing that makes it possible to verify the integrity and authenticity of the code. It’s also possible to audit the source before installing — as long as you have the knowledge and the time that requires, of course.

Start by installing everything you will need to compile and use both the Electrum wallet and the secp256k1 library. To do this, open the terminal and run the following command as root:

1
# zypper install autoconf automake gcc gettext-tools git libtool make python3-cryptography python3-devel python3-pip python3-requests python3-setuptools

To verify the integrity and authenticity of the source, we need to import the developer’s public key. I’m going to explain the process briefly, if you want more information, read:

Go to the official Electrum wallet website (electrum.org) and click Download. On the next page, click the ThomasV link at the beginning of the page, where it reads “Sources and executables are signed by ThomasV”:

Your browser downloads the developer’s public key, a file called ThomasV.asc. To import it, run the following command:

1
2
3
4
5
$ gpg --import ThomasV.asc

gpg: key 2BD5824B7F9470E6: public key "Thomas Voegtlin (https://electrum.org) <thomasv@electrum.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Optionally, if you have your own GPG key, sign the imported key:

1
2
3
4
$ gpg --edit-key 2BD5824B7F9470E6
> trust
> sign
> quit

Now let’s get the source of the Electrum wallet, which is hosted on GitHub:

1
2
3
$ git clone https://github.com/spesmilo/electrum.git
$ cd electrum
$ git submodule update --init

At the moment, the latest version of Electrum is 4.0.5, and the developer follows the good practice of creating a Git tag for each version. Check out the source code of this version:

1
$ git checkout 4.0.5

Source codes versioned with Git have their own way of verifying integrity and authenticity. To verify this source code on this specific tag, run:

1
$ git verify-tag 4.0.5

Make sure the good signature message appears:

1
2
3
4
5
gpg: Signature made qua 18 nov 2020 16:24:04 -03
gpg:                using RSA key 6694D8DE7BE8EE5631BED9502BD5824B7F9470E6
gpg: Good signature from "Thomas Voegtlin (https://electrum.org) <thomasv@electrum.org>" [ultimate]
gpg:                 aka "ThomasV <thomasv1@gmx.de>" [ultimate]
gpg:                 aka "Thomas Voegtlin <thomasv1@gmx.de>" [ultimate]

If the verification was successful, we can trust this source code and move on.

The Electrum source comes with a script to download and build the secp256k1 library, whose source is also hosted on GitHub. Run this script:

1
$ ./contrib/make_libsecp256k1.sh

The secp256k1 binaries are created inside the electrum folder, at contrib/secp256k1/dist/lib.

To install Electrum’s Python dependencies, run:

1
$ python3 -m pip install --user -e .

Optionally, to download and build Electrum translations, run:

1
$ ./contrib/pull_locale

At this point, you’re already able to start Electrum from the source folder:

1
$ ./run_electrum

Click Cancel to exit Electrum.

Note that to start Electrum from the source code, it is always needed to enter the source folder and run that command. For daily usage, it is more interesting to install Electrum.

To do this, start by copying the secp256k1 library to the system libraries folder:

1
2
# cp --preserve=links contrib/secp256k1/dist/lib/*.so.* /usr/lib64/
# ldconfig

Then, install the Electrum wallet:

1
$ python3 -m pip install --user .

Make sure the command informs that the installation was successful:

1
Successfully installed Electrum-4.0.5

You can close the terminal window now.

Finally, you can delete the electrum folder containing the source code, if you want. As the wallet has been installed on the system, this folder is not needed for everyday use. However, I recommend keeping it, as it may make it easier to update Electrum in the future.

Starting Electrum

Regardless of the installation method you have chosen, to start the Electrum Bitcoin wallet, click Activities, by the upper-left corner of the screen, type electrum and click its icon:

When run for the first time, Electrum presents a configuration wizard.

The goal of this how-to (installing Electrum) was met, so today I’m going to stop here.

Do you want to know more?

Using Electrum to make Bitcoin transactions will be the subject of a future post.

In the meanwhile, if you want to know more about bitcoins and the Electrum wallet, I recommend you this great guide:

Did you like it? What about sharing?

Would you buy me a coffee?
If you really liked it, if it was really helpful for you, is it worth a coffee? If you want, you can "buy me a coffee" with PayPal or contribute to the project in other ways.

Comments

About

The Linux Kamarada Project aims to spread and promote Linux as a robust, secure, versatile and easy to use operating system, suitable for everyday use be at home, at work or on the server. The project focuses mainly on distribution and documentation.

Ads

Facebook

Author