How are fees negotiated in multi-hop payments in Lightning?

Imagine a four-hop payment: Alice -- Bob -- Charlie -- Dave. Bob and Charlie advertise fees of 100 sat each, Alice thinks it's reasonable and starts routing the payment through this route. Does Bob know which part of the expected payment is intended to be a fee? What is Bob forwards the payment to Charlie taking 120, 150, or 200 sat instead of 100 -- what does Charlie do?

Is there anything that prevents intermediary nodes from lying about their fees?

2 Answers 2


Nodes advertise the fees for forwarding over a channel as part of a channel_update message. The update should be sent as soon as a channel_announcement is sent. Each party can decide its own fees for the channel.

For private channels, nodes advertise the fees inside the r tagged field of the BOLT#11 invoice.

When forwarding a payment, your node must calculate the required fee for each hop and add it to the payment requested in the invoice. When each intermediate hop receives an update_add_htlc message, they will unwrap one level of the onion packet, which contains an amt_to_forward. This is subtracted from the amount_msat in the update_add_htlc message, and the difference is the fee paid for this hop.

If the hop determines that the fee is insufficient, they respond to the sender with fee_insufficient error as part of an update_fail_htlc message. This message also includes the most recent channel_update for this channel so that the payer can re-attempt the payment with new fees.

There is always the possibility of a race condition where fees may have changed between the most recently received channel_update and the payment attempt. This is minimized by including the channel_update as part of the failure as above.

If the payment at the last hop is too small, they will respond with a failure containing the incorrect_or_unknown_payment_details failure code.

  • 1
    We need to coordinate in future (: I was typing on my mobile where putting all these links and syntax highlighting is annoying. Anyway plus 1 for nice onside explainations instead of referring to a tutorial video like I did. Commented May 8, 2019 at 14:42

The situation you describe cannot happen / would lead to a routing failure. I have created an 11 minute video explaining how htlcs are used in onion routing. Parts of the video (rather at the end) explain how fees are encoded within the sent onion. I think watching that video is the quickest way to understand the fee model of the lightning network.

A tl;dw (too long didn't watch) answer looks like that:

If a node decides to maliciously collect a larger fee and forward the onion. The next hop will not be able to collect the fee as it advertised and will fail the routing process. In your setting this means charlie decrypts his onion and sees which amount to forward and sees from the incoming htlc that it would only receive a fee of 80 / 50 or 0 Satoshi instead of the advertised 100. As said charlie would fail the onion but not be able to blame Bob. Actually obs behavior would confuse Alice as she chose the correct fees. Alice could assume Bob was a bad routing node and elect a different part. However this mechanism is as far as I know not implemented yet.

  • By "this mechanism" in the last sentence do you mean Alice marking Bob as a bad node? (BTW, the tiny envelopes you use in the video are amazing, where did you even get those things :) Commented May 8, 2019 at 14:50
  • 1
    What if we extended this argument by one more party? Alice sending BTC to Eric via bob, charlie and dave. Assume charlie is the bad apple in the lot and consumes all the remaining fee in the hop. How would Alice know whether it is Bob or Charlie?
    – Ugam Kamat
    Commented May 8, 2019 at 14:50
  • 1
    Since the fees are part of the onion noone in the chain knows what the payment amount is and how much fees are in the onion in total... On the other hand I hope to remember correctly that the node that can't forward the onion because the prev took too much fees and back an failure message of type 12 fee _insufficient cf: github.com/lightningnetwork/lightning-rfc/blob/master/… Commented May 8, 2019 at 14:59
  • 1
    What I see here is a violation of the "don't explain to the attacker why the error happened" security principle, screaming for probing attacks similar to this one... ;) Commented May 8, 2019 at 15:11
  • 1
    Yeah the probing attack is well known. I don't see a direct relation. The proving attack usually would use a circular onion and you yourself would fail the htlc / onion Commented May 8, 2019 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.