<p>As far as I know it is not specified on a protocol level. Since routing a payment triggers setting up an htlc I believe that n4 will also charge a fee as people did not differentiate in the code if it is the last hop or not.</p>

<p>I observed this when playing lightning tennis sending back and forth one Satoshi in one channel and got this answer from a c lightning developer. I didn't check the code but it makes sense. </p>

CC BY-SA 4.0
2019-02-06T11:05:24.893Z
2019-02-06T11:05:24.893Z
Rene Pickhardt
<p>The fee is implied by the difference in routed amounts across the channels in the payment route. The htlc amounts reflecting the payment amount will decrease from channel to channel.</p>

<ul>
<li><code>n1 -&gt; n2</code>: Incoming amount </li>
<li><code>n2 -&gt; n3</code>: Incoming amount - fee_2 (n2
earns a fee_2) </li>
<li><code>n3 -&gt; n4</code>: Incoming amount - fee_2 - fee_3 (n3 earns
a fee of fee_3)</li>
</ul>

<p>Each fee is earned by a single node which relays the payment from one of its payment channels to another. On balance, the peer receives an <code>amount A</code>, and forwards an <code>amount A - fee</code> to the channel it is connected to along the route.</p>

<p>Each peer can decide which fee it wishes to set when providing routing services. When the route is negotiated, the announced fees of each peer are taken into consideration to construct the optimal route. </p>

<p>Once peers agree to participate in forwarding a route, the payment amounts along the route are committed to the <code>htlc</code> outputs in each channel. Theses <code>htlc</code> amounts will decrease along the route, reflecting the forwarding fees charged by each peer.</p>

CC BY-SA 4.0
2019-02-06T11:26:24.713Z
Are you sure that the hop from n1 to n2 is without fee? Ist the inbound channel always charging and in that sense we would have 3 fees to be paid?
Rene Pickhardt
CC BY-SA 4.0
2019-02-06T11:13:54.323Z
2019-02-07T19:33:10.683Z
2019-02-07T19:33:10.683Z
James C.
<p>The last channel in the route does have an impact on the fees of the payment. It's a bit counter-intuitive but when a payment is being forwarded by intermediate nodes it pays <em>to the node</em> the fees necessary to traverse an <em>outgoing</em> channel of that node. In a situation <code>A -&gt; B -&gt; C</code> A sends to B <code>amount + fee(BC)</code> because A knows that B will subtract the fees according to the cost of traversing the channel to C namely 'fee(BC)'; note that if there are multiple channels between B and C, A can't choose which one to traverse. In the case of the last hop you want to it to have the amount that was requested in the invoice (or whatever amount you want it to receive), in the { A, B, C } example A is effectively paying for the last hop even though the amount that comes out of B is without fees because B takes them in advance (before forwarding it to C). </p>

<p>As reference you can look <a href="https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md#packet-structure" rel="nofollow noreferrer">here</a> and specifically in the field descriptions: every forwarding node has to respect the equality <code>incoming_htlc_amt - fee &gt;= amt_to_forward</code> where <em>incoming_htlc_amt</em> is the amount being received <strong>upstream</strong> and
<em>amt_to_forward</em> is what will be sent <strong>downstream</strong>.So to answer your question, an LN route with N channels requires exactly N-1 fee payments.</p>

CC BY-SA 4.0
2019-02-06T15:32:34.530Z
2019-02-07T09:30:33.447Z
2019-02-07T09:30:33.447Z
Andrea Raspitzu
<p>Assume we have a route <code>n1 -&gt; n2 -&gt; n3 -&gt; n4</code>. My intuition here is that <code>n2</code> charges <code>n1</code> a fee and that <code>n3</code> charges <code>n2</code> a fee for routing payments. However, there's <em>no</em> fee for the last hop where <code>n3</code> forwards the payment to <code>n4</code>. Is this correct? And if so, is this just an implementation detail, or is this somehow enforced on the protocol level?</p>

<lightning-network><lightning-routing>
Does a LN route with N channels at most require N-2 fee payments?
torkel
# Does a LN route with N channels at most require N-2 fee payments?

(Asked by: username_0 on 2019-02-06)

Assume we have a route `n1 -> n2 -> n3 -> n4`. My intuition here is that `n2` charges `n1` a fee and that `n3` charges `n2` a fee for routing payments. However, there's *no* fee for the last hop where `n3` forwards the payment to `n4`. Is this correct? And if so, is this just an implementation detail, or is this somehow enforced on the protocol level?

**Tags:** lightning-network, lightning-routing


---

## 3 answers

### Answer by username_3 on 2019-02-06. Score: 3 | Accepted answer

The last channel in the route does have an impact on the fees of the payment. It's a bit counter-intuitive but when a payment is being forwarded by intermediate nodes it pays *to the node* the fees necessary to traverse an *outgoing* channel of that node. In a situation `A -> B -> C` A sends to B `amount + fee(BC)` because A knows that B will subtract the fees according to the cost of traversing the channel to C namely 'fee(BC)'; note that if there are multiple channels between B and C, A can't choose which one to traverse. In the case of the last hop you want to it to have the amount that was requested in the invoice (or whatever amount you want it to receive), in the { A, B, C } example A is effectively paying for the last hop even though the amount that comes out of B is without fees because B takes them in advance (before forwarding it to C).

As reference you can look [here](https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md#packet-structure) and specifically in the field descriptions: every forwarding node has to respect the equality `incoming_htlc_amt - fee >= amt_to_forward` where *incoming\_htlc\_amt* is the amount being received **upstream** and
*amt\_to\_forward* is what will be sent **downstream**.So to answer your question, an LN route with N channels requires exactly N-1 fee payments.


---

### Answer by username_1 on 2019-02-06. Score: 1

As far as I know it is not specified on a protocol level. Since routing a payment triggers setting up an htlc I believe that n4 will also charge a fee as people did not differentiate in the code if it is the last hop or not.

I observed this when playing lightning tennis sending back and forth one Satoshi in one channel and got this answer from a c lightning developer. I didn't check the code but it makes sense.


---

### Answer by username_2 on 2019-02-06. Score: 1

The fee is implied by the difference in routed amounts across the channels in the payment route. The htlc amounts reflecting the payment amount will decrease from channel to channel.

* `n1 -> n2`: Incoming amount
* `n2 -> n3`: Incoming amount - fee\_2 (n2
  earns a fee\_2)
* `n3 -> n4`: Incoming amount - fee\_2 - fee\_3 (n3 earns
  a fee of fee\_3)

Each fee is earned by a single node which relays the payment from one of its payment channels to another. On balance, the peer receives an `amount A`, and forwards an `amount A - fee` to the channel it is connected to along the route.

Each peer can decide which fee it wishes to set when providing routing services. When the route is negotiated, the announced fees of each peer are taken into consideration to construct the optimal route.

Once peers agree to participate in forwarding a route, the payment amounts along the route are committed to the `htlc` outputs in each channel. Theses `htlc` amounts will decrease along the route, reflecting the forwarding fees charged by each peer.

> **Comments:**
> **username_1**: Are you sure that the hop from n1 to n2 is without fee? Ist the inbound channel always charging and in that sense we would have 3 fees to be paid?  

---

