|
| 1 | +# Will Fund For Food Proposal |
| 2 | +## Liquidity Advertisements |
| 3 | + |
| 4 | +## Problem Description |
| 5 | + |
| 6 | +Sourcing liquidity on the lightning network is a common problem |
| 7 | +for any node looking to accept inbound payments. |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +This proposal adds a TLV to the `node_announcement`, |
| 12 | +which permits a node to advertise a rate for which they will contribute |
| 13 | +funds to an open channel request. Due to the nature of the protocol, these |
| 14 | +opens are only possible on the v2 channel protocol. |
| 15 | + |
| 16 | +Any advertised liquidity lease is for a duration of 4032 blocks, or |
| 17 | +approximately 28 days. |
| 18 | + |
| 19 | +Any node wishing to take advantage of the offered funding contribution |
| 20 | +may send an `open_channel2` request to the `node_announcement` node, |
| 21 | +and include a `request_funds` tlv. |
| 22 | + |
| 23 | +The accepter responds to the `open_channel2` by including a `will_fund` |
| 24 | +TLV in their `accept_channel2` response, which includes the |
| 25 | +fees they're charging for funding an open, the weight of the bytes they'll |
| 26 | +add to the funding transaction, the maximum channel-fees |
| 27 | +they will charge for moving HTLCs over the channel, and a signature. The |
| 28 | +signature can be used by the opener to prove the accepter did not |
| 29 | +abide by their channel-fee commitment. |
| 30 | + |
| 31 | +An accepter may refuse to fund (but allow the open to succeed without |
| 32 | +their contribution of funds) or decline to participate in a |
| 33 | +channel open (fail the negotiation). |
| 34 | + |
| 35 | +In the case that the accepter does not or can not supply the |
| 36 | +requested funding amount, they may contribute less than the total |
| 37 | +requested amount. They may also offer to contribute more. The lease fee |
| 38 | +is calculated using the total amount contributed by the accepter. |
| 39 | + |
| 40 | +Any contributed funds are subject to a funding lease of 4032 blocks. To enforce |
| 41 | +this lease, the CSV of the accepter's output on the commitment transaction |
| 42 | +is modified to reflect the remaining time left in the lease. |
| 43 | + |
| 44 | +The opener updates the lease expiry by communicating their current blockheight |
| 45 | +to the accepter via `update_blockheight` messages. If the opener fails |
| 46 | +to update the blockheight (and thus the CSV lock) in a timely manner, the |
| 47 | +accepter should fail the channel. |
| 48 | + |
| 49 | +When the funding lease expires, the CSV locks on the accepter's |
| 50 | +commitment transaction output reverts to the normal value, and the |
| 51 | +fund lease is considered concluded. |
| 52 | + |
| 53 | +## Implementation |
| 54 | + |
| 55 | +This proposal is only applicable to dual-funded channels, as |
| 56 | +single-funded channels do not have the capability to permit |
| 57 | +the accepter to contribute funds to a channel. |
| 58 | + |
| 59 | +A new TLV is added to both the `open_channel2` and `accept_channel2`. |
| 60 | +These allow for the negotiation of the terms and funds for the |
| 61 | +contribution. |
| 62 | + |
| 63 | +A new message, `update_blockheight` is added to the Normal Operation of |
| 64 | +a channel's lifetime. As with `update_feerate`, only the channel opener |
| 65 | +may send this message. |
| 66 | + |
| 67 | +The CSV value for the commitment transaction outputs to the accepter |
| 68 | +are modified. They now incorporate the funding lease and time since |
| 69 | +the channel has been opened. As blocks are published, the CSV |
| 70 | +for the accepter's outputs is decremented. Once the funding lease |
| 71 | +has passed, the CSV value outputs return to the 'normal', non-leased values. |
| 72 | + |
| 73 | +The lease fee, which is owed to the accepter from the opener's funding |
| 74 | +transaction inputs, is found as: |
| 75 | + |
| 76 | + - the `funding_fee_base_sat`, plus |
| 77 | + - the accepter's `funding_satoshis` times the |
| 78 | + `funding_fee_proportional_basis` / 1000, plus |
| 79 | + - the weight charge times the `funding_feerate_perkw` / 1000 |
| 80 | + |
| 81 | +The lease fee is added to the accepter's output in the commitment transaction. |
| 82 | + |
| 83 | +## Security |
| 84 | +The opener should consider implementing a rate limit or routing policy |
| 85 | +that curtails the export of the leased funds during the duration of |
| 86 | +the lease. This depends on the goals of the opener node. |
| 87 | + |
| 88 | +## Open Questions |
| 89 | +TODO |
0 commit comments