比特币挖矿——集群矿池btcpool

访客 阅读:16 2024-07-01 12:30:23 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

btcpool一个集群的解决方案,它使用了mysql数据库,web服务,kafka,zooKeeper,据说可以控制100000矿机。代码中逻辑和安装说明都比较完整,但还需要一些编写一些web界面做UI支持。配好之后就和其它大矿池差不多了。
挖矿的哈希碰撞需要大量计算,由矿机实现。而拆分集成运算量,分配任务,在矿机多的情况下也需要大量的算力支持。Btcpool是一个去中心化集群的解决方案(矿池内部去中心,对外自成体系)。N个矿机连一个控制板,控制板接入网络,通过端口连服务器,服务器再把拆分运算量的工作分担给矿池内的多台服务器同时计算。
它的主旨就是整套系统切分成功能块,块与块之间用使用kafka传递数据和信息,后台由zooKeeper负载均衡,从而使不同的功能块运行在不同的服务器上。像钱包和mysql这种频率使用的公用数据放在另外的服务器上,各功能块通过rpc,zmp等方式访问它们。
其中最核心的程序是sserver,矿机控制板连接的就是该程序。它支持Stratum协议。现在一般的比特币矿池都支持两种协议:getwork、stratum。getwork比较方便也非常好理解,直接连接到矿池挖矿。stratum协议是一个挖矿代理,先通过电脑稳定连接矿池,然后挖矿机连接到电脑上,通过电脑中转挖矿结果和接收新的block,因为有电脑作为中转,相对来说挖矿过程比较稳定。

Btcpool's cluster solution, which uses mysql database, web service, kafka, ZooKeper, is said to control 100,000 mine machines. Logic and installation instructions are complete in the code, but some of the web interfaces are required to be UI-supported.

1) 下载


2) 安装

btcpool源码里,虽然没有什么文档,但是README和INSTALL里面写得很清楚。

In the btcpool source code, although there are no documents, it is well written in README and INSTALL.


3) 注意事项

i. /work/btcpool/build/run_xxx/xxx.cfg文件必须根据具体信息修改,先安装好支持软件,最后修改配置文件。
ii. 集群的搭建方法必须按btcpool/docs/INSTALL*.md来操作,因为有一些重要参数,比如broker.id,max.size等等需要调整,如按一般方法安装,调试起来非常麻烦。
iii. 尽量不要变更目录,很多路径都是写死的
iv. 核心算法在src/bitcoin目录下,它编出来的是一个静态库,其它的可执行程序调用它。

i. /work/btcpool/build/run_xxx/xx.cfg files must be adapted to specific information, first install support software, and finally modify configuration files.
ii. Clusters must be built according to btcpool/docs/INSTALL*.md, because there are important parameters that need to be adjusted, such as broker.id, max.size, etc., that are installed in a normal way and that are difficult to calibrate.
iii. Try not to change the directory, many of which are paths
iv. The core algorithm is created under the src/bitcoin catalogue, which is a static library and other executable programs are used.

主要负责负载均衡。安装Kafka的说明书在/work/btcpool/docs/ INSTALL- ZooKeeper.md中,最好按它的步骤配置,否则调试可能很麻烦。ZooKeeper原理及调试方法见上篇《比特币挖矿——建立Kafka&Zookeeper集群》

Mainly responsible for load balance. In installing Kafka's instructions in /work/btcpool/docs/INSTALL-Zookeeper.md, it would be better to configure them at its own pace, otherwise debugging could be difficult. ZooKeeper principles and debugging methods can be found in the previous issue of Bitcoin Mining - Building Kafka&Zookeeper Clusters.

主要负责消息传送。安装Kafka的说明书在/work/btcpool/docs/ INSTALL-Kafka.md中,一定要按它的要求修改配置文件,如果一开始配置错误,后对调试很麻烦。具体原理及调试方法见上篇《比特币挖矿——建立Kafka&Zookeeper集群》
建topic操作见INSTALL.md脚本

