BTCpool矿池-测试环境搭建及使用cgminer测试
注意:不管你做哪个币的池,都需要比特币源码,因为我们编译矿池的时候需要比特币源码里面的库
本项目未开源支付的代码,因此支付操作需要自己进行开发。
%&&&&&%0
若我们想要创建非比特币矿池,我们无需对比特币源码进行编译,因此以下命令可以不执行;若创建比特币矿池,需要编译比特币钱包或自行前往比特币官方github下载
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
apt-get install -y zoOKeeper zoOKeeper-bin zoOKeeperd #mkdir for datamkdir -p /work/zoOKeepermkdir /work/zookeeper/version-2touch /work/zookeeper/myidchown -R zookeeper:zookeeper /work/zookeeper #set machine idecho 1 > /work/zookeeper/myid #edit config filevim /etc/zookeeper/conf/zoo.cfg initLimit=5syncLimit=2clientPort=2181clientPortAddress=127.0.0.1dataDir=/work/zookeeper#伪分布式server.1=127.0.0.1:2888:3888 #start/stop serviceservice zookeeper restart#service zookeeper start/stop/restart/status
#install dependsapt-get install -y default-jre #install Kafkamkdir /root/sourcecd /root/sourcewget https://archive.apache.org/dist/kafka/2.2.1/kafka_2.11-2.2.1.tgzmkdir -p /work/kafkacd /work/kafkatar -zxf /root/source/kafka_2.11-2.2.1.tgz --strip 1 #edit confvim /work/kafka/config/server.properties broker.id=1offsets.topic.replication.factor=1message.max.bytes=20000000replica.fetch.max.bytes=30000000log.dirs=/work/kafka-logslisteners=PLAINTEXT://127.0.0.1:9092#伪分布式zookeeper.connect=127.0.0.1:2181 #start servercd /work/kafkanohup /work/kafka/bin/kafka-server-start.sh /work/kafka/config/server.properties > /dev/null 2>&1 &
cd /work
安装需要的包
apt-get updateapt-get install -y build-essential autotools-dev libtool autoconf automake pkg-config cmake \ openssl libssl-dev libcurl4-openssl-dev libconfig -dev \ libboost-all-dev libgmp-dev libmysqlclient-dev libzookeeper-mt-dev \ libzmq3-dev libgoogle-glog-dev libhiredis-dev zlib1g zlib1g-dev \ libsodium-dev libprotobuf-dev protobuf-compiler # zmq-v4.1.5mkdir -p /root/source && cd /root/sourcewget https://github.com/zeromq/zeromq4-1/releases/download/v4.1.5/zeromq-4.1.5.tar.gztar zxvf zeromq-4.1.5.tar.gzcd zeromq-4.1.5./autogen.sh && ./configure && make -j $CPUSmake check && make install && ldconfig # glog-v0.3.4mkdir -p /root/source && cd /root/sourcewget https://github.com/google/glog/archive/v0.3.4.tar.gztar zxvf v0.3.4.tar.gzcd glog-0.3.4./configure && make -j $CPUS && make install # librdkafka-v0.9.1apt-get install -y zlib1g zlib1g-devmkdir -p /root/source && cd /root/sourcewget https://github.com/edenhill/librdkafka/archive/0.9.1.tar.gztar zxvf 0.9.1.tar.gzcd librdkafka-0.9.1./configure && make -j $CPUS && make install # libevent-2.0.22-stablemkdir -p /root/source && cd /root/sourcewget https://github.com/libevent/libevent/releases/download/release-2.1.10-stable/libevent-2.1.10-stable.tar.gztar zxf libevent-2.1.10-stable.tar.gzcd libevent-2.1.10-stable./autogen.sh./configure --disable-sharedmake -j$(nproc) && make install
安装BTCpool
mkdir -p /work && cd /workgit clone https://github.com/BTCcom/BTCpool.gitcd /work/btcpoolmkdir build && cd build
以下内容根据需要2选1
# Release build:cmake -DJOBS=4 -DCHAIN_TYPE=BTC -DCHAIN_SRC_ROOT=/work/bitcoin-0.16.3 ..make -j$(nproc)
# Debug build:cmake -DCMAKE_BUILD_TYPE=Debug -DCHAIN_TYPE=BTC -DCHAIN_SRC_ROOT=/work/bitcoin-0.16.3 ..make -j$(nproc)
注意:
-DCHAIN_TYPE=coin 这里的coin根据你想要编译的币种自行修改(仅BTC、BCH等sha256算法的币需要修改,其他币种ETH,Grin等默认使用BTC); -DCHAIN_SRC_ROOT=bitcoindir 这里的bitcoindir是源码路径,若选择BTC币种,则需要BTC源码;若选择BCH则需要BCH源码,根据需要自行修改
将install目录下的init_folders.sh文件复制到 build目录 然后执行
cd /work/btcpool/installcp init_folders.sh ../build/init_folders.shsh init_folders.sh
以上代码作用为:对编译成功的二进制文件生成相应目录并创建快捷方式
配置gbtmaker
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
0
启动gbtmaker
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
1
配置jobmaker
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
2
启动jobmaker
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
3
配置sserver
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
4
启动sserver
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
5
测试矿池是否已经正常运作
安装cgminer
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
6
cgminer测试
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
7
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
8
启动blkmaker
略
将/work/btcpool/install文件夹中的bpool_local_db.sql在数据库中运行
这边的sql分为各种币种,需要根据自己的需要进行选择
cd bitcoin-0.16.3/./autogen.sh./configure --with-incompatible-bdb --prefix=/work/bitcoinmakemake install #start/stop servicecd /work/bitcoin/bin/./bitcoind --daemon -testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331#./bitcoin-cli -testnet stop
9
apt-get install -y zookeeper zookeeper-bin zookeeperd #mkdir for datamkdir -p /work/zookeepermkdir /work/zookeeper/version-2touch /work/zookeeper/myidchown -R zookeeper:zookeeper /work/zookeeper #set machine idecho 1 > /work/zookeeper/myid #edit config filevim /etc/zookeeper/conf/zoo.cfg initLimit=5syncLimit=2clientPort=2181clientPortAddress=127.0.0.1dataDir=/work/zookeeper#伪分布式server.1=127.0.0.1:2888:3888 #start/stop serviceservice zookeeper restart#service zookeeper start/stop/restart/status
0
3 btc矿池客户端下载(btc矿池app) 16623 如果本文章对你有所帮助,或者暂时未解答完全你的问题,欢迎查看其他内容或收藏本站。
正加财富网内容推荐 | ||
OK交易所下载 | USDT钱包下载 | 比特币平台下载 |
新手交易教程 | 平台提币指南 | 挖矿方法讲解 |