Does a LN route with N channels at most require N-2 fee payments?












2















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?










share|improve this question



























    2















    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?










    share|improve this question

























      2












      2








      2








      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?










      share|improve this question














      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?







      lightning-network lightning-routing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 6 at 10:53









      torkeltorkel

      405




      405






















          3 Answers
          3






          active

          oldest

          votes


















          1














          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 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.






          share|improve this answer

































            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.






            share|improve this answer































              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.






              share|improve this answer


























              • 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
                Feb 6 at 11:26











              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "308"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              noCode: true, onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f84281%2fdoes-a-ln-route-with-n-channels-at-most-require-n-2-fee-payments%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              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 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.






              share|improve this answer






























                1














                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 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.






                share|improve this answer




























                  1












                  1








                  1







                  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 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.






                  share|improve this 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 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.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Feb 7 at 9:30

























                  answered Feb 6 at 15:32









                  Andrea RaspitzuAndrea Raspitzu

                  264




                  264























                      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.






                      share|improve this answer




























                        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.






                        share|improve this answer


























                          1












                          1








                          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.






                          share|improve this answer













                          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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 6 at 11:05









                          Rene PickhardtRene Pickhardt

                          1,805114




                          1,805114























                              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.






                              share|improve this answer


























                              • 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
                                Feb 6 at 11:26
















                              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.






                              share|improve this answer


























                              • 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
                                Feb 6 at 11:26














                              1












                              1








                              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.






                              share|improve this answer















                              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.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Feb 7 at 19:33

























                              answered Feb 6 at 11:13









                              James C.James C.

                              1,8551214




                              1,8551214













                              • 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
                                Feb 6 at 11:26



















                              • 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
                                Feb 6 at 11:26

















                              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
                              Feb 6 at 11:26





                              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
                              Feb 6 at 11:26


















                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Bitcoin Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f84281%2fdoes-a-ln-route-with-n-channels-at-most-require-n-2-fee-payments%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Index of /

                              Tribalistas

                              Listed building