docker-compose up -d
then restart lnd container, because btc container now is initialised and lnd now can connect to btc
docker-compose restart lnd
docker exec -i -t lnd bash
$lnd lncli -n=regtest walletbalance
{
"total_balance": "0",
"confirmed_balance": "0",
"unconfirmed_balance": "0"
}
$lnd lncli -n=regtest newaddress np2wkh
{
"address": "2NC4FMaJmgoXF6EPodAwokdEeMxFnNgerom"
}
In new terminal window
docker exec -i -t btc bash
$btc bitcoin-cli getwalletinfo
generate 400 blocks
$btc bitcoin-cli generate 400
$btc bitcoin-cli getwalletinfo
$btc bitcoin-cli sendtoaddress 2NC4FMaJmgoXF6EPodAwokdEeMxFnNgerom 1 "My first Bitcoin"
$lnd lncli -n=regtest walletbalance
{
"total_balance": "100000000",
"confirmed_balance": "0",
"unconfirmed_balance": "100000000"
}
$btc bitcoin-cli generate 1
$lnd lncli -n=regtest walletbalance
{
"total_balance": "100000000",
"confirmed_balance": "100000000",
"unconfirmed_balance": "0"
}
So we have a bitcoin in our LN wallet, lets open some channels.. Or first create two more lnd nodes - Alice and Bob
docker-compose -f docker-compose.yaml -f docker-compose-alice.yaml run -d --name alice -p 10010:10009 -p 9010:9735 lnd
docker-compose -f docker-compose.yaml -f docker-compose-bob.yaml run -d --name bob -p 10011:10009 -p 9011:9735 lnd
New terminal
docker exec -i -t alice bash
$bob lncli -n=regtest walletbalance
$bob lncli -n=regtest newaddress np2wkh
copy bobs Alices address
$btc bitcoin-cli sendtoaddress ALICE_ADDRESS 1 "Alices first Bitcoin"
$btc bitcoin-cli generate 1
$bob lncli -n=regtest walletbalance
Now Bob have 1 bitcoin ;)
New terminal
docker exec -i -t bob bash
$bob lncli -n=regtest walletbalance
$bob lncli -n=regtest newaddress np2wkh
copy Bobs btc address
$btc bitcoin-cli sendtoaddress BOBS_ADDRESS 1 "Bobs first Bitcoin"
$btc bitcoin-cli generate 1
$bob lncli -n=regtest walletbalance
Now Alice have 1 bitcoin ;)
Find replace all regtest -> testnet in docker-compose and lnd.conf, bitcoin.conf files
Docker setup to create bictoind and LND containers work together, to create Lightning network.
-
Edit
bitcoind/bitcoin.conf
andlnd/lnd.conf
with your settings and justdocker-compose up -d
should work -
If you'd like to stop just one of the services (btc or lnd containers), use
docker-compose stop lnd
and then use the commanddocker-compose up -d --build lnd
to start it again -
If you've made changes to any of the files and need to rebuild just one of the containers, use
docker-compose up -d --build lnd
After containers are started for the first time, let btc sync with blockchain (that may take a while ~27GB for testnet). After that you need:
-
create lightning wallet with command
docker-compose exec lnd lncli -n=testnet create
-
Unlock walet use command
docker-compose exec lnd lncli -n=testnet unlock