NOMP矿池搭建

本文将以dash(x11)和Raven(x16rv2)为例子来说明多算法矿池的搭建过程。

1 环境准备

1.1 准备Ubuntu

准备虚拟机或物理机,操作系统为Ubuntu 18.04

1.2 安装必需的包

sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev libboost-all-dev
sudo apt-get install git npm nodejs redis-server

1.3 下载源码

git clone https://github.com/zone117x/node-open-mining-portal.git nomp
cd nomp
npm update
执行完update后会编译更新一系列依赖库

2 配置矿池

这里钱包和矿池服务器分别部署在不同的机器上,当然它们也可以部署到同一台机器上。

2.1 服务器端配置

cp config_example.json config.json
config.json内容如下

  1 {
  2     "logLevel": "debug",
  3     "logColors": true,
  4 
  5     "cliPort": 17117,
  6 
  7     "clustering": {
  8         "enabled": true,
  9         "forks": "auto"
 10     },
 11 
 12     "defaultPoolConfigs": {
 13         "blockRefreshInterval": 1000,
 14         "jobRebroadcastTimeout": 55,
 15         "connectionTimeout": 600,
 16         "emitInvalidBlockHashes": false,
 17         "validateWorkerUsername": true,
 18         "tcpProxyProtocol": false,
 19         "banning": {
 20             "enabled": true,
 21             "time": 600,
 22             "invalidPercent": 50,
 23             "checkThreshold": 500,
 24             "purgeInterval": 300
 25         },
 26         "redis": {
 27             "host": "127.0.0.1",
 28             "port": 6379
 29         }
 30     },
 31 
 32     "website": {
 33         "enabled": true,
 34         "host": "10.10.1.230",
 35         "port": 8080,
 36         "stratumHost": "cryppit.com",
 37         "stats": {
 38             "updateInterval": 60,
 39             "historicalRetention": 43200,
 40             "hashrateWindow": 300
 41         },
 42         "adminCenter": {
 43             "enabled": false,
 44             "password": "password"
 45         }
 46     },
 47 
 48     "redis": {
 49         "host": "127.0.0.1",
 50         "port": 6379
 51     },
 52 
 53     "switching": {
 54         "switch1": {
 55             "enabled": false,
 56             "algorithm": "sha256",
 57             "ports": {
 58                 "3333": {
 59                     "diff": 10,
 60                     "varDiff": {
 61                         "minDiff": 16,
 62                         "maxDiff": 512,
 63                         "targetTime": 15,
 64                         "retargetTime": 90,
 65                         "variancePercent": 30
 66                     }
 67                 }
 68             }
 69         },
 70         "switch2": {
 71             "enabled": false,
 72             "algorithm": "scrypt",
 73             "ports": {
 74                 "4444": {
 75                     "diff": 10,
 76                     "varDiff": {
 77                         "minDiff": 16,
 78                         "maxDiff": 512,
 79                         "targetTime": 15,
 80                         "retargetTime": 90,
 81                         "variancePercent": 30
 82                     }
 83                 }
 84             }
 85         },
 86         "switch3": {
 87             "enabled": false,
 88             "algorithm": "x11",
 89             "ports": {
 90                 "5555": {
 91                     "diff": 0.001,
 92                     "varDiff": {
 93                         "minDiff": 0.001,
 94                         "maxDiff": 1, 
 95                         "targetTime": 15, 
 96                         "retargetTime": 60, 
 97                         "variancePercent": 30 
 98                     }
 99                 }
100             }
101         }
102     },
103 
104     "profitSwitch": {
105         "enabled": false,
106         "updateInterval": 600,
107         "depth": 0.90,
108         "usePoloniex": true,
109         "useCryptsy": true,
110         "useMintpal": true,
111         "useBittrex": true
112     }
113 }
config.json

