A Step by step manual to setup a Raspberry Pi for running a validator on the Altona Test-Net.
- Raspberry Pi B 8GB RAM
- Raspberry Pi Power Supply 3A USB-C
- MicroSD card (16GB)
- Case with heatsink and ventilator (e.g. Joy-it)
- External SSD (1TB) with USB 3
- USB Keyboard
- HDMI Kabel(mini to full)
- TV / Monitor with HMDI input
- Ethernet cable
- Ubuntu Server 20.04 for Raspberry Pi See here
- Balena Etcher See here
- Rust See here
- Go See here
- Lighthouse See here
Flash Ubuntu Server to microSD card
- Put microSD into the SD Card adapter and plug it into your PC / Mac.
- Download Ubuntu Server for Raspberry Pi and save the image on you Desktop.
- On Mac open the Etcher App, select the image and flash it to the microSD card.
- Put the microSD card into the Raspberry Pi.
Assemble Raspberry Pi Case
- Follow the instructions of the case you bought and assemble it.
- I can recommend the Joy-it case with two ventilators. Very easy and fast to open / close because it uses magnets.
Connectivity check before first Power up of the Raspberry Pi
- External SSD drive connected to Blue USB 3 Port.
- Usb Keyboard connected.
- Ethernet cable connected to Router.
- HDMI cable connected to Monitor / TV
- Lastly connect power supply into socket.
How to get the IP / hostname to connect remotely
If the MicroSD card has been flashed correctly you should see a terminal screen after 1-2 minutes which says:
Username: ubuntu Enter Password:
Type in ubuntu for username and password. You are going to create a new user for the main tasks and disable ubuntu user to access via SSH.
Now you want to know what the IP address is for the Raspberry Pi so you can connect to it from another PC / Laptop remotely.
In order to find the IP address (e.g. 192.168.x.x) type the following into the terminal.
Write down the IP address, you will need it when logging into the Raspberry Pi from a different computer.
Connect to the Raspberry Pi remotely vis SSH and update the system
On your PC / Laptop open either the terminal (mac) or a SSH App for windows and do the following.
- First type
ssh [email protected] IP(e.g. ssh [email protected]) to connect to your Raspberry Pi.
- Next update your system with the following command
sudo apt-get update && sudo apt-get upgrade
Create a new user and update SSH and firewall rules for security (Optional)
Create a new user for connecting to the Raspberry Pi going forward which is saver then using the ubuntu account.
sudo adduser YOUR-USERNAME
- Next give the new user sudo rights by adding the user to the sudo group. Type
sudo usermod -G sudo YOUR-USERNAME
- Switch from the current (ubuntu) user to the user just created by typing
Next update the firewall rules to restrict traffic to the server.
Allow connection via port 22 which is SSH.
sudo ufw allow 22/tcp
Allow connection via port 3000 which is used by Grafana.
sudo ufw allow 3000/tcp
Allow connection to port 30303 udp and tcp for Geth (Ethereum Blockchain)
sudo ufw allow 30303/tcp
sudo ufw allow 30303/udp
Enable the firewall with
ufw enable. To check the status type
Finally restrict the root account to login via SSH.
sudo vi etc/ssh/sshd_config and change the line PermitRootLogin yes to PermitRootLogin no
Mount the External SSD USB3 drive
Be sure the External SSD USB3 drive is plugged into the Raspberry Pi blue USB port.
To find the drive type the following
sudo fdisk -l In my case the external drive is the last one shown in the list ==/dev/sda==.
Next format the disk and create a portion using the following command
sudo mkfs.ext4 /dev/sda
Manually mount the disk to the folder mnt/ssd.
- First create a directory mnt/ssd by typing
sudo mkdir /mnt/ssd
- Next grant your user account permission to access the directory
sudo chown -R YOUR-USERNAME:YOUR-USERNAME /mnt/ssd/
- Mount the disk to the created directory
sudo mount /dev/sda /mnt/ssd
You need the unique ID of the External disk in order to mount the drive automatically. Type
Find the line with your disk (starting with /dev/sda in my case) and copy the number after UUID (e.g. 5c3a8481-682c-4834-9814-17dba166f591)
Edit the ==/etc/fstab== file to auto mount your disk on startup. Type
sudo vi /etc/fstab and add the following line at the end
UUID=YOUR-NUMBER /mnt/ssd ext4 defaults 0 0
Now reboot your system with
sudo reboot. Connected again via SSH and check if you see the drive with the following command
df -ha /dev/sda
To build the Lighthouse Client from Source you need to install Rust on your Raspberry Pi.
- To install Rust type
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- When prompted, enter 1 for the default installation.
- After finished type the following to add Rust to your System path
- Now you need to source the user by typing
- Finally install some dependencies Rust will need by typing
sudo apt install -y git gcc g++ make cmake pkg-config libssl-dev
Install the Lighthouse Client
Now with Rust and all dependencies installed you can get the Lighthouse repository.
git clone https://github.com/sigp/lighthouse.git
- Change into the Lighthouse directory with
- Build Lighthouse by typing
This will take up to an hour. If the installation was successful you should be able to run the
lighthouse --help command.
- Move the Lighthouse executable file to the usr/local/bin folder with
sudo mv ~/lighthouse/target/release/lighthouse /usr/local/bin
In order to use the Lighthouse client you need to run the Ethereum blockchain. I use the Geth client in this Tutorial.
To do this you need to install Go first.
-Create and change into a download folder by typing
mkdir ~/download && cd ~/download
- Install the latest GO ARM version. As of 1st July 2020 it is
sudo wget https://dl.google.com/go/go1.14.4.linux-arm64.tar.gz.
- You can check latest version on gaoling.org
- Extract the file to the local folder so it can be executed by typing
sudo tar -C /usr/local -xvf go1.14.4.linux-arm64.tar.gz
- Change owner to root, and change permissions
sudo chown root:root /usr/local/goand
sudo chmod 755 /usr/local/go
- Set environment variables by editing the /etc/profile file and add the bold line at the end:
sudo vi /etc/profileexport PATH=$PATH:/usr/local/go/bin
- Finally reboot with
sudo rebootand try if all works well with
Install Geth (Ethereum blockchain)
- Download Geth from Github with
git clone https://github.com/ethereum/go-ethereum.git
- Change into the go-ethereum folder with
cd go-ethereumand type
maketo build Geth.
- Move the Geth executable file into the usr/local/bin folder with
sudo mv ~/go-ethereum/build/bin/geth /usr/local/bin
- Try if everything worked with
Start Geth using a Service to keep process running in the background
In order to keep Geth running after you closed a window or SSH session you will need to create a Service (systemd). See this great tutorial for more info
- Create an empty "geth.service" file in etc/systemd/system by typing
sudo vi /etc/systemd/system/geth.service
- Press i to edit and copy paste the following:
[Unit] Description=Geth Node After=network.target Wants=network.target [Service] WorkingDirectory=/home/tarek ExecStart=/usr/local/bin/geth --goerli --rpc --cache 512 --port 30303 --datadir /mnt/ssd/ethereum User=ethereum Group=ethereum Restart=always RestartSec=5s [Install] WantedBy=multi-user.target Alias=geth.service
- This basically says: "Use the user with name and group ethereum,run the Geth client as a service in fast sync mode and save the data to my external SSD drive"
- More details about Geth parameters can be found here
- Now you need to create a user called ethereum (or any other name you like. The reason you want to create a different user is because it is recommended that a Service user shouldn't be able to login to the server via SSH.
- To create a service user (I called it ethereum) and type the following.
sudo useradd --no-create-home --shell /bin/false ethereum
- Next create a folder on the SSD drive for the Geth data to be stored. Type
sudo mkdir -p /mnt/ssd/ethereum
- Give the new user access to write data on the SSD with
sudo chown -R ethereum:ethereum /mnt/ssd/ethereum
- Finally reload and start the service by typing
sudo systemctl daemon-reloadfollowed by
sudo systemctl start geth
Start Beacon-Chain using a Service to keep process running in the background
In order to keep beacon-chain running after you closed a window or SSH session you will need to create a Service (systemd). See this great tutorial for more info
- Create an empty "beacon.service" file in etc/systemd/system by typing
sudo vi /etc/systemd/system/beacon.service
- Press i to edit and copy paste the following:
[Unit] Description=beacon-chain After=network.target Wants=network.target [Service] WorkingDirectory=/home/tarek ExecStart=/usr/local/bin/lighthouse beacon --eth1 --http --datadir /mnt/ssd/beacon User=beacon Group=beacon Restart=always RestartSec=5s [Install] WantedBy=multi-user.target Alias=beacon.service
This basically says: "Use the user with name and group beacon and run the beacon-chain as a service with eth1 and http flag to run a validator and save the data to my external SSD drive"
More details about beacon-chain parameters can be found here
Now you need to create a user called beacon (or any other name you like. The reason you want to create a different user is because it is recommended that a Service user shouldn't be able to login to the server via SSH.
To create a service user (I called it beacon) and type the following.
sudo useradd --no-create-home --shell /bin/false beacon
Next create a folder on the SSD drive for the Geth data to be stored. Type
sudo mkdir -p /mnt/ssd/beacon
Give the new user access to write data on the SSD with
sudo chown -R beacon:beacon /mnt/ssd/beacon
Finally reload and start the service by typing
sudo systemctl daemon-reloadfollowed by
sudo systemctl start beacon
Create a Wallet to get your mnemonic and public key and start the validator
The manual of Lighthouse explains this very well. Check these last steps on their website.