btcpool矿池-接口测试构建及应用cgminer检测
留意:无论你做哪个币的池,都必须比特币源码,由于大家编译矿池的过程中必须比特币源码里边的库
本新项目未开源系统付款的编码,因而付款实际操作必须自身完成开发设计。
安装Bitcoind ZMQapt-get -y install build-essential libtool autotools-dev automake autoconf pkg-config bsdmainutils python3apt-get -y install libdb-dev libdb -dev libminiupnpc-dev libzmq3-dev libssl-dev libboost-all-dev libevent-devapt-get -y install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev #To Buildwget https://github.com/bitcoin/bitcoin/archive/v0.16.3.tar.gztar -zxvf v0.16.3.tar.gz
若大家需要建立非比特币矿池,大家不用对比特币源码开展编译,因而下列指令可以不实行;若建立比特币矿池,必须编译比特币钱包或自主前去BTC官方网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
组装ZooKeeperapt-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
安装Kafka#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 &
安装BTCPoolcd /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配备gbtmaker
cd /work/btcpool/build/mkdir run_gbtmakercd run_gbtmaker/vim gbtmaker.cfg gbtmaker = { rpcinterval = 5; is_check_zmq = true;};bitcoind = { zmq_addr = "tcp://127.0.0.1:18331"; rpc_addr = "http://127.0.0.1:18332"; rpc_userpwd = "bitcoinrpc:xxxx";};kafka = { brokers = "127.0.0.1:9092";};
运行gbtmaker
cd /work/btcpool/build/run_gbtmaker/mkdir log_gbtmaker./gbtmaker -c ./gbtmaker.cfg -l ./log_gbtmaker &tail -f log_gbtmaker/gbtmaker.INFO
启动jobmaker配备jobmaker
cd /work/btcpool/build/cd run_jobmaker/vim jobmaker.cfg testnet = true;jobmaker = { stratum_job_interval = 20; gbt_life_time = 90; empty_gbt_life_time = 15; file_last_job_time = "/work/btcpool/build/run_jobmaker/jobmaker_lastjobtime.txt"; block_version = 0;};kafka = { brokers = "127.0.0.1:9092";};zookeeper = { brokers = "127.0.0.1:2181";};pool = { payout_address = "mi9vpXBWJ31WGpRU7n7VJQG4PvTndHBoCN"; coinbase_info = "region1/Project BTCPool/";};
运行jobmaker
cd /work/btcpool/build/run_jobmaker/mkdir log_jobmaker./jobmaker -c ./jobmaker.cfg -l ./log_jobmaker &tail -f log_jobmaker/jobmaker.INFO
启动sserver配备sserver
cd /work/btcpool/build/cd run_sserver/vim ./sserver.cfg testnet = true;kafka = { brokers = "127.0.0.1:9092";};sserver = { ip = "0.0.0.0"; port = 3333; id = 1; file_last_notify_time = "/work/btcpool/build/run_sserver/sserver_lastnotifytime.txt"; enable_simulator = false; enable_submit_invalid_block = false; share_avg_seconds = 10;};users = { list_id_api_url = "http://index.qubtc.com/apidemo.php";};
运行sserver
cd /work/btcpool/build/run_sserver/mkdir log_sserver./sserver -c ./sserver.cfg -l ./log_sserver &tail -f log_sserver/sserver.INFO
检测矿池是不是已经正常的运行
cgminer检测BTC货币组装cgminer
cd /work/apt-get -y install build-essential autoconf automake libtool pkg-config libcurl3-dev libudev-devapt-get -y install libusb-1.0-0-devgit clone https://github.com/ckolivas/cgminer.gitcd cgminersh autogen.sh./configure --enable-cpumining --disable-openclmake
cgminer检测
./cgminer --cpu-threads 3 -o stratum tcp://127.0.0.1:3333 -u jack -p x./cgminer --cpu-threads 3 --url 127.0.0.1:3333 --userpass jack:x#./cgminer -o stratum tcp://127.0.0.1:3333 -u jack -p x --debug --protocol-dump#--debug,开发者模式#--protocol-dump,协议书导出
claymore检测ETH货币./EthDcrMiner64 -epool 127.0.0.1:3333 -ewal jack -epsw x -allpools 1
运行blkmaker
组装MySQL略
将/work/btcpool/install文件夹名称中的bpool_local_db.sql在数据库系统中运作
这里的sql分成各种各样货币,必须按照自身的必须做好挑选
配备blkmakercd /work/btcpool/build/cd run_blkmaker/vim blkmaker.cfg bitcoinds = ({ rpc_addr = "http://127.0.0.1:18332"; rpc_userpwd = "bitcoinrpc:xxxx";});kafka = { brokers = "127.0.0.1:9092";};pooldb = { host = "localhost"; port = 3306; username = "develop"; password = "iZ2ze3r0li2kgfvjkvs2xeZ"; dbname = "bpool_local_db";};
运行blkmakercd /work/btcpool/build/run_blkmaker/mkdir log_blkmaker./blkmaker -c ./blkmaker.cfg -l ./log_blkmaker &tail -f log_blkmaker/blkmaker.INFO