#lightning #bitcoin #ldk #bdk

no-std lightning-liquidity

Types and primitives to integrate a spec-compliant LSP with an LDK-based node

9 releases

new 0.1.0 Jan 16, 2025
0.1.0-beta1 Jan 3, 2025
0.1.0-alpha.6 Oct 15, 2024
0.1.0-alpha.5 Sep 10, 2024
0.1.0-alpha.1 Feb 28, 2024

#2 in #bdk

Download history 624/week @ 2024-09-25 781/week @ 2024-10-02 1341/week @ 2024-10-09 1692/week @ 2024-10-16 850/week @ 2024-10-23 938/week @ 2024-10-30 1287/week @ 2024-11-06 1058/week @ 2024-11-13 977/week @ 2024-11-20 1000/week @ 2024-11-27 734/week @ 2024-12-04 1197/week @ 2024-12-11 574/week @ 2024-12-18 197/week @ 2024-12-25 824/week @ 2025-01-01 590/week @ 2025-01-08

2,287 downloads per month
Used in 6 crates (via ldk-node)

MIT/Apache

275KB
6K SLoC

lightning-liquidity

The goal of this crate is to provide types and primitives to integrate a spec-compliant LSP with an LDK-based node. To this end, this crate provides client-side as well as service-side logic to implement the LSP specifications.

Note: Service-side support is currently considered "beta", i.e., not fully ready for production use.

Currently the following specifications are supported:

  • LSPS0 defines the transport protocol with the LSP over which the other protocols communicate.
  • LSPS1 allows to order Lightning channels from an LSP. This is useful when the client needs inbound Lightning liquidity for which they are willing and able to pay in bitcoin.
  • LSPS2 allows to generate a special invoice for which, when paid, an LSP will open a "just-in-time" channel. This is useful for the initial on-boarding of clients as the channel opening fees are deducted from the incoming payment, i.e., no funds are required client-side to initiate this flow.

To get started, you'll want to setup a LiquidityManager and configure it to be the CustomMessageHandler of your LDK node. You can then call LiquidityManager::lsps1_client_handler / LiquidityManager::lsps2_client_handler, or LiquidityManager::lsps2_service_handler, to access the respective client-side or service-side handlers.

LiquidityManager uses an eventing system to notify the user about important updates to the protocol flow. To this end, you will need to handle events emitted via one of the event handling methods provided by LiquidityManager, e.g., LiquidityManager::next_event.

Dependencies

~18–25MB
~302K SLoC