Running an Idena node on a Raspberry Pi 4

Swingy
10 min readSep 15, 2021

This guide was made for those on a windows computer, however I’m sure you can do this on a Mac with a bit of know-how. A large majority of this guide was made idiot-proof for me by an extremely knowledgeable friend. All credit should go to @PrivacyGeorge (on Twitter).

I can’t compliment his patience with justice in words.

RPI = Raspberry Pi 4

Also… This isn’t a super secure set up, so please take caution.

What you’ll need.

Hardware

  • A computer… (with SD card reader)
  • Raspberry Pi 4 8GB Motherboard (4GB works however for the sake of efficiency and longevity an 8GB motherboard is recommended)
  • Raspberry Pi 4 Power Supply (You’ll see your RPI acting like it’s in a boot-loop if you use a power supply with less amperage.)
  • Raspberry Pi 4 Enclosure with Fans (Optional… but just get it.)
  • Ethernet cable (WiFi isn’t sufficient)
  • MicroSD Card 64GB
  • M.2 SSD 256GB or higher (I got this.)
  • M.2 USB 3.0+ Reader (I got this.)

Important side note! Make sure that your M.2 SSD is compatible with your M.2 Reader. Most M.2 to USB Readers/Adapters will require B or B+M key (PCIe = big no no).

Software

Let’s begin

First we must prepare our MicroSD.

  • Insert your MicroSD into your computer and open up balenaEtcher.
  • Click “Flash from file” and select the Ubuntu Server image file you’ve saved on your computer, continue to “Select target”
  • Here we are going to select the drive which correlates to our MicroSD card that we inserted.
  • Afterwards click “Flash!”

This process may take a few minutes. Once finished our MicroSD card is ready to be mounted to our RPI. Great!

Now, let’s prepare our SSD.

We need our M.2 SSD to be in Ext4 format for efficiency’s sake. Why is this? I have no idea. Ask @PrivacyGeorge.

  • With your M.2 mounted in your M.2 Reader connect it to a USB 3.0 + port on your computer.
  • Open Minitool Partition Wizard
  • Right click your M.2 SSD on the list of drives and click format.
  • Select Ext4 for file system type then “OK”.
  • Now select “Apply” on the bottom left.

Done!

(Your SSD has unallocated space if you are unable to see your SSD drive when connected to your PC. Follow this simple Youtube video to allocate space on your drive so that your computer recognizes it. Apply allocation as GPT)

Now it’s time for the RPI.

  • Assemble the RPI with the enclosure if you haven’t already.
  • Insert the MicroSD card with the newly flashed Linux OS and the M.2 SSD via the USB 3.0 port.
  • Connect the Ethernet Cable to your RPI
  • Finally connect your power supply to turn on your RPI.

Your RPI is still booting and not yet connected to your LAN when the RPI’s ethernet port has a solid yellow and green LED. You are connected once you see the green LED faintly blink while the yellow light is solid.

We must now find the IP address of the RPI on our LAN (Local area network).

