Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Two-party eltoo w/ punishment

7 messages, Dec 7, 2022, to Jan 6, 2023. Started by Anthony Towns.

Anthony Towns (3), Antoine Riard (3), Greg Sanders

Permalink First message in the Wayback Machine

Anthony Towns permalink original

Hi all,

On the eltoo irc channel we discussed optimising eltoo for the 2-party scenario; figured it was probably worth repeating that here.

This is similar to:

 - 2018-07-18, simplified eltoo: https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2018/eltoo-a-simplified-update-mechanism-for-lightning-and-off-chain-contracts#m-a2f01009
 - 2021-09-17, IID 2Stage, https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019470.html
 - 2022-09-29, Daric: https://eprint.iacr.org/2022/1295
 - 2022-10-21, eltoo/chia: https://twitter.com/bramcohen/status/1583122833932099585

The basic idea is "if it's a two party channel with just Alice and Bob, then if Alice starts a unilateral close, then she's already had her say, so it's only Bob's opinion that matters from now on, and he should be able to act immediately", and once it's only Bob's opinion that matters, you can simplify a bunch of things.

A "gist" for this idea is https://gist.github.com/ajtowns/53e0f735f4d5c06a681429d937200aa5 (it goes into a little more detail in places, though doesn't cover trustless watchtowers at all).

