Running a Tezos node made ultra-simple (with RPI3)


#1

Here is another option to run your own Tezos node on the alphanet almost effortlessly.

I made an image file containing Linux OS (Fedora) + precompiled Tezos.
The image file (RPI3-TEZOS-02282018.img) is ~4GB and can be downloaded from here:
https://drive.google.com/file/d/18uPhwxTQEebZZFP2nJmt1mmgqBdUOgiF

Requirement:

  • Raspberry Pi 3 Model B
  • Micro SD card (at least 16GB)
  • USB keyboard & mouse
  • monitor with HDMI port
  • LAN internet (no wireless), static or dynamic IP address
  • optional but recommended (cooling fan and heatsinks)
  • optional small UPS (<700 VA) for the router and RPI3. The tiny machine doesn’t consume more that 5 W
    (there are also nice DIY projects to build your own UPS with Li-ion batteries)
  • wish list a cool case with the Tezos logo

Write the image on a SD card using etcher (https://etcher.io/) or a similar tool.
Put the SD card on your RPI3, power it up, on the screen there will be a minimal graphic interface with one text shell.
After the first boot, type 3 commands that will initialize the system, then 1 command will start the node.
For any subsequent boot, just 1 command and your Tezos node will start working.

The following 3 commands should be typed only one time after the first boot of the RPI3.
In the text shell type the first command (mandatory):
./resize.sh
this is absolutely mandatory. It will inflate the OS to take the entire space on the SD card

Next command (highly recommended):
./tz-block.sh
thanks to Fred Yankowski a new Tezos node does not need to sync starting from time zero but part of the blockchain up to ~Feb/10/2018 can be downloaded (more info here https://fred.yankowski.com/2017/10/04/build-tezos-on-debian-9/). The above command will download the blockchain and extract the files.
This operation requires ~6GB of space (down to ~3GB after it is done) and may take a while depending on your LAN internet speed.

The third command (mandatory):
./tz-init.sh
will initialize the new node and will give it a unique identification fingerprint on the network.

The above 3 commands won’t be needed anymore after the first boot.

To start running the node simply type:
./tz-start.sh
This will open 2 text shells, one for the screen output of the tezos-node program and the second one for the output of the tezos-client.

That’s it. You have a functioning Tezos node.

After few mins you’ll see on one screen the node will start syncing and on the other screen a script like this:
“no nonce to reveal for block …2d8”

To stop the Tezos node just type:
./tz-stop.sh

and to shutdown the RPI3:
./tz-sleep.sh

Additional commands, for example to create an identity or to transfer “virtual” tezzies from an account
should follow the syntax described in the Tezos documentation (http://doc.tzalpha.net/).

What is the fun without an update? While the node is running, in the text shell please type:
wget -N https://www.dropbox.com/s/eienap1sw6conzw/tz-start.sh
with the original script sometimes the tezos-client program fails to start, this update should reduce the risk.
and also:
wget -N -P /home/tzuser/.tezos-node https://www.dropbox.com/s/stu7gjjx7rsqyt0/config.json
a slightly revised version of config.json

A little bit more info on the setup. The Linux-OS includes a small number of services with a minimal graphical interface (X11). ssh, wifi, bluetooth are disabled, no mail, desktop or web-applications. It should be pretty secure, even though no login is required on boot. Beware that someone doesn’t physically steal your RPI3!
The default username of the only user is “tzuser”, password “tzuser”.
The administrator/root/superuser password is “mrgevers” (there is no excuse not to change it)

At the moment it is a good idea to restart the node after few days. The two scripts to do that (tz-stop.sh and tz-start.sh) are scheduled to run automatically using crontab every 3 days at 1:00AM (Paris time or the time on the clock if you change the time zone). In practice one should start the node manually with the command ./tz-start.sh and then let the automatic procedure take over, that is stop and restart the node. Note that 3 days means that the node will restart on the 3rd, 6th, 9th… of every month. If the RPI3 is powered on and the node is not running on these dates, it will start automatically.
I encourage anyone to explore the system by opening additional text shells, in particular have a look at the
files that I modified, config.json located in /home/tzuser/.tezos-node and the kernel configuration file sysctl.config located in the folder /etc.
It is probably wise to update the OS from time to time, type:
sudo dnf upgrade (followed by the root password)

Have fun!


Running a Tezos node on the *alphanet* and the *zeronet* made super-simple (with RPI3)
#2

You are doing a really great job !


#3

I wasn’t sure that what I was doing was just a freaky accident, you and @Mootjes007 were the first to give it a try and succeed proving that it can be done. Thank you both.


#4

Awesome, great work! Buying a RPi3 right now :slight_smile:


#5

root pass=mrgevers… I love it!


#6

@glebowski

anyone now can enjoy the pleasure of removing mrgevers from Tezos…

please let me know how it goes with the installation and running the node, I am still a bit nervous that I screwed up somewhere even though I tested the image before uploading it.
The crontab (automatic restart) is acting funny. It was doing a fine job restarting every 1 or 3 hrs then I assumed that 3 days would be ok as well, I am looking into it.
[edit] crontab is ok, next restart is scheduled on March/04 at 1:00am https://crontab.guru/#0_1_*/3_*_*


#7

My RPi3 should be arriving today or tomorrow. I’ll get it up and running and let you know how it goes. Personally replacing mrgevers as root will be the highlight of my day. Onward and upward!


#8

@maxtez-raspbaker I managed to get the node running on Saturday but then my ocd took over and I did a dnf upgrade and it stopped working. I don’t remember the error message. Fast forward to tonight, I burned a fresh image, followed the steps and now getting “xterm: Xt error:Can’t open display: :0” after running ./tz-start.sh. I did a reboot, downloaded the latest ./tz-start.sh and config.json with wget and still same error. I think the node might be running but not sure how to verify. Any ideas to fix?


#9

oh, sorry for the trouble, but good news there is a easy fix.
First, you are right the tezos node may be running even without screen output. To find out, type on a terminal:
ps aux
and if you see somewhere something like “tezos-node run” and “tezos-client launch daemon” then yes it is running. If it is running, let’s stop it for a moment, the script “tz-stop.sh” should do the job.

Usually the graphical interface (X11) sets the default output display to 0 (or 0.0), but if something happened like accidental shutdown then with the next reboot it may pick a different number, 1 (or 1.0), 2 ( or 2.0) and so on. As far as I know there is no way to predict which number will be picked. But here is the command to find out the current display number, just type:
echo $DISPLAY

UPDATE: there is no more need to find the right display output and use different tz-start scripts. The revised “script tz-start.sh” will find it automatically for you. Just download the revised version (same link as in the original post)

wget -N https://www.dropbox.com/s/eienap1sw6conzw/tz-start.sh

Everything below here is not necessary anymore (I’ll keep it just for the record.)


Now that we know the number we need to put it in the tezos script “tz-start.sh”. You have 2 options.
1- you can edit the file “tz-start.sh” and it is easy to see where the correct number should be put (2 places).
or
2- use wget to get the script with the correct display number, here are the links to tz-start scripts with a nice display output ranging from 0 to 4. Based on the output of the echo command, you can just download the one you need.

0.0
wget -N https://www.dropbox.com/s/4rdtjk5j6vea9bo/tz-start.0.sh
1.0
wget -N https://www.dropbox.com/s/2o2lkm75ux2bqvp/tz-start.1.sh
2.0
wget -N https://www.dropbox.com/s/sna6hgkx6v9ploo/tz-start.2.sh
3.0
wget -N https://www.dropbox.com/s/188tjnuawvfzcur/tz-start.3.sh
4.0
wget -N https://www.dropbox.com/s/d7e5j3ey2arbk84/tz-start.4.sh

If you choose option 2-, there is one more step and then you are ready to run the node again with a nice display output. Just copy the downloded file into “tz-start.sh” by typing:
cp tz-start.x.sh tz-start.sh
where the “x” should be replaced by the file number (0-4).

The next regular reboot may restore the default output display (0), worth check it out before starting the node.
Piece of cake with the echo command!


#10

That worked, thanks! Letting it run now.


#11

that’s how to start a good day…

Congratulations!

update: there is no more need to find the right display output and use different tz-start scripts. The revised “script tz-start.sh” will find it automatically for you. Just download the revised version (same link as in the original post)

wget -N https://www.dropbox.com/s/eienap1sw6conzw/tz-start.sh


#14

@maxtez-raspbaker The node seems to be running fine for some time now smiley: Thanks for all your hard work! I could use a little help trying to figure out how to use all the commands in the alphanet.sh script per http://doc.tzalpha.net/introduction/alphanet.html. After I download alphanet.sh and changed permissions I get “docker does not seem to be installed”. I realize this setup is compiled from scratch and not using docker but having a hard time trying to figure out how to run equivalent commands on my RPI3 node. A point in the right direction should suffice as I can typically figure out most things.


#15

@glebowski
It is great to hear that the node is working properly,
Tezos on RPI3 is almost magic (and for someone still believed to be impossible).

I made another change to “tz-start.sh” today, hopefully this is the last, but please when you have time re-download the file from dropbox with wget (usual link), this should take care of the DISPLAY issue once for all.

About playing with Tezos, you are right the “alphanet.sh” script works only with the docker version but the commands with the compiled version are the same found in github.com/tezos/tezos/tree/alphanet,
or http://doc.tzalpha.net/
The key is to replace ./alphanet.sh with ./tezos-client.
For example to create an identity just replace:
./alphanet.sh client gen keys "my_identity"
with
./tezos-client client gen keys "my_identity"

Then you may want to create an account and delegate the account to yourself and transfer some virtual tezzies.
To use these commands you may want to move into the tezos folder because when you open a terminal shell
the defalt location is /home/tzuser. Simply type: cd tezos which is the location of the tezos-client program, and you are ready to play.

You can also look at your tezos node activities with one of the various block explores (for example tzscan.io/).
Soon you may start endorsing and baking…


#16

@maxtez-raspbaker Thanks for the clarification. I was on the right track. I knew I was supposed to use tezos-client instead of alphanet command but wasn’t in the correct folder. I should be good to go for awhile now. I see this setup and your hard work going into an official Tezos supported RPi3 image at some point. Thanks!


#17

I think this is a great work what you have done here! Thank you very much! The Foundation could support some company to provide these Raspberry PI 3 Tezos nodes to people for a cheap price, pre-installed. Just plug & bake. Raspberry PI 3 has only 1 GB of RAM, so it appears you don’t really need much to run a node.


#18

@Farmer_John
Thanks, yes that would be amazing. Tezos on RPI3 for everyone!
My plan is to go on a solo-baking journey with my 3 tiny machines (Les triplettes de Bonneville).
It was a fun ride so far, it would have been crazy not to share. I like to think that running a Tezos node on RPI3 is like driving an electric car, they are better for the environment even though still few around but they could potentially change the future, oh maybe there is one difference, they are much cheaper to buy!

At some point I hope that the DLS-TF will take over. I am not even sure that posting the image file is legal, since I am just a random dude with no affiliation with Tezos. And it could also be harmful, I mean if I was an evil spirit I could inject the image with malicious software and cause a lot of troubles to the network.

I can assure that:

  1. the image that I posted does not contain any malicious software (I am not an evil spirit)
  2. and I do not work for the Raspberry Pi Foundation

#19

i could not :frowning: are you planning to post a video on this topic?


#20

@baybety
a video? mmm, probably no, but I can help you out if you tell me where you got stuck, please share as many details as possible.


#21

all stat is ok. but I see
no nonce reveal for block BKyWCrbTDB7sw4
no nonce reveal for block BK…warnings like.
and I can’t see myself at http://tzscan.io/network connected tabs
My ip is 213.14.19.194 Turkey. I’m the only one
Peer ID idrKnJWWE8LPh94fz8zyuMLJDFwNf


#22

@baybety,
are you the first node runner from Turkey? and with an RPI3, that’s great!
I think it is all good, on one terminal you see the output of the tezos-client (“no nonce to reveal for block xxxx”), on the other terminal you should see the output of the tezos-node syncing (something like: “date time - node.validator. net: update current head xxxx…date2-time2…”). Look at the date2-time2, most likely it is older than data-time. Your node is catching up…
In the meantime you can create an identity, one or more accounts and transfer “virtual” tezzies (see the Tezos documentation and previous posts). Eventually your node will be selected for endorsing and baking.