This process is different for everyone depending on your modem, ISP, etc. I’m going to tell you how I did this.

  • Open Command Prompt (Press windows key and type CMD)
  • Type “ipconfig” and press Enter
  • You should see “Default Gateway” at the bottom, copy the address.
    (ex: “192.168.1.1")
  • Paste this address into your internet browser (Chrome, Firefox, etc.).

This is where you will have to think for yourself.

  • Find where you can see “connected devices”. Your RPI should be labeled as “ubuntu”. Copy the IPV4 Address.(Ex:”192.168.1.12")
  • Keep this IP Address handy for the time being, post it on a separate notepad or sticky.

Done!

(IMPORTANT!! Your RPI may have a DHCP configured connection to your modem. I advise changing this to a static/reserved IP. This way your RPI will always have the same IP address when connected to your modem. You will be making your own IP Address for your RPI if you need to do this. You will only need to make up the digits after the last decimal. Ex: 192.168.1.xx, copy and keep this handy.)

PuTTY time!

  • Open PuTTY and insert the RPI’s IPV4 Address under “host name”. (Keep all other settings as is).
  • Click Open
  • Username and password on the first launch will always be “ubuntu” and “ubuntu”. It will ask you to change your password right away, remember it.

(For security reasons, you won’t see anything being typed on your terminal when typing your password. This is normal, just hit Enter afterwards)

  • Once launched, let it run for a while. It will go through all the absolute necessary updates. We will run another series of updates very shortly.
information may not be exact as yours, don’t stress.

You should now be presented with a small terminal window via PuTTY and have access to your RPI without the need of a monitor. Everything we need to do below will be done through this terminal.

Installing Idena Node on your RPI

In PuTTY, type what you see within bold quotations below followed by Enter. Verbatim syntax!!!
1. “sudo apt update” (This takes a bit of time)
2. “sudo apt upgrade” (This takes a bit more time so be patient!)
3. “sudo reboot” (We are rebooting just to apply all the updates, you will need to reconnect PuTTY to the RPI via the previous steps for PuTTY)

Now we need to tell the Linux OS on our RPI to identify the M.2 SSD and use it.

4. “sudo fdisk -l” (This shows us all connected storage devices, find your SSD address, this may be something like “/dev/sda1". You can confirm it is your M.2 SSD by comparing the memory size listed to what you have.)

5. “sudo blkid” (Locate your SSD once again with the address you found in the previous step. You should see something saying UUID=”[letters and numbers with lotsa dashes]”. Copy the UUID. Ex: abff2df8-dha6-d901–211b-8da8dba9d701)

6. “sudo nano /etc/fstab” (This will change what you see on PuTTY. Imagine as if you just opened notepad on windows, nothing has been lost. This is just a pop up window.)

As explained in step 8.

7. Now type “UUID=”[UUID GOES HERE]” /mnt/Vault auto nosuid,nodev,nofail 0 0" below any other listed information as shown in the example above. (Right click to paste the UUID where your green cursor is located)

8. PressCTRL + X”

9. Press “Y”, then “Enter” (You should now be redirected to your previous window)

10. “sudo apt-get install tmux” (We are installing tmux to be able to keep certain programs running even when PuTTY is closed, give this time to install)

11. “sudo apt-get install golang” (golang is needed for us to use the Idena node, give this time to load. If you are having issues with this command - make sure you have the newest Ubuntu OS. See software requirements above.)

12. “sudo reboot” (Once again, reconnect to PuTTY afterwards.)

(Your SSD is now mounted under the directory “/mnt/Vault”. To verify this you can type “cd /mnt/Vault”. You should see that your position has changed. You can type and enter “cd ..” twice to back out to home, where we shall continue.)

13. “sudo nano /home/ubuntu/config”

— paste the below (!!!PAY ATTENTION TO THE “HTTPHost” SECTION!!!)—

{
“DataDir”: “/mnt/Vault/Idena/datadir”,
“P2P”: {
“MaxInboundPeers”: 12,
“MaxOutboundPeers”: 6
},
“RPC”: {
“HTTPHost”: “[YOUR RPI IPV4 ADDRESS HERE]”,
“HTTPPort”: 9009
},
“IpfsConf”: {
“Profile”: “server”,
“IpfsPort”: 40405,
“BlockPinThreshold”: 0.3,
“FlipPinThreshold”: 0.5
},
“Sync”: {
“FastSync”: true,
“LoadAllFlips”:true
}
}

14. PressCTRL + X”

15. Press “Y”, then “Enter”

16. “sudo nano /home/ubuntu/idena_node.sh”
— paste the below —

#!/bin/sh
cd /mnt/Vault/Idena
./idena-go — config /home/ubuntu/config

17. PressCTRL + X”

18. Press “Y”, then “Enter”

19. “cd /mnt/Vault”

20. “sudo git clone https://github.com/idena-network/idena-go Idena” (This may take some time, just wait a bit)

21. “cd Idena/”

22. “sudo go build -ldflags “-X main.version=[version.number.here]” “
This step will take a LONG while so wait patiently.
for example for node version “0.27.0” I would type:
sudo go build -ldflags “-X main.version=0.27.0”

23. “cd /home/ubuntu”

24. “tmux new -s i”
tmux is basically like opening a different window in the same linux session. allows you to run things in background. in this case we’re creating a new one called “i”

25. “sudo bash idena_node.sh”
After it starts and runs for a second, stop it by pressing “Ctrl+C” on your keyboard.

26. Press Ctrl+B” and then (after pressing the first combination) “D” on your keyboard to detach yourself from that tmux session

27. sudo nano /mnt/Idena/datadir/keystore/nodekey”
remove whatever is there and paste the private key of the identity that you’d like to run the node then CTRL+X, Y, Enter, you know the drill.

28. “nano /mnt/Vault/Idena/datadir/api.key”
— take note of that api key. we’ll paste it into the client

29. “tmux attach -t i”
note that now we’re doing “attach” instead of “new”. basically connects us to that same secondary window that we called “i”

30. “sudo bash idena_node.sh”

31. “Ctrl+B” , then “D”
you may now close the PuTTY window to your RPI altogether. the tmux window will keep running.

32. Turn on the idena client on your computer.

33. Go to Settings > Node > Switch Connect to remote node. Change the node address to your RPI4 IP address and port number (step #13) and the API key to the API key (we got in step #28).
example:
Node Address: http://192.168.1.2:9009
Node API key: imnotgivinganexampleherelol

If all is well, your client will connect and it will say “Synchronizing” in top left. Once it’s synced you have successfully got your RPI4 Idena Node up and running. Congrats! You’ll now be mining Idena on a Raspberry Pi!

NOTE: if you didn’t put “-ldflags “-X main.version=[whatever is the latest version]” “ in the “go build” command, the client will show on the bottom “Update Node Version X.Y.Z” even if you actually have the latest. This is fine, except for hard forks where you absolutely have to do “-ldflags…” otherwise the client will freak out.

TO LAUNCH THE NODE IF THE RPI TURNS OFF/SHUTS DOWN/IS REBOOTED/ETC.

1. Log in to your RPI
2. “tmux new -s i”
3. “sudo bash idena_node.sh”
4. “Ctrl+B”, “D”
5. close the rpi window

TO UPDATE YOUR NODE WHICH IS RUNNING
When a new version of the node comes out:

  1. Log in to your RPI via PuTTY
    2. “tmux attach -t i”
    attach yourself to the running node session
    3. “Ctrl+C”
    kill the process but only press this once, so the node gets to shutdown properly. if you don’t the SSD will have issues. wait for it to actually stop
    4. “Ctrl+B”, then “D”
    5. “cd /mnt/Vault/Idena”
    6. “sudo git pull”
    7. “sudo go build -ldflags “-X main.version=[whatever is the newest node version #]” “
    8. “sudo reboot“ (recommended, not required)
    9a. log in again and launch the node if rebooted
    OR
    9b.
    tmux attach -t i
    sudo bash idena_node.sh

    it is likely that after a node update and a rebuild, you’ll have to get a new api key. Just do
    nano /mnt/Vault/Idena/datadir/api.key
    and get the new key to put into the client. The identity key is unlikely to have changed, but you can always check by going to /mnt/Vault/Idena/datadir/nodekey/keystore.

IF YOUR RASPBERRY PI’S IPV4 ADDRESS CHANGES
When a new version of the node comes out:

You’ll know the address is different by checking the settings in your client and comparing it to your LAN’s connected devices ipv4 (under ubuntu). If these two IP addresses aren’t matching you will continually be offline, and you may not be able to connect via putty. All you have to do is “sudo nano /home/ubuntu/config” >> Change your “HTTPHost” to current IPV4 shown in LAN settings>> Change your Idena client settings to match your new IPV4 address>> Reboot RPI4

Follow steps above this lesson to open Idena node again.

EXTRA TIP!

Instead of launching putty every time you want to check your node. Make a bat file! Open your notepad and put this in it:

@echo off
start “Putty” “C:\Program Files\PuTTY\putty.exe” -ssh -L 9999:localhost:9009 ubuntu@[YOUR RPI IPV4 ADDRESS] 22 -pw [YOUR UBUNTU PASSWORD]

Save this as “connect.bat” and click it anytime you want access to your RPI.

I’d recommend logging into the RPI4 every now and then to make sure everything is running right. Example:
• There are no urgent security updates to the linux system (it’ll tell you upon login), for which you need to do “sudo apt update” + “sudo apt upgrade” + “sudo reboot”
• The RPI isn’t too hot (temperature under ~50 Celsius) quick way to check is:

sudo apt install hddtemp lm-sensors (Install sensor software)

sensors (check temp)

  • The RPI storage says there is plenty left (ex: “Usage: 11% of 28.9 GB” if your microSD is 32 GB).
    if it uses much more than that (ex: 50%+) it is likely that the SSD isn’t connected right or the node is not configured right, so the blockchain is being saved directly on your microSD. This is not good and you may have done an earlier step wrong.

Leave a comment if you have any trouble.

--

--