I'm trying to compute the routing fees for a lightning network payment of 100,000 msats. The route uses the following sequence of channels (CHAN1 is not shown for privacy reasons):
CHAN1 (base fee: 1000, ppm: 9)
647868x2102x1 (base fee: 0, ppm: 5000)
751905x3128x0 (base fee: 0, ppm: 5000)
751905x3125x0 (base fee: 1000, ppm: 1)
The route that lightning-cli returns is the following:
"route": [
{
"id": "0298f6074a454a1f5345cb2a7c6f9fce206cd0bf675d177cdbf0ca7508dd28852f",
"channel": "CHAN1",
"direction": 1,
"msatoshi": 101505,
"amount_msat": "101505msat",
"delay": 123,
"style": "tlv"
},
{
"id": "023d70f2f76d283c6c4e58109ee3a2816eb9d8feb40b23d62469060a2b2867b77f",
"channel": "647868x2102x1",
"direction": 1,
"msatoshi": 101505,
"amount_msat": "101505msat",
"delay": 89,
"style": "tlv"
},
{
"id": "0265c45476ef53365755f7076eef987965f308b04dba1d8f74638e75b3164eafdd",
"channel": "751905x3128x0",
"direction": 0,
"msatoshi": 101000,
"amount_msat": "101000msat",
"delay": 49,
"style": "tlv"
},
{
"id": "026165850492521f4ac8abd9bd8088123446d126f648ca35e60f88177dc149ceb2",
"channel": "751905x3125x0",
"direction": 1,
"msatoshi": 100000,
"amount_msat": "100000msat",
"delay": 9,
"style": "tlv"
}
]
The second to last channel is routing 101,000 msat, which means that the second to last node (0265c4...) receives 1,000 msats as a routing fee. I don't understand how this number is calculated.
I thought the correct fee is:
math.ceil(base + 100,000 * ppm) = math.ceil(1,000 + 100,000 * (1/1,000,000)) = math.ceil(1,000.1) = 1,001 msats.
What is the correct formula?
from Recent Questions - Bitcoin Stack Exchange
October 12, 2022 at 07:59PM