<oembed><type>rich</type><version>1.0</version><author_name>npub17fjkngg0s0mfx4uhhz6n4puhflwvrhn2h5c78vdr5xda4mvqx89swntr0s</author_name><author_url>https://nostr.ae/npub17fjkngg0s0mfx4uhhz6n4puhflwvrhn2h5c78vdr5xda4mvqx89swntr0s</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2020-10-19&#xA;📝 Original message:&#xA;Good morning list,&#xA;&#xA;I&#39;ve started summarizing proposals, attacks and threat models on github [1].&#xA;I&#39;m hoping it will help readers get up-to-speed and avoid falling in the&#xA;same pitfalls we already&#xA;fell into with previous proposals.&#xA;&#xA;I&#39;ve kept it very high-level for now; we can add nitty-gritty technical&#xA;details as we slowly&#xA;converge towards acceptable solutions. I have probably missed subtleties&#xA;from previous proposals;&#xA;feel free to contribute to correct my mistakes. I have omitted for examples&#xA;the details of Rusty&#39;s&#xA;previous proposal since he mentioned a new, better one that will be&#xA;described soon.&#xA;&#xA;While doing this exercise, I couldn&#39;t find a reason why the `reverse&#xA;upfront payment` proposal&#xA;would be broken (notice that I described it using a flat amount after a&#xA;grace period, not an amount&#xA;based on the time HTLCs are held). Can someone point me to the most obvious&#xA;attacks on it?&#xA;&#xA;It feels to me that its only issue is that it still allows spamming for&#xA;durations smaller than the&#xA;grace period; my gut feeling is that if we add a smaller forward direction&#xA;upfront payment to&#xA;complement it it could be a working solution.&#xA;&#xA;Pasting it here for completeness:&#xA;&#xA;### Reverse upfront payment&#xA;&#xA;This proposal builds on the previous one, but reverses the flow. Nodes pay&#xA;a fee for *receiving*&#xA;HTLCs instead of *sending* them.&#xA;&#xA;```text&#xA;A -----&gt; B -----&gt; C -----&gt; D&#xA;&#xA;B pays A to receive the HTLC.&#xA;Then C pays B to receive the forwarded HTLC.&#xA;Then D pays C to receive the forwarded HTLC.&#xA;```&#xA;&#xA;There must be a grace period during which no fees are paid; otherwise the&#xA;`uncontrolled spam` attack&#xA;allows the attacker to force all nodes in the route to pay fees while he&#39;s&#xA;not paying anything.&#xA;&#xA;The fee cannot be the same at each hop, otherwise it&#39;s free for the&#xA;attacker when he is at both&#xA;ends of the payment route.&#xA;&#xA;This fee must increase as the HTLC travels downstream: this ensures that&#xA;nodes that hold HTLCs&#xA;longer are penalized more than nodes that fail them fast, and if a node has&#xA;to hold an HTLC for a&#xA;long time because it&#39;s stuck downstream, they will receive more fees than&#xA;what they have to pay.&#xA;&#xA;The grace period cannot be the same at each hop either, otherwise the&#xA;attacker can force Bob to be&#xA;the only one to pay fees. Similarly to how we have `cltv_expiry_delta`,&#xA;nodes must have a&#xA;`grace_period_delta` and the `grace_period` must be bigger upstream than&#xA;downstream.&#xA;&#xA;Drawbacks:&#xA;&#xA;* The attacker can still lock HTLCs for the duration of the `grace_period`&#xA;and repeat the attack&#xA;continuously&#xA;&#xA;Open questions:&#xA;&#xA;* Does the fee need to be based on the time the HTLC is held?&#xA;* What happens when a channel closes and HTLC-timeout has to be redeemed&#xA;on-chain?&#xA;* Can we implement this without exposing the route length to intermediate&#xA;nodes?&#xA;&#xA;Cheers,&#xA;Bastien&#xA;&#xA;[1] https://github.com/t-bast/lightning-docs/blob/master/spam-prevention.md&#xA;&#xA;Le dim. 18 oct. 2020 à 09:25, Joost Jager &lt;joost.jager at gmail.com&gt; a écrit :&#xA;&#xA;&gt; &gt; We&#39;ve looked at all kinds of trustless payment schemes to keep users&#xA;&gt;&gt;&#xA;&gt;&gt; &gt; honest, but it appears that none of them is satisfactory. Maybe it is&#xA;&gt;&gt; even&#xA;&gt;&gt; &gt; theoretically impossible to create a scheme that is trustless and has&#xA;&gt;&gt; all&#xA;&gt;&gt; &gt; the properties that we&#39;re looking for. (A proof of that would also be&#xA;&gt;&gt;&#xA;&gt;&gt; &gt; useful information to have.)&#xA;&gt;&gt;&#xA;&gt;&gt; I don&#39;t think anyone has drawn yet a formal proof of this, but roughly a&#xA;&gt;&gt; routing peer Bob, aiming to prevent resource abuse at HTLC relay is seeking&#xA;&gt;&gt; to answer the following question &#34;Is this payment coming from Alice and&#xA;&gt;&gt; going to Caroll will compensate for my resources consumption ?&#34;. With the&#xA;&gt;&gt; current LN system, the compensation is conditional on payment settlement&#xA;&gt;&gt; success and both Alice and Caroll are distrusted yet discretionary on&#xA;&gt;&gt; failure/success. Thus the underscored question is undecidable for a routing&#xA;&gt;&gt; peer making relay decisions only on packet observation.&#xA;&gt;&gt;&#xA;&gt;&gt; One way to mitigate this, is to introduce statistical observation of&#xA;&gt;&gt; sender/receiver, namely a reputation system. It can be achieved through a&#xA;&gt;&gt; scoring system, web-of-trust, or whatever other solution with the same&#xA;&gt;&gt; properties.&#xA;&gt;&gt; But still it must be underscored that statistical observations are only&#xA;&gt;&gt; probabilistic and don&#39;t provide resource consumption security to Bob, the&#xA;&gt;&gt; routing peer, in a deterministic way. A well-scored peer may start to&#xA;&gt;&gt; suddenly misbehave.&#xA;&gt;&gt;&#xA;&gt;&gt; In that sense, the efficiency evaluation of a reputation-based solution&#xA;&gt;&gt; to deter DoS must be evaluated based based on the loss of the reputation&#xA;&gt;&gt; bearer related to the potential damage which can be inflicted. It&#39;s just&#xA;&gt;&gt; reputation sounds harder to compute accurately than a pure payment-based&#xA;&gt;&gt; DoS protection system.&#xA;&gt;&gt;&#xA;&gt;&#xA;&gt; I can totally see the issues and complexity of a reputation-based system.&#xA;&gt; With &#39;trustless payment scheme&#39; I meant indeed a trustless pure&#xA;&gt; payment-based DoS protection system and the question whether such a system&#xA;&gt; can be proven to not exist. A sender would pay an up-front amount to cover&#xA;&gt; the maximum cost, but with the guarantee that nodes can only take a fair&#xA;&gt; part of the deposit (based on actual lock time). Perhaps the taproot&#xA;&gt; upgrade offers new possibilities with adaptor signatures to atomically swap&#xA;&gt; part of the up-front payment with htlc-received-in-time-signatures from&#xA;&gt; nodes downstream (random wild idea).&#xA;&gt;&#xA;&gt;&#xA;&gt;&gt; &gt; What I can see working is a system where peers charge each other a hold&#xA;&gt;&gt; fee&#xA;&gt;&gt; &gt; for forwarded HTLCs based on the actual lock time (not the maximum lock&#xA;&gt;&gt;&#xA;&gt;&gt; &gt; time) and the htlc value. This is just for the cost of holding and&#xA;&gt;&gt; separate&#xA;&gt;&gt; &gt; from the routing fee that is earned when the payment settles&#xA;&gt;&gt;&#xA;&gt;&gt; Yes I guess any solution will work as long as it enforces an asymmetry&#xA;&gt;&gt; between the liquidity requester and a honest routing peer. This asymmetry&#xA;&gt;&gt; can be defined as guaranteeing that the routing peer&#39;s incoming/outgoing&#xA;&gt;&gt; balance is always increasing, independently of payment success. Obviously&#xA;&gt;&gt; this increase should be materialized by a payment, while minding it might&#xA;&gt;&gt; be discounted based on requester reputation (&#34;pay-with-your-reputation&#34;).&#xA;&gt;&gt; This reputation evaluation can be fully delegated to the routing node&#xA;&gt;&gt; policy, without network-wise guidance.&#xA;&gt;&gt;&#xA;&gt;&gt; That said, where I&#39;m skeptical on any reputation-heavy system is on the&#xA;&gt;&gt; long-term implications.&#xA;&gt;&gt;&#xA;&gt;&gt; Either, due to the wants of a subset of actors deliberately willingly to&#xA;&gt;&gt; trade satoshis against discounted payment flow by buying well-scored&#xA;&gt;&gt; pubkeys, we see the emergence of a reputation market. Thus enabling&#xA;&gt;&gt; reputation to be fungible to satoshis, but with now a weird &#34;reputation&#34;&#xA;&gt;&gt; token to care about.&#xA;&gt;&gt;&#xA;&gt;&gt; Or, reputation is too hard to make liquid (e.g hard to disentangle&#xA;&gt;&gt; pubkeys from channel ownership or export your score across routing peers)&#xA;&gt;&gt; and thus you now have reputation scarcity which is introducing a bias from&#xA;&gt;&gt; a &#34;purer&#34; market, where agents are only routing based on advertised fees.&#xA;&gt;&gt; IMO, we should strive for the more liquid Lightning market we can, as it&#xA;&gt;&gt; avoids bias towards past actors and thus may contain centralization&#xA;&gt;&gt; inertia. I&#39;m curious about your opinion on this last point.&#xA;&gt;&gt;&#xA;&gt;&#xA;&gt; I am in favor of more liquidity and less centralization, but as far as I&#xA;&gt; know the reality is that we don&#39;t have a good solution yet to achieve this&#xA;&gt; without being vulnerable to DoS attacks. If those attacks would happen on a&#xA;&gt; large scale today, what would we do?&#xA;&gt;&#xA;&gt; Also peers can implement these trusted upfront payments without protocol&#xA;&gt; changes. Just stop forwarding when the prepaid forwarding budget is used up&#xA;&gt; and require a top-up. It may have been implemented already in parts of the&#xA;&gt; network, I don&#39;t think there is a way to know. I&#39;ve experimented a bit with&#xA;&gt; the fee model myself (&#xA;&gt; https://twitter.com/joostjgr/status/1317546071984427009). Node operators&#xA;&gt; don&#39;t need to wait for permission.&#xA;&gt;&#xA;&gt; To me it seems that the longer it takes to come up with a good anti-DoS&#xA;&gt; system for Lightning, the further the outside world will have developed&#xA;&gt; their trust-based systems and established that potential bias towards&#xA;&gt; centralization.&#xA;&gt;&#xA;&gt; That might be another reason to prioritize this issue. Not just because we&#xA;&gt; want the network to be safe, but also to be able to implement the preferred&#xA;&gt; solution while the opportunity window is still open.&#xA;&gt;&#xA;&gt; - Joost&#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/20201019/93818bf0/attachment.html&gt;</html></oembed>