docker: create distinct containers for blockchains

Create disctinct containers for Litecoin and Bitcoin, and also change
the readme accordingly.
This commit is contained in:
Andrey Samokhvalov 2017-07-04 23:25:24 +03:00 committed by Olaoluwa Osuntokun
parent 816b9ada44
commit e60a370d46
3 changed files with 17 additions and 22 deletions

@ -63,18 +63,15 @@ bitcoin into.
# Init bitcoin network env variable:
$ export NETWORK="simnet"
# Run "btcd" node:
$ docker-compose up -d "btcd"
# Run the "Alice" container and log into it:
$ docker-compose up -d "alice"
$ docker exec -i -t "alice" bash
$ docker-compose run -d --name alice lnd_btc
$ docker exec -i -t alice bash
# Generate a new backward compatible nested p2sh address for Alice:
alice$ lncli newaddress np2wkh
# Recreate "btcd" node and set Alice's address as mining address:
$ MINING_ADDRESS=<alice_address> docker-compose up -d "btcd"
$ MINING_ADDRESS=<alice_address> docker-compose up -d btcd
# Generate 400 block (we need at least "100 >=" blocks because of coinbase
# block maturity and "300 ~=" in order to activate segwit):
@ -93,8 +90,8 @@ Connect `Bob` node to `Alice` node.
```bash
# Run "Bob" node and log into it:
$ docker-compose up --no-recreate -d "bob"
$ docker exec -i -t "bob" bash
$ docker-compose up --no-recreate -d --name bob lnd_btc
$ docker exec -i -t bob bash
# Get the identity pubkey of "Bob" node:
bob$ lncli getinfo
@ -115,7 +112,7 @@ bob$ lncli getinfo
}
# Get the IP address of "Bob" node:
$ docker inspect "bob" | grep IPAddress
$ docker inspect bob | grep IPAddress
# Connect "Alice" to the "Bob" node:
alice$ lncli connect <bob_pubkey>@<bob_host>
@ -198,12 +195,11 @@ bob$ lncli addinvoice --value=10000
# Send payment from "Alice" to "Bob":
alice$ lncli sendpayment --pay_req=<encoded_invoice>
# Check "Alice"'s channel balance was decremented accordingly by the payment
# amount
alice$ lncli listchannels
# Check "Alice"'s channel balance
alice$ lncli channelbalance
# Check "Bob"'s channel balance was credited with the payment amount
bob$ lncli listchannels
# Check "Bob"'s channel balance
bob$ lncli channelbalance
```
Now we have open channel in which we sent only one payment, let's imagine

@ -77,15 +77,15 @@ services:
- shared:/rpc
entrypoint: ["./start-lnd.sh"]
alice:
lnd_ltc:
extends: lnd
container_name: alice
container_name: lnd_ltc
links:
- "btcd:blockchain"
- "ltcd:blockchain"
bob:
lnd_btc:
extends: lnd
container_name: bob
container_name: lnd_btc
links:
- "btcd:blockchain"

@ -14,7 +14,7 @@ EXPOSE 18555 18556
# Expose segnet ports (server, rpc)
EXPOSE 28901 28902
# Grab and install the latest version of roasbeef's fork of btcd and all
# Grab and install the latest version of roasbeef's fork of ltcd and all
# related dependencies.
WORKDIR $GOPATH/src/github.com/ltcsuite/ltcd
RUN git clone https://github.com/ltcsuite/ltcd ./
@ -25,12 +25,11 @@ RUN go install . ./cmd/ltcctl ./cmd/gencerts
RUN mkdir "/rpc" "/root/.ltcd" "/root/.ltcctl"
RUN touch "/root/.ltcd/ltcd.conf"
# Manually generate certificate and add all domains, it is needed to connect
# "ltcctl" and "lnd" to "ltcd" over docker links.
RUN "/go/bin/gencerts" --host="*" --directory="/rpc" --force
# Create a volume to house pregenerated RPC credentials. This will be
# shared with any lnd, btcctl containers so they can securely query btcd's RPC
# shared with any lnd, btcctl containers so they can securely query ltcd's RPC
# server.
# You should NOT do this before certificate generation!
# Otherwise manually generated certificate will be overriden with shared