Hosted Ethereum Nodes & Load Balancing

Joey Krug

There aren’t many guides on how to get easily scalable Ethereum node infrastructure that actually works decently well out there, so here’s a simple [albeit if not the most cost effective] approach.

First create some droplets on DigitalOcean. Something like the 8 GB + 160 GB of SSD space one will work well for this and cost you about $40/mo. Ssh in or use the GUI to click and open the console.

Once you’re in we’ll install supervisor to restart geth and keep it running if it goes down, install go-ethereum, and open ports needed to access it from the outside world. Run these in the command line. You may need to use sudo for some

apt-get install supervisor
apt-get install software-properties-common
add-apt-repository -y ppa:ethereum/ethereum
apt-get update
apt-get install ethereum
ufw allow 8545
ufw allow 8546

Next we want to enable the supervisor to manage geth:

nano /etc/supervisor/conf.d/geth.conf

For the content, you want something like this:

command=/usr/bin/geth --ws --wsorigins '*' --wsaddr "" --rpc --rpcaddr "" --rpccorsdomain '*' --cache 4096

Then restart the supervisor which should launch geth and start syncing

$ supervisorctl reload

Next, you can use the IP of your node on digital ocean to then use as an ethereum rpc or ws address for anything (metamask, dapps, etc.). However, to continue and build something with multiple nodes all behind a load balancer, what you want to do next is take a snapshot of your droplet you configured above and create new droplets using that snapshot [you can do this all from the digital ocean UI].

Then after that you want to create a load balancer on digital ocean [also in the UI]. Add your droplets to it, then you’ll also want to add forwarding rules to forward traffic on:

HTTP on port 8545 -> HTTP on port 8545TCP on port 8546 -> TCP on port 8546

Finally, enable sticky sessions. This way, you’ll run into less issues with getting inconsistent data when accessing nodes through the load balancer. Going forward, you can use the IP of your load balancer that digitalocean gives you as your RPC address for ethereum use cases.

Joey Krug

Written by

Joey Krug

Founder @ Augur, Co-CIO @ Pantera Capital

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade