Merge pull request #7 from altafan/master

Enhancements
This commit is contained in:
Marco Argentieri
2019-03-28 16:01:55 +01:00
committed by GitHub
14 changed files with 116 additions and 64 deletions

View File

@@ -11,6 +11,7 @@ A dockerized environment hosting a bitcoin and liquid daemons in regtest network
* [Bitcoin daemon](https://bitcoin.org/en/bitcoin-core/)
* [Liquid daemon](https://blockstream.com/liquid/)
* [Electrum server](https://github.com/Blockstream/electrs)
* [Chopsticks](https://github.com/vulpemventures/nigiri-chopsticks)
## Directions
@@ -37,11 +38,12 @@ Start nigiri:
$ bash scripts/start
```
This will start 3 containers that run the following services respectevely:
This will start 4 containers that run the following services respectevely:
* bitcoin and liquid daemons (regtest)
* bitcoin daemon (regtest)
* liquid daemon
* electrs REST server
* faucet REST server & router (TODO)
* API passthrough with optional faucet and mining capabilities (nigiri-chopsticks)
Stop nigiri:
@@ -67,8 +69,8 @@ If you really do love Sathoshi's favourite dish like us at Vulpem Ventures, chec
## Roadmap
- [ ] router
- [x] router
- [x] electrum server
- [x] bitcoin daemon
- [x] liquid daemon
- [ ] faucet
- [x] faucet

View File

@@ -1,30 +0,0 @@
# bitcoin-box docker image
FROM ubuntu:18.04
# add bitcoind from the official PPA
# install bitcoind (from PPA) and make
RUN apt-get update && \
apt-get install --yes wget clang cmake jq software-properties-common && \
add-apt-repository --yes ppa:bitcoin/bitcoin && \
apt-get update && \
apt-get install --yes bitcoind
# install liquid
RUN mkdir -p /tmp && wget -qO- https://github.com/Blockstream/liquid/releases/download/liquid.3.14.1.22/liquid-3.14.1.22-x86_64-linux-gnu.tar.gz | tar xvz -C /tmp && \
mv /tmp/liquid-3.14.1.22/bin/liquidd /usr/bin/liquidd && \
mv /tmp/liquid-3.14.1.22/bin/liquid-cli /usr/bin/liquid-cli &&\
mv /tmp/liquid-3.14.1.22/bin/liquid-tx /usr/bin/liquid-tx &&\
rm -rf /tmp/liquid-3.14.1.22
RUN mkdir -p /config /script
# copy the box files into the image
ADD alice/config /config
ADD alice/run /script
WORKDIR /script
# expose two rpc ports for the nodes to allow outside container access
EXPOSE 19001 18884
STOPSIGNAL SIGINT
CMD ["./run"]

23
bitcoin/Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
# bitcoin-box docker image
FROM ubuntu:18.04
# add bitcoind from the official PPA
# install bitcoind (from PPA) and make
RUN apt-get update && \
apt-get install --yes clang cmake jq software-properties-common && \
add-apt-repository --yes ppa:bitcoin/bitcoin && \
apt-get update && \
apt-get install --yes bitcoind
RUN mkdir -p /config /script
# copy the box files into the image
ADD bitcoin/config /config
ADD bitcoin/run /script
WORKDIR /script
# expose two rpc ports for the nodes to allow outside container access
EXPOSE 19001
STOPSIGNAL SIGINT
CMD ["./run"]

View File

@@ -10,7 +10,6 @@ function clean {
trap clean SIGINT
bitcoind -datadir=/config &
liquidd -datadir=/config
sleep 10

10
chopsticks/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM ubuntu:18.04
WORKDIR /build
COPY chopsticks/nigiri-chopsticks-linux-amd64.tar.gz /build
RUN ls
RUN tar -xzf nigiri-chopsticks-linux-amd64.tar.gz && rm -rf *.tar.gz
EXPOSE 3000
CMD ["./nigiri-chopsticks-linux-amd64", "--addr", "0.0.0.0:3000", "--electrs-addr", "10.10.0.12:3002", "--rpc-addr", "10.10.0.10:19001"]

Binary file not shown.

View File

@@ -1,28 +1,42 @@
version: '3'
services:
alice:
bitcoin:
build:
context: .
dockerfile: alice/Dockerfile
ports:
- 19001:19001
- 18884:18884
dockerfile: bitcoin/Dockerfile
networks:
local:
ipv4_address: 10.10.0.10
volumes:
- daemon-config:/config
electrs:
build:
- bitcoin-config:/config
liquid:
build:
context: .
dockerfile: electrs/Dockerfile
ports:
- 3002:3002
dockerfile: liquid/Dockerfile
networks:
local:
ipv4_address: 10.10.0.11
volumes:
- daemon-config:/config
- liquid-config:/config
electrs:
build:
context: .
dockerfile: electrs/Dockerfile
networks:
local:
ipv4_address: 10.10.0.12
volumes:
- bitcoin-config:/config
- liquid-config:/liquidconfig
chopsticks:
build:
context: .
dockerfile: chopsticks/Dockerfile
ports:
- 3000:3000
networks:
local:
ipv4_address: 10.10.0.13
networks:
local:
@@ -32,4 +46,5 @@ networks:
- subnet: 10.10.0.0/24
volumes:
daemon-config:
bitcoin-config:
liquid-config:

View File

@@ -1,15 +1,9 @@
FROM rust:latest
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y clang cmake
RUN apt-get update && apt-get install --yes wget
WORKDIR /build
RUN wget -qO- https://github.com/vulpemventures/electrs/releases/download/v0.4.1-bin/electrs.tar.gz | tar -xvz && rm -rf electrs.tar.gz
RUN ls
# RUN git clone https://github.com/blockstream/electrs
# WORKDIR /home/user/electrs
# RUN git checkout new-index
# RUN cargo build --release
WORKDIR /scripts

17
liquid/Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM ubuntu:18.04
RUN apt-get update && apt-get install --yes curl wget
RUN mkdir -p /tmp /config /script
ADD liquid/config /config
ADD liquid/script /script
WORKDIR /script
RUN /script/install
EXPOSE 18884
STOPSIGNAL SIGINT
CMD ["./run"]

View File

@@ -5,16 +5,14 @@ rpcport=18884
port=18886
# Over p2p we will only connect to local other liquidd
connect=localhost:18887
# connect=localhost:18887
regtest=1
daemon=1
# Make sure you set listen after -connect, otherwise neither
# will accept incoming connections!
listen=1
# Just for looking at random txs
txindex=1
txindex=0
# enable to allow non-localhost RPC connections
# recommended to change to a subnet, such as your LAN
@@ -34,12 +32,13 @@ rpcallowip=0.0.0.0/0
# We want to validate pegins by checking with bitcoind if header exists
# in best known chain, and how deep. We combine this with pegin
# proof included in the pegin to get full security.
validatepegin=1
validatepegin=0
# If in the same datadir and using standard ports, these are unneeded
# thanks to cookie auth. If not, like in our situation, liquidd needs
# more info to connect to bitcoind:
mainchainrpcport=19001
mainchainrpchost=10.10.0.10
mainchainrpcuser=admin1
mainchainrpcpassword=123

13
liquid/script/install Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
LATEST_VERSION=$(curl --silent "https://api.github.com/repos/blockstream/liquid/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
VERSION_NAME=$(echo $LATEST_VERSION | sed '1,/\./s/\./\-/')
wget -qO- https://github.com/Blockstream/liquid/releases/download/$LATEST_VERSION/$VERSION_NAME-x86_64-linux-gnu.tar.gz | tar xvz -C /tmp
mv /tmp/$VERSION_NAME/bin/liquidd /usr/bin/liquidd
mv /tmp/$VERSION_NAME/bin/liquid-cli /usr/bin/liquid-cli
mv /tmp/$VERSION_NAME/bin/liquid-tx /usr/bin/liquid-tx
rm -rf /tmp

10
liquid/script/run Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
function clean {
kill -9 $(pidof liquidd)
}
trap clean SIGINT
liquidd -datadir=/config &
wait $!

View File

@@ -7,7 +7,7 @@ PARENT_PATH=$(dirname $(cd $(dirname $0); pwd -P))
pushd $PARENT_PATH
docker-compose down && \
docker volume rm nigiri_daemon-config && \
docker rmi nigiri_electrs nigiri_alice
docker volume rm nigiri_bitcoin-config nigiri_liquid-config && \
docker rmi nigiri_electrs nigiri_bitcoin nigiri_liquid
popd