A NKN mining pool proposal

Our NKN mining pool implementation, tested using docker swarm & portainer

version: "3.7"
services:
  nknc:
    image: nknorg/nkn-commercial:latest-arm64v8
    restart: always
    networks:
      hostnet: {}
    deploy:
      mode: global
      placement:
        constraints: [node.platform.os == linux]
    command: "-b <beneficiary-addr> -d /data"
    volumes:
      - /root/nkn/data:/data
networks:
  hostnet:
    external: true
    name: host

How to use?

Go to your Portainer, Endpoint -> Stacks -> add Stack

copy & paste the stack code above, and replace the beneficiary-addr to be your mining pool address.

wait for the stack to be deployed.

Congras, Now you can publish your docker join command for other miner to join your pool.

# login to swarm manager endpoint.
# use following cmd to get join token for worker
docker swarm join-token worker

Enjoy, and I hope NKN can be mining friendly to all small contributors!

2 Likes

For miner who wants to join the pool,

Step 1, Install Docker

Step 2, Prepare data directory

mkdir -p ~/nkn/data/services/nkn-node/ChainDB/

Step 3, Prepare ChainDB files, optional but will save a lot of time

rsync -avh ./ChainDB/  ./nkn/data/services/nkn-node/ChainDB/

Note: ./ChainDB/ can be a NFS mounted dir, or Unziped from ChainDB_pruned_latest.tar.gz

Step 4, Run Docker join cmd to join the pool

# example join cmd
docker swarm join --token SWMTKN-1-3m2nbcg2hvome7awuybio3x3gevlzqjdrbn8grc9xt3f19mxtv-9pyqp71m55yv7prvmprgqf9nv 192.168.0.177:2377

Note: Most Cloud Provider will have default port rules which is not open for NKN node. you need to open them inorder to start mining.

TCP : 2377   # docker swarm
TCP : 30001-30005 # nkn node
TCP : 32768-65535  # nkn tuna rev
UDP : 32768-65535 # nkn tuna rev
TCP : 30020 # nkn tuna rev
TCP : 30010 # nkn tuna
UDP : 30011 # nkn tuna
UDP : 30021 # nkn tuna rev
TCP : 9001 # portainer agent

可以出一个centos的教程吗

centos 和Ubuntu没什么差别, 主要是docker的安装, 请参考

请教一下,该怎么部署矿池,部署一个nkn 矿池有什么硬件,网络上的要求?

Hi Jerry, I’m getting an error with the stack… image
is the image the same for everybody and also the volume section… also for the wallet address do we also remove the <> brackets or leave it?
image

are you running X86 ?

if so, please use this image

image: nknorg/nkn-commercial:latest

also remove the <> brackets when using your own address

volumes:
      - ~/nkn/data:/data

volume binding may also works with ~, but we have not tested yet.

nknorg/nkn-commercial:latest-arm64v8 (is this for android/PI) arm64?

looks like its working now… let me keep testing… thank you

Nice to see a mining pool proposal here! A few questions I have:

  1. This seems to be the worker side of the pool. Guess you have some controller side of the pool that collect information and distribute reward, etc?
  2. How does the mining pool know which node is in the pool and how to distribute reward?
  3. My understanding is that, if a node has joined the pool, but has never produced any block yet, it will never receive any reward from pool because the pool won’t even know this node has set up its beneficiary to the pool address. Is that correct?

In my opinion one of the most important features of a mining pool is to reward node that has made contribution but is not lucky enough to mine a block. So I want to know how your pool solution solves this problem.

BTW, we have used docker swarm before, but it seems to have some scalability issue. When there are many (e.g. thousands of) workers, the swarm manager will use a lot of resources. Just want to let you know about it.

2 Likes

Here what I have noticed so far trying it out.

  1. This seems to be the worker side of the pool. Guess you have some controller side of the pool that collect information and distribute reward, etc?
    Yes this is basically the worker side, still nothing yet setup to be able to automatically distribute the rewards, but it is possible.

  2. How does the mining pool know which node is in the pool and how to distribute reward?
    as of now the user would join the swarm and it will automatically install the node for them and it will input the pool beneficiary address. so the user would not have to do anything other than join the swarm and pay the nkn. The problem I see is that we would be able to see the node join the swarm but if a user later decides to change the beneficiary address we would not know unless something was setup to verify that. also some nodes go offline or start going to sync a lot so there would have to be something setup that would monitor that.

  3. My understanding is that, if a node has joined the pool, but has never produced any block yet, it will never receive any reward from pool because the pool won’t even know this node has set up its beneficiary to the pool address. Is that correct? yeah that is correct. node would be setup automatically but the user could change the beneficiary address later, but something could be setup to monitor that.
    I think another option is to setup and host the nodes for the user.
    example user goes to the site and selects how many nodes, and sends the nkn fee along with the monthly hosting fee and we would setup the node for the user. all the user would see is a dashboard with how many nodes they have and how much rewards they are getting. kind of like https://www.allnodes.com/host or something similar.

@jerry49 Hello,
I am new to the forum but interested in running a node without messing with ETH fees to get some NKN in order to activate the node.
Is there a way to join your pool using linux CLI without using docker?
Thank you!!!

ps: here I am --> 2021/05/26 15:42:48.790468 [WARN ] GID 1, Failed to create ID. Make sure node’s wallet address has enough balance for generate ID fee, or use another wallet to generate ID for this node’s public key.