If you are thinking of becoming a validator on blockchain the Ethereum node is one of the most popular and reasonable nodes you can run. One reason we choose to run an Ethereum node is that Ethereum transitioned to proof-of-stake.
The Merge allows the execution and consensus clients to work together to verify Ethereum's state. Thus, with Ethereum proof-of-stake, we can save costs for our hardware, electricity bills, and any overhead costs that we would expect when we take on this project.
In this guide, we chose to run an Ethereum node on a Raspberry Pi, which is one of the smallest computers in the market. Read on to learn how we run an Ethereum node on a Raspberry Pi.
Step 1: The Shopping List
Choosing The Hardware
- Raspberry Pi 4 Model B 8GB
- USB Type C Power Supply - 3 amps
- MicroSD Card Samsung Evo 256GB U3 Class 10
- Heatsinks
- USB 3.0 Samsung T7 Solid State Drive (SSD) 1TB
- Ethernet Cable Cat 5e
- Raspberry Pi Casing
- Keyboard
- Monitor
- Mini HDMI to HDMI cable
Choosing The Software
- Ubuntu Server 22.04.1 LTS (RPi Zero 2W/3/4/400) 64-bit server OS with long-term support for arm64 architectures
The operating system that we chose to run on our Raspberry Pi is the Ubuntu Server 22.04 because it is the latest version of the Ubuntu Server and it comes with the latest updates and security.
There are, of course, a variety of other options for nodes and setup tools that we can choose from such as:
- RocketPool
- Vouch + Dirk
- Stereum
- Avado
- Ethereum on Arm
- eth-docker
- DAppNode
We are going to use RocketPool to set up our Ethereum node.
Step 2 Preliminary Setup
Once you have all the hardware ready, we can jump into building your node. The next thing you would need to do is to install the software. Here’s a step-by-step guide on how to install the software you would need for your Ethereum node.
Installing Ubuntu Server on Raspberry Pi
- Install Raspberry Pi Imager on your PC/Mac. You can use this Raspberry Pi Imager link to download the software. Once the program had been installed, open the Pi Imager.
- Connect the MicroSD card to the adapter and plug it into your PC or Mac.
- Choose OS from Imager. We recommend the latest version of the Ubuntu Server.
- Choose your MicroSD card by clicking on Choose Storage.
- Click on the Settings button and enable these:
Set a hostname, for ease you can just put in raspberry pi or any other name according to your preference. The hostname will appear in the ubuntu when you log in.
Check Enable SSH and toggle Use Password Authentication.
Check Enable username and password. Then set your name and password here. This is to login into your ubuntu.
Check the Configure Wireless LAN if you use WiFi and ignore it if you use the Ethernet cable.
Check Eject media when finished
Click on the Save button
- Press Write. Click on Yes when it prompts a warning that you are going to erase all the data in the SD. Then write the OS into your SD card and verify the card.
- Remove SD card.
Mounting the hardware
- Insert your SD card into the Raspberry Pi.
- Connect a keyboard to the USB 2.0 port (non-blue color).
- Connect your SSD to the USB 3.0 port.
- Connect an Ethernet cable. This step is optional if you use WiFi.
- Connect the HDMI cable to the monitor and Pi.
- Install the heatsinks. This step is vital to prevent your Raspberry from overheating.
- Connect the power input to turn on your Pi.
- Let it boot into Ubuntu.
SSD Setup
- Log into Ubuntu Server using the username and password you have created before.
- Next, we are going to format and create a new partition for the SSD. This will be the main partition to store your blockchain data.
Run this command to check the location of your SSD.
sudo lshw -C disk
Take note of the logical name. In this case,
/dev/sda
Run this command to create a new partition table.
sudo parted -s /dev/sda mklabel gpt unit GB mkpart primary ext4 0 100%
Format a new partition with ext4 file system.
sudo mkfs -t ext4 /dev/sda1
Add a label to the partition. This is optional.
sudo e2label /dev/sda1 "Rocket Drive"
To confirm that this is working, run this:
sudo blkid
You should see something like this.
Please take note of the UUID value. Save it because you would need it later.
- Next, we need to optimize the partition that we have created before. The defaults setting of ext4 will reserve 5% for system processes but because we need to store the chain data, we do not need that.
sudo tune2fs -m 0 /dev/sda1
- Create a new mount point.
sudo mkdir /mnt/rpdata
- Mount the directory to your SSD.
sudo mount /dev/sda1 /mnt/rpdata
- Enable automount to allow automatic detection of the directory when you reboot your Pi. Now we will need to use the UUID value that we have saved previously. Run this command to open the file editor:
sudo nano /etc/fstab
- Go to the last line and add this line. Replace <UUID VALUE> with the UUID value that you have saved previously.
The last step in setting up your SSD is to test the SSD performance. The recommended minimum speed is 15k IOPS for read with at least 60 MiB/s bandwidth and 5k IOPS for write with at least 20 MiB/s bandwidth. We usually call it 15k/5k. The maximum speeds that we got from the Samsung T7 are 12k read with 46.9MiB/s bandwidth and 4k write with 15.7MiB/s bandwidth. This is below the recommendation but still, it can get the job done.
To check the performance of the SSD, we will be using a software called Fio. Install Fio by running this command.
sudo apt install fio
Move to SSD’s mount point which is /mnt/rpdata
cd /mnt/rpdata
Now run the test using this command
sudo fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75
As the result, it should look like this:
Setting up Node Clients
- Choosing Ethereum Client
A reminder before you proceed to install eth clients, you should first need to take a look at the distribution in the network. Take a look at this client diversity website and get an overall outlook on the client distribution and the percentage of validators in the market share.
- Choosing Execution and Consensus Clients
Choosing the best pair for execution and consensus clients can be really important for a more resilient network. Choosing a minority client over a major client can really help you avoid your validator node from being slashed. The percentage below 50% and highlighted green are indicators of which clients you can safely choose to use.
Since we are running the node on Raspberry Pi, the recommended client pair is Geth for the execution client and Nimbus for the consensus client. Now let's continue with the most important thing which is installing the node tool, RocketPool.
Installing RocketPool Smartnode
There are a few options for us to install RocketPool’s Smartnode which are:
- Docker
- Hybrid
- Native
The easiest Smartnode to use is Docker since you would not have to do many configurations as it is already configured for you. Additionally, it is also suitable for those who want to run the node from scratch.
You can opt for the hybrid mode if you have an existing client that runs on other machines.
As for the native mode, if you want to directly install the node software into the machine, then you can choose this mode.
In this guide, we will be using docker mode since it is straightforward and easy to configure.
of our guide will be helping you install and configure RocketPool.
Follow us on Instagram and Twitter to get more updates or check out our curated news page at DefiDive.