Does a LN route with N channels at most require N-2 fee payments?
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
add a comment |
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
add a comment |
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
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
lightning-network lightning-routing
asked 15 hours ago
torkeltorkel
405
405
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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 a 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.
New contributor
add a comment |
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.
add a comment |
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
: Payment amount A
n2 -> n3
: Payment amount A - fee_2 (n2
earns a fee_2)
n3 -> n4
: Payment amount A - 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.
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
14 hours ago
Ah yes, of course, the fee must be charged by each receiving peer so each segment is negotiated "identically", because otherwise it would be obvious which channel is paying the final recipient, right?
– James C.
14 hours ago
The final peer's final invoice amount should equal the htlc amount in the last hop, even if the final peer charges a fee. The routed_amount+fee = invoice or htlc amounts, correct?
– James C.
14 hours ago
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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 a 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.
New contributor
add a comment |
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 a 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.
New contributor
add a comment |
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 a 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.
New contributor
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 a 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.
New contributor
New contributor
answered 10 hours ago
Andrea RaspitzuAndrea Raspitzu
261
261
New contributor
New contributor
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered 14 hours ago
Rene PickhardtRene Pickhardt
1,06913
1,06913
add a comment |
add a comment |
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
: Payment amount A
n2 -> n3
: Payment amount A - fee_2 (n2
earns a fee_2)
n3 -> n4
: Payment amount A - 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.
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
14 hours ago
Ah yes, of course, the fee must be charged by each receiving peer so each segment is negotiated "identically", because otherwise it would be obvious which channel is paying the final recipient, right?
– James C.
14 hours ago
The final peer's final invoice amount should equal the htlc amount in the last hop, even if the final peer charges a fee. The routed_amount+fee = invoice or htlc amounts, correct?
– James C.
14 hours ago
add a comment |
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
: Payment amount A
n2 -> n3
: Payment amount A - fee_2 (n2
earns a fee_2)
n3 -> n4
: Payment amount A - 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.
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
14 hours ago
Ah yes, of course, the fee must be charged by each receiving peer so each segment is negotiated "identically", because otherwise it would be obvious which channel is paying the final recipient, right?
– James C.
14 hours ago
The final peer's final invoice amount should equal the htlc amount in the last hop, even if the final peer charges a fee. The routed_amount+fee = invoice or htlc amounts, correct?
– James C.
14 hours ago
add a comment |
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
: Payment amount A
n2 -> n3
: Payment amount A - fee_2 (n2
earns a fee_2)
n3 -> n4
: Payment amount A - 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.
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
: Payment amount A
n2 -> n3
: Payment amount A - fee_2 (n2
earns a fee_2)
n3 -> n4
: Payment amount A - 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.
answered 14 hours ago
James C.James C.
1,752214
1,752214
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
14 hours ago
Ah yes, of course, the fee must be charged by each receiving peer so each segment is negotiated "identically", because otherwise it would be obvious which channel is paying the final recipient, right?
– James C.
14 hours ago
The final peer's final invoice amount should equal the htlc amount in the last hop, even if the final peer charges a fee. The routed_amount+fee = invoice or htlc amounts, correct?
– James C.
14 hours ago
add a comment |
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
14 hours ago
Ah yes, of course, the fee must be charged by each receiving peer so each segment is negotiated "identically", because otherwise it would be obvious which channel is paying the final recipient, right?
– James C.
14 hours ago
The final peer's final invoice amount should equal the htlc amount in the last hop, even if the final peer charges a fee. The routed_amount+fee = invoice or htlc amounts, correct?
– James C.
14 hours ago
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
14 hours ago
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
14 hours ago
Ah yes, of course, the fee must be charged by each receiving peer so each segment is negotiated "identically", because otherwise it would be obvious which channel is paying the final recipient, right?
– James C.
14 hours ago
Ah yes, of course, the fee must be charged by each receiving peer so each segment is negotiated "identically", because otherwise it would be obvious which channel is paying the final recipient, right?
– James C.
14 hours ago
The final peer's final invoice amount should equal the htlc amount in the last hop, even if the final peer charges a fee. The routed_amount+fee = invoice or htlc amounts, correct?
– James C.
14 hours ago
The final peer's final invoice amount should equal the htlc amount in the last hop, even if the final peer charges a fee. The routed_amount+fee = invoice or htlc amounts, correct?
– James C.
14 hours ago
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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