Skip to content
Permalink
Browse files

BCH: v0.19.0 lightgbt dockerfile

  • Loading branch information...
bmhjyu committed May 9, 2019
1 parent ba5e163 commit e680d4f52d916c5847defa02861d42aaa35c2d14
@@ -0,0 +1,58 @@
#
# Dockerfile
#
# @author zhibiao.pan@bitmain.com, yihao.peng@bitmain.com
# @copyright btc.com
# @since 2016-08-01
#
#
FROM phusion/baseimage:0.11
MAINTAINER YihaoPeng <yihao.peng@bitmain.com>

CMD ["/sbin/my_init"]

# use aliyun source
# ADD sources-aliyun.com.list /etc/apt/sources.list

RUN apt-get update && apt-get install -y \
autoconf \
automake \
bsdmainutils \
build-essential \
curl \
git \
libboost-all-dev \
libevent-dev \
libssl-dev \
libtool \
libzmq3-dev \
pkg-config \
unzip \
wget \
yasm \
&& apt-get autoremove && apt-get clean && rm -rf /var/lib/apt/lists/*

# build bitcoind
RUN cd /tmp && git clone -b v0.19.0_lightgbt --depth 1 https://github.com/btccom/bitcoin-abc-1.git && \
cd bitcoin-abc-1 && ./autogen.sh && ./configure --disable-bench --disable-wallet --disable-tests && \
make -j$(nproc) && make install && rm -r /tmp/bitcoin-abc-1

# mkdir bitcoind data dir
RUN mkdir -p /root/.bitcoin

# logrotate
ADD logrotate-bitcoind /etc/logrotate.d/bitcoind

#
# services
#

# service for mainnet
RUN mkdir /etc/service/bitcoind
ADD run /etc/service/bitcoind/run
RUN chmod +x /etc/service/bitcoind/run

#service for testnet
#RUN mkdir /etc/service/bitcoind_testnet
#ADD run_testnet /etc/service/bitcoind_testnet/run
#RUN chmod +x /etc/service/bitcoind_testnet/run
@@ -0,0 +1,71 @@
Docker for Bitcoin-abc v0.19.0-lightgbt
============================

* OS: `Ubuntu 14.04 LTS`, `Ubuntu 16.04 LTS`
* Docker Image OS: `Ubuntu 16.04 LTS`
* Bitcoin ABC: `v0.19.0-lightgbt`

## Install Docker

```
# Use 'curl -sSL https://get.daocloud.io/docker | sh' instead of this line
# when your server is in China.
wget -qO- https://get.docker.com/ | sh
service docker start
service docker status
```

## Build Docker Images

```
cd /work
git clone https://github.com/btccom/btcpool.git
cd btcpool/docker/bitcoin-abc/v0.19.0-lightgbt
# If your server is in China, please check "Dockerfile" and uncomment some lines.
# If you want to enable testnet, please uncomment several lines behind `# service for testnet`
# build
docker build -t bitcoin-abc:0.19.0-lightgbt .
# docker build --no-cache -t bitcoin-abc:0.19.0-lightgbt .
# mkdir for bitcoin-abc
mkdir -p /work/bitcoin-abc
# bitcoin.conf
touch /work/bitcoin-abc/bitcoin.conf
```

### bitcoin.conf example

```
rpcuser=bitcoinrpc
# generate random rpc password:
# $ strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo
rpcpassword=xxxxxxxxxxxxxxxxxxxxxxxxxx
rpcthreads=4
rpcallowip=172.16.0.0/12
rpcallowip=192.168.0.0/16
rpcallowip=10.0.0.0/8
# use 1G memory for utxo, depends on your machine's memory
dbcache=1000
# use 8MB block when call GBT
# The blockmaxsize should be between 1000001 and 8000000.
blockmaxsize=8000000
```

## Start Docker Container

```
# start docker
docker run -it -v /work/bitcoin-abc:/root/.bitcoin --name bitcoin-abc -p 8333:8333 -p 8332:8332 -p 8331:8331 --restart always -d bitcoin-abc:0.19.0-lightgbt
#docker run -it -v /work/bitcoin-abc:/root/.bitcoin --name bitcoin-abc -p 8333:8333 -p 8332:8332 -p 8331:8331 -p 18333:18333 -p 18332:18332 -p 18331:18331 --restart always -d bitcoin-abc:0.19.0-lightgbt
# login
docker exec -it bitcoin-abc /bin/bash
```
@@ -0,0 +1,6 @@
/root/.bitcoin/debug.log {
daily
rotate 3
missingok
copytruncate
}
@@ -0,0 +1,13 @@
#! /bin/bash
#
# run shell for bitcoind
#
# @copyright btc.com
# @author zhibiao.pan@bitmain.com
#
export LC_ALL=C
SROOT=$(cd $(dirname "$0"); pwd)
cd $SROOT

OPT_ZMQ="-zmqpubrawblock=tcp://0.0.0.0:8331 -zmqpubrawtx=tcp://0.0.0.0:8331 -zmqpubhashtx=tcp://0.0.0.0:8331 -zmqpubhashblock=tcp://0.0.0.0:8331"
bitcoind -conf="/root/.bitcoin/bitcoin.conf" -datadir="/root/.bitcoin" $OPT_ZMQ
@@ -0,0 +1,13 @@
#! /bin/bash
#
# run shell for bitcoind: testnet
#
# @copyright btc.com
# @author zhibiao.pan@bitmain.com
#
export LC_ALL=C
SROOT=$(cd $(dirname "$0"); pwd)
cd $SROOT

OPT_ZMQ="-zmqpubrawblock=tcp://0.0.0.0:18331 -zmqpubrawtx=tcp://0.0.0.0:18331 -zmqpubhashtx=tcp://0.0.0.0:18331 -zmqpubhashblock=tcp://0.0.0.0:18331"
bitcoind -testnet -conf="/root/.bitcoin/bitcoin.conf" -datadir="/root/.bitcoin" $OPT_ZMQ
@@ -0,0 +1,4 @@
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

0 comments on commit e680d4f

Please sign in to comment.
You can’t perform that action at this time.