`The server indexes the entire Bitcoin blockchain, and the resulting index enables fast queries for any given user wallet, allowing the user to keep real-time track of his balances and his transaction history using the Electrum wallet. Since it runs on the user's own machine, there is no need for the wallet to communicate with external Electrum servers, thus preserving the privacy of the user's addresses and balances.` - https:/github.com/romanz/electrs
Requires 47 Gb diskpace (March 2019).
Tested on:
- Raspberry Pi 4
- Odroid HC1 and XU4 (~18 hours)
- Raspberry Pi 3 B+ (~two days to build the database from scratch). For the RPi3 the lighter weight Electrum Personal Server is a good alternative, but only watches the preconfigured addresses and xpubs.
To download and run on the RaspiBlitz (logged in as the user admin
):
$ wget https://github.com/openoms/bitcoin-tutorials/raw/master/electrs/electrs_to_RaspiBlitz.sh && bash electrs_to_RaspiBlitz.sh
This will install:
- Rust
- Electrs
- Nginx for connecting through SSL with a self-signed certificate
- Tor Hidden Service if Tor is active
Electrs will only start serving on the port 50001 when it has finished indexing.
-
$ sudo systemctl status electrs
-
$ sudo journalctl -n 10000 | grep electrs
To monitor continuously add
-f
-
$ sudo -u electrs lsof -i
Look for the output:
electrs 2532 admin 17u IPv4 32885 0t0 TCP *:50001 (LISTEN)
-
htop
Take note of the CPU and RAM usage.
If running the always-on electrs service is taking up too much RAM of your RPi3:
-
stop the service with:
$ sudo systemctl stop electrs
-
stop running on boot:
$ sudo systemctl disable electrs
-
start again (and wait for it to catch up):
sudo systemctl start electrs
-
re-enable on boot
sudo systemctl enable electrs
-
Follow the instructions on https://electrum.org/#download and verify the GPG signature.
-
The instruction are in the script: electrum_wallet.sh
Tested on Ubuntu 18.04.
To download and run on the Linux desktop:
$ wget https://raw.githubusercontent.com/openoms/bitcoin-tutorials/master/electrs/electrum_wallet.sh && bash electrum_wallet.sh
On Windows or Mac set the server in the Electrum GUI or adapt the config file.
Command syntax for Linux systems:
-
$ electrum --oneserver --server RASPIBLITZ_IP:50001:t
-
$ electrum --oneserver --server YOUR_DOMAIN:50002:s
After a reinstall will need to delete the SSL certificate from the Electrum data directory to be able to connect again to the same domain:
- on Linux delete the relevant file from the
~/.electrs/certs
directory
- on Linux delete the relevant file from the
-
To connect through Tor (see how to set up a Hidden Service)
Take note of the Hidden Service address on the RaspiBlitz:
$ sudo cat /mnt/hdd/tor/electrs/hostname
-
Start electrum with the Tor Browser open (proxy on port 9150):
$ electrum --oneserver --server Tor_address.onion:50001:t --proxy socks5:127.0.0.1:9150
-
With Tor installed and running (proxy on port 9050):
$ electrum --oneserver --server Tor_address.onion:50001:t --proxy socks5:127.0.0.1:9050
-
Any communication outside a secure LAN must be encrypted.
-
Forward the port 50002 on the router to be able to access electrs from the outside of the LAN.
Can be used as the secure backend of:
Electrum wallet (desktop and mobile) BitBox App
For the Eclair Mobile Bitcoin and Lightning wallet the server needs to have a CA validated certificate for which the usage of certbot/letsencypt is required.
-
Tor Hidden Service
Need to activate Tor on the RaspiBlitz + on the computer used for Electrum and configure a Tor Hidden Service for Electrs.
See the guide from @cryptomulde about How to Connect Electrum to Raspiblitz electrs-server via Tor - based on this guide
-
See the guide from @cryptomulde to connect to a VPS through a reverse ssh tunnel.
The setup has multiple components and dependencies which can change when updated or modified by the maintainers.
Based on:
Shared experiences:
Notes on using Electrum with Tails
If you run into problems:
- if after a reinstall Electrum would not connect try deleting the relevant certificate from the .electrum/certs directory on your desktop.
- try to run the commands manually one-by-one, spot which is causing the problem and copy the output
- open an issue here with the details and I will be happy to help to solve it
Bear in mind that this guide and the parts used are free-opensource projects, use them at your own responsibility and there are no guarantees of any kind.