Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.project

.idea
2 changes: 2 additions & 0 deletions 1/bitcoin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ regtest=1
dnsseed=0
upnp=0

txindex=1

# listen on different ports than default testnet
port=19000
rpcport=19001
Expand Down
2 changes: 2 additions & 0 deletions 2/bitcoin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ regtest=1
dnsseed=0
upnp=0

txindex=1

# don't listen on a port, just connect to node 1
listen=0
connect=127.0.0.1:19000
Expand Down
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ MAINTAINER Sean Lavine <lavis88@gmail.com>

# add bitcoind from the official PPA
RUN apt-get update
RUN apt-get install --yes software-properties-common
RUN apt-get install --yes software-properties-common supervisor
RUN add-apt-repository --yes ppa:bitcoin/bitcoin
RUN apt-get update

# install bitcoind (from PPA) and make
RUN apt-get install --yes bitcoind make
# install bitcoind (from PPA)
RUN apt-get install --yes bitcoind

# create a non-root user
RUN adduser --disabled-login --gecos "" tester
Expand All @@ -25,12 +25,9 @@ ADD . /home/tester/bitcoin-testnet-box
# make tester user own the bitcoin-testnet-box
RUN chown -R tester:tester /home/tester/bitcoin-testnet-box

# use the tester user when running the image
USER tester
RUN mkdir -p /var/log/supervisor

# run commands from inside the testnet-box directory
WORKDIR /home/tester/bitcoin-testnet-box

# expose two rpc ports for the nodes to allow outside container access
EXPOSE 19001 19011
CMD ["/bin/bash"]
CMD ["/usr/bin/supervisord"]
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# bitcoin-testnet-box
[![docker pulls](https://img.shields.io/docker/pulls/freewil/bitcoin-testnet-box.svg?style=flat)](https://hub.docker.com/r/freewil/bitcoin-testnet-box/)
[![docker pulls](https://img.shields.io/docker/pulls/freewil/bitcoin-testnet-box.svg?style=flat)](https://hub.docker.com/r/softwaremill/bitcoin-testbox/)

Based on https://github.com/freewil/bitcoin-testnet-box

Create your own private bitcoin testnet

Expand Down Expand Up @@ -139,20 +141,20 @@ an isolated container.
### Building docker image

Pull the image
* `docker pull freewil/bitcoin-testnet-box`
* `docker pull softwaremill/bitcoin-testnet-box`

or build it yourself from this directory
* `docker build -t bitcoin-testnet-box .`
* `docker build -t softwaremill/bitcoin-testbox .`

You can also push it to the docker hub:
`docker push softwaremill/bitcoin-testbox`

### Running docker container
The docker image will run two bitcoin nodes in the background and is meant to be
attached to allow you to type in commands. The image also exposes
the two JSON-RPC ports from the nodes if you want to be able to access them
from outside the container.

`$ docker run -t -i -p 19001:19001 -p 19011:19011 freewil/bitcoin-testnet-box`

or if you built the docker image yourself:
`$ docker run -t -p 19001:19001 -p 19011:19011 softwaremill/bitcoin-testbox`

`$ docker run -t -i -p 19001:19001 -p 19011:19011 bitcoin-testnet-box`

30 changes: 30 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[supervisord]
nodaemon = true

[program:node1]
user = tester
command = bitcoind -datadir=1
; start nodes before bitcoin-cli
priority = 100
stdout_logfile = /var/log/node1.log
stderr_logfile = /var/log/node1err.log
autorestart = true


[program:node2]
user = tester
command = bitcoind -datadir=2
; start nodes before bitcoin-cli
priority = 100
stdout_logfile = /var/log/node2.log
stderr_logfile = /var/log/node2err.log
autorestart = true


; generate some blocks, to have some bitcoins to test transfers etc.

[program:generate-bitcoins]
user = tester
command = bitcoin-cli -datadir=1 generate 500
startsecs = 0
autorestart = unexpected