In particular, there are a few practical constraints that we might like to consider for 2-party channels with eltoo:

 - fast forwards: we might want to allow our channel partner
   to immediately rely on a new state we propose without needing a
   round-trip delay -- this potentially makes forwarding payments much
   faster (though with some risk of locking the funds up, if you do a
   fast forward to someone who's gone offline)
 - doubled delays: once we publish the latest state we can, we want to
   be able to claim the funds immediately after to_self_delay expires;
   however if our counterparty has signatures for a newer state than we
   do (which will happen if it was fast forwarded), they could post that
   state shortly before to_self_delay expires, potentially increasing
   the total delay to 2*to_self_delay.
 - penalties: when you do a unilateral close, attempting to cheat comes
   with no cost to you and a possible benefit if you succeed, but
   potentially does cost your channel partner (either in forcing them
   to spend on-chain fees to update to the correct state, or in the risk
   of loss if their node malfunctions occassionally) -- a penalty could
   reduce this incentive to cheat
 - trustless watchtowers: we may want to consider the possibility of a
   watchtower holding onto obsolete states and colluding with an
   attacker to attempt to cheat us

What follows is a rough approach for dealing with all those issues for two-party channels. It's spelled out in a little more detail in the gist.

(I think for initial eltoo experimentation it doesn't make sense to try to deal with all (or perhaps any) of those constraints; simple and working is better than complex and theoretical. But having them written down so the ideas can be thought about and looked up later still seems useful)

In more detail: unilateral closes are handled by each channel participant maintaining five transactions, which we'll call:

 * UA.n, UB.n : unilaterally propose closing at state n
   - this is for Alice or Bob to spend the funding tx for a unilater
     close to state n. Spends the funding transaction.
 * WA.n, WB.n : watchtower update to state n
   - this is for an untrusted watchtower to correct attempted cheating
     by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
     (or UA.k/WB.k) respectively, provided k < n.
 * CA.n, CB.n : cooperatively claim funds according to state n
   - this is for Alice to confirm Bob's unilateral close (or vice-versa).
     Spends UB.k, WA.k (or UA.k/WB.k respectively), provided k <= n
 * SA.n, SB.n : slowly claim funds according to state n
   - this is for Alice to claim her funds if Bob is completely offline
     (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
     timelock of to_self_delay.
 * RA.n, RB.n : claim funds with penalty after unilateral close to
   revoked state
   - this is for Alice to update the state if Bob attempted to cheat
     (or vice-versa). Spends UB.k or WA.k (or UA.k/WB.k respectively)
     conditional on k < n - 1; outputs are adjusted to transfer a fixed
     penalty of penalty_msat from Bob's balance to Alice's (or vice-versa)

Each of these "transactions" requires a pre-signed signature; however the actual transaction/txid will vary in cases where a transaction has the possibility of spending different inputs (eg "Spends UB.k or WA.k"). In particular UA.n/UB.n can be constructed with known txids and non-APO signatures but WA.n/WB.n/CA.n/CB.n/SA.n/SB.n/RA.n/RB.n all require APO signatures.

They're named such that Alice can immediately broadcast all the *A.n transactions (provided a tx that it can spend has been broadcast) and Bob can likewise immediately broadcast all the *B.n transactions.

Scenarios where Alice decides to unilaterally close the channel might look like:

 * if Alice/Bob can't communicate directly, but both are online:
     F -> UA.n -> CB.n -> money
   (balances and htlcs claimed, no delay)
 * if Bob has gone offline entirely:
     F -> UA.n -> (to_self_delay) -> SA.n -> money
 * Alice cheats, Bob punishes:
     F -> UA.k -> RB.n -> money[Alice pays Bob penalty]
 * Bob is offline, Alice cheats, but Bob has a watchtower:
     F -> UA.k -> WB.n -> (to_self_delay) -> SA.n -> money
 * Alice and Bob's watchtower collude, but Bob's not offline:
     F -> UA.k1 -> WB.k2 -> RB.n -> money[Alice pays Bob penalty]
 * Alice and Bob's watchtower collude, but Bob has many watchtowers:
     F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money

For Alice to successfully cheat, she needs Bob to be offline for at least to_self_delay, and for all Bob's watchtowers to either also be offline, or colluding.

This can be simplified somewhat, if you don't care about all the features:

 * If you don't care about trustless watchtowers you can drop WA.n/WB.n
   (and simplify SA.n/SB.n to not require an APO signature)
 * If you don't care about penalties you can set penalty_msat to 0 and
   allow RA.n/RB.n to spend k<=n. In this case, you can either drop
   CA.n/CB.n entirely, or you can have CA.n/CB.n only be used for directly
   spending of UB.n/UA.n and thus not require APO signatures

In order to allow fast-forwards, when Alice proposes a new state, she needs to send her partial signatures to allow Bob to unilaterally accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she also needs to be able to claim the funds if Bob proposes the new state and broadcasts UB.n, she needs to be able broadcast CA.n. This can be achieved with an adaptor signature approach (spelt out a bit more fully in the gist) or a CTV-like approach, provided that UB.n reveals the state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md).

Note that in this scenario Alice doesn't provide WB.n to Bob immediately. This is okay, as if Alice proposes UA.(n-1) (her most recent state), Bob can still immediately claim via CA.n. If Bob did have WB.n; then if Alice proposed UA.(n-1) Bob could wait for an initial to_self_delay period and broadcast WB.n, forcing Alice to wait for an additional to_self_delay before being able to claim her funds via SA.n.

Note also that this is why RA.n/RB.n require "k < n - 1" -- otherwise Alice would only be able to broadcast UA.(n-1) and Bob would immediately be able to penalise by broadcasting RB.n.

Note that if you're using a watchtower and wish to punish your counterparty if it attempts to cheat, you should only pass WA.(n-2) to your watchtowers, not WA.(n-1) or WA.n.

This doesn't address any potential issues from:

 * how to add fees -- the U/W transactions are 1-in/1-out transactions
   that can't be trivially CPFPed by the proposer and need to have
   fees added (either SINGLE/ANYONECANPAY signatures or having a 0-sat
   ephemeral output and package relay might be workable); the C/S/R
   transactions are 1-in/many-out transactions, but have balance outputs
   that can be immediately spent to pay for fees via CPFP if package
   relay is available.
 * how to pay watchtowers -- when a watchtower broadcasts a W
   transaction, it needs to add fees, and it's not clear (to me) how it
   could fairly and reliably ensure it's compensated for those costs,
   particularly if multiple W transactions are broadcast for a single
   unilateral close attempt, due to one or more watchtowers colluding
   with an attacker, or simply having out of date information.
 * lack of layered transactions -- while this prevents you having to
   wait longer than to_self_delay before you can claim channel funds,
   it still means that any htlc that is going to timeout sooner than that
   may not be claimable on-chain, meaning you need to set
   cltv_expiry_delta >= to_self_delay.
 * extending to multiparty channels -- penalising is hard if there's
   more than two parties, fast forwards are probably impossible since
   you need multiple round-trips to coordinate signatures anyway, and if
   you're doing channels-within-channels to reduce your n-party channel
   to an easier to update 2-party channel you're probably forced to have
   to_self_delay for each layer of channels. Also, just figuring out how
   to coordinate multiparty state updates and even keeping everyone in
   a multiparty channel online consistently to generate new signatures
   seems potentially hard?

Cheers, aj

Antoine Riard in reply to Anthony Towns permalink original

Hi AJ,

The eltoo irc channel is ##eltoo on Libera chat.

Quoted text (1 line)
>  - 2022-10-21, eltoo/chia:

https://twitter.com/bramcohen/status/1583122833932099585

On the eltoo/chia variant, from my (quick) understanding, the main innovation aimed for is the limitation of the publication of eltoo states more than once by a counterparty, by introducing a cryptographic puzzle, where the witness can be produced once and only once ? I would say you might need the inheritance of the updated scriptpubkey across the chain of eltoo states, with a TLUV-like mechanism.

Quoted text (6 lines)
> The basic idea is "if it's a two party channel with just Alice and Bob,
> then if Alice starts a unilateral close, then she's already had her say,
> so it's only Bob's opinion that matters from now on, and he should be
> able to act immediately", and once it's only Bob's opinion that matters,
> you can simplify a bunch of things.

>From my understanding, assuming Eltoo paper terminology, Alice can publish

an update K transaction, and then after Bob can publish an update transaction K<N or Alice can publish the settlement transaction N, or Bob can publish an update transaction N. The main advantage of this construction I can see is a strict bound on the shared_delay encumbered in the on-chain publication of the channel ?

Quoted text (5 lines)
> fast forwards: we might want to allow our channel partner
> to immediately rely on a new state we propose without needing a
> round-trip delay -- this potentially makes forwarding payments much
> faster (though with some risk of locking the funds up, if you do a
> fast forward to someone who's gone offline)

IIRC, there has already been a "fast-forward" protocol upgrade proposal based on update-turn in the LN-penalty paradigm [0]. I think reducing the latency of HTLC propagation across payment paths would constitute a UX improvement, especially a link-level update mechanism upgrade deployment might be incentivized by routing algorithms starting to penalize routing hops HTLC relay latency. What is unclear is the additional risk of locking the funds up. If you don't receive acknowledgement the fast forward state has been received, you should still be able to exit with the state N-1 ? However, the fast-forward trade-off might sound acceptable, with time you might expect reliable routing hops in the core of the graph, and flappy spokes at the edge.

Quoted text (6 lines)
> doubled delays: once we publish the latest state we can, we want to
> be able to claim the funds immediately after to_self_delay expires;
> however if our counterparty has signatures for a newer state than we
> do (which will happen if it was fast forwarded), they could post that
> state shortly before to_self_delay expires, potentially increasing
> the total delay to 2*to_self_delay.

While the 2*to_self_delay sounds the maximum time delay in the state publication scenario where the cheating counterparty publishes a old state then the honest counterparty publishes the latest one, there could be the case where the cheating counterparty broadcast chain of old states, up to mempool's `limitancestorcount`. However, this chain of eltoo transactions could be replaced by the honest party paying a higher-feerate (assuming something like nversion=3). I think there might still be an attack triggerable under certain economic conditions, where the attacker overbids with the higher-feerate transaction until the HTLC cltv expires. If this attack is plausible, it could be even opportun if you're batching against multiple channels, where the victims are not able to coordinate response.

Quoted text (6 lines)
> penalties: when you do a unilateral close, attempting to cheat comes
> with no cost to you and a possible benefit if you succeed, but
> potentially does cost your channel partner (either in forcing them
> to spend on-chain fees to update to the correct state, or in the risk
> of loss if their node malfunctions occassionally) -- a penalty could
> reduce this incentive to cheat

I think there has been a proposal in the past to enable penalties on top of symmetric states by leveraging asymmetric witnesses [1]. Further, I wonder if there is a game-theory interest for penalty-on-top-eltoo, it could be an incentive against laziness, where a dysfunctional trusted watchtower broadcasts an old state. On the qualification of the game-theory soundness, I think one would have to run the empirical case study: select channel counterparties randomly (no out-of-band assumptions), one set with eltoo+penalty and the other with vanilla eltoo, observe the broadcast of revoked states over some period.

Quoted text (3 lines)
> trustless watchtowers: we may want to consider the possibility of a
> watchtower holding onto obsolete states and colluding with an
> attacker to attempt to cheat us

In terms of pinning and other mempool games, I think honest participant own states leveraged by a colluding watchtower might increase the attack surface, especially post-anchor with the SIGHASH_SINGLE malleability on second-stage HTLC transactions.

Quoted text (4 lines)
> (I think for initial eltoo experimentation it doesn't make sense to try to
> deal with all (or perhaps any) of those constraints; simple and working
> is better than complex and theoretical. But having them written down so
> the ideas can be thought about and looked up later still seems useful)

I share the belief -- "simple and working" enable shorter iteration cycles and hopefully fasten the protocol design learning curve. Beyond, I think it's also realistic in face of the state of the LN ecosystem, especially on the watchtower issue. AFAICT, there is no even multi trusted watchtower design covering the full execution of the protocol (i.e including HTLC-preimage/ HTLC-timeout claim), and such implementation is far from simple, as from now on you LN's chain backend might have asynchronicity issue to solve between your on-chain monitoring state machine (at least speaking in knowledge of the LDK-architecture).

Quoted text (4 lines)
> * WA.n, WB.n : watchtower update to state n
>   - this is for an untrusted watchtower to correct attempted cheating
>     by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
>     (or UA.k/WB.k) respectively, provided k < n.

I wonder if the introduction of watchtower specific transactions doesn't break the 2*to_self_delay assumption (iiuc it's a design goal of current protocol) and what is the design rationale. Beyond that, there is a concern with watchtower-specific transactions, it might leak your towers topology (i.e the number of them and the distribution in the p2p network) to an adversary.

Quoted text (4 lines)
> * SA.n, SB.n : slowly claim funds according to state n
>   - this is for Alice to claim her funds if Bob is completely offline
>     (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
>     timelock of to_self_delay.

If I'm following correctly the description, this is logically equivalent to the sweep of a `to_local`/`to_remote` output on a commitment transaction though instead the waiting delay is eltoo shared_delay. There is no to_self_delay, at the punishment seems only to happen on the update-level, or maybe one should be also able to punish slow fund exit, and another relative locktime should exist on the S* transactions.

Quoted text (3 lines)
> * Alice and Bob's watchtower collude, but Bob has many watchtowers:
>
>     F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money

Could the punishment transactions R* be also delegated to watchtowers, assuming they have been pre-signed to lockdown the exit scriptpubkeys ?

Quoted text (9 lines)
> In order to allow fast-forwards, when Alice proposes a new state,
> she needs to send her partial signatures to allow Bob to unilaterally
> accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she
> also needs to be able to claim the funds if Bob proposes the new state
> and broadcasts UB.n, she needs to be able broadcast CA.n. This can be
> achieved with an adaptor signature approach (spelt out a bit more fully
> in the gist) or a CTV-like approach, provided that UB.n reveals the
> state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in
>

https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md ).

If you would like to have fast forward of chain of transactions, I wonder if there could be also the "sig-in-the-script" trick, where UB.n scriptpubkey (or one of its tapscripts) contains the signature for CB.n, SB.n, RB.n. Though you might have an issue of re-generating the witnessscript in case of state loss.

Quoted text (7 lines)
> * how to add fees -- the U/W transactions are 1-in/1-out transactions
>   that can't be trivially CPFPed by the proposer and need to have
>   fees added (either SINGLE/ANYONECANPAY signatures or having a 0-sat
>   ephemeral output and package relay might be workable); the C/S/R
>   transactions are 1-in/many-out transactions, but have balance outputs
>   that can be immediately spent to pay for fees via CPFP if package
>   relay is available.

Assuming something like nversion=3, the SINGLE/ANYONCANPAY could be a viable fee-bumping mechanism, as ancestor-based pinning should be less of a concern. Ephemeral anchor output could be a more efficient direction, if the output value can be cooperatively inflated from the channel value, rather than relying on external fee-bumping reserves. I think even more efficient fee-bumping primitives can be introduced later.

Quoted text (6 lines)
> * how to pay watchtowers -- when a watchtower broadcasts a W
>   transaction, it needs to add fees, and it's not clear (to me) how it
>   could fairly and reliably ensure it's compensated for those costs,
>   particularly if multiple W transactions are broadcast for a single
>   unilateral close attempt, due to one or more watchtowers colluding
>   with an attacker, or simply having out of date information.

I wonder if paying a watchtower, or getting paid as a watchtower isn't a "counterparty risk" similar to what is happening with jamming due to non-covered HTLC forward risk. The watchtower has the risk of not being paid a posteriori and the user has the risk of the tower not acting. There is even a trade-off between tower costs and safety, as the more towers you have, more robust if your Lightning channel (in theory, as you also have a duplication of the key material).

Quoted text (6 lines)
> * lack of layered transactions -- while this prevents you having to
>   wait longer than to_self_delay before you can claim channel funds,
>   it still means that any htlc that is going to timeout sooner than that
>   may not be claimable on-chain, meaning you need to set
>   cltv_expiry_delta >= to_self_delay.

>From a security perspective, offsetting the cltv_expiry_delta to a value

superior to to_self_delay can be considered as an improvement, especially if it gradually does it network-wide. On the other hand, if routing algorithms start to penalize long-cltv-delta payment paths as the timevalue of liquidity is priced in routing fees, this design rationale might not be aligned with long-term LN network incentives (as of today even more loosely-defined than miner incentives).

Quoted text (9 lines)
> * extending to multiparty channels -- penalising is hard if there's
>   more than two parties, fast forwards are probably impossible since
>   you need multiple round-trips to coordinate signatures anyway, and if
>   you're doing channels-within-channels to reduce your n-party channel
>   to an easier to update 2-party channel you're probably forced to have
>   to_self_delay for each layer of channels. Also, just figuring out how
>   to coordinate multiparty state updates and even keeping everyone in
>   a multiparty channel online consistently to generate new signatures
>   seems potentially hard?

I don't know if penalising has been a solved issue for mulit-party, at least in a trustless fashion in the same way we have with 2-party LN-penalty (you could devise weird scheme based on timelock, taproot tree and threshold signatures incentivizing towards the convergence of a "consensus" punishment, still...) Figuring out coordinating multi-party states updates sounds workable with modern consensus algorithms (e.g Raft), though still conserving the fast forward effect is a high bar, it might be better deferred to an uplifted layer of 2-of-2 LN channels. The only reason you might have payments at the multi-party level (with the signature of the N-of-N participants requested) only for privacy or liquidity allocation reason. Though effectively, it sounds like your multiparty channel coordination mechanism should encompass party eviction or partitioning the offline parties. One or two orders of magnitude of complexity beyond the 2-party eltoo channel case, I think.

Antoine

[0] https://github.com/lightning/bolts/pull/867
[1] https://github.com/LLFourn/witness-asymmetric-channel

Le mer. 7 déc. 2022 à 00:36, Anthony Towns <aj at erisian.com.au> a écrit :

Quoted text (214 lines)
> Hi all,
>
> On the eltoo irc channel we discussed optimising eltoo for the 2-party
> scenario; figured it was probably worth repeating that here.
>
> This is similar to:
>
>  - 2018-07-18, simplified eltoo:
> https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2018/eltoo-a-simplified-update-mechanism-for-lightning-and-off-chain-contracts#m-a2f01009
>  - 2021-09-17, IID 2Stage,
> https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019470.html
>  - 2022-09-29, Daric: https://eprint.iacr.org/2022/1295
>  - 2022-10-21, eltoo/chia:
> https://twitter.com/bramcohen/status/1583122833932099585
>
> The basic idea is "if it's a two party channel with just Alice and Bob,
> then if Alice starts a unilateral close, then she's already had her say,
> so it's only Bob's opinion that matters from now on, and he should be
> able to act immediately", and once it's only Bob's opinion that matters,
> you can simplify a bunch of things.
>
> A "gist" for this idea is
> https://gist.github.com/ajtowns/53e0f735f4d5c06a681429d937200aa5 (it goes
> into a little more detail in places, though doesn't cover trustless
> watchtowers at all).
>
>
>
> In particular, there are a few practical constraints that we might like
> to consider for 2-party channels with eltoo:
>
>  - fast forwards: we might want to allow our channel partner
>    to immediately rely on a new state we propose without needing a
>    round-trip delay -- this potentially makes forwarding payments much
>    faster (though with some risk of locking the funds up, if you do a
>    fast forward to someone who's gone offline)
>
>  - doubled delays: once we publish the latest state we can, we want to
>    be able to claim the funds immediately after to_self_delay expires;
>    however if our counterparty has signatures for a newer state than we
>    do (which will happen if it was fast forwarded), they could post that
>    state shortly before to_self_delay expires, potentially increasing
>    the total delay to 2*to_self_delay.
>
>  - penalties: when you do a unilateral close, attempting to cheat comes
>    with no cost to you and a possible benefit if you succeed, but
>    potentially does cost your channel partner (either in forcing them
>    to spend on-chain fees to update to the correct state, or in the risk
>    of loss if their node malfunctions occassionally) -- a penalty could
>    reduce this incentive to cheat
>
>  - trustless watchtowers: we may want to consider the possibility of a
>    watchtower holding onto obsolete states and colluding with an
>    attacker to attempt to cheat us
>
> What follows is a rough approach for dealing with all those issues for
> two-party channels. It's spelled out in a little more detail in the gist.
>
> (I think for initial eltoo experimentation it doesn't make sense to try to
> deal with all (or perhaps any) of those constraints; simple and working
> is better than complex and theoretical. But having them written down so
> the ideas can be thought about and looked up later still seems useful)
>
> In more detail: unilateral closes are handled by each channel participant
> maintaining five transactions, which we'll call:
>
>  * UA.n, UB.n : unilaterally propose closing at state n
>    - this is for Alice or Bob to spend the funding tx for a unilater
>      close to state n. Spends the funding transaction.
>
>  * WA.n, WB.n : watchtower update to state n
>    - this is for an untrusted watchtower to correct attempted cheating
>      by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
>      (or UA.k/WB.k) respectively, provided k < n.
>
>  * CA.n, CB.n : cooperatively claim funds according to state n
>    - this is for Alice to confirm Bob's unilateral close (or vice-versa).
>      Spends UB.k, WA.k (or UA.k/WB.k respectively), provided k <= n
>
>  * SA.n, SB.n : slowly claim funds according to state n
>    - this is for Alice to claim her funds if Bob is completely offline
>      (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
>      timelock of to_self_delay.
>
>  * RA.n, RB.n : claim funds with penalty after unilateral close to
>    revoked state
>    - this is for Alice to update the state if Bob attempted to cheat
>      (or vice-versa). Spends UB.k or WA.k (or UA.k/WB.k respectively)
>      conditional on k < n - 1; outputs are adjusted to transfer a fixed
>      penalty of penalty_msat from Bob's balance to Alice's (or vice-versa)
>
> Each of these "transactions" requires a pre-signed signature; however
> the actual transaction/txid will vary in cases where a transaction has
> the possibility of spending different inputs (eg "Spends UB.k or WA.k").
> In particular UA.n/UB.n can be constructed with known txids and non-APO
> signatures but WA.n/WB.n/CA.n/CB.n/SA.n/SB.n/RA.n/RB.n all require
> APO signatures.
>
> They're named such that Alice can immediately broadcast all the *A.n
> transactions (provided a tx that it can spend has been broadcast) and
> Bob can likewise immediately broadcast all the *B.n transactions.
>
> Scenarios where Alice decides to unilaterally close the channel might
> look like:
>
>  * if Alice/Bob can't communicate directly, but both are online:
>
>      F -> UA.n -> CB.n -> money
>
>    (balances and htlcs claimed, no delay)
>
>  * if Bob has gone offline entirely:
>
>      F -> UA.n -> (to_self_delay) -> SA.n -> money
>
>  * Alice cheats, Bob punishes:
>
>      F -> UA.k -> RB.n -> money[Alice pays Bob penalty]
>
>  * Bob is offline, Alice cheats, but Bob has a watchtower:
>
>      F -> UA.k -> WB.n -> (to_self_delay) -> SA.n -> money
>
>  * Alice and Bob's watchtower collude, but Bob's not offline:
>
>      F -> UA.k1 -> WB.k2 -> RB.n -> money[Alice pays Bob penalty]
>
>  * Alice and Bob's watchtower collude, but Bob has many watchtowers:
>
>      F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money
>
> For Alice to successfully cheat, she needs Bob to be offline for at least
> to_self_delay, and for all Bob's watchtowers to either also be offline,
> or colluding.
>
> This can be simplified somewhat, if you don't care about all the features:
>
>  * If you don't care about trustless watchtowers you can drop WA.n/WB.n
>    (and simplify SA.n/SB.n to not require an APO signature)
>
>  * If you don't care about penalties you can set penalty_msat to 0 and
>    allow RA.n/RB.n to spend k<=n. In this case, you can either drop
>    CA.n/CB.n entirely, or you can have CA.n/CB.n only be used for directly
>    spending of UB.n/UA.n and thus not require APO signatures
>
> In order to allow fast-forwards, when Alice proposes a new state,
> she needs to send her partial signatures to allow Bob to unilaterally
> accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she
> also needs to be able to claim the funds if Bob proposes the new state
> and broadcasts UB.n, she needs to be able broadcast CA.n. This can be
> achieved with an adaptor signature approach (spelt out a bit more fully
> in the gist) or a CTV-like approach, provided that UB.n reveals the
> state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in
>
> https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md
> ).
>
> Note that in this scenario Alice doesn't provide WB.n to Bob
> immediately. This is okay, as if Alice proposes UA.(n-1) (her most
> recent state), Bob can still immediately claim via CA.n. If Bob did have
> WB.n; then if Alice proposed UA.(n-1) Bob could wait for an initial
> to_self_delay period and broadcast WB.n, forcing Alice to wait for an
> additional to_self_delay before being able to claim her funds via SA.n.
>
> Note also that this is why RA.n/RB.n require "k < n - 1" -- otherwise
> Alice would only be able to broadcast UA.(n-1) and Bob would immediately
> be able to penalise by broadcasting RB.n.
>
> Note that if you're using a watchtower and wish to punish your
> counterparty if it attempts to cheat, you should only pass WA.(n-2)
> to your watchtowers, not WA.(n-1) or WA.n.
>
>
>
> This doesn't address any potential issues from:
>
>  * how to add fees -- the U/W transactions are 1-in/1-out transactions
>    that can't be trivially CPFPed by the proposer and need to have
>    fees added (either SINGLE/ANYONECANPAY signatures or having a 0-sat
>    ephemeral output and package relay might be workable); the C/S/R
>    transactions are 1-in/many-out transactions, but have balance outputs
>    that can be immediately spent to pay for fees via CPFP if package
>    relay is available.
>
>  * how to pay watchtowers -- when a watchtower broadcasts a W
>    transaction, it needs to add fees, and it's not clear (to me) how it
>    could fairly and reliably ensure it's compensated for those costs,
>    particularly if multiple W transactions are broadcast for a single
>    unilateral close attempt, due to one or more watchtowers colluding
>    with an attacker, or simply having out of date information.
>
>  * lack of layered transactions -- while this prevents you having to
>    wait longer than to_self_delay before you can claim channel funds,
>    it still means that any htlc that is going to timeout sooner than that
>    may not be claimable on-chain, meaning you need to set
>    cltv_expiry_delta >= to_self_delay.
>
>  * extending to multiparty channels -- penalising is hard if there's
>    more than two parties, fast forwards are probably impossible since
>    you need multiple round-trips to coordinate signatures anyway, and if
>    you're doing channels-within-channels to reduce your n-party channel
>    to an easier to update 2-party channel you're probably forced to have
>    to_self_delay for each layer of channels. Also, just figuring out how
>    to coordinate multiparty state updates and even keeping everyone in
>    a multiparty channel online consistently to generate new signatures
>    seems potentially hard?
>
> Cheers,
> aj
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
Greg Sanders in reply to Antoine Riard permalink original

Antoine,

Quoted text (11 lines)
> While the 2*to_self_delay sounds the maximum time delay in the state
publication scenario where the cheating counterparty publishes a old state
then the honest counterparty publishes the latest one, there could be the
case where the cheating counterparty broadcast chain of old states, up to
mempool's `limitancestorcount`. However, this chain of eltoo transactions
could be replaced by the honest party paying a higher-feerate (assuming
something like nversion=3). I think there might still be an attack
triggerable under certain economic conditions, where the attacker overbids
with the higher-feerate transaction until the HTLC cltv expires. If this
attack is plausible, it could be even opportun if you're batching against
multiple channels, where the victims are not able to coordinate response.

Feel free to assume that we've worked around mempool pinning for all of these discussions, otherwise we're pretty hosed regardless. I'm implicitly assuming V3+ephemeral anchors, which disallows batched bumps, for example. You'll need to give some room for "slippage", but I think shared_delay/2*shared_delay is going to end up dominating UX in any non-layered scheme.

Quoted text (2 lines)
> I wonder if the introduction of watchtower specific transactions doesn't
break the 2*to_self_delay assumption

This architecture doesn't suffer from 2*self_delay, and each transition aside from Slow/Settle/SX.y has no relative timelock so that relative timelock is all that matters. It does introduce a watchtower cycle, so it's not longer a one-shot architecture, or even k-shot exactly, it ends up looking like vanilla eltoo for that single path.

Cheers, Greg

On Thu, Dec 8, 2022 at 2:14 PM Antoine Riard <antoine.riard at gmail.com> wrote:

Quoted text (450 lines)
> Hi AJ,
>
> The eltoo irc channel is ##eltoo on Libera chat.
>
> >  - 2022-10-21, eltoo/chia:
> https://twitter.com/bramcohen/status/1583122833932099585
>
> On the eltoo/chia variant, from my (quick) understanding, the main
> innovation aimed for is the limitation of the publication of eltoo states
> more than once by a counterparty, by introducing a cryptographic puzzle,
> where the witness can be produced once and only once ? I would say you
> might need the inheritance of the updated scriptpubkey across the chain of
> eltoo states, with a TLUV-like mechanism.
>
> > The basic idea is "if it's a two party channel with just Alice and Bob,
> > then if Alice starts a unilateral close, then she's already had her say,
> > so it's only Bob's opinion that matters from now on, and he should be
> > able to act immediately", and once it's only Bob's opinion that matters,
> > you can simplify a bunch of things.
>
> From my understanding, assuming Eltoo paper terminology, Alice can publish
> an update K transaction, and then after Bob can publish an update
> transaction K<N or Alice can publish the settlement transaction N, or Bob
> can publish an update transaction N. The main advantage of this
> construction I can see is a strict bound on the shared_delay encumbered in
> the on-chain publication of the channel ?
>
> > fast forwards: we might want to allow our channel partner
> > to immediately rely on a new state we propose without needing a
> > round-trip delay -- this potentially makes forwarding payments much
> > faster (though with some risk of locking the funds up, if you do a
> > fast forward to someone who's gone offline)
>
> IIRC, there has already been a "fast-forward" protocol upgrade proposal
> based on update-turn in the LN-penalty paradigm [0]. I think reducing the
> latency of HTLC propagation across payment paths would constitute a UX
> improvement, especially a link-level update mechanism upgrade deployment
> might be incentivized by routing algorithms starting to penalize routing
> hops HTLC relay latency. What is unclear is the additional risk of locking
> the funds up. If you don't receive acknowledgement the fast forward state
> has been received, you should still be able to exit with the state N-1 ?
> However, the fast-forward trade-off might sound acceptable, with time you
> might expect reliable routing hops in the core of the graph, and flappy
> spokes at the edge.
>
> > doubled delays: once we publish the latest state we can, we want to
> > be able to claim the funds immediately after to_self_delay expires;
> > however if our counterparty has signatures for a newer state than we
> > do (which will happen if it was fast forwarded), they could post that
> > state shortly before to_self_delay expires, potentially increasing
> > the total delay to 2*to_self_delay.
>
> While the 2*to_self_delay sounds the maximum time delay in the state
> publication scenario where the cheating counterparty publishes a old state
> then the honest counterparty publishes the latest one, there could be the
> case where the cheating counterparty broadcast chain of old states, up to
> mempool's `limitancestorcount`. However, this chain of eltoo transactions
> could be replaced by the honest party paying a higher-feerate (assuming
> something like nversion=3). I think there might still be an attack
> triggerable under certain economic conditions, where the attacker overbids
> with the higher-feerate transaction until the HTLC cltv expires. If this
> attack is plausible, it could be even opportun if you're batching against
> multiple channels, where the victims are not able to coordinate response.
>
> > penalties: when you do a unilateral close, attempting to cheat comes
> > with no cost to you and a possible benefit if you succeed, but
> > potentially does cost your channel partner (either in forcing them
> > to spend on-chain fees to update to the correct state, or in the risk
> > of loss if their node malfunctions occassionally) -- a penalty could
> > reduce this incentive to cheat
>
> I think there has been a proposal in the past to enable penalties on top
> of symmetric states by leveraging asymmetric witnesses [1]. Further, I
> wonder if there is a game-theory interest for penalty-on-top-eltoo, it
> could be an incentive against laziness, where a dysfunctional trusted
> watchtower broadcasts an old state. On the qualification of the game-theory
> soundness, I think one would have to run the empirical case study: select
> channel counterparties randomly (no out-of-band assumptions), one set with
> eltoo+penalty and the other with vanilla eltoo, observe the broadcast of
> revoked states over some period.
>
> > trustless watchtowers: we may want to consider the possibility of a
> > watchtower holding onto obsolete states and colluding with an
> > attacker to attempt to cheat us
>
> In terms of pinning and other mempool games, I think honest participant
> own states leveraged by a colluding watchtower might increase the attack
> surface, especially post-anchor with the SIGHASH_SINGLE malleability on
> second-stage HTLC transactions.
>
> > (I think for initial eltoo experimentation it doesn't make sense to try
> to
> > deal with all (or perhaps any) of those constraints; simple and working
> > is better than complex and theoretical. But having them written down so
> > the ideas can be thought about and looked up later still seems useful)
>
> I share the belief -- "simple and working" enable shorter iteration cycles
> and hopefully fasten the protocol design learning curve. Beyond, I think
> it's also realistic in face of the state of the LN ecosystem, especially on
> the watchtower issue. AFAICT, there is no even multi trusted watchtower
> design covering the full execution of the protocol (i.e including
> HTLC-preimage/ HTLC-timeout claim), and such implementation is far from
> simple, as from now on you LN's chain backend might have asynchronicity
> issue to solve between your on-chain monitoring state machine (at least
> speaking in knowledge of the LDK-architecture).
>
> > * WA.n, WB.n : watchtower update to state n
> >   - this is for an untrusted watchtower to correct attempted cheating
> >     by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
> >     (or UA.k/WB.k) respectively, provided k < n.
>
> I wonder if the introduction of watchtower specific transactions doesn't
> break the 2*to_self_delay assumption (iiuc it's a design goal of current
> protocol) and what is the design rationale. Beyond that, there is a concern
> with watchtower-specific transactions, it might leak your towers topology
> (i.e the number of them and the distribution in the p2p network) to an
> adversary.
>
> > * SA.n, SB.n : slowly claim funds according to state n
> >   - this is for Alice to claim her funds if Bob is completely offline
> >     (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
> >     timelock of to_self_delay.
>
> If I'm following correctly the description, this is logically equivalent
> to the sweep of a `to_local`/`to_remote` output on a commitment transaction
> though instead the waiting delay is eltoo shared_delay. There is no
> to_self_delay, at the punishment seems only to happen on the update-level,
> or maybe one should be also able to punish slow fund exit, and another
> relative locktime should exist on the S* transactions.
>
> > * Alice and Bob's watchtower collude, but Bob has many watchtowers:
> >
> >     F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money
>
> Could the punishment transactions R* be also delegated to watchtowers,
> assuming they have been pre-signed to lockdown the exit scriptpubkeys ?
>
> > In order to allow fast-forwards, when Alice proposes a new state,
> > she needs to send her partial signatures to allow Bob to unilaterally
> > accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she
> > also needs to be able to claim the funds if Bob proposes the new state
> > and broadcasts UB.n, she needs to be able broadcast CA.n. This can be
> > achieved with an adaptor signature approach (spelt out a bit more fully
> > in the gist) or a CTV-like approach, provided that UB.n reveals the
> > state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in
> >
> https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md
> ).
>
> If you would like to have fast forward of chain of transactions, I wonder
> if there could be also the "sig-in-the-script" trick, where UB.n
> scriptpubkey (or one of its tapscripts) contains the signature for CB.n,
> SB.n, RB.n. Though you might have an issue of re-generating the
> witnessscript in case of state loss.
>
> > * how to add fees -- the U/W transactions are 1-in/1-out transactions
> >   that can't be trivially CPFPed by the proposer and need to have
> >   fees added (either SINGLE/ANYONECANPAY signatures or having a 0-sat
> >   ephemeral output and package relay might be workable); the C/S/R
> >   transactions are 1-in/many-out transactions, but have balance outputs
> >   that can be immediately spent to pay for fees via CPFP if package
> >   relay is available.
>
> Assuming something like nversion=3, the SINGLE/ANYONCANPAY could be a
> viable fee-bumping mechanism, as ancestor-based pinning should be less of a
> concern. Ephemeral anchor output could be a more efficient direction, if
> the output value can be cooperatively inflated from the channel value,
> rather than relying on external fee-bumping reserves. I think even more
> efficient fee-bumping primitives can be introduced later.
>
> > * how to pay watchtowers -- when a watchtower broadcasts a W
> >   transaction, it needs to add fees, and it's not clear (to me) how it
> >   could fairly and reliably ensure it's compensated for those costs,
> >   particularly if multiple W transactions are broadcast for a single
> >   unilateral close attempt, due to one or more watchtowers colluding
> >   with an attacker, or simply having out of date information.
>
> I wonder if paying a watchtower, or getting paid as a watchtower isn't  a
> "counterparty risk" similar to what is happening with jamming due to
> non-covered HTLC forward risk. The watchtower has the risk of not being
> paid a posteriori and the user has the risk of the tower not acting. There
> is even a trade-off between tower costs and safety, as the more towers you
> have, more robust if your Lightning channel (in theory, as you also have a
> duplication of the key material).
>
> > * lack of layered transactions -- while this prevents you having to
> >   wait longer than to_self_delay before you can claim channel funds,
> >   it still means that any htlc that is going to timeout sooner than that
> >   may not be claimable on-chain, meaning you need to set
> >   cltv_expiry_delta >= to_self_delay.
>
> From a security perspective, offsetting the cltv_expiry_delta to a value
> superior to to_self_delay can be considered as an improvement, especially
> if it gradually does it network-wide. On the other hand, if routing
> algorithms start to penalize long-cltv-delta payment paths as the timevalue
> of liquidity is priced in routing fees, this design rationale might not be
> aligned with long-term LN network incentives (as of today even more
> loosely-defined than miner incentives).
>
> > * extending to multiparty channels -- penalising is hard if there's
> >   more than two parties, fast forwards are probably impossible since
> >   you need multiple round-trips to coordinate signatures anyway, and if
> >   you're doing channels-within-channels to reduce your n-party channel
> >   to an easier to update 2-party channel you're probably forced to have
> >   to_self_delay for each layer of channels. Also, just figuring out how
> >   to coordinate multiparty state updates and even keeping everyone in
> >   a multiparty channel online consistently to generate new signatures
> >   seems potentially hard?
>
> I don't know if penalising has been a solved issue for mulit-party, at
> least in a trustless fashion in the same way we have with 2-party
> LN-penalty (you could devise weird scheme based on timelock, taproot tree
> and threshold signatures incentivizing towards the convergence of a
> "consensus" punishment, still...) Figuring out coordinating multi-party
> states updates sounds workable with modern consensus algorithms (e.g Raft),
> though still conserving the fast forward effect is a high bar, it might be
> better deferred to an uplifted layer of 2-of-2 LN channels. The only reason
> you might have payments at the multi-party level (with the signature of the
> N-of-N participants requested) only for privacy or liquidity allocation
> reason. Though effectively, it sounds like your multiparty
> channel coordination mechanism should encompass party eviction or
> partitioning the offline parties. One or two orders of magnitude of
> complexity beyond the 2-party eltoo channel case, I think.
>
> Antoine
>
> [0] https://github.com/lightning/bolts/pull/867
> [1] https://github.com/LLFourn/witness-asymmetric-channel
>
> Le mer. 7 déc. 2022 à 00:36, Anthony Towns <aj at erisian.com.au> a écrit :
>
>> Hi all,
>>
>> On the eltoo irc channel we discussed optimising eltoo for the 2-party
>> scenario; figured it was probably worth repeating that here.
>>
>> This is similar to:
>>
>>  - 2018-07-18, simplified eltoo:
>> https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2018/eltoo-a-simplified-update-mechanism-for-lightning-and-off-chain-contracts#m-a2f01009
>>  - 2021-09-17, IID 2Stage,
>> https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019470.html
>>  - 2022-09-29, Daric: https://eprint.iacr.org/2022/1295
>>  - 2022-10-21, eltoo/chia:
>> https://twitter.com/bramcohen/status/1583122833932099585
>>
>> The basic idea is "if it's a two party channel with just Alice and Bob,
>> then if Alice starts a unilateral close, then she's already had her say,
>> so it's only Bob's opinion that matters from now on, and he should be
>> able to act immediately", and once it's only Bob's opinion that matters,
>> you can simplify a bunch of things.
>>
>> A "gist" for this idea is
>> https://gist.github.com/ajtowns/53e0f735f4d5c06a681429d937200aa5 (it
>> goes into a little more detail in places, though doesn't cover trustless
>> watchtowers at all).
>>
>>
>>
>> In particular, there are a few practical constraints that we might like
>> to consider for 2-party channels with eltoo:
>>
>>  - fast forwards: we might want to allow our channel partner
>>    to immediately rely on a new state we propose without needing a
>>    round-trip delay -- this potentially makes forwarding payments much
>>    faster (though with some risk of locking the funds up, if you do a
>>    fast forward to someone who's gone offline)
>>
>>  - doubled delays: once we publish the latest state we can, we want to
>>    be able to claim the funds immediately after to_self_delay expires;
>>    however if our counterparty has signatures for a newer state than we
>>    do (which will happen if it was fast forwarded), they could post that
>>    state shortly before to_self_delay expires, potentially increasing
>>    the total delay to 2*to_self_delay.
>>
>>  - penalties: when you do a unilateral close, attempting to cheat comes
>>    with no cost to you and a possible benefit if you succeed, but
>>    potentially does cost your channel partner (either in forcing them
>>    to spend on-chain fees to update to the correct state, or in the risk
>>    of loss if their node malfunctions occassionally) -- a penalty could
>>    reduce this incentive to cheat
>>
>>  - trustless watchtowers: we may want to consider the possibility of a
>>    watchtower holding onto obsolete states and colluding with an
>>    attacker to attempt to cheat us
>>
>> What follows is a rough approach for dealing with all those issues for
>> two-party channels. It's spelled out in a little more detail in the gist.
>>
>> (I think for initial eltoo experimentation it doesn't make sense to try to
>> deal with all (or perhaps any) of those constraints; simple and working
>> is better than complex and theoretical. But having them written down so
>> the ideas can be thought about and looked up later still seems useful)
>>
>> In more detail: unilateral closes are handled by each channel participant
>> maintaining five transactions, which we'll call:
>>
>>  * UA.n, UB.n : unilaterally propose closing at state n
>>    - this is for Alice or Bob to spend the funding tx for a unilater
>>      close to state n. Spends the funding transaction.
>>
>>  * WA.n, WB.n : watchtower update to state n
>>    - this is for an untrusted watchtower to correct attempted cheating
>>      by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
>>      (or UA.k/WB.k) respectively, provided k < n.
>>
>>  * CA.n, CB.n : cooperatively claim funds according to state n
>>    - this is for Alice to confirm Bob's unilateral close (or vice-versa).
>>      Spends UB.k, WA.k (or UA.k/WB.k respectively), provided k <= n
>>
>>  * SA.n, SB.n : slowly claim funds according to state n
>>    - this is for Alice to claim her funds if Bob is completely offline
>>      (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
>>      timelock of to_self_delay.
>>
>>  * RA.n, RB.n : claim funds with penalty after unilateral close to
>>    revoked state
>>    - this is for Alice to update the state if Bob attempted to cheat
>>      (or vice-versa). Spends UB.k or WA.k (or UA.k/WB.k respectively)
>>      conditional on k < n - 1; outputs are adjusted to transfer a fixed
>>      penalty of penalty_msat from Bob's balance to Alice's (or vice-versa)
>>
>> Each of these "transactions" requires a pre-signed signature; however
>> the actual transaction/txid will vary in cases where a transaction has
>> the possibility of spending different inputs (eg "Spends UB.k or WA.k").
>> In particular UA.n/UB.n can be constructed with known txids and non-APO
>> signatures but WA.n/WB.n/CA.n/CB.n/SA.n/SB.n/RA.n/RB.n all require
>> APO signatures.
>>
>> They're named such that Alice can immediately broadcast all the *A.n
>> transactions (provided a tx that it can spend has been broadcast) and
>> Bob can likewise immediately broadcast all the *B.n transactions.
>>
>> Scenarios where Alice decides to unilaterally close the channel might
>> look like:
>>
>>  * if Alice/Bob can't communicate directly, but both are online:
>>
>>      F -> UA.n -> CB.n -> money
>>
>>    (balances and htlcs claimed, no delay)
>>
>>  * if Bob has gone offline entirely:
>>
>>      F -> UA.n -> (to_self_delay) -> SA.n -> money
>>
>>  * Alice cheats, Bob punishes:
>>
>>      F -> UA.k -> RB.n -> money[Alice pays Bob penalty]
>>
>>  * Bob is offline, Alice cheats, but Bob has a watchtower:
>>
>>      F -> UA.k -> WB.n -> (to_self_delay) -> SA.n -> money
>>
>>  * Alice and Bob's watchtower collude, but Bob's not offline:
>>
>>      F -> UA.k1 -> WB.k2 -> RB.n -> money[Alice pays Bob penalty]
>>
>>  * Alice and Bob's watchtower collude, but Bob has many watchtowers:
>>
>>      F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money
>>
>> For Alice to successfully cheat, she needs Bob to be offline for at least
>> to_self_delay, and for all Bob's watchtowers to either also be offline,
>> or colluding.
>>
>> This can be simplified somewhat, if you don't care about all the features:
>>
>>  * If you don't care about trustless watchtowers you can drop WA.n/WB.n
>>    (and simplify SA.n/SB.n to not require an APO signature)
>>
>>  * If you don't care about penalties you can set penalty_msat to 0 and
>>    allow RA.n/RB.n to spend k<=n. In this case, you can either drop
>>    CA.n/CB.n entirely, or you can have CA.n/CB.n only be used for directly
>>    spending of UB.n/UA.n and thus not require APO signatures
>>
>> In order to allow fast-forwards, when Alice proposes a new state,
>> she needs to send her partial signatures to allow Bob to unilaterally
>> accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she
>> also needs to be able to claim the funds if Bob proposes the new state
>> and broadcasts UB.n, she needs to be able broadcast CA.n. This can be
>> achieved with an adaptor signature approach (spelt out a bit more fully
>> in the gist) or a CTV-like approach, provided that UB.n reveals the
>> state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in
>>
>> https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md
>> ).
>>
>> Note that in this scenario Alice doesn't provide WB.n to Bob
>> immediately. This is okay, as if Alice proposes UA.(n-1) (her most
>> recent state), Bob can still immediately claim via CA.n. If Bob did have
>> WB.n; then if Alice proposed UA.(n-1) Bob could wait for an initial
>> to_self_delay period and broadcast WB.n, forcing Alice to wait for an
>> additional to_self_delay before being able to claim her funds via SA.n.
>>
>> Note also that this is why RA.n/RB.n require "k < n - 1" -- otherwise
>> Alice would only be able to broadcast UA.(n-1) and Bob would immediately
>> be able to penalise by broadcasting RB.n.
>>
>> Note that if you're using a watchtower and wish to punish your
>> counterparty if it attempts to cheat, you should only pass WA.(n-2)
>> to your watchtowers, not WA.(n-1) or WA.n.
>>
>>
>>
>> This doesn't address any potential issues from:
>>
>>  * how to add fees -- the U/W transactions are 1-in/1-out transactions
>>    that can't be trivially CPFPed by the proposer and need to have
>>    fees added (either SINGLE/ANYONECANPAY signatures or having a 0-sat
>>    ephemeral output and package relay might be workable); the C/S/R
>>    transactions are 1-in/many-out transactions, but have balance outputs
>>    that can be immediately spent to pay for fees via CPFP if package
>>    relay is available.
>>
>>  * how to pay watchtowers -- when a watchtower broadcasts a W
>>    transaction, it needs to add fees, and it's not clear (to me) how it
>>    could fairly and reliably ensure it's compensated for those costs,
>>    particularly if multiple W transactions are broadcast for a single
>>    unilateral close attempt, due to one or more watchtowers colluding
>>    with an attacker, or simply having out of date information.
>>
>>  * lack of layered transactions -- while this prevents you having to
>>    wait longer than to_self_delay before you can claim channel funds,
>>    it still means that any htlc that is going to timeout sooner than that
>>    may not be claimable on-chain, meaning you need to set
>>    cltv_expiry_delta >= to_self_delay.
>>
>>  * extending to multiparty channels -- penalising is hard if there's
>>    more than two parties, fast forwards are probably impossible since
>>    you need multiple round-trips to coordinate signatures anyway, and if
>>    you're doing channels-within-channels to reduce your n-party channel
>>    to an easier to update 2-party channel you're probably forced to have
>>    to_self_delay for each layer of channels. Also, just figuring out how
>>    to coordinate multiparty state updates and even keeping everyone in
>>    a multiparty channel online consistently to generate new signatures
>>    seems potentially hard?
>>
>> Cheers,
>> aj
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
Anthony Towns in reply to Antoine Riard permalink original

On Thu, Dec 08, 2022 at 02:14:06PM -0500, Antoine Riard wrote:

Quoted text (4 lines)
> >  - 2022-10-21, eltoo/chia:
> https://twitter.com/bramcohen/status/1583122833932099585
> On the eltoo/chia variant, from my (quick) understanding, the main
> innovation aimed for is

I'd say the main innovation aimed for is just doing something like lightning over the top of chia (rather than bitcoin, liquid, ethereum etc), and making it simple enough to be easily implemented.

Quoted text (5 lines)
> the limitation of the publication of eltoo states
> more than once by a counterparty, by introducing a cryptographic puzzle,
> where the witness can be produced once and only once ? I would say you
> might need the inheritance of the updated scriptpubkey across the chain of
> eltoo states, with a TLUV-like mechanism.

Chia uses different terminology to bitcoin; "puzzle" is just what we call "scriptPubKey" in bitcoin, more or less. Since its scripting capabilities are pretty powerful, you can rig up a TLUV/OP_EVICT like mechanism, but for a two-party setup, in practice I think that mostly just means you can encode the logic directly as script, and when updating the state you then only need to exchange CHECKSIGFROMSTACK-like signatures along the lines of "state N implies outputs of A,B,C,... -- Alice", rather than signing multiple transactions.

Quoted text (11 lines)
> > The basic idea is "if it's a two party channel with just Alice and Bob,
> > then if Alice starts a unilateral close, then she's already had her say,
> > so it's only Bob's opinion that matters from now on, and he should be
> > able to act immediately", and once it's only Bob's opinion that matters,
> > you can simplify a bunch of things.
> From my understanding, assuming Eltoo paper terminology, Alice can publish
> an update K transaction, and then after Bob can publish an update
> transaction K<N or Alice can publish the settlement transaction N, or Bob
> can publish an update transaction N. The main advantage of this
> construction I can see is a strict bound on the shared_delay encumbered in
> the on-chain publication of the channel ?

If you have fully symmetric transactions, then you could have the situation where Alice broadcasts update K, then attacks Bob and when he attempts to post update N, she instead does a pinning attack by broadcasting update K+1 (spending update K), which then forces Bob to generate a new version update N, which she then blocks with update K+2, etc. An attack like that is presumably pretty difficult to pull off in practice, but it makes it pretty hard to reason about many of the limits.

A simple advantage to breaking the symmetry is that if A does a unilateral close, then B can immediately confirm that closure releasing all funds for both parties. Without breaking the symmetry, you can't distinguish that case from B attempting to confirm his own unilateral close, which would allow B to cheat.

Quoted text (14 lines)
> > fast forwards: we might want to allow our channel partner
> > to immediately rely on a new state we propose without needing a
> > round-trip delay -- this potentially makes forwarding payments much
> > faster (though with some risk of locking the funds up, if you do a
> > fast forward to someone who's gone offline)
>
> IIRC, there has already been a "fast-forward" protocol upgrade proposal
> based on update-turn in the LN-penalty paradigm [0]. I think reducing the
> latency of HTLC propagation across payment paths would constitute a UX
> improvement, especially a link-level update mechanism upgrade deployment
> might be incentivized by routing algorithms starting to penalize routing
> hops HTLC relay latency. What is unclear is the additional risk of locking
> the funds up. If you don't receive acknowledgement the fast forward state
> has been received, you should still be able to exit with the state N-1 ?

Yes, you can unilaterally close the channel with state N-1; but even then they might respond by bumping to state N anyway. If that happens, then the funds can remain locked up until the timeout, as you can no longer time the htlc out off-chain.

Still, if it's one hung per htlc for the channel's entire lifetime (because you close it "immediately" when it happens), that's probably not going to cause problems frequently...

Quoted text (14 lines)
> > doubled delays: once we publish the latest state we can, we want to
> > be able to claim the funds immediately after to_self_delay expires;
> > however if our counterparty has signatures for a newer state than we
> > do (which will happen if it was fast forwarded), they could post that
> > state shortly before to_self_delay expires, potentially increasing
> > the total delay to 2*to_self_delay.
>
> While the 2*to_self_delay sounds the maximum time delay in the state
> publication scenario where the cheating counterparty publishes a old state
> then the honest counterparty publishes the latest one, there could be the
> case where the cheating counterparty broadcast chain of old states, up to
> mempool's `limitancestorcount`. However, this chain of eltoo transactions
> could be replaced by the honest party paying a higher-feerate (assuming
> something like nversion=3).

With the asymmetric transactions proposed here, you'd need to have your watchtowers collude with the attacker for this to happen.

I think you could prevent chains from building up in the mempool by requiring a relative timelock of perhaps 2 or 3 blocks for a WA.n/WB.n tx to be valid (giving you time to post RA.n/RB.n in the meantime).

Quoted text (6 lines)
> > * WA.n, WB.n : watchtower update to state n
> >   - this is for an untrusted watchtower to correct attempted cheating
> >     by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
> >     (or UA.k/WB.k) respectively, provided k < n.
> I wonder if the introduction of watchtower specific transactions doesn't
> break the 2*to_self_delay assumption

The to_self_delay applies to whoever initiated the unilateral close, and provided they actually posted the most recent state, no watchtower tx is a valid spend. ie, if Alice is honest and n is the latest state, then the only possible spends of UA.n are SA.n (after a delay) or CB.n, and as soon as either of those are on chain, she gets access to her funds. No version of WB.k or RB.k (or WA.k, CA.k, RA.k) are valid if k<=n and UA.n is confirmed.

If Alice is dishonest, and posts a very old state (n-x), then Bob could post up to x watchtower txs (WB.(n-x+1) .. WB.n) causing Alice to be unable to access her funds for up to (x+1)*to_self_delay blocks. But that's just a reason for her to not be dishonest in the first place.

Quoted text (5 lines)
> (iiuc it's a design goal of current
> protocol) and what is the design rationale. Beyond that, there is a concern
> with watchtower-specific transactions, it might leak your towers topology
> (i.e the number of them and the distribution in the p2p network) to an
> adversary.

If you have a watchtower and it takes action, I don't think you can expect to retain privacy over the fact that you have a watchtower, and how effective it is against an attacker with extensive monitoring of the p2p network...

Quoted text (11 lines)
> > * SA.n, SB.n : slowly claim funds according to state n
> >   - this is for Alice to claim her funds if Bob is completely offline
> >     (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
> >     timelock of to_self_delay.
>
> If I'm following correctly the description, this is logically equivalent to
> the sweep of a `to_local`/`to_remote` output on a commitment transaction
> though instead the waiting delay is eltoo shared_delay. There is no
> to_self_delay, at the punishment seems only to happen on the update-level,
> or maybe one should be also able to punish slow fund exit, and another
> relative locktime should exist on the S* transactions.

I'm just using "to_self_delay" as the X in "if you attempt to cheat, I'll definitely notice and take action within X blocks". If you post UA.n then post SA.n after X blocks (due to SA.n's relative time lock) then you've already proven you didn't cheat, because that was enough time for B to notice and take action.

Quoted text (4 lines)
> > * Alice and Bob's watchtower collude, but Bob has many watchtowers:
> >     F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money
> Could the punishment transactions R* be also delegated to watchtowers,
> assuming they have been pre-signed to lockdown the exit scriptpubkeys ?

No -- the RB.n transactions immediately release A's funds after applying the penalty, so if the watchtower colludes with A and has an old RB.y transaction, Alice can steal funds by posting UA.x and RB.y, provided that her balance now is sufficiently less than her balance then (ie bal.n < bal.y - penalty).

In this model, Bob shouldn't be signing RB.n or CB.n txs until Alice has already started a unilateral close and posted UA.n/UA.k.

Quoted text (17 lines)
> > In order to allow fast-forwards, when Alice proposes a new state,
> > she needs to send her partial signatures to allow Bob to unilaterally
> > accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she
> > also needs to be able to claim the funds if Bob proposes the new state
> > and broadcasts UB.n, she needs to be able broadcast CA.n. This can be
> > achieved with an adaptor signature approach (spelt out a bit more fully
> > in the gist) or a CTV-like approach, provided that UB.n reveals the
> > state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in
> >
> https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md
> ).
>
> If you would like to have fast forward of chain of transactions, I wonder
> if there could be also the "sig-in-the-script" trick, where UB.n
> scriptpubkey (or one of its tapscripts) contains the signature for CB.n,
> SB.n, RB.n. Though you might have an issue of re-generating the
> witnessscript in case of state loss.

Broadcasting UB.n will only reveal signatures by B; so that would only potentially help with CA.n or RA.n; and if UB.n is on-chain, then RA.n isn't valid (since it would require "n < n").

The EXPR_SETTLE stuff in the github link describes how to do the trick via a CTV-ish approach (including an APO signature in a tapscript in the scriptPubKey of UA.n here; and including data in the annex so that you can recalculate thinks if an old UA.n is broadcast after you've forgotten n's state details).

Quoted text (9 lines)
> > * how to pay watchtowers -- when a watchtower broadcasts a W
> >   transaction, it needs to add fees, and it's not clear (to me) how it
> >   could fairly and reliably ensure it's compensated for those costs,
> >   particularly if multiple W transactions are broadcast for a single
> >   unilateral close attempt, due to one or more watchtowers colluding
> >   with an attacker, or simply having out of date information.
> I wonder if paying a watchtower, or getting paid as a watchtower isn't  a
> "counterparty risk" similar to what is happening with jamming due to
> non-covered HTLC forward risk.

Actually, perhaps you could "yo dawg" it: if you give the watchtower a pre-signed transaction WA.n:

    input 1: UA.k/WA.k (ANYPREVOUTANYSCRIPT, SINGLE)
    input 2: my funds (SINGLE, ALL)
    output 1: WA.n
    output 2: new lightning channel between me and watchtower
    output 3: ephemeral OP_TRUE output

then you could have the "new lightning channel" be setup with an initial capacity of "my funds", and off-chain update the state of that channel so that the watchtower's balance is how much you're willing to contribute in fees if the watchtower does its job. If you set things up so that you're always able to claim a penalty via WA.n->RA.n if the watchtower acts, then you can give up to that penalty to the watchtower and still end up making a profit.

Doesn't generalise to redundant untrusted watchtowers though, but presumably nothing does. (You could use the same utxo across multiple watchtowers, but a rogue watchtower could just post an old WA.k tx and claim your funds, preventing some honest watchtower from helping)

(Yo dawg, I heard you liked closing lightning channels, so we put a lightning channel in your watchtower, so you can close a channel while you're closing a channel. Alternatively: "when god closes one channel, he opens another")

Cheers, aj

Antoine Riard in reply to Greg Sanders permalink original

Hi Greg,

Quoted text (6 lines)
> Feel free to assume that we've worked around mempool pinning for all of
> these discussions, otherwise we're pretty hosed regardless. I'm implicitly
> assuming V3+ephemeral anchors, which disallows batched bumps, for example.
> You'll need to give some room for "slippage", but I think
> shared_delay/2*shared_delay is going to end up dominating UX in any
> non-layered scheme.

I think I was making the same assumption of V3+ephemeral anchors, and effectively disabling batching removes the known case of "commitment cat-and-mouse" attack, where a counterparty goes to confirm the commitment one by one to break the validity of the common CPFP. However, I wonder if there is not another attack case, see my other "update overflow" mail, and I don't think it qualifies as a pinning here!

Quoted text (6 lines)
> This architecture doesn't suffer from 2*self_delay, and each transition
> aside from Slow/Settle/SX.y has no relative timelock so that relative
> timelock is all that matters. It does introduce a watchtower cycle, so
it's
> not longer a one-shot architecture, or even k-shot exactly, it ends up
> looking like vanilla eltoo for that single path.

Here I think my understanding is aligned, the watchtower cycle ends up looking more like the update phase of vanilla eltoo.

Antoine

Le jeu. 8 déc. 2022 à 15:28, Greg Sanders <gsanders87 at gmail.com> a écrit :

Quoted text (491 lines)
> Antoine,
>
> > While the 2*to_self_delay sounds the maximum time delay in the state
> publication scenario where the cheating counterparty publishes a old state
> then the honest counterparty publishes the latest one, there could be the
> case where the cheating counterparty broadcast chain of old states, up to
> mempool's `limitancestorcount`. However, this chain of eltoo transactions
> could be replaced by the honest party paying a higher-feerate (assuming
> something like nversion=3). I think there might still be an attack
> triggerable under certain economic conditions, where the attacker overbids
> with the higher-feerate transaction until the HTLC cltv expires. If this
> attack is plausible, it could be even opportun if you're batching against
> multiple channels, where the victims are not able to coordinate response.
>
> Feel free to assume that we've worked around mempool pinning for all of
> these discussions, otherwise we're pretty hosed regardless. I'm implicitly
> assuming V3+ephemeral anchors, which disallows batched bumps, for example.
> You'll need to give some room for "slippage", but I think
> shared_delay/2*shared_delay is going to end up dominating UX in any
> non-layered scheme.
>
> > I wonder if the introduction of watchtower specific transactions doesn't
> break the 2*to_self_delay assumption
>
> This architecture doesn't suffer from 2*self_delay, and each transition
> aside from Slow/Settle/SX.y has no relative timelock so that relative
> timelock is all that matters. It does introduce a watchtower cycle, so it's
> not longer a one-shot architecture, or even k-shot exactly, it ends up
> looking like vanilla eltoo for that single path.
>
> Cheers,
> Greg
>
> On Thu, Dec 8, 2022 at 2:14 PM Antoine Riard <antoine.riard at gmail.com>
> wrote:
>
>> Hi AJ,
>>
>> The eltoo irc channel is ##eltoo on Libera chat.
>>
>> >  - 2022-10-21, eltoo/chia:
>> https://twitter.com/bramcohen/status/1583122833932099585
>>
>> On the eltoo/chia variant, from my (quick) understanding, the main
>> innovation aimed for is the limitation of the publication of eltoo states
>> more than once by a counterparty, by introducing a cryptographic puzzle,
>> where the witness can be produced once and only once ? I would say you
>> might need the inheritance of the updated scriptpubkey across the chain of
>> eltoo states, with a TLUV-like mechanism.
>>
>> > The basic idea is "if it's a two party channel with just Alice and Bob,
>> > then if Alice starts a unilateral close, then she's already had her say,
>> > so it's only Bob's opinion that matters from now on, and he should be
>> > able to act immediately", and once it's only Bob's opinion that matters,
>> > you can simplify a bunch of things.
>>
>> From my understanding, assuming Eltoo paper terminology, Alice can
>> publish an update K transaction, and then after Bob can publish an update
>> transaction K<N or Alice can publish the settlement transaction N, or Bob
>> can publish an update transaction N. The main advantage of this
>> construction I can see is a strict bound on the shared_delay encumbered in
>> the on-chain publication of the channel ?
>>
>> > fast forwards: we might want to allow our channel partner
>> > to immediately rely on a new state we propose without needing a
>> > round-trip delay -- this potentially makes forwarding payments much
>> > faster (though with some risk of locking the funds up, if you do a
>> > fast forward to someone who's gone offline)
>>
>> IIRC, there has already been a "fast-forward" protocol upgrade proposal
>> based on update-turn in the LN-penalty paradigm [0]. I think reducing the
>> latency of HTLC propagation across payment paths would constitute a UX
>> improvement, especially a link-level update mechanism upgrade deployment
>> might be incentivized by routing algorithms starting to penalize routing
>> hops HTLC relay latency. What is unclear is the additional risk of locking
>> the funds up. If you don't receive acknowledgement the fast forward state
>> has been received, you should still be able to exit with the state N-1 ?
>> However, the fast-forward trade-off might sound acceptable, with time you
>> might expect reliable routing hops in the core of the graph, and flappy
>> spokes at the edge.
>>
>> > doubled delays: once we publish the latest state we can, we want to
>> > be able to claim the funds immediately after to_self_delay expires;
>> > however if our counterparty has signatures for a newer state than we
>> > do (which will happen if it was fast forwarded), they could post that
>> > state shortly before to_self_delay expires, potentially increasing
>> > the total delay to 2*to_self_delay.
>>
>> While the 2*to_self_delay sounds the maximum time delay in the state
>> publication scenario where the cheating counterparty publishes a old state
>> then the honest counterparty publishes the latest one, there could be the
>> case where the cheating counterparty broadcast chain of old states, up to
>> mempool's `limitancestorcount`. However, this chain of eltoo transactions
>> could be replaced by the honest party paying a higher-feerate (assuming
>> something like nversion=3). I think there might still be an attack
>> triggerable under certain economic conditions, where the attacker overbids
>> with the higher-feerate transaction until the HTLC cltv expires. If this
>> attack is plausible, it could be even opportun if you're batching against
>> multiple channels, where the victims are not able to coordinate response.
>>
>> > penalties: when you do a unilateral close, attempting to cheat comes
>> > with no cost to you and a possible benefit if you succeed, but
>> > potentially does cost your channel partner (either in forcing them
>> > to spend on-chain fees to update to the correct state, or in the risk
>> > of loss if their node malfunctions occassionally) -- a penalty could
>> > reduce this incentive to cheat
>>
>> I think there has been a proposal in the past to enable penalties on top
>> of symmetric states by leveraging asymmetric witnesses [1]. Further, I
>> wonder if there is a game-theory interest for penalty-on-top-eltoo, it
>> could be an incentive against laziness, where a dysfunctional trusted
>> watchtower broadcasts an old state. On the qualification of the game-theory
>> soundness, I think one would have to run the empirical case study: select
>> channel counterparties randomly (no out-of-band assumptions), one set with
>> eltoo+penalty and the other with vanilla eltoo, observe the broadcast of
>> revoked states over some period.
>>
>> > trustless watchtowers: we may want to consider the possibility of a
>> > watchtower holding onto obsolete states and colluding with an
>> > attacker to attempt to cheat us
>>
>> In terms of pinning and other mempool games, I think honest participant
>> own states leveraged by a colluding watchtower might increase the attack
>> surface, especially post-anchor with the SIGHASH_SINGLE malleability on
>> second-stage HTLC transactions.
>>
>> > (I think for initial eltoo experimentation it doesn't make sense to try
>> to
>> > deal with all (or perhaps any) of those constraints; simple and working
>> > is better than complex and theoretical. But having them written down so
>> > the ideas can be thought about and looked up later still seems useful)
>>
>> I share the belief -- "simple and working" enable shorter iteration
>> cycles and hopefully fasten the protocol design learning curve. Beyond, I
>> think it's also realistic in face of the state of the LN ecosystem,
>> especially on the watchtower issue. AFAICT, there is no even multi trusted
>> watchtower design covering the full execution of the protocol (i.e
>> including HTLC-preimage/ HTLC-timeout claim), and such implementation is
>> far from simple, as from now on you LN's chain backend might have
>> asynchronicity issue to solve between your on-chain monitoring state
>> machine (at least speaking in knowledge of the LDK-architecture).
>>
>> > * WA.n, WB.n : watchtower update to state n
>> >   - this is for an untrusted watchtower to correct attempted cheating
>> >     by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
>> >     (or UA.k/WB.k) respectively, provided k < n.
>>
>> I wonder if the introduction of watchtower specific transactions doesn't
>> break the 2*to_self_delay assumption (iiuc it's a design goal of current
>> protocol) and what is the design rationale. Beyond that, there is a concern
>> with watchtower-specific transactions, it might leak your towers topology
>> (i.e the number of them and the distribution in the p2p network) to an
>> adversary.
>>
>> > * SA.n, SB.n : slowly claim funds according to state n
>> >   - this is for Alice to claim her funds if Bob is completely offline
>> >     (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
>> >     timelock of to_self_delay.
>>
>> If I'm following correctly the description, this is logically equivalent
>> to the sweep of a `to_local`/`to_remote` output on a commitment transaction
>> though instead the waiting delay is eltoo shared_delay. There is no
>> to_self_delay, at the punishment seems only to happen on the update-level,
>> or maybe one should be also able to punish slow fund exit, and another
>> relative locktime should exist on the S* transactions.
>>
>> > * Alice and Bob's watchtower collude, but Bob has many watchtowers:
>> >
>> >     F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money
>>
>> Could the punishment transactions R* be also delegated to watchtowers,
>> assuming they have been pre-signed to lockdown the exit scriptpubkeys ?
>>
>> > In order to allow fast-forwards, when Alice proposes a new state,
>> > she needs to send her partial signatures to allow Bob to unilaterally
>> > accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she
>> > also needs to be able to claim the funds if Bob proposes the new state
>> > and broadcasts UB.n, she needs to be able broadcast CA.n. This can be
>> > achieved with an adaptor signature approach (spelt out a bit more fully
>> > in the gist) or a CTV-like approach, provided that UB.n reveals the
>> > state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in
>> >
>> https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md
>> ).
>>
>> If you would like to have fast forward of chain of transactions, I wonder
>> if there could be also the "sig-in-the-script" trick, where UB.n
>> scriptpubkey (or one of its tapscripts) contains the signature for CB.n,
>> SB.n, RB.n. Though you might have an issue of re-generating the
>> witnessscript in case of state loss.
>>
>> > * how to add fees -- the U/W transactions are 1-in/1-out transactions
>> >   that can't be trivially CPFPed by the proposer and need to have
>> >   fees added (either SINGLE/ANYONECANPAY signatures or having a 0-sat
>> >   ephemeral output and package relay might be workable); the C/S/R
>> >   transactions are 1-in/many-out transactions, but have balance outputs
>> >   that can be immediately spent to pay for fees via CPFP if package
>> >   relay is available.
>>
>> Assuming something like nversion=3, the SINGLE/ANYONCANPAY could be a
>> viable fee-bumping mechanism, as ancestor-based pinning should be less of a
>> concern. Ephemeral anchor output could be a more efficient direction, if
>> the output value can be cooperatively inflated from the channel value,
>> rather than relying on external fee-bumping reserves. I think even more
>> efficient fee-bumping primitives can be introduced later.
>>
>> > * how to pay watchtowers -- when a watchtower broadcasts a W
>> >   transaction, it needs to add fees, and it's not clear (to me) how it
>> >   could fairly and reliably ensure it's compensated for those costs,
>> >   particularly if multiple W transactions are broadcast for a single
>> >   unilateral close attempt, due to one or more watchtowers colluding
>> >   with an attacker, or simply having out of date information.
>>
>> I wonder if paying a watchtower, or getting paid as a watchtower isn't  a
>> "counterparty risk" similar to what is happening with jamming due to
>> non-covered HTLC forward risk. The watchtower has the risk of not being
>> paid a posteriori and the user has the risk of the tower not acting. There
>> is even a trade-off between tower costs and safety, as the more towers you
>> have, more robust if your Lightning channel (in theory, as you also have a
>> duplication of the key material).
>>
>> > * lack of layered transactions -- while this prevents you having to
>> >   wait longer than to_self_delay before you can claim channel funds,
>> >   it still means that any htlc that is going to timeout sooner than that
>> >   may not be claimable on-chain, meaning you need to set
>> >   cltv_expiry_delta >= to_self_delay.
>>
>> From a security perspective, offsetting the cltv_expiry_delta to a value
>> superior to to_self_delay can be considered as an improvement, especially
>> if it gradually does it network-wide. On the other hand, if routing
>> algorithms start to penalize long-cltv-delta payment paths as the timevalue
>> of liquidity is priced in routing fees, this design rationale might not be
>> aligned with long-term LN network incentives (as of today even more
>> loosely-defined than miner incentives).
>>
>> > * extending to multiparty channels -- penalising is hard if there's
>> >   more than two parties, fast forwards are probably impossible since
>> >   you need multiple round-trips to coordinate signatures anyway, and if
>> >   you're doing channels-within-channels to reduce your n-party channel
>> >   to an easier to update 2-party channel you're probably forced to have
>> >   to_self_delay for each layer of channels. Also, just figuring out how
>> >   to coordinate multiparty state updates and even keeping everyone in
>> >   a multiparty channel online consistently to generate new signatures
>> >   seems potentially hard?
>>
>> I don't know if penalising has been a solved issue for mulit-party, at
>> least in a trustless fashion in the same way we have with 2-party
>> LN-penalty (you could devise weird scheme based on timelock, taproot tree
>> and threshold signatures incentivizing towards the convergence of a
>> "consensus" punishment, still...) Figuring out coordinating multi-party
>> states updates sounds workable with modern consensus algorithms (e.g Raft),
>> though still conserving the fast forward effect is a high bar, it might be
>> better deferred to an uplifted layer of 2-of-2 LN channels. The only reason
>> you might have payments at the multi-party level (with the signature of the
>> N-of-N participants requested) only for privacy or liquidity allocation
>> reason. Though effectively, it sounds like your multiparty
>> channel coordination mechanism should encompass party eviction or
>> partitioning the offline parties. One or two orders of magnitude of
>> complexity beyond the 2-party eltoo channel case, I think.
>>
>> Antoine
>>
>> [0] https://github.com/lightning/bolts/pull/867
>> [1] https://github.com/LLFourn/witness-asymmetric-channel
>>
>> Le mer. 7 déc. 2022 à 00:36, Anthony Towns <aj at erisian.com.au> a écrit :
>>
>>> Hi all,
>>>
>>> On the eltoo irc channel we discussed optimising eltoo for the 2-party
>>> scenario; figured it was probably worth repeating that here.
>>>
>>> This is similar to:
>>>
>>>  - 2018-07-18, simplified eltoo:
>>> https://www.learnbitcoin.com/archive/lists/lightning-dev/t/2018/eltoo-a-simplified-update-mechanism-for-lightning-and-off-chain-contracts#m-a2f01009
>>>  - 2021-09-17, IID 2Stage,
>>> https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2021-September/019470.html
>>>  - 2022-09-29, Daric: https://eprint.iacr.org/2022/1295
>>>  - 2022-10-21, eltoo/chia:
>>> https://twitter.com/bramcohen/status/1583122833932099585
>>>
>>> The basic idea is "if it's a two party channel with just Alice and Bob,
>>> then if Alice starts a unilateral close, then she's already had her say,
>>> so it's only Bob's opinion that matters from now on, and he should be
>>> able to act immediately", and once it's only Bob's opinion that matters,
>>> you can simplify a bunch of things.
>>>
>>> A "gist" for this idea is
>>> https://gist.github.com/ajtowns/53e0f735f4d5c06a681429d937200aa5 (it
>>> goes into a little more detail in places, though doesn't cover trustless
>>> watchtowers at all).
>>>
>>>
>>>
>>> In particular, there are a few practical constraints that we might like
>>> to consider for 2-party channels with eltoo:
>>>
>>>  - fast forwards: we might want to allow our channel partner
>>>    to immediately rely on a new state we propose without needing a
>>>    round-trip delay -- this potentially makes forwarding payments much
>>>    faster (though with some risk of locking the funds up, if you do a
>>>    fast forward to someone who's gone offline)
>>>
>>>  - doubled delays: once we publish the latest state we can, we want to
>>>    be able to claim the funds immediately after to_self_delay expires;
>>>    however if our counterparty has signatures for a newer state than we
>>>    do (which will happen if it was fast forwarded), they could post that
>>>    state shortly before to_self_delay expires, potentially increasing
>>>    the total delay to 2*to_self_delay.
>>>
>>>  - penalties: when you do a unilateral close, attempting to cheat comes
>>>    with no cost to you and a possible benefit if you succeed, but
>>>    potentially does cost your channel partner (either in forcing them
>>>    to spend on-chain fees to update to the correct state, or in the risk
>>>    of loss if their node malfunctions occassionally) -- a penalty could
>>>    reduce this incentive to cheat
>>>
>>>  - trustless watchtowers: we may want to consider the possibility of a
>>>    watchtower holding onto obsolete states and colluding with an
>>>    attacker to attempt to cheat us
>>>
>>> What follows is a rough approach for dealing with all those issues for
>>> two-party channels. It's spelled out in a little more detail in the gist.
>>>
>>> (I think for initial eltoo experimentation it doesn't make sense to try
>>> to
>>> deal with all (or perhaps any) of those constraints; simple and working
>>> is better than complex and theoretical. But having them written down so
>>> the ideas can be thought about and looked up later still seems useful)
>>>
>>> In more detail: unilateral closes are handled by each channel participant
>>> maintaining five transactions, which we'll call:
>>>
>>>  * UA.n, UB.n : unilaterally propose closing at state n
>>>    - this is for Alice or Bob to spend the funding tx for a unilater
>>>      close to state n. Spends the funding transaction.
>>>
>>>  * WA.n, WB.n : watchtower update to state n
>>>    - this is for an untrusted watchtower to correct attempted cheating
>>>      by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
>>>      (or UA.k/WB.k) respectively, provided k < n.
>>>
>>>  * CA.n, CB.n : cooperatively claim funds according to state n
>>>    - this is for Alice to confirm Bob's unilateral close (or vice-versa).
>>>      Spends UB.k, WA.k (or UA.k/WB.k respectively), provided k <= n
>>>
>>>  * SA.n, SB.n : slowly claim funds according to state n
>>>    - this is for Alice to claim her funds if Bob is completely offline
>>>      (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
>>>      timelock of to_self_delay.
>>>
>>>  * RA.n, RB.n : claim funds with penalty after unilateral close to
>>>    revoked state
>>>    - this is for Alice to update the state if Bob attempted to cheat
>>>      (or vice-versa). Spends UB.k or WA.k (or UA.k/WB.k respectively)
>>>      conditional on k < n - 1; outputs are adjusted to transfer a fixed
>>>      penalty of penalty_msat from Bob's balance to Alice's (or
>>> vice-versa)
>>>
>>> Each of these "transactions" requires a pre-signed signature; however
>>> the actual transaction/txid will vary in cases where a transaction has
>>> the possibility of spending different inputs (eg "Spends UB.k or WA.k").
>>> In particular UA.n/UB.n can be constructed with known txids and non-APO
>>> signatures but WA.n/WB.n/CA.n/CB.n/SA.n/SB.n/RA.n/RB.n all require
>>> APO signatures.
>>>
>>> They're named such that Alice can immediately broadcast all the *A.n
>>> transactions (provided a tx that it can spend has been broadcast) and
>>> Bob can likewise immediately broadcast all the *B.n transactions.
>>>
>>> Scenarios where Alice decides to unilaterally close the channel might
>>> look like:
>>>
>>>  * if Alice/Bob can't communicate directly, but both are online:
>>>
>>>      F -> UA.n -> CB.n -> money
>>>
>>>    (balances and htlcs claimed, no delay)
>>>
>>>  * if Bob has gone offline entirely:
>>>
>>>      F -> UA.n -> (to_self_delay) -> SA.n -> money
>>>
>>>  * Alice cheats, Bob punishes:
>>>
>>>      F -> UA.k -> RB.n -> money[Alice pays Bob penalty]
>>>
>>>  * Bob is offline, Alice cheats, but Bob has a watchtower:
>>>
>>>      F -> UA.k -> WB.n -> (to_self_delay) -> SA.n -> money
>>>
>>>  * Alice and Bob's watchtower collude, but Bob's not offline:
>>>
>>>      F -> UA.k1 -> WB.k2 -> RB.n -> money[Alice pays Bob penalty]
>>>
>>>  * Alice and Bob's watchtower collude, but Bob has many watchtowers:
>>>
>>>      F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money
>>>
>>> For Alice to successfully cheat, she needs Bob to be offline for at least
>>> to_self_delay, and for all Bob's watchtowers to either also be offline,
>>> or colluding.
>>>
>>> This can be simplified somewhat, if you don't care about all the
>>> features:
>>>
>>>  * If you don't care about trustless watchtowers you can drop WA.n/WB.n
>>>    (and simplify SA.n/SB.n to not require an APO signature)
>>>
>>>  * If you don't care about penalties you can set penalty_msat to 0 and
>>>    allow RA.n/RB.n to spend k<=n. In this case, you can either drop
>>>    CA.n/CB.n entirely, or you can have CA.n/CB.n only be used for
>>> directly
>>>    spending of UB.n/UA.n and thus not require APO signatures
>>>
>>> In order to allow fast-forwards, when Alice proposes a new state,
>>> she needs to send her partial signatures to allow Bob to unilaterally
>>> accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she
>>> also needs to be able to claim the funds if Bob proposes the new state
>>> and broadcasts UB.n, she needs to be able broadcast CA.n. This can be
>>> achieved with an adaptor signature approach (spelt out a bit more fully
>>> in the gist) or a CTV-like approach, provided that UB.n reveals the
>>> state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in
>>>
>>> https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md
>>> ).
>>>
>>> Note that in this scenario Alice doesn't provide WB.n to Bob
>>> immediately. This is okay, as if Alice proposes UA.(n-1) (her most
>>> recent state), Bob can still immediately claim via CA.n. If Bob did have
>>> WB.n; then if Alice proposed UA.(n-1) Bob could wait for an initial
>>> to_self_delay period and broadcast WB.n, forcing Alice to wait for an
>>> additional to_self_delay before being able to claim her funds via SA.n.
>>>
>>> Note also that this is why RA.n/RB.n require "k < n - 1" -- otherwise
>>> Alice would only be able to broadcast UA.(n-1) and Bob would immediately
>>> be able to penalise by broadcasting RB.n.
>>>
>>> Note that if you're using a watchtower and wish to punish your
>>> counterparty if it attempts to cheat, you should only pass WA.(n-2)
>>> to your watchtowers, not WA.(n-1) or WA.n.
>>>
>>>
>>>
>>> This doesn't address any potential issues from:
>>>
>>>  * how to add fees -- the U/W transactions are 1-in/1-out transactions
>>>    that can't be trivially CPFPed by the proposer and need to have
>>>    fees added (either SINGLE/ANYONECANPAY signatures or having a 0-sat
>>>    ephemeral output and package relay might be workable); the C/S/R
>>>    transactions are 1-in/many-out transactions, but have balance outputs
>>>    that can be immediately spent to pay for fees via CPFP if package
>>>    relay is available.
>>>
>>>  * how to pay watchtowers -- when a watchtower broadcasts a W
>>>    transaction, it needs to add fees, and it's not clear (to me) how it
>>>    could fairly and reliably ensure it's compensated for those costs,
>>>    particularly if multiple W transactions are broadcast for a single
>>>    unilateral close attempt, due to one or more watchtowers colluding
>>>    with an attacker, or simply having out of date information.
>>>
>>>  * lack of layered transactions -- while this prevents you having to
>>>    wait longer than to_self_delay before you can claim channel funds,
>>>    it still means that any htlc that is going to timeout sooner than that
>>>    may not be claimable on-chain, meaning you need to set
>>>    cltv_expiry_delta >= to_self_delay.
>>>
>>>  * extending to multiparty channels -- penalising is hard if there's
>>>    more than two parties, fast forwards are probably impossible since
>>>    you need multiple round-trips to coordinate signatures anyway, and if
>>>    you're doing channels-within-channels to reduce your n-party channel
>>>    to an easier to update 2-party channel you're probably forced to have
>>>    to_self_delay for each layer of channels. Also, just figuring out how
>>>    to coordinate multiparty state updates and even keeping everyone in
>>>    a multiparty channel online consistently to generate new signatures
>>>    seems potentially hard?
>>>
>>> Cheers,
>>> aj
>>> _______________________________________________
>>> Lightning-dev mailing list
>>> Lightning-dev at lists.linuxfoundation.org
>>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>>
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>
Antoine Riard in reply to Anthony Towns permalink original

Hi AJ,

Quoted text (8 lines)
> Chia uses different terminology to bitcoin; "puzzle" is just what we call
> "scriptPubKey" in bitcoin, more or less. Since its scripting capabilities
> are pretty powerful, you can rig up a TLUV/OP_EVICT like mechanism, but
> for a two-party setup, in practice I think that mostly just means you
> can encode the logic directly as script, and when updating the state you
> then only need to exchange CHECKSIGFROMSTACK-like signatures along the
> lines of "state N implies outputs of A,B,C,... -- Alice", rather than
> signing multiple transactions.

In the multi-party setup, encoding more of the unrolling logic directly as script could be a witness space gain, I guess. To express a channel factory/payment pool withdrawal, at the minimum I think you need an amount/exit scriptPubKey committed by the signature. Or maybe the output value could be a spent input amount distribution among a set of signers, if you would like some non-interactive pre-funded scheme.

Quoted text (13 lines)
> If you have fully symmetric transactions, then you could have the
> situation where Alice broadcasts update K, then attacks Bob and when
> he attempts to post update N, she instead does a pinning attack by
> broadcasting update K+1 (spending update K), which then forces Bob to
> generate a new version update N, which she then blocks with update K+2,
> etc. An attack like that is presumably pretty difficult to pull off in
> practice, but it makes it pretty hard to reason about many of the limits.
>
> A simple advantage to breaking the symmetry is that if A does a unilateral
> close, then B can immediately confirm that closure releasing all funds
> for both parties. Without breaking the symmetry, you can't distinguish
> that case from B attempting to confirm his own unilateral close, which
> would allow B to cheat.

Yes, IIUC the proposed flow is UA.n -> CB.n -> money, and in this optimistic case, there is only one CLTV delay to respect the spend of the UA. In terms of timevalue cost to redeem all the funds, I think this is making the cost equivalent for all the parties. With today's LN-penalty, the broadcaster balance is encumbered by the CSV delay, not the counterparty one.

(Note on the gist, the UA state description includes a Pa or tapscript "IF CODESEP n OP_CLTV DROP ENDIF 1 CHECKSIG" as spendable paths and the CA.n state description nSequence = 0, so I'm not sure how the update/justice delay is enforced)

Quoted text (8 lines)
> Yes, you can unilaterally close the channel with state N-1; but even
> then they might respond by bumping to state N anyway. If that happens,
> then the funds can remain locked up until the timeout, as you can no
> longer time the htlc out off-chain.
>
> Still, if it's one hung per htlc for the channel's entire lifetime
> (because you close it "immediately" when it happens), that's probably
> not going to cause problems frequently...

I think here the issue can be corrected by selecting conservatively your implementation channel breakout timers, you should go to chain with the state N-1 with X buffer of block and ensure your CLTV delta are always bigger than X, where X=delay * 2. That way even if your counterparty is broadcasting state N at X-1, your htlc-timeout should be safe, I guess.

Quoted text (4 lines)
> If Alice is dishonest, and posts a very old state (n-x), then Bob could
> post up to x watchtower txs (WB.(n-x+1) .. WB.n) causing Alice to be
> unable to access her funds for up to (x+1)*to_self_delay blocks. But
> that's just a reason for her to not be dishonest in the first place.

So I think there still is the case of Bob broadcasting a very old state and Alice's watchtowers colluding to prevent Alice's honest funds access, potentially preventing the HTLC-timeout, IIUC. I don't know if we're not introducing some changes in the trust assumptions towards watchtowers where with vanilla eltoo a single compromised watchtower can be corrected by the honest channel holder or another watchtower, iirc.

Quoted text (8 lines)
> No -- the RB.n transactions immediately release A's funds after applying
> the penalty, so if the watchtower colludes with A and has an old RB.y
> transaction, Alice can steal funds by posting UA.x and RB.y, provided that
> her balance now is sufficiently less than her balance then (ie bal.n <
> bal.y - penalty).
>
> In this model, Bob shouldn't be signing RB.n or CB.n txs until Alice
> has already started a unilateral close and posted UA.n/UA.k.

So the penalty transactions should not be delegated to untrusted watchtowers. In case of RB.n signing key compromise, the whole channel funds might be lost.

Quoted text (4 lines)
> Doesn't generalise to redundant untrusted watchtowers though, but
> presumably nothing does. (You could use the same utxo across multiple
> watchtowers, but a rogue watchtower could just post an old WA.k tx and
> claim your funds, preventing some honest watchtower from helping)

So you could have a channel balance between the watchtower and yourself, where the tower balance is the payment for the WA.n broadcast, and there is an assumption the balance is cooperatively updated to adjust for on-chain fees. For sure, I'm not sure either how it would generalize to an untrusted watchtower, where interactions might be even bounded to avoid leak of the client identity.

Still, I think eltoo channels would simplify the implementation of distributed towers by Lightning implementation, notably handling concurrent broadcast w.r.t chain asynchronicity issues, and hopefully removing the concern of commitment transaction key duplication by tower [0].

Best, Antoine

[0] https://github.com/lightningdevkit/rust-lightning/pull/679

Le ven. 9 déc. 2022 à 01:55, Anthony Towns <aj at erisian.com.au> a écrit :

Quoted text (241 lines)
> On Thu, Dec 08, 2022 at 02:14:06PM -0500, Antoine Riard wrote:
> > >  - 2022-10-21, eltoo/chia:
> > https://twitter.com/bramcohen/status/1583122833932099585
> > On the eltoo/chia variant, from my (quick) understanding, the main
> > innovation aimed for is
>
> I'd say the main innovation aimed for is just doing something like
> lightning over the top of chia (rather than bitcoin, liquid, ethereum
> etc), and making it simple enough to be easily implemented.
>
> > the limitation of the publication of eltoo states
> > more than once by a counterparty, by introducing a cryptographic puzzle,
> > where the witness can be produced once and only once ? I would say you
> > might need the inheritance of the updated scriptpubkey across the chain
> of
> > eltoo states, with a TLUV-like mechanism.
>
> Chia uses different terminology to bitcoin; "puzzle" is just what we call
> "scriptPubKey" in bitcoin, more or less. Since its scripting capabilities
> are pretty powerful, you can rig up a TLUV/OP_EVICT like mechanism, but
> for a two-party setup, in practice I think that mostly just means you
> can encode the logic directly as script, and when updating the state you
> then only need to exchange CHECKSIGFROMSTACK-like signatures along the
> lines of "state N implies outputs of A,B,C,... -- Alice", rather than
> signing multiple transactions.
>
> > > The basic idea is "if it's a two party channel with just Alice and Bob,
> > > then if Alice starts a unilateral close, then she's already had her
> say,
> > > so it's only Bob's opinion that matters from now on, and he should be
> > > able to act immediately", and once it's only Bob's opinion that
> matters,
> > > you can simplify a bunch of things.
> > From my understanding, assuming Eltoo paper terminology, Alice can
> publish
> > an update K transaction, and then after Bob can publish an update
> > transaction K<N or Alice can publish the settlement transaction N, or Bob
> > can publish an update transaction N. The main advantage of this
> > construction I can see is a strict bound on the shared_delay encumbered
> in
> > the on-chain publication of the channel ?
>
> If you have fully symmetric transactions, then you could have the
> situation where Alice broadcasts update K, then attacks Bob and when
> he attempts to post update N, she instead does a pinning attack by
> broadcasting update K+1 (spending update K), which then forces Bob to
> generate a new version update N, which she then blocks with update K+2,
> etc. An attack like that is presumably pretty difficult to pull off in
> practice, but it makes it pretty hard to reason about many of the limits.
>
> A simple advantage to breaking the symmetry is that if A does a unilateral
> close, then B can immediately confirm that closure releasing all funds
> for both parties. Without breaking the symmetry, you can't distinguish
> that case from B attempting to confirm his own unilateral close, which
> would allow B to cheat.
>
> > > fast forwards: we might want to allow our channel partner
> > > to immediately rely on a new state we propose without needing a
> > > round-trip delay -- this potentially makes forwarding payments much
> > > faster (though with some risk of locking the funds up, if you do a
> > > fast forward to someone who's gone offline)
> >
> > IIRC, there has already been a "fast-forward" protocol upgrade proposal
> > based on update-turn in the LN-penalty paradigm [0]. I think reducing the
> > latency of HTLC propagation across payment paths would constitute a UX
> > improvement, especially a link-level update mechanism upgrade deployment
> > might be incentivized by routing algorithms starting to penalize routing
> > hops HTLC relay latency. What is unclear is the additional risk of
> locking
> > the funds up. If you don't receive acknowledgement the fast forward state
> > has been received, you should still be able to exit with the state N-1 ?
>
> Yes, you can unilaterally close the channel with state N-1; but even
> then they might respond by bumping to state N anyway. If that happens,
> then the funds can remain locked up until the timeout, as you can no
> longer time the htlc out off-chain.
>
> Still, if it's one hung per htlc for the channel's entire lifetime
> (because you close it "immediately" when it happens), that's probably
> not going to cause problems frequently...
>
> > > doubled delays: once we publish the latest state we can, we want to
> > > be able to claim the funds immediately after to_self_delay expires;
> > > however if our counterparty has signatures for a newer state than we
> > > do (which will happen if it was fast forwarded), they could post that
> > > state shortly before to_self_delay expires, potentially increasing
> > > the total delay to 2*to_self_delay.
> >
> > While the 2*to_self_delay sounds the maximum time delay in the state
> > publication scenario where the cheating counterparty publishes a old
> state
> > then the honest counterparty publishes the latest one, there could be the
> > case where the cheating counterparty broadcast chain of old states, up to
> > mempool's `limitancestorcount`. However, this chain of eltoo transactions
> > could be replaced by the honest party paying a higher-feerate (assuming
> > something like nversion=3).
>
> With the asymmetric transactions proposed here, you'd need to have your
> watchtowers collude with the attacker for this to happen.
>
> I think you could prevent chains from building up in the mempool by
> requiring a relative timelock of perhaps 2 or 3 blocks for a WA.n/WB.n
> tx to be valid (giving you time to post RA.n/RB.n in the meantime).
>
> > > * WA.n, WB.n : watchtower update to state n
> > >   - this is for an untrusted watchtower to correct attempted cheating
> > >     by Bob on behalf of Alice (or vice-versa). Spends UB.k or WA.k
> > >     (or UA.k/WB.k) respectively, provided k < n.
> > I wonder if the introduction of watchtower specific transactions doesn't
> > break the 2*to_self_delay assumption
>
> The to_self_delay applies to whoever initiated the unilateral close,
> and provided they actually posted the most recent state, no watchtower
> tx is a valid spend. ie, if Alice is honest and n is the latest state,
> then the only possible spends of UA.n are SA.n (after a delay) or CB.n,
> and as soon as either of those are on chain, she gets access to her funds.
> No version of WB.k or RB.k (or WA.k, CA.k, RA.k) are valid if k<=n and
> UA.n is confirmed.
>
> If Alice is dishonest, and posts a very old state (n-x), then Bob could
> post up to x watchtower txs (WB.(n-x+1) .. WB.n) causing Alice to be
> unable to access her funds for up to (x+1)*to_self_delay blocks. But
> that's just a reason for her to not be dishonest in the first place.
>
> > (iiuc it's a design goal of current
> > protocol) and what is the design rationale. Beyond that, there is a
> concern
> > with watchtower-specific transactions, it might leak your towers topology
> > (i.e the number of them and the distribution in the p2p network) to an
> > adversary.
>
> If you have a watchtower and it takes action, I don't think you can
> expect to retain privacy over the fact that you have a watchtower,
> and how effective it is against an attacker with extensive monitoring
> of the p2p network...
>
> > > * SA.n, SB.n : slowly claim funds according to state n
> > >   - this is for Alice to claim her funds if Bob is completely offline
> > >     (or vice-versa). Spends UA.n, UB.n, WA.n or WB.n with relative
> > >     timelock of to_self_delay.
> >
> > If I'm following correctly the description, this is logically equivalent
> to
> > the sweep of a `to_local`/`to_remote` output on a commitment transaction
> > though instead the waiting delay is eltoo shared_delay. There is no
> > to_self_delay, at the punishment seems only to happen on the
> update-level,
> > or maybe one should be also able to punish slow fund exit, and another
> > relative locktime should exist on the S* transactions.
>
> I'm just using "to_self_delay" as the X in "if you attempt to cheat,
> I'll definitely notice and take action within X blocks". If you post
> UA.n then post SA.n after X blocks (due to SA.n's relative time lock)
> then you've already proven you didn't cheat, because that was enough
> time for B to notice and take action.
>
> > > * Alice and Bob's watchtower collude, but Bob has many watchtowers:
> > >     F -> UA.k1 -> WB.k2 -> WB.n -> (to_self_delay) -> SA.n -> money
> > Could the punishment transactions R* be also delegated to watchtowers,
> > assuming they have been pre-signed to lockdown the exit scriptpubkeys ?
>
> No -- the RB.n transactions immediately release A's funds after applying
> the penalty, so if the watchtower colludes with A and has an old RB.y
> transaction, Alice can steal funds by posting UA.x and RB.y, provided that
> her balance now is sufficiently less than her balance then (ie bal.n <
> bal.y - penalty).
>
> In this model, Bob shouldn't be signing RB.n or CB.n txs until Alice
> has already started a unilateral close and posted UA.n/UA.k.
>
> > > In order to allow fast-forwards, when Alice proposes a new state,
> > > she needs to send her partial signatures to allow Bob to unilaterally
> > > accept the new state, ie sigs for: UB.n, CB.n, SB.n, RB.n. But she
> > > also needs to be able to claim the funds if Bob proposes the new state
> > > and broadcasts UB.n, she needs to be able broadcast CA.n. This can be
> > > achieved with an adaptor signature approach (spelt out a bit more fully
> > > in the gist) or a CTV-like approach, provided that UB.n reveals the
> > > state needed to calculate the the CTV commitment (see "EXPR_SETTLE" in
> > >
> >
> https://github.com/instagibbs/bolts/blob/29fe6d36cbad4101d5ec76c2b19c83c1494ac2fc/XX-eltoo-transactions.md
> > ).
> >
> > If you would like to have fast forward of chain of transactions, I wonder
> > if there could be also the "sig-in-the-script" trick, where UB.n
> > scriptpubkey (or one of its tapscripts) contains the signature for CB.n,
> > SB.n, RB.n. Though you might have an issue of re-generating the
> > witnessscript in case of state loss.
>
> Broadcasting UB.n will only reveal signatures by B; so that would only
> potentially help with CA.n or RA.n; and if UB.n is on-chain, then RA.n
> isn't valid (since it would require "n < n").
>
> The EXPR_SETTLE stuff in the github link describes how to do the trick
> via a CTV-ish approach (including an APO signature in a tapscript in the
> scriptPubKey of UA.n here; and including data in the annex so that you
> can recalculate thinks if an old UA.n is broadcast after you've
> forgotten n's state details).
>
> > > * how to pay watchtowers -- when a watchtower broadcasts a W
> > >   transaction, it needs to add fees, and it's not clear (to me) how it
> > >   could fairly and reliably ensure it's compensated for those costs,
> > >   particularly if multiple W transactions are broadcast for a single
> > >   unilateral close attempt, due to one or more watchtowers colluding
> > >   with an attacker, or simply having out of date information.
> > I wonder if paying a watchtower, or getting paid as a watchtower isn't  a
> > "counterparty risk" similar to what is happening with jamming due to
> > non-covered HTLC forward risk.
>
> Actually, perhaps you could "yo dawg" it: if you give the watchtower a
> pre-signed transaction WA.n:
>
>     input 1: UA.k/WA.k (ANYPREVOUTANYSCRIPT, SINGLE)
>     input 2: my funds (SINGLE, ALL)
>
>     output 1: WA.n
>     output 2: new lightning channel between me and watchtower
>     output 3: ephemeral OP_TRUE output
>
> then you could have the "new lightning channel" be setup with an initial
> capacity of "my funds", and off-chain update the state of that channel so
> that the watchtower's balance is how much you're willing to contribute in
> fees if the watchtower does its job. If you set things up so that you're
> always able to claim a penalty via WA.n->RA.n if the watchtower acts,
> then you can give up to that penalty to the watchtower and still end up
> making a profit.
>
> Doesn't generalise to redundant untrusted watchtowers though, but
> presumably nothing does. (You could use the same utxo across multiple
> watchtowers, but a rogue watchtower could just post an old WA.k tx and
> claim your funds, preventing some honest watchtower from helping)
>
> (Yo dawg, I heard you liked closing lightning channels, so we put a
> lightning channel in your watchtower, so you can close a channel while
> you're closing a channel. Alternatively: "when god closes one channel,
> he opens another")
>
> Cheers,
> aj
>
>
Anthony Towns in reply to Antoine Riard permalink original

On Thu, Jan 05, 2023 at 06:59:42PM -0500, Antoine Riard wrote:

Quoted text (8 lines)
> > A simple advantage to breaking the symmetry is that if A does a unilateral
> > close, then B can immediately confirm that closure releasing all funds
> > for both parties. Without breaking the symmetry, you can't distinguish
> > that case from B attempting to confirm his own unilateral close, which
> > would allow B to cheat.
> Yes, IIUC the proposed flow is UA.n -> CB.n -> money, and in this
> optimistic case, there is only one CLTV delay to respect the spend of the
> UA.

The only delay in the UA.n/CB.n case is if someone's trying to redeem an HTLC that times out in the future, in which case you might have UA.n, CB.n, (CB.n -> A's balance), (CB.n -> B's balance), (CB.n -> A claiming HTLC x with preimage x') all in the same block, but (CB.n -> A claiming HTLC y at timeout) happening 100 blocks later, when y times out.

Quoted text (4 lines)
> (Note on the gist, the UA state description includes a Pa or tapscript "IF
> CODESEP n OP_CLTV DROP ENDIF 1 CHECKSIG" as spendable paths and the CA.n
> state description nSequence = 0, so I'm not sure how the update/justice
> delay is enforced)

(Note that the CLTV here is just for eltoo state ratcheting, and is always in the past so doesn't imply an actual delay)

CA.n is only able to spend UB.n, not UA.n. (Or it can spend WA.n, but WA.n can only spend UB.k or prior WA.k, so it means much the same thing).

That's achievable by having the CA.n signature use ANYPREVOUT rather than ANYPREVOUTANYSCRIPT (thus committing to UB.n/WA.n's shared scriptPubKey) and having different scriptPubKey's between UA.n and UB.n (which breaks the symmetry).

SA.n spends UA.n or WB.n in the same way, except also sets nSequence to force a relative timelock.

Quoted text (7 lines)
> > If Alice is dishonest, and posts a very old state (n-x), then Bob could
> > post up to x watchtower txs (WB.(n-x+1) .. WB.n) causing Alice to be
> > unable to access her funds for up to (x+1)*to_self_delay blocks. But
> > that's just a reason for her to not be dishonest in the first place.
> So I think there still is the case of Bob broadcasting a very old state and
> Alice's watchtowers colluding to prevent Alice's honest funds access,
> potentially preventing the HTLC-timeout, IIUC.

Alice was the dishonest one here, so it'd be Alice broadcasting an old state, preventing Bob from accessing funds.

If you're not online and have no honest watchtowers, then Alice can just broadcast an old state, wait for the delay, and confirm the old state (UA.k -> SA.k), and steal as much as she wants.

If you are online, or have honest watchtowers, then your honest CB.n or WB.n can be confirmed in the same block as 2000 dishonest WB.(k+1), WA.(k+2) txs. The point of having a watchtower helping you out is that the watchtower can do fancier things than your lightning node on your phone, like observe the mempool and potentially have direct relationships with mining pools to overcome things like the 25 tx ancestor/descendant limit.

Quoted text (4 lines)
> I don't know if we're not
> introducing some changes in the trust assumptions towards watchtowers where
> with vanilla eltoo a single compromised watchtower can be corrected by the
> honest channel holder or another watchtower, iirc.

The same scenario applies in traditional eltoo, except in that case Alice doesn't need to compromise any of Bob's watchtowers, she can just broadcast multiple states herself -- since the txs are symmetric, there's no difference between Alice.1 -> Alice.2 and Alice.1 -> Bob.2; so you can't allow the latter while preventing the former (and there's likewise no difference between those and Alice.1 -> Watchtower.2).

Quoted text (10 lines)
> > No -- the RB.n transactions immediately release A's funds after applying
> > the penalty, so if the watchtower colludes with A and has an old RB.y
> > transaction, Alice can steal funds by posting UA.x and RB.y, provided that
> > her balance now is sufficiently less than her balance then (ie bal.n <
> > bal.y - penalty).
> >
> > In this model, Bob shouldn't be signing RB.n or CB.n txs until Alice
> > has already started a unilateral close and posted UA.n/UA.k.
> So the penalty transactions should not be delegated to untrusted
> watchtowers.

Yes.

Quoted text (2 lines)
> In case of RB.n signing key compromise, the whole channel
> funds might be lost.

Compromise of pretty much any of the signing keys allows all the channel funds to be lost; this is always true of the key used for signing cooperative closes, for instance.

If you do want to delegate punishment, you could probably have an alternative setup where every watchtower transaction implies punishment.

(I assume watchtower punishment needs to be all or nothing, otherwise a compromised watchtower would just rbf any attempts to punish, switching them over to non-punishment, which then encourages attackers to compromise watchtowers (and prioritise attacking people who use their compromised watchtowers), and you'd end up with "nothing" anyway...)

Something like:

no-punishment:
  UA.n -> delay -> SA.n (keypath)
  UA.k -> CB.n         (k <= n)
punishment of Alice:
  UA.k -> RB.n         (k < n - X)
  UA.k -> WB.n         (k < n)
  WB.k -> WB.n         (k < n)
  WB.k -> RB.n         (k <= n)
  WB.n -> delay -> TA.n

where A only signs WB.n when the state has already updated to n+X, and TA.n/RB.n transfers the punishment amount from A's balance to B's balance compared to SA.n/CB.n.

That introduces an extra signature per state for TA.n, and probably an additional one given the different constraints for RB.n when spending UA.k vs WB.k.

Cheers, aj