Skip to content

Instantly share code, notes, and snippets.

@h4x3rotab
Created March 23, 2021 11:33
Show Gist options
  • Select an option

  • Save h4x3rotab/e5adcf0fae04e5258b23120a57a39ca2 to your computer and use it in GitHub Desktop.

Select an option

Save h4x3rotab/e5adcf0fae04e5258b23120a57a39ca2 to your computer and use it in GitHub Desktop.

Deploy ElectrumX Server On Ubuntu

Here are the steps required to run electrumX for BitcoinGold wallet ElectrumG. Replace the variables according to your setup.

  • $username is the username under which electrumX will run
  • $rpcuser$ and $rpcpass are form the conf of bitcoindgold.conf

Before run

Make sure you have at least 30G ~ 40G free space on your device, and you have enabled txindex=1 in bitcoingold.conf

Install package dependencies

Assume that you have clone the electrumX source code to your local machine. BitcoinGold can run with the latest electrumX

sudo apt-get install python3-setuptools python3-multidict python3.7 python3.7-dev libleveldb-dev
cd electrumX
sudo python3 setup.py install

Both python3.7x and python3.8x can work

Setup electrumX config files

sudo cp contrib/systemd/electrumx.service /etc/systemd/system/
sudo nano /etc/systemd/system/electrumx.service

Fill the following contents into the file:

[Unit]
Description=Electrumx
After=network.target

[Service]
EnvironmentFile=/etc/electrumx.conf
ExecStart=<your electrumX code root>/electrumx_server
User=<username>
LimitNOFILE=8192
TimeoutStopSec=30min

[Install]
WantedBy=multi-user.target

Create electrumX data folder. Here we create /mnt/blockstorage/electrumx-data on our machine

Create service config file

nano /etc/electrumx.conf

Fill the following contents into the file:

COIN = BitcoinGold
DB_DIRECTORY = /mnt/blockstorage/electrumx-data
DAEMON_URL = http://<rpcuser>:<rpcpass>@<daemon url>:8332/
SERVICES = tcp://:50001,ssl://:50002,wss://:50004,rpc://0.0.0.0:8000
SSL_CERTFILE = /mnt/blockstorage/electrumx-data/electrumx.crt
SSL_KEYFILE = /mnt/blockstorage/electrumx-data/electrumx.key
EVENT_LOOP_POLICY = uvloop
PEER_DISCOVERY = self
INITIAL_CONCURRENT = 50
COST_SOFT_LIMIT = 10000
COST_HARD_LIMIT = 100000
BANDWIDTH_UNIT_COST = 10000
ALLOW_ROOT = 1

Put your own ssl cert files into electrumX data directory, now you can run electrumX with command

sudo systemctl start electrumx.service

And check electrumX log info with command

journalctl -f | grep electrumx_server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment