Eth2 node, at home, without a monitor

Vedant Agarwala
8 min readMay 17, 2021

I was evaluating options to run an Eth2 proof-of-stake node. My initial thought was to host on AWS. For the machine I had selected it was~$300/month (primarily because of the 500GB SSD). Didn’t seem like a lot, until I realised

I can get a full desktop setup in ~$220!

I already had a monitor, keyboard and mouse. I found a refurbished computer dealer nearby, to which I had to install a new 256GB SSD. SSDs are recommended to run nodes because they are quite I/O heavy. Resulting computer specs:

  • Core i5 4th gen, 4 cores, 3.2 GHz
  • 8 GB RAM
  • 256 GB SSD

Best part: I could upgrade the RAM and SSD myself whenever wanted to.

To setup an ethereum node, most guides that I referred to, assumed a computer with physical access. I’m compiling my experience to set it up as a remote computer on the local network. I use my MacBook’s terminal to connect to it.

The hardware setup

I got a new machine delivered to my place 🎉. I was surprised to see how small desktop PCs have become (I got one after more than a decade)!

The Dell CPU (Pen and WiFi router for comparison)

I was really excited to start using it. But alas, I didn’t have the correct cable to connect to my monitor (there’s a difference between a DP and HDMI cable). Also, no way to connect to the internet- my machine only has an ethernet port, and my wifi router physically far from my work desk (with the monitor and CPU). So I ordered a USB WiFi card, and DP cable; and started waiting for 4 long days.

In the meantime, I faced a dilemma- in the long run should I

  1. connect my monitor, keyboard and mouse to the machine, or,
  2. just SSH into the machine from my Mac and use only the terminal to set up my node.

I wasn’t sure how I’d do option 2, so I went ahead with option 1 (for now).

OS installation

My computer came pre-installed with Windows. I knew I wanted to install Ubuntu LTS on it- I have used it before on a PC and always use it on cloud servers. Using my MacBook, I downloaded a 64bit ISO file (get the latest LTS release ISO here). Following the official guide I created a bootable USB in a few mins.

I inserted the USB in the new machine, restarted, and booted from USB. Then, I followed the guide to install and everything worked perfectly. WiFi connected without any hassle. I decided to do a fresh install (remove Windows) instead of worrying about how to partition my SSD. Easy peasy.

Screen after ubuntu successful install

For some reason my wireless mouse wasn’t working, even with the provided USB access point. I struggled a bit but gave up thinking do I need a mouse? Turned out, I didn’t need a mouse after all. I had to google a few ubuntu shortcuts but that was it. Only, I couldn’t use any internet browser.

I quickly resorted to using 2 computers- my Mac’s browser and doing the rest on the Ubuntu terminal with just a keyboard.

In hindsight, I could have installed ubuntu server instead. There isn’t much different between the two except the packages that come bundled with them. For now, I installed the packages from ubuntu (credits to this AskUbuntu post):

sudo apt install ubuntu-server

Eth2 Software setup

I will not go into detail on how to setup the eth2: Validator Client (VC) and Beacon Node (BN). Other guides do a much better job: Launchpad on Ethereum, The Lighthouse Book. Nevertheless, feel free to reach out to me (medium response, or twitter) if you need some help with it.

Going through the official eth2 launch guides, I decided on Infura as my eth1 node, and, lighthouse as my Validator Client (VC) and Beacon Node (BN). Lighthouse project is newer and has a few clients running it but I found its discord server to be super helpful. Special shoutout to @sproul and @pawan!

Good decision to go ahead with lighthouse!

From https://lighthouse.sigmaprime.io/

Why Infura

Infura provides a free eth1 node endpoint. Ideally I would have preferred to set it up on my own, primarily to promote decentralisation. However, I didn’t have 500 GB of free SSD space.

In the future, I might get a new standalone machine that runs an eth1 node. Now I’m confident I can setup new nodes at home. Additionally, I will have this machine as primary and infura as backup!

Code!

I used linux’s systemd to mange the lighthouse processes (reference). With some trial and error on testnet, I came up with configs that work well for me. Without delving into the details:

/etc/systemd/system/bn-mainnet.service:

[Unit]
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=3
User=vedant
ExecStart=/home/vedant/.cargo/bin/lighthouse bn \
--http \
--metrics \
--validator-monitor-auto \
--eth1-endpoints=https://mainnet.infura.io/v3/...

[Install]
WantedBy=multi-user.target

/etc/systemd/system/vc-mainnet.service:

[Unit]
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=3
User=vedant
ExecStart=/home/vedant/.cargo/bin/lighthouse vc --http --metrics
[Install]
WantedBy=multi-user.target
From https://launchpad.ethereum.org/

Moving to standalone machine

Setup local ssh

Since I had gone ahead with option 1. of my above mentioned dilemma, switching between the 2 setups was an inconvenience. In addition to mental context switching, I had to disconnect and connect my keyboard, and, switch the monitor input. It couldn’t be that hard to ssh onto my local machine over WiFi 🤔 It wasn’t.

