Jump to content
Sign in to follow this  

ElectrumX Server Setup Guide

Recommended Posts

To run ElectrumX, use Ubuntu 16.04 and have the denariusd daemon already setup. I tried this first in a VM.

#install python 3.7

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7

#install pip

sudo apt-get install python-pip
sudo apt-get install python3-pip

#prepare for installing electrumx (this could use some pruning)

sudo apt-get install python3.7 python3.7-dev python3-pip libleveldb-dev libssl-dev python3-distutils
sudo -H python3.7 -m pip install plyvel pylru aiorpcx aiohttp
sudo apt-get install build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev cmake liblz4-dev
sudo python3.7 -m pip install --upgrade pip setuptools wheel
sudo apt-get install python3.7-dev
sudo python3.7 -m pip install --upgrade aiohttp pylru leveldb plyvel aiorpcx ecdsa tribus_hash

#Use electrumx installer script

wget https://raw.githubusercontent.com/bauerj/electrumx-installer/master/bootstrap.sh -O - | bash

#Use service electrumx start to start electrumx once it's configured
#Generating TLS certificates                                                                           
#electrumx has been installed successfully. Edit /etc/electrumx.conf to configure it.

Replace denariusrpc and the password with your stuff configured in denarius.conf in ~/.denarius/denarius.conf
Don't forget to have txindex=1 in your denarius.conf as well.

sudo nano /etc/electrumx.conf


# default /etc/electrumx.conf for systemd

COIN = Denarius
# Bitcoin Node RPC Credentials
DAEMON_URL = http://RPCUSERNAME:[email protected]:32369/

# See http://electrumx.readthedocs.io/en/latest/environment.html for
# information about other configuration settings you probably want to consider.


# Listen on all interfaces:

#run electrumx server

service electrumx start

#check its running

journalctl -u electrumx -f


openssl s_client -connect IPGoesHere:50002


  • Like 2

Join Denarius Discord - https://discord.gg/JQEmXwb

Share this post

Link to post
Share on other sites

Thanks to @manosv for the nice little kill cronjob to make sure the daemon isnt crashed out. Make sure you know where your denariusd is located for proper path.

crontab -e
25 */1 * * * /usr/local/bin/denariusd stop
26 */1 * * * /usr/bin/killall -q -9 denariusd
27 */1 * * * /usr/local/bin/denariusd 


  • Like 2

Join Denarius Discord - https://discord.gg/JQEmXwb

Share this post

Link to post
Share on other sites

I found my electrumx server crashed this morning.Apparently its a problem that happens with coin that have a short block intervals

the flush_count would overflow after 65536 which is about 455 days in Bitcoin if we were indexing a fully synced node. However this is not the case if the node is not fully synced and ElectrumX manages to catch up the full node. In that scenario ElectrumX will quickly exhaust the 16bit space of the flush_countvariable as it flushes to disk after each block.

according to this thread :



to fix it you have to do the following:

service electrumx stop

su electrumx  #This is critical for not messing with the permissions

export DB_DIRECTORY='/db'

export COIN=Denarius

export DB_ENGINE=leveldb

then issue the command:


after compacting happens then start it again with:

exit #to become root again

service electrumx start

Apparently this has to happen every 65536 blocks

for bitcoin this is every 455 days for Denarius though is way shorter than that

65536 * 20seconds  =15 days !!!!

Thats why you had a problem Carsen to keep them up and running


Edited by manosv
  • Like 1
  • Upvote 1

Share this post

Link to post
Share on other sites

So to automate all this i made the following script

service electrumx stop

export DB_DIRECTORY='/db'
export COIN=Denarius
export DB_ENGINE=leveldb


chown -R electrumx:electrumx /db

service electrumx start

name it whatever you want i went with


make it executable

chmod +x compact_electrum_database.sh

So then all we have to do is to make an entry to crontab to run automatically every lets say 12 days

issue the command as root

crontab -e 

and insert the following to run it automatically At 00 minutes past 1:00 on every 12 days of every month

0 1 */12 * * /root/compact_electrum_database.sh >/dev/null 2>&1

save it and you are good to go

Edited by manosv
  • Like 2

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...