1- This document is written for people who are eager to do something with
2- the Lightning Network Daemon (` lnd ` ). This folder uses ` docker-compose ` to
3- package ` lnd ` and ` btcd ` together to make deploying the two daemons as easy as
4- typing a few commands. All configuration between ` lnd ` and ` btcd ` are handled
5- automatically by their ` docker-compose ` config file.
1+ This document is intended for those looking to get started with
2+ the Lightning Network Daemon (lnd). This folder uses docker to package lnd and
3+ btcd together, making the deployment of both daemons as simple as running a
4+ few commands. All configuration between lnd and btcd is handled automatically
5+ by the docker-compose.yml file
66
77### Prerequisites
88Name | Version
99--------|---------
10- docker-compose | 1.9.0
11- docker | 1.13.0
10+ docker | 20.10.13+
1211
1312### Table of content
1413 * [ Create lightning network cluster] ( #create-lightning-network-cluster )
15- * [ Connect to faucet lightning node] ( #connect-to-faucet-lightning-node )
1614 * [ Building standalone docker images] ( #building-standalone-docker-images )
1715 * [ Using bitcoind version] ( #using-bitcoind-version )
1816 * [ Start Bitcoin Node with bitcoind using Docker Compose] ( #start-bitcoin-node-with-bitcoind-using-docker-compose )
@@ -30,10 +28,6 @@ possible to spin up an arbitrary number of `lnd` instances within containers to
3028create a mini development cluster. All state is saved between instances using a
3129shared volume.
3230
33- Current workflow is big because we recreate the whole network by ourselves,
34- next versions will use the started ` btcd ` bitcoin node in ` testnet ` and
35- ` faucet ` wallet from which you will get the bitcoins.
36-
3731In the workflow below, we describe the steps required to recreate the following
3832topology, and send a payment from ` Alice ` to ` Bob ` .
3933``` text
@@ -62,6 +56,11 @@ topology, and send a payment from `Alice` to `Bob`.
6256 * Close the channel between ` Alice ` and ` Bob ` .
6357 * Check that on-chain ` Bob ` balance was changed.
6458
59+ > [ !IMPORTANT]
60+ > ** Prerequisites:** This guide assumes you have ** Docker** installed. If not, please follow the [ official Docker installation guide] ( https://docs.docker.com/get-docker/ ) .
61+ >
62+ > All commands should be executed from the ` lnd/docker/ ` directory. Depending on your system's configuration, you may need to prefix ** docker** commands with ** sudo** . For ` Linux ` users, we highly recommend following the official [ Docker documentation to manage Docker as a non-root] ( https://docs.docker.com/engine/install/linux-postinstall/ ) user, which allows you to run commands without sudo safely
63+
6564Start ` btcd ` , and then create an address for ` Alice ` that we'll directly mine
6665bitcoin into.
6766``` shell
@@ -73,11 +72,11 @@ $ docker volume create simnet_lnd_alice
7372$ docker volume create simnet_lnd_bob
7473
7574# Run the "Alice" container and log into it:
76- $ docker- compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd
77- $ docker exec -i -t alice bash
75+ $ docker compose run -d --name alice --volume simnet_lnd_alice:/root/.lnd lnd
76+ $ docker exec -it alice bash
7877
79- # Generate a new backward compatible nested p2sh address for Alice:
80- alice $ lncli --network=simnet newaddress np2wkh
78+ # Generate a new native SegWit (Bech32) address for Alice:
79+ alice $ lncli --network=simnet newaddress p2wkh
8180
8281# Recreate "btcd" node and set Alice's address as mining address:
8382$ export MINING_ADDRESS=< alice_address>
@@ -86,9 +85,6 @@ $ docker-compose up -d btcd
8685# Generate 400 blocks (we need at least "100 >=" blocks because of coinbase
8786# block maturity and "300 ~=" in order to activate segwit):
8887$ docker exec -it btcd /start-btcctl.sh generate 400
89-
90- # Check that segwit is active:
91- $ docker exec -it btcd /start-btcctl.sh getblockchaininfo | grep -A 1 segwit
9288```
9389
9490Check ` Alice ` balance:
@@ -100,8 +96,8 @@ Connect `Bob` node to `Alice` node.
10096
10197``` shell
10298# Run "Bob" node and log into it:
103- $ docker- compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd
104- $ docker exec -i -t bob bash
99+ $ docker compose run -d --name bob --volume simnet_lnd_bob:/root/.lnd lnd
100+ $ docker exec -it bob bash
105101
106102# Get the identity pubkey of "Bob" node:
107103bob $ lncli --network=simnet getinfo
@@ -267,66 +263,6 @@ bob $ lncli --network=simnet walletbalance
267263}
268264```
269265
270- ### Connect to faucet lightning node
271- In order to be more confident with ` lnd ` commands I suggest you to try
272- to create a mini lightning network cluster ([ Create lightning network cluster] ( #create-lightning-network-cluster ) ).
273-
274- In this section we will try to connect our node to the faucet/hub node
275- which we will create a channel with and send some amount of
276- bitcoins. The schema will be following:
277-
278- ``` text
279- + ----- + + ------ + (1) + --- +
280- | Alice | <--- channel ---> | Faucet | <--- channel ---> | Bob |
281- + ----- + + ------ + + --- +
282- | | |
283- | | | <--- (2)
284- + - - - - - - - - - - - - - + - - - - - - - - - - - - - +
285- |
286- + --------------- +
287- | Bitcoin network | <--- (3)
288- + --------------- +
289-
290-
291- (1) You may connect an additional node "Bob" and make the multihop
292- payment Alice->Faucet->Bob
293-
294- (2) "Faucet", "Alice" and "Bob" are the lightning network daemons which
295- create channels to interact with each other using the Bitcoin network
296- as source of truth.
297-
298- (3) In current scenario "Alice" and "Faucet" lightning network nodes
299- connect to different Bitcoin nodes. If you decide to connect "Bob"
300- to "Faucet" then the already created "btcd" node would be sufficient.
301- ```
302-
303- First you need to run ` btcd ` node in ` testnet ` and wait for it to be
304- synced with test network (` May the Force and Patience be with you ` ).
305- ``` shell
306- # Init bitcoin network env variable:
307- $ NETWORK=" testnet" docker-compose up
308- ```
309-
310- After ` btcd ` synced, connect ` Alice ` to the ` Faucet ` node.
311-
312- The ` Faucet ` node address can be found at the [ Faucet Lightning Community webpage] ( https://faucet.lightning.community ) .
313-
314- ``` shell
315- # Run "Alice" container and log into it:
316- $ docker-compose run -d --name alice lnd_btc; docker exec -i -t " alice" bash
317-
318- # Connect "Alice" to the "Faucet" node:
319- alice $ lncli --network=testnet connect < faucet_identity_address> @< faucet_host>
320- ```
321-
322- After a connection is achieved, the ` Faucet ` node should create the channel
323- and send some amount of bitcoins to ` Alice ` .
324-
325- ** What you may do next?:**
326- - Send some amount to ` Faucet ` node back.
327- - Connect ` Bob ` node to the ` Faucet ` and make multihop payment (` Alice->Faucet->Bob ` )
328- - Close channel with ` Faucet ` and check the onchain balance.
329-
330266### Building standalone docker images
331267
332268Instructions on how to build standalone docker images (for development or
@@ -339,7 +275,7 @@ If you are using the bitcoind version of the compose file i.e. `docker-compose-b
339275#### Start Bitcoin Node with bitcoind using Docker Compose
340276To launch the Bitcoin node using bitcoind in the regtest network using Docker Compose, use the following command:
341277``` shell
342- $ NETWORK=" regtest" docker- compose -f docker-compose-bitcoind.yml up
278+ $ NETWORK=" regtest" docker compose -f docker-compose-bitcoind.yml up
343279```
344280
345281#### Generating RPCAUTH
@@ -377,5 +313,5 @@ Note: The address `2N1NQzFjCy1NnpAH3cT4h4GoByrAAkiH7zu` is just a random example
377313
378314* How to see ` alice ` | ` bob ` | ` btcd ` | ` lnd ` | ` bitcoind ` logs?
379315``` shell
380- $ docker- compose logs < alice| bob| btcd| lnd| bitcoind>
316+ $ docker compose logs < alice| bob| btcd| lnd| bitcoind>
381317```
0 commit comments