Set up NOIA node on Linux

Antti Turunen
10 min readAug 8, 2019

--

About NOIA

NOIA is a super cool distributed ledger technology (DLT, a.k.a blockchain) project working on the next generation, programmable internet, tackling challenges in scaling, maintaining and protecting the current net infrastructure. You can and definitely should read more about the concept in NOIA website: https://noia.network

Benefits of running an own NOIA node

NOIA nodes maintain and secure the network as well as provide the needed bandwith and storage for the users. The project offers an opportunity to run an own node in NOIA network, giving a great chance to:

  • Learn Distributed Ledger Technology
  • Get hands on Linux command line
  • Earn NOIA tokens as reward

There is also a Windows version of NOIA node available, but you having this guide in front of you means you are a cool Linux command line guy.

Earning NOIA tokens

You can well run a node just for fun and learning, but for earning (see below) you need to register yourself. You can do it by giving your email address in the GET STARTED box in NOIA site (above) and continuing according the instructions.

NOIA is currently in its testnet phase 2, where you get rewards for maintaining a node in three categories:

  • Any type of node with WebRTC enabled (IPv4) : 50 NOIAs
  • VPS with IPv6 address : 100 NOIAs
  • Residential node with IPv6 address : 200 NOIAs

All these three categories require 120 hours of uptime per week. The hour counter is reset every Monday at 12.00 PM UTC. Residential node is typically a PC or a card computer like Raspberry Pi.

Taking IPv6 into use

Notice! Currently still in transition phase to IPv6 you must have also IPv4 TCP port 8048 and UDP port open. This is described in detail in the Prereqisites chapter further below.

You can see in the reward table that there is higher rewards offered to nodes using IPv6. This is because together with Segment Routing IPv6 is an essential piece of NOIA’s programmable internet, routing of data programmed on packet level.

IPv6 on PC and Raspberry Pi

If you are using a computer at home or office network, your computer can get an IPv6 address automatically after two main requirements filled:

  • Your internet service provider must support IPv6
  • Your router must support IPv6

Routers supporting IPv6 typically have a switch or two to click to get IPv6 enabled.

IPv6 and port forwarding

Notice! Port forwarding thru NAT is no longer needed in IPv6 world. Here each device connected to the router gets automatically a unique, public IP address that is passed through the router without extra settings for NAT.

IPv6 on VPS

Handling of IPv6 varies at different cloud service providers. E.g. Digital Ocean has a switch on the VPS dashboard to enable IPv6, where Hetzner Online has IPv6 activated as default (Currently still needing user action, described below in IPv6 tips). See your service providers documentation or contact their support to get forward.

Miscellaneous tips for IPv6

There are some web tools for testing IPv6 capability, but our focus is on command line, so here is some useful commands for checking IPv6 status.

To see if you have an IPv6 address defined, give command:

ip -6 addr

If you see an address starting with 2xxx:.. you have a public IPv6 address available. Here is an example:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2001:14bb:190:2d77:6420:ab58:7508:db95/128 scope global dynamic noprefixroute
valid_lft 65276sec preferred_lft 65276sec
inet6 2001:14bb:190:2d77:bb84:b5da:29c1:9d09/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 86207sec preferred_lft 86207sec
inet6 fe80::7c9d:122c:1e01:c352/64 scope link
valid_lft forever preferred_lft forever

Above you see the public address 2001:14bb:190:2d77:bb84:b5da:29c1:9d09/64 being available. The address beginning with fe80:.. is so called Link Local address. If you see only that, there is something missing in your IPv6 chain to internet.

A tip for Hetzner Online

Using Hetzner VPS, you can see the public IP address, but its state is deprecated. To get up working give the command below. Replace the address 2xxx:.. with the address you see with command ip -6 addr described above.

ip -6 addr change 2xxx:../64 dev eth0 preferred_lft forever

Currently the IPv6 address is dropped at restart of the VPS, so after restarting the VPS you must give the command above again. (This is reported to Hetzner.)

Checking if internet sees you thru IPv6

There is several ways to check that your you have a public IPv6 address available to internet.

Check your machine IP configuration with command

ip -6 addr

You should see an IPv6 format address beginning with 2xxx:.. like here:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2a01:4f8:1c17:7226::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::9400:ff:fe2d:c1d0/64 scope link
valid_lft forever preferred_lft forever

You can also ping Google through IPv6 network:

ping6 ipv6.google.com

One more way is to use dig command. Here you should get an IPv6 format address.
Notice!If command dig is not found, install package dnsutils with command sudo apt install dnsutils.

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'

