main logo
/

A Guide To Running A Raspberry Pi Ethereum Node

27th March 2023

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

01-min.webp

  • 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

02-min.webp

  • 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:

  1. RocketPool
  2. Vouch + Dirk
  3. Stereum
  4. Avado
  5. Ethereum on Arm
  6. eth-docker
  7. 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

  1. 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.

03-min.webp

  1. Connect the MicroSD card to the adapter and plug it into your PC or Mac.
  2. Choose OS from Imager. We recommend the latest version of the Ubuntu Server.

04-min.webp

  1. Choose your MicroSD card by clicking on Choose Storage.
  2. Click on the Settings button and enable these:
    1. 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.

    2. Check Enable SSH and toggle Use Password Authentication.

    3. Check Enable username and password. Then set your name and password here. This is to login into your ubuntu.

    4. Check the Configure Wireless LAN if you use WiFi and ignore it if you use the Ethernet cable.

    5. Check Eject media when finished

    6. Click on the Save button

  3. 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.

05-min.webp

  1. Remove SD card.

Mounting the hardware

  1. Insert your SD card into the Raspberry Pi.
  2. Connect a keyboard to the USB 2.0 port (non-blue color).
  3. Connect your SSD to the USB 3.0 port.
  4. Connect an Ethernet cable. This step is optional if you use WiFi.
  5. Connect the HDMI cable to the monitor and Pi.
  6. Install the heatsinks. This step is vital to prevent your Raspberry from overheating.

06-min.webp

  1. Connect the power input to turn on your Pi.
  2. Let it boot into Ubuntu.

SSD Setup

  1. Log into Ubuntu Server using the username and password you have created before.
  2. 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. 
  3. Run this command to check the location of your SSD.

    sudo lshw -C disk

07-min.webp

  1. Take note of the logical name. In this case, 

    /dev/sda

  2. Run this command to create a new partition table.

    sudo parted -s /dev/sda mklabel gpt unit GB mkpart primary ext4 0 100%

  3. Format a new partition with ext4 file system.

    sudo mkfs -t ext4 /dev/sda1

  4. Add a label to the partition. This is optional.

    sudo e2label /dev/sda1 "Rocket Drive"

  5. To confirm that this is working, run this:

    sudo blkid

You should see something like this. 

08-min.webp

Please take note of the UUID value. Save it because you would need it later. 

  1. 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

  1. Create a new mount point.

sudo mkdir /mnt/rpdata

  1. Mount the directory to your SSD.

sudo mount /dev/sda1 /mnt/rpdata

  1. 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

09-min.webp

  1. Go to the last line and add this line. Replace <UUID VALUE> with the UUID value that you have saved previously.

10-min.webp

  1. 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:

11-min.webp

Setting up Node Clients

  1. 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.

  1. 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.

Part 2 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.

Copyright DefiDive © 2024