Eth2 node, at home, without a monitor
By: Vedant Agarwala
Tags: Proof Of Stake, Ethereum, Eth2, Servers, Home Server

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

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:

The Lighthouse Validator Client (VC) and Beacon Node (BN) processes handle unexpected exits. PC to boot into Ubuntu, once turned on Ubuntu to connect to the internet 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!