<oembed><type>rich</type><version>1.0</version><title>Nadav Kohen [ARCHIVE] wrote</title><author_name>Nadav Kohen [ARCHIVE] (npub1ge…rtua0)</author_name><author_url>https://yabu.me/npub1geqdlge6ysz9qlq3w758422flnkgqklpu9veu80ehjprcd04ugyqkrtua0</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2020-04-01&#xA;📝 Original message:&#xA;Hi ZmnSCPxj and list,&#xA;&#xA;Love the idea! I have a couple questions though:&#xA;&#xA;I&#39;m not convinced that &#34;Purely Falsified Proof-Of-Closure&#34; aren&#39;t&#xA;effective. Consider a similar network to the one you described where we&#xA;have channels A - B - C and A - E - C but where we add a &#34;fake&#34; channel E -&#xA;E&#39;. Now if the attacker sets up a payment from E to E&#39; using the route E -&#xA;C - B - A - E - E&#39;, then the attacker can successfully lock up all of B&#39;s&#xA;channels (as is desirable to get rid of competition) and also generate a&#xA;false proof of closure for the E - E&#39; channel. Even if this false proof&#xA;(which is a commitment tx) ends up being published on chain, E has lost no&#xA;ability to route and has successfully made B unable to route between A and&#xA;C. If my understanding of the proposal is correct, and it may not be, then&#xA;the punishment for grieving payments is the threat of closing channels that&#xA;would benefit from the grieving attack. But adding a new channel on the end&#xA;to be closed seems to invalidate this punishment?&#xA;&#xA;A second question I have is if you think that it would be advisable to use&#xA;up-front payments (pay for attempt, not just success) on payments with&#xA;abnormally high soft timeouts? If all this works, this combination seems to&#xA;be a way to enable hodl invoices under the proof of closure proposal.&#xA;&#xA;Best,&#xA;Nadav&#xA;&#xA;On Wed, Apr 1, 2020 at 1:19 AM ZmnSCPxj via Lightning-dev &lt;&#xA;lightning-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&#xA;&gt; Introduction&#xA;&gt; ============&#xA;&gt;&#xA;&gt; Given the fact that contracts on offchain protocols need to be enforceable&#xA;&gt; onchain as well, timelocks involved in multi-hop payments are measured in&#xA;&gt; blocks.&#xA;&gt; This is because the blockchain can only (third-party-verifiably) enforce&#xA;&gt; timeouts in units of entire blocks.&#xA;&gt; This leads to very long timeouts for payment delivery, thus multi-hop&#xA;&gt; offchain payment attempts can be, deliberately or accidentally, be in a&#xA;&gt; &#34;pending&#34; state up to the very large timeouts involved.&#xA;&gt;&#xA;&gt; Deliberately setting up a multi-hop payment such that it will be in a&#xA;&gt; &#34;pending&#34; state for long periods of time is colloquially known as a&#xA;&gt; &#34;griefing attack&#34;.&#xA;&gt; In this article, we assess various proposed solutions to mitigate the&#xA;&gt; effects of griefing attacks, and propose a particular solution,&#xA;&gt; proof-of-closure, as well, that requires significant changes to the update&#xA;&gt; state machine.&#xA;&gt;&#xA;&gt; Digression: Why Grief?&#xA;&gt; ======================&#xA;&gt;&#xA;&gt; Before embarking on our investigation for solutions to the griefing&#xA;&gt; problem, we should first wonder if griefing is, in fact, a problem.&#xA;&gt;&#xA;&gt; This brings up the question of: why would anybody grief at all?&#xA;&gt;&#xA;&gt; Humans, like cats and other less-sapient pieces of walking meat, often&#xA;&gt; find enjoyment in causing the suffering of others for no immediate direct&#xA;&gt; gain to themselves, as a public demonstration of dominance over those they&#xA;&gt; make suffer (aka &#34;shits and giggles&#34;, which, if executed correctly, can&#xA;&gt; lead to eventual direct gains to themselves or their progeny or relatives&#xA;&gt; or allies, but such details are often outside the ken of the very beings&#xA;&gt; who execute such survival strategies: brains are pieces of meat that have&#xA;&gt; been hacked to act as action-reaction engines, but are not sophisticated&#xA;&gt; enough to execute as pure rationality engines at all times).&#xA;&gt; Fortunately, in the Bitcoin world, only purely rational beings of pure&#xA;&gt; selfishness can exist in the long run, thus we can neglect such motivations&#xA;&gt; as mere noise.&#xA;&gt;&#xA;&gt; First, let us investigate *how* griefing attacks can be performed.&#xA;&gt;&#xA;&gt; * An intermediate node in a multi-hop attempt can delay forwarding or&#xA;&gt; failing an incoming HTLC.&#xA;&gt; * A final node in a payment attempt can delay claiming an incoming HTLC.&#xA;&gt;&#xA;&gt; Let us consider a purely rational intermediate node of pure selfishness:&#xA;&gt;&#xA;&gt; * If it forwards as soon as possible, it can earn fees, and also speed up&#xA;&gt; the release of the HTLC-locked funds so that they can reuse those funds as&#xA;&gt; liquidity for further payment attempts.&#xA;&gt; * Thus, delaying an HTLC is not selfishly-rational for an intermediate&#xA;&gt; node.&#xA;&gt;&#xA;&gt; Thus, for an intermediate node, it seems there is no selfishly-rational&#xA;&gt; motivation to execute a griefing attack on an arbitrary payment attempt.&#xA;&gt; We can then conclude that an intermediate that delays a payment would do&#xA;&gt; so, not of its own rational self-interest, but as an accident, such as an&#xA;&gt; unforeseen connectivity or power failure.&#xA;&gt;&#xA;&gt; However, things are different when we consider a non-arbitrary payment.&#xA;&gt; Suppose a node were to make a payment attempt to itself, and deliberately&#xA;&gt; delay claiming this self-payment.&#xA;&gt; This lets any single node, *who happens to own large liquidity*, to lock&#xA;&gt; up the liquidity of other nodes.&#xA;&gt;&#xA;&gt; The motivation to lock up the liquidity of other nodes is to *eliminate&#xA;&gt; competition*.&#xA;&gt; Suppose we have a network as below:&#xA;&gt;&#xA;&gt;     A -- B -- C&#xA;&gt;       \     /&#xA;&gt;        \   /&#xA;&gt;         \ /&#xA;&gt;          E&#xA;&gt;&#xA;&gt; When A and C want to transact with one another, they may choose to route&#xA;&gt; via either B or E.&#xA;&gt; B and E are therefore competitors in the business of forwarding payments.&#xA;&gt;&#xA;&gt; But suppose E has much larger channels AE and CE than the channels of AB&#xA;&gt; and CB.&#xA;&gt; For example, suppose E has 100mBTC perfectly-balanced channels while B has&#xA;&gt; only 10mBTC perfectly-balanced channels, as all things should be in&#xA;&gt; simplified models of reality.&#xA;&gt; E can then &#34;take out the competition&#34; by making a 5mBTC self-payment along&#xA;&gt; E-&gt;A-&gt;B-&gt;C-&gt;E and a 5mBTC self-payment along E-&gt;C-&gt;B-&gt;A-&gt;E, then refusing&#xA;&gt; to claim the payment, tying up all the liquidity of the channels of B.&#xA;&gt; By doing so, it can ensure that A and C will always fail to pay via B,&#xA;&gt; even if they wish to transact in amounts less than 5mBTC.&#xA;&gt; E thereby eliminates B as a competitor.&#xA;&gt;&#xA;&gt; This demonstrates that griefing attacks will be motivated, such that such&#xA;&gt; attacks will be performed by payers and payees *against intermediate nodes*.&#xA;&gt; Intermediate nodes have no motivation to attack payers and payees (those&#xA;&gt; are their potential customers in the business of forwarding payments, and&#xA;&gt; attacking potential customers is bad business: such attacking intermediate&#xA;&gt; nodes will be removed economically in the long run).&#xA;&gt; However, payers and payees can become motivated to attack intermediate&#xA;&gt; nodes, if the &#34;payer&#34; and &#34;payee&#34; are actually competitor intermediate&#xA;&gt; nodes.&#xA;&gt;&#xA;&gt; (We can observe that this is always a possibility even outside of&#xA;&gt; Lightning: a service or product provider has no incentive to attack its&#xA;&gt; customers (&#34;the customer is always right&#34;), but have an incentive to&#xA;&gt; *pretend* to be a customer of a competitor and attack them.)&#xA;&gt;&#xA;&gt; We will keep this fact in mind: active griefing attacks are attacks *on*&#xA;&gt; intermediate nodes, not *by* intermediate nodes, because there is no&#xA;&gt; economic incentive for intermediate nodes to attack their customers.&#xA;&gt;&#xA;&gt; Previous Proposed Solutions&#xA;&gt; ===========================&#xA;&gt;&#xA;&gt; Time-Spent Reporting&#xA;&gt; --------------------&#xA;&gt;&#xA;&gt; At each channel along the route, the time spent by a node to handle its&#xA;&gt; forwarding is recorded, and reported upstream in the route.&#xA;&gt;&#xA;&gt; Unfortunately, this solution protects payers from intermediate nodes and&#xA;&gt; payees: it does not protect intermediate nodes from colluding payers and&#xA;&gt; payees.&#xA;&gt; Even if an intermediate node knows that a particular node is consistently&#xA;&gt; slow via a previous time-spent report, it will not be able, with our&#xA;&gt; current onion routing, determine if an onion packet it just received will&#xA;&gt; or will not go through the known-slow node.&#xA;&gt; Thus, an intermediate node would not be able to defend against distant&#xA;&gt; payees that, with a colluding payer, will not claim a particular payment.&#xA;&gt;&#xA;&gt; As we have established, an active griefing atttack will never be&#xA;&gt; deliberately performed by a selfishly-rational intermediate node.&#xA;&gt; Thus, this solution protects against the wrong thing: it protects payers&#xA;&gt; against slow/unreliable intermediate nodes, it does not protect&#xA;&gt; intermediate nodes against malicious payer/payee collusions.&#xA;&gt; It protects only against intermediate nodes that inadvertently go offline&#xA;&gt; during forwarding, but such nodes will inevitably lose out on the&#xA;&gt; forwarding market anyway, and will disappear in the long run.&#xA;&gt;&#xA;&gt; Up-Front Payment&#xA;&gt; ----------------&#xA;&gt;&#xA;&gt; Payers pay for an attempt, not just the successful completion of an&#xA;&gt; attempt.&#xA;&gt;&#xA;&gt; A variation on this is that the payer (or payee) continuously pays as long&#xA;&gt; as the payment is pending.&#xA;&gt; Further variations include paying by other means, such as just locking&#xA;&gt; funds or paying with proof-of-work.&#xA;&gt;&#xA;&gt; While it certainly erects economic barriers against payer/payee collusions&#xA;&gt; attacking intermediate nodes, it *also* erects economic barriers against&#xA;&gt; normal, non-malicious payments.&#xA;&gt;&#xA;&gt; We can consider that economic barriers against non-malicious, low-value,&#xA;&gt; high-frequency payments (&#34;micropayments&#34;) may be enough that such payments&#xA;&gt; become infeasible if we impose up-front payment for mere attempts.&#xA;&gt; Thus, while this solution is certainly something we can consider, we must&#xA;&gt; be reluctant to use it due to its up-front, strict-evaluation behavior.&#xA;&gt;&#xA;&gt; Proof-Of-Closure&#xA;&gt; ================&#xA;&gt;&#xA;&gt; Observing the above, we want the properties for a &#34;good&#34; solution to&#xA;&gt; griefing attacks to be:&#xA;&gt;&#xA;&gt; * It should protect intermediate nodes against payer/payee collusions.&#xA;&gt; * It should only come into play upon detection of an attack.&#xA;&gt;&#xA;&gt; We now present proof-of-closure, which (we hope) has the above properties.&#xA;&gt;&#xA;&gt; We can consider instead a softer timeout, distinct from the HTLC&#xA;&gt; block-based timeout.&#xA;&gt; This softer timeout is measurable in fractions of a second, e.g. units of&#xA;&gt; 0.1 seconds.&#xA;&gt;&#xA;&gt; Each node on the network advertises, in addition to a block-based&#xA;&gt; `cltv_delta`, a `timeout_delta` in units of 0.1 seconds.&#xA;&gt; Further, each invoice contains, in addition to a block-based `final_cltv`,&#xA;&gt; a `final_timeout` in units of 0.1 seconds.&#xA;&gt;&#xA;&gt; Thus, there are two timeouts:&#xA;&gt;&#xA;&gt; * The current &#34;hard&#34; block-based timeout that is enforceable onchain.&#xA;&gt; * A new &#34;soft&#34; sidereal-time-based timeout that is not onchain enforceable.&#xA;&gt;&#xA;&gt; The soft timeout, as mentioned, is not enforceable onchain.&#xA;&gt; Instead, enforcement of the soft timeout *is* the act of putting the&#xA;&gt; channel state onchain.&#xA;&gt;&#xA;&gt; Now, for the current &#34;hard&#34; block-based timeout, we already have a&#xA;&gt; reaction.&#xA;&gt; If the HTLC &#34;hard&#34; timeout is approaching:&#xA;&gt;&#xA;&gt; * Drop the channel onchain and enforce the hard timeout onchain to reclaim&#xA;&gt; the funds in the HTLCs.&#xA;&gt; * Wait for the onchain action to be deeply resolved (either timelock or&#xA;&gt; hashlock branch is confirmed deeply) and report the result (success or&#xA;&gt; fail) upstream.&#xA;&gt;&#xA;&gt; What happens if the &#34;soft&#34; timeout is violated?&#xA;&gt;&#xA;&gt; * Drop the channel onchain.&#xA;&gt; * Report the channel closure upstream.&#xA;&gt;&#xA;&gt; The &#34;hard&#34; timeout is cancelled in any of these two conditions:&#xA;&gt;&#xA;&gt; * A success is reported via `update_fulfill_htlc`, OR,&#xA;&gt; * A failure is reported via `update_fail_htlc` AND the HTLC is irrevocably&#xA;&gt; removed from the latest commitments/state(s) of the channel.&#xA;&gt;&#xA;&gt; The &#34;soft&#34; timeout is cancelled in any of these three conditions, the&#xA;&gt; first two of which are the same as above:&#xA;&gt;&#xA;&gt; * A success is reported via `update_fulfill_htlc`, OR,&#xA;&gt; * A failure is reported via `update_fail_htlc` AND the HTLC is irrevocably&#xA;&gt; removed from the latest commitments/state(s) of the channel, OR&#xA;&gt; * A channel closure is reported.&#xA;&gt;&#xA;&gt; Let us fill this in more detail.&#xA;&gt;&#xA;&gt; Suppose we have a payment route A-&gt;B-&gt;C-&gt;E.&#xA;&gt;&#xA;&gt; Both the &#34;hard&#34; block timeouts and the &#34;soft&#34; second timeouts decrement&#xA;&gt; monotonically at each hop.&#xA;&gt; Thus, the payee E has the shortest &#34;hard&#34; and &#34;soft&#34; timeouts (as normal).&#xA;&gt;&#xA;&gt; * Suppose E then delays claiming the payment and violates the &#34;soft&#34;&#xA;&gt; timeout.&#xA;&gt; * C then drops the CE channel onchain.&#xA;&gt; * C reports, before its own timeout (slightly larger than the timeout&#xA;&gt; imposed on E), the closing of the channel CE, to B.&#xA;&gt; * B validates this report, and if valid, propagates the report to A.&#xA;&gt; * A validates this report, and if valid, accepts that the payment will be&#xA;&gt; &#34;stuck&#34; for up to the hard timeout it imposed on B.&#xA;&gt;&#xA;&gt; C has to report back to B in order to prevent B from closing the BC&#xA;&gt; channel, and B has to report back to A in order to prevent A from closing&#xA;&gt; the AB channel.&#xA;&gt; The decrementing seconds-unit timeouts are needed for each hop, for the&#xA;&gt; same reason that decrementing block-unit timeouts are needed.&#xA;&gt;&#xA;&gt; Since E is motivated to attack intermediate nodes because it wants to&#xA;&gt; redirect payment forwards through itself rather than its competitotrs,&#xA;&gt; having one of its channels closed (which prevents it from being used for&#xA;&gt; forwarding) is directly opposed to its end goal of getting more money,&#xA;&gt; thus, we can believe the action of closing a channel involved in a griefing&#xA;&gt; attack is sufficient disincentive.&#xA;&gt;&#xA;&gt; The major drawback is that enforcement of the soft timeout *is* a channel&#xA;&gt; closure, which is generally a negative for the network.&#xA;&gt; This is not a remote attack vector, since a node can only trigger this&#xA;&gt; closure if it is able to stall the fulfillment or failure of an HTLC on a&#xA;&gt; channel, which generally means the node triggering this closure can only do&#xA;&gt; so for its own channels (or it is able to, via a separate mechanism,&#xA;&gt; remotely crash a different node).&#xA;&gt;&#xA;&gt; Proving Channel Closes&#xA;&gt; ----------------------&#xA;&gt;&#xA;&gt; What C *really* needs to prove is that:&#xA;&gt;&#xA;&gt; * It is *willing* to close a channel due to a violation of the soft&#xA;&gt; timeout.&#xA;&gt; * The channel it is willing to close was, in fact, involved in the same&#xA;&gt; payment attempt.&#xA;&gt;&#xA;&gt; With the above, B can believe that C was innocent of wrongdoing, because:&#xA;&gt;&#xA;&gt; * C would only be wiling to close a channel in case of a protocol&#xA;&gt; violation, in this case, a violation of the soft timeout.&#xA;&gt; * The channel it closed was closed because of this payment attempt, and&#xA;&gt; not because of another payment attempt, or some other unrelated channel&#xA;&gt; being unilaterally closed.&#xA;&gt;&#xA;&gt; First, what C needs to prove is *NOT*, in fact, actual channel closure: it&#xA;&gt; needs to prove a *willingness* to close a channel.&#xA;&gt; Thus, it does not require the channel to actually be *closed* yet, i.e. it&#xA;&gt; does not have to wait for onchain activity that the channel closure is in a&#xA;&gt; mempool and is confirmed deeply onchain etc etc.&#xA;&gt;&#xA;&gt; Thus, to prove a *willingness to close* rather than an actual close, C can&#xA;&gt; provide the unilateral close of the channel CE.&#xA;&gt; The act of unilaterally closing a channel is the publication of the&#xA;&gt; transaction(s) making up the unilateral close.&#xA;&gt; Thus, if C is *willing* to close the channel, it is willing to publish the&#xA;&gt; transaction(s) involved, and thus, providing the unilateral close to B and&#xA;&gt; further upstream, shows a willingness to close the channel.&#xA;&gt;&#xA;&gt; B then validates the provided proof-of-closure by checking that the&#xA;&gt; unilateral close transaction is either onchain, in the mempool, or that it&#xA;&gt; spends a TXO that is not currently spent by another transaction.&#xA;&gt; In the case the unilateral close transaction is not confirmed and in the&#xA;&gt; mempool, B can speed up its propagation on the Bitcoin layer by putting it&#xA;&gt; in its own mempool as well --- after all, C is willing to close the channel&#xA;&gt; to exonerate itself and punish the actual culprit, and B putting the&#xA;&gt; unilateral close in its own mempool can only help C in what it is willing&#xA;&gt; to do.&#xA;&gt;&#xA;&gt; Secondly, C needs to prove that the channel it is willing to close&#xA;&gt; involves the payment attempt, and is not some other channel closure that it&#xA;&gt; is attempting to use to fulfill its own soft timeout.&#xA;&gt; Since the unilateral close transaction *is* the proof-of-closure, B (and&#xA;&gt; A) can inspect the transaction outputs and see (with some additional data&#xA;&gt; from C) that one of the outputs is to an HTLC that matches the payment hash.&#xA;&gt;&#xA;&gt; Thus, B (and A) can believe that the proof-of-closure proves that whoever&#xA;&gt; is presenting it is free of wrongdoing, as whoever is actually causing the&#xA;&gt; delay has been punished (by someone being willing to close a channel with&#xA;&gt; the culprit), and that the proof-of-closure commits to this particular&#xA;&gt; payment attempt and no other (because it commits to a particular payment&#xA;&gt; hash).&#xA;&gt;&#xA;&gt; Further, if CE is closed by E dropping it onchain rather than C, C will&#xA;&gt; still be able to fulfill its own soft timeout by taking the closing&#xA;&gt; transaction from E, which should still contain the HTLC.&#xA;&gt; Indeed, neither A nor B will particularly care (nor need to know) who&#xA;&gt; dropped the channel onchain, or (for A) that the channel participants are C&#xA;&gt; and E.&#xA;&gt;&#xA;&gt; Update State Shenanigans&#xA;&gt; ------------------------&#xA;&gt;&#xA;&gt; Bitcoin update mechanisms are complicated things, and it may be possible&#xA;&gt; for an attacking payee E to fool around with the update state machine to&#xA;&gt; make it difficult for C to report a willingness to close CE.&#xA;&gt;&#xA;&gt; In particular, I quote here the relevant passages from `lightning-rfc`,&#xA;&gt; `02-peer-protocol.md`, which is an implementation of the Poon-Dryja update&#xA;&gt; mechanism:&#xA;&gt;&#xA;&gt; &gt; Thus each update traverses through the following states:&#xA;&gt; &gt;&#xA;&gt; &gt; 1. pending on the receiver&#xA;&gt; &gt; 2. in the receiver&#39;s latest commitment transaction&#xA;&gt; &gt; 3. ... and the receiver&#39;s previous commitment transaction has been&#xA;&gt; revoked,&#xA;&gt; &gt;    and the update is pending on the sender&#xA;&gt; &gt; 4. ... and in the sender&#39;s latest commitment transaction&#xA;&gt; &gt; 5. ... and the sender&#39;s previous commitment transaction has been revoked&#xA;&gt;&#xA;&gt; The payee E is the &#34;receiver&#34; in this context.&#xA;&gt;&#xA;&gt; In this case, once the update has reached step 2, then E has a commitment&#xA;&gt; transaction that it can put onchain, that contains an HTLC it can claim.&#xA;&gt; From this step onward, C cannot send a failure (i.e. it cannot send back&#xA;&gt; an `update_fail_htlc`) back to B, because E could drop its latest&#xA;&gt; commitment onchain and claim the HTLC onchain.&#xA;&gt;&#xA;&gt; However, until step 4, C does not have a unilateral close containing the&#xA;&gt; HTLC, and thus cannot provide a proof-of-closure that contains an HTLC that&#xA;&gt; refers to the payment.&#xA;&gt;&#xA;&gt; Thus, between steps 2 to 4, C cannot safely respond to its own soft&#xA;&gt; timeout.&#xA;&gt; C cannot respond with a failure, as E could then drop its latest&#xA;&gt; commitment transaction onchain and claim the payment from C, and extract&#xA;&gt; money from C that way.&#xA;&gt; C also cannot respond with a proof-of-closure, as it does not have a&#xA;&gt; transaction that it can use to provide this proof.&#xA;&gt;&#xA;&gt; The best that C can do would be to impose an even shorter timeout between&#xA;&gt; steps 2 and 4 above, and to drop its current commitment transaction (which&#xA;&gt; does not contain the HTLC yet and thus does not constitute a valid&#xA;&gt; proof-of-closure) onchain.&#xA;&gt; In between the time it drops the commitment transaction and its own&#xA;&gt; incoming soft timeout, there is a chance, however small, that this&#xA;&gt; transaction will be confirmed, and the channel will (with high probability)&#xA;&gt; settle in a state where the HTLC is not instantiated, thus C can safely&#xA;&gt; fail its incoming HTLC (not show a proof-of-closure, since that is not&#xA;&gt; possible for C to do) without risk of loss, just prior to its own soft&#xA;&gt; timeout.&#xA;&gt;&#xA;&gt; Of course, C is still at risk here: E could collude with miners via a&#xA;&gt; side-channel fee offer to confirm its commitment transaction with the HTLC&#xA;&gt; present, and ensure that C is liable for the HTLC value.&#xA;&gt;&#xA;&gt; With Decker-Russell-Osuntokun, we can remove this risk by requiring a&#xA;&gt; ritual as follows:&#xA;&gt;&#xA;&gt; 1.  C requests exclusive access to update their single shared state.&#xA;&gt;   * This can be done via a variety of sub-protocols, including a fair coin&#xA;&gt; toss in case of near-simultaneous requests for exclusive locks on both&#xA;&gt; sides.&#xA;&gt; 2.  C provides the details of the new HTLC to E.&#xA;&gt; 3.  C and E generate the new state transaction and exchange signatures for&#xA;&gt; it.&#xA;&gt; 4.  C and E generate (without signing) the new update transaction.&#xA;&gt; 5.  E provides the signature (or share of signature, if MuSig) for the new&#xA;&gt; update transaction to C.&#xA;&gt; 6.  C provides the signature for the new update transaction to E, which&#xA;&gt; releases the exclusive lock on the shared state atomically with the&#xA;&gt; finalization of the new update transaction.&#xA;&gt;&#xA;&gt; Prior to step 5, C can simply fail the incoming HTLC from B in case its&#xA;&gt; own soft timeout is near.&#xA;&gt; Even if E performs step 5 after C has already failed the incoming HTLC&#xA;&gt; from B, C can simply not perform step 6 and drop the channel onchain with&#xA;&gt; the previous update and state transactions.&#xA;&gt;&#xA;&gt; With Poon-Dryja, we will have to rearrange the order in which we perform&#xA;&gt; things, effectively adding an extra communications turnaround between the&#xA;&gt; participants.&#xA;&gt; Specifically, the order would have to be revised to:&#xA;&gt;&#xA;&gt; &gt; 1. pending on the sender&#xA;&gt; &gt; 2. in the sender&#39;s latest commitment transaction&#xA;&gt; &gt; 3. ... and the sender&#39;s previous commitment transaction has been revoked,&#xA;&gt; &gt;    and the update is pending on the receiver&#xA;&gt; &gt; 4. ... and in the receiver&#39;s latest commitment transaction&#xA;&gt; &gt; 5. ... and the receiver&#39;s previous commitment transaction has been&#xA;&gt; revoked&#xA;&gt;&#xA;&gt; This allows the sender (C in our context) to provide a proof-of-closure&#xA;&gt; after step 2, and before step 2, C can safely return a failure with&#xA;&gt; `update_fail_htlc` (and refuse to proceed beyond step 2, thus ensuring it&#xA;&gt; can still use the previous commitment that still has no HTLC).&#xA;&gt;&#xA;&gt; Of course, this change will require redesigning the update state machine,&#xA;&gt; increasing the number of communication turnarounds, and creating a subtle&#xA;&gt; incompatbility when transitioning a payment from a hop that knows only the&#xA;&gt; old update state machine to a hop that knows the new update state machine.&#xA;&gt;&#xA;&gt; Purely Falsified Proof-Of-Closure&#xA;&gt; ---------------------------------&#xA;&gt;&#xA;&gt; Of course, the attacking node E might want to create a false&#xA;&gt; proof-of-closure.&#xA;&gt; E can do this by simulating a Lightning channel: lock an amount of funds&#xA;&gt; in a 2-of-2 (where E controls both keys), then spend it in a set of&#xA;&gt; transactions mimicking the unilateral close.&#xA;&gt;&#xA;&gt; We observe, however, that the overhead of simulating a Lightning channel&#xA;&gt; is the same as the overhead of actually creating and closing a Lightning&#xA;&gt; channel.&#xA;&gt; Since the punishment of proof-of-closure is to force attackers to have&#xA;&gt; their channels closed, we can consider that this simulation of a channel&#xA;&gt; open and close is sufficient as well.&#xA;&gt;&#xA;&gt; Future-Proofing&#xA;&gt; ---------------&#xA;&gt;&#xA;&gt; This sketch of proof-of-closure can be used for any update mechanism:&#xA;&gt;&#xA;&gt; * With Poon-Dryja, C can use its own commitment transaction as the&#xA;&gt; proof-of-closure.&#xA;&gt; * With Decker-Wattenhofer, C can give all the offchain transactions up to&#xA;&gt; the last stage in the multi-stage decrementing-`nSequence` mechanism.&#xA;&gt; * With Deckker-Russell-Osuntokun, C can give the latest update and state&#xA;&gt; trnsaction.&#xA;&gt;&#xA;&gt; Basically, we expect that for now, and in the future, any update mechanism&#xA;&gt; worth consideration will have a concept of &#34;unilateral close&#34; where a&#xA;&gt; channel can be dropped onchain, using data that only one of the channel&#xA;&gt; participants holds.&#xA;&gt;&#xA;&gt; Such a unilateral close will be a sequence of one or more valid&#xA;&gt; transactions, terminating in a transaction containing an HTLC-like contract&#xA;&gt; in one of its outputs.&#xA;&gt;&#xA;&gt; Thus, to validate the unilateral close, it is only required to validate&#xA;&gt; all the transactions contained in the proof-of-closure, and see that the&#xA;&gt; last transaction has an HTLC output.&#xA;&gt;&#xA;&gt; The limitations are thus:&#xA;&gt;&#xA;&gt; * The acceptable forms of HTLC would need to be agreed-upon by the entire&#xA;&gt; network.&#xA;&gt; * Implementations would need to be able to assess, in a&#xA;&gt; Bitcoin-consensus-compatible way, whether a transaction is valid or not.&#xA;&gt;&#xA;&gt; Payment Decorrelation and Payment Points&#xA;&gt; ----------------------------------------&#xA;&gt;&#xA;&gt; Of course, having a single payment hash for the entire payment attempt is&#xA;&gt; a privacy loss, which we intend to fix in the near future by using payment&#xA;&gt; points, and adding a blinding scalar at each hop, aka. payment&#xA;&gt; decorrelation.&#xA;&gt;&#xA;&gt; Thus, in the future, there will not be any HTLC, but instead a PTLC.&#xA;&gt; Further, the payment point at each hop will be changed at each hop, in&#xA;&gt; order to prevent decorrelation.&#xA;&gt;&#xA;&gt; Thus, C needs to provide proofs:&#xA;&gt;&#xA;&gt; * That an apparent singlesig on the unilateral close output is in fact a&#xA;&gt; PTLC.&#xA;&gt;   C needs to provide:&#xA;&gt;   * A target point P.&#xA;&gt;   * A partial signature that would spend that singlesig for a particular&#xA;&gt; sighash.&#xA;&gt;   * An adaptor signature which, with knowledge of the completed signature,&#xA;&gt; adaptor signature, and sighash message, would have revealed the scalar&#xA;&gt; behind P.&#xA;&gt; * That the PTLC belongs to the same payment attempt as what B offered to C.&#xA;&gt;   C needs to provide:&#xA;&gt;   * The C-only blinding factor that is the difference between the payment&#xA;&gt; point of the B-to-C PTLC and the C-to-E PTLC on the unilateral close.&#xA;&gt;&#xA;&gt; Then, when B needs to propagate the proof-of-closure back to A, B simply&#xA;&gt; adds its own blinding factor to the reported blinding factor, in order to&#xA;&gt; convince A that this is the same payment attempt.&#xA;&gt;&#xA;&gt; As we have brought up privacy, we observe that, when this mechanism&#xA;&gt; triggers, there is a mild privacy loss, in that intermediate nodes now know&#xA;&gt; some channel closure that is related to this payment, and can thus&#xA;&gt; determine the exact path that the payment attempt went through, at least&#xA;&gt; until the channel being closed.&#xA;&gt; However, proof-of-closure is only propagated in case of violation of the&#xA;&gt; soft timeout, so for normal non-malicious payments, proof-of-closure does&#xA;&gt; not cause any privacy loss.&#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/20200401/082a44f1/attachment-0001.html&gt;</html></oembed>