<oembed><type>rich</type><version>1.0</version><title>Anthony Towns [ARCHIVE] wrote</title><author_name>Anthony Towns [ARCHIVE] (npub17r…x9l2h)</author_name><author_url>https://yabu.me/npub17rld56k4365lfphyd8u8kwuejey5xcazdxptserx03wc4jc9g24stx9l2h</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2020-02-23&#xA;📝 Original message:&#xA;On Fri, Feb 21, 2020 at 12:35:20PM +1030, Rusty Russell wrote:&#xA;&gt; &gt; I think the way it would end up working&#xA;&gt; &gt; is that the further the route extends, the greater the payments are, so:&#xA;&gt; &gt;   A -&gt; B   : B sends A 1msat per minute&#xA;&gt; &gt;   A -&gt; B -&gt; C : C sends B 2msat per minute, B forwards 1msat/min to A&#xA;&gt; &gt;   A -&gt; B -&gt; C -&gt; D : D sends C 3 msat, etc&#xA;&gt; &gt;   A -&gt; B -&gt; C -&gt; D -&gt; E : E sends D 4 msat, etc&#xA;&gt; &gt; so each node is receiving +1 msat/minute, except for the last one, who&#39;s&#xA;&gt; &gt; paying n msat/minute, where n is the number of hops to have gotten up to&#xA;&gt; &gt; the last one. There&#39;s the obvious privacy issue there, with fairly&#xA;&gt; &gt; obvious ways to fudge around it, I think.&#xA;&gt; Yes, it needs to scale with distance to work at all.  However, it has&#xA;&gt; the same problems with other upfront schemes: how does E know to send&#xA;&gt; 4msat per minute?&#xA;&#xA;D tells it &#34;if you want this HTLC, you&#39;ll need to pay 4msat/minute after&#xA;the grace period of 65 seconds&#34;. Which also means A as the originator can&#xA;also choose whatever fees they like. The only consequence of choosing too&#xA;high a fee is that it&#39;s more likely one of the intermediate nodes will&#xA;say &#34;screw that!&#34; and abort the HTLC before it gets to the destination.&#xA;&#xA;&gt; &gt; I think it might make sense for the payments to have a grace period --&#xA;&gt; &gt; ie, &#34;if you keep this payment open longer than 20 seconds, you have to&#xA;&gt; &gt; start paying me x msat/minute, but if it fulfills or cancels before&#xA;&gt; &gt; then, it&#39;s all good&#34;.&#xA;&gt; But whatever the grace period, I can just rely on knowing that B is in&#xA;&gt; Australia (with a 1 second HTLC commit time) to make that node bleed&#xA;&gt; satoshis.  I can send A-&gt;B-&gt;C, and have C fail the htlc after 19&#xA;&gt; seconds for free.  But B has to send 1msat to A.  B can&#39;t blame A or C,&#xA;&gt; since this attack could come from further away, too.&#xA;&#xA;So A gives B a grace period of 35 seconds, B deducts 5 seconds&#xA;processing time and 10 seconds for latency, so gives C a grace period of&#xA;20 seconds; C rejects after 19 seconds, and B still has 15 seconds to&#xA;notify A before he has to start paying fees. Same setup as decreasing&#xA;timelocks when forwarding HTLCs.&#xA;&#xA;&gt; And if there is a grace period, I can just gum up the network with lots&#xA;&gt; of slow-but-not-slow-enough HTLCs.&#xA;&#xA;Well, it reduces the &#34;gum up the network for &lt;timeout&gt; blocks&#34; to &#34;gum&#xA;up the network for &lt;grace period&gt; seconds&#34;, which seems like a pretty&#xA;big win. I think if you had 20 hops each with a 1 minute grace period,&#xA;and each channel had a max_accepted_htlcs of 30, you&#39;d need 25 HTLCs per&#xA;second to block 1000 channels (so 2.7% of the 36k channels 1ml reports),&#xA;so at the very least, successfully performing this attack would be&#xA;demonstrating lightning&#39;s solved bitcoin&#39;s transactions-per-second&#xA;limitation?&#xA;&#xA;I think you could do better by having the acceptable grace period be&#xA;dynamic: both (a) requiring a shorter grace period the more funds a HTLC&#xA;locks up, which stops a single HTLC from gumming up the channel, and (b) &#xA;requiring a shorter grace period the more active HTLCs you have (or, the&#xA;more active HTLCs you have that are in the grace period, perhaps). That&#xA;way if the network is loaded, you&#39;re prioritising more efficient routes&#xA;(or at least ones that are willing to pay their way), and if it&#39;s under&#xA;attack, you&#39;re dynamically increasing the resources needed to maintain&#xA;the attack.&#xA;&#xA;Anyway, that&#39;s my hot take; not claiming it&#39;s a perfect solution or&#xA;final answer, rather that this still seems worth brainstorming out.&#xA;&#xA;My feeling is that this might interact nicely with the sender-initiated&#xA;upfront fee. Like, you could replace a grace period of 30 seconds at&#xA;2msat/minute by always charging 2msat/minute but doing a forward payment&#xA;of 1msat. But at this point I can&#39;t keep it all in my head at once to&#xA;figure out something that really makes sense.&#xA;&#xA;&gt; &gt; Maybe this also implies a different protocol for HTLC forwarding,&#xA;&gt; &gt; something like:&#xA;&gt; &gt;   1. A sends the HTLC onion packet to B&#xA;&gt; &gt;   2. B decrypts it, makes sure it makes sense&#xA;&gt; &gt;   3. B sends a half-signed updated channel state back to A&#xA;&gt; &gt;   4. A accepts it, and forwards the other half-signed channel update to B&#xA;&gt; &gt; so that at any point before (4) Alice can say &#34;this is taking too long,&#xA;&gt; &gt; I&#39;ll start losing money&#34; and safely abort the HTLC she was forwarding to&#xA;&gt; &gt; Bob to avoid paying fees; while only after (4) can she start the time on&#xA;&gt; &gt; expecting Bob to start paying fees that she&#39;ll forward back. That means&#xA;&gt; &gt; 1.5 round-trips before Bob can really forward the HTLC on to Carol;&#xA;&gt; &gt; but maybe it&#39;s parallelisable, so Bob/Carol could start at (1) as soon&#xA;&gt; &gt; as Alice/Bob has finished (2).&#xA;&gt; We added a ping-before-commit[1] to avoid the case where B has disconnected&#xA;&gt; and we don&#39;t know yet; we have to assume an HTLC is stuck once we send&#xA;&gt; commitment_signed.  This would be a formalization of that, but I don&#39;t&#xA;&gt; think it&#39;s any better?&#xA;&#xA;I don&#39;t think it&#39;s any better as things stand, but with the &#34;B pays A&#xA;holding fees&#34; I think it becomes necessary. If you&#39;ve got a route&#xA;A-&gt;B-&gt;C then from B&#39;s perspective I think it currently looks like:&#xA;&#xA;  A-&gt;B: here&#39;s a HTLC, locked in&#xA;&#xA;  B-&gt;C: ping&#xA;  C-&gt;B: pong!&#xA;  B-&gt;C: updated commitment with HTLC locked in&#xA;&#xA;  C-&gt;B: *silence*&#xA;&#xA;at which point the best B can do is unilaterally close the B/C channel&#xA;with their pre-HTLC commitment, but they still have to wait for that to&#xA;confirm before they can safely cancel the HTLC with A, and that will&#xA;likely take more than whatever the grace period is, so B will be losing&#xA;money on holding fees.&#xA;&#xA;Whereas:&#xA;&#xA;  A-&gt;B: here&#39;s a HTLC, locked in&#xA;&#xA;  B-&gt;C: HTLC proposal&#xA;  C-&gt;B: sure: updated commitment with HTLC locked in&#xA;  B-&gt;C: great, corresponding updated commitment, plus revocation&#xA;  C-&gt;B: revocation&#xA;&#xA;means that if C goes silent before B receives a new commitment, B can&#xA;cancel the HTLC with A with no risk (B can publish the old commitment&#xA;still even if the new arrives later, and C can only publish the pre-HTLC&#xA;commitment), and if C goes silent after B receives the new commitment, B&#xA;can drop the new commitment to the blockchain and pay A&#39;s fees out of it.&#xA;&#xA;&gt; There&#39;s an old proposal to fast-fail HTLCs: Bob sends an new message &#34;I&#xA;&gt; would fail this HTLC once it&#39;s committed, here&#39;s the error&#34; &#xA;&#xA;Yeah, you could do &#34;B-&gt;C: proposal, C-&gt;B: no way!&#34; instead of &#34;sure&#34; to&#xA;fast fail the above too. &#xA;&#xA;And I think something like that&#39;s necessary (at least with my view of how&#xA;this &#34;keep the HTLC open&#34; payment would work), otherwise B could send C a&#xA;&#34;1 microsecond grace period, rate of 3e11 msat/minute, HTLC for 100 sat,&#xA;timeout of 2016 blocks&#34; and if C couldn&#39;t reject it immediately would&#xA;owe B 50c per millisecond it took to cancel.&#xA;&#xA;Cheers,&#xA;aj</html></oembed>