Hello my fellow tech amateurs, it’s Stevson, the new intern at Tezos Southeast Asia who has just been thrown at with a Raspberry Pi and told to write up a dummies’ guide on setting up a Tezos node and Baker. It’s my very first time coming into contact with this gadget; let alone writing a guide on it. So here goes nothing, please be gentle with me. 

Firstly, here’s a list of items which you’d need to prepare: 

  1. Raspberry Pi 4 Computer Model B (4GB RAM)
  2. Official USB-C Power Supply
  3. Ledger Nano S
  4. MicroSD card (preferably 64GB)
  5. Monitor with HDMI cables and HDMI Adapter
  6. Keyboard 
  7. Wired Connection (e.g. LAN cables)

Some of the things you’d need to take note of while setting up

The Raspberry Pi 4 comes with a small casing, so make sure you put it on to ensure your gadget stays protected for all you clumsy lads out there. Next thing is to ensure that your PC/Mac has a port for your SanDisk Adapter which you will need to put the MicroSD card in. Please do note that I am doing this entirely on Mac but the steps are the same for Windows users. However, the applications that we are about to download are different, so please pay attention to that. 

Please note that it will only work with Raspberry Pi 4 64bit edition and that you can check it with the command “uname -m”.

What’s more important is that when we are using the terminal, you can type the commands only when it shows something like “[email protected]:~/Tezos$” or “[email protected]:~$”. If either of these doesn’t show, it means it’s still loading and some commands can take up to hours, so please be patient and not type anything to disrupt the command. 

Downloading Ubuntu Server 

So we are going to download the Ubuntu Server which works well with Raspberry Pi. This means that there will NOT be any GUI on your desktop but you can install from the terminal.

Step 1: Go to https://ubuntu.com/download/raspberry-pi

This link will bring you here. Depending on your Raspberry Pi, choose the correct image. For me, I’m going for the 64-bit image. Skip the verify because it is a waste of time.

Step 2: Do not click on the instructions from that page

It is a waste of time and absolutely did not help at all. Instead, go to https://www.balena.io/etcher/ to download the Etcher application, it’s seriously a lot faster. 

Step 3: Flashing your microSD card

Go to Applications and find balenaEtcher. Insert your microSD card into your PC/Mac. It will automatically appear at the ‘Select Drive’ section. Now click on ‘Select Image’ and choose your ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz image and flash it.

It should look like this:

Installing Ubuntu Server into your Raspberry Pi 4 

Step 1: Insert your microSD card into the tiny microSD port at the bottom of the Pi

Step 2: Attach the Type C Power Supply from your power socket to the Pi and attach the HDMI cable from your monitor to the Pi with the use of the HDMI Adapter.

Step 3: Login In to your Ubuntu Server. 

The Ubuntu login and password is ubuntu. They are the same. Then, you will be prompted to change the password.

There you go! You have successfully installed Ubuntu server into your Raspberry Pi. Well, don’t get too happy just yet, ‘cause the next part is where it starts to get tedious.

Connecting to Wireless Wifi using ubuntu 

Alright, this part is really long and susceptible to making errors so follow me closely. I’ll be giving you some troubleshooting tips because you are bound to meet some obstacles like Yours Truly here. 

Step 1: Provide a wired Wifi connection to install packages

In order to install anything, you will need: 

  1. Lan cable (cat 5, 5e, 6, 6a, 7)
  2. Router 

Note: You’re required to connect a LAN cable to the Raspberry Pi because there are some drives that you need to install to connect to wifi wirelessly. You can use the cable for your house router to connect, don’t worry, it’s temporary. This is because the Ubuntu Server that I downloaded is a minimal version which means it does not comes with Ethernet so we need a wired connection to the Raspberry Pi. Some of you will not have this problem because your Ubuntu server has the drives installed in it already. 

Step 2: Connecting Wifi using Terminal 

These are the commands that you have to follow step-by-step to connect to Wifi:

  1. sudo apt install rfkill
  2. rfkill list
  3. sudo rfkill unblock wifi 
  4. sudo apt install wireless-tools
  5. iwconfig
  6. sudo iwlist wlan0 scan | grep ESSID (wlan0 is my case, yours might be wlp4s0)
    • If this command has this error “ Interface doesn’t support scanning: Network is down”, try this: 
      • ip link to find your wireless interface 
      • ip link set dev wlan0 up (wlan0 is my case)

If you can find your Network name(ESSID), we shall connect to it.

  1. sudo apt install wpasupplicant 
  2. wpa_passphrase “ESSID” “wifi password” | sudo tee /etc/wpa_supplicant.conf
    • Please change the “ESSID” and “wifi password’ accordingly
  3. sudo wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
    • It should say “Successfully initialized wpa_supplicant”
  4. ip a
  5. iwconfig
  6. sudo dhclient wlan0 
  7. ip addr show wlan0
  8. ping google.com 
    • This is to check if you are connected to the Internet

