lightning-kmp icon indicating copy to clipboard operation
lightning-kmp copied to clipboard

On-the-fly channel funding based on splicing and liquidity ads

Open t-bast opened this issue 9 months ago • 0 comments

We revamp our protocols for on-the-fly funding to use a unified approach based on liquidity ads. We simplify messages exchanged and reduce the number of custom extensions required on top of the BOLT specifications.

The main changes to the protocol are:

  • the wallet initiates all channel operations (it is responsible for sending open_channel2 and splice_init)
    • it thus automatically pays the on-chain fees for the common transaction fields, as specified by the interactive-tx protocol
    • it uses a custom channel flag to ask the service provider to pay the commit tx fees and closing fees (won't be necessary anymore once we use 0-fee commit txs with package relay), which enables 0-reserve and allows emptying a wallet using an off-chain payment
  • we replace the pay_to_open messages with a will_add_htlc message, which is a clone of update_add_htlc without a channel_id or htlc_id:
    • the wallet processes them in the IncomingPaymentHandler
    • if it wishes to fulfill them, it first sends open_channel2 or splice_init to purchase enough liquidity:
      • we introduce new payment options that can be used with liquidity ads to pay the fees from the HTLCs themselves
  • the only fees that are applied are the liquidity ads fees:
    • on-chain fees for the inputs/outputs contributed by the service provider to add inbound liquidity (as specified by the liquidity ads protocol)
    • service fees for the inbound liquidity purchased (as specified by the liquidity ads protocol)

The specification can be found in https://github.com/lightning/blips/pull/36. An implementation of the seller side is available in https://github.com/ACINQ/eclair/pull/2861.

This PR is best reviewed commit-by-commit: each commit is self-contained and contains a piece of the puzzle.

Replaces #618.

t-bast avatar May 24 '24 13:05 t-bast