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

From Veriblock Wiki
Revision as of 11:24, 7 November 2018 by HakureiAnna (talk | contribs) (Created page with "==常见问题==")
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. 确保nodecore在运行 (参见: HowTo_run_NodeCore)
  2. 在nodecore命令行界面中运行“startpool”指令。这样将在8501端口打开UCP的NodeCore协议,挖矿软件需要该协议。
  3. 解压缩 nodecore-reference-pow.zip
  4. 在bin文件夹中:如果是Windows系统则运行nodecore-reference-pow.bat, 如果是Linux系统则运行nodecore-reference-pow
  5. 输入所需要的参数
    1. How many threads would you like to mine on?(使用多少个CPU线程来挖矿?) --> 比如 2 或者 8 线程。
    2. What host:port would you like to connect to for mining?(连接到哪个矿池IP:端口来进行挖矿?) --> 127.0.0.1:8501
    3. What address would you like to mine to?(挖矿所得的收益地址是?) --> 本地Nodecore实例的默认地址即可, 比如"V6RRxmzJAhLkeWTzcFzQkQEgP2hC1e"。 可以通过在Nodecore命令行里运行getinfo指令以获得默认地址。

启动命令行会显示刚才的输入:

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

接下来会输出以下信息:

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

根据提交的份额,命令行会显示以下内容。注意,这些信息并不等于可以得到收益。

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

如何运行一个独立矿池

在nodecore命令行对话框中,连接到一个NodeCore实例并且运行startsolopool命令

startsolopool VHHqCkYqpJydXZB2uUs7msSKK5c2Xp

正常的响应如下:

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)

用常规方法打开Pow挖矿程序并填写相关内容(输入线程数量,矿池地址端口,一般为默认地址127.0.0.1:8501,然后是钱包地址)

示例:

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!

此时应当可以看到挖矿软件在运行,也应该可以通过本地网页:http://127.0.0.1:8500查看挖矿状况。

常见问题

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)