ssh within a local network was a breeze!

I just had to install an addition package on my destination machine (the desktop):

sudo apt install openssh-server

Credits to this AskUbuntu answer. Then, I could just use the login password to connect!

Below is a snapshot. Note the different vedant@vedants-MacBook-Pro ~ % and vedant@vedant-OptiPlex-9020:~$ before and after login! 🤩

vedant@vedants-MacBook-Pro ~ % ssh 192.168.1.107
vedant@192.168.1.107's password:
Welcome to Ubuntu 20.04.2 LTS ..
...
vedant@vedant-OptiPlex-9020:~$

Reconnecting a keyboard and monitor may not sound like a lot, but removing this step increased my productivity by 10x!

Power and internet failure tests

Yes this is a real thing, and highly recommended:

Snapshot from https://launchpad.ethereum.org/en/checklist

Few things had to go right for my setup start working after a power failure:

  1. The Lighthouse Validator Client (VC) and Beacon Node (BN) processes handle unexpected exits.
  2. PC to boot into Ubuntu, once turned on
  3. Ubuntu to connect to the internet
  4. PC powers on, without me having to hit the power button on the cabinet.

Part 1, worked surprising well without any effort. Kudos to the lighthouse for the built-in resiliency!

For Part 2, I had to do some boot setup (Boot from UEFI, set Ubuntu as default, among others). Simple enough with some googling.

In Part 3, I hit a snag. Till now, I was quite comfortable with ssh’ing into the machine and not connecting the monitor/keyboard physically. But after a restart, I wasn’t able to do so 🤯! I connected physically to debug, to find out that for some reason WiFi wasn’t connected. I physically removed and inserted the USB WiFi card. Voila, it started working. I realised, I should use a wired ethernet connection instead of WiFi for better reliability and resiliency.

Time to revise my decide my decision and switch to option 2- use the desktop without a monitor or keyboard, and ssh to it instead.

So, I turned off the machine, picked it up, placed it next to my router and switched it on.

The desktop booted up and connected to the internet uneventfully! It has been sitting there since.

vedant@vedant-OptiPlex-9020:~$ uptime -p
up 4 days, 17 hours, 14 minutes

I had thought, in worst case scenario, I would have to temporarily pick up and move the monitor+keyboard for initial setup. But this never happened. The WiFi card and DP cable purchase are now just a cost of learning.

Part 4, I wasn’t sure if it was possible or not. To my pleasant surprise, the PC turned on automatically after I switched the power back on- no need to hit the power button. Desktops have come a long way; I feel they behave a lot like servers now!

My setup survives power interruptions, with just 2 cables connected to it (power and ethernet):

Firewall

I feel it is safe enough to allow ssh access from within the local network but not from the internet. I installed uncomplicated firewall or ufw. I added a rule like:

ufw allow proto tcp from 192.168.0.0/24 to any port 22

This allows any device on the local network to open an ssh connection (port 22 by default).

I still need to know the login password to connect. Key based ssh is an alternative (safer and no need to enter a password) but I haven’t set it up as yet.

Port forwarding

On my router I set a static IP to my desktop machine. I got its MAC address by running ifconfig.

router config snapshot

Now I don’t have to check the local IP every few days (router cycle through IPs). I had to set a static IP anyway, because I needed port forwarding to my lighthouse Beacon Node.

Monitoring

A reliable setup cannot be complete with monitoring and alerting.

Monitoring, naturally, has to be external to the machine: if the machine goes down, I should get notified

I opted for local prometheus + grafana cloud setup. Prometheus scrapes metrics exposed by lighthouse BN and VC and pushes them to grafana cloud. My prometheus.yml:

scrape_configs:
- job_name: 'lighthouse'
static_configs:
- targets: ['localhost:5054', 'localhost:5064']
group: 'mainnet'

- job_name: node
static_configs:
- targets: ['localhost:9100']

remote_write:
- url: https://prometheus-blocks-prod-us-central1.grafana.net/api/prom/push
basic_auth:
username: "..."
password: "<API KEY>="
Snapshots of the grafana dashboard

Aren’t these graphs just beautiful! 🤩

As for alerts, I get a notification on my phone when things go south. I have set a few alerts to notify me on discord.

Parting thoughts

Before taking on this project I was nervous: will I lose my hardware investment, will the upkeep effort be too high, or the worst, will I lose my 32 ETH investment?!

Turns out, it was just fear of the unknown. The current setup is working so well, I might even start providing p2p (peer-to-peer) nodes as service (DM me on twitter if you’re interested 😉) by setting up physical machines at home.

Sure, using cloud providers is easier. But it doesn’t bring joy like the blinking lights of a server that I setup myself!

--

--

Vedant Agarwala

Sr. Engineering Manager | Startup enthusiast, Public Speaker, Tech Blogger | 1 startup was acqui-hired.