Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions contrib/ldk-server-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,19 @@ server_url = "ssl://electrum.blockstream.info:50002" # Electrum endpoint
[esplora]
server_url = "https://mempool.space/api" # Esplora endpoint

# LSPS2 Client Support
[liquidity.lsps2_client]
# The public key of the LSPS2 LSP we source just-in-time liquidity from.
# LSPS Client Support
# Repeat this section to register several LSPs. Supported protocols are discovered per
# LSP via bLIP-50 / LSPS0 on startup. Only LSPS2 is supported at present.
[[liquidity.lsps_client]]
# The public key of the LSP we source inbound liquidity from.
node_pubkey = "<lsp node pubkey>"
# Address to connect to the LSPS2 LSP (IPv4:port, IPv6:port, OnionV3:port, or hostname:port).
# Address to connect to the LSP (IPv4:port, IPv6:port, OnionV3:port, or hostname:port).
address = "<lsp ip address>:9735"
# Optional token for authenticating to the LSP.
# token = ""
# Accept 0-confirmation channels opened by this LSP. Required for JIT channels to be
# usable before the funding transaction confirms.
trust_peer_0conf = true

# Experimental LSPS2 Service Support
# CAUTION: LSPS2 support is highly experimental and for testing purposes only.
Expand Down
4 changes: 2 additions & 2 deletions docs/api-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ These RPCs support a manual claim/fail workflow for held payments. See

### BOLT11 JIT Channels (LSPS2)

Requires an `[liquidity.lsps2_client]` configuration. The LSP opens a channel just-in-time
when the invoice is paid.
Requires at least one `[[liquidity.lsps_client]]` entry for an LSPS2-capable LSP. The LSP opens
a channel just-in-time when the invoice is paid.

| RPC | Description |
|--------------------------------------------|-----------------------------------------------------------|
Expand Down
24 changes: 16 additions & 8 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,22 @@ You must configure **exactly one** of the following sections:
> against the blockchain. This means a malicious peer could flood your node with fake channel
> announcements, consuming memory and disk. If your node is publicly reachable, use bitcoind.

### `[liquidity.lsps2_client]`

Connects to an [LSPS2](https://github.com/BitcoinAndLightningLayerSpecs/lsp/blob/main/LSPS2/README.md)
Liquidity Service Provider for just-in-time (JIT) inbound channel opening. When configured,
the `Bolt11ReceiveViaJitChannel` and `Bolt11ReceiveVariableAmountViaJitChannel` RPCs become
available, the LSP will open a channel on the fly when the generated invoice is paid.

Requires the LSP's public key and address. Some LSPs also require an authentication token.
### `[[liquidity.lsps_client]]`

Registers a Liquidity Service Provider to source inbound liquidity from. Repeat the section
to register several LSPs. Each LSP's supported protocols are discovered on startup via
[bLIP-50 / LSPS0](https://github.com/lightning/blips/blob/master/blip-0050.md). LDK Server
currently supports LSPS2 only, so an LSP that does not advertise it is registered but unused.

When at least one LSPS2-capable LSP is configured, the `Bolt11ReceiveViaJitChannel` and
`Bolt11ReceiveVariableAmountViaJitChannel` RPCs become available, and the cheapest fee offer
across all LSPS2-capable LSPs is selected per invoice.

Requires each LSP's public key and address. Some LSPs also require an authentication token.
`trust_peer_0conf` is required and controls whether 0-confirmation channels from that LSP are
accepted. Setting it to `true` is generally necessary for JIT channels to be usable before
the funding transaction confirms. Each entry must name a distinct `node_pubkey` as duplicates
are rejected at startup.

### `[liquidity.lsps2_service]`

Expand Down
3 changes: 2 additions & 1 deletion ldk-server-client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,11 @@ mod tests {
rpc_user = "bitcoind-testuser"
rpc_password = "bitcoind-testpassword"

[liquidity.lsps2_client]
[[liquidity.lsps_client]]
node_pubkey = "0217890e3aad8d35bc054f43acc00084b25229ecff0ab68debd82883ad65ee8266"
address = "127.0.0.1:39735"
token = "lsps2-token"
trust_peer_0conf = true

[liquidity.lsps2_service]
advertise_service = false
Expand Down
16 changes: 9 additions & 7 deletions ldk-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,15 @@ fn main() {
std::process::exit(-1);
}

if let Some(lsps2_client_config) = config_file.lsps2_client_config {
builder.add_liquidity_source(
lsps2_client_config.node_id,
lsps2_client_config.address,
lsps2_client_config.token,
false,
);
if let Some(lsps_client_configs) = config_file.lsps_client_config {
for lsps_client_config in lsps_client_configs {
builder.add_liquidity_source(
lsps_client_config.node_id,
lsps_client_config.address,
lsps_client_config.token,
lsps_client_config.trust_peer_0conf,
);
}
}

if let Some(tor_config) = config_file.tor_config {
Expand Down
Loading