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

From VeriBlock Wiki
Jump to: navigation, search
This page is a translated version of the page HowTo run PoW CPU Miner and the translation is 100% complete.

Other languages:
English • ‎中文(中国大陆)‎

参见: HowTo_run_PoW_GPU_Miner

概述

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

用户可以独立运行矿池,亦可通过连接到其他矿池的方式式来运行PoW挖矿程序(参见: 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查看挖矿状况。

常见问题

挖矿奖励是什么

每个区块的奖励是43.755个VBK。如果加入了矿池,那么奖励将按照贡献分配个在池子里挖的矿工。

我提交了很多份额,但是我的余额还是为0

提交一个份额并不意味着那个份额将会获得奖励。提交越多份额,有越大的概率获得收益。

如果是在矿池里提交,并且矿池赢得了区块,那么奖励将会根据所提交份额的比例来分配。

有GPU挖矿程序了吗?

是的。参见: HowTo_run_PoW_GPU_Miner

可以在命令提示符下输入参数吗?

不可以。不过可以在配置文件里设置参数,这样程序就会自动运行了。

在nodecore-pow.bat文件后的nodecore_miner_pow.properties文件中加入以下配置节。程序会自动识别参数并自动运行。

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

故障排除

挖矿程序崩溃

试着通过命令行来运行PoW挖矿程序(代替直接运行“nodecore-pow.bat”程序),这样你将看到错误输出,而不是像之前一样程序直接退出

一般导致windows系统下程序闪退的原因很有可能是因为矿池没有启动,如果运行的是自己的独立挖矿程序,那么在nodecore命令行中运行“startpool”命令。