709 / 736JIT

Just-in-Time Channels

仅在付款到达时才开设的通道

Just-in-Time Channel 是 LSP 仅在 incoming payment 到来时才开设的 Lightning channel;收款人无需预购 capacity 即可开始收款,opening cost 从首笔 payment 扣除。

LSPS2 即 bLIP 52 协商 parameters,在 payment data 中放入特殊 identifier,并在其经过 LSP 时触发 private zero-confirmation channel 开设,在扣除 opening fee 后交付 payment。

Just-in-Time Channel 只在 incoming payment 从 public Lightning Network 经 LSP 到达时创建。收款人无需预先拥有 channel、outbound capacity 或 on-chain funds;新增 inbound liquidity 的成本从首笔收到的 payment 中支付。 [1]

Client 先调用 lsps2.get_info,取得含 min_fee_msat、以 ppm 表示的 proportional rate、valid_until、min_lifetime、max_client_to_self_delay 与 payment size limits 的 offers。随后在 lsps2.buy 中提交选定 offer 和 LSP 生成的 promise;过期、payment 太小或 liquidity 不足都可能返回 error。 [2]

成功的 lsps2.buy 返回 jit_channel_scid 与 lsp_cltv_expiry_delta。Client 将 LSP node ID 和该 SCID 作为 route hint 唯一 hop 写入 BOLT11 invoice,或通过 blinded path 等未来方案传递同样信息;payment expiry 不得超过 valid_until,且 payment 到达时 client 必须保持连接。 [1]

LSP 在 incoming HTLC 中识别 jit_channel_scid 后,启动标准 BOLT 2 channel establishment。Channel 必须足以承载 payment_size_msat 减 opening_fee 及 reserve,保持 unannounced,使用 option_scid_alias,并可在 funding transaction 确认前作为 zero-confirmation channel 转发 payment。 [4]

LSPS2 定义两种 trust models。在 LSP trusts client 模式下,provider 先发布 valid funding transaction,并承担 client 不释放 preimage 的风险;在 client trusts LSP 模式下,provider 可延后 broadcast,而 client 先释放 preimage 并信任其创建 valid funding outpoint。 [3]

JIT 并非无条件 delivery。Payment 必须覆盖 opening fee、limits 与 minimum HTLC;client 在 funding_signed 前断线会导致 temporary_channel_failure,naive prepayment probe 在 LSP trusts client 模式下还可能触发 channel open,最终却未向 LSP 付款。 [1]

bLIP 52 列为 active specification,并要求以 LSPS0 即 bLIP 50 作为 transport。Reference crate lightning-liquidity 为 LSPS2 提供 client 与 service handlers,但其 documentation 将 service-side support 标为 beta;存在 API 不代表特定 wallet 或 LSP 已达到 production readiness。 [5]

Verification 从 lsps2.get_info 和精确计算 max(min_fee_msat, proportional fee) 开始,并核对 valid_until、promise、payment limits、min_lifetime 与 max_client_to_self_delay。Payment 后还要检查 deducted fee、funding outpoint、channel parameters、channel_ready、alias 及 actual inbound capacity;invoice 本身不能证明 channel 已开设。 [1]

要获得更完整的理解,请将本词条与以下词条结合阅读: Lightning Service Provider, Inbound Liquidity, Payment Channel, Price Channel, BOLT 11, BOLT 12.

01Just-in-Time Channel 免费吗?

不免费。LSP 从首笔 incoming payment 中扣除 opening fee。Client 必须提前在 offer 中核对 minimum 与 proportional fee 部分、payment limits 和 parameters validity period。

02收到 payment 前,Just-in-Time Channel 已在 on-chain 确认吗?

通常没有。LSPS2 响应 payment 开设 zero-confirmation channel;依 trust model 不同,funding transaction 可能仅在 mempool 或仍待 broadcast。Client 必须主动选择可接受的 confirmation threshold 与 LSP risk。

DOC · 001bLIP 52 — LSPS2 JIT Channel Negotiation规范 DOC · 002bLIP 50 — LSPS0 Transport Layer规范 DOC · 003bLIP 25 — Forward less than onion value规范 DOC · 004BOLT 2 — Peer Protocol for Channel Management规范 DOC · 005LDK lightning-liquidity — LSPS2 module文档
修订日期: 来源优先 · 非投资建议