Preparation
1. Prepare a full node for obtaining POW computing tasks. Please refer to the tutorial: https://developer.bytom.io/zh/guide/01_set_up_full_node.html
2. You need to install Go environment and configure the environment variables. It is recommended to use the latest Go1.17
Download source code to compile
Download source code
git clone https://github.com/Bytom/btmcpool.git
You need to put the source code in the directory specified by the Go path, if not, you need to create a new one
$GOPATH/src/github.com/bytom/btmcpool
Construct
go build -o target_file
If there is an error, confirm whether it is wrong with Go version or dependency package, because the basic dependency packages are already packaged in the project, so you can set it without looking in the environment
go env -w GO111MODULE=false
Run a mining pool
Configure operating parameters
$ cd $GOPATH/src/github.com/bytom/btmcpool/stratum/conf
The contents of the file are as follows:
mode: prod #
# server 服务器信息
stratum.id: 0 # 矿工的id分配
stratum.port: 9119 # 矿工连接端口
stratum.max_conn: 32768 # 最大矿工连接数
stratum.default_ban_period: 10m # 禁止恶意矿工连接# session 会话信息
session_timeout: 5m # 连接超时
session.sched_interval: 0 # 工作广播间隔,0表示新工作到来时立即广播
session.init_diff: 1050000 # 初始难度
session.min_diff: 1050000 # 最小难度
session.max_diff: 1050000 # 最大难度
session.target_rate: 0.1 # 提交频率,默认每10s提交一次工作
session.diff_step_rate: 0.1 #
session.sub_hist_len: 60 ## node 全节点信息
node.url:
-
http://127.0.0.1:9888 # BTMC节点ip
node.name: btmc_mainnet # 节点名称,默认为btmc_mainnet
node.sync_interval: 100ms # 从节点获取工作的时间间隔
service.port: 11002 # 服务器端口
Others can be the default, you need to modify node.url
After the configuration is complete, run BTMC pool, you need to specify the file directory configuration
$ cd $GOPATH/src/github.com/bytom/btmcpool/stratum/cmd
If the following information is printed, it means the startup is successful:
If you do not start the full node, get-work will report an error
After starting the full node, the task will be successfully obtained
Connect users to the mining pool
Configure the miner
URL: The ip and port of your mining pool, the port is the stratum.port parameter in the previous configuration file, the default is 9119
User: <mining address>.<mining machine code>, such as bm1q5mmx49m84muuhlmvm0qgezg4rzdxlucrns2ekt.001
Password: Do not need to fill in
Click to save
Check user connection
When a user connects to the mining pool, the session will increase
Get rewards
The mining pool will get BTMC mining rewards, and the mining rewards will default to the first account created by the full node (that is, the full node connected at runtime).
Summary
The btmcpool open source project provides basic mining pool capabilities such as BTMC (BTM1.0) to obtain work from full node and distribute to users, maintain user connections, submit work and other basic mining pool capabilities. Additional capabilities such as rewards distribution need to be added by users.
More details: https://github.com/Bytom/btmcpool