Dynamic fees for lightning gateways #2392
Replies: 8 comments 9 replies
-
This is interesting! I'm happy to look into this. Do you think it's in scope to include the interaction of gateways advertising fees and clients optimizing selection or should we leave that as a future improvement? |
Beta Was this translation helpful? Give feedback.
-
I would do this in 3 PRs:
|
Beta Was this translation helpful? Give feedback.
-
Also, any client API which actually pays lightning invoice (e.g. ln-pay cli command) might need to add a confirmation step where it presents the fees associated with paying this invoice and asks if that's OK. Maybe we don't need to do that for our CLI now, but GUI clients would definitely want to present this information before blindly paying the invoice + fees. |
Beta Was this translation helpful? Give feedback.
-
On the implementation,
I think the LightningGateway should declare routing fees as See #2246
|
Beta Was this translation helpful? Give feedback.
-
Originally posted as Issue #524 |
Beta Was this translation helpful? Give feedback.
-
After today's discussion in deep dive, we started sketching full requirements and spec for dynamic gateway routing fees The two halves of fees are Here, it seems possible to represent gateway fees as:
Similar to RoutingFees For incoming payments, we may want to support a fee spec where either the sender / receiver can pay the gateway fir routing payments into the federation. It's unclear what that representation entails, and if we can use the same spec as outgoing payments |
Beta Was this translation helpful? Give feedback.
-
is it possible right now for the federation to change the price of a preimage? Assuming the gateway is ready to purchase the preimage with ecash to settle an HTLC they intercepted, seems like the gateway could actually get the chance to ask Alice for a lower price in the scenario where the gateway would be losing money and should just fail the HTLC. Alice may want to just cover the difference in ecash to avoid a payment failure and the hassle of choosing a different gateway? |
Beta Was this translation helpful? Give feedback.
-
Only the outgoing case is interesting imo, the incoming one should be transparent to the sender and recipient (looks and behaves like normal LN fees). When it come to outgoing payments we are faced with an optimization problem for which is probably unsolvable:
The problem here is that we cannot tell ahead of time which gateway will require how much fees to route a payment. To approximate a solution we need a "quote" API endpoint where the gateway estimates, through probing, how much fees will have to be paid to route the payment. For example Bitcoin Beach Wallet implements a similar functionality. The interesting point about the quote API is that we don't need to announce gateway fees at all because only the total fee paid is relevant. For us, with multiple independent gateways, this becomes a lot trickier. Each time a gateway fails we need to cancel one contract and fund another one with potentially a different gateway (the next cheapest one), costing at least one epoch in time. Imo setting an upper bound for fees paid and letting the state machines in the background figure out the details would likely be the best UX. The same behavior could be achieved without a quote API, but there are some bad incentives to set GW fees to zero while pretending LN fees are costlier to maximize earnings since clients would need to guess a certain upper limit in fees they are willing to pay before trying another GW. |
Beta Was this translation helpful? Give feedback.
-
Outgoing payments:
Incoming payments:
In principle I think the gateways should advertise the fees they will charge and clients would use this information to choose which gateway to use.
Beta Was this translation helpful? Give feedback.
All reactions