!!! NOTE: I've archived this repository as Zap seems to have stopped uploading the latest LND images to DockerHub.
!!! I added a section to the start of this README on setting up & running a node simply without using Docker.
I'm adding this section as Zap no longer seems to upload LND images to DockerHub (at least, not in a timely manner).
The simple steps are:
Install lnd, lncli, lndconnect as follows (remember to change the link as necessary, based on version and platform):
wget -c https://github.com/lightningnetwork/lnd/releases/download/v0.13.3-beta/lnd-linux-amd64-v0.13.3-beta.tar.gz -O - | tar -xz
wget -c https://github.com/LN-Zap/lndconnect/releases/download/v0.2.0/lndconnect-linux-amd64-v0.2.0.tar.gz -O - | tar -xz
sudo mv lnd-linux-amd64-v0.13.3-beta/lncli /usr/local/bin/lncli
sudo mv lnd-linux-amd64-v0.13.3-beta/lnd /usr/local/bin/lnd
sudo mv lndconnect-linux-amd64-v0.2.0/lndconnect /usr/local/bin/lndconnect
When you do this, make sure /usr/local/bin is in your PATH variable. If which lnd
and which lncli
return a path, you're set.
If you are migrating from using Docker, for simplicity I recommend moving your .lnd
directory to /home/ubuntu
sudo cp -r /home/ubuntu/lnd-data/.lnd /home/ubuntu/.lnd
Now, make sure that all settings you would have set inline are in the /home/ubuntu/.lnd/lnd.conf
file.
MAKING SURE THAT YOU STOPPED & REMOVED THE DOCKER CONTAINER & IMAGE for your previous lightning node, run your new one with
nohup lnd > /dev/null 2> /home/ubuntu/.lnd/err.log &
# After a few seconds...
lncli unlock
Error logs can be found in /home/ubuntu/.lnd/err.log
. Lndconnect should work as usual.
When updating LND, all you need to do is lncli stop
then repeat the installation step & startup step.
Docker image that runs lnd in a container for easy deployment. Modified some parameters to run on mainnet.
The image contains the latest lnd daemon and lndconnect.
-
Create a
lnd-data
volume to persist the lnd data, should exit immediately. Thelnd-data
container will store the lnd data when the node container is recreated (software upgrade, reboot, etc):docker volume create --name=lnd-data docker run -v ~/lnd-data:/lnd --name=lnd-node -d \ -p 9735:9735 \ -p 10009:10009 \ lnzap/lnd:latest \ --bitcoin.active \ --bitcoin.mainnet \ --debuglevel=info \ --bitcoin.node=neutrino \ --routing.assumechanvalid \ --neutrino.connect=btcd-mainnet.lightning.computer \ --neutrino.connect=bb1.breez.technology \ --neutrino.feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json \ --rpclisten=0.0.0.0:10009
Instead of lnzap/lnd:latest
, you can also try specific images such as lnzap/lnd:0.12.1-beta
as listed in LNZap's dockerHub page.
1.1 Some additional settings that may be of interest:
--alias=Paddle \
--color=#9fbed0 \
--rejecthtlc \
--rejectpush \
--accept-keysend \
-
Verify that the container is running and lnd node is downloading the blockchain
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d0e1076b2dca lnzap/lnd:0.12.1-beta "lnd_oneshot" 2 seconds ago Up 1 seconds 0.0.0.0:9735->9735/tcp, 0.0.0.0:10009->10009/tcp lnd-node
-
You can then access the daemon's output thanks to the docker logs command
docker logs -f lnd-node
-
Install optional init scripts for upstart and systemd are in the
init
directory. -
You must set up a wallet in order to generate macaroons.
docker exec -u lnd -it lnd-node lncli create
-
You will likely need to add these settings to lnd.conf, delete tls.cert and tls.key files, and restart lnd to regenerate them:
tlsextraip=IPADDRESS externalip=IPADDRESS # Other settings are optional, refer to [these](https://github.com/alexbosworth/run-lnd) instructions for an example # [This](https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf) is also an exhaustive exmaple
-
I find that the easiest way to set up a gRPC connection to this node from other devices is to use lndconnect.
# In a temporary location, download lndconnect and install wget https://github.com/LN-Zap/lndconnect/releases/download/v0.2.0/lndconnect-linux-386-v0.2.0.tar.gz sudo tar -xvf lndconnect-linux-386-v0.2.0.tar.gz --strip=1 -C /usr/local/bin # Display help to make sure it works lndconnect -h # Issue an lndconnect URI lndconnect --lnddir=/home/<username>/lnd-data/.lnd --host=<IPADDRESS> -j # If using EC2 following [these](https://github.com/alexbosworth/run-lnd) instructions: lndconnect --host=<EC2_IPADDRESS> -j # If you want a scannable QR code in your terminal, omit the -j parameter lndconnect --lnddir=/home/<username>/lnd-data/.lnd --host=<IPADDRESS>
-
If still having trouble connecting, make sure firewall settings allow port 9735 & 10009.
-
Use a library like node-lnd-grpc or ln-service, connect with lndconnectUri or its cert and macaroon params and get started!
An easy way to set up a channel with inbound liquidity is to use Bitrefill's Thor service.
When opening a channel with the Bitrefill Thor service, you are given a long command ("LND Channel") in the website that looks like this:
lncli connect <Bitrefill's LND Node Pubkey>@<Bitrefill's IP>:9735 >/dev/null 2>&1; lncli getinfo|grep '"identity_pubkey"'|sed -e 's/.*://;s/[^0-9a-f]//g'|tr -d '\n'| curl -G --data-urlencode remoteid@- "https://api.bitrefill.com/v1/thor?k1=some_long_hexadecimal_string&private=0"
So in our setup (using docker), we will run the following commands:
docker exec -u lnd -it lnd-node lncli connect <Bitrefill's LND Node Pubkey>@<Bitrefill's IP>:9735
docker exec -u lnd -it lnd-node lncli getinfo|grep '"identity_pubkey"'|sed -e 's/.*://;s/[^0-9a-f]//g'|tr -d '\n'| curl -G --data-urlencode remoteid@- "https://api.bitrefill.com/v1/thor?k1=some_long_hexadecimal_string&private=0"
This should return a JSON string stating {"status":"OK"}
if successful. I hope that works!
Relying on altruistic third party btcd nodes for your neutrino node is not da wae. Check out Zap's repository LN-Zap/docker-btcd for a quick and simple way to run a local btcd node.
I have had lnd basically stop responding due to 'too many open files'.
Error opening file /lnd/.lnd/data/chain/bitcoin/mainnet/peers.json: open /lnd/.lnd/data/chain/bitcoin/mainnet/peers.json: too many open files
This causes enormous headaches as it seems to increase routing fails and prevents new grpc connections. A temporary solution short of simply restarting the container is the following:
See how many simultaneous open files the system supports with ulimit -n
. This often defaults to 1024.
sudo vi /etc/security/limits.conf
and add rows * soft nofiles 65536
and * hard nofiles 65536
, save, log out and back in. Check ulimit -n
to see that it is now 65536.
- Additional documentation in the docs folder.