Mainly responsible for transmitting the message. In installing Kafka's instructions in /work/btcpool/docs/INSTALL-Kafka.md, the configuration file must be modified in accordance with its requirements. If the initial configuration is wrong, then the debugging will be difficult. See the previous issue of Bitcoin Mining - Building Kafka&Zookeper Group
for the construction of the topic script at INSTALL.md

  1. 安装

  1. 建库

其它操作见INSTALL.md脚本

See INSTALL.md script for other operations

  1. 安装

  1. 需要写一个php,能输入如下内容

它与矿工连上来的用户名对应。

It corresponds to the name of the user connected by the miners.

ZeroMQ看起来像一个可嵌入的网络库, 但其作用就像是一个并发框架。它提供了各种传输工具, 如进程内, 进程间, TCP和组播中进行原子消息传递的套接字。
在install.sh脚本里下载到/root/sources/下,并安装,无需手动再安了。
在gbtmaker.cfg中的默认设置为使用zeromq通讯, 需要bitcoin钱包也支持zeromq,如果不想用它,在gbtmaker.cfg里将zmq相关的设为false,它将改为调用rpc通讯。

ZeroMQ looks like an embedded network library, but it acts as a co-mixing framework. It provides a variety of transmission tools, e.g. process, inter-process, TPCP and packaged atomic messages in the broadcast.
downloads to/root/sources/ install.sh scripts and installs them without manual installation.
default settings in gbtmaker.cfg are set to use zeromq communications, need bitcoin wallets to also support zeromq. If you do not want to use it, turn zmq-related settings into false in gbtmaker.cfg, which will be replaced with a rpc newsletter.

1) 说明

它负责管理后台进程,服务一般要长时间运行,它负责监测进程状态,在死掉时重启服务等等,其中的配置文件conf用于指定具体的程序及参数。

It is responsible for managing the back-office process and generally runs for long periods of time. It is responsible for monitoring the status of the process, restarting the service in the event of death, etc. The configuration fileconf is used to specify specific procedures and parameters.

2) 安装


将需要启动的服务配置写成conf文件复制到/etc/supervisor/conf.d下即可,其它操作见INSTALL.md脚本

The service configuration that will need to be started will be copied into /etc/subvisor/conf.d. See INSTATALL.md script for other operations

3) 常用命令



1) 自带的测试工具simulator


2) 模拟矿机连接


注意这里的用户名要和http服务上的匹配

Note that the usernames here match those on the http-service.

1) 一般调试过程如下:

i. 所有程序正常运行,不退出,不报错,不卡往。
ii. 矿机能连上矿池,能分配到工作,开始计算。
iii. 数据库中出现用户登录的记录。
iv. 数据库中的各项数据都显示正常。
v. 程序员做一些监控统计的工具,供一般用户使用。

i. All programs run well, do not quit, do not report wrong, do not get stuck.
ii. Miners can be connected to the pond, they can be assigned to work and start calculating.
iii. Records of user login appear in the database.
iv. All data in the database are shown as normal.
v. Programmers do some statistical monitoring tools for general users.

2) 调试说明:

i. 首先要根据具体情况修改各个.cfg文件
ii. 调试时,可以先不使用supervisorctl,直接调用/work/btcpool/build/run*中的程序,具体参数见对应的conf程序
iii. 建议从核心程序开始一个一个调试。默认有很多log文件,里面显示了具体程序出错的位置。调试的顺序是blkmaker->gbtmaker->jobmaker->sserver->其它
iv. 集成最重要的是配置文件和软件版本,配完后最好对其进行记录和备份
v. 综上,Btcpool提供了一个工作框架,真正用起来还需要做很多工作。

i. First, individual.cfg documents
ii. When debugging, it is possible to call directly /work/btcpool/build/run* without using Supervisortl, the parameters of which are described in the corresponding conf program
ii. It is recommended that a debugger start from the core program. The default is that there are a lot of log files that show where the specific program is wrong. The debugging order is blkmaker-> gbtmaker-> jobmaker-> sserver-& gt; other
iv. The compilation is most important to configure files and software versions, which are best recorded and backed up after completion
v.

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=69525

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友