A simplified guide to running your own Electrumx server

Use Electron-Cash a lot? It is an excellent wallet for Bitcoin Cash, and some would say it’s the best desktop wallet, for good reasons: It shuffles, there’s coin control, there are multiple servers so it’s almost never down, transactions are easily searchable and labeled, you can add arbitrary op_returns, there’s Schnorr signature support, you can use your own server…

Wait, did I say own server? Sounds like a chore, why would anyone ever want to do that, aside from “I’m a good guy and I want to serve the public”?

Well, for one, do you know all the addresses in your wallet are subscribed with the server you use – therefore the server operator can link your addresses, no matter how much you shuffle? We know some people like me do not track you, but there’s no telling what other operators might do! What if one of them is literally from the FBI?

There are proposals to mitigate this – to a certain extent – by altering the networking code in Electron-cash, but that is a non-trivial job and the timeline uncertain. While that is going on, there’s no substitute for running your own Electronx server – and serving other people in the process. This is the ultimate setup for network privacy, bar none.

“Ok, I think there is a guide, but it looks pretty intimidating, and there’s a lot of things unmentioned.”

Indeed it is, that’s why I’m going to attempt to simplify it a bit. I’ll only list one set of steps, and as long as you follow them you should be up and running in a day. Do you need to know how to get around Linux command line? Yes. Will this make your life easier? Hopefully.

  1. Obtain Linux KVM VPS (or dedicated) hosting. A minimum of 8GB RAM / 300GB disk / 4 core CPU / 5TB per mo bandwidth is recommended, the more the merrier – you do not need SSD, although that’s nice. Get Debian 9 or 10 preinstalled. Get a domain, and point it at your server’s ip.
  2. Make the necessary security adjustments: sudo apt update && sudo apt upgrade , close all firewall ports except SSH, 50002, 50001, 8333. Don’t be dumb, secure your server’s SSH login with either a long random password or public key.
  3. Under your home folder: Grab a bitcoind node (Bitcoin-ABC or Bitcoin Unlimited ), unpack it, make ~/.bitcoin/bitcoin.confand make sure you got daemon=1, server=1 rpcuser=yourusername, rpcpassword=yourpasswordand txindex=1 in there. Obviously do not literally put “yourpassword” there. Seriously.
  4. Run bitcoind: It’s recommended to run your bitcoind as a systemd service so it doesn’t die even if your server hiccups. To do that, make a file bitcoind.service under /etc/systemd/system, and follow a forking template. sudo systemctl enable bitcoind && sudo systemctl start bitcoind afterwards – the node should start syncing. Proceed to the next step.
  5. sudo apt install git python3-aiohttp build-essential python3-pip 
  6. sudo pip3 install pylru plyvel
  7. git clone https://github.com/Electron-Cash/electrumx.git
  8. cd electrumx && python3 ./setup.py build && sudo python3 ./setup.py install
  9. Don’t run it yet! Get your SSL certificate setup. You can either do a self-signed or Let’s encrypt; Let’s encrypt instructions can be found here, but I won’t go into the details. For a self–signed 5-year(!) certificate – good enough for anti-MiTM purposes – follow instructions here.
  10. Recommended: Get your Electrumx ran as a systemd service as well. Adapt from service file to your /etc/systemd/system/electrumx.service:

and /etc/electrumx.conf, substituting the obvious parts with your own:

DB_DIRECTORY = /home/user/.electrumx
COIN = BitcoinCash
NET = mainnet
ELECTRUMX = /usr/local/bin/electrumx_server.py
DB_ENGINE = leveldb
DB_DIRECTORY = /home/user/.electrumx
DAEMON_URL = http://user:yourpassword@

11. Make a folder /etc/electrumx, and put whatever you want in banner.txtunder it. Nerds like me will see your banner when connected and have a chuckle.

12. sudo systemctl enable electrumx && sudo systemctl start electrumx. Wait half a day.

13. You should now have a functional Electrumx server! Try it out by connecting via Electron-cash. Remember to keep your bitcoind updated every six months to keep up with the network! 🙂

14. Recommended: join the Electron-cash telegram to brag about your new server, or yell at me if the guide didn’t work. Submit an addition to preferred server list if you plan to keep it maintained – it’s good for your privacy, and good for everyone.

If I missed anything, let me know!