This is an example procedure for setting up an Electrum-ECC Server on Digital Ocean. It should be trivial to adapt this to other cloud service providers or your own hardware.
Note that this is doubly firewalled - Digital Ocean firewall plus ufw.
- Create droplet ecc-0n [4x CPU, 8GB, 160GB : room for additional future services]
- Add droplet to Eccoin firewall definition [allow 22, 19118, 50002]
- Add dynamic DNS setup [No-IP or other]
- Reset root password
- sudo apt update; sudo apt upgrade
- Check that root login via Putty requires public key [root login will later be disabled]
- Add user ecc
- usermod -aG sudo ecc
- sudo ufw app list [check OpenSSH]
- sudo ufw allow OpenSSH
- sudo ufw allow 19118
- sudo ufw allow 50002
- sudo ufw enable
- ecc access key > ~/.ssh/authorized_keys
- Configure ssh /etc/ssh/sshd_config [disable root login, key access only, paranoid settings, no IP or X-11 forwarding, etc]
- sudo systemctl restart ssh
- sudo apt install fail2ban -y
- sudo systemctl status fail2ban
- configure fail2ban for ssh policing
- sudo systemctl restart fail2ban.service
- sudo systemctl enable fail2ban.service
- Install & sync eccoind
- Install ElextrumX 1.15.0
- sudo apt install python3-pip
- pip3 install aiorpcX==0.18.7
- pip3 install plyvel
- pip3 install pylru
- pip3 install aiohttp
- pip3 install scrypt
Release: https://github.com/project-ecc/electrumx/releases/tag/1.15.1
Documentation: https://electrumx.readthedocs.io/en/latest/
Note that ElectrumX 1.15.0 is the final version to have altcoin support. ECC then had to fork the parent project in order to incorporate support for the v3 and v4 new transaction formats introduced by eccoind 0.4.0.0 and the March 2020 fork. Do not be tempted to use a more recent version of the parent project !
If you don't have SSL keys to copy over from a prior installation:
server.crt
server.csr
server.key
then follow the procedure detailed here: https://electrumx.readthedocs.io/en/latest/HOWTO.html#creating-a-self-signed-ssl-certificate
Note that ElectrumX takes a long time to start the first time it's run. Watch stdout for progress. You may want to run it under screen if not properly setup as a systemd service.
Once synced with the eccoin blockchain, there is a second phase of startup which is (a) also lengthy [15-20 mins] (b) happens on every startup and (c) is silent in stdout terms. Watch CPU utilisation to discover when this is happening - top/htop/etc.
To improve automated server peer discovery, which in turn feeds through to client server discovery, add the following to the definition of class ECCoin /electrumx/lib/coins.py - immediately after RPC_PORT is fine. No need to add your own server because this info is used for other non-self servers. In theory any client app connecting to your server will also become aware of these other servers:
PEERS = [
'eccserver1.ddns.net s50002',
'eccserver2.ddns.net s50002']
We should really fork the repo because we can't get this change merged back in because we're using a prior version, with altcoin support having been removed in later versions.
Add the following 2 scripts to the standard ElectrumX install.
#!/bin/bash
export DB_DIRECTORY=database # relative path to the directory where the db files are stored
export DAEMON_URL=http://eccoinrpc:ecc123-OK-Maybeitneedstobemorecomplex@localhost:19119/
export COIN=ECCoin
export NET=mainnet
export HOST=
export SSL_CERTFILE=$(pwd)/server.crt
export SSL_KEYFILE=$(pwd)/server.key
export SERVICES=ssl://:50002,rpc://:8000
export REPORT_SERVICES=ssl://eccserver2.ddns.net:50002
export PEER_DISCOVERY=on
export DONATION_ADDRESS="EZ5Lj6dWPouwsMc9je2Vh1CwubQGauafa7" # visible in the client
./electrumx_server
NOTE - In REPORT_SERVICES substitute your server's URL or IP address
For use occasionally (monthly) for database maintenance or when the server falls over complaining about needing history compaction.
#!/bin/bash
export DB_DIRECTORY=database # relative path to the directory where the db files are stored
export DAEMON_URL=http://eccoinrpc:ecc123-OK-Maybeitneedstobemorecomplex@localhost:19119/
export COIN=ECCoin
export HOST=
export SSL_CERTFILE=$(pwd)/server.crt
export SSL_KEYFILE=$(pwd)/server.key
export SERVICES=ssl://:50002,rpc://:8000
export DONATION_ADDRESS="EZ5Lj6dWPouwsMc9je2Vh1CwubQGauafa7" # visible in the client
./electrumx_compact_history