Crate lightning_liquidity

Crate lightning_liquidity 

Source
Expand description

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 LSPS specifications.

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

Currently the following specifications are supported:

  • bLIP-50 / LSPS0 defines the transport protocol with the LSP over which the other protocols communicate.
  • bLIP-51 / LSPS1 defines a protocol for ordering 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.
  • bLIP-52 / LSPS2 defines a protocol for generating 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.
  • bLIP-55 / LSPS5 defines a protocol for sending webhook notifications to clients. This is useful for notifying clients about incoming payments, channel expiries, etc.

To get started, you’ll want to setup a LiquidityManager and configure it to be the CustomMessageHandler of your LDK node. You can then for example 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.

Modules§

events
Events are surfaced by the library to indicate some action must be taken by the end-user.
lsps0
Types and primitives that implement the bLIP-50 / LSPS0: Transport Layer specification.
lsps1
Types and primitives that implement the bLIP-51 / LSPS1: Channel Request specification.
lsps2
Implementation of bLIP-52 / LSPS2: JIT Channel Negotiation specification.
lsps5
LSPS5 Webhook Registration Protocol Implementation
message_queue
Holds types and traits used to implement message queues for LSPSMessages.
persist
Types and utils for persistence.
utils
Utilities for LSPS5 service.

Structs§

LiquidityClientConfig
A client-side configuration for LiquidityManager.
LiquidityManager
The main interface into LSP functionality.
LiquidityManagerSync
A synchroneous wrapper around LiquidityManager to be used in contexts where async is not available.
LiquidityServiceConfig
A server-side configuration for LiquidityManager.

Traits§

ALiquidityManager
A trivial trait which describes any LiquidityManager.
ALiquidityManagerSync
A trivial trait which describes any LiquidityManagerSync.