Setting up a NOIA node

Finally, put on your nerd glasses on, and let’s go. Here is the procedure to follow.

The following commands works on up-to-date Ubuntu and Debian builds on HW like personal computer, Raspberry Pi or virtual private server.

Prerequisites

  1. You should have access to Linux command line of your machine, be it through console, ssh terminal or a mobile device.
  2. Your machine should be reachable from internet through:
    a) Internet Protocol version 6, described earlier in this document, or
    b) In case of IPv4 routing through ports TCP 8048 and UDP 8058. If your machine is behind a NAT router or firewall, ensure you open/forward ports TCP 8048 and UDP 8058.
    Detailed port forwarding instructions for different routers you can be found at https://portforward.com.
    NOIA node can also use NAT Port Mapping Protocol, so if your router supports NAT PMP, you can set it active in the node settings (explained later in this document) and port forwarding is done automatically.
  3. If you have blocked ports in iptables you can make the needed holes for the node with the commands below.
    Notice! Do this only if you have ports blocked. In different Linux distros these commands might be different. See iptables -h.
sudo iptables -A INPUT -p tcp –-dport 8048 -j ACCEPT
sudo iptables -A INPUT -p udp –-dport 8058 -j ACCEPT

If you have ufw (Universal WireWall) active and blocking ports, you need to give the commands:

sudo ufw allow 8048/tcp 
sudo ufw allow 8058/udp

After you have started the node, you can test the ports at https://check-host.net. Give NODE_EXTERNAL_IP_ADDRESS:8048 and click [TCP], then give NODE_EXTERNAL_IP_ADDRESS:8058 and click [UDP].

Working on different platforms

Here is very brief guides to get started with different machines:

  1. Linux PC

Open terminal window and jump to “Installing the software”.

2. Raspberry Pi

Get Linux to the MicroSD card:

  • Download Raspbian Buster Lite here: https://www.raspberrypi.org/downloads/raspbian/
  • Download and install balenaEtcher https://www.balena.io/etcher/
  • Insert the microSD to your card reader, start balenaEtcher, then select the image, your microSD disk and start flashing
  • To allow ssh access to your RPi create an empty text file named ssh to the created Raspbian directory. On Linux terminal you can just type touch ssh, and on Windows left-click the folder and select New ->Text file. (Notice: the file name must be just ssh, not ssh.txt!)

Connect and start the RPi

  • Insert the MicroSD to your RPi, connect LAN cable to the router and power supply to the wall
  • After a minute or two take ssh connection to RPi. You can see the IP address in your router’s DHCP client list, the user ID is pi and the password is raspberry. (If using Windows PC, Putty is the tool for ssh, even though in up-to-date Windows 10 there is ssh command available in command prompt. When using Linux terminal, command ssh does the trick.)

3. Installing on a VPS

The dashboards of different Cloud providers vary a bit, but usually they are quite self explanatory, and there are good guides available. Briefly, create a VPS with Debian 9 or 10. (Also Ubuntu is OK, but Debian has less needless stuff installed as default.) When ready and having the IP address and ssh password/keys available, open an ssh session to the node.

There is also a script for “one-click” installation of NOIA node to a VPS. If you want to use the script, it can be done like this:

cd ~curl -LO https://raw.githubusercontent.com/anttu-t/create-noia-node/master/nncreate.shsudo chmod u+x nncreate.sh./nncreate.sh

Help for using the script available here:
https://github.com/anttu-t/create-noia-node/blob/master/README.md

Installing the software

Here are the steps for installing the node software. You can copy-paste the whole code boxes one at a time to the command prompt. If the job seems too boring, try skipping a step or two and it gets more exciting…

Notice! If you are root, you do not to give sudo in front of the commands.

1. Install the modules needed for running the node:

sudo apt update
sudo apt -y install curl git build-essential python-dev

2. Install node.js:

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt -y install nodejs

3. Install npm: (You can try just apt install, but it may fail for broken packages. That is why aptitude is used here.)

sudo apt -y install aptitude
sudo aptitude install npm

4. Get noia-node-cli package:

git clone https://github.com/noia-network/noia-node-cli.git

5. Go to noia-node-cli folder and install NPM: (There is probably some warnings shown. Ignore.)

cd noia-node-cli
npm install
npm audit fix
npm run build

6. Test-run your node:

npm start

If everything went OK, you should see the log scrolling.

7. Stop the node:

Ctrl + C

8. Edit the node configuration file created by the test run:

nano ~/.noia-node/node.settings