Step 3: Auto-Connect at Boot Time 

  1. sudo  cp /lib/systemd/system/wpa_supplicant.service /etc/systemd/system/wpa_supplicant.service 
  2. sudo nano /etc/systemd/ system/wpa_supplicant.service

You need to find the following line:

   3. ExecStart=/sbin/wpa_supplicant -u -s -0 /run/wpa_supplicant

Then, you need to change it to the following:

   4. ExecStart=/sbin/wpa_supplicant -u -s -c /etc/wpa_supplicant.conf -i wlan0

Next, find the following line:

   5. Alias =dbus-fi.w1.wpa_supplicant1.service

Add the # character to comment it out. Then press CTRL x to save and ENTER to continue.

In the end, it should look like this:

   6. sudo systemctl enable wpa_supplicant 

   7. sudo nano /etc/systemd/system/dhclient.service

   8. Once you enter a blank page, type out exactly as the following that I am  showing you.

Once you are done (please check through for silly mistakes), press CTRL x to save and press ENTER to continue.

    9.  sudo systemctl enable dhclient.service

   10. reboot

Once you rebooted and login, we shall check whether we are connected to the wifi.

   11. ping google.com (CTRL c to stop the spam)

Now that you’ve successfully connected to the wifi, we can finally get started on installing the Tezos Node.

Installing the Tezos node

Here comes the easiest part, just follow my guide. Also, there will be questions asked by Terminal that looks like this “(N/y)”, always choose the one in caps.

Step 1: Install Tezos Mainnet 

 

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt install -y rsync git m4 build-essential patch unzip bubblewrap wget
  4. wget https://github.com/ocaml/opam/releases/download/2.0.5/opam-2.0.5-arm64-linux
  5. sudo cp opam-2.0.5-arm64-linux /usr/local/bin/opam
  6. sudo chmod a+x /usr/local/bin/opam
  7. git clone https://gitlab.com/Tezos/Tezos.git
  8. cd Tezos 
  9. git checkout Mainnet 
  10.  opam init –bare (you should be asked two questions at this step, both answers should be n)
  11.  make build-deps (this usually takes more than an hour or two)
  12.  eval $(opam env)
  13.  make (this also takes about 30mins-1 hour)
  14.  export PATH =~/Tezos:$PATH
  15.  source ./src/bin_client/bash-completion.sh
  16.  export TEZOS_CLIENT_UNSAFE_DISABLE_DICLAIMER=Y

Step 2: Create Node Identity (this takes about 45mins)

  1.  ./tezos-node identity generate

Step 3: Importing Snapshot

In order to import a snapshot, you need to download Winscp (for Windows) or FlieZilla (for Mac). In this guide, I will be showing you how to import a snapshot on Mac. 

Here are the links

For Mac OS: https://filezilla-project.org/download.php?type=client

For Windows: https://winscp.net/eng/download.php

Once downloaded, you will be at the homepage. Fill in the host, username, password and port.

Tips: For host, you need to type your ip address. To find out your ip address, the command is hostname -I 

Your username is ubuntu and your password is whatever that you have changed earlier. 

For port, try 22.

Press Quickconnect. You should see this if you have connected successfully:

Once done, download the json file. Your files and folders will appear at “Local site” on the left side while the files and folders in your Raspberry Pi will appear on your right side. You can transfer files from your computer to the Raspberry Pi by dragging the file from the left to the right.

The command is ./tezos-node snapshot import FILE.full

Step 4: Syncing up

So now we have to run the rpc command. In order to sync up, open a new terminal to allow session to continue running after SSH is closed.

  1. screen
  2. ./tezos-node run –rpc-addr 127.0.0.1:8732

The above command will run the Tezos node to listen to all IP addresses assigned to the device, on port 8732. To check if you have successfully run the rpc command, run bootstrapped

  3. ./tezos-client bootstrapped

To view running screen ID

  4. screen -ls

To kill screen

  5. screen -X -S “<ID>” quit

Setting up baker using key on the system without Ledger Nano S

Step 1: Generating a key

Never forget your password. ‘myWallet’ is an alias for your addresses only used locally. You can freely set an alias and use this alias to check the balance and transfer tokens.

  1. ./tezos-client gen keys <alias> –encrypted 
  2. ./tezos-client get balance for <alias>

Step 2: Managing key

Check your account and see if your secret key is encrypted. 

  1. ./tezos-client known addresses
  2.  ./tezos-client show addresses –show-secret

*Copy Hash, Public Key and Secret Key to somewhere secure

  1.  ls ~/.tezos-client/

This is to see if ~/.tezos-client is filled with 3 files. Please make sure to make a back-up of these (strongly recommended). 

Step 3: Set an account as delegate

  1. ./tezos-client register key <alias> as delegate

