Skip to content

Commit

Permalink
feat(bitcoin-regtest): change subsidy interval to 21000 blocks (#20)
Browse files Browse the repository at this point in the history
* feat(bitcoin-regtest): change subsidy interval to 21000 blocks

* feat(bitcoin): update to v27.1
  • Loading branch information
louneskmt authored Jun 21, 2024
1 parent 48d89ae commit 0860d73
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 6 deletions.
83 changes: 80 additions & 3 deletions docker/bitcoin-regtest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,96 @@
FROM lncm/berkeleydb:v4.8.30.NC AS berkleydb

FROM alpine:3.18 AS builder

ARG VERSION

FROM lnmarkets/bitcoin:${VERSION}
WORKDIR /opt

COPY --from=berkleydb /opt /opt

RUN apk add --no-cache \
autoconf \
automake \
boost-dev \
sqlite-dev \
build-base \
chrpath \
file \
libevent-dev \
libressl \
libtool \
linux-headers \
zeromq-dev

RUN wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/bitcoin-${VERSION}.tar.gz

# Removed gpp signature verification
RUN wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS && \
grep "bitcoin-${VERSION}.tar.gz\$" SHA256SUMS | sha256sum -c -

RUN tar -xzf bitcoin-${VERSION}.tar.gz

WORKDIR /opt/bitcoin-${VERSION}

# Change the default subsidy halving interval for regtest from 150 to 21 000 blocks
RUN sed -i 's/consensus.nSubsidyHalvingInterval = 150/consensus.nSubsidyHalvingInterval = 21000/g' src/kernel/chainparams.cpp

RUN ./autogen.sh

RUN ./configure \
BDB_LIBS="-L/opt/db4/lib -ldb_cxx-4.8" \
BDB_CFLAGS="-I/opt/db4/include" \
CXXFLAGS="-O2" \
--prefix=/opt/build \
--enable-hardening \
--disable-tests \
--disable-bench \
--disable-ccache \
--disable-man \
--enable-static \
--enable-reduce-exports \
--without-gui \
--without-libs \
--with-utils \
--with-sqlite=yes \
--with-daemon \
--with-zmq

RUN make -j $(nproc) install

RUN strip /opt/build/bin/bitcoind && \
strip /opt/build/bin/bitcoin-tx && \
strip /opt/build/bin/bitcoin-wallet

FROM lnmarkets/base-alpine:3.18

ENV DATA_PATH=/home/.bitcoin
ENV MINING=true
ENV MININING_INTERVAL=30

RUN apk add --update --no-cache bash libcap
COPY --from=builder /opt/build/bin/* /bin/

RUN apk add --no-cache --update \
boost-filesystem \
boost-thread \
libevent \
libsodium \
libstdc++ \
libzmq \
sqlite-libs \
bash \
libcap

COPY --chown=satoshi:satoshi docker/bitcoin-regtest/bitcoin.conf /home/.bitcoin/bitcoin.conf

COPY --chown=satoshi:satoshi docker/bitcoin-regtest/mine.sh /usr/bin/mine

COPY --chown=satoshi:satoshi docker/bitcoin-regtest/entrypoint.sh /docker/entrypoint.sh

EXPOSE 18443 18444 28334 28335
EXPOSE 8080
EXPOSE 18333 18444
EXPOSE 18332 18443
EXPOSE 28334 28335

USER satoshi

Expand Down
4 changes: 2 additions & 2 deletions docker/bitcoin-regtest/image.hcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release version
VERSION="27.0"
VERSION="27.1"

# Image config
NAME="bitcoin-regtest"
DESCRIPTION="Bitcoin Core preconfigured for regtest, with convenience mining cron job"
DESCRIPTION="Bitcoin Core preconfigured for regtest, with convenience mining cron job and 21 000 blocks subsidy halving interval"
2 changes: 1 addition & 1 deletion docker/bitcoin/image.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Release version
VERSION="27.0"
VERSION="27.1"
NAME="bitcoin"
DESCRIPTION="Bitcoin Core"

0 comments on commit 0860d73

Please sign in to comment.