Lightning Network is a Layer 2 solution on top Bitcoin (Layer 1).
Under normal conditions we should run our own Bitcoin Full Node and point the Lightning Network Node to it. This way we make sure that we are independent of any third parties to notify us about events related to our channel(s) state.
However, many people do not want/can/care to run a Bitcoin Full Node, what they would like is a quick and simple way to test some Lightning Network applications (LApps).
For the cases when the Lightning Network node has just one or two channels with little funds on them (~10 USD), then we can just connect to some third party Neutrino nodes instead of using our own full node.
DO NOT FOLLOW THIS APPROACH IF YOU HAVE MANY CHANNELS AND/OR SIGNIFICANT FUNDS!
Start the Lightning Network Node
Steps:
- Install
docker
anddocker-compose
(there are plenty of online resource on how to do this for every major OS) - Save the below file and name it
docker-compose.yaml
- Open a command line and go to the folder where the
docker-compose.yaml
was downloaded - Run
docker-compose up -d
to start your Lightning Network Node - To see the logs run
docker-compose logs -f
We have to wait for a few minutes (~5–10) until the Lightning Network Node synchronizes.
A volumes
folder will be created next to the the docker-compose.yaml
file. The TLS Certificate and the macaroon files will be located under this folder.
Lightning Network Client
Depending on the LApp that we are testing, we might need to run some command line instructions (create wallet, open channel, etc). We will run the commands using docker exec
.
Steps:
- Get the Container ID by running
docker ps
. Choose the Container ID corresponding to thelnd-prod
name.
CONTAINER ID IMAGE NAMES
83fbf550a52b lightninglabs/lnd:v0.12.0-beta.rc6 lnd-prod
- Use docker to execute
lncli
commands. For example:
docker exec -t 83fbf550a52b /bin/lncli create
Of course, replace83fbf550a52b
with your own Container ID - Check the Lightning Network Node state by running:
docker exec -t 83fbf550a52b /bin/lncli getinfo
{
"version": "0.12.0-beta.rc6 commit=v0.12.0-beta.rc6",
...
"synced_to_chain": true,
"synced_to_graph": true,
"testnet": false,
"chains": [
{
"chain": "bitcoin",
"network": "mainnet"
}
],
...
}
Both synced_to_chain
and synced_to_graph
must be true
in order to consider the Node ready to use.
Neutrino
More details about Neutrino can be found here:
https://github.com/lightninglabs/neutrino