其中34行改为Ubuntu主机IP地址,为了防止80端口被其他web服务占用,这里使用8080端口,见35行,36行是stratum协议域名,即矿池部署服务器绑定的域名,这里保持默认,其实这里也应是Ubutu主机IP地址,之后再生成两个算法的配置文件
cp pool_configs/litecoin_example.json pool_configs/dash.json
cp pool_configs/litecoin_example.json pool_configs/raven.json
两个文件内容如下

 1 {
 2     "enabled": true,
 3     "coin": "darkcoin.json",
 4 
 5     "address": "Xz2J7ktmY7Zip3xvp2hrHLXeUN3bBL75QB",
 6 
 7     "rewardRecipients": {
 8         "n37vuNFkXfk15uFnGoVyHZ6PYQxppD3QqK": 1.5,
 9         "22851477d63a085dbc2398c8430af1c09e7343f6": 0.1
10     },
11 
12     "paymentProcessing": {
13         "enabled": true,
14         "paymentInterval": 30,
15         "minimumPayment": 0.01,
16         "daemon": {
17             "host": "10.10.1.202",
18             "port": 9998,
19             "user": "wei",
20             "password": "0123456789a"
21         }
22     },
23 
24     "ports": {
25         "3008": {
26             "diff": 0.1
27         },
28         "3032": {
29             "diff": 32,
30             "varDiff": {
31                 "minDiff": 8,
32                 "maxDiff": 512,
33                 "targetTime": 15,
34                 "retargetTime": 90,
35                 "variancePercent": 30
36             }
37         },
38         "3256": {
39             "diff": 256
40         }
41     },
42 
43     "daemons": [
44         {
45             "host": "10.10.1.202",
46             "port": 9998,
47             "user": "wei",
48             "password": "0123456789a"
49         }
50     ],
51 
52     "p2p": {
53         "enabled": false,
54         "host": "10.10.1.202",
55         "port": 8333,
56         "disableTransactions": true
57     },
58 
59     "mposMode": {
60         "enabled": false,
61         "host": "127.0.0.1",
62         "port": 3306,
63         "user": "me",
64         "password": "mypass",
65         "database": "btc",
66         "checkPassword": false,
67         "autoCreateWorker": false
68     }
69 }
dash.json

 其中第5行的address必须为有效的地址,第6行的daemon里分别填写的是钱包运行主机的IP地址,端口号,配置文件里的用户名和密码,如图所示

 1 {
 2     "enabled": true,
 3     "coin": "raven.json",
 4     "address": "RVc3Pvo72yfzDoTqE6Z85YFXKKYgvDaoVa",
 5     "rewardRecipients": {
 6         "RQTE2qcKPCf1pVvBVcx9VLxSzx6ACyBoiB": 1
 7     },
 8     "paymentProcessing": {
 9         "enabled": true,
10         "paymentInterval": 20,
11         "minimumPayment": 0.01,
12         "daemon": {
13             "host": "10.10.1.3",
14             "port": 8766,
15             "user": "ravend",
16             "password": "Ao3iceIpAo3icjsn392H3iceIp"
17         }
18     },
19     "ports": {
20         "8888": {
21             "tls":false,
22             "diff": 0.5,
23             "varDiff": {
24                 "minDiff": 0.04,
25                 "maxDiff": 16,
26                 "targetTime": 15,
27                 "retargetTime": 60,
28                 "variancePercent": 30
29             }
30         },
31                 "7777": {
32             "tls":false,
33             "diff": 0.5,
34             "varDiff": {
35                 "minDiff": 0.04,
36                 "maxDiff": 16,
37                 "targetTime": 15,
38                 "retargetTime": 60,
39                 "variancePercent": 30
40             }
41         },
42         "9999": {
43             "tls":false,
44             "diff": 2.5,
45             "varDiff": {
46                 "minDiff": 1.5,
47                 "maxDiff": 16,
48                 "targetTime": 15,
49                 "retargetTime": 60,
50                 "variancePercent": 30
51             }
52         }
53     },
54     "daemons": [
55         {
56             "host": "10.10.1.3",
57             "port": 8766,
58             "user": "ravend",
59             "password": "Ao3iceIpAo3icjsn392H3iceIp"
60         }
61     ],
62     "p2p": {
63         "enabled": false,
64         "host": "127.0.0.1",
65         "port": 5889,
66         "disableTransactions": true
67     },
68     "mposMode": {
69         "enabled": false,
70         "host": "127.0.0.1",
71         "port": 3306,
72         "user": "me",
73         "password": "mypass",
74         "database": "vtc",
75         "checkPassword": true,
76         "autoCreateWorker": false
77     },
78     "mongoMode": {
79         "enabled": false,
80         "host": "127.0.0.1",
81         "user": "",
82         "pass": "",
83         "database": "vtc",
84         "authMechanism": "DEFAULT"
85     }
86 }
raven.json

 Raven配置和Dash类似,钱包的配置文件内容如下

 另外在coins目录下还需要准备两个币种的算法配置文件darkcoin.json和raven.json文件,内容如下:

1 {
2     "name": "Darkcoin",
3     "symbol": "DRK",
4     "algorithm": "x11",
5     "mposDiffMultiplier": 256
6 }
darkcoin
1 {
2         "name": "Raven",
3         "symbol": "RVN",
4         "algorithm": "x16rv2",
5         "txfee": 0.00005
6 }
raven 

 3 启动矿池并挖矿

运行如下命令启动矿池
sudo node init.js
矿池主界面如下所示

单击Getting Started可以看到该矿池支持Dash(Darkcoin)和Raven挖矿,再单击左侧的Raven可以看到x16rv2的stratum地址及端口,注意真正挖矿时需要用矿机部署的PC地址10.10.1.230替换cryppit.com

用开源代挖矿程序cpuminer-multi来验证搭建的矿池,编译后运行如下命令来进行挖矿
./cpuminer -a x16r -o stratum+tcp://10.10.1.230:7777 -u RVG96MbaKEDFzzj9NzbAuxkDt86KAm2Qj5 -p x -D -P -t 10
运行一段时间后可以看到后台软件相应的接收情况

 矿池Graph Status显示如下

Dash挖矿验证过程类似,不再进行详细介绍。

原创文章转载请注明链接:https://www.cnblogs.com/zhaoweiwei/p/nomp.html

posted @ 2019-10-28 12:14  weiwei22844  阅读(2665)  评论(0编辑  收藏  举报