Research/Bitcoin Dev Archive / lightning-dev list
#zerobasefee
20 messages, Aug 15 to 25, 2021. Started by Anthony Towns.
Anthony Towns (5), ZmnSCPxj (5), Matt Corallo (5), Stefan Richter (3), lisa neigut, Olaoluwa Osuntokun
Hey *,
There's been discussions on twitter and elsewhere advocating for setting the BOLT#7 fee_base_msat value [0] to zero. I'm just writing this to summarise my understanding in a place that's able to easily be referenced later.
Setting the base fee to zero has a couple of benefits:
- it means you only have one value to optimise when trying to collect the most fees, and one-dimensional optimisation problems are obviously easier to write code for than two-dimensional optimisation problems
- when finding a route, if all the fees on all the channels are proportional only, you'll never have to worry about paying more fees just as a result of splitting a payment; that makes routing easier (see [1])
So what's the cost? The cost is that there's no longer a fixed minimum fee -- so if you try sending a 1sat payment you'll pay 0.1% of the fee to send a 1000sat payment, and there may be fixed costs that you have in routing payments that you'd like to be compensated for (eg, the computational work to update channel state, the bandwith to forward the tx, or the opportunity cost for not being able to accept another htlc if you've hit your max htlcs per channel limit).
But there's no need to explicitly separate those costs the way we do now; instead of charging 1sat base fee and 0.02% proportional fee, you can instead just set the 0.02% proportional fee and have a minimum payment size of 5000 sats (htlc_minimum_msat=5e6, ~$2), since 0.02% of that is 1sat. Nobody will be asking you to route without offering a fee of at least 1sat, but all the optimisation steps are easier.
You could go a step further, and have the node side accept smaller payments despite the htlc minimum setting: eg, accept a 3000 sat payment provided it pays the same fee that a 5000 sat payment would have. That is, treat the setting as minimum_fee=1sat, rather than minimum_amount=5000sat; so the advertised value is just calculated from the real settings, and that nodes that want to send very small values despite having to pay high rates can just invert the calculation.
I think something like this approach also makes sense when your channel becomes overloaded; eg if you have x HTLC slots available, and y channel capacity available, setting a minimum payment size of something like y/2/x**2 allows you to accept small payments (good for the network) when you're channel is not busy, but reserves the last slots for larger payments so that you don't end up missing out on profits because you ran out of capacity due to low value spam.
Two other aspects related to this:
At present, I think all the fixed costs are also incurred even when a htlc fails, so until we have some way of charging failing txs for incurring those costs, it seems a bit backwards to penalise successful txs who at least pay a proportional fee for the same thing. Until we've got a way of handling that, having zero base fee seems at least fair.
Lower value HTLCs don't need to be included in the commitment transaction (if they're below the dust level, they definitely shouldn't be included, and if they're less than 1sat they can't be included), and as such don't incur all the same fixed costs that HTLCs that are committed too do. Having different base fees for microtransactions that incur fewer costs would be annoying; so having that be "amortised" into the proportional fee might help there too.
I think eltoo can help in two ways by reducing the fixed costs: you no longer need to keep HTLC information around permanently, and if you do a multilevel channel factory setup, you can probably remove the ~400 HTLCs per channel at any one time limit. But there's still other fixed costs, so I think that would just lower the fixed costs, not remove them altogether and isn't a fundamental change.
I think the fixed costs for forwarding a HTLC are very small; something like:
0.02sats -- cost of permanently storing the HTLC info
(100 bytes, $500/TB/year, 1% discount rate)
0.04sats -- compute and bandwidth cost for updating an HTLC ($40/month
at linode, 1 second of compute)
The opportunity cost of having HTLC slots or Bitcoin locked up until the HTLC succeeds/fails could be much more significant, though.
Cheers, aj
[0] https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#the-channel_update-message [1] https://basefee.ln.rene-pickhardt.de/
Good morning aj, et al.
Quoted text (13 lines)
> Hey *, > > There's been discussions on twitter and elsewhere advocating for > setting the BOLT#7 fee_base_msat value [0] to zero. I'm just writing > this to summarise my understanding in a place that's able to easily be > referenced later. > > Setting the base fee to zero has a couple of benefits: > > - it means you only have one value to optimise when trying to collect > the most fees, and one-dimensional optimisation problems are > obviously easier to write code for than two-dimensional optimisation > problems
Indeed, this is a good point regarding this.
Quoted text (4 lines)
> - when finding a route, if all the fees on all the channels are > proportional only, you'll never have to worry about paying more fees > just as a result of splitting a payment; that makes routing easier > (see [1])
If we neglect roundoff errors.
On the other hand, roundoff errors involved are <1msat per split, so it probably will not matter to most people.
Quoted text (14 lines)
> So what's the cost? The cost is that there's no longer a fixed minimum > fee -- so if you try sending a 1sat payment you'll pay 0.1% of the fee > to send a 1000sat payment, and there may be fixed costs that you have > in routing payments that you'd like to be compensated for (eg, the > computational work to update channel state, the bandwith to forward the > tx, or the opportunity cost for not being able to accept another htlc if > you've hit your max htlcs per channel limit). > > But there's no need to explicitly separate those costs the way we do > now; instead of charging 1sat base fee and 0.02% proportional fee, > you can instead just set the 0.02% proportional fee and have a minimum > payment size of 5000 sats (htlc_minimum_msat=5e6, ~$2), since 0.02% > of that is 1sat. Nobody will be asking you to route without offering a > fee of at least 1sat, but all the optimisation steps are easier.
Should this minimum a node will be willing to forward be part of gossip, and how does this affect routing algorithms?
Quoted text (7 lines)
> You could go a step further, and have the node side accept smaller > payments despite the htlc minimum setting: eg, accept a 3000 sat payment > provided it pays the same fee that a 5000 sat payment would have. That is, > treat the setting as minimum_fee=1sat, rather than minimum_amount=5000sat; > so the advertised value is just calculated from the real settings, > and that nodes that want to send very small values despite having to > pay high rates can just invert the calculation.
I like this idea, as I think it matches more what the incentives are. But it requires a change in gossip and in routing algorithms, and more importantly it requires routing algorithms to support two different fee schemes (base + proportional vs min + proportional).
On the other hand, this still is a two-dimensional optimization algorithm, with `minimum_fee` and `proportional_fee_millionths` as the two dimensions. So maybe just have a single proportional-fee mechanism...
Quoted text (16 lines)
> > I think something like this approach also makes sense when your channel > becomes overloaded; eg if you have x HTLC slots available, and y channel > capacity available, setting a minimum payment size of something like > y/2/x**2 allows you to accept small payments (good for the network) > when you're channel is not busy, but reserves the last slots for larger > payments so that you don't end up missing out on profits because you > ran out of capacity due to low value spam. > > Two other aspects related to this: > > At present, I think all the fixed costs are also incurred even when > a htlc fails, so until we have some way of charging failing txs for > incurring those costs, it seems a bit backwards to penalise successful > txs who at least pay a proportional fee for the same thing. Until we've > got a way of handling that, having zero base fee seems at least fair.
Yes, the dreaded mechanism against payment lockup, which as far as I understand has a lot of thought already sunk into it without any widely-accepted solution, sigh.
Regards, ZmnSCPxj
The field of economics has done much work over the past few decades demonstrating that “Free” is problematic in practice because humans will go out of their way to externalize costs elsewhere (e.g. time, in the case of lightning), given the promise of freedom. In other words, actors often act irrationally to get a free deal.
As protocol designers, it would be remiss to ignore this (repeatedly demonstrated) truth.
To avoid this, we’ve been suggesting setting a min_htlc_value requirement. The problem with zbf + a min_htlc size requirement is that it makes tiny payments impossible over lightning, which was one of the original design goals of the system, and is an important feature to keep/support as lightning grows into poorer economic bases and the bitcoin market price continues to rise.
My suggestion would be that, as a compromise, we set a network wide minimum fee at the protocol level of 1msat. Naively, this seems it should be easy to add to calculations using single-dimension optimization (or trivial enough to ignore entirely), it removes the “free lunch” irrationality honeypot zbf opens, and it provides a way forward for the continued use of micropayments.
The result is that micropayments have a different payment regime than “non-micropayments”, (which may still incentive almost irrational behavior) but at least there’s no *loss* felt by node operators for handling/supporting low value payments. 10k micropayments is worth 10sats.
It’s also simple to implement and seems rather obvious in retrospect.
The only confounding future change that I can see us making would be the introduction of negative fees, which are useful as a way to induce payments to rebalance channels passively. This seems like something we can revisit once a proposal for negative fees is being seriously considered, however.
On Sun, Aug 15, 2021 at 05:59 ZmnSCPxj via Lightning-dev < lightning-dev at lists.linuxfoundation.org> wrote:
Quoted text (108 lines)
> Good morning aj, et al. > > > Hey *, > > > > There's been discussions on twitter and elsewhere advocating for > > setting the BOLT#7 fee_base_msat value [0] to zero. I'm just writing > > this to summarise my understanding in a place that's able to easily be > > referenced later. > > > > Setting the base fee to zero has a couple of benefits: > > > > - it means you only have one value to optimise when trying to collect > > the most fees, and one-dimensional optimisation problems are > > obviously easier to write code for than two-dimensional optimisation > > problems > > Indeed, this is a good point regarding this. > > > > - when finding a route, if all the fees on all the channels are > > proportional only, you'll never have to worry about paying more fees > > just as a result of splitting a payment; that makes routing easier > > (see [1]) > > If we neglect roundoff errors. > > On the other hand, roundoff errors involved are <1msat per split, so it > probably will not matter to most people. > > > So what's the cost? The cost is that there's no longer a fixed > minimum > > fee -- so if you try sending a 1sat payment you'll pay 0.1% of the > fee > > to send a 1000sat payment, and there may be fixed costs that you have > > in routing payments that you'd like to be compensated for (eg, the > > computational work to update channel state, the bandwith to forward > the > > tx, or the opportunity cost for not being able to accept another > htlc if > > you've hit your max htlcs per channel limit). > > > > But there's no need to explicitly separate those costs the way we do > > now; instead of charging 1sat base fee and 0.02% proportional fee, > > you can instead just set the 0.02% proportional fee and have a > minimum > > payment size of 5000 sats (htlc_minimum_msat=5e6, ~$2), since 0.02% > > of that is 1sat. Nobody will be asking you to route without offering > a > > fee of at least 1sat, but all the optimisation steps are easier. > > Should this minimum a node will be willing to forward be part of gossip, > and how does this affect routing algorithms? > > > You could go a step further, and have the node side accept smaller > > payments despite the htlc minimum setting: eg, accept a 3000 sat > payment > > provided it pays the same fee that a 5000 sat payment would have. > That is, > > treat the setting as minimum_fee=1sat, rather than > minimum_amount=5000sat; > > so the advertised value is just calculated from the real settings, > > and that nodes that want to send very small values despite having to > > pay high rates can just invert the calculation. > > I like this idea, as I think it matches more what the incentives are. > But it requires a change in gossip and in routing algorithms, and more > importantly it requires routing algorithms to support two different fee > schemes (base + proportional vs min + proportional). > > On the other hand, this still is a two-dimensional optimization algorithm, > with `minimum_fee` and `proportional_fee_millionths` as the two dimensions. > So maybe just have a single proportional-fee mechanism... > > > > > I think something like this approach also makes sense when your > channel > > becomes overloaded; eg if you have x HTLC slots available, and y > channel > > capacity available, setting a minimum payment size of something like > > y/2/x**2 allows you to accept small payments (good for the network) > > when you're channel is not busy, but reserves the last slots for > larger > > payments so that you don't end up missing out on profits because you > > ran out of capacity due to low value spam. > > > > Two other aspects related to this: > > > > At present, I think all the fixed costs are also incurred even when > > a htlc fails, so until we have some way of charging failing txs for > > incurring those costs, it seems a bit backwards to penalise > successful > > txs who at least pay a proportional fee for the same thing. Until > we've > > got a way of handling that, having zero base fee seems at least fair. > > Yes, the dreaded mechanism against payment lockup, which as far as I > understand has a lot of thought already sunk into it without any > widely-accepted solution, sigh. > > > Regards, > ZmnSCPxj > > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >
Good morning lisa, aj, et al.,
Quoted text (3 lines)
> The result is that micropayments have a different payment regime than “non-micropayments”, (which may still incentive almost irrational behavior) but at least there’s no *loss* felt by node operators for handling/supporting low value payments. 10k micropayments is worth 10sats. > > It’s also simple to implement and seems rather obvious in retrospect.
It seems simple to implement for *forwarders*, but I think complicates the algorithm described by Pickhardt and Richter?
On the other hand, the algorithm is targeted towards "large" payments, so perhaps the Pickhardt-Richter payment algo can be forced to have some minimum split size, and payments below this minimum size are just sent as single payments (on the assumption that such micropayments are so small that the probability of failure is negligible). That is, just have the `pay` command branch based on the payment size, if it is below the minimum size, just use the old try-and-try-until-you-die algo, otherwise use a variant on the Pickhardt-Richter algo that respects this minimum payment size. This somewhat implies a minimum on the possible feerate, which we could say is 1 ppm, maybe.
So for example, the minimum size could be 1,000,000msat, or 1,000sat. If the payment is much larger than that, use the Pickhardt-Richter algorithm with zerobasefee. If payment is lower than that threshold, just do not split and do try-and-try-until-you-die.
Regards, ZmnSCPxj
Good morning Zmn!
That is indeed precisely what we do. We usually quantize the min-cost flow into minimum shares of, say, 10kSat to 100kSat. This makes the algorithm run faster and loses very little precision. It also gives a simple way of dealing with (reasonable) min-htlc-size values.
Cheers, Stefan
ZmnSCPxj via Lightning-dev <lightning-dev at lists.linuxfoundation.org> schrieb am So., 15. Aug. 2021, 16:03:
Quoted text (39 lines)
> Good morning lisa, aj, et al., > > > > The result is that micropayments have a different payment regime than > “non-micropayments”, (which may still incentive almost irrational behavior) > but at least there’s no *loss* felt by node operators for > handling/supporting low value payments. 10k micropayments is worth 10sats. > > > > It’s also simple to implement and seems rather obvious in retrospect. > > > It seems simple to implement for *forwarders*, but I think complicates the > algorithm described by Pickhardt and Richter? > > On the other hand, the algorithm is targeted towards "large" payments, so > perhaps the Pickhardt-Richter payment algo can be forced to have some > minimum split size, and payments below this minimum size are just sent as > single payments (on the assumption that such micropayments are so small > that the probability of failure is negligible). > That is, just have the `pay` command branch based on the payment size, if > it is below the minimum size, just use the old try-and-try-until-you-die > algo, otherwise use a variant on the Pickhardt-Richter algo that respects > this minimum payment size. > This somewhat implies a minimum on the possible feerate, which we could > say is 1 ppm, maybe. > > So for example, the minimum size could be 1,000,000msat, or 1,000sat. > If the payment is much larger than that, use the Pickhardt-Richter > algorithm with zerobasefee. > If payment is lower than that threshold, just do not split and do > try-and-try-until-you-die. > > Regards, > ZmnSCPxj > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >
Thanks, AJ, for kicking off the thread.
I'm frankly still very confused why we're having these conversations now. In one particular class of applicable routing algorithms you could use for lightning routing having a base fee makes the algorithm intractably slow, but:
a) to my knowledge, no one has (yet) done any follow-on work to investigate pulling many of the same heuristics Rene et al use in a Dijkstras/A* algorithm with multiple passes or generating multiple routes in the same pass to see whether you can emulate the results in a faster algorithm without the drawbacks here,
b) to my knowledge, no one has (yet) done any follow-on work to investigate mapping the base fee to other, more flow-based-routing-compatible numbers, eg you could convert the base fee to a minimum fee by increasing the "effective" proportional fees. From what others have commented, this may largely "solve" the issue.
c) to my knowledge, no one has (yet) done any follow-on work to analyze where the proposed algorithm may be most optimal in the HTLC-value<->channel liquidity ratio ranges. We may find that the proposed algorithm only provides materially better routing when the HTLC value approaches X% of common network channel liquidity, allowing us to only use it for large-value payments where we can almost ignore the base fees entirely.
There's real cost to distorting the fee structures on the network away from the costs of node operators, especially as we move towards requiring and using Real (tm) amounts of capital on routing nodes. If we're relying purely on hobbyists forever who are operating out of goodwill, we should just remove all fees. If we think Lightning is going to involve capital with real opportunity cost, matching fees to the costs is important, or at least important enough that we shouldn't throw it away after one (pretty great) paper and limited further analysis.
Imagine we find some great way to address HTLC slot flooding/DoS attacks (or just chose to do it in a not-great way) by charging for HTLC slot usage, now we can't fix a critical DoS issue because the routing algorithms we deployed can't handle the new costing. Instead, we should investigate how we can apply the ideas here with the more complicated fee structures we have.
Color me an optimist, but I'm quite confident with sufficient elbow grease and heuristics we can get 95% of the way there. We can and should revisit these conversations if such exploration is done and we find that its not possible, but until then this all feels incredibly premature.
Matt
On 8/14/21 21:00, Anthony Towns wrote:
Quoted text (95 lines)
> Hey *, > > There's been discussions on twitter and elsewhere advocating for > setting the BOLT#7 fee_base_msat value [0] to zero. I'm just writing > this to summarise my understanding in a place that's able to easily be > referenced later. > > Setting the base fee to zero has a couple of benefits: > > - it means you only have one value to optimise when trying to collect > the most fees, and one-dimensional optimisation problems are > obviously easier to write code for than two-dimensional optimisation > problems > > - when finding a route, if all the fees on all the channels are > proportional only, you'll never have to worry about paying more fees > just as a result of splitting a payment; that makes routing easier > (see [1]) > > So what's the cost? The cost is that there's no longer a fixed minimum > fee -- so if you try sending a 1sat payment you'll pay 0.1% of the fee > to send a 1000sat payment, and there may be fixed costs that you have > in routing payments that you'd like to be compensated for (eg, the > computational work to update channel state, the bandwith to forward the > tx, or the opportunity cost for not being able to accept another htlc if > you've hit your max htlcs per channel limit). > > But there's no need to explicitly separate those costs the way we do > now; instead of charging 1sat base fee and 0.02% proportional fee, > you can instead just set the 0.02% proportional fee and have a minimum > payment size of 5000 sats (htlc_minimum_msat=5e6, ~$2), since 0.02% > of that is 1sat. Nobody will be asking you to route without offering a > fee of at least 1sat, but all the optimisation steps are easier. > > You could go a step further, and have the node side accept smaller > payments despite the htlc minimum setting: eg, accept a 3000 sat payment > provided it pays the same fee that a 5000 sat payment would have. That is, > treat the setting as minimum_fee=1sat, rather than minimum_amount=5000sat; > so the advertised value is just calculated from the real settings, > and that nodes that want to send very small values despite having to > pay high rates can just invert the calculation. > > I think something like this approach also makes sense when your channel > becomes overloaded; eg if you have x HTLC slots available, and y channel > capacity available, setting a minimum payment size of something like > y/2/x**2 allows you to accept small payments (good for the network) > when you're channel is not busy, but reserves the last slots for larger > payments so that you don't end up missing out on profits because you > ran out of capacity due to low value spam. > > Two other aspects related to this: > > At present, I think all the fixed costs are also incurred even when > a htlc fails, so until we have some way of charging failing txs for > incurring those costs, it seems a bit backwards to penalise successful > txs who at least pay a proportional fee for the same thing. Until we've > got a way of handling that, having zero base fee seems at least fair. > > Lower value HTLCs don't need to be included in the commitment transaction > (if they're below the dust level, they definitely shouldn't be included, > and if they're less than 1sat they can't be included), and as such don't > incur all the same fixed costs that HTLCs that are committed too do. > Having different base fees for microtransactions that incur fewer costs > would be annoying; so having that be "amortised" into the proportional > fee might help there too. > > I think eltoo can help in two ways by reducing the fixed costs: you no > longer need to keep HTLC information around permanently, and if you do > a multilevel channel factory setup, you can probably remove the ~400 > HTLCs per channel at any one time limit. But there's still other fixed > costs, so I think that would just lower the fixed costs, not remove them > altogether and isn't a fundamental change. > > I think the fixed costs for forwarding a HTLC are very small; something > like: > > 0.02sats -- cost of permanently storing the HTLC info > (100 bytes, $500/TB/year, 1% discount rate) > 0.04sats -- compute and bandwidth cost for updating an HTLC ($40/month > at linode, 1 second of compute) > > The opportunity cost of having HTLC slots or Bitcoin locked up until > the HTLC succeeds/fails could be much more significant, though. > > Cheers, > aj > > [0] https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#the-channel_update-message > [1] https://basefee.ln.rene-pickhardt.de/ > > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >
On Sun, Aug 15, 2021 at 07:19:01AM -0500, lisa neigut wrote:
Quoted text (2 lines)
> My suggestion would be that, as a compromise, we set a network wide minimum fee > at the protocol level of 1msat.
Is that different in any meaningful way to just saying "fees get rounded up to the nearest msat" ? If the fee is 999.999msat, expecting to get away with paying less than 1sat seems kinda buggy to me.
On Sun, Aug 15, 2021 at 08:04:52PM -0400, Matt Corallo wrote:
Quoted text (1 line)
> I'm frankly still very confused why we're having these conversations now.
Because it's what people are thinking about. The bar for having a conversation about something is very low...
Quoted text (3 lines)
> In > one particular class of applicable routing algorithms you could use for > lightning routing having a base fee makes the algorithm intractably slow,
I don't think of that as the problem, but rather as the base fee having a multiplicative effect as you split payments.
If every channel has the same (base,proportional) fee pair, and send a payment along a single path, you're paying n*(base+k*proportional). If you split the payment, and send half of it one way, and half the other way, you're paying n*(2*base+k*proportional). If you split the payment four ways, you're paying n*(4*base+k*proportional). Where's the value to the network in penalising payment splitting?
Being denominated in sats, the base fee also changes in value as the bitcoin price changes -- c-lightning dropped the base fee to 1sat (from 546 sat!) in Jan 2018, but the value of 1sat has increased about 4x since then, and it seems unlikely the fixed costs of a successful HTLC payment have likewise increased 4x. Proportional fees deal with this factor automatically, of course.
Quoted text (2 lines)
> There's real cost to distorting the fee structures on the network away from > the costs of node operators,
That's precisely what the base fee is already doing. Yes, we need some other way of charging fees to prevent using up too many slots or having transactions not fail in a timely manner, but the base fee does not do that.
Quoted text (4 lines)
> Imagine we find some great way to address HTLC slot flooding/DoS attacks (or > just chose to do it in a not-great way) by charging for HTLC slot usage, now > we can't fix a critical DoS issue because the routing algorithms we deployed > can't handle the new costing.
I don't think that's true. The two things we don't charge for that can be abused by probing spam are HTLC slot usage and channel balance usage; both are problems only in proportion to the amount of time they're held open, and the latter is also only a problem proportional to the value being reserved. [0]
Additionally, I don't think HTLC slot usage needs to be kept as a limitation after we switch to eltoo; and in the meantime, I think it can be better managed via adjusting the min_htlc_amount -- at least for the scenario where problems are being caused by legitimate payment attempts, which is also the only place base fee can help.
[0] (Well, ln-penalty's requirement to permanently store HTLC information
in order to apply the penalty is in some sense a constant
cost, however the impact is also proportional to value, and for
sufficiently low value HTLCs can be ignored entirely if the HTLC
isn't included in the channel commitment)
Quoted text (2 lines)
> Instead, we should investigate how we can > apply the ideas here with the more complicated fee structures we have.
Fee structures should be *simple* not complicated.
I mean, it's kind of great that we started off complicated -- if it turns out base fee isn't necessary, it's easy to just set it to zero; if we didn't have it, but needed it, it would be much more annoying to add it in later.
Quoted text (4 lines)
> Color me an optimist, but I'm quite confident with sufficient elbow grease > and heuristics we can get 95% of the way there. We can and should revisit > these conversations if such exploration is done and we find that its not > possible, but until then this all feels incredibly premature.
Depends; I don't think it makes sense to try to ban nodes that don't have a base fee of zero or anything, but random people on twitter advocating that node operators should set it to zero and just worry about optimising via the proportional fee and the min htlc amount seems fine.
For an experimental plugin that aggressively splits payments up, I think either ignoring channels with >0 base fee entirely, or deciding that you're happy to spend a total of X sats on base fees, and then ignoring channels whose base fee is greater than X/paths/path-length sats is fine.
But long term, I also think that the base fee is an entirely unhelpful complication that will eventually just be hardcoded to zero by everyone, and eventually channels that propose non-zero base fees won't even be gossiped. I don't expect that to happen any time soon though.
Cheers, aj
On 8/15/21 22:02, Anthony Towns wrote:
Quoted text (6 lines)
>> In >> one particular class of applicable routing algorithms you could use for >> lightning routing having a base fee makes the algorithm intractably slow, > > I don't think of that as the problem, but rather as the base fee having > a multiplicative effect as you split payments.
Yes, matching the real-world costs of forwarding an HTLC.
Quoted text (6 lines)
> If every channel has the same (base,proportional) fee pair, and send a > payment along a single path, you're paying n*(base+k*proportional). If > you split the payment, and send half of it one way, and half the other > way, you're paying n*(2*base+k*proportional). If you split the payment > four ways, you're paying n*(4*base+k*proportional). Where's the value > to the network in penalising payment splitting?
Yes. You have to pay the cost of a node. If we're really worried about this, we should be talking about upfront fees and/or refunds on HTLC fulfillment, not removing the fees entirely.
Quoted text (6 lines)
> Being denominated in sats, the base fee also changes in value as the > bitcoin price changes -- c-lightning dropped the base fee to 1sat (from > 546 sat!) in Jan 2018, but the value of 1sat has increased about 4x > since then, and it seems unlikely the fixed costs of a successful HTLC > payment have likewise increased 4x. Proportional fees deal with this > factor automatically, of course.
This isn't a protocol issue, implementations can automate this without issue.
Quoted text (7 lines)
>> There's real cost to distorting the fee structures on the network away from >> the costs of node operators, > > That's precisely what the base fee is already doing. Yes, we need some > other way of charging fees to prevent using up too many slots or having > transactions not fail in a timely manner, but the base fee does not > do that.
Huh? For values much smaller than a node's liquidity, the cost for nodes is (mostly) a function of HTLCs, not the value. The cost to nodes is largely (a) the forever-storage that exists, roughly, per HTLC ever on a channel, (b) the HTLC slots which are highly limited for technical reasons per channel, (c) the disk/cpu/network/etc operations per HTLC on an channel, (d) the liquidity required per node. I'd argue (c) is basically zero in any realistic context, (a) is pretty low, but could be non-zero in some cases, so you really just have (b) and (d). For many HTLCs forwarded today, the liquidity on a channel isn't much, so I'd argue for many HTLCs forwarded today per-payment costs mirror the cost to a node much, much, much, much better than some proportional fees?
I'm really not sure where you're coming from here.
Quoted text (13 lines)
>> Imagine we find some great way to address HTLC slot flooding/DoS attacks (or >> just chose to do it in a not-great way) by charging for HTLC slot usage, now >> we can't fix a critical DoS issue because the routing algorithms we deployed >> can't handle the new costing. > > I don't think that's true. The two things we don't charge for that can > be abused by probing spam are HTLC slot usage and channel balance usage; > both are problems only in proportion to the amount of time they're held > open, and the latter is also only a problem proportional to the value > being reserved. [0] > > Additionally, I don't think HTLC slot usage needs to be kept as a > limitation after we switch to eltoo;
The HTLC slot limit is to keep transactions broadcastable. I don't see why this would change, you still get an output for each HTLC on the latest commitment in eltoo, AFAIU.
Quoted text (4 lines)
> and in the meantime, I think it can > be better managed via adjusting the min_htlc_amount -- at least for the > scenario where problems are being caused by legitimate payment attempts, > which is also the only place base fee can help.
Sure, we could also shift towards upfront fees or similar solutions, though, and that was my point - if we start dropping absolute fee amounts now in order to make some given routing algorithm work, we box ourselves in here, and quite needlessly given no one has (yet) done the legwork to show that we even *need* to box ourselves in.
Quoted text (15 lines)
> [0] (Well, ln-penalty's requirement to permanently store HTLC information > in order to apply the penalty is in some sense a constant > cost, however the impact is also proportional to value, and for > sufficiently low value HTLCs can be ignored entirely if the HTLC > isn't included in the channel commitment) > >> Instead, we should investigate how we can >> apply the ideas here with the more complicated fee structures we have. > > Fee structures should be *simple* not complicated. > > I mean, it's kind of great that we started off complicated -- if it > turns out base fee isn't necessary, it's easy to just set it to zero; > if we didn't have it, but needed it, it would be much more annoying to > add it in later.
Fee structures should also match reality, and allow node operators sufficient flexibility to capture their costs. I think we have a design that does so quite well - its pretty simple, there's only two knobs, but the two knobs capture exactly the two broad categories of costs a node operator has.
Quoted text (9 lines)
>> Color me an optimist, but I'm quite confident with sufficient elbow grease >> and heuristics we can get 95% of the way there. We can and should revisit >> these conversations if such exploration is done and we find that its not >> possible, but until then this all feels incredibly premature. > > Depends; I don't think it makes sense to try to ban nodes that don't have > a base fee of zero or anything, but random people on twitter advocating > that node operators should set it to zero and just worry about optimising > via the proportional fee and the min htlc amount seems fine.
Sure, the great thing about today is because the protocol exposes decent knobs operators can tune their fee structures any way they want, providing competition and multiple paths to nodes with potentially very divergent fees depending on the type of payment. Absent liquidity limits, this should provide better service for all types of payments - routing them to nodes that will support those types of payments!
Quoted text (4 lines)
> For an experimental plugin that aggressively splits payments up, I think > either ignoring channels with >0 base fee entirely, or deciding that > you're happy to spend a total of X sats on base fees, and then ignoring > channels whose base fee is greater than X/paths/path-length sats is fine.
Sure, experimental plugins can do whatever they want!
Quoted text (4 lines)
> But long term, I also think that the base fee is an entirely unhelpful > complication that will eventually just be hardcoded to zero by everyone, > and eventually channels that propose non-zero base fees won't even be > gossiped. I don't expect that to happen any time soon though.
I very strongly disagree, as discussed, and am left highly dubious that it is a practical complication in any case.
On Sun, Aug 15, 2021 at 10:21:52PM -0400, Matt Corallo wrote:
Quoted text (7 lines)
> On 8/15/21 22:02, Anthony Towns wrote: > > > In > > > one particular class of applicable routing algorithms you could use for > > > lightning routing having a base fee makes the algorithm intractably slow, > > I don't think of that as the problem, but rather as the base fee having > > a multiplicative effect as you split payments. > Yes, matching the real-world costs of forwarding an HTLC.
Actually, no, not at all.
The base+proportional fees paid only on success roughly match the *value* of forwarding an HTLC, they don't match the costs particularly well at all.
Why not? Because the costs are incurred on failed HTLCs as well, and also depend on the time a HTLC lasts, and also vary heavily depending on how many other simultaneous HTLCs there are.
Quoted text (3 lines)
> Yes. You have to pay the cost of a node. If we're really worried about this, > we should be talking about upfront fees and/or refunds on HTLC fulfillment, > not removing the fees entirely.
(I don't believe either of those are the right approach, but based on previous discussions, I don't think anyone's going to realise I'm right until I implement it and prove it, so *shrug*)
Quoted text (7 lines)
> > Being denominated in sats, the base fee also changes in value as the > > bitcoin price changes -- c-lightning dropped the base fee to 1sat (from > > 546 sat!) in Jan 2018, but the value of 1sat has increased about 4x > > since then, and it seems unlikely the fixed costs of a successful HTLC > > payment have likewise increased 4x. Proportional fees deal with this > > factor automatically, of course. > This isn't a protocol issue, implementations can automate this without issue.
I don't think anyone's proposing the protocol be changed; just that node operators set an option to a particular value?
Well, except that Lisa's maybe proposing that 0 not be allowed, and a value >= 0.001 sat be required? I'm not quite sure.
Quoted text (5 lines)
> > > There's real cost to distorting the fee structures on the network away from > > > the costs of node operators, > > That's precisely what the base fee is already doing. > Huh? For values much smaller than a node's liquidity, the cost for nodes is > (mostly) a function of HTLCs, not the value.
Yes, the cost for nodes is a function of the requests that come in, not how many succeed. The fees are proportional to how many succeed, which is at best a distorted reflection of the number of requests that come in.
Quoted text (1 line)
> The cost to nodes is largely [...]
The cost to nodes is almost entirely the opportunity cost of not being able to accept other txs that would come in afterwards and would pay higher fees.
And all those costs can be captured equally well (or badly) by just setting a proportional fee and a minimum payment value. I don't know why you keep ignoring that point.
Quoted text (3 lines)
> so I'd argue for many HTLCs forwarded > today per-payment costs mirror the cost to a node much, much, much, much > better than some proportional fees?
You're talking yourself into a *really* broken business model there.
Quoted text (5 lines)
> > Additionally, I don't think HTLC slot usage needs to be kept as a > > limitation after we switch to eltoo; > The HTLC slot limit is to keep transactions broadcastable. I don't see why > this would change, you still get an output for each HTLC on the latest > commitment in eltoo, AFAIU.
eltoo gives us the ability to have channel factories, where we divide the overall factory balance amongst different channels, all updated off-chain. It seems likely we'll want to do factories from day one, so that we don't implicitly limit either the lifetime of the channel or its update rate (>1 update/sec ~= <4 year lifetime otherwise if I did the maths right). Once we're doing factories, if we have more than however many htlcs for a channel, we can re-divide the factory balance and add a new channel. If the limit is 500 HTLCs per tx, you'd have to amortize 0.2% of the new tx across each HTLC, in addition to the cost of the HTLC itself, but that seems trivial.
Quoted text (5 lines)
> > and in the meantime, I think it can > > be better managed via adjusting the min_htlc_amount -- at least for the > > scenario where problems are being caused by legitimate payment attempts, > > which is also the only place base fee can help. > Sure, we could also shift towards upfront fees or similar solutions,
Upfront fees seem extremely vulnerable to attacks, and are certainly a (pretty large) protocol change.
Quoted text (11 lines)
> > > Instead, we should investigate how we can > > > apply the ideas here with the more complicated fee structures we have. > > Fee structures should be *simple* not complicated. > > I mean, it's kind of great that we started off complicated -- if it > > turns out base fee isn't necessary, it's easy to just set it to zero; > > if we didn't have it, but needed it, it would be much more annoying to > > add it in later. > Fee structures should also match reality, and allow node operators > sufficient flexibility to capture their costs. I think we have a design that > does so quite well - its pretty simple, there's only two knobs, but the two > knobs capture exactly the two broad categories of costs a node operator has.
I don't know how you can think these "exactly" capture node operators' costs. They're missing the time factor, and don't capture any of the costs due to failed payments.
Quoted text (2 lines)
> Sure, the great thing about today is because the protocol exposes decent > knobs operators can tune
Knobs are great for experimenting; but they're also something to work at reducing once the experiments have come up with some results. I think #zerobasefee is more in the experiment stage: "hey, this seems like a great idea, let's set this knob to zero and focus on these other ones instead".
Quoted text (5 lines)
> > For an experimental plugin that aggressively splits payments up, I think > > either ignoring channels with >0 base fee entirely, or deciding that > > you're happy to spend a total of X sats on base fees, and then ignoring > > channels whose base fee is greater than X/paths/path-length sats is fine. > Sure, experimental plugins can do whatever they want!
Is there any reason to think any of this would be something other than node configuration options and experimental plugins any time soon?
(By "any time soon" I mean, I could see software defaults changing if over 50% of the network deliberately switched to zero base fees and found it worked fine; and I could see deprecating non-zero fees if that ended up with 90% of the network on zero base fees, no good reasons for node operators wanting to stick with running non-zero base fees, and the experimental algos that relied on zero base fees being significantly easier to maintain or faster/better)
Quoted text (6 lines)
> > But long term, I also think that the base fee is an entirely unhelpful > > complication that will eventually just be hardcoded to zero by everyone, > > and eventually channels that propose non-zero base fees won't even be > > gossiped. I don't expect that to happen any time soon though. > I very strongly disagree, as discussed, and am left highly dubious > that it is a practical complication in any case.
That's okay! Long term predictions would be pretty boring if everyone agreed with them.
Cheers, aj
Dropped a number of replies to which the reply would otherwise be "see above".
On 8/16/21 00:00, Anthony Towns wrote:
Quoted text (18 lines)
> On Sun, Aug 15, 2021 at 10:21:52PM -0400, Matt Corallo wrote: >> On 8/15/21 22:02, Anthony Towns wrote: >>>> In >>>> one particular class of applicable routing algorithms you could use for >>>> lightning routing having a base fee makes the algorithm intractably slow, >>> I don't think of that as the problem, but rather as the base fee having >>> a multiplicative effect as you split payments. >> Yes, matching the real-world costs of forwarding an HTLC. > > Actually, no, not at all. > > The base+proportional fees paid only on success roughly match the *value* > of forwarding an HTLC, they don't match the costs particularly well > at all. > > Why not? Because the costs are incurred on failed HTLCs as well, and > also depend on the time a HTLC lasts, and also vary heavily depending > on how many other simultaneous HTLCs there are.
Sure, indeed, there's some additional costs which are not covered by failed HTLCs, nor incorporate the time the HTLC slot was used. But that wasn't my argument - my argument was that base + proportional is a much, much closer match for the costs of a node barring clever-er solutions around HTLC-slot-time-used. Dropping base fee makes the whole situation a good chunk *worse*.
Quoted text (7 lines)
>> Yes. You have to pay the cost of a node. If we're really worried about this, >> we should be talking about upfront fees and/or refunds on HTLC fulfillment, >> not removing the fees entirely. > > (I don't believe either of those are the right approach, but based on > previous discussions, I don't think anyone's going to realise I'm right > until I implement it and prove it, so *shrug*)
I think I agree, but I think they may currently be better than any *other* proposal, not that they're particularly good.
Quoted text (9 lines)
>> The cost to nodes is largely [...] > > The cost to nodes is almost entirely the opportunity cost of not being > able to accept other txs that would come in afterwards and would pay > higher fees. > > And all those costs can be captured equally well (or badly) by just > setting a proportional fee and a minimum payment value. I don't know why > you keep ignoring that point.
I didn't ignore this, I just disagree, and I'm not entirely sure why you're ignoring the points I made to that effect :).
In all seriousness, I'm entirely unsure why you think proportional is just as good? As you note, the cost for nodes is a function of the opportunity cost of the capital, and opportunity cost of the HTLC slots. Lets say as a routing node I decide that the opportunity cost of one of my HTLC slots is generally 1 sat per second, and the average HTLC is fulfilled in one second. Why is it that a proportional fee captures this "equally well"?!
Yes, you could amortize it, but that doesn't make it "equally" good, and there are semi-serious proposals to start ignoring nodes that *dont* set their fees to some particular structure in routing decisions. Sure, nodes can do what they want, but its kinda absurd to suggest that this is a perfectly fine thing to do absent a somewhat compelling reason. This goes doubly because deploying such things significantly will mean we cannot do future protocol changes which may better capture the time-value of node resources!
Quoted text (7 lines)
>>> Additionally, I don't think HTLC slot usage needs to be kept as a >>> limitation after we switch to eltoo; >> The HTLC slot limit is to keep transactions broadcastable. I don't see why >> this would change, you still get an output for each HTLC on the latest >> commitment in eltoo, AFAIU. > > eltoo gives us the ability to have channel factories....
That doesn't solve the issue at all - you still have a ton of transactions and transaction outputs and spends thereof to put on the chain in the case of a closure with pending HTLCs. In fact, most nodes today enforce a lower limit than the 400-some-odd HTLCs that represent the transaction standardness limit, because 100KB transactions are stupid impractical.
Quoted text (7 lines)
> (By "any time soon" I mean, I could see software defaults changing if > over 50% of the network deliberately switched to zero base fees and found > it worked fine; and I could see deprecating non-zero fees if that ended > up with 90% of the network on zero base fees, no good reasons for node > operators wanting to stick with running non-zero base fees, and the > experimental algos that relied on zero base fees being significantly > easier to maintain or faster/better)
What is your definition of "works fine" here? In today's nearly-entirely-altruistic-routing-node network, we could probably entirely drop the routing fees and things would "work fine". That doesn't make it a good idea for the long-term health of the network.
My suggestion is quite simple - that the software vendors wishing to rely on these types of algorithms *first* do the legwork to see what other ideas can be explored before jumping to "ignore all the nodes who've decided their fees are X", because I think *that* is pretty bad idea for the long-term health of the network. I even suggested several areas of future research for folks to look into before we get to the point of in any way seriously relying on routing algorithms that constrain our ability to adapt fees in the future.
Matt
Good morning matt and aj,
Let me cut in here.
Quoted text (1 line)
>From my reading of the actual paper --- which could be a massive misunderstanding, as I can barely understand half the notation, I am more a dabbler in software engineering than a mathist --- it seems to me that it would be possible to replace the cost function in the planning algorithm with *only* the negative-log-probability, which I think is the key point of the paper.
That is, the algorithm can be run in a mode where it *ignores* whatever fee scheme forwarding nodes desire. (@rene: correct me if I am wrong?)
I propose that the algorithm be modified as such, that is, it *ignore* the fee scheme.
However, the algorithm then gets an extra step after getting a payment plan (i.e. how to route multiple sub-payments). It looks over the payment plan and if the fees involved are beyond some user-defined limit (with, say, a default of 0.5% of the total amount, as per the C-Lightning `pay` default), to look at the highest-fee channels in the payment plan. Then, it can rerun the flow algorithm, telling it to *disallow* the highest-fee channels identified if the total fees exceed the fee budget.
It seems to me that this modification of the algorithm may be sufficient to be resilient against any and all future fee scheme we may decide for Lightning.
This still achieves "optimality" in the sense of the paper, in a way similar to what is suggested in the paper. The paper suggests to basically ignore gossiped channels with non-zero basefee. The approach I suggest allows us to *start* without ignoring non-zero basefee, but to slowly degrade our view of the network by disallowing high-fee (whether high basefee or high propfee) channels.
Regards, ZmnSCPxj
Hi Zmn et al.,
Quoted text (2 lines)
>I propose that the algorithm be modified >as such, that is, it *ignore* the fee scheme.
We actually started out thinking like this in the event we couldn't find a proper way to handle fees, and the real world experiments we've done so far have only involved probability costs, no fees at all.
However, I think it is non-trivial to deal with the many cases in which too high fees could occur, and in the end the most systematic way of dealing with them is actually including them in the cost function.
That said, I agree with Matt that more research needs to be done about the effect of base fees on these computations. We do know they make the problem hard in general, but we might find a way to deal with them reasonably in practice.
I tend to agree with AJ, that I don't believe the base fee is economically helpful, but I also think that the market will decide that rather than the devs (though I would argue for default Zerobasefee in the implementations).
In my view, nobody is really earning any money with the base fee, so the discussion is kind of artificial. On the other hand, I would estimate our approach should lead to liquidity being priced correctly in the proportional fee instead of the price being undercut by hobbyists as is the case now. So in the long run I expect our routing method to make running a well-stocked LN router much more profitable.
Cheers, Stefan
ZmnSCPxj via Lightning-dev <lightning-dev at lists.linuxfoundation.org> schrieb am Mo., 16. Aug. 2021, 05:15:
Quoted text (44 lines)
> Good morning matt and aj, > > Let me cut in here. > > From my reading of the actual paper --- which could be a massive > misunderstanding, as I can barely understand half the notation, I am more a > dabbler in software engineering than a mathist --- it seems to me that it > would be possible to replace the cost function in the planning algorithm > with *only* the negative-log-probability, which I think is the key point of > the paper. > > That is, the algorithm can be run in a mode where it *ignores* whatever > fee scheme forwarding nodes desire. > (@rene: correct me if I am wrong?) > > > However, the algorithm then gets an extra step after getting a payment > plan (i.e. how to route multiple sub-payments). > It looks over the payment plan and if the fees involved are beyond some > user-defined limit (with, say, a default of 0.5% of the total amount, as > per the C-Lightning `pay` default), to look at the highest-fee channels in > the payment plan. > Then, it can rerun the flow algorithm, telling it to *disallow* the > highest-fee channels identified if the total fees exceed the fee budget. > > It seems to me that this modification of the algorithm may be sufficient > to be resilient against any and all future fee scheme we may decide for > Lightning. > > This still achieves "optimality" in the sense of the paper, in a way > similar to what is suggested in the paper. > The paper suggests to basically ignore gossiped channels with non-zero > basefee. > The approach I suggest allows us to *start* without ignoring non-zero > basefee, but to slowly degrade our view of the network by disallowing > high-fee (whether high basefee or high propfee) channels. > > Regards, > ZmnSCPxj > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >
Good morning Stefan,
Quoted text (5 lines)
> >I propose that the algorithm be modified >as such, that is, it *ignore* the fee scheme. > > We actually started out thinking like this in the event we couldn't find a proper way to handle fees, and the real world experiments we've done so far have only involved probability costs, no fees at all. > > However, I think it is non-trivial to deal with the many cases in which too high fees could occur, and in the end the most systematic way of dealing with them is actually including them in the cost function.
A reason why I suggest this is that the cost function in actual implementation is *already* IMO overloaded.
In particular, actual implementations will have some kind of conversion between cltv-delta and fees-at-node.
This conversion implies some kind of "conversion rate" between blocks-locked-up and fees-at-node. For example, in C-Lightning this is the `riskfactor` argument to `getroute`, which is also exposed at `pay`.
However, I think that in practice, most users cannot intuitively understand `riskfactor`. I myself cannot; when I write my own `pay` (e.g. in CLBOSS) I just start `riskfactor` to the in-manual default value, then tweak it higher if the total lockup time exceeds some maximum cltv budget for the payment and call `getroute` again.
Similarly, I think it is easier for users to think in terms of "fee budget" instead.
Of course, algorithms should try to keep costs as low as possible, if there are two alternate payment plans that are both below the fee budget, the one with lower actual fee is still preferred. But perhaps we should focus more on payment success *within some fee and timelock budget*.
Indeed, as you point out, your real-world experiments you have done have involved only probability as cost. However, by the paper you claim to have sent 40,000,000,000msat for a cost of 814,000msat, or 0.002035% fee percentage, far below the 0.5% default `maxfeepercent` we have, which I think is fairly reasonable argument for "let us ignore fees and timelocks unless it hits the budget". (on the other hand, those numbers come from a section labelled "Simulation", so that may not reflect the real world experiments you had --- what numbers did you get for those?)
Quoted text (2 lines)
> > That said, I agree with Matt that more research needs to be done about the effect of base fees on these computations. We do know they make the problem hard in general, but we might find a way to deal with them reasonably in practice.
Is my suggestion not reasonable in practice? Is the algorithm runtime too high?
Quoted text (4 lines)
> > I tend to agree with AJ, that I don't believe the base fee is economically helpful, but I also think that the market will decide that rather than the devs (though I would argue for default Zerobasefee in the implementations). > > In my view, nobody is really earning any money with the base fee, so the discussion is kind of artificial. On the other hand, I would estimate our approach should lead to liquidity being priced correctly in the proportional fee instead of the price being undercut by hobbyists as is the case now. So in the long run I expect our routing method to make running a well-stocked LN router much more profitable.
While we certainly need to defer to economic requirements, we *also* need to defer to engineering requirements (else Lightning cannot be implemented in practice, so any economic benefits it might provide are not achievable anyway). As I understand the argument of Matt, we may encounter an engineering reason to charge some base fee (or something very much like it), so encouraging #zerobasefee *now* might not be the wisest course of action, as a future engineering problem may need to be solved with non-zero basefee (or something very much like it).
Regards, ZmnSCPxj
Matt wrote:
Quoted text (1 line)
> I'm frankly still very confused why we're having these conversations now
1000% this!!
This entire conversation strikes me as extremely premature and backwards tbh. Someone experimenting with a new approach shouldn't prompt us to immediately modify the protocol to better "fit" the approach, particularly before any sort of comparative analysis has even been published. At this point, to my knowledge we don't even have an independent implementation of the algorithm that has been tightly integrated into an existing LN implementation. We don't know in which conditions the algorithm excels, and in which conditions this improvement is maybe negligible (likely when payAmt << chanCapacity).
I think part of the difficulty here lies in the current lack of a robust framework to use in comparing the efficacy of different approaches. Even in this domain, there're a number of end traits to optimize for including: path finding length, total CLTV delay across all shards, the amount of resulting splits (goal should be consume less commitment space), attempt iteration latency, amount/path randomization, path finding memory, etc, etc.
This also isn't the first time someone has attempted to adapt typical flow-based algorithms to path finding in the LN setting. T-bast from ACINQ initially attempted to adapt a greedy flow-based algorithm [1], but found that a number of implementation related edge cases (he cites that the min+max constraints in addition to the normal fee limit most implementations as barriers to adapting the algorithm) led him to go with a simpler approach to then iterate off of. I'd be curious to hear from T-bast w.r.t how this new approach differs from his initial approach, and if he spots any yet-to-be-recognized implementation level complexities to properly integrating flow based algorithms into path finding.
Quoted text (5 lines)
> a) to my knowledge, no one has (yet) done any follow-on work to > investigate pulling many of the same heuristics Rene et al use in a > Dijkstras/A* algorithm with multiple passes or generating multiple routes > in the same pass to see whether you can emulate the results in a faster > algorithm without the drawbacks here,
lnd's current approach (very far from perfect, derived via satisficement) has some similarities to the flow-based approach in its use of probabilities to attempt to quantify the level of uncertainty of internal network channel balances.
We start by assuming a config level a priori probability of any given route working, we then take that, and the fee to route across a given link and convert the two values into a scalar "distance/weight" (mapping to an expected cost) we can plug into vanilla Dijkstras [2]. A fresh node uses this value to compare routes instead of the typical hop count distance metric. With a cold cache this doesn't really do much, but then we'll update all the a priori probabilities with observations we gain in the wild.
If a node is able to forward an HTLC to the next hop, we boost their probability (conditional on the amount forward/failed, so there's a bayesian aspect). Each failure results in the probabilities of nodes being affected differently (temp chan failure vs no next node, etc). For example, if we're able to route through the first 3 hops of the route, but the final hop fails with a temp chan failure. We'll rewards all the nodes with a success probability amount (default rn is 95%) that applies when the amount being carried is < that prior attempt.
As we assume balances are always changing, we then apply a half life decay that slows increases a penalized probability back to the baseline. The resulting algorithm starts with no information/memory, but then gains information with each attempt (increasing and decreasing probabilities as a function of the amount attempted and time that has passed since the last attempt). The APIs also let you mark certain nodes as having a higher apriori probability which can reduce the amount of bogus path exploration. This API can be used "at scale" to create a sort of active learning system that learns from the attempts of a fleet of nodes, wallets, trampoline nodes, wallets, etc (some privacy caveats apply, though there're ways to fuzz things a bit differential style).
Other knobs exist such as the min probability setting, which controls how high a success probability a candidate edge needs to have before it is explored. If the algo is exploring too many lackluster paths (and there're a lot of these on mainnet due to normal balance imbalance), this value can be increased which will let it shed a large number of edges to be explored. When comparing this to the discussed approach that doesn't use any prior memory, there may be certain cases that allows this algorithm to "jump" to the correct approach and skip all the pre-processing and optimization that may result in the same route, just with added latency before the initial attempt. I'm skipping some other details like how we handle repeated failures of a node's channels (there's a mechanism that penalizes them more heavily, as the algo assumes most of the node's channels aren't well maintained/balanced, so why waste time trying the other 900 channels).
Our approach differs more dramatically from this new approach further when it comes to the question of how to split a payment either due to a failure, or when it's necessary (amt > max(chanCapacities...)). lnd takes a very a simple approach of just divides the problem in half (divide and conquer, so fork into two instances of amt/2) and try again. The divide and conquer approach typically means you'll end up with a minimal-ish amount of fees. There's also a knob that lets you control the largest split size, which can force the algo to split sooner, as otherwise it only splits when no route exists (either we explored a ton and they all failed, or the payment amt is larger than chan capacity).
The algo works pretty well when the probabilities combined with well tuning of the parameters help the algorithm naturally ignore lower probability routes during the edge relaxation step of Dijkstras. However if a client has no prior observations (and didn't get any from say it's wallet provider or w/e), then it can end up exploring poor routes for a while and eventually hit the default timeout (particularly with a slow disk, but that'll be optimized away in lnd 0.14).
One interesting area of research would be to investigate if a small amount of flow pre-planning can help the algorithm effectively re-summarize its current working memory to ignore more paths we know likely won't work.
In the end, there's still so much of the design space that needs exploring, so settling on something (and advertising that everything is solved by magically setting a particular value to zero) that appears (so far we're going mainly off of experimental anecdotes w/ unclear methods) to improve on things in certain scenarios, and morphing the protocol around it is a premature declaration of "Mission Accomplished!".
In any case, major kudos to Rene and Stefan for examining the problem in a new light, and re-invigorating research of related areas!
-- Laolu
[1]: https://github.com/ACINQ/eclair/pull/1427 [2]: https://github.com/lightningnetwork/lnd/blob/958119a12ab60d24c75c7681f344ceb5a450c4ad/routing/pathfind.go#L930
On Sun, Aug 15, 2021 at 5:07 PM Matt Corallo <lf-lists at mattcorallo.com> wrote:
Quoted text (161 lines)
> Thanks, AJ, for kicking off the thread. > > I'm frankly still very confused why we're having these conversations now. > In one particular class of applicable routing > algorithms you could use for lightning routing having a base fee makes the > algorithm intractably slow, but: > > a) to my knowledge, no one has (yet) done any follow-on work to > investigate pulling many of the same heuristics Rene et > al use in a Dijkstras/A* algorithm with multiple passes or generating > multiple routes in the same pass to see whether > you can emulate the results in a faster algorithm without the drawbacks > here, > > b) to my knowledge, no one has (yet) done any follow-on work to > investigate mapping the base fee to other, more > flow-based-routing-compatible numbers, eg you could convert the base fee > to a minimum fee by increasing the "effective" > proportional fees. From what others have commented, this may largely > "solve" the issue. > > c) to my knowledge, no one has (yet) done any follow-on work to analyze > where the proposed algorithm may be most optimal > in the HTLC-value<->channel liquidity ratio ranges. We may find that the > proposed algorithm only provides materially > better routing when the HTLC value approaches X% of common network channel > liquidity, allowing us to only use it for > large-value payments where we can almost ignore the base fees entirely. > > There's real cost to distorting the fee structures on the network away > from the costs of node operators, especially as > we move towards requiring and using Real (tm) amounts of capital on > routing nodes. If we're relying purely on hobbyists > forever who are operating out of goodwill, we should just remove all fees. > If we think Lightning is going to involve > capital with real opportunity cost, matching fees to the costs is > important, or at least important enough that we > shouldn't throw it away after one (pretty great) paper and limited further > analysis. > > Imagine we find some great way to address HTLC slot flooding/DoS attacks > (or just chose to do it in a not-great way) by > charging for HTLC slot usage, now we can't fix a critical DoS issue > because the routing algorithms we deployed can't > handle the new costing. Instead, we should investigate how we can apply > the ideas here with the more complicated fee > structures we have. > > Color me an optimist, but I'm quite confident with sufficient elbow grease > and heuristics we can get 95% of the way > there. We can and should revisit these conversations if such exploration > is done and we find that its not possible, but > until then this all feels incredibly premature. > > Matt > > On 8/14/21 21:00, Anthony Towns wrote: > > Hey *, > > > > There's been discussions on twitter and elsewhere advocating for > > setting the BOLT#7 fee_base_msat value [0] to zero. I'm just writing > > this to summarise my understanding in a place that's able to easily be > > referenced later. > > > > Setting the base fee to zero has a couple of benefits: > > > > - it means you only have one value to optimise when trying to collect > > the most fees, and one-dimensional optimisation problems are > > obviously easier to write code for than two-dimensional optimisation > > problems > > > > - when finding a route, if all the fees on all the channels are > > proportional only, you'll never have to worry about paying more fees > > just as a result of splitting a payment; that makes routing easier > > (see [1]) > > > > So what's the cost? The cost is that there's no longer a fixed minimum > > fee -- so if you try sending a 1sat payment you'll pay 0.1% of the fee > > to send a 1000sat payment, and there may be fixed costs that you have > > in routing payments that you'd like to be compensated for (eg, the > > computational work to update channel state, the bandwith to forward the > > tx, or the opportunity cost for not being able to accept another htlc if > > you've hit your max htlcs per channel limit). > > > > But there's no need to explicitly separate those costs the way we do > > now; instead of charging 1sat base fee and 0.02% proportional fee, > > you can instead just set the 0.02% proportional fee and have a minimum > > payment size of 5000 sats (htlc_minimum_msat=5e6, ~$2), since 0.02% > > of that is 1sat. Nobody will be asking you to route without offering a > > fee of at least 1sat, but all the optimisation steps are easier. > > > > You could go a step further, and have the node side accept smaller > > payments despite the htlc minimum setting: eg, accept a 3000 sat payment > > provided it pays the same fee that a 5000 sat payment would have. That > is, > > treat the setting as minimum_fee=1sat, rather than > minimum_amount=5000sat; > > so the advertised value is just calculated from the real settings, > > and that nodes that want to send very small values despite having to > > pay high rates can just invert the calculation. > > > > I think something like this approach also makes sense when your channel > > becomes overloaded; eg if you have x HTLC slots available, and y channel > > capacity available, setting a minimum payment size of something like > > y/2/x**2 allows you to accept small payments (good for the network) > > when you're channel is not busy, but reserves the last slots for larger > > payments so that you don't end up missing out on profits because you > > ran out of capacity due to low value spam. > > > > Two other aspects related to this: > > > > At present, I think all the fixed costs are also incurred even when > > a htlc fails, so until we have some way of charging failing txs for > > incurring those costs, it seems a bit backwards to penalise successful > > txs who at least pay a proportional fee for the same thing. Until we've > > got a way of handling that, having zero base fee seems at least fair. > > > > Lower value HTLCs don't need to be included in the commitment transaction > > (if they're below the dust level, they definitely shouldn't be included, > > and if they're less than 1sat they can't be included), and as such don't > > incur all the same fixed costs that HTLCs that are committed too do. > > Having different base fees for microtransactions that incur fewer costs > > would be annoying; so having that be "amortised" into the proportional > > fee might help there too. > > > > I think eltoo can help in two ways by reducing the fixed costs: you no > > longer need to keep HTLC information around permanently, and if you do > > a multilevel channel factory setup, you can probably remove the ~400 > > HTLCs per channel at any one time limit. But there's still other fixed > > costs, so I think that would just lower the fixed costs, not remove them > > altogether and isn't a fundamental change. > > > > I think the fixed costs for forwarding a HTLC are very small; something > > like: > > > > 0.02sats -- cost of permanently storing the HTLC info > > (100 bytes, $500/TB/year, 1% discount rate) > > 0.04sats -- compute and bandwidth cost for updating an HTLC > ($40/month > > at linode, 1 second of compute) > > > > The opportunity cost of having HTLC slots or Bitcoin locked up until > > the HTLC succeeds/fails could be much more significant, though. > > > > Cheers, > > aj > > > > [0] > https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#the-channel_update-message > > [1] https://basefee.ln.rene-pickhardt.de/ > > > > _______________________________________________ > > Lightning-dev mailing list > > Lightning-dev at lists.linuxfoundation.org > > https://www.learnbitcoin.com/archive/lists/lightning-dev > > > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >
Good morning Zmn!
ZmnSCPxj <ZmnSCPxj at protonmail.com> schrieb am Mo., 16. Aug. 2021, 10:27:
Quoted text (7 lines)
> > A reason why I suggest this is that the cost function in actual > implementation is *already* IMO overloaded. > > In particular, actual implementations will have some kind of conversion > between cltv-delta and fees-at-node. >
That's an interesting aspect. Would this lead to a constant per edge if incorporated in the cost function? If so, this would lead to another generally hard problem, which, again, needs to be explored more in the concrete cases we have here to see if we can still solve/approximate it.
Quoted text (3 lines)
However, I think that in practice, most users cannot intuitively understand > `riskfactor`. >
I don't think they have to. Only people like you who write actual software probably need to.
Quoted text (19 lines)
> Similarly, I think it is easier for users to think in terms of "fee > budget" instead. > > Of course, algorithms should try to keep costs as low as possible, if > there are two alternate payment plans that are both below the fee budget, > the one with lower actual fee is still preferred. > But perhaps we should focus more on payment success *within some fee and > timelock budget*. > > Indeed, as you point out, your real-world experiments you have done have > involved only probability as cost. > However, by the paper you claim to have sent 40,000,000,000msat for a cost > of 814,000msat, or 0.002035% fee percentage, far below the 0.5% default > `maxfeepercent` we have, which I think is fairly reasonable argument for > "let us ignore fees and timelocks unless it hits the budget". > (on the other hand, those numbers come from a section labelled > "Simulation", so that may not reflect the real world experiments you had > --- what numbers did you get for those?) >
René is going to publish those results very soon.
Regarding payment success *within some fee and timelock budget*: the situation is a little more complex than it appears. As you have pointed out, at the moment, most of the routes are very cheap (too cheap, IMHO), so you have to be very unlucky to hit an expensive flow. So in the current environment, your approach seems to work pretty well, which is also why we first thought about it.
Unfortunately, as you know, we have to think adversarially in this domain. And it is clear that if we simply disregarded fees in routing, people would try to take advantage of this. If we just set a fee budget, and try again if it is missed, then I see some problems arise: First, what edges do you exclude in the next try? Where is that boundary? Second, I am pretty sure an adversary could design a DOS vector in this way by forcing people to go through exponentially many min-cost flow rounds (which are not cheap anyway) excluding only few edges per round.
Indeed, if you read the paper closely you will have seen that this kind of problem (optimizing for some cost while staying under a budget for a second cost) is (weakly) np-hard even for the single path case. So there is some intuition that this is not as simple as you might imagine it. I personally think that the Lagrangian style of combining the costs in a linear fashion is very promising, but you might be successful with more direct methods as well.
Quoted text (3 lines)
Is my suggestion not reasonable in practice? > Is the algorithm runtime too high? >
See above. I don't know, but I believe it would be hard to make safe against adversaries. Including the fees in the cost function appears to be the more holistic approach to me, since min-cost flow algorithms always give you a globally optimized answer.
Quoted text (5 lines)
While we certainly need to defer to economic requirements, we *also* need > to defer to engineering requirements (else Lightning cannot be implemented > in practice, so any economic benefits it might provide are not achievable > anyway). >
Yes. I wholeheartedly agree. However, I prefer watering down a mathematically correct solution as needed to building increasingly complex ad-hoc heuristics.
Quoted text (6 lines)
As I understand the argument of Matt, we may encounter an engineering > reason to charge some base fee (or something very much like it), so > encouraging #zerobasefee *now* might not be the wisest course of action, as > a future engineering problem may need to be solved with non-zero basefee > (or something very much like it). >
If we encountered such a reason, we could still encourage something else IMHO. I do agree that we should not shorten our options by making a protocol change at this time.
Best regards,
Stefan
P. S. : I have been using Clboss for some time now and I am very impressed. Thank you for your amazing work! I would love a zerobasefee flag, though ;)
Good morning Stefan,
Quoted text (5 lines)
> > A reason why I suggest this is that the cost function in actual implementation is *already* IMO overloaded. > > > > In particular, actual implementations will have some kind of conversion between cltv-delta and fees-at-node. > > That's an interesting aspect. Would this lead to a constant per edge if incorporated in the cost function? If so, this would lead to another generally hard problem, which, again, needs to be explored more in the concrete cases we have here to see if we can still solve/approximate it.
No, because each edge defines its own cltv-delta.
Quoted text (4 lines)
> > > However, I think that in practice, most users cannot intuitively understand `riskfactor`. > > I don't think they have to. Only people like you who write actual software probably need to.
***I*** do not intuitively understand it either. (^^;) I understand it with system 2 (expected return on investment if you were investing the money instead of having it locked due to node failure along a path) but my system 1 just goes "hmmm whut" and I just use the default, which I *hope* cdecker chose rationally.
Quoted text (21 lines)
> > Similarly, I think it is easier for users to think in terms of "fee budget" instead. > > > > Of course, algorithms should try to keep costs as low as possible, if there are two alternate payment plans that are both below the fee budget, the one with lower actual fee is still preferred. > > But perhaps we should focus more on payment success *within some fee and timelock budget*. > > > > Indeed, as you point out, your real-world experiments you have done have involved only probability as cost. > > However, by the paper you claim to have sent 40,000,000,000msat for a cost of 814,000msat, or 0.002035% fee percentage, far below the 0.5% default `maxfeepercent` we have, which I think is fairly reasonable argument for "let us ignore fees and timelocks unless it hits the budget". > > (on the other hand, those numbers come from a section labelled "Simulation", so that may not reflect the real world experiments you had --- what numbers did you get for those?) > > René is going to publish those results very soon. > > Regarding payment success *within some fee and timelock budget*: the situation is a little more complex than it appears. As you have pointed out, at the moment, most of the routes are very cheap (too cheap, IMHO), so you have to be very unlucky to hit an expensive flow. So in the current environment, your approach seems to work pretty well, which is also why we first thought about it. > > Unfortunately, as you know, we have to think adversarially in this domain. And it is clear that if we simply disregarded fees in routing, people would try to take advantage of this. If we just set a fee budget, and try again if it is missed, then I see some problems arise: First, what edges do you exclude in the next try? Where is that boundary? Second, I am pretty sure an adversary could design a DOS vector in this way by forcing people to go through exponentially many min-cost flow rounds (which are not cheap anyway) excluding only few edges per round. > > Indeed, if you read the paper closely you will have seen that this kind of problem (optimizing for some cost while staying under a budget for a second cost) is (weakly) np-hard even for the single path case. So there is some intuition that this is not as simple as you might imagine it. I personally think that the Lagrangian style of combining the costs in a linear fashion is very promising, but you might be successful with more direct methods as well. > > > Is my suggestion not reasonable in practice? > > Is the algorithm runtime too high? > > See above. I don't know, but I believe it would be hard to make safe against adversaries. Including the fees in the cost function appears to be the more holistic approach to me, since min-cost flow algorithms always give you a globally optimized answer.
Hah, yes, adversarial.
I may have a route towards a unified cost function, will clean up a write up and post in a little while on a new thread.
Regards, ZmnSCPxj
On Mon, Aug 16, 2021 at 12:48:36AM -0400, Matt Corallo wrote:
Quoted text (6 lines)
> > The base+proportional fees paid only on success roughly match the *value* > > of forwarding an HTLC, they don't match the costs particularly well > > at all. > Sure, indeed, there's some additional costs which are not covered by failed > HTLCs, [...] > Dropping base fee makes the whole situation a good chunk *worse*.
Can you justify that quantitatively?
Like, pick a realistic scenario, where you can make things profitable with some particular base_fee, prop_fee, min_htlc_amount combination, but can't reasonably pick another similarly profitable outcome with base_fee=0? (You probably need to have a bimodal payment distribution with a micropayment peak and a regular payment peak, I guess, or perhaps have particularly inelastic demand and highly competitive supply?)
Quoted text (4 lines)
> > And all those costs can be captured equally well (or badly) by just > > setting a proportional fee and a minimum payment value. I don't know why > > you keep ignoring that point. > I didn't ignore this, I just disagree, and I'm not entirely sure why you're ignoring the points I made to that effect :).
I don't think I've seen you explicitly disagree with that previously, nor explain why you disagree with it? (If I've missed that, a reference appreciated; explicit re-explanation also appreciated)
Quoted text (2 lines)
> In all seriousness, I'm entirely unsure why you think proportional is just > as good?
In principle, because fee structures already aren't a good match, and a simple approximation is better that a complicated approximation. Specifically, because you can set
min_htlc_msat=old_base_fee_msat * 1e6 / prop_fee_millionths
which still ensures every HTLC you forward offers a minimum fee of old_base_fee_msat, and your fees still increase as the value transferred goes up, which in the current lightning environment seems like it's just as good an approximation as if you'd actually used "old_base_fee_msat".
For example, maybe you pay $40/month for your node, which is about 40msat per second [0], and you really can only do one HTLC per second on average [1]. Then instead of a base_fee of 40msat, pick your proportional rate, say 0.03%, and calculate your min_htlc amount as above, ie 133sat. So if someone sends 5c/133sat through you, they'll pay 40msat, and for every ~3 additional sats, they'll pay you an additional 1msat. Your costs are covered, and provided your fee rate is competitive and there's traffic on the network, you'll make your desired profit.
If your section of the lightning network is being used mainly for microtransactions, and you're not competitive/profitable when limiting yourself to >5c transactions, you could increase your proportional fee and lower your min_htlc amount, eg to 1% and 4sat so that you'll get your 40msat from a 4sat/0.16c HTLC, and increase at a rate of 10msat/sat after that.
That at least matches the choices you're probably actually making as a node operator: "I'm trying to be cheap at 0.03% and focus on relatively large transfers" vs "I'm focussing on microtransactions by reducing the minimum amount I'll support and being a bit expensive". I don't think anyone's setting a base fee by calculating per-tx costs (and if they were, per the footnote, I'm not convinced it'd even justify 1msat let alone 1sat per tx).
OTOH, if you want to model an arbitrary concave fee function (because you have some scheme that optimises fee income by discriminating against smaller payments), you could do that by having multiple channels between the same nodes, which is much more effective with (base, prop) fee pairs than with (prop, min) pairs. (With (prop, min) pairs, you end up with large ranges of the domain that would prefer to pay prop2*min2 rather than prop1*x when x<min2) [2]
It's not clear to me that's desirable in practice -- the benefit of a concave fee function is that it penalises smaller payments / benefits larger payments, which naturally penalises splitting payments up and (to some extent) micropayments in general. OTOH, it's whatever the "turing complete" version of setting fees is, which does at least feel theoretically appealing.
Quoted text (5 lines)
> As you note, the cost for nodes is a function of the opportunity > cost of the capital, and opportunity cost of the HTLC slots. Lets say as a > routing node I decide that the opportunity cost of one of my HTLC slots is > generally 1 sat per second, and the average HTLC is fulfilled in one second. > Why is it that a proportional fee captures this "equally well"?!
If I send an HTLC through you, I can pay your 1 sat fee, then keep the HTLC open for a day, costing you 86,400 sats by your numbers. So I don't think that's even remotely close to capturing the costs of the individual HTLC that's paying the fee.
But if your averages are right, and enough people are nice despite me being a PITA, then you can get the same minimum with a proportional fee; if you're charging 0.1% you set the minimum amount to be 1000 sats.
(But 1sat per HTLC is ridiculously expensive, like at least 20x over what your actual costs would be, even if your hardware is horribly slow and horribly expensive)
Quoted text (1 line)
> Yes, you could amortize it,
You're already amortizing it: that's what "generally 1 sat per second" and "average HTLC is fulfilled in one second" is capturing.
Quoted text (3 lines)
> but that doesn't make it "equally" good, and > there are semi-serious proposals to start ignoring nodes that *dont* set > their fees to some particular structure in routing decisions.
Are there proposals to do that outside of experimental plugins? That seems... aggressive, particularly given it'd exclude three-quarters of the network, and any node running with default parameters.
Quoted text (6 lines)
> Sure, nodes > can do what they want, but its kinda absurd to suggest that this is a > perfectly fine thing to do absent a somewhat compelling reason. This goes > doubly because deploying such things significantly will mean we cannot do > future protocol changes which may better capture the time-value of node > resources!
I think you're getting a bit of a "consensus" mindset there -- if we need to change lightning routing algorithms later, it'll be a pain, sure, but old behaviours aren't locked in permanently in the same way they are for bitcoin consensus rules.
We'll need an similar network-wide routing upgrade to support PTLCs, and also (in my opinion anyway) to support a new fee mechanism that deals with failed payments. Also needing one to re-support specifying a base fee would be pretty easy by comparison, especially since we've "been there, done that".
But I don't think anyone's proposing deploying such things "significantly" in the first place?
Quoted text (9 lines)
> > > > Additionally, I don't think HTLC slot usage needs to be kept as a > > > > limitation after we switch to eltoo; > > > The HTLC slot limit is to keep transactions broadcastable. I don't see why > > > this would change, you still get an output for each HTLC on the latest > > > commitment in eltoo, AFAIU. > > eltoo gives us the ability to have channel factories.... > That doesn't solve the issue at all - you still have a ton of transactions > and transaction outputs and spends thereof to put on the chain in the case > of a closure with pending HTLCs.
It solves the broadcastability issue. If you're worrying about ending up with 5GB worth of pending HTLCs and not being able to atomically post that to the blockchain because their timeouts all expire in less than 5000 blocks, then sure, there's still other limits you might want to care about.
Quoted text (11 lines)
> > (By "any time soon" I mean, I could see software defaults changing if > > over 50% of the network deliberately switched to zero base fees and found > > it worked fine; and I could see deprecating non-zero fees if that ended > > up with 90% of the network on zero base fees, no good reasons for node > > operators wanting to stick with running non-zero base fees, and the > > experimental algos that relied on zero base fees being significantly > > easier to maintain or faster/better) > What is your definition of "works fine" here? In today's > nearly-entirely-altruistic-routing-node network, we could probably entirely > drop the routing fees and things would "work fine". That doesn't make it a > good idea for the long-term health of the network.
"We have a problem, and something must be done. This is something, therefore it must be done" ? Fixed fees that apply only to successful transactions aren't a solution for the long term health of the network. Yes, something to address that must be done, but base fees aren't something that addresses it, so IMO it's just not a relevant point.
Many node operators actively rejecting the recommendation would be an easy example of not "working fine" -- that's certainly what I'd expect to see if the recommendation in question was "just don't charge any fees". (Equally, I wouldn't have any problem with a #zerofees twitter campaign to encourage people to try it out; though I don't think I'd support that one myself. Presumably if there were a reasonable zero fee path between sender and recipient most lightning nodes would already try that first?)
Cheers, aj
[0] $1/month is about 1/40k BTC/month equals 10e3/4 sat/month;
there's about 2.5e6 seconds in a month (~28.9 days), so that's
about 10e3/10e6 sat/second or 1 msat/second. Neat.
[1] A $40/month linode gives you 4 EPYC cores, so really you ought
to be able to do 100s of payments per second, giving you a per
payment cost of 0.4msat or less as far as I can see... If you're
ending up with 40msat after amortizing that's hundreds of failed
payments per success, if you're ending up at 1sat, that's thousands
of failed payments per success. (Not sure how the maths changes if
you're self-hosting or have dedicated hosting or if shared hosting
doesn't actually provide it's nominal performance)
[2] Dammit, the theoretical argument is kind-of convincing me at this
point. (Hence the delay in posting this...)I feel like we're having two very, very different conversations here. On one hand, you're arguing that the base fee is of marginal use, and that maybe we can figure out how to average it out such that we can avoid needing it. On the other hand, I'm arguing that, yes, maybe you can, but ideally you wouldn't have to, because its still pretty nice to capture those costs sometimes. Also, even if we can maybe do away with the base fee, that still doesn't mean we should start relying on the lack of any not-completely-linear-in-HTLC-value fees in our routing algorithms, as maybe we'll want to do upfront payments or some other kind of anti-DoS payment in the future to solve the gaping, glaring, giant DoS hole that is HTLCs taking forever to time out.
I'm not even sure that you're trying to argue, here, that we should start making key assumptions about the only fee being a proportional one in our routing algorithms, but that is what the topic at hand is, so I can't help but assume you are?
If you disagree with the above characterization I'm happy to go line-by-line tit-for-tat, but usually those kinds of tirades aren't exactly useful and end up being more about semantics than the thrust of the argument.
Matt
On 8/20/21 21:46, Anthony Towns wrote:
Quoted text (193 lines)
> On Mon, Aug 16, 2021 at 12:48:36AM -0400, Matt Corallo wrote: >>> The base+proportional fees paid only on success roughly match the *value* >>> of forwarding an HTLC, they don't match the costs particularly well >>> at all. >> Sure, indeed, there's some additional costs which are not covered by failed >> HTLCs, [...] >> Dropping base fee makes the whole situation a good chunk *worse*. > > Can you justify that quantitatively? > > Like, pick a realistic scenario, where you can make things profitable > with some particular base_fee, prop_fee, min_htlc_amount combination, > but can't reasonably pick another similarly profitable outcome with > base_fee=0? (You probably need to have a bimodal payment distribution > with a micropayment peak and a regular payment peak, I guess, or perhaps > have particularly inelastic demand and highly competitive supply?) > >>> And all those costs can be captured equally well (or badly) by just >>> setting a proportional fee and a minimum payment value. I don't know why >>> you keep ignoring that point. >> I didn't ignore this, I just disagree, and I'm not entirely sure why you're ignoring the points I made to that effect :). > > I don't think I've seen you explicitly disagree with that previously, > nor explain why you disagree with it? (If I've missed that, a reference > appreciated; explicit re-explanation also appreciated) > >> In all seriousness, I'm entirely unsure why you think proportional is just >> as good? > > In principle, because fee structures already aren't a good match, and > a simple approximation is better that a complicated approximation. > Specifically, because you can set > > min_htlc_msat=old_base_fee_msat * 1e6 / prop_fee_millionths > > which still ensures every HTLC you forward offers a minimum fee of > old_base_fee_msat, and your fees still increase as the value transferred > goes up, which in the current lightning environment seems like it's just > as good an approximation as if you'd actually used "old_base_fee_msat". > > For example, maybe you pay $40/month for your node, which is about 40msat > per second [0], and you really can only do one HTLC per second on average > [1]. Then instead of a base_fee of 40msat, pick your proportional rate, > say 0.03%, and calculate your min_htlc amount as above, ie 133sat. So if > someone sends 5c/133sat through you, they'll pay 40msat, and for every > ~3 additional sats, they'll pay you an additional 1msat. Your costs are > covered, and provided your fee rate is competitive and there's traffic > on the network, you'll make your desired profit. > > If your section of the lightning network is being used mainly for > microtransactions, and you're not competitive/profitable when limiting > yourself to >5c transactions, you could increase your proportional fee > and lower your min_htlc amount, eg to 1% and 4sat so that you'll get > your 40msat from a 4sat/0.16c HTLC, and increase at a rate of 10msat/sat > after that. > > That at least matches the choices you're probably actually making as a > node operator: "I'm trying to be cheap at 0.03% and focus on relatively > large transfers" vs "I'm focussing on microtransactions by reducing the > minimum amount I'll support and being a bit expensive". I don't think > anyone's setting a base fee by calculating per-tx costs (and if they > were, per the footnote, I'm not convinced it'd even justify 1msat let > alone 1sat per tx). > > OTOH, if you want to model an arbitrary concave fee function (because > you have some scheme that optimises fee income by discriminating against > smaller payments), you could do that by having multiple channels between > the same nodes, which is much more effective with (base, prop) fee pairs > than with (prop, min) pairs. (With (prop, min) pairs, you end up with > large ranges of the domain that would prefer to pay prop2*min2 rather > than prop1*x when x<min2) [2] > > It's not clear to me that's desirable in practice -- the benefit of a > concave fee function is that it penalises smaller payments / benefits > larger payments, which naturally penalises splitting payments up and > (to some extent) micropayments in general. OTOH, it's whatever the > "turing complete" version of setting fees is, which does at least feel > theoretically appealing. > >> As you note, the cost for nodes is a function of the opportunity >> cost of the capital, and opportunity cost of the HTLC slots. Lets say as a >> routing node I decide that the opportunity cost of one of my HTLC slots is >> generally 1 sat per second, and the average HTLC is fulfilled in one second. >> Why is it that a proportional fee captures this "equally well"?! > > If I send an HTLC through you, I can pay your 1 sat fee, then keep the > HTLC open for a day, costing you 86,400 sats by your numbers. So I don't > think that's even remotely close to capturing the costs of the individual > HTLC that's paying the fee. > > But if your averages are right, and enough people are nice despite me > being a PITA, then you can get the same minimum with a proportional fee; > if you're charging 0.1% you set the minimum amount to be 1000 sats. > > (But 1sat per HTLC is ridiculously expensive, like at least 20x over > what your actual costs would be, even if your hardware is horribly slow > and horribly expensive) > >> Yes, you could amortize it, > > You're already amortizing it: that's what "generally 1 sat per second" > and "average HTLC is fulfilled in one second" is capturing. > >> but that doesn't make it "equally" good, and >> there are semi-serious proposals to start ignoring nodes that *dont* set >> their fees to some particular structure in routing decisions. > > Are there proposals to do that outside of experimental plugins? That > seems... aggressive, particularly given it'd exclude three-quarters of > the network, and any node running with default parameters. > >> Sure, nodes >> can do what they want, but its kinda absurd to suggest that this is a >> perfectly fine thing to do absent a somewhat compelling reason. This goes >> doubly because deploying such things significantly will mean we cannot do >> future protocol changes which may better capture the time-value of node >> resources! > > I think you're getting a bit of a "consensus" mindset there -- if we > need to change lightning routing algorithms later, it'll be a pain, > sure, but old behaviours aren't locked in permanently in the same way > they are for bitcoin consensus rules. > > We'll need an similar network-wide routing upgrade to support PTLCs, > and also (in my opinion anyway) to support a new fee mechanism that deals > with failed payments. Also needing one to re-support specifying a base fee > would be pretty easy by comparison, especially since we've "been there, > done that". > > But I don't think anyone's proposing deploying such things "significantly" > in the first place? > >>>>> Additionally, I don't think HTLC slot usage needs to be kept as a >>>>> limitation after we switch to eltoo; >>>> The HTLC slot limit is to keep transactions broadcastable. I don't see why >>>> this would change, you still get an output for each HTLC on the latest >>>> commitment in eltoo, AFAIU. >>> eltoo gives us the ability to have channel factories.... >> That doesn't solve the issue at all - you still have a ton of transactions >> and transaction outputs and spends thereof to put on the chain in the case >> of a closure with pending HTLCs. > > It solves the broadcastability issue. If you're worrying about ending up > with 5GB worth of pending HTLCs and not being able to atomically post > that to the blockchain because their timeouts all expire in less than > 5000 blocks, then sure, there's still other limits you might want to > care about. > >>> (By "any time soon" I mean, I could see software defaults changing if >>> over 50% of the network deliberately switched to zero base fees and found >>> it worked fine; and I could see deprecating non-zero fees if that ended >>> up with 90% of the network on zero base fees, no good reasons for node >>> operators wanting to stick with running non-zero base fees, and the >>> experimental algos that relied on zero base fees being significantly >>> easier to maintain or faster/better) >> What is your definition of "works fine" here? In today's >> nearly-entirely-altruistic-routing-node network, we could probably entirely >> drop the routing fees and things would "work fine". That doesn't make it a >> good idea for the long-term health of the network. > > "We have a problem, and something must be done. This is something, > therefore it must be done" ? Fixed fees that apply only to successful > transactions aren't a solution for the long term health of the > network. Yes, something to address that must be done, but base fees > aren't something that addresses it, so IMO it's just not a relevant point. > > Many node operators actively rejecting the recommendation would be an > easy example of not "working fine" -- that's certainly what I'd expect to > see if the recommendation in question was "just don't charge any fees". > (Equally, I wouldn't have any problem with a #zerofees twitter campaign > to encourage people to try it out; though I don't think I'd support that > one myself. Presumably if there were a reasonable zero fee path between > sender and recipient most lightning nodes would already try that first?) > > Cheers, > aj > > [0] $1/month is about 1/40k BTC/month equals 10e3/4 sat/month; > there's about 2.5e6 seconds in a month (~28.9 days), so that's > about 10e3/10e6 sat/second or 1 msat/second. Neat. > > [1] A $40/month linode gives you 4 EPYC cores, so really you ought > to be able to do 100s of payments per second, giving you a per > payment cost of 0.4msat or less as far as I can see... If you're > ending up with 40msat after amortizing that's hundreds of failed > payments per success, if you're ending up at 1sat, that's thousands > of failed payments per success. (Not sure how the maths changes if > you're self-hosting or have dedicated hosting or if shared hosting > doesn't actually provide it's nominal performance) > > [2] Dammit, the theoretical argument is kind-of convincing me at this > point. (Hence the delay in posting this...) >
On Tue, Aug 24, 2021 at 08:50:42PM -0700, Matt Corallo wrote:
Quoted text (3 lines)
> I feel like we're having two very, very different conversations here. On one > hand, you're arguing that the base fee is of marginal use, and that maybe we > can figure out how to average it out such that we can avoid needing it.
I'm not sure about the "we" in that sentence -- I'm saying node operators shouldn't bother with it, not that lightning software devs shouldn't offer it as a config option or take it into account when choosing routes. The only software change that /might/ make sense is changing defaults from 1sat to 0msat, but it seems a bit early for that too, to me.
(I'm assuming comments like "We'll most definitely support #zerobasefee" [0] just means "you can set it to zero if you like" which seems like a weird thing to have to say explicitly...)
[0] https://twitter.com/Snyke/status/1418109408438063104
Quoted text (4 lines)
> On > the other hand, I'm arguing that, yes, maybe you can, but ideally you > wouldn't have to, because its still pretty nice to capture those costs > sometimes.
I don't really think it captures costs at all, but I do agree it could be nice (at least in theory) to have it available since then you might be able to better optimise your fee income based on whatever demand happens to be. That's to increase profits, not match costs though, and I'm not convinced the theory will play out in practice presuming AMP is often useful/necessary.
Quoted text (3 lines)
> Also, even if we can maybe do away with the base fee, that still > doesn't mean we should start relying on the lack of any > not-completely-linear-in-HTLC-value fees in our routing algorithms,
I mean, exprimental/research routing algorithms should totally rely on that if they feel like it? I just don't see any evidence that anyone's thinking of moving that out of research and into production until there's feedback from operators and a lot more results from the research in general...
Quoted text (4 lines)
> as maybe > we'll want to do upfront payments or some other kind of anti-DoS payment in > the future to solve the gaping, glaring, giant DoS hole that is HTLCs taking > forever to time out.
Until we've got an even vaguely workable scheme for that, I don't think it's relevant to consider. (If my preferred scheme turns out to be workable, I don't think it needs to be taken into account when (multi)pathfinding at all)
Quoted text (4 lines)
> I'm not even sure that you're trying to argue, here, that we should start > making key assumptions about the only fee being a proportional one in our > routing algorithms, but that is what the topic at hand is, so I can't help > but assume you are?
No, that's not the topic at hand, at all?
I mean, it's related, and interesting to talk about, but it's a digression into "wild ideas that might happen in the future", not the topic... I don't think anyone's currently advocating for node software to work that way? (I do think having many/most channels have a zero base fee will make multipath routing algos work better even when they *don't* assume the base fee is zero)
I think I'm arguing for these things:
a) "everyone" should drop their base fee msat from the default,
probably to 0 because that's an easy fixed point that you don't need
to think about again as the price of btc changes, but anything at
or below 10msat would be much more reasonable than 1000msat.
b) if people are concerned about wasting resources forwarding super
small payments for correspondingly super small fees, they should
raise min_htlc_amount from 0 (or 1000) to compensate, instead of
raising their base fee.
c) software should dynamically increase min_htlc_amount as the
number of available htlc slots decreases, as a DoS mitigation measure.
(presuming this is a temporary increase, probably this wouldn't
be gossiped, and possibly not even communicated to the channel
counterparty -- just a way of immediately rejecting htlcs? I think
if something along these lines were implemented, (b) would almost
never be necessary)
d) the default base fee should be changed to 0, 1, or 10msat instead
of 1000msat
e) trivially: (I don't think anyone's saying otherwise)
- 0 base fee should be a supported config option
- research/experimental routing algorithms are great and should
be encouraged
- deploying new algorithms in production should only be done with
a lot of care
- changing the protocol should only be done with even more care
- proportional fees should be rounded up to the next msat and never
rounded down to 0
- research/experiments on charging for holding htlcs open should
continue (likewise research on other DoS prevention measures)
I'm not super sure about (c) or (d), and the "everyone" in (a) could easily not really be everyone.
Quoted text (3 lines)
> If you disagree with the above characterization I'm happy to go line-by-line > tit-for-tat, but usually those kinds of tirades aren't exactly useful and > end up being more about semantics than the thrust of the argument.
Thanks for the lack of a tirade :)
Cheers, aj
On 8/25/21 05:50, Anthony Towns wrote:
Quoted text (6 lines)
> On Tue, Aug 24, 2021 at 08:50:42PM -0700, Matt Corallo wrote: >> I feel like we're having two very, very different conversations here. On one >> hand, you're arguing that the base fee is of marginal use, and that maybe we >> can figure out how to average it out such that we can avoid needing it. > > I'm not sure about the "we" in that sentence
You and I, and it seems I was very much right :)
Quoted text (5 lines)
> I'm saying node operators > shouldn't bother with it, not that lightning software devs shouldn't offer > it as a config option or take it into account when choosing routes. The > only software change that /might/ make sense is changing defaults from > 1sat to 0msat, but it seems a bit early for that too, to me.
I think I largely agree, its too early to decide these things and node operators can consider these issues for themselves.
Quoted text (5 lines)
> (I'm assuming comments like "We'll most definitely support #zerobasefee" > [0] just means "you can set it to zero if you like" which seems like a > weird thing to have to say explicitly...) > > [0] https://twitter.com/Snyke/status/1418109408438063104
I don't believe so at all, we were definitely having a different conversation from both sides here. The #zerobasefee movement grew out of, and focuses on, switching to #zerobasefee in order to allow people to start using routing algorithms in production which ignore all nodes which do *not* have zero base fee and requiring that to be a routing node. Rusty even made a comment to that effect recently on a Twitter Spaces, saying that its probably something that could be considered sooner or later, though I admit it was an off-the-cuff remark so maybe he has a slightly different view when pressed.
My objection, and it seems like you agree, is that it is much, much too early to start making a strong assumption of the only fee being a proportional one in deployed routing algorithms.
Quoted text (9 lines)
>> Also, even if we can maybe do away with the base fee, that still >> doesn't mean we should start relying on the lack of any >> not-completely-linear-in-HTLC-value fees in our routing algorithms, > > I mean, exprimental/research routing algorithms should totally rely > on that if they feel like it? I just don't see any evidence that > anyone's thinking of moving that out of research and into production > until there's feedback from operators and a lot more results from the > research in general...
Maybe, maybe not - my only points on Twitter, and here, have been focused on how more research needs to happen on proposed routing algorithms and how we can adapt the ideas to other algorithms. A large part of the impetus for the #zerobasefee movement has been to reduce base fees to allow for a migration to these experimental algorithms, and, to me, is entirely premature.
Quoted text (1 line)
> No, that's not the topic at hand, at all?
Well, then we were having two different conversations :p
Quoted text (11 lines)
> I think I'm arguing for these things: > > a) "everyone" should drop their base fee msat from the default, > probably to 0 because that's an easy fixed point that you don't need > to think about again as the price of btc changes, but anything at > or below 10msat would be much more reasonable than 1000msat. > > b) if people are concerned about wasting resources forwarding super > small payments for correspondingly super small fees, they should > raise min_htlc_amount from 0 (or 1000) to compensate, instead of > raising their base fee.
:shrug: dunno. some people pay on-chain fees to route tiny payments to Muun wallets and seem fine with it.
Quoted text (7 lines)
> c) software should dynamically increase min_htlc_amount as the > number of available htlc slots decreases, as a DoS mitigation measure. > (presuming this is a temporary increase, probably this wouldn't > be gossiped, and possibly not even communicated to the channel > counterparty -- just a way of immediately rejecting htlcs? I think > if something along these lines were implemented, (b) would almost > never be necessary)
This sounds like a cool idea. We shipped something highly related that almost accomplishes this on accident in LDK [1] focusing on exposure to small-value HTLCs and limiting that to ensure we don't send all our money to miners.
More dynamic limits in lightning sounds like the right direction to me! Also dynamic fees, also dynamic....
Quoted text (6 lines)
> d) the default base fee should be changed to 0, 1, or 10msat instead > of 1000msat > > e) trivially: (I don't think anyone's saying otherwise) > - deploying new algorithms in production should only be done with > a lot of care
There is *so* much debate around this point in the lightning world these days. This is just another flavor of it.
Matt
[1] https://github.com/rust-bitcoin/rust-lightning/pull/1009