Skip to content

Pre-configured, dockerized lightning network small cluster, using lnd and btcd in dev mode.

License

Notifications You must be signed in to change notification settings

wardialer/lightning-network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightning Network

pipeline status

Pre-configured, dockerized lightning network small cluster, using lnd and btcd in dev mode.

Building

Use docker build to build the container images.

docker build -f Dockerfile.lnd -t eng/lnd .
docker build -f Dockerfile.btcd -t eng/btcd .

Usage

Use docker-compose to run the containers.

docker-compose up -d

and to stop them

docker-compose down

Configuration

Use the command line to configure and manage the network nodes:

Create a new wallet

docker exec -ti alice /bin/sh -c "lncli --network=simnet create"

and generate a new receiving address

docker exec alice /bin/sh -c "lncli --network=simnet newaddress np2wkh"

update .env file with the newly generated address and then restart btcd

docker-compose up -d

generate enough blocks for SegWit activation

docker exec btcd /bin/sh -c "btcctl --simnet --rpcuser=kek --rpcpass=kek --rpccert=/rpc/rpc.cert --rpcserver=localhost generate 400"
docker exec btcd /bin/sh -c "btcctl --simnet --rpcuser=kek --rpcpass=kek --rpccert=/rpc/rpc.cert --rpcserver=localhost getblockchaininfo | grep segwit -A 1"
docker exec alice /bin/sh -c "lncli --network=simnet walletbalance"

Connecting Bob and Alice nodes

docker exec -ti bob /bin/sh -c "lncli --network=simnet create"

Get "Bob" identity pubkey

docker exec -ti bob /bin/sh -c "lncli --network=simnet getinfo | grep identity_pubkey"

and IP address

docker inspect bob | grep IPAddress

connect Alice to Bob node

docker exec alice /bin/sh -c "lncli --network=simnet connect <node key>@<node ip>"

verify the connection on both sides

docker exec alice /bin/sh -c "lncli --network=simnet listpeers"
docker exec bob /bin/sh -c "lncli --network=simnet listpeers"

create the channel

docker exec alice /bin/sh -c "lncli --network=simnet openchannel --node_key=<node key> --local_amt=1000000"
docker exec btcd /bin/sh -c "btcctl --simnet --rpcuser=kek --rpcpass=kek --rpccert=/rpc/rpc.cert --rpcserver=localhost generate 3"
docker exec alice /bin/sh -c "lncli --network=simnet listchannels"

Send payments

Generate the invoice

docker exec bob /bin/sh -c "lncli --network=simnet addinvoice --amt=10000"

From the output, copy the payment request and then send the payment

docker exec -ti alice /bin/sh -c "lncli --network=simnet sendpayment --pay_req=<payment request>"

Check balances

docker exec alice /bin/sh -c "lncli --network=simnet channelbalance"
docker exec bob /bin/sh -c "lncli --network=simnet channelbalance"

Follow Working with LND and Docker for more.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License

MIT

About

Pre-configured, dockerized lightning network small cluster, using lnd and btcd in dev mode.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors