Skip to content

Commit d30aa2b

Browse files
committed
Remove duration_based_funding_leases
It makes more sense to start with only the most basic liquidity ads type and add more `lease_type`s in the future, as needed. It may be useful to readers to see how different lease types can be introduced. The previous commit is a good example of that.
1 parent 58f2fdd commit d30aa2b

File tree

3 files changed

+22
-179
lines changed

3 files changed

+22
-179
lines changed

02-peer-protocol.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,9 +1304,8 @@ The receiving node:
13041304
- `provide_funding` is set and:
13051305
- the `will_fund.lease_witness` does not match the `request_funds.funding_lease`.
13061306
- the `will_fund.signature` is invalid.
1307-
- a `duration_based_funding_lease_witness` is provided but its `lease_expiry` is too close.
13081307
- MUST pay fees for the `option_will_fund` amount (if any) as detailed in the
1309-
[liquidity ads section](07-routing-gossip.md#paying-the-funding_lease_fee).
1308+
[liquidity ads section](07-routing-gossip.md#liquidity-ads).
13101309

13111310
#### Rationale
13121311

07-routing-gossip.md

Lines changed: 21 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,6 @@ The origin node:
514514
- SHOULD NOT create redundant `channel_update`s
515515
- If it creates a new `channel_update` with updated channel parameters:
516516
- SHOULD keep accepting the previous channel parameters for 10 minutes
517-
- If it is the seller of a currently active `duration_based_funding_lease` on this channel:
518-
- MUST NOT set `fee_base_msat` greater than `max_channel_fee_base_msat`
519-
(as committed to in `will_fund.signature`).
520-
- MUST NOT set `fee_proportional_millionths` greater than `max_channel_fee_basis * 100`
521-
(as committed to in `will_fund.signature`).
522517

523518
The receiving node:
524519
- if the `short_channel_id` does NOT match a previous `channel_announcement`,
@@ -1172,9 +1167,6 @@ are selling depending on the guarantees offered to buyers.
11721167
1. type: 1 (`basic_funding_leases`)
11731168
2. data:
11741169
* [`...*basic_funding_lease`:`funding_lease_rates`]
1175-
1. type: 3 (`duration_based_funding_leases`)
1176-
2. data:
1177-
* [`...*duration_based_funding_lease`:`funding_lease_rates`]
11781170

11791171
1. subtype: `request_funds`
11801172
2. data:
@@ -1186,19 +1178,6 @@ are selling depending on the guarantees offered to buyers.
11861178
2. data:
11871179
* [`u32`:`min_lease_amount_sat`]
11881180
* [`u32`:`max_lease_amount_sat`]
1189-
* [`funding_lease_fee`:`funding_lease_fee`]
1190-
1191-
1. `lease_type`: 3 (`duration_based_funding_lease`)
1192-
2. data:
1193-
* [`u16`:`lease_duration`]
1194-
* [`u32`:`min_lease_amount_sat`]
1195-
* [`u32`:`max_lease_amount_sat`]
1196-
* [`funding_lease_fee`:`funding_lease_fee`]
1197-
* [`u16`:`max_channel_fee_basis`]
1198-
* [`u32`:`max_channel_fee_base_msat`]
1199-
1200-
1. subtype: `funding_lease_fee`
1201-
2. data:
12021181
* [`u16`:`funding_weight`]
12031182
* [`u16`:`lease_fee_basis`]
12041183
* [`u32`:`lease_fee_base_sat`]
@@ -1214,14 +1193,6 @@ are selling depending on the guarantees offered to buyers.
12141193
* [`u16`:`funding_script_size`]
12151194
* [`funding_script_size`:`funding_script`]
12161195

1217-
1. `lease_witness_type`: 3 (`duration_based_funding_lease_witness`)
1218-
2. data:
1219-
* [`u32`:`lease_expiry`]
1220-
* [`u16`:`funding_script_size`]
1221-
* [`funding_script_size`:`funding_script`]
1222-
* [`u16`:`max_channel_fee_basis`]
1223-
* [`u32`:`max_channel_fee_base_msat`]
1224-
12251196
Sellers may offer multiple `lease_type`s, described in the following sections.
12261197
Buyers select a specific lease offered by the seller and use `request_funds`
12271198
to purchase that lease. Sellers answer with `will_fund` containing a signature
@@ -1233,8 +1204,27 @@ A `basic_funding_lease` does not provide any guarantee that the seller won't
12331204
close the channel or increase their routing fees after the purchase, if the
12341205
liquidity isn't actually used.
12351206

1236-
The `funding_lease_fee` is paid as detailed in the `funding_lease_fee` section
1237-
below.
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.
1215+
1216+
The lease fee has three components:
1217+
1218+
* a fixed amount: `lease_fee_base_sat`
1219+
* a proportional amount based on the seller's `funding_amount`:
1220+
* `paid_funding_contribution = min(funding_amount, request_funds.requested_sats)`
1221+
* `lease_fee_proportional_sat = paid_funding_contribution * lease_fee_basis / 10_000`
1222+
* a contribution to the on-chain fees paid by the seller:
1223+
* `lease_fee_mining_sat = funding_weight * funding_feerate_perkw / 1000`
1224+
1225+
The lease fee is then:
1226+
1227+
lease_fee_total = lease_fee_base_sat + lease_fee_proportional_sat + lease_fee_mining_sat
12381228

12391229
The seller provides an ECDSA signature in `will_fund` using the private key
12401230
associated with their `node_id`. The data signed is:
@@ -1256,58 +1246,6 @@ A node selling a `basic_funding_lease`:
12561246
It ensures that the funding node is refunded for some of the on-chain
12571247
fees it will pay to contribute the requested funds to a channel.
12581248

1259-
### The `duration_based_funding_lease` type
1260-
1261-
A `duration_based_funding_lease` commits to a duration during which the seller
1262-
will not remove the funds nor increase their routing fees above the maximum
1263-
values provided in the lease. It is impossible to actually prevent them from
1264-
doing so, but the signature they provide in `will_fund` can be used to prove
1265-
that they cheated.
1266-
1267-
The `funding_lease_fee` is paid as detailed in the `funding_lease_fee` section
1268-
below.
1269-
1270-
The seller provides an ECDSA signature in `will_fund` using the private key
1271-
associated with their `node_id`. The data signed is:
1272-
1273-
SHA256("duration_based_funding_lease" || duration_based_funding_lease_witness)
1274-
1275-
We use a tagged hash to ensure that this signature cannot be used in a
1276-
different context.
1277-
1278-
#### Requirements
1279-
1280-
A node selling a `duration_based_funding_lease`:
1281-
- MUST set `lease_duration` to the number of blocks during which the lease
1282-
will be active.
1283-
- MUST set `max_channel_fee_base_msat` to the maximum `fee_base_msat` it
1284-
will use in its `channel_update` while the lease is active.
1285-
- MUST set `max_channel_fee_basis` to match (when converted from basis
1286-
points to millionths) the maximum `fee_proportional_millionths` it will
1287-
use in its `channel_update` while the lease is active.
1288-
1289-
### Paying the `funding_lease_fee`
1290-
1291-
When `request_funds` and `will_fund` have been exchanged, the buyer must pay
1292-
fees to the seller for the funding they provide to the channel based on the
1293-
agreed upon `funding_lease_fee`.
1294-
1295-
The lease fee is taken from the buyer's funding inputs and added to the
1296-
seller's channel balance during the funding flow. The buyer must contribute
1297-
enough funds to cover their channel balance, the lease fee, and the on-chain
1298-
fees for the weight of the funding transaction they're responsible for.
1299-
1300-
The lease fee has three components:
1301-
1302-
* a fixed amount: `lease_fee_base_sat`
1303-
* a proportional amount based on the seller's `funding_amount`:
1304-
* `paid_funding_contribution = min(funding_amount, request_funds.requested_sats)`
1305-
* `lease_fee_proportional_sat = paid_funding_contribution * lease_fee_basis / 10_000`
1306-
* a contribution to the on-chain fees paid by the seller:
1307-
* `lease_fee_mining_sat = funding_weight * funding_feerate_perkw / 1000`
1308-
1309-
The lease fee is then `lease_fee_total = lease_fee_base_sat + lease_fee_proportional_sat + lease_fee_mining_sat`.
1310-
13111249
#### Example
13121250

13131251
A node contributes `500_000 sats` to a channel and requests `1_000_000 sats`

bolt07/liquidity-ads.json

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,6 @@
3030
"lease_fee_base_sat": 0,
3131
"encoded": "0007a120 004c4b40 044c 004b 00000000"
3232
}
33-
],
34-
"duration_based_funding_leases": [
35-
{
36-
"lease_duration": 1008,
37-
"min_lease_amount_sat": 100000,
38-
"max_lease_amount_sat": 1000000,
39-
"funding_weight": 600,
40-
"lease_fee_basis": 150,
41-
"lease_fee_base_sat": 1000,
42-
"max_channel_fee_basis": 75,
43-
"max_channel_fee_base_msat": 10000,
44-
"encoded": "03f0 000186a0 000f4240 0258 0096 000003e8 004b 00002710"
45-
},
46-
{
47-
"lease_duration": 2016,
48-
"min_lease_amount_sat": 500000,
49-
"max_lease_amount_sat": 1500000,
50-
"funding_weight": 1000,
51-
"lease_fee_basis": 250,
52-
"lease_fee_base_sat": 10000,
53-
"max_channel_fee_basis": 100,
54-
"max_channel_fee_base_msat": 10000,
55-
"encoded": "07e0 0007a120 0016e360 03e8 00fa 00002710 0064 00002710"
56-
}
5733
]
5834
}
5935
},
@@ -123,75 +99,5 @@
12399
},
124100
"encoded": "0041 0100000000000000000000000000000000000000000000000000000000000000 00000000000aae60 00000000000001d9 0000000005f5e100 0000000000000001 00000006 0090 0032 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 03 65 01 002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c 2766629334a0cd5a8835fe6fb1790fea7a85da49dab7740d72c8b591247f905a5400c576bd196e9394a92c4340179f0aaf5076b4b4953b3ca2928ded94d1dc8b"
125101
}
126-
},
127-
"open_channel2_with_duration_lease": {
128-
"chainHash": "6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000",
129-
"temporaryChannelId": "0100000000000000000000000000000000000000000000000000000000000000",
130-
"fundingFeerate": 5000,
131-
"commitmentFeerate": 4000,
132-
"fundingAmount": 250000,
133-
"dustLimit": 500,
134-
"maxHtlcValueInFlightMsat": 50000,
135-
"htlcMinimum": 15,
136-
"toSelfDelay": 144,
137-
"maxAcceptedHtlcs": 483,
138-
"lockTime": 650000,
139-
"fundingPubkey": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
140-
"revocationBasepoint": "024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766",
141-
"paymentBasepoint": "02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337",
142-
"delayedPaymentBasepoint": "03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b",
143-
"htlcBasepoint": "0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7",
144-
"firstPerCommitmentPoint": "03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a",
145-
"secondPerCommitmentPoint": "02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f",
146-
"channelFlags": {
147-
"announceChannel": true
148-
},
149-
"tlvStream": {
150-
"request_funding": {
151-
"requested_sats": 750000,
152-
"lease_type": 3,
153-
"funding_lease": {
154-
"lease_duration": 1008,
155-
"min_lease_amount_sat": 100000,
156-
"max_lease_amount_sat": 1000000,
157-
"funding_weight": 600,
158-
"lease_fee_basis": 150,
159-
"lease_fee_base_sat": 1000,
160-
"max_channel_fee_basis": 75,
161-
"max_channel_fee_base_msat": 10000
162-
}
163-
}
164-
},
165-
"encoded": "0040 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 0100000000000000000000000000000000000000000000000000000000000000 00001388 00000fa0 000000000003d090 00000000000001f4 000000000000c350 000000000000000f 0090 01e3 0009eb10 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 01 03 21 00000000000b71b0 03 03f0 000186a0 000f4240 0258 0096 000003e8 004b 00002710"
166-
},
167-
"accept_channel2_with_duration_lease": {
168-
"temporaryChannelId": "0100000000000000000000000000000000000000000000000000000000000000",
169-
"fundingAmount": 700000,
170-
"dustLimit": 473,
171-
"maxHtlcValueInFlightMsat": 100000000,
172-
"htlcMinimum": 1,
173-
"minimumDepth": 6,
174-
"toSelfDelay": 144,
175-
"maxAcceptedHtlcs": 50,
176-
"fundingPubkey": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f",
177-
"revocationBasepoint": "024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766",
178-
"paymentBasepoint": "02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337",
179-
"delayedPaymentBasepoint": "03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b",
180-
"htlcBasepoint": "0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7",
181-
"firstPerCommitmentPoint": "03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a",
182-
"secondPerCommitmentPoint": "02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f",
183-
"tlvStream": {
184-
"provide_funding": {
185-
"lease_witness_type": 3,
186-
"lease_witness": {
187-
"lease_expiry": 840330,
188-
"funding_script": "00202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c",
189-
"max_channel_fee_basis": 75,
190-
"max_channel_fee_base_msat": 10000
191-
},
192-
"signature": "5b8e3c79db5f2144ea4d4573c033c36c601ab705afe0fab305b8b78a6551d4873ccca86d9e68ae896e722d0008c653b4c253398c266ed039c4776fd0f492d10d"
193-
}
194-
},
195-
"encoded": "0041 0100000000000000000000000000000000000000000000000000000000000000 00000000000aae60 00000000000001d9 0000000005f5e100 0000000000000001 00000006 0090 0032 031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f 024d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766 02531fe6068134503d2723133227c867ac8fa6c83c537e9a44c3c5bdbdcb1fe337 03462779ad4aad39514614751a71085f2f10e1c7a593e4e030efb5b8721ce55b0b 0362c0a046dacce86ddd0343c6d3c7c79c2208ba0d9c9cf24a6d046d21d21f90f7 03f006a18d5653c4edf5391ff23a61f03ff83d237e880ee61187fa9f379a028e0a 02989c0b76cb563971fdc9bef31ec06c3560f3249d6ee9e5d83c57625596e05f6f 03 6f 03 000cd28a 002200202ec38203f4cf37a3b377d9a55c7ae0153c643046dbdbe2ffccfb11b74420103c 004b 00002710 5b8e3c79db5f2144ea4d4573c033c36c601ab705afe0fab305b8b78a6551d4873ccca86d9e68ae896e722d0008c653b4c253398c266ed039c4776fd0f492d10d"
196102
}
197103
}

0 commit comments

Comments
 (0)