GETH Node, Raspberry Pi
See the HARDWARE tab for parts list and assembly/build information
Latest Update Feb '19 [Geth release version 1.8.22]
Step (1) Preparing the Pi
Because all the preparation steps are the same for all nodes here, I have made a beginner friendly guide with images, step-by-step. "Getting started" Link opens a new window
Getting Started
Then continue below...
Latest Update Feb '19 [Geth release version 1.8.22]
Step (1) Preparing the Pi
Because all the preparation steps are the same for all nodes here, I have made a beginner friendly guide with images, step-by-step. "Getting started" Link opens a new window
Getting Started
Then continue below...
Step (2) Enabling WiFi
Wifi is available once the Pi is rebooted. Either reboot now using
sudo reboot and remove the ethernet cable. Or continue, and reboot later as it is required after the next step. |
With the Pi turned on, booted and you logged in with SSH we can start the setup.
First WiFi network connections are stored: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf Go to the bottom of the file and add the following text: network={ ssid="YOUR WIFI ROUTER NAME" psk="YOUR WIFI ROUTER PASSWORD" } **Note: Enter details between the quotes, leave the "" in save and exit using ctrl+O Then 'enter' ctrl+X |
Step (3) Expand the file system, (making full use of the SD card) and changing the Password.
|
enter:
sudo raspi-config The default password for obvious security reasons should be changed. That is done in this menu. select "1 change user password", and follow the on-screen instructions. This will be the new password when using PUTTY to SSH into the Pi. Because we installed a 2GB image onto the card, the Pi may think that the card is only 2GB in size. So we tell it to expand the file-system (returns it to it's full size allowed): select "7 advanced options" select "A1 expand filesystem" select 'finish' system will reboot, (remove the ethernet cable if you didn't at the previous step). And log back in with SSH and PUTTY once reboot is complete. |
Step (4) Updates
The image we downloaded may have an update or two since they released it:
sudo apt-get update
sudo apt-get upgrade
select 'y' to accept the storage requirement.
The image we downloaded may have an update or two since they released it:
sudo apt-get update
sudo apt-get upgrade
select 'y' to accept the storage requirement.
Step (5) Moving everything to the USB drive
People have been making projects (not just nodes) on the raspberry pi for some time. A common failure point seems to be the SD cards. The constant read/write process 24/7 drastically shorten their life. We can reduce this by moving the entire file-system to the USB drive, and where possible using traditional platter HDDs. Check out the 'HARDWARE' section for cheap solutions available to the Raspberry Pi.
For moving the file-system we need the "git" repository
sudo apt-get install git
Insert the USB drive if you havn't already, then check it is mounted to the Pi.
sudo lsblk
99% of the time it will be mounted as /dev/sda with a partition called sda1
We need to delete this partition to stop raspbian from automatically using the drive on boot, at this point. The helper in the next step will automatically create a new partition to do it's job of moving the files.
sudo fdisk /dev/sda
d
(deletes old partition)
w
(writes and commits the changes)
Now it's compatible with the helper script.
The folks at Adafruit have made a very useful helper to reduce the amount of commands you need. These next three lines create a new partition and move the entire file system onto the USB drive. It does warn you that any data currently written to /sda will be overwritten. If you are an advanced user and have called the partition something other than /sda, this is where it should be changed.
git clone https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper.git
cd Adafruit-Pi-ExternalRoot-Helper
sudo ./adafruit-pi-externalroot-helper -d /dev/sda
It will ask you to check that you are writing to the correct partition, select y when you are sure. When I do this step it takes a little under 10mins. Please be patient.
People have been making projects (not just nodes) on the raspberry pi for some time. A common failure point seems to be the SD cards. The constant read/write process 24/7 drastically shorten their life. We can reduce this by moving the entire file-system to the USB drive, and where possible using traditional platter HDDs. Check out the 'HARDWARE' section for cheap solutions available to the Raspberry Pi.
For moving the file-system we need the "git" repository
sudo apt-get install git
Insert the USB drive if you havn't already, then check it is mounted to the Pi.
sudo lsblk
99% of the time it will be mounted as /dev/sda with a partition called sda1
We need to delete this partition to stop raspbian from automatically using the drive on boot, at this point. The helper in the next step will automatically create a new partition to do it's job of moving the files.
sudo fdisk /dev/sda
d
(deletes old partition)
w
(writes and commits the changes)
Now it's compatible with the helper script.
The folks at Adafruit have made a very useful helper to reduce the amount of commands you need. These next three lines create a new partition and move the entire file system onto the USB drive. It does warn you that any data currently written to /sda will be overwritten. If you are an advanced user and have called the partition something other than /sda, this is where it should be changed.
git clone https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper.git
cd Adafruit-Pi-ExternalRoot-Helper
sudo ./adafruit-pi-externalroot-helper -d /dev/sda
It will ask you to check that you are writing to the correct partition, select y when you are sure. When I do this step it takes a little under 10mins. Please be patient.
This is our drives labels and addresses. We need to check that the PARTUUID long number (that's the USB), is entered into
sudo nano /boot/cmdline.txt |
So everything has been copied over and the drive configured. We just need to change the boot file so it starts from the USB drive from now on. The helper untility should have done this automatically. But recently this has not been the case. Do this just to check, it's simple and is just a copy/paste action. sudo blkid -o export /dev/sda1 The numbers will be different but it brings up something like the image on the left. |
Enter:
sudo nano /boot/cmdline.txt And ensure that the helper has changed root=PARTUUID= to match the one that was listed to you above. Yours will be different to mine. Then Save and exit using ctrl+o then ctrl+x. Do another reboot with sudo reboot and when the Pi starts this time your USB activity light will blink like crazy, showing it's now getting it's data from there. |
Step (6) Installing "Screen"
We are now very close to completion. Very soon we will be telling the node to start. However the node will be running in the PUTTY window on our screen and if you close that screen, it closes the connection too, stopping the node. An easy solution is to use a nifty program called "screen". It runs the current session on the Pi and detaches you from it. This leaves you free to leave and re-join to check the node's progress as you wish, without disturbing it!
sudo apt-get install screen
Then, to use it, type…
screen bash
It will open another terminal instance that is running on the Pi. You can now start a process you want to be able to leave running and reconnect to later. In this case, this will be the node.
"Screens" can be rejoined (I'll show how to detach them later) at any point using the command
screen -r
We are now very close to completion. Very soon we will be telling the node to start. However the node will be running in the PUTTY window on our screen and if you close that screen, it closes the connection too, stopping the node. An easy solution is to use a nifty program called "screen". It runs the current session on the Pi and detaches you from it. This leaves you free to leave and re-join to check the node's progress as you wish, without disturbing it!
sudo apt-get install screen
Then, to use it, type…
screen bash
It will open another terminal instance that is running on the Pi. You can now start a process you want to be able to leave running and reconnect to later. In this case, this will be the node.
"Screens" can be rejoined (I'll show how to detach them later) at any point using the command
screen -r
Step (7) Installing Ethereum (Geth)
|
To help the Pi because it doesn't have loads of RAM (1GB on the 3b) we can artificially create more using a swap-file. This will help it process the blockchain.
sudo nano /etc/dphys-swapfile And change the default size of 100(MB), to 1000 as shown to the left. save, exit, ctrl+o ctrl+x Then, to build the new swap file... sudo dphys-swapfile setup sudo dphys-swapfile swapon This has artificially given the Pi 2GB of RAM. Nearly there. |
Download the dependency Ethereum (Geth) needs:
sudo apt install libboost-all-dev
We make a directory to download Geth files
mkdir ~/bin
cd ~/bin
Download Geth as a package with:
wget https://gethstore.blob.core.windows.net/builds/geth-linux-arm7-1.8.22-7fa3509e.tar.gz
Then open up that package
tar -vxf ./geth-linux-arm7-1.8.22-7fa3509e.tar.gz
Then finally the moment of truth!!!
To run the node type
./geth-linux-arm7-1.8.22-7fa3509e/geth
sudo apt install libboost-all-dev
We make a directory to download Geth files
mkdir ~/bin
cd ~/bin
Download Geth as a package with:
wget https://gethstore.blob.core.windows.net/builds/geth-linux-arm7-1.8.22-7fa3509e.tar.gz
Then open up that package
tar -vxf ./geth-linux-arm7-1.8.22-7fa3509e.tar.gz
Then finally the moment of truth!!!
To run the node type
./geth-linux-arm7-1.8.22-7fa3509e/geth
***Important, to leave the node running in the background. Press "ctrl+a" release just the "a" key and press "d"
This sends a command to "screen" to detach ("d") it so you can come back and check on it later.
At any point when not re-attached to the screen, in a different window, type
screen -r
and it will take you back to the screen with geth running. This can even be done from another computer in the same network at home!
To stop the node use
ctrl+c
This sends a command to "screen" to detach ("d") it so you can come back and check on it later.
At any point when not re-attached to the screen, in a different window, type
screen -r
and it will take you back to the screen with geth running. This can even be done from another computer in the same network at home!
To stop the node use
ctrl+c
To prepare for the eventuality that power is lost unexpectedly (off and on). The Node can be made to auto-boot when power is restored.
Simply edit sudo nano /etc/rc.local and add ./home/pi/bin/./geth-linux-arm7-1.8.22-7fa3509e/geth & To the bottom, but ABOVE 'exit 0'. The & is also very important at the end and the . is important at the start of that command |