<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi ZmnSCPxj,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I came up with a followup question...</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Does node GOSSIP also reveal the funding/balance of channels, same way it does the fees?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<p style="margin-top:0;margin-bottom:0">I'm trying to understand how to make an informed payment routing decision as a sender, based on the fees (that you have already explained), but also the funding/balance of each channel, to select the cheapest route with
the highest chance of success.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
I have looked through the RFC and can't seem to find an explanation on whether or not the channel funding/balance information is available from GOSSIP or how else you'd handle this kind of thing?</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
I was hoping you might have a short explanation for this stuff as well? :-)</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">
/Thomas<br>
</p>
<div><br>
</div>
<p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> ZmnSCPxj <ZmnSCPxj@protonmail.com><br>
<b>Sent:</b> Sunday, March 18, 2018 8:48:57 PM<br>
<b>To:</b> Thomas Steenholdt<br>
<b>Cc:</b> lightning-dev@lists.linuxfoundation.org<br>
<b>Subject:</b> Re: [Lightning-dev] High level fee mechanics</font>
<div> </div>
</div>
<div>
<div>Good morning Thomas,<br>
</div>
<div><br>
</div>
<div class="x_protonmail_signature_block">
<div class="x_protonmail_signature_block-user x_protonmail_signature_block-empty">
<br>
</div>
<div class="x_protonmail_signature_block-proton">Sent with <a href="https://protonmail.com">
ProtonMail</a> Secure Email.<br>
</div>
</div>
<div><br>
</div>
<div>$B!>!>!>!>!>!>!>(B Original Message $B!>!>!>!>!>!>!>(B<br>
</div>
<div>On March 19, 2018 6:24 AM, Thomas Steenholdt <TSteenholdt@cascadetechnologypartners.com> wrote:<br>
</div>
<div><br>
</div>
<blockquote type="cite" class="x_protonmail_quote">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Hi,<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I've been trying to figure out the mechanics of Lightning fees, especially in the case of routed payments. Unfortunately, I haven't had any success in finding a high level description on the topic.<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<div><span class="x_font" style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols"><span class="x_size" style="font-size:16px">I'm hoping somebody is able to
point me in the right direction?</span></span> <br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>BOLT spec <a href="https://github.com/lightningnetwork/lightning-rfc">https://github.com/lightningnetwork/lightning-rfc</a> contains everything, but is very detailed and contains the topic in multiple places.<br>
</div>
<div><br>
</div>
<blockquote type="cite" class="x_protonmail_quote">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style=""><span class="x_font" style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols"><span class="x_size" style="font-size:16px">Example:</span></span><br>
</p>
<p style=""><span class="x_font" style="font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols"><span class="x_size" style="font-size:16px">A multi-hop routed payment
where A needs to pay D through B and C. Established channels are A -> B -> C -> D.</span></span><br>
</p>
<div><br>
</div>
<p><br>
</p>
<p style="margin-top:0; margin-bottom:0">What I'm looking for is a high level explanation of how fees are established, announced and ultimately claimed in a payment like this. Some of the questions that come to mind are:<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><span class="x_size" style="font-size:12pt">- Does A know ahead of time the fees on B and C, or only when trying to set up the payment? And how?</span><br>
</p>
</div>
</blockquote>
<div><br>
</div>
<div>Yes. Node gossip, the `channel_update` message in BOLT#7. This message, contains `fee_base_msat` and `fee_proportional_millionths`. For each channel, there are two `channel_update` messages, one from each direction. For example B<->C channel, B announces
its fee for B->C transfers while C announnces its fee for C->B transfers.<br>
</div>
<div><br>
</div>
<div>The A may have obsolete information about fees (e.g. B or C change their fee but their `channel_update` has not propagated to A yet). In this case, payment routing will fail, but the `channel_update` will also be sent as part of the error message returned
by payment routing failure.<br>
</div>
<div><br>
</div>
<blockquote type="cite" class="x_protonmail_quote">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">- How does A know the amount of fees that need to be added to the payment to cover all fees?<br>
</p>
</div>
</blockquote>
<div><br>
</div>
<div>It computes it. If D is to be given a payment with value `msatoshi` then it computes first the C->D fee, which is the C->D `fee_base_msat` + (C->D `fee_proportion_millionts` * `msatoshi` / 1,000,000). Add that to `msatoshi` and that is the payment that
needs to reach C, so A computes the payment from B->C similarly, except the `msatoshi` is replaced with the payment that should reach C. Then A knows how much it has to give to B.<br>
</div>
<div><br>
</div>
<blockquote type="cite" class="x_protonmail_quote">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">- Is D aware of the full amount including fees or is that somehow hidden?<br>
</p>
</div>
</blockquote>
<div><br>
</div>
<div>No. D is only aware of how much C offers it.<br>
</div>
<div><br>
</div>
<blockquote type="cite" class="x_protonmail_quote">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">- How are the fees actually claimed (who ends up paying whom)?<br>
</p>
</div>
</blockquote>
<div><br>
</div>
<div>A offer B a value that is higher than what A instruct B to forward to C. The difference is the fee. Since the highest value is at the source A, A is the one, who ends up paying the entire fee.<br>
</div>
<div><br>
</div>
<div>Regards,<br>
</div>
<div>ZmnSCPxj<br>
</div>
</div>
</body>
</html>