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

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"
  }
}
2 Likes

Excellent!