Skip to content

Commit 40df22e

Browse files
author
Rainer Stuetz
committed
Initial commit
0 parents  commit 40df22e

File tree

10 files changed

+211
-0
lines changed

10 files changed

+211
-0
lines changed

.gitignore

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# IDE files
2+
/.idea/
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
env/
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
*.egg-info/
27+
.installed.cfg
28+
*.egg
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*,cover
49+
.hypothesis/
50+
51+
# Translations
52+
*.mo
53+
*.pot
54+
55+
# Django stuff:
56+
*.log
57+
58+
# Sphinx documentation
59+
docs/_build/
60+
61+
# PyBuilder
62+
target/
63+
64+
#Ipython Notebook
65+
.ipynb_checkpoints

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM alpine:3.7
2+
LABEL maintainer="[email protected]"
3+
4+
RUN apk --no-cache add make bash boost boost-program_options libevent libressl shadow && \
5+
useradd -r -u 10000 dockeruser && \
6+
mkdir -p /opt/graphsense/data && \
7+
chown dockeruser /opt/graphsense
8+
9+
ADD docker/bitcoin.conf /opt/graphsense/bitcoin.conf
10+
ADD docker/Makefile /tmp/Makefile
11+
12+
RUN apk --no-cache --virtual build-dependendencies add \
13+
linux-headers \
14+
libressl-dev \
15+
g++ \
16+
boost-dev \
17+
file \
18+
autoconf \
19+
automake \
20+
libtool \
21+
libevent-dev \
22+
git \
23+
coreutils \
24+
binutils \
25+
grep && \
26+
cd /tmp; make install && \
27+
rm -rf /tmp/src && \
28+
strip /usr/local/bin/*bitcoin* && \
29+
apk del build-dependendencies
30+
31+
USER dockeruser
32+
EXPOSE 8432
33+
34+
CMD bitcoind -conf=/opt/graphsense/bitcoin.conf -datadir=/opt/graphsense/data -daemon -rest && bash

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 AIT Austrian Institute of Technology
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Bitcoin Cash Docker container
2+
3+
A Docker container running [Bitcoin ABC][bitcoin-abc] as a service and
4+
exposing the REST API. Bitcoin ABC is a full node implementation of the
5+
Bitcoin Cash protocol.
6+
7+
## Prerequisites
8+
9+
Install [Docker][docker], e.g. on Debian/Ubuntu based systems
10+
11+
sudo apt install docker.io
12+
13+
## Configuration
14+
15+
Modify `docker/bitcoin.conf` according to your environment
16+
(see [doc][bitcoin-conf]).
17+
18+
Configure `rpcallowip=...` to allow the client/daemon to accept
19+
RPC connections outside the localhost and set an RPC username (`rpcuser`)
20+
and password (`rpcpassword`).
21+
22+
Make sure your config file includes the following line:
23+
24+
txindex=1
25+
26+
## Usage
27+
28+
Building the docker container (tagged GitHub version if Bitcoin Cash in `docker/Makefile`):
29+
30+
./docker/build.sh
31+
32+
Starting the container:
33+
34+
./docker/start.sh DATA_DIR
35+
36+
Attaching to the container:
37+
38+
./docker/attach.sh
39+
40+
Showing the Bitcoin log file:
41+
42+
./docker/show_log.sh
43+
44+
45+
[bitcoin-abc]: https://www.bitcoinabc.org
46+
[docker]: https://www.docker.com
47+
[bitcoin-conf]: https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File

docker/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
install:
2+
if [ ! -d bitcoin ]; then \
3+
git clone https://github.com/Bitcoin-ABC/bitcoin-abc src && \
4+
cd src && \
5+
git checkout tags/v0.17.2 -b local && \
6+
./autogen.sh && \
7+
./configure --without-gui --disable-zmq --disable-upnp-default --disable-tests --disable-wallet && \
8+
make install; \
9+
fi

docker/attach.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
docker exec -ti bitcoin-cash bash

docker/bitcoin.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# server=1 tells Bitcoin-Qt and bitcoind to accept JSON-RPC commands
2+
server=1
3+
rpcclienttimeout=30
4+
# By default, only RPC connections from localhost are allowed.
5+
# Specify as many rpcallowip= settings as you like to allow connections from other hosts,
6+
# either as a single IPv4/IPv6 or with a subnet specification.
7+
rpcport=8432
8+
# API requests need to access non-wallet blockchain transactions by their IDs,
9+
# following is used enable the transaction index in the Bitcoin Core database
10+
txindex=1

docker/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
docker build -t bitcoin-cash .

docker/show_log.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
docker exec bitcoin-cash bash -c "tail -f /opt/graphsense/data/debug.log"

docker/start.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
if ! [ -n "$1" ] ; then
4+
echo "Please provide directory for blockchain data."
5+
fi
6+
7+
docker stop bitcoin-cash
8+
docker rm bitcoin-cash
9+
10+
chown -R dockeruser "$1"
11+
12+
docker run --restart=always -d --name bitcoin-cash \
13+
-p 8432:8432 \
14+
-v "$1":/opt/graphsense/data \
15+
-it bitcoin-cash
16+
docker ps -a

0 commit comments

Comments
 (0)