如何运行基于CPU的PoW挖矿程序

From Veriblock Wiki
Revision as of 11:07, 7 November 2018 by HakureiAnna (talk | contribs) (Created page with "注意:如果在linux系统下运行nodecore-reference-pow时候遇到问题,则可能需要重新生成可执行的nodecore-reference-pow,通过使用以下命令:chm...")
Jump to: navigation, search
Other languages:
English • ‎中文(中国大陆)‎

参见: HowTo_run_PoW_GPU_Miner

概述

POW挖矿程序能够让区块链找到新区块并加入区块链中。该程序使用UCP协议经由8501端口连接到本地的NodeCore实例。

You can run the PoW Miner as an individual, or connect to a pool (See: HowTo_run_and_connect_to_PoW_Miner_pool)

该页面解释了如何独立的运行PoW挖矿软件

需要注意的是:PoW挖矿是跟PoP挖矿区分开的,两种挖矿形式都能获得VBK代币作为奖励,但是操作过程有一定差异。(参见: HowTo_run_PoP_Miner, PoW_vs_PoP_Mining)


步骤

注意:如果在linux系统下运行nodecore-reference-pow时候遇到问题,则可能需要重新生成可执行的nodecore-reference-pow,通过使用以下命令:chmod a+x nodecore-reference-pow

  1. Ensure that nodecore is running (see: HowTo_run_NodeCore)
  2. In the NodeCore CLI, run the "startpool" command. This will start the UCP NodeCore protocol on port 8501, which the miner needs.
  3. Unzip nodecore-reference-pow.zip
  4. In the bin folder, if Windows then run nodecore-reference-pow.bat, if linux then run nodecore-reference-pow
  5. Enter the input arguments
    1. How many threads would you like to mine on? --> such as 2 or 8.
    2. What host:port would you like to connect to for mining? --> 127.0.0.1:8501
    3. What address would you like to mine to? --> the default address for your local instance of nodecore, such as "V6RRxmzJAhLkeWTzcFzQkQEgP2hC1e". Run getinfo in the commandline to see the default address.

The Startup console output will prompt for input:

If running a local NodeCore instance, then use the NodeCore CLI to run the command: startpool
How many threads would you like to mine on?
2
What host:port would you like to connect to for mining? (Use the port for UPC. Default 127.0.0.1:8501)
127.0.0.1:8501
What address would you like to mine to?
V34RwWk5CEp5uE8L4SSpJWcwN29dKu

And then dump output like:

Note: server capabilities are 10011111111
Authentication successful!
Mining subscription successful!
Initial job: {"command":"MINING_JOB","request_id":{"type":"REQUEST_ID","data":1312098332},"job_id":{"type":"JOB_ID","data":0},"block_version":{"type":"BLOCK_VERSION","data":1},"previous_block_hash":{"type":"BLOCK_HASH","data":"000000011BA344746B3E0C3C86943BB4B453AAC0305854F2"},"pool_address":{"type":"ADDRESS","data":"V64wSk4Ag6a3dnGAU3M3CNdqLAnDsa"},"merkle_root":{"type":"TOP_LEVEL_MERKLE_ROOT","data":"211C2A34FD8FCB383D9597C71DBE05E27EF35B28377590AC"},"timestamp":{"type":"TIMESTAMP","data":1525038678},"difficulty":{"type":"DIFFICULTY","data":72017977},"mining_target":{"type":"TARGET","data":"000000ffffffffffffffffffffffffffffffffffffffffff"},"ledger_hash":{"type":"LEDGER_HASH","data":"F08396AB15DE7A70DD5C4CA590409B6908AA34BBB7790702"},"coinbase_txid":{"type":"TRANSACTION_ID","data":"0F257194F1598EE5A1C112CCE792E5A5B68746E1CC0B483D22BDA8DA18090444"},"pop_datastore_hash":{"type":"POP_DATASTORE_HASH","data":"F5A5FD42D16A20302798EF6ED309979B43003D2320D9F0E8EA9831A92759FB4B"},"miner_comment":{"type":"MINER_COMMENT","data":"Default NodeCore Pool Software"},"pop_transaction_merkle_root":{"type":"INTERMEDIATE_LEVEL_MERKLE_ROOT","data":"0000000000000000000000000000000000000000000000000000000000000000"},"normal_transaction_merkle_root":{"type":"INTERMEDIATE_LEVEL_MERKLE_ROOT","data":"38853B3A9E1C2062067C4395F5AB511999DC3323CB37488DDE3FDA91658F9C63"},"extra_nonce_start":{"type":"EXTRA_NONCE","data":2000000},"extra_nonce_end":{"type":"EXTRA_NONCE","data":2999999}}
Starting thread 0...
Starting thread 1...
Current Hashrate: 0.000 MH/s        VALID: 0        INVALID: 0
Current Hashrate: 0.690 MH/s        VALID: 0        INVALID: 0

