<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&nbsp;reveal the funding/balance of channels, same way&nbsp;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&nbsp;routing decision as a sender, based on the&nbsp;fees (that you have already explained), but also the funding/balance of each channel,&nbsp;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, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, NotoColorEmoji, &quot;Segoe UI Symbol&quot;, &quot;Android Emoji&quot;, 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&nbsp;or how else you'd&nbsp;handle this kind of thing?</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, NotoColorEmoji, &quot;Segoe UI Symbol&quot;, &quot;Android Emoji&quot;, EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, NotoColorEmoji, &quot;Segoe UI Symbol&quot;, &quot;Android Emoji&quot;, 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, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, NotoColorEmoji, &quot;Segoe UI Symbol&quot;, &quot;Android Emoji&quot;, EmojiSymbols; font-size: 16px;">
<br>
</p>
<p style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, NotoColorEmoji, &quot;Segoe UI Symbol&quot;, &quot;Android Emoji&quot;, 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 &lt;ZmnSCPxj@protonmail.com&gt;<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>&nbsp;</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 &lt;TSteenholdt@cascadetechnologypartners.com&gt; 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,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,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&nbsp;fees, especially in the case of routed payments. Unfortunately, I haven't had any success&nbsp;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,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,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,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,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,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,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,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,EmojiSymbols"><span class="x_size" style="font-size:16px">A&nbsp;multi-hop routed&nbsp;payment
 where&nbsp;A needs to pay D through B and C. Established channels are&nbsp;A -&gt; B -&gt; C -&gt; 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&nbsp;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.&nbsp; Node gossip, the `channel_update` message in BOLT#7.&nbsp; This message, contains `fee_base_msat` and `fee_proportional_millionths`.&nbsp; For each channel, there are two `channel_update` messages, one from each direction.&nbsp; For example B&lt;-&gt;C channel, B announces
 its fee for B-&gt;C transfers while C announnces its fee for C-&gt;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).&nbsp; 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,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,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&nbsp;fees?<br>
</p>
</div>
</blockquote>
<div><br>
</div>
<div>It computes it.&nbsp; If D is to be given a payment with value `msatoshi` then it computes first the C-&gt;D fee, which is the C-&gt;D `fee_base_msat` &#43;&nbsp; (C-&gt;D `fee_proportion_millionts` * `msatoshi` / 1,000,000).&nbsp; Add that to `msatoshi` and that is the payment that
 needs to reach C, so A computes the payment from B-&gt;C similarly, except the `msatoshi` is replaced with the payment that should reach C.&nbsp; 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,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,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.&nbsp; 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,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,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.&nbsp; The difference is the fee.&nbsp; 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>