HowTo run and connect to PoW Miner pool

From Veriblock Wiki
Jump to: navigation, search

See: Main_Page, NodeCore_Networking

See also: List_of_mining_pools_testnet

Overview

A brand new pool will start at Current Round = 1, as the Current Round is based on number of blocks won... not to be confused with the current blockchain height

  • Current Round: X - the blocks that have been won by this pool. This increments each time the pool wins a new block.
  • Pool Mining Block: Y - the current block the pool is working on
  • Blockchain height: Z - the height of the blockchain

Once a round is won, then the pool payouts the reward from the block proportionally to all the shares submitted.

For example, if you mine on a pool for 10 minutes, and it wins a block (block time is targeted for every 30 seconds, other pools may win other blocks in the meantime), and you contributed 10% of the shares to that round, then you will receive approximately 10% of the block reward (less pool fees).

Technical note - The pool data is stored in the file: "\testnet\poolshares-normal.txt". Is that is deleted, then the html page will start anew.

Setup a Pool

In order to run a pool that is compatible with the vProgPoW fork (occurring on MainNet block 1512000), pool operators must use the following settings for the vProgPoW pool to correctly bind the stratum server to be reachable from any remote host on port 8502:

stratum.mining.bind.address=0.0.0.0
stratum.mining.bind.port=8502

Modify the nodecore.properties file:

#Allow the pool statistics page to be reachable from any remote host
pool.stats.bind.address=0.0.0.0

#Allow the UCP pool server to be reachable from any remote host (Can remove after vProgPoW fork)
ucp.mining.bind.address=0.0.0.0

#Allow the Stratum pool server to be reachable from any remote host
stratum.mining.bind.address=0.0.0.0

#Bind the Stratum pool server to port 8502
stratum.mining.bind.port=8502

#set the pool fee
# Decimal value between 0 and 1, representing a percentage, i.e. 0.01 = 1%
pool.operator.fee=0.01

#set the address the pool fees are paid out to. 
# NOTE: This should be different than the pool address that appears on the website.
pool.operator.address=VHPQB7kUNtkKFLdx3CyB6rAyHAhdAS

#on nodecore start, automatically run the pool
pool.standard.autostart=GPU

#OPTIONAL - inject custom html into pool
pool.custom.html=pool_html_file.txt

#OPTIONAL - specify some miner comment that will show up the blockchain, such as your pool name or url
pool.operator.comment=myPool

  1. Run an instance of NodeCore
  2. In the NodeCore_CommandLine, run startpool, either for CPU or GPU. Note that one instance of nodecore supports only 1 pool. If you want both a CPU and GPU, then you'll need to run two instances of NodeCore, one for each.
    1. Run 'startpool CPU'
    2. Run 'startpool GPU'
  3. Make note of the public IP (pool miners will connect to this)
  4. Open firewall ports for 8500/tcp, and 8501/tcp (only prior to vProgPoW hardfork), and 8502/tcp such that other clients can connect

Opening firewall ports will vary per OS and version. One set of commands is:

firewall-cmd --permanent --add-port=8500/tcp
firewall-cmd --permanent --add-port=8501/tcp
firewall-cmd --permanent --add-port=8502/tcp
firewall-cmd --reload


Note the Pool Address is created by the pool service, and is separate from the 'pool.operator.address' that the fee is paid to.

Pool settings v2.png

Choose a Pool Type

NOTE: After the vProgPoW fork, only the GPU pool will be viable (until the economically gated ASIC transition occurs, at which point GPU and [future-feature] ASIC pools will be viable).

A pool can be either CPU, GPU, or FPGA (CPU and FPGA pools will be deprecated at the vProgPoW fork height). Simply pass in the type to the command line:

#CPU
startpool CPU

#GPU (Use only this one after vProgPoW hardfork)
startpool GPU

Set the auto-restart option

For better pool stability, set nodecore.properties to auto-restart the pool. When nodecore starts (or restarts), it will automatically start the pool without needing to run the NC_CLI startpool command.

pool.standard.autostart = GPU

For a solo pool, just specify the address:

pool.solo.autostart=V5QCsNjm8nzqWi1ymHtF3GWPEDsd2g

Set custom html for your pool

This is optional, but if you wanted to add custom html to the top of your pool's web page, such as your website or a contact, then set the nodecore.properties file:

pool.custom.html=pool_html_file.txt

"pool_html_file.txt" is relative to the bin folder.

This takes the contents of the file and injects it directly into the top of the pool html page as an html snippet.

See: HowTo_run_and_connect_to_PoW_Miner_pool#How_to_inject_custom_HTML_into_the_pool

Update memory

Modify nodecore or nodecore.bat to allow Java to use more memory instead of the default 6. Consider 16g, 24g, or 32g depending on your pool size.

# Add default JVM options here. You can also use JAVA_OPTS and NODECORE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-XX:+HeapDumpOnOutOfMemoryError" "-Dio.netty.noUnsafe=true" "-Xmx16g"'

