Notes on v2.1.7 light mode for nkn-commercial on Digital Ocean

NKN Lite Node by AL

This is the quick tutorial I used to upgrade my nkn-commercial node on Digital Ocean to v2.1.7 light sync mode.

Warning: If you used nknx.org Fast Deploy, the method is slightly different. Please scroll down to the reply post about the nknx Fast Deploy instructions

Prerequisites:

  • I installed the nkn-commercial node via Digital Ocean marketplace 1-click, selecting the $5 droplet with 25GB SSD, and using custom data to fill in the beneficiary address
  • Since it was installed more than a year ago, it was running v2.1.6 with 99.9% of disk full. So the node is offline, both from nknx.org dashboard and from nstatus.org

Steps 1: Log into your droplet/VM as root

ssh root@YOUR_IP_ADDRESS

Step 2: Find your nkn node directory

cd /home/nkn/nkn-commercial/services/nkn-node/

Step 3: delete all Chain database

rm -Rf ChainDB

Step 4: modify config.json

You are welcome to use your favorite text editor, e.g. nano or vi and adding one line to the config.json file
"SyncMode": "light",

Screen Shot 2021-10-21 at 9.58.50 AM

Step 5: update your Linux operating system

This step is optional but recommended so your Linux operating system is always up to date and with all the latest security patches. Assume you are using Ubuntu, the following commands will do:

apt update
apt upgrade -y

Step 6: Reboot your VM

reboot

Voila! and aftermath

In a few minutes after rebooting, your nkn-commercial node should be automatically upgrade to v2.1.7 and enabled light sync mode. You can use nknx.org or nstatus.org to check your node’s status. Since the Chain database is entirely deleted, the node has to start from zero to sync to the latest blockchain height. This process might take anywhere from a couple of hours to a couple of days, depending on your node’s Internet connectivity.

Once all is set and done, you will find that your disk usage will be dramatically reduced. From totally full to about 26% used (out of 25GB). Now your light node can run for a much longer time.

Screen Shot 2021-10-20 at 10.29.53 AM

Appendix: what is light mode or light node?

According to Ethereum definition:

Light node

  • Stores the header chain and requests everything else.
  • Can verify the validity of the data against the state roots in the block headers.
  • Useful for low capacity devices, such as embedded devices or mobile phones, which can’t afford to store gigabytes of blockchain data.

Light node still have all the states of the entire blockchain, for example the account balance of any wallet. But only full node have all the details of each individual historical transaction. So if your disk space is not a concern, e.g. my home Raspberry Pi, you are encouraged to continue to run full NKN node.

To learn more:

The End

The following instructions are for nknx.org Fast Deploy nodes ONLY!!!

NKNx.org Fast Deploy ONLY: specific instructions

This is the script that can automatically upgrade and enable light sync on NKNx.org Fast Deploy nodes

sudo wget -O tolitesync.sh "https://nknx.org/api/v1/fast-deploy/linux-amd64/tolitesync"; bash tolitesync.sh

depending on your node hardware (in case you’re running on a pi) it is:
linux-armv8 , linux-armv7 and linux-armv6 respectively instead of linux-amd64

I wonder if the light mode will affect the mining income.

It will not impact mining income. There is no difference in terms of mining reward, whether it is light or fast sync, or normal sync.

1 Like