@@ -277,7 +277,7 @@ nodes not associated with an already known channel are ignored.
277
277
2 . types:
278
278
1 . type: 1 (` option_will_fund ` )
279
279
2 . data:
280
- * [ ` will_fund_lease_rates ` :` will_fund_lease_rates ` ]
280
+ * [ ` will_fund_rates ` :` will_fund_rates ` ]
281
281
282
282
` timestamp ` allows for the ordering of messages, in the case of multiple
283
283
announcements. ` rgb_color ` and ` alias ` allow intelligence services to assign
@@ -1156,62 +1156,89 @@ above.
1156
1156
1157
1157
Liquidity ads allow nodes to announce their willingness to provide funding to
1158
1158
other nodes for a fee. Sellers advertise various rates for the liquidity they
1159
- are selling depending on the guarantees offered to buyers .
1159
+ are selling.
1160
1160
1161
- 1 . subtype: ` will_fund_lease_rates `
1161
+ 1 . ` lease_type ` : 0 ( ` basic_funding_lease ` )
1162
1162
2 . data:
1163
- * [ ` will_fund_lease_rates_tlvs ` :` lease_rates ` ]
1163
+ * [ ` u32 ` :` min_lease_amount_sat ` ]
1164
+ * [ ` u32 ` :` max_lease_amount_sat ` ]
1165
+ * [ ` u16 ` :` funding_weight ` ]
1166
+ * [ ` u16 ` :` lease_fee_basis ` ]
1167
+ * [ ` tu32 ` :` lease_fee_base_sat ` ]
1164
1168
1165
- 1 . ` tlv_stream ` : ` will_fund_lease_rates_tlvs `
1166
- 2 . types:
1167
- 1 . type: 1 (` basic_funding_leases ` )
1168
- 2 . data:
1169
- * [ ` ...*basic_funding_lease ` :` funding_lease_rates ` ]
1169
+ Each ` lease_type ` has a matching ` lease_witness ` that commits to the lease.
1170
+
1171
+ 1 . ` lease_type ` : 0 (` basic_funding_lease_witness ` )
1172
+ 2 . data:
1173
+ * [ ` ...*byte ` :` funding_script ` ]
1174
+
1175
+ Lease types and lease witnesses are encoded using the TLV format, using the
1176
+ ` lease_type ` for the type field.
1177
+
1178
+ Sellers also define how the fees can be paid by listing the ` payment_type ` s
1179
+ they support.
1180
+
1181
+ 1 . ` payment_type ` : 0 (` from_channel_balance ` )
1182
+
1183
+ Payment types are encoded using the TLV format, using the ` payment_type ` for
1184
+ the type field.
1185
+
1186
+ Sellers advertize their rates and payment types using ` will_fund_rates ` .
1187
+
1188
+ 1 . subtype: ` will_fund_rates `
1189
+ 2 . data:
1190
+ * [ ` u16 ` :` funding_rates_count ` ]
1191
+ * [ ` funding_rates_count*funding_lease ` :` funding_rates ` ]
1192
+ * [ ` u16 ` :` payment_types_len ` ]
1193
+ * [ ` payment_types_len*byte ` :` payment_types ` ]
1194
+
1195
+ Buyers select a specific lease and a ` payment_type ` offered by the seller
1196
+ and use ` request_funds ` to purchase that lease.
1170
1197
1171
1198
1 . subtype: ` request_funds `
1172
1199
2 . data:
1173
1200
* [ ` u64 ` :` requested_sats ` ]
1174
- * [ ` byte ` :` lease_type ` ]
1175
1201
* [ ` funding_lease ` :` funding_lease ` ]
1202
+ * [ ` payment_type ` :` payment_type ` ]
1176
1203
1177
- 1 . ` lease_type ` : 1 (` basic_funding_lease ` )
1178
- 2 . data:
1179
- * [ ` u32 ` :` min_lease_amount_sat ` ]
1180
- * [ ` u32 ` :` max_lease_amount_sat ` ]
1181
- * [ ` u16 ` :` funding_weight ` ]
1182
- * [ ` u16 ` :` lease_fee_basis ` ]
1183
- * [ ` u32 ` :` lease_fee_base_sat ` ]
1204
+ Sellers accept the purchase with ` will_fund ` containing a signature that
1205
+ commits to the lease parameters included in the ` lease_witness ` .
1184
1206
1185
1207
1 . subtype: ` will_fund `
1186
1208
2 . data:
1187
- * [ ` byte ` :` lease_witness_type ` ]
1188
1209
* [ ` lease_witness ` :` lease_witness ` ]
1189
1210
* [ ` signature ` :` signature ` ]
1190
1211
1191
- 1 . ` lease_witness_type ` : 1 (` basic_funding_lease_witness ` )
1192
- 2 . data:
1193
- * [ ` u16 ` :` funding_script_size ` ]
1194
- * [ ` funding_script_size ` :` funding_script ` ]
1212
+ ### Requirements
1195
1213
1196
- Sellers may offer multiple ` lease_type ` s, described in the following sections.
1197
- Buyers select a specific lease offered by the seller and use ` request_funds `
1198
- to purchase that lease. Sellers answer with ` will_fund ` containing a signature
1199
- that commits to the lease parameters included in the ` lease_witness ` .
1214
+ A node selling liquidity:
1215
+ - MUST advertise its funding rates with ` will_fund_rates ` :
1216
+ - MUST include a list of ` lease_type ` s in ` funding_rates ` .
1217
+ - MUST encode each ` funding_lease ` using the TLV format.
1218
+ - MAY include multiple ` funding_lease ` s with the same ` lease_type ` .
1219
+ - MUST include a ` payment_types ` bitfield: for each ` payment_type ` that it
1220
+ supports, the bit at the position matching this type MUST be set.
1221
+ - When receiving ` request_funds ` :
1222
+ - If the ` funding_lease ` does not match a lease it offers:
1223
+ - MUST reject the funding attempt.
1224
+ - If the ` payment_type ` is not supported:
1225
+ - MUST reject the funding attempt.
1226
+ - Otherwise:
1227
+ - MUST send ` will_fund ` with the ` lease_witness ` matching the requested
1228
+ ` funding_lease ` and a signature covering that witness (see below).
1229
+
1230
+ A node buying liquidity:
1231
+ - MUST ignore any unknown ` lease_type ` in ` will_fund_rates.funding_rates ` .
1232
+ - MUST ignore any unknown ` payment_type ` in ` will_fund_rates.payment_types ` .
1233
+ - MUST create ` request_funds ` with a ` funding_lease ` from the ` funding_rates `
1234
+ and a ` payment_type ` from the ` payment_types ` bitfield.
1235
+ - MUST encode ` funding_lease ` and ` payment_type ` using the TLV format.
1200
1236
1201
1237
### The ` basic_funding_lease ` type
1202
1238
1203
- A ` basic_funding_lease ` does not provide any guarantee that the seller won't
1204
- close the channel or increase their routing fees after the purchase, if the
1205
- liquidity isn't actually used.
1206
-
1207
- When ` request_funds ` and ` will_fund ` have been exchanged, the buyer must pay
1208
- fees to the seller for the funding they provide to the channel based on the
1209
- agreed upon ` funding_weight ` , ` lease_fee_basis ` and ` lease_fee_base_sat ` .
1210
-
1211
- The lease fee is taken from the buyer's funding inputs and added to the
1212
- seller's channel balance during the funding flow. The buyer must contribute
1213
- enough funds to cover their channel balance, the lease fee, and the on-chain
1214
- fees for the weight of the funding transaction they're responsible for.
1239
+ When ` request_funds ` and ` will_fund ` have been exchanged, the buyer agrees to
1240
+ pay fees to the seller for the funding they provide to the channel based on
1241
+ the proposed ` funding_weight ` , ` lease_fee_basis ` and ` lease_fee_base_sat ` .
1215
1242
1216
1243
The lease fee has three components:
1217
1244
@@ -1231,6 +1258,8 @@ associated with their `node_id`. The data signed is:
1231
1258
1232
1259
SHA256("basic_funding_lease" || basic_funding_lease_witness)
1233
1260
1261
+ The ` basic_funding_lease_witness ` is encoded using the TLV format.
1262
+
1234
1263
We use a tagged hash to ensure that this signature cannot be used in a
1235
1264
different context.
1236
1265
@@ -1246,14 +1275,23 @@ A node selling a `basic_funding_lease`:
1246
1275
It ensures that the funding node is refunded for some of the on-chain
1247
1276
fees it will pay to contribute the requested funds to a channel.
1248
1277
1278
+ ### The ` from_channel_balance ` payment type
1279
+
1280
+ The lease fee is taken from the buyer's transaction inputs and added to the
1281
+ seller's channel balance during the funding flow, using the
1282
+ [ interactive-tx] ( ./02-peer-protocol.md#interactive-transaction-construction )
1283
+ protocol. The buyer must contribute enough funds to cover their channel
1284
+ balance, the lease fee, and the on-chain fees for the weight of the funding
1285
+ transaction they're responsible for.
1286
+
1249
1287
#### Example
1250
1288
1251
1289
A node contributes ` 500_000 sats ` to a channel and requests ` 1_000_000 sats `
1252
1290
from its peer, at a feerate of ` 2500 sat/kw ` . The total weight of their inputs
1253
1291
and outputs in the funding transaction is 720. More details about transaction
1254
1292
weight can be found in the [ interactive-tx section] ( 02-peer-protocol.md#interactive-transaction-construction ) .
1255
1293
1256
- The seller contributes ` 1_100_000 sats ` with the following ` lease_rate ` :
1294
+ The seller contributes ` 1_100_000 sats ` with the following lease rate :
1257
1295
1258
1296
funding_weight = 444
1259
1297
lease_fee_base_sat = 233 sats
0 commit comments