If you want to bake, you need to set your address as delegate. However, you need to secure more than 8,000 XTZ in your address to set your account as delegate.

Step 4: Setting up baker and endorser 

  1. ./tezos-client import secret key <alias>
  2. ./tezos-baker-005-PsBabyM1 run with local node ~/.tezos-node/<alias>
  3. ./tezos-endorser-005-PsBabyM1 run <alias>

Setting up your Ledger Nano S

Now that we’re done with the easy part, here comes the tedious part. Well, nothing worth having comes easy right? 

There’re 3 sheets of paper in the Ledger Nano box for you to write your 24 recovery words. You must not lose them! If you lose your Ledger Nano, you can get another one and recover your data with the 24 recovery words so they’re really important. 

Step 1: Download the Ledger Live application

Here is the link: https://www.ledger.com/ledger-live/download/

You are required to create an account and password.

Once done, go to Manager and you should see this:

Step 2: Setting up your Ledger Nano S

Plug the Ledger Nano into your computer (not your Raspberry Pi). Don’t be silly like me, you need it plug to your computer because you have to download applications into your Ledger Nano. 

  1. You need to choose an 8 digit pin-code so write that down somewhere as well
  2. Next, you would have to crack your brain and write down the chosen 24 recovery words

Anyway, I’ll leave a link here to a video tutorial for setting up for you visual creatures: 

https://support.ledger.com/hc/en-us/articles/360000613793-Set-up-as-new-device

Step 3: Installing Recovery check

Okay, by now, I assumed you have completed setting up your Ledger Nano.

  1. I want you to open up your Ledger Live App
  2. You will see that the app is getting permission to access your Ledger Nano

  3. So you will see the request on your Ledger Nano, confirm it.

  4. Then, we need to install some applications. Search Recovery check and install.

5. Lastly, we shall enable the Developer Mode by heading to Settings

6. On the menu, click on Experimental Features.

7. Go to Developer Mode and enable it.

First, click on the recovery check on your Ledger Nano to start. Select 24 words for more secure protection. You are required to type in the first 3 letters of each word and then choose the word based on the numbering in sequence. 

Second, once you are done, you may delete away the Recovery check app by clicking the dustbin icon on your Ledger Live. This step is to ensure that you are able to recover your ledger nano.

Step 4: Installing the Tezos applications in your Ledger Nano S

Now, go search “tezos” and you will see two applications. Download both.

Once you are done, your Ledger should look like this:

And we are almost done! Just bear with me…this is the last one, I promise.

Setting up baker 

Step 1: Set Udev Rules (you can skip this step if the signer node has been setup before)

This is to enable the user group to have access to the Ledger Nano. So now we need to download script.

Set permission

  • sudo chmod +x add_udev_rules.sh 

Run script

  • sudo ./add_udev_rules.sh

Replug the Ledger Nano for the changes to take effect

Step 2: Check Ledger Nano Device status and Generate Key to Ledger Nano (Signer) 

./tezos-client list connected ledgers

  1. Copy the command with ed25519
  2. Replace tezos-client with tezos-signer
  3. Replace ledger_minipc-node to other name (eg. ledger_tom, ledger_jerry) Example: ./tezos-signer import secret key ledger_minipc-node “ledger://some-random-animal-name/ed25519/0’/0′”
  4. New hash will be generated
  5. Check device and confirm, note down new hash

Step 3: Open TCP connection( Skip this step if the socket has already been setup)

1. ./tezos-signer launch socket signer -a 0.0.0.0 -p <PORT of Signer Daemon>

List address. Ensure it says “ledger sk known” instead of “unencrypted sk known”

2. ./tezos-signer list known addresses

To show secret key is encrypted and stored on the Ledger Nano. Ensure secret key starts with “ledger://”

3. ./tezos-signer show address <account_name> –show-secret

*Copy Hash, Public Key and Secret Key to somewhere secure

Step 4: Setting up baker, endorser and delegate 

  1. ./tezos-client import secret key <alias> <secret key>
  2. ./tezos-baker-005-PsBabyM1 run with local node ~/.tezos-node/<alias>
  3. ./tezos-endorser-005-PsBabyM1 run <alias>
  4. ./tezos-client register key <alias> as delegate</span>

And Voilà! We have completed setting up Tezos baker using Raspberry Pi!

Thanks everyone for following me on this arduous journey and I hope this guide encourages more beginners like me out there to get started on baking. If an amateur like me can do it, so can you. Please let us know if you guys would like to see more of such guide for dummies from us and feel free to share it with your mates!

Don’t forget to follow us on our socials: 

Twitter Instagram LinkedIn Facebook

Get Involved!
Join our mailing list for updates on our events, meet-ups, workshops & more!
By clicking the button:
1) It confirms you are a genius.
2) We promise that your privacy is respected and will not be shared.
3) You will not be spammed.

Leave a Reply