a) If your router supports NAT Port Mapping Protocol that does port forwarding automatically, set natPmp=true. If you did port forwarding manually, set natPmp=false. Typically true is the best choice, but in case of problems despite of port forwarding correctly set in your router you might want to try setting this to false.

b) Edit the field airdropAddress under [node.blockchain] from null to your wallet address that you used in KYC process.

c) (Optional) Define the storage location and size under [node.storage]

dir : the folder of your choice
size : the spent disk amount in bytes

d) Save by pressing Ctrl + x, y, Enter

9. Start the node again:

npm start

Optional: NOIA node as a Linux service

To have your node running without having to keep the terminal open it is recommended to run the node as a Linux service. This also makes it possible to use the NOIA node data, status and statistics script described further below.

Important: Before creating the service file you must know how to define the service User and WorkingDirectory. USERNAME is the username you give when logging into the machine, (You can check it with command users.) and your HOME_DIRECTORY you can check with commands:

Ctrl+C (if the node is still running)cd ~
pwd
  1. Create noia.service file:
cd ~
nano noia.service

Copy-paste and edit (see above) the file content below:

[Unit]
Description=noia
[Service]
User=USERNAME
WorkingDirectory=HOME_DIRECTORY/noia-node-cli
ExecStart=/usr/bin/npm start
Restart=always
RestartSec=7
[Install]
WantedBy=default.target

Close the editor and save the file with Ctrl + X, Y, Enter

2. Copy the service file to /etc/systemd/system folder:

sudo cp noia.service /etc/systemd/system/

3. Enable and start the service:

sudo systemctl enable noia.service
sudo systemctl start noia.service

You can check that the node is running OK with journalctl command:

sudo journalctl -fu noia

You should see messages scrolling. (Exit with Ctrl + C).

Your TCP port 8048 is open if you see this “connected” with IP address message:

Sep 26 13:05:57 noia-k npm[6884]: info: [noia-node] WebRTC client client-id=WFCguYaTrkO4ZbFAncn2yNH7 connected (wrtc): ip=178.63.9.115, connected-clients=1.

If TCP port 8048 is blocked, after a few minutes after staring the node you will see this “connection failed” message:

Sep 26 14:39:12 atu-rpi3 npm[11873]: warn: [noia-node] WebRTC connection failed. Port 8048 or IP 176.93.69.174 might be unreachable.

This “wasClean=false” message tells you that you are already having a node with the same ERC20 address running somewhere else:

Sep 27 10:00:43 noia-k npm[25794]: info: [noia-node] Connection with master closed code=1002, reason=Unspecified connection closure reason, code=1002., wasClean=false

Notice! This message might look like an error, but no worries, this is fully normal:

Sep 11 16:11:23 noia-test npm[6209]: info: [noia-node] WebRTC client client-id=bLz9Qxmx07Rf3vdkfojPXsQx disconnected: connected-clients=0.

After stopping the log output with Ctrl + C you can do other tasks or close the terminal, and your node continues its hard work. As a service the node is also started automatically after a connection drop and/or changed nodes (dynamic) IP address as well as after power failure or reboot.

NOIA node data, status and statistics script

To get thorough data, status and statistics of your node, install and run the script nnstat.sh as follows.

  1. Download the script in your home directory and install dnsutils required for external IP address checking:
cd ~curl -LO https://raw.githubusercontent.com/anttu-t/noia-node-status/master/nnstat.shsudo apt install dnsutils

2. Give execute rights to the script

sudo chmod u+x nnstat.sh

3. Start the script

./nnstat.sh

Notice! With a brand new node you will get an error message until the first diacnostics message appears in the log. This message comes once in an hour, so you may need to wait up to an hour to get the data/status correctly shown.

Updating the node software

In case of upgrades to the node SW stop the node with Ctrl+C in the node screen or command sudo systemctl stop. Then upgrade with commands:

cd ~/noia-node-cli/
rm -rf node_modules
rm package-lock.json
git pull
npm install
npm run build

You can check the current version with command:

grep version ~/noia-node-cli/package.json

Then start the node with either command start npm or sudo systemctl stop noia.

NOIA Dashboard

You can check your earned NOIAs at https://dashboard.noia.network. The weekly up-time checkpoint is on Fridays at 12.00 PM UTC, and the dashboard is updated soon after that.

You can ask questions and send feedback about this guide to NOIA Telegram channel: https://t.me/NoiaNetwork. (or directly to @anttu on Discord or @anttut on Telegram)

This document will be continuously updated based on received feedback and possible changes in NOIA network.

--

--