Configurations

  • If you experience issues where miners are banned you can modify these parameters inside nodecore.properties
    • stratum.max.connections.per.address=100
    • stratum.ban.threshold=20

Starting in NodeCore 0.4.6:

  • pool.cycle.time
Added nodecore properties for pool operators: "pool.cycle.time". It is an integer representing the number of milliseconds between recalculation of pool mining jobs. The default value is 3000 (3 seconds), which differs from prior versions of NodeCore that were using a fixed 500ms schedule.

Run in a loop

If for whatever reason NodeCore crashes, you'll want to run it in a loop that auto-restarts for best uptime. Consider a script like so:

Windows : "nodecore-loop.bat"

:execute
call nodecore.bat

echo ----------------------------------------------------------------------
echo ^| NodeCore is restarting in 30 seconds!                              ^|
echo ^| Press CTRL+C to cancel this or ENTER to proceed immediately...     ^|
echo ----------------------------------------------------------------------
timeout /t 30 > NUL
echo Restarting NodeCore...
goto execute

Linux : "nodecore-loop"

while true
do
    ./nodecore
	
    echo ----------------------------------------------------------------------
    echo ": NodeCore is restarting in 30 seconds!                              :"
    echo ": Press CTRL+C to cancel this or ENTER to proceed immediately...     :"
    echo ----------------------------------------------------------------------
    read -t 30
    echo Restarting NodeCore...
done

What success looks like

There will be two addresses: (1) the pool address (on the pool html page), (2) the pool owner's address that any fees are sent to.

A pool wins a block, and then sends many transactions to all the contributing workers:

  1. The address from the pool html page should exist in the block explorer
  2. This usually has a very small balance, such as between 0 and 1 block reward
  3. Once a block has been won, it has transactions (to send the reward to all the contributing workers)

Pool success 2.png

The file structure in the testnet folder will look something like so:

  • 3 groups of files for nodecore.dat, pool.dat, and wallet.dat

Pool success 3.png

Checklist

  • Html page shows up, per success screenshots above
  • For a public pool, reach out on Telegram/Discord to make sure it's listed here: List_of_mining_pools_testnet
  • Join the pool community on Discord: https://discord.gg/phazWBE
  • Some pool monitoring. The pool exposes an API like so: http://<your_pool_url>:8500/api/summary. Set up your favorite http monitoring tool to alert you if your pool goes down
  • Auto-restart script (listed above). If for whatever reason your pool dies, you'll want NodeCore to instance restart
  • Some anti-DDOS protection. If you're a pool admin, reach out to the pool channels on discord

Connect to an Existing Pool

To run the GPU miner, see instructions here: https://wiki.veriblock.org/index.php/HowTo_run_vProgPoW_GPU_Miner

You can see pool mining statistics, including the number of shares you are submitting (based on the VeriBlock address you are mining to) by viewing the web page:

http://<IP_Address>:8500

API

View a specific address

Not really an API, but will highlight address in the HTML page and show an address summary

http://testnet-pool-gpu.veriblock.org:8500?address=VEcTwuZfAmBABEFTguoYgyQVR55Job


Pool address highlight.png

View pool summary

Breaking change, as of 0.3.4:

http://testnet-pool-gpu.veriblock.org:8500/api/summary

{
  "network": "TestNet",
  "poolType": "GPU",
  "poolAddress": "VJ2WZN7nB4AVDJZc2Sg1whwJLAUPNr",
  "fee": 0.0,
  "currentRoundNumber": 2,
  "miningBlockNumber": 48267,
  "lastBlockNumber": 48266,
  "lastBlockHash": "00000000000187D3269B861CA088C7C188D8617A74E89993",
  "recentRoundsIncluded": 1,
  "recentRoundsTotalShares": 183,
  "recentRoundsAverageShares": 183,
  "recentHashRate": 1209198484,
  "displayAddress": false,
  "recentRoundsSingleAddressShares": 0,
  "recentRoundsSingleAddressPercent": 0.0,
  "applicationVersion": "VeriBlock NodeCore v0.3.4",
  "nodeCoreStartTime": 1538408980,
  "timestamp": "Oct 1, 2018 6:01:33 PM"
}

View raw data

http://testnet-pool-gpu.veriblock.org:8500/api/raw

