# 比特币本地测试网 ### 安装&运行 ``` sudo docker pull cfanhacker/btcp:1.1 sudo docker run --network host --privileged --restart always -itd cfanhacker/btcp:1.1 ``` 容器启动后,内部有两个bitcoin节点在运行,组成一个私有测试网,其中一个bitcoin节点监听48332端口,为bitcoind rpc端口,用户名btc密码btc 已经预创建好了钱包地址1GiMuTqQGBMmJAq6Ef7k5FAvsxBbLZjsTV 一个矿池服务端(nomp)运行于3032端口,矿机可连接该端口,通过stratum协议挖矿 https://github.com/mining-pool/not-only-mining-pool ### 挖矿 1. 使用cpuminer ./minerd -a sha256d -t 1 -o stratum+tcp://192.168.18.249:3032 2. 使用蚂蚁矿机 配置矿池地址为 stratum+tcp://192.168.18.249:3032 用户名(钱包地址) 1GiMuTqQGBMmJAq6Ef7k5FAvsxBbLZjsTV ### 使用 先运行 sudo docker ps 查看运行的容器id 假如容器id为d6702619f82e 进入容器bash sudo docker exec -it d6702619f82e /bin/bash cd /root 该目录下有几个常用脚本 查看bitcoin钱包地址 ./address.sh 查看钱包余额 ./balance.sh 查看bitcoind节点日志(tail) journalctl -f -u btcp1 查看bitcoind节点日志(vim) journalctl -u btcp1 查看矿池服务端日志(tail) journalctl -f -u mining_pool 查看矿池服务端日志(vim) journalctl -u mining_pool 重启bitcoin节点 systemctl restart btcp1 systemctl restart btcp2 重启矿池服务端 systemctl restart mining_pool ./cli.sh 等同于 bitcoin-cli 用于和 bitcoind节点交互,用法见bitcoin文档 https://developer.bitcoin.org/reference/rpc/index.html ### 配置 矿池服务端配置文件 /var/bitcoin/mining_pool/config.json 矿池难度可以在此配件文件内调整 修改配置文件后重启矿池服务 systemctl restart mining_pool
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.