區塊鏈入門教程btcpool礦池源碼分析環境搭建

來源:互聯網
上載者:User

標籤:源碼   user   roo   pru   g++   tun   disable   code   term   

# btcpool礦池-測試環境搭建及使用cgminer測試本文檔基於Ubuntu 16.04 LTS, 64 Bits。![](http://i2.51cto.com/images/blog/201810/29/7555485d8d22fccbea56d0fcf44c6960.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)## 安裝Bitcoind+ZMQ```shell#Dependenciesapt-get -y install build-essential libtool autotools-dev automake autoconf pkg-config bsdmainutils python3apt-get -y install libssl-dev libboost-all-dev libevent-devapt-get -y install libdb-dev libdb++-devapt-get -y install libminiupnpc-dev libzmq3-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.15.1.tar.gztar -zxvf bitcoin-0.15.1.tar.gzcd bitcoin-0.15.1/./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安裝ZooKeeper
#Install 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.cfginitLimit=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://mirrors.tuna.tsinghua.edu.cn/apache/kafka/0.11.0.2/kafka_2.11-0.11.0.2.tgzmkdir -p /work/kafkacd /work/kafkatar -zxf /root/source/kafka_2.11-0.11.0.2.tgz --strip 1#edit confvim /work/kafka/config/server.propertiesbroker.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 &
安裝BTCPool
#Buildcd /workwget https://raw.githubusercontent.com/btccom/btcpool/master/install/install_btcpool.shbash ./install_btcpool.sh

如下內容為install_btcpool.sh展開:

CPUS=`lscpu | grep ‘^CPU(s):‘ | awk ‘{print $2}‘`apt-get updateapt-get install -y build-essential autotools-dev libtool autoconf automake pkg-config cmakeapt-get install -y openssl libssl-dev libcurl4-openssl-dev libconfig++-dev libboost-all-dev libmysqlclient-dev libgmp-dev libzookeeper-mt-dev# 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.0.22-stable/libevent-2.0.22-stable.tar.gztar zxvf libevent-2.0.22-stable.tar.gzcd libevent-2.0.22-stable./configuremake -j $CPUSmake install# btcpoolmkdir -p /work && cd /workgit clone https://github.com/btccom/btcpool.gitcd /work/btcpoolmkdir build && cd buildcmake -DCMAKE_BUILD_TYPE=Release ..make -j $CPUS
啟動BTCPool及cgminer測試btcpool啟動gbtmaker
#配置gbtmakercd /work/btcpool/build/mkdir run_gbtmakercd run_gbtmaker/ln -s ../gbtmakercp /work/btcpool/src/gbtmaker/gbtmaker.cfg ./vim gbtmaker.cfggbtmaker = {  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";};#啟動gbtmakercd /work/btcpool/build/run_gbtmaker/mkdir log_gbtmaker./gbtmaker -c ./gbtmaker.cfg -l ./log_gbtmaker &tail -f log_gbtmaker/gbtmaker.INFO
啟動jobmaker
#配置jobmakercd /work/btcpool/build/mkdir run_jobmakercd run_jobmaker/ln -s ../jobmakercp /work/btcpool/src/jobmaker/jobmaker.cfg ./vim jobmaker.cfgtestnet = 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/";};#啟動jobmakercd /work/btcpool/build/run_jobmaker/mkdir log_jobmaker./jobmaker -c ./jobmaker.cfg -l ./log_jobmaker &tail -f log_jobmaker/jobmaker.INFO
啟動sserver
#配置sservercd /work/btcpool/build/mkdir run_sservercd run_sserver/ln -s ../sservercp /work/btcpool/src/sserver/sserver.cfg ./vim ./sserver.cfgtestnet = 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";};#啟動sservercd /work/btcpool/build/run_sserver/mkdir log_sserver./sserver -c ./sserver.cfg -l ./log_sserver &tail -f log_sserver/sserver.INFO
cgminer測試btcpool
#安裝cgminercd /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,協議輸出
啟動blkmaker
#安裝MySQL待補充#配置blkmakercd /work/btcpool/build/mkdir run_blkmakercd run_blkmaker/ln -s ../blkmakercp /work/btcpool/src/blkmaker/blkmaker.cfg ./vim blkmaker.cfgbitcoinds = ({  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

區塊鏈入門教程btcpool礦池源碼分析環境搭建

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.