Blog

Maximize your Bitcoin privacy with a streamlined deployment of a Dockerized Electrum server

Maximize your Bitcoin privacy with a streamlined deployment of a Dockerized Electrum server

As privacy advocates, we are committed to making the setup process as effortless as possible. That's why we have created a Dockerized Electrum server, requiring minimal input and configuration on your part for optimal privacy protection.

A Solution to the Privacy Concerns with the Default Electrum Configuration 

Are you tired of having to send hashes of your Bitcoin addresses to an Electrum server that is vulnerable to being spied on? Chris Belcher has created Electrum Personal Server (EPS), a more secure and private solution for your Electrum Bitcoin wallet.

EPS operates as a full node server, downloading the entire blockchain and scanning it for your own addresses. This eliminates the need to send your Bitcoin addresses to an outside server. Additionally, EPS is lightweight, compatible with Bitcoin Core pruning, and supports Tor to prevent traffic analysis. Yet, despite all these upgrades, you'll still enjoy the traditional Electrum wallet interface and functionality.

Unfortunately, the setup of EPS can be complex. That's why, as privacy advocates, we have created a Dockerized version of Electrum Personal Server, allowing for easy deployment with minimal input and configuration. This guide will provide further ease by building on our repo instructions. Take control of your privacy and try EPS today!

Preparations for Deploying Electrum Personal Server


To run Electrum Personal Server, you will need minimal resources such as CPU, RAM, and disk space. In fact, a full node setup will require only a few GB of disk space, which can be reduced further by using pruning. For the purpose of this tutorial, we'll be using Ubuntu 20.04, but the steps can be adapted to other Unix-like systems with some slight modifications to the commands.

You'll require both Docker and Docker Compose to get started. You can either follow our step-by-step Docker Compose guide or execute the following command to install both:


apt update -y && apt install docker docker-compose -y


For added privacy, it is recommended to run Tor on both your Electrum Personal Server machine and Electrum client machine, especially if they are hosted on different servers such as a VPS. To install Tor, you can use the following command:


apt update -y && apt install tor -y


Step by Step Guide to Setting Up a Dockerized Electrum Personal Server with Tor Integration


Are you looking to secure your Bitcoin transactions with the added privacy of Tor? Here's a comprehensive guide to setting up a Dockerized Electrum Personal Server (EPS) with Tor integration on both the host machine and the Electrum client machine.

Preparation

For non-root users, add your user to the tor group or debian-tor group and log out: 

sudo usermod -aG debian-tor YourUser


Download Tor for Windows or macOS.
Clone the EPS Repository
Clone the Dockerized EPS repository using the following command: git clone https://github.com/BitLaunchIO/docker-electrum-personal-server.git
Configure Tor on the Host Machine

Copy the torrc config file from the repo to /etc/tor/torrc: 

cp docker-eps/torrc /etc/tor/torrc

Restart the Tor service: 

systemctl restart tor

Configure Tor on the Electrum Client Machine
Create a torcc file in /etc/tor/torcc on Linux, or in TorBrowser\Browser\TorBrowser\Data\Tor for Windows or ~/Library/Application Support/TorBrowser-Data/Tor for macOS.

Add the following lines to the torcc file:

  • User tor
  • ControlPort 9051
  • CookieAuthentication 1
  • CookieAuthFileGroupReadable 1


Save the changes and restart Tor: 

sudo systemctl restart tor

Configure the EPS

Add your public Electrum wallet keys to the config.ini file on the EPS host machine: 

sudo nano docker-eps/config.ini

Edit the bitcoin.conf file to include the necessary tor nodes for blockchain synchronization: 

sudo nano docker-eps/bitcoin/bitcoin.conf

With these steps completed, you will have a fully functional Dockerized Electrum Personal Server with Tor integration, providing added privacy and security to your Bitcoin transactions.

How to restart the Tor service using the Linux command line

To restart the Tor service on a Linux machine, use the following command:

systemctl restart tor

Instructions for configuring Tor on your Electrum client machine:
If you are using Tor with your Electrum client, you will need to create a torcc file. 

On Linux, you can create the file by running the following commands:

cd docker-eps sudo nano /etc/tor/torcc

For Windows, the file is located in

TorBrowser\Browser\TorBrowser\Data\Tor and can be edited with any text editor. 

On macOS, the torcc file can be found in ~/Library/Application Support/TorBrowser-Data/Tor. If the folder is hidden, you can use the "Go to Folder…" option in Finder and type in the path.

In the torcc file, add the following lines or replace the existing lines with these:
User tor ControlPort 9051 CookieAuthentication 1 CookieAuthFileGroupReadable 1

After making the changes, save the file using Ctrl + O (nano) or Ctrl + S (other OSes) and restart Tor using the command:

sudo systemctl restart tor

Steps for configuring Electrum Personal Server

To allow Electrum Personal Server (EPS) to scan for transactions and your addresses, you need to add your public Electrum wallet keys to the config.ini file on your Electrum server host. To modify the config file, use the following command:

sudo nano docker-eps/config.ini

Then, add the following lines to the file, replacing "xpubkey" and "zpubkey" with your actual public wallet keys:

mywallet = xpubkey myotherwallet = zpubkey

After saving the changes using Ctrl + O, exit the file using Ctrl + X.
You also need to edit your bitcoin.conf file to include the necessary tor nodes for syncing to the blockchain. Use the following command to edit the config file:

sudo nano docker-eps/bitcoin/bitcoin.conf

Get the addresses of some onion nodes from Google or the wiki, and paste them into the config file using the following format:

addnode=btcnode1.onion addnode=btcnode2.onion

Save the changes and exit the file using Ctrl + O and Ctrl + X.

Starting the containers

With the configuration and setup complete, you can now start the containers. Note that bitcoin core has to sync the blockchain for the first time, which may take days or even weeks depending on your internet speed and hardware. To start the container, run the following command:

cd docker-eps && docker-compose up --build -d

Once the blockchain is fully synced, create a wallet on your docker-eps host server by running the following command:

docker exec -t docker-eps_bitcoind_1 bitcoin-cli createwallet electrumpersonalserver

To perform a rescan for historical transactions, you need to disable pruning. Edit the bitcoin.conf file with the following command:

sudo nano docker-eps/bitcoin/bitcoin.conf

Comment out the line starting with "prune=550" by adding a "#" symbol in front of it, save the document, and then edit the Dockerfile.eps by running:

sudo nano docker-eps/Dockerfile.eps

Comment out the line starting with "CMD ["electrum-personal-server
Once you've set up your EPS, you may need to be patient while it syncs with the blockchain. If you face any issues or want to personalize EPS even further, take advantage of the extensive resources available on its official wiki, including step-by-step instructions and supplementary setup guides. If you're a Crypadvise customer, you can also get in touch with our 24/7 live chat support for immediate assistance.