Difference between revisions of "Easily deploy your Linux NKN node by yourself"

From NKN Community Wiki
Line 117: Line 117:

In the config file modify the beneficiary address ( you can create a wallet on <nowiki>[https://wallet.nkn.org/]</nowiki>(<nowiki>https://wallet.nkn.org//</nowiki>) )  
In the config file modify the beneficiary address ( you can create a wallet on https://wallet.nkn.org/ )  
  "BeneficiaryAddr": "YOUR-NKN-WALLET-ADDRESS-HERE",
  "BeneficiaryAddr": "YOUR-NKN-WALLET-ADDRESS-HERE",

Revision as of 09:37, 27 July 2021

📌 This guide will help you to configure and start a NKN Linux node using SSH.

NKN Node VS NKN Commercial

The first concept you need to understand is the difference between the NKN node and a NKN node Commercial.

NKN node

A NKN node is a message relayer in the network. Its only purpose is to store the information in the chain and relay messages through nodes. Running this type of node will allow you to get "mining rewards" only. As the NKN node is an open-source software you will need to download it from the NKN official Github account and keep it updated by yourself.

NKN Commercial

A NKN Commercial node is basically a NKN node with other software embedded in such as nConnect. Running a NKN Commercial node will allow you to get mining reward from your node activity but also "nano payments" from users using the embedded software. NKN Commercial are easier to keep up to date as an auto-update system is included.


In order to simplify the install the NKN community have build an "auto install" script called "ALLinOne-nknnode" , it is highly recommend to use this script to install your node unless you are comfortable with Linux, bash, GoLang, ...!  You can otherwise follow the line by line install instructions.

ALLinOne nkn node

Switch to root user if not root yet:

sudo su -

Start the script in terminal with this command:

wget -O nkndeploy.sh '<https://raw.githubusercontent.com/no112358/ALLinONE-nknnode/main/nkndeploy.sh>'; bash nkndeploy.sh

Follow the instruction on the screen.

Line by line instructions

Connect to your node using SSH

ssh username@instance-ip-address

Switch to root user of not root yet

sudo su -

Apply update, upgrade and auto remove

apt update && apt upgrade -y && apt autoremove -y  

Install the required packages

apt install sudo make curl git

Create the NKN user and add it in the sudo group

adduser nkn && usermod -aG sudo nkn

Switch to newly created user

su - nkn

Download GoLang

url=curl https://golang.org/dl/ | grep linux-amd64 | sort --version-sort | tail -1 | grep -o -E "https://dl.google.com/go/go[0-9]+\.[0-9]+((\.[0-9]+)?).linux-amd64.tar.gz" && wget ${url}

Install GoLang

sudo tar -C /usr/local -xvf echo ${url} | cut -d '/' -f5

Now that our installation has been finished, we need to make sure that go is present in the path so anyone can access go from anywhere without pointing to go directory. For that, we will add those path into rc file and resource it.

cat >> ~/.rc << 'EOF'

After you enter above command, next line will be >> only, expecting input from user till user enters EOF.

export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin

Re-source your rc file

source ~/.rc

and verify if go is correctly installed

# go version
go version go1.12.7 linux/amd64

It's now time to install your node from the NKN Github

mkdir -p ~/go/src/github.com/nknorg && cd ~/go/src/github.com/nknorg

Clone the repository

git clone https://github.com/nknorg/nkn.git

Now that we have our code, let’s change the directory to nkn and fire up build command

cd nkn && make

At this stage your node is compiling, you can now take care of its configuration

cp config.mainnet.json config.json && nano config.json

In the config file modify the beneficiary address ( you can create a wallet on https://wallet.nkn.org/ )  

"SeedList": [

Create a local wallet for your node

./nknc wallet -c

⚠️ This password will be used to run nkn service and miner, so don’t forget it.

It's now time to see if your installation is working !