Difference between revisions of "Mining NKN with Linux"

From NKN Community Wiki
(Add commands)
 
Line 36: Line 36:
A light node is a node containing only sync headers of old blocks without transactions. This node use less disk space (3GB in Oct 2021) but is not be able to respond to <code>getblock</code> and <code>gettransaction</code> RPC requests for old blocks/transactions.
A light node is a node containing only sync headers of old blocks without transactions. This node use less disk space (3GB in Oct 2021) but is not be able to respond to <code>getblock</code> and <code>gettransaction</code> RPC requests for old blocks/transactions.


By default node are installed in "full mode". If you want to switch your node to "light mode" you need to modify the new <code>"SyncMode"</code> parameter of  your config.json file.  
By default node are installed in "full mode". If you want to switch your node to "light mode" you need to [https://wiki.my-nkn.cloud/index.php/Configure_your_NKN_node#SyncMode modify the new <code>"SyncMode"</code> parameter of  your config.json file].  


'''If you were running a node before 2.1.7 and want to switch from full mode to light mode it is possible!'''  
'''If you were running a node before 2.1.7 and want to switch from full mode to light mode it is possible!'''  

Latest revision as of 04:31, 20 October 2021

📌 This guide will help you to install a NKN node using Linux.

Requirements

NKN Node tech requirement
Spec Requirement
Operating system Ubuntu is recommended (works perfectly with Debian)
Memory 1GB
CPU Most of them works (AMD, ARM, MIPS,...)
Internet connection speed 10Mbps up and down is a minimum
Internet usage The amount of data used per month can be as high as multiple TB per month
IP address 1 IP version 4 (IPv4) is require per node. There is no way (and it would make no sense) to run multiple node on a single IP. IPv6 is not available.
Port forwarding You need to be able to reach the TCP/UDP ports 30001-30021. Optionally the TCP ports 30022-65535 for NKN Commercial services like nConnect. See our page about port forwarding

Disk space

Since version 2.1.7 NKN offers you 2 options regarding disk space. You can decide to build a full node or a light node.

A full node is a node with the entire history of transactions. This node use more disk space (17/22GB in Oct 2021) but contain the entire ledger and all the blocks transactions are available through its JSON RPC API.

A light node is a node containing only sync headers of old blocks without transactions. This node use less disk space (3GB in Oct 2021) but is not be able to respond to getblock and gettransaction RPC requests for old blocks/transactions.

By default node are installed in "full mode". If you want to switch your node to "light mode" you need to modify the new "SyncMode" parameter of your config.json file.

If you were running a node before 2.1.7 and want to switch from full mode to light mode it is possible!

  1. Stop your NKN node
  2. Delete the ChainDB folder
  3. Modify your config.json file, add "SyncMode" : "light" inside the json content.
  4. Start your NKN node

Your node should start to synchronise with the network from 0 but reach the current block within a short period of time.

Before you start

Please be sure to check all the following points

  • [ ]  I have 10.1NKN mainnet tokens (or I'm ready to buy them)
  • [ ]  My server is connected to internet
  • [ ]  I have setup my port forwarding


It's now time to ask yourself an important question: are you confident with the concepts of console, SSH, bash ?


Debug

Here is a cheatsheet of commands helping you to debug and understand better your node.

Find and reach your node install directory

cd "$(find / -type d -name "nkn-node" 2>/dev/null)"

Verify your node service status

systemctl status nkn-commercial.service

Start your node

systemctl stop nkn-commercial.service

Stop your node

systemctl start nkn-commercial.service

Check on your node last logs

journalctl -u nkn-commercial.service


The following commands needs to be entered inside your node install directory

Display your node status information

./nknc info -s

Display your node log in real time

tail -f nkn-node.log


Uninstall

Switch to root user if not root yet

sudo su -

Run the following command

/home/nkn/nkn-commercial/nkn-commercial uninstall