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


#1

This update of an earlier post adds the possibility to run a node with a precompiled Tezos program for the zeronet network with RPI3.

If you had already a lot of fun with the alphanet following the recipe in my previous post, jump here(*) (next paragraph).

If you are wondering what to do with a blank SD card on one hand and a brand new RPI3 model B (or even better a RPI3 model B+) on the other hand, just start following the instructions in my previous post (few simple steps) here: Running a Tezos node made ultra-simple (with RPI3)
PLEASE NOTE
if you are planning to run the node only on the zeronet, stop following the old instructions after the command “./resize.sh” and jump to the next paragraph (*).
Or
if you are planning to run the node on the alphanet and also the zeronet then go one step further and stop after the command “./tz-block.sh”, then follow the procedure here below.

(*) For anyone.
Stop the node if it is running. If the RPI3 is off, just boot it then download the zip file tz-zero032618.zip
by typing on the terminal from the default location /home/tzuser:
wget https://www.dropbox.com/s/xytmq80rs4a5akd/tz-zero032618.zip

Next, download the script “tz-switch.sh”:
wget https://www.dropbox.com/s/zrhdxfym2ryflaq/tz-switch.sh

and change the access rules:
chmod 764 tz-switch.sh

Run the script by typing:
./tz-switch.sh

it will extract the zip file content and do few more things (the zip file will be automatically deleted after installation).
Now regardless whether you had previously ran the node on the alphanet or not, type:
./tz-init.sh

a new identity for the node is created with this command since you are on a different network. As with the alphanet, the above command is needed only once.

Ready to surf on the zeronet? just type:
./tz-start.sh
and the magic will happen. That’s it!

If you want to switch from the zeronet to the alphanet or vice versa, just stop the node with the script “tz-stop.sh” then type “tz-switch.sh” and you are ready to start playing with the other network with “./tz-start.sh”

In summary, the commands to start/stop the node on the zeronet are the same as with the alphanet. If at some point you decide to change network, stop the node, run the script “tz-switch.sh” and start the node again, now it will be on the alternative network.

A little background info (optional reading).
The script “tz-switch.sh” preserves any previous info for both networks (identity, blockchain, etc). For example going from the alphanet to the zeronet, it will simply move everything from the default folders into 3 temporary folders-alpha (/tezos-alpha, /.tezos-node-alpha and./tezos-client-alpha) and move the zeronet stuff from the temporary folders-zero (/tezos-zero, /.tezos-node-zero and./tezos-client-zero) into the default folders.

The script “tz-start.sh” is slightly different for the two networks therefore it is preserved in the files “tz-start-alpha.sh” and “tz-start-zero.sh”. No need to worry, the script “tz-switch.sh” will copy for you the right file version in “tz-start.sh”.
For practical purposes the script “tz-start.sh” is all that is needed to run the node either on the alphanet or the zeronet. The file “config.json” is also slightly different for the alphanet and zeronet network. The two versions are stored in their temporary folders.

Have a look at the new tezos-client front-end, it is much nicer and easier to use with the zeronet (great job of the Tezos Development team!). General manual: /home/tzuser/tezos/tezos-client man

The zeronet network is still quite volatile, and I decided to put a limit on the allocated CPU resources for the tezos-node program using a small utility called cpulimit. At the moment the CPU limit for the tezos-node program is set to 80% of the total RPI3 CPU resources. It is more a precaution than a real need,
from what I have seen it rarely happens to go beyond ~50%. You can monitor the situation typing “ps aux” and in case, change the limit by editing the file tz-start.sh.

In future I am also planning to introduce a small script attached to the crontab scheduler to monitor the RAM usage and eventually, if needed, restart the node before the end of the regular cycle (3 days).

Since Tezos for the zeronet is constantly evolving, I will try to post new precompiled versions for RPI3 possibly every ~week. It is fairly easy to do, once I have the new Tezos compiled, something that I will do for myself anyway, it is only a matter of zipping the Tezos folder and upload it. Then you can just download the new zip file and follow the same procedure above here.

