Author: Thomas Steenholdt 2018-04-10 15:02:39
Published on: 2018-04-10T15:02:39+00:00
The email conversation is about the mechanics of Lightning fees, especially in the case of routed payments. The sender wants to understand how to make an informed payment routing decision as a sender, based on the fees and the funding/balance of each channel, to select the cheapest route with the highest chance of success. The BOLT spec contains everything, but is very detailed and contains the topic in multiple places. In a multi-hop routed payment where A needs to pay D through B and C, established channels are A -> B -> C -> D, and A knows ahead of time the fees on B and C from node gossip, the `channel_update` message in BOLT#7. The `channel_update` message contains `fee_base_msat` and `fee_proportional_millionths`. If D is to be given a payment with value `msatoshi` then it computes first the C->D fee, which is the C->D `fee_base_msat` + (C->D `fee_proportion_millionts` * `msatoshi` / 1,000,000). Add that to `msatoshi` and that is the payment that needs to reach C, so A computes the payment from B->C similarly, except the `msatoshi` is replaced with the payment that should reach C. A offers B a value that is higher than what A instructs B to forward to C, and the difference is the fee. Since the highest value is at the source A, A is the one who ends up paying the entire fee.
Updated on: 2023-05-24T22:01:58.219904+00:00