|
| 1 | +``` |
| 2 | +bLIP: 34 |
| 3 | +Title: The `recommended_feerates` message |
| 4 | +Status: Active |
| 5 | +Author: Bastien Teinturier <[email protected]> |
| 6 | +Created: 2024-07-02 |
| 7 | +License: CC0 |
| 8 | +``` |
| 9 | + |
| 10 | +## Abstract |
| 11 | + |
| 12 | +Many lightning messages include feerates for on-chain transactions. Nodes |
| 13 | +receiving those messages are supposed to reject them if they are considered |
| 14 | +too low or too high. However, there is no mechanism to let peers know which |
| 15 | +feerates we currently find acceptable, which leads to frequent failures, |
| 16 | +especially when the mempool feerates fluctuate quickly. |
| 17 | + |
| 18 | +We introduce an optional message to advertise to our peers the feerates we'd |
| 19 | +like to use when funding new or existing channels. |
| 20 | + |
| 21 | +## Copyright |
| 22 | + |
| 23 | +This bLIP is licensed under the CC0 license. |
| 24 | + |
| 25 | +## Motivation |
| 26 | + |
| 27 | +This feature is particularly useful when mobile wallets initiate channel |
| 28 | +operations with their service provider: in most cases, they should use what |
| 29 | +the service provider recommends since they don't have access to a full node |
| 30 | +and the service provider would reject unacceptable feerates anyway. |
| 31 | + |
| 32 | +## Specification |
| 33 | + |
| 34 | +### The `recommended_feerates` message |
| 35 | + |
| 36 | +1. type: 39409 (`recommended_feerates`) |
| 37 | +2. data: |
| 38 | + * [`chain_hash`:`chain_hash`] |
| 39 | + * [`u32`:`funding_feerate_per_kw`] |
| 40 | + * [`u32`:`commitment_feerate_per_kw`] |
| 41 | + |
| 42 | +1. `tlv_stream`: `recommended_feerates_tlvs` |
| 43 | +2. types: |
| 44 | + 1. type: 1 (`funding_feerate_range`) |
| 45 | + 2. data: |
| 46 | + * [`u32`:`min_funding_feerate_per_kw`] |
| 47 | + * [`u32`:`max_funding_feerate_per_kw`] |
| 48 | + 1. type: 3 (`commitment_feerate_range`) |
| 49 | + 2. data: |
| 50 | + * [`u32`:`min_commitment_feerate_per_kw`] |
| 51 | + * [`u32`:`max_commitment_feerate_per_kw`] |
| 52 | + |
| 53 | +### Requirements |
| 54 | + |
| 55 | +The sender: |
| 56 | + |
| 57 | +* SHOULD frequently send `recommended_feerates` with feerates it currently |
| 58 | + accepts for channel funding operations. |
| 59 | +* SHOULD set `funding_feerate_per_kw` to the feerate it uses for funding |
| 60 | + channels. |
| 61 | +* SHOULD set `funding_feerate_range` to the range of acceptables feerates |
| 62 | + for funding channels. |
| 63 | +* SHOULD set `commitment_feerate_per_kw` to the feerate it uses for channel |
| 64 | + commitment transactions. |
| 65 | +* SHOULD set `commitment_feerate_range` to the range of acceptables feerates |
| 66 | + for channel commitment transactions. |
| 67 | +* SHOULD accept feerates that are inside the ranges it advertised. |
| 68 | + |
| 69 | +The receiver: |
| 70 | + |
| 71 | +* SHOULD not send `open_channel`, `open_channel2`, `splice_init`, `tx_init_rbf` |
| 72 | + or other channel funding messages using feerates that are outside of the |
| 73 | + advertised ranges. |
| 74 | + |
| 75 | +### Rationale |
| 76 | + |
| 77 | +While it won't guarantee success every time, taking into account our peer's |
| 78 | +recommended feerates reduces the frequency of failures when funding channels. |
| 79 | + |
| 80 | +### Test vectors |
| 81 | + |
| 82 | +The following test vectors describe how the `recommended_feerates` message is |
| 83 | +encoded: |
| 84 | + |
| 85 | +```json |
| 86 | +[ |
| 87 | + { |
| 88 | + "recommended_feerates": { |
| 89 | + "chain": "testnet3", |
| 90 | + "funding_feerate_per_kw": "2500 sat/kw", |
| 91 | + "commitment_feerate_per_kw": "2500 sat/kw" |
| 92 | + }, |
| 93 | + "encoded": "99f1 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000 000009c4 000009c4" |
| 94 | + }, |
| 95 | + { |
| 96 | + "recommended_feerates": { |
| 97 | + "chain": "testnet3", |
| 98 | + "funding_feerate_per_kw": "5000 sat/kw", |
| 99 | + "commitment_feerate_per_kw": "253 sat/kw" |
| 100 | + }, |
| 101 | + "encoded": "99f1 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000 00001388 000000fd" |
| 102 | + }, |
| 103 | + { |
| 104 | + "recommended_feerates": { |
| 105 | + "chain": "testnet3", |
| 106 | + "funding_feerate_per_kw": "10000 sat/kw", |
| 107 | + "min_funding_feerate_per_kw": "5000 sat/kw", |
| 108 | + "max_funding_feerate_per_kw": "15000 sat/kw", |
| 109 | + "commitment_feerate_per_kw": "1000 sat/kw", |
| 110 | + "min_commitment_feerate_per_kw": "253 sat/kw", |
| 111 | + "max_commitment_feerate_per_kw": "2000 sat/kw" |
| 112 | + }, |
| 113 | + "encoded": "99f1 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000 00002710 000003e8 01080000138800003a98 0308000000fd000007d0" |
| 114 | + } |
| 115 | +] |
| 116 | +``` |
| 117 | + |
| 118 | +## Reference Implementations |
| 119 | + |
| 120 | +* eclair: <https://github.com/ACINQ/eclair/pull/2860> |
0 commit comments