I've been tempted to run own ElectrumX
server for quite some. First attempt was to run this on Turris Omnia router
, however that turned out to be impossible due to memory requirements both Bitcoind and ElectrumX have.
This time I've dedicated host for this and it runs fine:
The server runs Debian sid (probably it would be doable on stretch as well, but I didn't try much) and the setup was pretty simple.
First we need to install some things - Bitcoin daemon and ElectrumX dependencies:
# Bitcoin daemon, not available in stretch
apt install bitcoind
# We will checkout ElectrumX from git
apt install git
# ElectrumX deps
apt install python3-aiohttp
# Build environment for ElectrumX deps
apt install build-essentials python3-pip libleveldb-dev
# ElectrumX deps not packaged in Debian
pip3 install plyvel pylru
# Download ElectrumX sources
su - electrumx -c 'git clone https://github.com/kyuupichan/electrumx.git'
Create users which will run the services:
Now it's time to prepare configuration for the services. For Bitcoin it's quite simple - we need to configure RPC interface and enable transaction index in
The ElectrumX configuration is quite simple as well and it's pretty well documented
. I've decided to place it in
I've decided to control both services using systemd, so it's matter of creating pretty simple units for that. Actually the Bitcoin one closely matches the one I've used on Turris Omnia
and the ElectrumX the one they ship
, but there are some minor changes.
Systemd unit for ElectrumX in
And finally systemd unit for Bitcoin daemon in
Now everything should be configured and it's time to start up the services:
# Enable services so that they start on boot
systemctl enable electrumx.service bitcoind.service
# Start services
systemctl start electrumx.service bitcoind.service
Now you have few days time until Bitcoin fetches whole blockchain and ElectrumX indexes that. If you happen to have another Bitcoin node running (or was running in past), you can speedup the process by copying blocks from that system (located in
). Only get blocks from sources you trust absolutely as it might change your view of history, see Bitcoin wiki
for more information on the topic. There is also magnet link in the ElectrumX
docs to download ElectrumX database to speed up this process. This should be safe to download from untrusted source.
The last think I'd like to mention is resources usage. You should have at least 4 GB of memory to run this, 8 GB is really preferred (both services consume around 4GB). On disk space, Bitcoin currently consumes 170 GB and ElectrumX 25 GB. Ideally all this should be running on the SSD disk.
You can however offload some of the files to slower storage as old blocks are rarely accessed and this can save some space on your storage. Following script will move around 50 GB of blockchain data to
(use only when Bitcoin daemon is not running):
find . -type f \( -name 'blk00*.dat' -o -name 'rev00*dat' \) sed 's@^\./@@' while read name ; do
mv $name $DEST/$name
ln -s $DEST/$name $name
Anyway if you would like to use this server, configure btc.cihar.com in your Electrum client.
If you find this howto useful, you can send some Satoshis to