<oembed><type>rich</type><version>1.0</version><author_name>npub1aslmpzentw224n3s6yccru4dq2qdlx7rfudfnqevfck637cjt6esswfqmx</author_name><author_url>https://nostr.ae/npub1aslmpzentw224n3s6yccru4dq2qdlx7rfudfnqevfck637cjt6esswfqmx</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2020-10-13&#xA;📝 Original message:&#xA;&gt;&#xA;&gt; &gt; The idea is that the available prepaid hold fee balance is enough to&#xA;&gt; cover the worst case hold fee. Otherwise the forward won&#39;t happen. The main&#xA;&gt; difference with option B is that you pay a sum upfront which can be used to&#xA;&gt; cover multiple forwards. And that this payment is a separate Lightning&#xA;&gt; payment, not integrated with the add/fail/settle flow. I prefer option B,&#xA;&gt; but implementation effort is also a consideration.&#xA;&gt;&#xA;&gt; If the above is not done (i.e. if I only prepay Joost but not Rusty) then&#xA;&gt; it seems to me that the below remote attack is possible:&#xA;&gt;&#xA;&#xA;Indeed, the above isn&#39;t done. Z only prepays Joost, not rusty.&#xA;&#xA;&#xA;&gt; * I convince Rene to make a channel to me.&#xA;&gt;&#xA;&#xA;You may succeed, but Rene is probably not going to pay you a hold fee&#xA;because you&#39;re untrusted.&#xA;&#xA;&#xA;&gt; * I connect to Joost.&#xA;&gt; * I prepay to Joost.&#xA;&gt; * I forward Me-&gt;Joost-&gt;Rusty-&gt;Rene-&gt;me.&#xA;&gt;   * I am exploiting the pre-existing tr\*st that Rusty has to Joost, and&#xA;&gt; the tr\*st that Rene has to Rusty.&#xA;&gt; * When the HTLC reaches me, I dicker around and wait until it is about to&#xA;&gt; time out before ultimately failing.&#xA;&gt; * Rusty loses tr\*st in Joost, and Rene loses tr\*st in Rusty.&#xA;&#xA;&#xA;But most importantly: you will have paid hold fees to Joost for the long&#xA;lock time of the htlc. This should keep you from even trying this attack.&#xA;&#xA;Thinking a little more deeply: it is in principle possible to give a&#xA;&gt; financial value to an amount of msat being locked for an amount of time.&#xA;&gt; For instance the C-Lightning `getroute` has a `riskfactor` argument which&#xA;&gt; is used in this conversion.&#xA;&gt; Basically, by being locked in an HTLC and later failing, then the&#xA;&gt; forwarding node loses the expected return on investment if instead the&#xA;&gt; amount were locked in an HTLC that later succeeds.&#xA;&gt;&#xA;&gt; Now, the cost on a forwarding node is based on the actual amount of time&#xA;&gt; that its outgoing HTLC is locked.&#xA;&gt;&#xA;&#xA;That is indeed the proposal, to give financial value to the sats and the&#xA;htlc slot being locked for an amount of time.&#xA;&#xA;&#xA;&gt; When we consider multi-hop payments, then we should consider that the&#xA;&gt; initiator of the multi-hop payment is asking multiple nodes to put their&#xA;&gt; funds at risk.&#xA;&gt;&#xA;&gt; Thus, the initiator of a multi-hop payment should, in principle, prepay&#xA;&gt; for *all* the risk of *all* the hops.&#xA;&gt;&#xA;&gt;&#xA;&gt; If we do not enforce this, then an initiator of a multi-hop payment can&#xA;&gt; pay a small amount relative to the risk that *all* the hops are taking.&#xA;&gt;&#xA;&#xA;I understand that, but I think it might be a large enough shift in the&#xA;incentives of the attacker.&#xA;&#xA;&#xA;&gt; Secondarily, we currently assume that forwarding nodes will, upon having&#xA;&gt; their outgoing HTLC claimed, seek to claim the incoming HTLC as quickly as&#xA;&gt; possible.&#xA;&gt; This is because the incoming HTLC would be locked and unuseable until they&#xA;&gt; claim their incoming HTLC, and the liquidity would not be usable for&#xA;&gt; earning more fees until the incoming HTLC is claimed and put into its pool&#xA;&gt; of liquidity.&#xA;&gt;&#xA;However, if we make anything that is based on the time that a forwarding&#xA;&gt; node claims its incoming HTLC, then this may incentivize the forwarding&#xA;&gt; node to delay claiming the incoming HTLC.&#xA;&gt;&#xA;&#xA;Yes, that is the trust part again.&#xA;&#xA;&#xA;&gt; &gt; &gt; &gt; B. Tightly integrated with the htlc add/fail/settle messages. When&#xA;&gt; an htlc is added, the maximum cost (based on maximum lock time) for holding&#xA;&gt; is deducted from the sender&#39;s channel balance. When the htlc settles, a&#xA;&gt; refund is given based on the actual lock time. An additional&#xA;&gt; `update_fee`-like message is added for peers to update their hold fee&#xA;&gt; parameters (fee_base and fee_rate).&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; If I am a forwarding node, and I receive the preimage from the&#xA;&gt; outgoing HTLC, can I deliberately defer claiming the incoming HTLC&#xA;&gt; (pretending that the outgoing HTLC was taking longer than it actually took)&#xA;&gt; in order to reduce the amount I have to refund?&#xA;&gt; &gt;&#xA;&gt; &gt; Yes you can. That is the trust part, your peer trusts you not to do&#xA;&gt; this. If they don&#39;t trust you, they won&#39;t forward to you if you charge a&#xA;&gt; (high) hold fee.&#xA;&gt;&#xA;&gt; What happens if I charge a tiny hold feerate in msats/second, but end up&#xA;&gt; locking the funds for a week?&#xA;&gt; How does my peer know that even though I charge a tiny hold fee, I will&#xA;&gt; hold their funds hostage for a week?&#xA;&gt;&#xA;&#xA;That is the trust part also.&#xA;&#xA;&#xA;&gt; &gt; &gt; &gt; In both cases the sender needs to trust its peer to not steal the&#xA;&gt; payment and/or artificially delay the forwarding to inflate the hold fee. I&#xA;&gt; think that is acceptable given that there is a trust relation between peers&#xA;&gt; already anyway.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; I am wary of *adding* trust.&#xA;&gt; &gt; &gt; You might trust someone to keep an eye on your snacks while you go&#xA;&gt; refill your drink, but not to keep an eye on your hardware wallet when you&#xA;&gt; do the same.&#xA;&gt; &gt; &gt; (Since consuming snacks and drinks and hardware wallets are human&#xA;&gt; activities, this should show that I am in fact a human.)&#xA;&gt; &gt;&#xA;&gt; &gt; So I am arguing that there is trust already between peers. Quite&#xA;&gt; considerable trust even in case of high on-chain fee conditions. The added&#xA;&gt; risk of being scammed out of these prepay sats may not be significant.&#xA;&gt;&#xA;&gt; Well, onchain activity is fairly rare in practice, so I am uncertain about&#xA;&gt; the relative size of prepays compared to relative fees of onchain activity.&#xA;&gt; I imagine payment forwardings to be much more common than onchain&#xA;&gt; activity, thus the prepays can add up and be significant compared to fees&#xA;&gt; on onchain activity, thus the tr\*st being considered may end up being a&#xA;&gt; good fraction of the current tr\*st.&#xA;&gt;&#xA;&#xA;Fair point. If you are continuously overcharged on the hold fees, it may&#xA;outweigh the once-in-a-channel-lifetime chain fees. But if all your&#xA;payments through a specific node are delayed, it does get suspicious.&#xA;&#xA;Joost&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20201013/e33007ce/attachment.html&gt;</html></oembed>