I am postponing the release of revised notes on how to manually compile Tezos specifically for the zeronet network on RPI3 (something similar to this: Step by step setup of a Raspberry Pi 3 with Fedora linux-OS and Tezos until things are settled a bit and/or when we are approaching the betanet or mainnet stage.
But if you have any question please let me know, I will be happy to help and exchange info.

Let’s make Tezos the first blockchain technology spreading everywhere through a swarm of tiny machines.


#2

Looking forward to getting this running this weekend or sooner. Thanks!


#3

@glebowski, thanks, yes please give it a try, it will be good to have more people on the zeronet


#4

…Amen!


#5

Excelent work!
Kudos for you


#6

@pedro
glad to hear it worked,
soon the RPI3s will take over the zeronet!


#7

Awesome notes… worked like a charm. Thanks for putting this together !!!


#8

Excellent news!
Please follow the updates on the new wiki home page and you are more than welcome to add material to the site if you like.


#9

Hey @maxtez-raspbaker - just wanted to let you know I’m now running the zeronet and finally it works as it should (they fixed the high read operations bug it seems so no more memory issues). Since I don’t have a good keyboard I ran it via ssh. I followed these steps:


Download image
burn on SSD with etcher

Open RPI3:
sudo systemctl start sshd.service;
sudo systemctl enable sshd.service;
ssh 192.168.0.142 -l tzuser

wget https://www.dropbox.com/s/xytmq80rs4a5akd/tz-zero032618.zip
wget https://www.dropbox.com/s/zrhdxfym2ryflaq/tz-switch.sh
chmod 764 tz-switch.sh
./tz-switch.sh
./tz-init.sh
./tz-start.sh

Finally, to start manually:
tezos/tezos-node run

And to query the ‘head’ block:
tezos/tezos-client rpc call blocks/head with ‘{}’

So yes, a lot less painful than manually compiling myself :smiley:
Thanks for your efforts!!


#10

@Mootjes007
This is great! the swarm is growing by the day…
feel free to contribute to the wiki, it is also your fault(!?*) if we got this far…


#11

Running into two oddities thus far: when I run tz-switch.sh, it returns the following error: “mv: cannot stat ‘./.tezos-client’: No such file or directory”

Additionally when I attempt to run ./tz-start.sh I get the following errors:

xterm: Xt error: Can’t open display: :0

Anyone experience these before? Running a raspberry pi 3.

edit: I should note that it appears the process is running or hung. There’s no textual or graphical feedback but the command prompt has not returned.


#12

Yes, getting same exact error when trying to go from RPi3 Tezos image directly to zeronet…


#13

@wambo I need a bit more info to help you out, the error with the mv command (no such file or directory) should not happen, and the display problem was solved some time ago.
As @glebowski mentioned, I would also guess that you didn’t wget the zip file tz-zero040318.zip (or the old one tz-zero032618.zip) and you are using the old tz-start.sh from the image file which was revised soon after.

Maybe have a look at the wiki (https://github.com/demodun/tezos-RPI3/wiki) in particular page b-2) and page f) with the updates and see if there is anything that was skipped in your installation. Just remember all the operations should be done from /home/tzuser as a user (tzuser), not as a root.

no worries, you’ll get your node up and running soon!

edit: your edit suggests that your node is running, that’s strange are you inside x-windows? you can open several terminals, right? if so then open a terminal and type ./tz-stop.sh then check if there is any step missing from the installation


#14

@maxtez-raspbaker I managed to burn the RPi3 image, then do the 4/4/2018 updates from the github wiki. But when I type ./tz-start.sh I get “Permission denied”. When I run sudo ./tz-start.sh I get an “…suid-root program…” error messaage. Not sure what I’m doing wrong.


#15

@glebowski, good you got the updated zip file.
No mistake on your end, I made a mistake in the script "tz-switch.sh " that gave the wrong permission to tz-start.sh. It is fixed now, but you don’t need to re-download tz-switch.sh.
As a user (tzuser) just change the permission
chmod 775 tz-start.sh
that should do the trick,

happy zeronet!


#16

Just added https://github.com/demodun/tezos-RPI3/wiki to tezos.rocks :+1:


#17

@maxtez-raspbaker I download the new tz.start.sh script but did sudo chmod 775 tz.start.sh and now getting "xterm: Xt error: Can’t open display: 1:2


#18

@glebowski, my apologies this is getting unnecessarily messy, I am trying to keep it simple but at the same time adding new files doesn’t help, still learning…

There was no need to download a new tz-start.sh the one you already had was the good one, it was just a problem with the permission.

But now you have to download a new file to put back in place the original good one., here:

wget -NO tz-start.sh https://www.dropbox.com/s/pearbd20ht1exr8/tz-start040318.sh

then change the permission with chmod and the node should be ready to take off.


#19

thanks I really appreciate it,
tezos.rocks is the perfect spot for people to start getting involved with Tezos.


#20

@maxtez-raspbaker I was able to download tz-start.sh again and change the permissions but now I get the following error when execute “sudo ./tz-start.sh”

./tz-start.sh: line 1: syntax near unexpected token ‘<’
./tz-start.sh: line 1: '<html lang=“en”…