{
  "network": "MainNet",
  "poolType": "GPU",
  "poolAddress": "V2yArEZzZdy2XLFZekCN2CFhxBqr8v",
  "fee": 1,
  "currentRoundNumber": 221569,
  "miningBlockNumber": 2658629,
  "lastBlockNumber": 2658628,
  "lastBlockHash": "000000000450EC69E7780EDFDA803CFC96BE3B29490104F1",
  "recentRoundsIncluded": 5,
  "recentRoundsTotalShares": 182.8779943786243,
  "recentRoundsAverageShares": 36.57559887572486,
  "recentHashRate": 371679862,
  "displayAddress": false,
  "recentRoundsSingleAddressShares": 0,
  "recentRoundsSingleAddressPercent": 0,
  "currentRound": {
    "round": 221569,
    "shares": 78.23798598725486,
    "startTimestamp": 0,
    "endTimestamp": 0,
    "finished": false,
    "addresses": [
      {
        "address": "V4EREjdBR8UAXgjZBUpWEQMWKFLTmU",
        "shares": 13.742602546425443,
        "percent": 17.565128208520274,
        "hashRate": 0
      }
    ],
    "hashRate": 0,
    "rounds": [
      {
        "round": 221568,
        "shares": 46.579140609263,
        "startTimestamp": 1636032896,
        "endTimestamp": 1636032972,
        "finished": true,
        "finishedAt": "Sep 4, 2021, 1:36:12 PM GMT",
        "blockHash": "0000000003FDB5BA36695E1C8409B0171C47C8FB6D277C28",
        "addresses": [],
        "hashRate": 324948183
      }
    ],
    "applicationVersion": "0.4.11",
    "nodeCoreStartTime": 1635856024,
    "timestamp": "Sep 4, 2021, 2:38:02 PM"
  }
}

Useful NC_CLI pool commands

Get Information

Start and Stop the pool

Security

FAQ

Should I pool or solo mine?

Joining a pool reduces the variance.

If you join a pool, you are more likely to get a trickle of rewards because the pool has higher hashing rate, but splits among all the members. Pools will also have an operator fee, but that is negligible.

  • If you join a bigger pool (more hashes), then you are likely to get a more frequent trickle, but of smaller rewards because it's split among more people
  • If you join a smaller pool (less hashes), then you are likely to get less frequent rewards... but when (if) they come they'll be larger because it's split among less people

If you solo mine, when (if) you do a get a reward then you get the whole thing. If you solo mine at 1/10000 of the total network hash, statistically within 10000 blocks you will win a block and get the whole reward.

There is not a right or wrong answer to (1) Should I join a pool or solo mine, or (2) should I join a big pool or a small pool.

How to inject custom HTML into the pool

As of 0.3.11, NodeCore allows the ability to inject an HTML snippet into the pool html page.

In the nodecore.properties file, set the 'pool.custom.html=your-html-file-name.html'. This file will be injected into the top of the pool.

The pool html file's path is relative to the "bin" folder (so put the "your-html-file-name.html" file in "bin")

This requires restarting the whole NodeCore instance to first take affect. But once the nodecore.prop file is set, the content will be auto-picked up by the pool with each page refresh.

Pool html inject.png

Can I set a miner comment for blocks my pool wins?

Yes, as of 0.4.3

In nodecore.properties, set:

pool.operator.comment=myPool

This will show up in the blockchain and be visible in the explorer (shows us as HEX and not ASCI):

Pool miner comment 1.png

Troubleshooting

Cannot see the pool web page

Check for http (as in http://<IP_Address>:8500), not https

Ensure that the nodecore.properties file has been updated per above steps (and NodeCore was restarted).

Ensure that firewall ports are open for 8500/tcp and 8501/tcp

I start the pool but another computer can not connect its IP

Set this option in your nodecore.properties file (See: Nodecore.properties)

ucp.mining.bind.address=0.0.0.0

And restart NodeCore and the pool software

Error: unable to start pool Starting pool failed: the port 8500 is already bound on 127.0.0.1!

Ensure that the nodecore.properties file is updated per above, and restart nodecore.

Related:

Unable to start HTTP server!
java.net.BindException: Address already in use: bind

Ensure that nothing is binding on port 8500

This could be:

  • A second instance of NodeCore
  • Another process that coincidentally used 8500
  • A web server configuration/redirect that somehow "locks up" port 8500

To check for processes bound on port 8500:

In Windows:

  • In an admin cmd window, run "netstat -a -b"
  • Check Resource Monitor

In Linux:

  • Run "netstat -tulpn"

Pool is stuck at round 1

Troubleshooting questions to check:

  • Is there a miner connecting to it?
  • If you run NC_CLI getinfo, does it show the latest block (i.e. does NodeCore appear to be updating)?

Pool is stuck at block X

This should not happen, but if it does... have the administrator restart nodecore on the server.

Pool html page not showing up

Run this NC_CLI command:

restartpoolwebserver

It only restarts the web page, it does not kick out miners.

General Troubleshooting tips

Make sure that it works locally:

  • You can connect a miner on 127.0.0.1
  • You can view the html page at http://127.0.0.1:8500
  • You can connect NC_CLI on 127.0.0.1 and run getInfo and it shows the latest block

Make your you're connecting to the right ports:

The website is on port 8500
http://111.194.224.159:8500/

The vProgPoW miner connects to port 8502
111.194.224.159:8502