NKN commercial: an all-in-one mining software for NKN ecosystem

nkn-commercial is an all-in-one mining software for NKN ecosystem. It will automatically run available services (e.g. NKN node, Tuna) and earn NKN token into your beneficiary address for all services.

nkn-commercial will keep all services running and upgraded automatically. On most Linux distributions, nkn-commercial can install itself as a systemd service so that it can be automatically started on system startup and restarted on exit.

Downloads

Linux: https://commercial.nkn.org/downloads/nkn-commercial/linux-amd64.zip
Linux (arm64): https://commercial.nkn.org/downloads/nkn-commercial/linux-arm64.zip
Mac: https://commercial.nkn.org/downloads/nkn-commercial/darwin-amd64.zip

Usage

nkn-commercial can be started by

./nkn-commercial -b <beneficiary-addr> -d <data-dir>

where <beneficiary-addr> is a NKN wallet address to receive rewards for all services (e.g. mining rewards for NKN node, NanoPay rewards for Tuna), <data-dir> is a directory to store all service data (e.g. ChainDB for NKN node). The data directory will be created if not exists.

nkn-commercial runs in foreground, stopping it will also stop all services. The recommended way is to keep it running reliably is using something like systemd.

Install as a systemd service (Linux only)

nkn-commercial can install itself as a systemd service. You first need to move nkn-commercial binary to a permanent location (which will used in systemd service file), and then run

sudo ./nkn-commercial -b <beneficiary-addr> -d <data-dir> -u <user> install

where <beneficiary-addr> and <data-dir> are same as you run nkn-commercial directly, <user> is the Linux user you would like systemd to run nkn-commercial as, who should have read and write access to the data directory. If user is not provided, root will be used, which is typically not
recommended.

If install succeeds, nkn-commercial will be started immediately, and restarted on exit or system startup.

The installation can be reverted by

sudo ./nkn-commercial uninstall

If uninstall succeeds, nkn-commercial will be stopped immediately, and no longer restarted automatically. However, service data will NOT be deleted so you can run or install nkn-commercial again in the future without losing any data.

Automatic port forwarding and detection

For services that require open ports (e.g. NKN node, Tuna), nkn-commercial will try to set up port forwarding (using UPnP or NAT-PMP) automatically and detect whether required ports are open. If ports are not open, it will not start corresponding service. A few port requirement examples:

  • NKN node: TCP/30001-30005
  • Tuna exit: TCP/30010, UDP/30011
  • Tuna reverse entry: TCP/30020, UDP/30021, TCP/32768-65535, UDP/32768-65535

Currently Tuna (tuna-exit and tuna-reverse-entry) is still in beta, so we only rollout it to less than 10% of the nkn-commercial instances randomly. This ratio will continue to increase slowly as Tuna is becoming more mature.

Config file

You can use config file to configure nkn-commercial or pass arguments to services. By default nkn-commercial will read config.json in current working directory, but this can be changed by using -c argument to specify config file path.

The top level values in config file controls global config for nkn-commercial, which has lower priority and will be overwrite by nkn-commercial cli arguments if privided. Per-service config can be specified under each service’s key. The following config file examples specifies the beneficiary address and data directory of nkn-commercial (if -b and -d arguments are not provided), and also pass additional arguments to nknd:

{
  "beneficiaryAddr": "xxx",
  "dataDir": "/etc/nkn-commercial",
  "nkn-node": {
    "args": "--wallet xxx --chaindb xxx --log xxx"
  }
}

If you want to bypass automatic port forwarding (using UPnP and NAT-PMP), and launch nknd regardless of public port check, you can use the following config. Only do so if you are 100% sure your port forwarding and firewall are set up correctly and working properly, otherwise you will end up with a nknd that cannot earn any rewards.

{
  "nkn-node": {
    "args": "--no-nat",
    "noRemotePortCheck": true
  }
}

A service can be disabled by setting disable field to true:

{
  "nkn-node": {
    "disable": true
  }
}
4 Likes

Excellent!

1 Like

Hello,

Where the ChainDB is stored after install nkn-commercial? I need to move it to another location since it is grow too big

1 Like

First stop the service and move the entire nkn-commercial folder to the new location.

Don’t forget to correct the systemd config file for nkn-commercial.

I believe the file is in /etc/systemd/system/nkn-commercial.service

Fix the 3 paths in that file to match the new location and start service.

1 Like

Hello. Please help me run the nkn-commercial file. Constantly reports an error.

What error do you get?

I coped with the installation. But, the generation ID has been writing for 5 hours already. Previously, it took 1-2 hours.

Generate ID is a random event, so there is a large variation. I had deployed 16 or so nodes in the past, and the generate id time varies from 30 minutes to 12 hours. But most are indeed about 1-2 hours.

2 Likes

@zbruceli @yilun is the Tuna project ready to be installed? I’ve got a couple of hundred active nkn nodes running and would love to utilize the servers more. The github repo seems lacking in documentation and clarity what’s it about.

Basically tuna is a universal tunneling service & marketplace that allows any network related application to become a service (e.g. httpproxy, reverse proxy) with token payment.

We still consider tuna to be alpha stage (that’s why we haven’t created any github release). Currently we are pushing tuna to nkn-commercial in greyscale, so around 10% nkn-commercial nodes are testing running tuna service node. Unlike mining, tuna reward comes from user directly, so it makes more sense to grow the user and service provider side at the same time to get a more balanced demand-supply market.

1 Like

Will service update nknd to the latest v2.0.9 before 2543000 height?

Yes it will

Is there a 32 bits version of nkn commercial ?

You mean amd or arm architecture?

amd 32

Currently not supported yet as some of the dependency is 64 bit. But you could still run nknd as it supports amd 32 bit.

1 Like

thank you

hello,
on some ubuntu server nodes i am getting this warning
time=“2021-05-04T13:24:54Z” level=info msg=“Dependency requirement not met.” program=generator
and the node never starts.
not sure what dependencies i need to install for generator

1 Like

Is nknd started on the machine? If not you need to check and make sure your port is open

1 Like