btcpool矿池-测试环境搭建及使用cgminer测试
注意:不管你做哪个币的池,都需要比特币源码,因为我们编译矿池的时候需要比特币源码里面的库
本项目未开源支付的代码,因此支付操作需要自己进行开发。
安装Bitcoind+ZMQ
apt-get -y install build-essential libtool autotools-dev automake autoconf pkg-config bsdmainutils python3
apt-get -y install libdb-dev libdb++-dev libminiupnpc-dev libzmq3-dev libssl-dev libboost-all-dev libevent-dev
apt-get -y install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev
#ToBuild
wget https://github.com/bitcoin/bitcoin/archive/v0.16.3.tar.gz
tar -zxvf v0.16.3.tar.gz
若我们想要创建非比特币矿池,我们无需对比特币源码进行编译,因此以下命令可以不执行;若创建比特币矿池,需要编译比特币钱包或自行前往比特币官方github下载
cd bitcoin-0.16.3/
./autogen.sh
./configure --with-incompatible-bdb --prefix=/work/bitcoin
make
make install
#start/stop service
cd /work/bitcoin/bin/
./bitcoind --daemon-testnet -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331
#./bitcoin-cli-testnet stop
安装ZooKeeper
apt-get install -y zookeeper zookeeper-bin zookeeperd
#mkdir for data
mkdir -p /work/zookeeper
mkdir /work/zookeeper/version-2
touch /work/zookeeper/myid
chown -R zookeeper:zookeeper /work/zookeeper
#set machine id
echo 1 >/work/zookeeper/myid
#edit config file
vim /etc/zookeeper/conf/zoo.cfg
initLimit=5
syncLimit=2
clientPort=2181
clientPortAddress=127.0.0.1
dataDir=/work/zookeeper
#伪分布式
server.1=127.0.0.1:2888:3888
#start/stop service
service zookeeper restart
#service zookeeper start/stop/restart/status
安装Kafka
#install depends
apt-get install -y default-jre
#install Kafka
mkdir /root/source
cd /root/source
wget https://archive.apache.org/dist/kafka/2.2.1/kafka_2.11-2.2.1.tgz
mkdir -p /work/kafka
cd /work/kafka
tar -zxf /root/source/kafka_2.11-2.2.1.tgz --strip 1
#edit conf
vim /work/kafka/config/server.properties
broker.id=1
offsets.topic.replication.factor=1
message.max.bytes=20000000
replica.fetch.max.bytes=30000000
log.dirs=/work/kafka-logs
listeners=PLAINTEXT://127.0.0.1:9092
#伪分布式
zookeeper.connect=127.0.0.1:2181
#start server
cd /work/kafka
nohup /work/kafka/bin/kafka-server-start.sh /work/kafka/config/server.properties >/dev/null 2>&1 &
安装BTCPool
cd /work
安装需要的包
apt-get update
apt-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.5
mkdir -p /root/source && cd /root/source
wget https://github.com/zeromq/zeromq4-1/releases/download/v4.1.5/zeromq-4.1.5.tar.gz
tar zxvf zeromq-4.1.5.tar.gz
cd zeromq-4.1.5
./autogen.sh && ./configure && make -j$CPUS && make check && make install && ldconfig
#glog-v0.3.4
mkdir -p /root/source && cd /root/source
wget https://github.com/google/glog/archive/v0.3.4