The Lightning Network Daemon (LND) is a complete Golang implementation of a BOLT-compliant Lightning Network node developed by Lightning Labs. It can connect to the Lightning Networks deployed on Bitcoin (mainnet, testnet3) and Litecoin (mainnet, testnet4).
LND is open source software under very active development on GitHub: v0.1-alpha was released on January 11th 2017; v0.5-beta was released on September 18th 2018; v0.6-beta is expected in Spring 2019.
Lightning Labs is an active contributor to the BOLT standards and LND strives for compliance with these specifications.
Like all Lightning nodes, LND requires access to information stored in the blockchain in order to manage channels. LND accesses this information by connecting to a backend node that provides access to the chain.
On supported blockchains, LND can use the following full nodes:
These full nodes must be fully synced with a transaction index database (e.g. bitcoind -txindex=1
) , which requires a substantial amount of disk space:
bitcoin mainnet: 240 GB
bitcoin testnet: 28 GB
litecoin mainnet: 24 GB
litecoin testnet: 2 GB
As a lightweight alternative for mobile and other resource-constrained devices, Lightning Labs is developing a lightweight trust-minimizing privacy-preserving Bitcoin light client called Neutrino. In contrast, Neutrino requires only a few hundred MB of storage. LND ships with Neutrino and can be configured to automatically launch and manage it when LND is started. Neutrino can theoretically run on the Mainnet today if it is able to find btcd
full node peers that will serve it compact filters, but due to known money-losing bugs this is strongly discouraged. A mainnet-ready Neutrino is expected later in 2019.
As of February 2019, LND is capable of:
Creating channels.
Closing channels.
Completely managing all channel states (including the exceptional ones!).
Maintaining a fully authenticated and validated channel graph.
Performing path finding within the network, passively forwarding incoming payments.
Sending outgoing onion-encrypted payments through the network.
Updating advertised fee schedules.
Automatic channel management (aka autopilot
)
LND ships with lncli
, a tool for controlling LND in the command line. The outputs of lncli
commands are often pages and pages of JSON that is hard to read. By using standard Bash tools, you can reprocess this output into something that is more readable.
For these examples, you will need to install a small tool called jq
to process the JSON. In Debian/Ubuntu Linux, you can do this with sudo apt install jq
.
For instance, to view a table of the payments your node routed in 2019 (use epochconverter to go between Unix epoch time (looks like 1552118735
) and normal human time:
$ lncli fwdinghistory --start_time 1546300800 --end_time 9999999999 --max_events 10000000 | jq '.forwarding_events[] | "(.timestamp|tonumber|gmtime|todate) (.amt_out|tonumber) (.fee|tonumber)"' | awk 'BEGIN {printf "%6s %18s %8s %5s\n", "id", "time", "sats", "fee"} {printf "%6s %18s %8s %5s\n", NR, substr($1,2,16), $2, substr($3,1,length($3)-1)}'id time sats fee1 2019-01-01T19:28 1000 12 2019-01-01T19:28 2000 13 2019-01-02T19:39 151 14 2019-01-02T23:06 70 15 2019-01-02T23:08 151 1
To view a simple table of your channels, including how the channel balance is divided between you and your channel peer and whether your peer is online and the channel is active:
lncli listchannels | jq '.channels[] | ["\(.remote_pubkey) \(.capacity) \(.local_balance) \(.remote_balance) \(.active)"] | @tsv'| awk 'BEGIN {printf "%19s %10s %10s %10s %7s\n", "peer", "capacity", "local", "remote", "active"} {printf "%19s %10s %10s %10s %7s\n", substr($1,2,16)"...", $2, $3, $4, substr($5,1,length($5)-1)}'peer capacity local remote active020398acf2628709... 4999823 4737659 258860 true022decf2837abadd... 5375294 5371990 0 true023ab7123987213a... 9000000 159998 8836166 true024832efabc23786... 1000000 497948 498747 true02438972abcd3966... 1000000 941894 53449 true0242387974587aba... 1886031 63000 1819195 false
We've written to (relatively) quickly and easily get set up on the Lightning Network with a Bitcoin full node.
Linux users can build LND from source with Go 1.11+:
go get -d github.com/lightningnetwork/lndcd $GOPATH/src/github.com/lightningnetwork/lndgit checkout v0.5.2-betamake && make install
For more information, including setting up a Go environment, see the official LND guide:
Pierre Rochard has created an LND Node Launcher application for quickly and easily installing a Lightning Network node on Windows and MacOS. Check out this tool and the accompanying installation guide:
LND supports a Remote Procedure Call (RPC) interface for interacting with underlying functionality programmatically, methods documented here. To interact with LND over RPC users can use their LND credentials (macaroons and TLS) to authenticate calls into their LND node. Several language-specific (ie. Typescript, Python, Ruby) client implementations have emerged to lower the barrier of developing on LND:
https://lightning.engineering/ Lightning Labs homepage
https://github.com/lightningnetwork/lnd LND on Github
https://dev.lightning.community/ developer resources for LND including talks, articles, and example applications
https://api.lightning.community/ https://api.lightning.community/rest/ API documentation