<oembed><type>rich</type><version>1.0</version><title>Joost Jager [ARCHIVE] wrote</title><author_name>Joost Jager [ARCHIVE] (npub1as…wfqmx)</author_name><author_url>https://yabu.me/npub1aslmpzentw224n3s6yccru4dq2qdlx7rfudfnqevfck637cjt6esswfqmx</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2020-02-18&#xA;📝 Original message:&#xA;Hi all,&#xA;&#xA;Within our team, we&#39;ve been discussing the subject of preventing&#xA;liquidity-consuming spam (aka channel jamming) further. One idea came up&#xA;that I think is worth sharing.&#xA;&#xA;Previous prepay ideas were based on the sender paying something up-front in&#xA;case the htlc causes grief on the network. This however leaves the sender&#xA;vulnerable to nodes stealing that up-front payment.&#xA;&#xA;Consider what is probably the worst known channel jamming attack: an&#xA;attacker sends minimum sized htlcs to fill up the limited number of&#xA;commitment slots of channels along the route. Those htlcs will be held as&#xA;long as possible by the receiving node (that is also controlled by the&#xA;attacker). The hold time per htlc doesn&#39;t even need to be very long,&#xA;because a fresh htlc can be launched to immediately re-occupy a slot after&#xA;it opens up again.&#xA;&#xA;The cost to the network of this attack is mostly dependent on the capacity&#xA;of the channels used. The bigger the capacity, the more funds are locked up&#xA;if a sufficient number of minimum sized htlcs are pending. The size of the&#xA;up-front payment likely needs to be proportional to this cost.&#xA;&#xA;This means that for small htlcs, the up-front payment requirements may very&#xA;well be exceeding the htlc amount and routing fees paid by far. At that&#xA;point, a routing node may decide to steal the up-front payment rather than&#xA;earn the routing fee in an honest way.&#xA;&#xA;A different way of mitigating this is to reverse the direction in which the&#xA;bond is paid. So instead of paying to offer an htlc, nodes need to pay to&#xA;receive an htlc. This sounds counterintuitive, but for the described&#xA;jamming attack there is also an attacker node at the end of the route. The&#xA;attacker still pays. The advantage is that for legitimate senders, there is&#xA;no up-front payment that can be stolen.&#xA;&#xA;How this would work is that channel peers charge each other for the time&#xA;that the other party holds an htlc. So if node A extends an htlc to node B,&#xA;node B will pay node A amount x per minute of hold time. If node B doesn&#39;t&#xA;pay (doesn&#39;t hold up the contract), A will close the channel. It can be a&#xA;running balance between A and B that materializes as a single htlc per&#xA;channel on the commitment transaction.&#xA;&#xA;As long as node B forwards the htlc swiftly to node C, the dfiference (the&#xA;actual cost) between what B needs to pay A and what B receives from C will&#xA;be tiny. Only when the htlc reaches the attacker node, or any other node on&#xA;the network that is (unintentionally) mishaving for some reason, the delta&#xA;starts to increase quickly for that node. The cost is borne by the node&#xA;that should bear it.&#xA;&#xA;This would also fix concerns that have been voiced around hodl invoices.&#xA;With the reverse bond payment as described above, hodling nodes will pay&#xA;for the cost of their actions.&#xA;&#xA;Many details skipped over, but interested to hear opinions on the viability&#xA;of this variation of up-front payments.&#xA;&#xA;Joost&#xA;&#xA;On Tue, Nov 5, 2019 at 3:25 AM Rusty Russell &lt;rusty at rustcorp.com.au&gt; wrote:&#xA;&#xA;&gt; Hi all,&#xA;&gt;&#xA;&gt;         It&#39;s been widely known that we&#39;re going to have to have up-front&#xA;&gt; payments for msgs eventually, to avoid Type 2 spam (I think of Type 1&#xA;&gt; link-local, Type 2 though multiple nodes, and Type 3 liquidity-using&#xA;&gt; spam).&#xA;&gt;&#xA;&gt;         Since both Offers and Joost&#39;s WhatSat are looking at sending&#xA;&gt; messages, it&#39;s time to float actual proposals.  I&#39;ve been trying to come&#xA;&gt; up with something for several years now, so thought I&#39;d present the best&#xA;&gt; I&#39;ve got in the hope that others can improve on it.&#xA;&gt;&#xA;&gt; 1. New feature bit, extended messages, etc.&#xA;&gt; 2. Adding an HTLC causes a *push* of a number of msat on&#xA;&gt;    commitment_signed (new field), and a hash.&#xA;&gt; 3. Failing/succeeding an HTLC returns some of those msat, and a count&#xA;&gt;    and preimage (new fields).&#xA;&gt;&#xA;&gt; How many msat can you take for forwarding?  That depends on you&#xA;&gt; presenting a series of preimages (which chain into a final hash given in&#xA;&gt; the HTLC add), which you get by decoding the onion.  You get to keep 50&#xA;&gt; msat[1] per preimage you present[2].&#xA;&gt;&#xA;&gt; So, how many preimages does the user have to give to have you forward&#xA;&gt; the payment?  That depends.  The base rate is 16 preimages, but subtract&#xA;&gt; one for each leading 4 zero bits of the SHA256(blockhash | hmac) of the&#xA;&gt; onion.  The blockhash is the hash of the block specified in the onion:&#xA;&gt; reject if it&#39;s not in the last 3 blocks[3].&#xA;&gt;&#xA;&gt; This simply adds some payment noise, while allowing a hashcash style&#xA;&gt; tradeoff of sats for work.&#xA;&gt;&#xA;&gt; The final node gets some variable number of preimages, which adds noise.&#xA;&gt; It should take all and subtract from the minimum required invoice amount&#xA;&gt; on success, or take some random number on failure.&#xA;&gt;&#xA;&gt; This leaks some forward information, and makes an explicit tradeoff for&#xA;&gt; the sender between amount spent and privacy, but it&#39;s the best I&#39;ve been&#xA;&gt; able to come up with.&#xA;&gt;&#xA;&gt; Thoughts?&#xA;&gt; Rusty.&#xA;&gt;&#xA;&gt; [1] If we assume $1 per GB, $10k per BTC and 64k messages, we get about&#xA;&gt;     655msat per message.  Flat pricing for simplicity; we&#39;re trying to&#xA;&gt;     prevent spam, not create a spam market.&#xA;&gt; [2] Actually, a number and a single preimage; you can check this is&#xA;&gt;     indeed the n&#39;th preimage.&#xA;&gt; [3] This reduces incentive to grind the damn things in advance, though&#xA;&gt;     maybe that&#39;s dumb?  We can also use a shorter hash (siphash?), or&#xA;&gt;     even truncated SHA256 (128 bits).&#xA;&gt; _______________________________________________&#xA;&gt; Lightning-dev mailing list&#xA;&gt; Lightning-dev at lists.linuxfoundation.org&#xA;&gt; https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20200218/59b4ba73/attachment.html&gt;</html></oembed>