Skip to main content

LND

Welcome to the API reference documentation for LND, the Lightning Network Daemon.

The Lightning Network Daemon (lnd) - is a complete implementation of a Lightning Network node. lnd has several pluggable back-end chain services including btcd (a full-node), bitcoind, and neutrino (a new experimental light client). The project's codebase uses the btcsuite set of Bitcoin libraries, and also exports a large set of isolated re-usable Lightning Network related libraries within it. In the current state lnd is capable of:

  • Creating channels.
  • Closing channels.
  • Completely managing all channel states (including the exceptional ones!).
  • Maintaining a fully authenticated+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 (autopilot).

Usage

Learn how to install, configure, and use LND by viewing the documentation in the Builder's Guide.

Summary

This site features the API documentation for lncli (CLI), Python, and JavaScript in order to communicate with a local lnd instance through gRPC and REST. It is intended for those who already understand how to work with LND. If this is your first time or you need a refresher, you may consider perusing our LND developer site featuring a tutorial, resources and guides at dev.lightning.community.

gRPC

The code samples assume that the there is a local lnd instance running and listening for gRPC connections on port 10009. LND_DIR will be used as a placeholder to denote the base directory of the lnd instance. By default, this is ~/.lnd on Linux and ~/Library/Application Support/Lnd on macOS.

At the time of writing this documentation, two things are needed in order to make a gRPC request to an lnd instance: a TLS/SSL connection and a macaroon used for RPC authentication. The code samples will show how these can be used in order to make a successful, secure, and authenticated gRPC request.

The original *.proto files from which the gRPC documentation was generated can be found here:

REST

View a listing of all REST URLs on the REST Endpoints page.

The code samples assume that the there is a local lnd instance running and listening for REST connections on port 8080. LND_DIR will be used as a placeholder to denote the base directory of the lnd instance. By default, this is ~/.lnd on Linux and ~/Library/Application Support/Lnd on macOS.

At the time of writing this documentation, two things are needed in order to make an HTTP request to an lnd instance: a TLS/SSL connection and a macaroon used for RPC authentication. The code samples will show how these can be used in order to make a successful, secure, and authenticated HTTP request.

The original *.swagger.json files from which the gRPC documentation was generated can be found here:

REST Encoding

NOTE: The byte field type must be set as the base64 encoded string representation of a raw byte array. Also, any time this must be used in a URL path (ie. /v1/abc/xyz/{payment_hash}) the base64 string must be encoded using a URL and Filename Safe Alphabet. This means you must replace + with -, / with _, and keep the trailing = as is. Url encoding (ie. %2F) will not work.

This documentation was generated automatically against commit bdc5187749496ec6dc56a18b77290f6b969660dc.

Experimental services

The following RPCs/services are currently considered to be experimental. This means they are subject to change in the future. They also need to be enabled with a compile-time flag to be active (they are active in the official release binaries).