Upon submitting a share, the console will output something like below. Note this is not a guarantee of a reward.

Current Hashrate: 0.673 MH/s        VALID: 0        INVALID: 0
Share on thread 1 on block 000000011BA344746B3E0C3C86943BB4B453AAC0305854F2
*** Miner submitted share (partial block) to pool ***
        Nonce: 4559309
        Timestamp: 1525038685
        Job Id: 0
        Block Hash: 000000CD8C333FB41F490B38DAA1A8695AF6B85502E38EDD
        Previous Block Hash: 000000011BA344746B3E0C3C86943BB4B453AAC0305854F2
Update: {"command":"MINING_SUBMIT_SUCCESS","request_id":{"type":"REQUEST_ID","data":700641749}}
Share successfully submitted!
Current Hashrate: 0.644 MH/s        VALID: 1        INVALID: 0
Current Hashrate: 0.588 MH/s        VALID: 1        INVALID: 0
Current Hashrate: 0.610 MH/s        VALID: 1        INVALID: 0

How to run a solo miner

In the NC_CLI, connect to a NodeCore instance and run the startsolopool command

startsolopool VHHqCkYqpJydXZB2uUs7msSKK5c2Xp

Expected response:

By default, your pool homepage will be available in a web browser at:
        http://127.0.0.1:8500
And a VeriBlock Proof-of-Work (PoW) miner can be pointed to:
        http://127.0.0.1:8501
Remember that by default a solo pool mines to your default address!
You can view that address with the command: getinfo
You may also find the following commands useful ('help' for syntax):
        stoppool           (Stops the built-in pool service in NodeCore)
        getbalance         (See the balances of all of your addresses)
        setdefaultaddress  (Sets the default address of a NodeCore instance)
        startcpuminer      (Attempts to start the CPU PoW Miner in a new window)

200 success (142.7 ms)

Open up the PoW miner and run like normal (entering threads, host/port - probably the default 127.0.0.1:8501, and the username/address)

Example:

How many threads would you like to mine on? Default=1, Maximum suggested=8
1
What host:port would you like to connect to for mining? (Use the port for UPC. Default 127.0.0.1:8501)

Using default = 127.0.0.1:8501
What username/address would you like to mine to?
VHHqCkYqpJydXZB2uUs7msSKK5c2Xp
Note: server capabilities are 10011111111
Authentication successful!
Mining subscription successful!

You should see the miner running, and you should be able to view the local webpage: http://127.0.0.1:8500

FAQ

What is the reward for PoW Mining

43.755 VBK per block. If pool mining, then that reward will be split among the pool.

I submitted many shares, but my balance is still 0

Submitting a share does not mean that that share will be rewarded. The more shares submitted, the more likely to get a reward.

If submitting shares to a pool, AND the pool wins the block, the reward will be split proportional to the shares submitted to the pool.

Is there a GPU miner?

Yes. See: HowTo_run_PoW_GPU_Miner

Can I pass in arguments from the command line?

No, but you can set the properties in a config file such that it can be automated.

Add config file next to nodecore-pow.bat: nodecore_miner_pow.properties, and it will automatically pick up values and run:

#PoW Miner Configuration
miner.threadcount=2
miner.address=VC8H4BPSKfKkg1CNK2yKr9P6MD9Zh7
miner.host=127.0.0.1:8501

Troubleshooting

The PoW Miner instantly crashes

Try running the PoW Miner from a command line (instead of just clicking "nodecore-pow.bat") such that you'll see an error output even if the original window exits.

The most likely cause of the window instantly shutting down is that the pool has not been started. If you're running an individual miner, then go to the NC_CLI and run "startpool". (See: NodeCore_CommandLine#startpool)