Research/Bitcoin Dev Archive / lightning-dev list
Using Per-Update Credential to enable Eltoo-Penalty
10 messages, Jul 13 to 17, 2019. Started by Antoine Riard.
ZmnSCPxj (5), Antoine Riard (4), Christian Decker
Hi all,
Eltoo has been criticized to lower the cost for a malicious party to test your monitoring of the chain. If we're able to reintroduce some form of punishment without breaking transaction symmetry that would be great.
Transaction symmetry implies that we can't deduce from observing txid which party broadcast a previous state. How to assign the faulty broadcast to the right party to punish it in consequence ? Thanks to taproot we have cheap witness asymmetry. Witness asymmetry can be used as a way to force the broadcaster to reveal a secret, and so committing thatn the transaction is the latest one.
If the party misbehaves, we wish to use the revealed secret to punish him on a second stage transaction. Doing so would be really insecure in case of reorg or even mempool monitoring by enabling a replay attack of your committed secret on a lower state update tx. i.e Mallory would counterfeit being Alice, and so enable the use of a punishment tx against an honest peer.
To solve the assignment problem, we need to have per-update credentials, a secret committed to a state number. You need a scheme were both your highest credential can't be used against you while at the same time if some attacker broadcast a transaction with a lower credential you are able to punish him.
How to make Bitcoin Script aware of a secret committed to a lower state number ? To do so, we may use some SIGHASH magic, if you sign two messages with the same key and we can be sure thatn the only difference between them is the nLocktime (encoding the state-number in eltoo), that means you tried to breach the contract.
Without access to arbitrary messages on the stack, the only messages we can enforce signatures on are Bitcoin transactions. We force a party broadcasting an Update tx to sign it with SIGHASH_ANYPREVOUTSCRIPT|SIGHASH_NONE|SIGHASH_SINGLE. If someone can shows a Litigation Tx with a higher state than the Update, we know that this one has been revoked, and someone is cheating among channel parties. We enter in a Litigation phase, the Settlement Tx will be encumbered by a Challenge Tx against which you will need to produce a signature with the same SIGHASH flags as the Update Tx., The only difference will be the nLocktime inherited from Litigation.
Assume Alice is trying to cheat, now Bob can take the signature from her broadcast Update tx and Alice’s signature on the Challenge tx, pass it as witness to a script verifying their validity and identity. If their validity is true and identity is false, you can spend with a Justice tx, splitting Alice’s funds between the other parties. If validity is true and identity is true, then the script should fail. After timelock expiration, if no one has proven Alice misbehaved, she can redeem her funds.
Eltoo-Penalty Transaction Tree ==============================
Friendly Settlement Tx
Challenge Tx -- Justice Tx
/
/
/
/
Funding-Output -- Update Tx -- Litigation Tx -- .. -- Hostile Settlement Tx
-- Challenge Tx -- Justice Tx
\
\ Challenge Tx -- Justice Tx
Eltoo-Penalty Scripts ================
(I've omitted chaperon signatures)
FUNDING_OUTPUT: output 0: Q = P + tG P = muSig(A,B,C) scripts = [ "OP_1 CHECKSIGVERIFY <Alice_key> CHECKSIGVERIFY" (Alice script path) "OP_1 CHECKSIGVERIFY <Bob_key> CHECKSIGVERIFY" (Bob script path) "OP_1 CHECKSIGVERIFY <Caroll_key> CHECKSIGVERIFY" (Caroll script path) ]
UPDATE TX: nLocktime: 500e6 + n output 0: P = muSig(A,B,C) scripts = [ "OP_1 CHECKSIGVERIFY" (friendly settlement script path) "OP_1 CHECKSGIVERIFY 500e6+n OP_CLTV OP_DROP" (litigation script path) witness: "sig(A, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=SINGLE)" (Alice commitment signature) "sig(B, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=SINGLE)" (Bob commitment signature) "sig(C, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=SINGLE)" (Caroll commitment signature)
LITIGATION TX: nLocktime: 500e6 + n nSequence: [delay] output 0: P = muSig(A,B,C) scripts = [ "OP_1 CHECKSIG" (litigation script path) "OP_1 CHECKSIGVERIFY" (hostile settlement script path) witness: "sig(P, hash_type=SINGLE|ANYPREVOUTANYSCRIPT)
HOSTILE SETTLEMENT TX: nLocktime: 0 nSequence: [delay] output 0: (to_Alice) P = muSig(A,B,C) scripts = [ "OP_1 CHECHSIGVERIFY <Alice_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" (Alice challenge script path) ] output 1: (to_Bob) P = muSig(A,B,C) scripts = [ "OP_1 CHECHSIGVERIFY <Bob_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" (Bob challenge script path) ] output 2: (to_Caroll) P = muSig(A,B,C) scripts = [ "OP_1 CHECHSIGVERIFY <Caroll_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" (Caroll challenge script path) ] output N (pending HTLCs) witness: "sig(P, hash_type=ALL)
CHALLENGE TX: (Alice case)
nLocktime: 500e6n
nSequence: 0
output 0:
P = muSig(A,B,C)
scripts = [
"OP_1 CHECKSIGVERIFY OP_DUP <Alice_key> CHECKSIGVERIFY OP_DUP OP_SWAP
<Alice_key> CHECKSIGVERIFY
OP_EQUAL OP_NOT OP_VERIFY" (proof-of-Alice-fraud script path)
"<n> OP_CSV <Alice refund_key> (refund Alice script path)
]
witness:
"sig(A, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=ALL)"
JUSTICE TX: (Alice punishment) nLocktime: 500e6n nSequence: 0 output 0: (to_Caroll) output 1: (to_Bob) witness: "sig_Alice_from_update_tx sig_Alice_from_challenge_tx sig(P, hash_type=ALL)"
State Update ============
Alice, Bob and Caroll build new friendly Settlement tx N, new Update Tx and revoke old one by generating a Justice tx with state higher than the previous one, a hostile Settlement tx plus Y challenge txn and Y justice txn with Y number of parties.
Cooperative Case ================
After X updates, Alice, Bob, Caroll, cooperate to closing transaction using key path spending of funding Taproot output, the spending transactions contains accurate balances.
Unilateral Case ================
After X updates, Alice broadcast the last Update tx N, by signing it with her private key with SIGHASH_NONE,SIGHASH_ANYPREVOUTANYSCRIPT,SIGHASH_SINGLE and use MuSig previously distributed between parties at state update. Her signature doesn't protect anything except commitment to the latest state number.
After finalization of the friendly settlement tx, she can redeem her balance, and timeout/fulfill her outputs.
If she has broadcast the latest state, none of the parties should be able to broadcast a Litigation tx with a highest state number. Her signature committing to the locktime, no one is able to counterfeit her identity by spending the funding taproot output with a lowest update tx.
Malicious Case ==============
Bob is broadcasting a lowest Update tx with his signature committing to it. Alice use Litigation tx to spend it, if anyone has a highest Litigation tx, he can use it. After Litigation tx finalization, hostile settlement transaction is used. Each output returning to a channel party, is encumbered by a "challenge". To unlock your funds, you must provide a signature against same pubkey and same SIGHASH flags than the one encumbering your tapscript for funding output.
Challenge tx is using a taproot output, one leaf returning fund to Alice after some timelock, The other one, let anyone with a MuSig and two valid signatures committing to different nLocktime to send challenged fund to a Justice tx, doing an equal split between other channel parties.
You need signatures to be safe against third-party malleability, i.e being able to tweak your signatures to be still valid but diff being interpreted as a proof of commitment on lowest state number. On the Justice tx, you need a new key type to enforce that every signature must have sighash SIGHASH_MASKLOCKTIMEWITH, where you expect the signature to be followed by the state number which is going to be used as locktime in transaction digest algorithm. So in this way state number are provided in witness and you can equivocate Justice tx as both revoked Update Tx and Challenge Tx.
Okay, I'm quite sure that Script gurus on this list are going to point flaws of this scheme. It's more a thought experiment and I was curious if anyone has other ideas to get Eltoo + penalties, if yes let it know !
Good morning Atoine,
Thank you for your proposal.
Quoted text (3 lines)
> Eltoo has been criticized to lower the cost for a malicious party to > test your monitoring of the chain. If we're able to reintroduce some > form of punishment without breaking transaction symmetry that would be great.
The primary advantage of Decker-Russell-Osuntokun is that it eliminates "toxic waste".
By this we mean, older version of your channel database are "toxic" in that you, ***or someone who wants to attack you***, can use it (accidentally in your case, deliberately in the attacker case), and then you will lose all funds in the channel.
Note that access to your channel database, without necessarily accessing your node private keys, is often easier. For example, C-Lightning stores channel data into an SQLITE database and exposes every transaction it makes to a `db_hook` that plugins can use to replicate the database elsewhere. If you were to use an insufficiently secured plugin to replicate your database, an attacker might be able to access your channel data, replicate your database, and use an older version to frame you for theft and make you lose all your channel funds.
Thus, Decker-Russell-Osuntokun removes the punitive consideration so that you being framed for theft does not lose all your funds, it merely closes your channels.
However, it look to me that you attempt to fix the toxic waste issue, as you mention a "Mallory" later that attempts to frame Alice (possibly by broadcasting old state). On the other hand, it seems, there is no description of how Alice might go about protecting herself from Mallory.
In particular, it seems to me that it would be trivial for Alice to avoid punishment by first creating a fake "Mallory", then taking whatever path would let Alice "off the hook" for a framing Mallory when at risk of getting caught, thus returning the "reduced cost for trying to steal channel funds".
Quoted text (26 lines)
> > Transaction symmetry implies that we can't deduce from observing > txid which party broadcast a previous state. How to assign the > faulty broadcast to the right party to punish it in consequence ? > Thanks to taproot we have cheap witness asymmetry. > Witness asymmetry can be used as a way to force the broadcaster to reveal > a secret, and so committing thatn the transaction is the latest one. > > If the party misbehaves, we wish to use the revealed secret to punish > him on a second stage transaction. Doing so would be really insecure > in case of reorg or even mempool monitoring by enabling a replay attack > of your committed secret on a lower state update tx. i.e Mallory > would counterfeit being Alice, and so enable the use of a punishment tx > against an honest peer. > > To solve the assignment problem, we need to have per-update credentials, > a secret committed to a state number. You need a scheme were both your > highest credential can't be used against you while at the same time if some > attacker broadcast a transaction with a lower credential you are able to > punish him. > > How to make Bitcoin Script aware of a secret committed to > a lower state number ? To do so, we may use some SIGHASH magic, if you sign > two messages with the same key and we can be sure thatn the only difference between > them is the nLocktime (encoding the state-number in eltoo), that means you > tried to breach the contract.
Could a hash preimage be used instead, with revocation? We would require that the hash preimage be unique per-update, but the same technique used in current Poon-Dryja (Russell shachain) can be used to store the preimages of revoked states.
Quoted text (28 lines)
> > Without access to arbitrary messages on the stack, the only messages we can > enforce signatures on are Bitcoin transactions. We force a party > broadcasting an Update tx to sign it with > SIGHASH_ANYPREVOUTSCRIPT|SIGHASH_NONE|SIGHASH_SINGLE. If someone can shows a > Litigation Tx with a higher state than the Update, we know that this one has > been revoked, and someone is cheating among channel parties. We enter in a > Litigation phase, the Settlement Tx will be encumbered by a Challenge Tx against > which you will need to produce a signature with the same SIGHASH flags as the Update Tx., > The only difference will be the nLocktime inherited from Litigation. > > Assume Alice is trying to cheat, now Bob can take the signature from her broadcast Update tx > and Alice’s signature on the Challenge tx, pass it as witness to a script verifying their validity > and identity. If their validity is true and identity is false, you can spend with a Justice tx, > splitting Alice’s funds between the other parties. If validity is true and identity is true, then the script should fail. After timelock expiration, if no one has proven Alice misbehaved, > she can redeem her funds. > > Eltoo-Penalty Transaction Tree > ============================== > > > Friendly Settlement Tx Challenge Tx -- Justice Tx > / / > / / > Funding-Output -- Update Tx -- Litigation Tx -- .. -- Hostile Settlement Tx -- Challenge Tx -- Justice Tx > \ > \ Challenge Tx -- Justice Tx >
I am uncertain if some of the alignment has gotten lost above, but currently your graph is somewhat confusing.
Quoted text (21 lines)
> Eltoo-Penalty Scripts > ================ > > (I've omitted chaperon signatures) > > FUNDING_OUTPUT: > output 0: > Q = P + tG > P = muSig(A,B,C) > scripts = [ > "OP_1 CHECKSIGVERIFY <Alice_key> CHECKSIGVERIFY" (Alice script path) > "OP_1 CHECKSIGVERIFY <Bob_key> CHECKSIGVERIFY" (Bob script path) > "OP_1 CHECKSIGVERIFY <Caroll_key> CHECKSIGVERIFY" (Caroll script path) > ] > > UPDATE TX: > nLocktime: 500e6 + n > output 0: > P = muSig(A,B,C) > scripts = [ > "OP_1 CHECKSIGVERIFY" (friendly settlement script path)
This branch seems pointless --- could you not just use the non-taproot path? You do not describe the friendly-settlement transaction anywhere. Is the friendly-settlement have `nSequence` delay? When is it created?
Quoted text (5 lines)
> "OP_1 CHECKSGIVERIFY 500e6+n OP_CLTV OP_DROP" (litigation script path) > witness: > "sig(A, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=SINGLE)" (Alice commitment signature) > "sig(B, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=SINGLE)" (Bob commitment signature) > "sig(C, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=SINGLE)" (Caroll commitment signature)
It looks to me that you cannot use a later update transaction to replace an older update transaction, as the shared signature does not use `SIGHASH_ANYPREVOUT`?
Quoted text (11 lines)
> > LITIGATION TX: > nLocktime: 500e6 + n > nSequence: [delay] > output 0: > P = muSig(A,B,C) > scripts = [ > "OP_1 CHECKSIG" (litigation script path) > "OP_1 CHECKSIGVERIFY" (hostile settlement script path) > witness: > "sig(P, hash_type=SINGLE|ANYPREVOUTANYSCRIPT)
You mentions later that "if anyone has a highest Litigation tx, he can use it", but it does not look like that the litigation script path enforces this, did you forget to add some `OP_CHECKLOCKTIMEVERIFY` here?
Quoted text (43 lines)
> > HOSTILE SETTLEMENT TX: > nLocktime: 0 > nSequence: [delay] > output 0: (to_Alice) > P = muSig(A,B,C) > scripts = [ > "OP_1 CHECHSIGVERIFY <Alice_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" (Alice challenge script path) > ] > output 1: (to_Bob) > P = muSig(A,B,C) > scripts = [ > "OP_1 CHECHSIGVERIFY <Bob_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" (Bob challenge script path) > ] > output 2: (to_Caroll) > P = muSig(A,B,C) > scripts = [ > "OP_1 CHECHSIGVERIFY <Caroll_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" (Caroll challenge script path) > ] > output N (pending HTLCs) > witness: > "sig(P, hash_type=ALL) > > CHALLENGE TX: (Alice case) > nLocktime: 500e6n > nSequence: 0 > output 0: > P = muSig(A,B,C) > scripts = [ > "OP_1 CHECKSIGVERIFY OP_DUP <Alice_key> CHECKSIGVERIFY OP_DUP OP_SWAP <Alice_key> CHECKSIGVERIFY > OP_EQUAL OP_NOT OP_VERIFY" (proof-of-Alice-fraud script path) > "<n> OP_CSV <Alice refund_key> (refund Alice script path) > ] > witness: > "sig(A, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=ALL)" > > JUSTICE TX: (Alice punishment) > nLocktime: 500e6n > nSequence: 0 > output 0: (to_Caroll) > output 1: (to_Bob) > witness: > "sig_Alice_from_update_tx sig_Alice_from_challenge_tx sig(P, hash_type=ALL)"
`P` here is `muSig(A,B,C)`? Why would Alice willingly sign a `SIGHASH_ALL` signature (meaning the transaction IDs are known at this point and have been confirmed deeply onchain, so this is after Alice has gone and performed any attempts at theft) that would punish her? What happens when the Litigation Tx is later than the initial Update Tx?
Maybe this should instead be a revocation key whose privkey Alice reveals as part of the update ritual?
If a later Litigation Tx is used, than the Update Tx that was put onchain, is the signature from the Update Tx valid on the same transaction where the Challenge Tx is valid?
Explicitly stating what transaction outputs are spent by each transaction input would be better, especially since your graph is unclear.
Quoted text (7 lines)
> > State Update > ============ > > Alice, Bob and Caroll build new friendly Settlement tx N, new Update Tx and revoke old one by > generating a Justice tx with state higher than the previous one, a hostile Settlement tx plus > Y challenge txn and Y justice txn with Y number of parties.
You do not describe the friendly settlement transaction. I assume it has some `nSequence` somewhere.
Quoted text (41 lines)
> > Cooperative Case > ================ > > After X updates, Alice, Bob, Caroll, cooperate to closing transaction using key path > spending of funding Taproot output, the spending transactions contains accurate balances. > > Unilateral Case > ================ > > After X updates, Alice broadcast the last Update tx N, by signing it with her private key with > SIGHASH_NONE,SIGHASH_ANYPREVOUTANYSCRIPT,SIGHASH_SINGLE and use MuSig previously distributed > between parties at state update. Her signature doesn't protect anything except commitment to > the latest state number. > > After finalization of the friendly settlement tx, she can redeem her balance, and timeout/fulfill > her outputs. > > If she has broadcast the latest state, none of the parties should be able to broadcast a Litigation > tx with a highest state number. Her signature committing to the locktime, no one is able to > counterfeit her identity by spending the funding taproot output with a lowest update tx. > > Malicious Case > ============== > > Bob is broadcasting a lowest Update tx with his signature committing to it. Alice use Litigation tx > to spend it, if anyone has a highest Litigation tx, he can use it. After Litigation tx finalization, > hostile settlement transaction is used. Each output returning to a channel party, is encumbered > by a "challenge". To unlock your funds, you must provide a signature against same pubkey and same > SIGHASH flags than the one encumbering your tapscript for funding output. > > Challenge tx is using a taproot output, one leaf returning fund to Alice after some timelock, > The other one, let anyone with a MuSig and two valid signatures committing to different nLocktime > to send challenged fund to a Justice tx, doing an equal split between other channel parties. > > You need signatures to be safe against third-party malleability, i.e being able to tweak > your signatures to be still valid but diff being interpreted as a proof of commitment on lowest state number. On the Justice tx, you need a new key type to enforce that every signature must have sighash SIGHASH_MASKLOCKTIMEWITH, where you expect the signature to be followed by the state number which is going to be used as locktime in transaction digest algorithm. So in this way state number are provided in witness and you can equivocate Justice tx as both revoked Update Tx and Challenge Tx. > > Okay, I'm quite sure that Script gurus on this list are going to point flaws of this scheme. > It's more a thought experiment and I was curious if anyone has other ideas to get Eltoo + penalties, > if yes let it know !
The descriptions of the transactions and scripts involved are confusing and I am uncertain if you actually achieve your target. Could you clarify?
Regards, ZmnSCPxj
ZmnSCPxj via Lightning-dev <lightning-dev at lists.linuxfoundation.org> writes:
Quoted text (15 lines)
> Good morning Atoine, > > Thank you for your proposal. > >> Eltoo has been criticized to lower the cost for a malicious party to >> test your monitoring of the chain. If we're able to reintroduce some >> form of punishment without breaking transaction symmetry that would be great. > > The primary advantage of Decker-Russell-Osuntokun is that it > eliminates "toxic waste". > > By this we mean, older version of your channel database are "toxic" in > that you, ***or someone who wants to attack you***, can use it > (accidentally in your case, deliberately in the attacker case), and > then you will lose all funds in the channel.
I'm pretty sure at this point that the toxic-waste problem is inherent to punishment schemes, and anything we build on top of it would reintroduce asymmetry, undoing a lot of the benefits that we gained with eltoo. Then again, I personally don't think that punishments are such a great idea in the first place (having been inadvertently punished myself due to botched backups and similar things).
Quoted text (9 lines)
> Note that access to your channel database, without necessarily > accessing your node private keys, is often easier. For example, > C-Lightning stores channel data into an SQLITE database and exposes > every transaction it makes to a `db_hook` that plugins can use to > replicate the database elsewhere. If you were to use an > insufficiently secured plugin to replicate your database, an attacker > might be able to access your channel data, replicate your database, > and use an older version to frame you for theft and make you lose all > your channel funds.
Just a minor correction here: your own commitment transactions are not being signed until we want to release them. Therefore having access to your DB doesn't give an attacker the ability to frame the user with an old version, since that'd still require access to the keys to add our own signature. Even a simple signing component that keeps a high-water mark for the latest state and refuses to sign an older one would be sufficient to guard against involuntary cheating.
Nevertheless, there are quite a few damaging things an attacker can do if he get hold of your DB, just not this one :-)
Quoted text (3 lines)
> Thus, Decker-Russell-Osuntokun removes the punitive consideration so > that you being framed for theft does not lose all your funds, it > merely closes your channels.
Which is also not free: you are still paying on-chain fees for your failed attempt to enforce an older state, and you still don't get the desired effect, since the counterparty just overrides your attempt, without returning your fees.
Cheers, Christian
Good morning list,
Quoted text (2 lines)
> witness: > "sig(A, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=SINGLE)" (Alice commitment signature)
I realized that this would not work. Alice can simply sign `sig(A, hash_type=ALL)` instead at this stage, as she is the only signatory to the `<Alice key> OP_CHECKSIGVERIFY` and nobody else can impose that she use the above `hash_type`. And this signature is intended to be used to identify Alice as the culprit, by also being used to sign for <Alice key>, but `SIGHASH_ALL` would strongly bind the signature to this particular transaction.
You could use `MuSig(A, B, C)` instead and perform the MuSig signing ritual such that Alice is the last one to generate the final signature, but this massively complicates things as you need to perform `n` such rituals where `n` is the number of participants.
I think a hash/preimage challenge would work better here. Each participant would reveal an identifying hash on channel opening, with a preimage only each participant knows. This is used to restrict which Taproot script they can use to perform a unilateral close, thus identifying which participant initiated the unilateral close (and if the unilateral close is to an old state, can be used to identify who should be punished).
Quoted text (17 lines)
> > > Eltoo has been criticized to lower the cost for a malicious party to > > > test your monitoring of the chain. If we're able to reintroduce some > > > form of punishment without breaking transaction symmetry that would be great. > > > > The primary advantage of Decker-Russell-Osuntokun is that it > > eliminates "toxic waste". > > By this we mean, older version of your channel database are "toxic" in > > that you, or someone who wants to attack you, can use it > > (accidentally in your case, deliberately in the attacker case), and > > then you will lose all funds in the channel. > > I'm pretty sure at this point that the toxic-waste problem is inherent > to punishment schemes, and anything we build on top of it would > reintroduce asymmetry, undoing a lot of the benefits that we gained with > eltoo. Then again, I personally don't think that punishments are such a > great idea in the first place (having been inadvertently punished myself > due to botched backups and similar things).
I largely agree.
Quoted text (20 lines)
> > Note that access to your channel database, without necessarily > > accessing your node private keys, is often easier. For example, > > C-Lightning stores channel data into an SQLITE database and exposes > > every transaction it makes to a `db_hook` that plugins can use to > > replicate the database elsewhere. If you were to use an > > insufficiently secured plugin to replicate your database, an attacker > > might be able to access your channel data, replicate your database, > > and use an older version to frame you for theft and make you lose all > > your channel funds. > > Just a minor correction here: your own commitment transactions are not > being signed until we want to release them. Therefore having access to > your DB doesn't give an attacker the ability to frame the user with an > old version, since that'd still require access to the keys to add our > own signature. Even a simple signing component that keeps a high-water > mark for the latest state and refuses to sign an older one would be > sufficient to guard against involuntary cheating. > > Nevertheless, there are quite a few damaging things an attacker can do > if he get hold of your DB, just not this one :-)
Ah, I understand.
Quoted text (8 lines)
> > Thus, Decker-Russell-Osuntokun removes the punitive consideration so > > that you being framed for theft does not lose all your funds, it > > merely closes your channels. > > Which is also not free: you are still paying on-chain fees for your > failed attempt to enforce an older state, and you still don't get the > desired effect, since the counterparty just overrides your attempt, > without returning your fees.
Current Poon-Dryja requires a "reserve", a minimum amount that each participant must maintain in the channel. Though not fixed in the spec (each participant supposedly indicates the reserve they want from the other) all implementations I know of hardcode 1% of the channel total value as the reserve. This is the amount that can be used to punish a thief.
Now, an economically-maximizing thief would prefer to steal as much as possible, thus such a thief would initiate a channel, then send out funds until only 1% is left to the thief, then "freeze" the channel (fail all incoming HTLCs from this channel without bothering to check if they would succeed) until the participant is offline, then perform the theft attempt by using their initial commitment (the one where they own all the funds in the channel).
Thus, if the fee that is needed in Decker-Russell-Osuntokun is at or above 1% of the channel value, the fee lost would be larger than what a thief would risk under Poon-Dryja.
Of course, an economically-maximizing thief would make channels of up to our channel limit of 16,777,215 satoshi, of which 1% would be a large fee even during congestion conditions. Still, a node could refuse incoming channel open requests for Decker-Russell-Osuntokun that are larger than 100 times the typical fee for a 1-input 1-output transaction, and still get similar protection to Poon-Dryja using the de facto standard 1% reserve.
Regards, ZmnSCPxj
Good morning list,
I had another realization about the use of punishment in a multiparticipant (n > 2) setting. And it has to do with contracts that have a sort of "shared ownership".
Consider HTLC outputs. Such outputs have shared ownership, as the offerer of the HTLC will be able to reclaim the money after the timelock, and the accepter of the HTLC will be able to reclaim the money before the timelock.
Suppose we know that Alice cheated. Suppose also that Bob offered an HTLC to Alice with a hash whose preimage Alice secretly knows, and that Alice offered an HTLC to Charlie with a long future lock time with a hash that Alice secretly knows has a high probability that nobody knows the preimage.
How should Bob and Charlie split the HTLCs? If we do not punish the HTLCs, then Alice can arrange such that most of her money is in HTLCs that she can recover, and thereby avoid punishment. If we *do* punish the HTLCs, we would have to make the Bob->Alice revocable only in favor of Bob, and make the Alice->Carol revocable only in favor of Charlie.
This ties to constructions such as Channel Factories. I would argue that channel factories are better used than multiparticipant channels, as channel factories allow *some* limited transport of funds even if one participant is offline, whereas multiparticipant channels prevent *all* transport of funds as soon as any one participant is offline. At the same time, channel factories allow arbitrary transport of funds between any participants inside the factory if all participants are online: if a channel is exhausted, but the paying participant has funds elsewhere, the paying participant can initiate a channel reorganization and move funds to the exhausted channel.
Channel factories host channels. Channels are shared-ownership UTXOs, in much the same way that HTLCs are shared-ownership UTXOs.
Thus, if we will use this construction to implement channel factories, channels inside the factory should be punished by transferring the funds to the other participant of the channel.
However, things can get more complicated as the states inside the construction change over time.
--------
Let us return to the HTLC example.
Suppose there exists an Alice->Bob HTLC in the old state that Alice the thief publishes, and that the entire value of the construction is in that HTLC.
Let us consider what happens if Alice the thief performs the theft attempt during various states:
* Suppose the current state is that Charlie owns the entire funds of the channel right now. Alice steals by publishing old state, but the old-state Alice->Bob HTLC is revocable only by Bob. Thus the money (that rightfully belongs to Charlie) goes to Bob instead. * Alice and Bob could be in cahoots, with Bob as the mastermind and Alice as the fall guy. * Suppose we decide that the Alice->Bob HTLC is revocable split by Bob and Charlie. Suppose the current state is that Bob owns the entire funds of the channel right now. Alice steals by publishing old state, but the old-state Alice->Bob HTLC is revocable split by Bob and Charlie. Thus the money (that rightfully belongs only to Bob) goes partly to Charlie instead. * Alice and Charlie could be in cahoots, with Charlie as the mastermind and Alice as the fall guy.
It seems to me, that punishment systems can only work if one of the following are true:
* 2 participants, which prevents channel factory scaling. * OR, no smart contracts (HTLCs or subchannels), which prevents channel factory scaling, **and** network/routing scaling.
So I think that, in terms of multiparticipant constructions, non-punitive constructions are the only possible constructions.
Regards, ZmnSCPxj
Good morning list,
As usual, I am spamming the list for my amusement.
Thus, I would like to thank you for your tolerance and continued attention.
----
We have identified two requirements:
1. We must identify which participant initiated the unilateral close onchain.
We do so that if later, we find that the unilateral close was to an older state, we can punish the participant that initiated the unilateral close.
2. We must identify that a unilateral close was, in fact, to an older state.
Thus, I will counterpropose a construction similar to that originally proposed here, but with the weaknesses fixed and key details filled in. (while part of it is similar to the Decker-Russell-Osuntokun "eltoo", it is different enough that I would not suggest calling it "eltoo-penalty")
----
On initiation, Alice, Bob, and Charlie indicate:
* Alice/Bob/Charlie "fingerprint" hash/preimage. Alice/Bob/Charlie publish the fingerprint hashes, but keep the fingerprint preimages secret. * Alice/Bob/Charlie "normal" pubkey. * Alice/Bob/Charlie "lawyer" pubkey. * All participants indicate a `delay`, a number of blocks. Funds may be locked, in worst case, up to `2 * delay`.
We also introduce a "common" key whose private key is known to all participants. For example, we can use a key whose private key is `SHA256("ZmnSCPxj is a human being and not any kind of AI")` as a consensus-accepted fact.
We have the below transactions:
* Funding transaction
* inputs: unspecified
* outputs:
* change output(s): unspecified
* funding output:
* Internal Taproot Key: `P = MuSig(Alice normal pubkey, Bob normal pubkey, Charlie normal pubkey)`
* Scripts:
* `OP_1 OP_CHECKSIGVERIFY OP_HASH160 <Alice fingerprint hash> OP_EQUALVERIFY`
* `OP_1 OP_CHECKSIGVERIFY OP_HASH160 <Bob fingerprint hash> OP_EQUALVERIFY`
* `OP_1 OP_CHECKSIGVERIFY OP_HASH160 <Charlie fingerprint> OP_EQUALVERIFY`
* Update Transaction
* comment: this transaction initiates a unilateral close attempt.
* comment: Updates have a "hidden" `n`, which is an "update" number incrementing from 0.
This number could be encoded as `nLockTime` by using `500e6 + n`, but in principle does not need to be encoded there (we could use the current encoding in Poon-Dryja, which is encrypted so that normal unilateral closes do not reveal how many updates occurred).
* Update transaction might have other inputs/outputs used to pay for onchain fees.
* input:
* Funding transaction output
* witness: one of the following, depending on which participant initiated the unilateral close:
* `<Alice fingerprint preimage> sign(MuSig(A normal, B normal, C normal), SIGHASH_ANYPREVOUTANYSCRIPT | SIGHASH_SINGLE)`
* `<Bob fingerprint preimage> sign(MuSig(A normal, B normal, C normal), SIGHASH_ANYPREVOUTANYSCRIPT | SIGHASH_SINGLE)`
* `<Charlie fingerprint preimage> sign(MuSig(A normal, B normal, C normal), SIGHASH_ANYPREVOUTANYSCRIPT | SIGHASH_SINGLE)`
* comment: which witness script appears onchain depends on which participant initiated the unilateral close.
* output:
* Internal Taproot Key: `MuSig(A normal, B normal, C normal)`
* Scripts:
* `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP <MuSig(A normal, B normal, C normal)> OP_CHECKSIG`
* This is the "normal" unilateral path where the participant did not steal any funds.
* `<500e6 + n + 1> OP_CHECKLOCKTIMEVERIFY OP_DROP <MuSig(A lawyer, B lawyer, C lawyer)> OP_CHECKSIG`
* This is the "litigation" path where the participant is proven to have stolen funds by showing a litigation transaction with later `n` than the update transaction.
* Friendly Settlement Transaction
* comment: This transaction completes a unilateral close attempt and publishes all contracts transported in the channel without revocability branches.
* `nSequence`: `<delay>`
* input:
* Update transaction output
* witness: `sign(MuSig(A normal, B normal, C normal), SIGHASH_ANYPREVOUTANYSCRIPT)`
* outputs: unencumbered outputs for this state.
* Litigation Transaction
* comment: The appearance of this transaction onchain is taken as proof that the unilateral close attempt is definitely a theft attempt.
It can only be broadcast and confirmed if and only if the unilateral close Update Transaction has an `n` that is less than the latest agreed `n`.
* comment: A Litigation Transaction can be spent by another Litigation Transaction with higher `n`.
The intent is to force the current state onchain, in order to punish the thief using the *latest* state instead of punishing from old state.
* `nLockTime`: `500e6 + n`, where `n` is the update index for this Litigation Transaction.
* comment: a Litigation Transaction with `n` cannot spend an Update Transaction of same `n`, only `n - 1` or less.
* input:
* Update transaction output *OR* another Litigation Transaction output; Update/Litigation tx has `n` less than this Litigation transaction.
* witness: `sign(MuSig(A lawyer, B lawyer, C lawyer), SIGHASH_ANYPREVOUTANYSCRIPT | SIGHASH_SINGLE)`
* output:
* Internal Taproot Key: `MuSig(A lawyer, B lawyer, C lawyer)`
* scripts:
* `<500e6 + n + 1> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_1 OP_CHECKSIG`
* comment: This allows a Litigation Transaction with later `nLockTime` to spend this Litigation Transaction.
* `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP <500e6 + n> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_1 OP_CHECKSIG`
* comment: This is the "Hostile Settlement" path that allows revocation of outputs owned by the participant that initiated the unilateral close.
* Hostile Settlement Transaction
* `nLockTime`: `500e6 + n`
* input:
* Litigation Transaction output
* witness: `sign(MuSig(A lawyer, B lawyer, C lawyer), SIGHASH_ANYPREVOUTANYSCRIPT)`
* outputs:
* Depending on type of contract, outputs are revocable:
* Single-ownership contract (example below is Alice-owned)
* Taproot Internal Key: `P = NUMS point` (cannot be spent via non-Taproot path)
* scripts:
* `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP <A lawyer> OP_CHECKSIG`
* comment: This lets Alice recover its funds if it is not the thief.
* `OP_0 OP_CHECKSEQUENCEVERIFY OP_DROP OP_HASH160 <Alice fingerprint hash> OP_EQUALVERIFY <common key> OP_CHECKSIG`
* comment: Alice fingerprint preimage is published if Alice is the one who published the old Update Transaction.
Any participant can take that preimage and re-publish it here.
* comment: the `0 OP_CHECKSEQUENCEVERIFY` ensures the spending script has RBF enabled.
* comment: we use the common key, and the requirement to provide the Alice fingerprint preimage, *and* the requirement to enable RBF, to force the output to be revoked to miners as fees: when the entire output is given as fee, no higher RBF is possible.
* comment: outputs may become too tiny to care about if we split up a tiny reserve between dozens of honest participants.
But the important point is to punish the thief, not award the honest participants.
* comment: further, since the Litigation Transaction *should* make valid the latest Hostile Settlement, the outputs of the honest participants are at the latest state, already, so they cannot lose funds by having the thief-owned outputs be revoked in favor of miners.
* Dual-ownership contract (example below is an HTLC from Bob to Charlie)
* Taproot Internal Key: `P = NUMS point`
* scripts:
* `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP <locktime> OP_CHECKLOCKTIMEVERIFY OP_DROP <B lawyer> OP_CHECKSIG`
* comment: Timelock branch, Bob reclaims money.
* `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP OP_HASH160 <hash> OP_EQUALVERIFY <C lawyer> OP_CHECKSIG`
* comment: Hashlock branch, Charlie claims funds in exchange for publishing payment preimage.
* `OP_HASH160 <Bob fingerprint hash> OP_EQUALVERIFY <C lawyer> OP_CHECKSIG`
* comment: Revocation branch, Bob attempted to steal, so Charlie gets the money outright.
* `OP_HASH160 <Charlie fingerprint hash> OP_EQUALVERIFY <B lawyer> OP_CHECKSIG`
* comment: Revocation branch, Charlie attempted to steal, so Bob gets the money outright.
* Any two-participant contract can be made revocable by the same pattern:
* Use a NUMS point for taproot internal key.
* Give every branch explicitly as a branch in the Taproot MAST; prepend an additional `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP`.
* Add branches for revocation, where proof that one side attempted to steal allows the other side to control the coin immediately.
* Sub-channels will need to use `SIGHASH_ANYPREVOUTANYSCRIPT`, so that signatures that can spend from an output of the Friendly Settlement can also spend from an output of the Hostile Settlement (once the additional encumberance has been passed).
So, here are some changes to the original proposal:
* We use a hash/preimage challenge to identify *who* attempted to steal.
* The "revocation key" is the same as the "fingerprint".
It is safe to publish the revocation key if you publish only the latest Update Transaction, as the latest Update Transaction cannot enable any Litigation Transaction.
* Single-ownership outputs of the current state are encumbered by a revocability clause that revokes in favor of miners.
* Dual-ownership outputs of the current state are encumbered by a revocability clause that revokes in favor of the non-thief participant if one of the participants is the thief.
* Outputs with more than two owners are not supported by this construction.
It was not very clear from the original proposal, but the Litigation Transaction path ensures we can go to the latest state, and the Hostile Settlement transaction represents the latest state, plus allowing revocability of outputs in that state. This behavior allows us to perform our punishments based on the latest state, compared to Poon-Dryja which punishes based on the old published state (which is simpler since it always just rewards the entire channel funds to the honest party).
The Friendly Settlement transaction does not allow any revocability, but can only be published if no Litigation Transaction has been published.
Regards, ZmnSCPxj
Hi ZmnSCPxj,
Deep thanks for your review.
Biggest gains with Eltoo are of course transaction symmetry and removing toxic waste. Reintroducing penalty on top of this shouldn't affect this two goals, that's why I'm trying to play with witnesses asymmetry and signatures committed to a state number with my proposal
Quoted text (5 lines)
> In particular, it seems to me that it would be trivial for Alice to avoid punishment by first creating a fake "Mallory", then taking whatever path would let Alice "off the hook" for a framing Mallory when at risk of getting caught, thus returning the "reduced cost for trying to steal channel funds".
By creating a fake "Mallory" you mean being another party in the channel ? With current design to kick-off unilateral closing you need to reveal your signature to spend the funding output to the Update tx, so you can't equivocate after first step. You can be both Alice and Bob, try to cheat with Alice and don't broadcast Litigation as Bob, if Caroll is honest she should be able to punish you on Alice funds.
Quoted text (4 lines)
> Could a hash preimage be used instead, with revocation? > We would require that the hash preimage be unique per-update, but the same technique used in current Poon-Dryja (Russell shachain) can be used to store the preimages of revoked states.
There is few issues with preimages, if you use per-update preimages, you need to keep a Hostile Settlement tx for every update because preimages are paired with a given Hostile Settllement tx and can't be used to punish on any Hostile Settlement tx. Plus, in multiparty channels, Hostile Settlement tx at state N - 2, doesn't reflect the correct balance between honest participants at state N. If you go with one unique preimage, which stays the same for every update, you're not safe against reorg or mempool snooping, where a malicious party take your preimage and replays it on a lower state Update tx.
Quoted text (2 lines)
> I am uncertain if some of the alignment has gotten lost above, but currently your graph is somewhat confusing.
Friendly Settlement Tx must spend the Update Tx after some delay. We have one Challenge Tx per-party and it must spend the to_party output on Hostile Settlement Tx. (transactions graph by mail are an uncertain art, sorry about that)
Quoted text (5 lines)
> This branch seems pointless --- could you not just use the non-taproot path? > You do not describe the friendly-settlement transaction anywhere. > Is the friendly-settlement have `nSequence` delay? > When is it created?
Oh you're right, you can use the taproot key spend path there. Friendly Settlement transaction is spending the Update tx and supports one output per party as return fund and HTLC outputs for every pending one. E.g to_Alice output is just encumbered by a Alice pubkey and HTLC outputs have timeout/preimage_fulfill branches. None of these outputs is encumbered by a punishment path. It should be created with every Update tx, it's symmetric for every channel party and yes should have nSequence set to some delay to let someone broadcast a Litigation tx on the Update tx.
Quoted text (3 lines)
> It looks to me that you cannot use a later update transaction to replace an older update transaction, as the shared signature does not use `SIGHASH_ANYPREVOUT`?
Yes that's intentional, IMO a current flaw of Eltoo is if you share an Update tx with watchtowers, any of them can close the channel on your behalf, of course if at least one of them is honest it will broadcast the latest Update tx and your funds are safe minus transaction fees. But you have lost a channel. Splitting unilateral channel closing and enforcement of correct state on two different transactions should avoid this issue. Know you just give the Justice tx to everyone of your watchtower and keep the Update tx on your local client. If you don't have HTLCs in the flight that should be secure.
Quoted text (3 lines)
> You mentions later that "if anyone has a highest Litigation tx, he can use it", but it does not look like that the litigation script path enforces this, did you forget to add some `OP_CHECKLOCKTIMEVERIFY` here?
Oh yes, thanks again I forgot to add an OP_CLTV in litigation script path.
Quoted text (6 lines)
> `P` here is `muSig(A,B,C)`? > Why would Alice willingly sign a `SIGHASH_ALL` signature (meaning the transaction IDs are known at this point and have been confirmed deeply onchain, so this is after Alice has gone and performed any attempts at theft) that would punish her? > What happens when the Litigation Tx is later than the initial Update Tx?
Yes P is muSig(A,B,C). If she has misbehaved, she is not going to be willingly to sign the Challenge tx, and let anyone use the signature comparison as a proof of cheat. So you're again right, a timelocked script spend path should be added on the to_Alice output where after some delay any honest channel party can spend it with the Justice tx. At initial state, there shouldn't be any Litigation tx, if you have a Litigation tx with a highest state number than an Update tx it means the Update tx has been revoked (and shouldn't be broadcast).
Quoted text (2 lines)
> Maybe this should instead be a revocation key whose privkey Alice reveals as part of the update ritual?
Hmmm I think if it's a private key revealed at update ritual, it means anyone can use it to spend the funding_output while counterfeiting being Alice.
Quoted text (3 lines)
> If a later Litigation Tx is used, than the Update Tx that was put onchain, is the signature from the Update Tx valid on the same transaction where the Challenge Tx is valid?
Main idea of this scheme is to used Per-Update Commitment to solve the assignment problem in a safe way. What we need on a higher-level are messages tied to a specific party and committed to a given state number. If anyone can prove to the blockchain you have broadcast 2 messages with different state number it means you breach the contract.
Now how to do that with Script ? Only messages interpreted by the blockchain are bitcoin transactions.
If we follow Taproot current transaction digest algorithm, without sighash flags set, assuming we spend a taproot output we have the following hashed elements : epoch, hash_type, nVersion, nLockTime, sha_prevouts, sha_amounts, sha_sequences, sha_outputs, spend_type, input_index, sha_annex.
If we use SIGHASH_ANYPREVOUTANYSCRIPT + SIGHASH_NONE, we get the following hashed elements : epoch, hash_type, nVersion, nLocktime, spend_type, amount, nSequence, sha_annex.
If we force to sign 2 different transactions with these both sighashes against same pubkey, and assuming there are spending the same amount and nSequences are equals, we should get identical signatures. If they are not, the only difference element is the nLocktime.
That could be a way to make script aware of committed per-party state number.
Using this in a Eltoo-Penalty scheme, the Challenge tx script is encumbered by a branch where if you show up with 2 valid signatures but non-identical, that's a proof the challenged party has tried to cheat. Of course, I guess you need a bit of expansion on script primitives, like SIGHASH_ANYPREVOUTANYSCRIPTANYAMOUNT and an OP_CHECKSIG_WITH_STATE_NUMBER with following syntax <sig> <state_number> <pubkey> OP_CSWSN and following semantic "verify this signature against this pubkey but first mask nLocktime of transaction with the second-to-top stack item". Because signatures need to be both valid on same transaction but they have committed to different nLocktime, Justice tx need to have a mutable nLocktime field at verification.
I didn't think about the need of something like OP_CSWSN in first mail, some people pointed me the issue, so here the updated scripts.
CHALLENGE TX: (Alice case) nLocktime: 500e6n nSequence: 0 output 0: P = muSig(A,B,C) scripts = [ "OP_1 CHECKSIGVERIFY OP_DUP <2> OP_ROLL <Alice_key> CHECKSIGVERIFY_WITH_STATE_NUMBER OP_SWAP OP_DUP <3> OP_ROLL <Alice_key> CHECKSIGVERIFY_WITH_STATE_NUMBER OP_EQUAL OP_NOT OP_VERIFY" (proof-of-Alice-fraud script path) "<n> OP_CSV <Alice refund_key> (refund Alice script path) ] witness: "sig(A, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=ALL)"
JUSTICE TX: (Alice punishment) nLocktime: 500e6n nSequence: 0 output 0: (to_Caroll) output 1: (to_Bob) witness: "<state_number_update_tx> <sig_Alice_from_update_tx> <state_number_challenge_tx> <sig_Alice_from_challenge_tx> <sig(P, hash_type=ALL)>"
To say it again, it's more a thought experiment, so if you hold so far, I thank you again :)
Best, Antoine
Le dim. 14 juil. 2019 à 00:48, ZmnSCPxj <ZmnSCPxj at protonmail.com> a écrit :
Quoted text (341 lines)
> Good morning Atoine, > > Thank you for your proposal. > > > Eltoo has been criticized to lower the cost for a malicious party to > > test your monitoring of the chain. If we're able to reintroduce some > > form of punishment without breaking transaction symmetry that would be > great. > > The primary advantage of Decker-Russell-Osuntokun is that it eliminates > "toxic waste". > > By this we mean, older version of your channel database are "toxic" in > that you, ***or someone who wants to attack you***, can use it > (accidentally in your case, deliberately in the attacker case), and then > you will lose all funds in the channel. > > Note that access to your channel database, without necessarily accessing > your node private keys, is often easier. > For example, C-Lightning stores channel data into an SQLITE database and > exposes every transaction it makes to a `db_hook` that plugins can use to > replicate the database elsewhere. > If you were to use an insufficiently secured plugin to replicate your > database, an attacker might be able to access your channel data, replicate > your database, and use an older version to frame you for theft and make you > lose all your channel funds. > > Thus, Decker-Russell-Osuntokun removes the punitive consideration so that > you being framed for theft does not lose all your funds, it merely closes > your channels. > > However, it look to me that you attempt to fix the toxic waste issue, as > you mention a "Mallory" later that attempts to frame Alice (possibly by > broadcasting old state). > On the other hand, it seems, there is no description of how Alice might go > about protecting herself from Mallory. > > In particular, it seems to me that it would be trivial for Alice to avoid > punishment by first creating a fake "Mallory", then taking whatever path > would let Alice "off the hook" for a framing Mallory when at risk of > getting caught, thus returning the "reduced cost for trying to steal > channel funds". > > > > > Transaction symmetry implies that we can't deduce from observing > > txid which party broadcast a previous state. How to assign the > > faulty broadcast to the right party to punish it in consequence ? > > Thanks to taproot we have cheap witness asymmetry. > > Witness asymmetry can be used as a way to force the broadcaster to reveal > > a secret, and so committing thatn the transaction is the latest one. > > > > If the party misbehaves, we wish to use the revealed secret to punish > > him on a second stage transaction. Doing so would be really insecure > > in case of reorg or even mempool monitoring by enabling a replay attack > > of your committed secret on a lower state update tx. i.e Mallory > > would counterfeit being Alice, and so enable the use of a punishment tx > > against an honest peer. > > > > To solve the assignment problem, we need to have per-update credentials, > > a secret committed to a state number. You need a scheme were both your > > highest credential can't be used against you while at the same time if > some > > attacker broadcast a transaction with a lower credential you are able to > > punish him. > > > > How to make Bitcoin Script aware of a secret committed to > > a lower state number ? To do so, we may use some SIGHASH magic, if you > sign > > two messages with the same key and we can be sure thatn the only > difference between > > them is the nLocktime (encoding the state-number in eltoo), that means > you > > tried to breach the contract. > > Could a hash preimage be used instead, with revocation? > We would require that the hash preimage be unique per-update, but the same > technique used in current Poon-Dryja (Russell shachain) can be used to > store the preimages of revoked states. > > > > > Without access to arbitrary messages on the stack, the only messages we > can > > enforce signatures on are Bitcoin transactions. We force a party > > broadcasting an Update tx to sign it with > > SIGHASH_ANYPREVOUTSCRIPT|SIGHASH_NONE|SIGHASH_SINGLE. If someone can > shows a > > Litigation Tx with a higher state than the Update, we know that this one > has > > been revoked, and someone is cheating among channel parties. We enter in > a > > Litigation phase, the Settlement Tx will be encumbered by a Challenge Tx > against > > which you will need to produce a signature with the same SIGHASH flags > as the Update Tx., > > The only difference will be the nLocktime inherited from Litigation. > > > > Assume Alice is trying to cheat, now Bob can take the signature from her > broadcast Update tx > > and Alice’s signature on the Challenge tx, pass it as witness to a > script verifying their validity > > and identity. If their validity is true and identity is false, you can > spend with a Justice tx, > > splitting Alice’s funds between the other parties. If validity is true > and identity is true, then the script should fail. After timelock > expiration, if no one has proven Alice misbehaved, > > she can redeem her funds. > > > > Eltoo-Penalty Transaction Tree > > ============================== > > > > > > Friendly Settlement Tx > Challenge Tx -- Justice Tx > > / > / > > / > / > > Funding-Output -- Update Tx -- Litigation Tx -- .. -- Hostile Settlement > Tx -- Challenge Tx -- Justice Tx > > > \ > > > \ Challenge Tx -- Justice Tx > > > > I am uncertain if some of the alignment has gotten lost above, but > currently your graph is somewhat confusing. > > > Eltoo-Penalty Scripts > > ================ > > > > (I've omitted chaperon signatures) > > > > FUNDING_OUTPUT: > > output 0: > > Q = P + tG > > P = muSig(A,B,C) > > scripts = [ > > "OP_1 CHECKSIGVERIFY <Alice_key> CHECKSIGVERIFY" (Alice script path) > > "OP_1 CHECKSIGVERIFY <Bob_key> CHECKSIGVERIFY" (Bob script path) > > "OP_1 CHECKSIGVERIFY <Caroll_key> CHECKSIGVERIFY" (Caroll script path) > > ] > > > > UPDATE TX: > > nLocktime: 500e6 + n > > output 0: > > P = muSig(A,B,C) > > scripts = [ > > "OP_1 CHECKSIGVERIFY" (friendly settlement script path) > > This branch seems pointless --- could you not just use the non-taproot > path? > You do not describe the friendly-settlement transaction anywhere. > Is the friendly-settlement have `nSequence` delay? > When is it created? > > > > "OP_1 CHECKSGIVERIFY 500e6+n OP_CLTV OP_DROP" (litigation script path) > > witness: > > "sig(A, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, > hash_type=SINGLE)" (Alice commitment signature) > > "sig(B, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, > hash_type=SINGLE)" (Bob commitment signature) > > "sig(C, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, > hash_type=SINGLE)" (Caroll commitment signature) > > It looks to me that you cannot use a later update transaction to replace > an older update transaction, as the shared signature does not use > `SIGHASH_ANYPREVOUT`? > > > > > LITIGATION TX: > > nLocktime: 500e6 + n > > nSequence: [delay] > > output 0: > > P = muSig(A,B,C) > > scripts = [ > > "OP_1 CHECKSIG" (litigation script path) > > "OP_1 CHECKSIGVERIFY" (hostile settlement script path) > > witness: > > "sig(P, hash_type=SINGLE|ANYPREVOUTANYSCRIPT) > > You mentions later that "if anyone has a highest Litigation tx, he can use > it", but it does not look like that the litigation script path enforces > this, did you forget to add some `OP_CHECKLOCKTIMEVERIFY` here? > > > > > HOSTILE SETTLEMENT TX: > > nLocktime: 0 > > nSequence: [delay] > > output 0: (to_Alice) > > P = muSig(A,B,C) > > scripts = [ > > "OP_1 CHECHSIGVERIFY <Alice_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" > (Alice challenge script path) > > ] > > output 1: (to_Bob) > > P = muSig(A,B,C) > > scripts = [ > > "OP_1 CHECHSIGVERIFY <Bob_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" > (Bob challenge script path) > > ] > > output 2: (to_Caroll) > > P = muSig(A,B,C) > > scripts = [ > > "OP_1 CHECHSIGVERIFY <Caroll_key> CHECKSIGVERIFY 500e6n OP_CLTV OP_DROP" > (Caroll challenge script path) > > ] > > output N (pending HTLCs) > > witness: > > "sig(P, hash_type=ALL) > > > > CHALLENGE TX: (Alice case) > > nLocktime: 500e6n > > nSequence: 0 > > output 0: > > P = muSig(A,B,C) > > scripts = [ > > "OP_1 CHECKSIGVERIFY OP_DUP <Alice_key> CHECKSIGVERIFY OP_DUP OP_SWAP > <Alice_key> CHECKSIGVERIFY > > OP_EQUAL OP_NOT OP_VERIFY" (proof-of-Alice-fraud script path) > > "<n> OP_CSV <Alice refund_key> (refund Alice script path) > > ] > > witness: > > "sig(A, hash_type=SINGLE|ANYPREVOUTANYSCRIPT|NONE) sig(P, hash_type=ALL)" > > > > JUSTICE TX: (Alice punishment) > > nLocktime: 500e6n > > nSequence: 0 > > output 0: (to_Caroll) > > output 1: (to_Bob) > > witness: > > "sig_Alice_from_update_tx sig_Alice_from_challenge_tx sig(P, > hash_type=ALL)" > > `P` here is `muSig(A,B,C)`? > Why would Alice willingly sign a `SIGHASH_ALL` signature (meaning the > transaction IDs are known at this point and have been confirmed deeply > onchain, so this is after Alice has gone and performed any attempts at > theft) that would punish her? > What happens when the Litigation Tx is later than the initial Update Tx? > > Maybe this should instead be a revocation key whose privkey Alice reveals > as part of the update ritual? > > If a later Litigation Tx is used, than the Update Tx that was put onchain, > is the signature from the Update Tx valid on the same transaction where the > Challenge Tx is valid? > > > Explicitly stating what transaction outputs are spent by each transaction > input would be better, especially since your graph is unclear. > > > > > > State Update > > ============ > > > > Alice, Bob and Caroll build new friendly Settlement tx N, new Update Tx > and revoke old one by > > generating a Justice tx with state higher than the previous one, a > hostile Settlement tx plus > > Y challenge txn and Y justice txn with Y number of parties. > > You do not describe the friendly settlement transaction. > I assume it has some `nSequence` somewhere. > > > > > Cooperative Case > > ================ > > > > After X updates, Alice, Bob, Caroll, cooperate to closing transaction > using key path > > spending of funding Taproot output, the spending transactions contains > accurate balances. > > > > Unilateral Case > > ================ > > > > After X updates, Alice broadcast the last Update tx N, by signing it > with her private key with > > SIGHASH_NONE,SIGHASH_ANYPREVOUTANYSCRIPT,SIGHASH_SINGLE and use MuSig > previously distributed > > between parties at state update. Her signature doesn't protect anything > except commitment to > > the latest state number. > > > > After finalization of the friendly settlement tx, she can redeem her > balance, and timeout/fulfill > > her outputs. > > > > If she has broadcast the latest state, none of the parties should be > able to broadcast a Litigation > > tx with a highest state number. Her signature committing to the > locktime, no one is able to > > counterfeit her identity by spending the funding taproot output with a > lowest update tx. > > > > Malicious Case > > ============== > > > > Bob is broadcasting a lowest Update tx with his signature committing to > it. Alice use Litigation tx > > to spend it, if anyone has a highest Litigation tx, he can use it. After > Litigation tx finalization, > > hostile settlement transaction is used. Each output returning to a > channel party, is encumbered > > by a "challenge". To unlock your funds, you must provide a signature > against same pubkey and same > > SIGHASH flags than the one encumbering your tapscript for funding output. > > > > Challenge tx is using a taproot output, one leaf returning fund to Alice > after some timelock, > > The other one, let anyone with a MuSig and two valid signatures > committing to different nLocktime > > to send challenged fund to a Justice tx, doing an equal split between > other channel parties. > > > > You need signatures to be safe against third-party malleability, i.e > being able to tweak > > your signatures to be still valid but diff being interpreted as a proof > of commitment on lowest state number. On the Justice tx, you need a new key > type to enforce that every signature must have sighash > SIGHASH_MASKLOCKTIMEWITH, where you expect the signature to be followed by > the state number which is going to be used as locktime in transaction > digest algorithm. So in this way state number are provided in witness and > you can equivocate Justice tx as both revoked Update Tx and Challenge Tx. > > > > Okay, I'm quite sure that Script gurus on this list are going to point > flaws of this scheme. > > It's more a thought experiment and I was curious if anyone has other > ideas to get Eltoo + penalties, > > if yes let it know ! > > The descriptions of the transactions and scripts involved are confusing > and I am uncertain if you actually achieve your target. > Could you clarify? > > Regards, > ZmnSCPxj >
Hi ZmnSCPxj,
Quoted text (5 lines)
> Just a minor correction here: your own commitment transactions are not > being signed until we want to release them. Therefore having access to > your DB doesn't give an attacker the ability to frame the user with an > old version, since that'd still require access to the keys to add our > own signature.
Okay, do you plan to handover keys to the watchtower to be able to sign and broadcast local commitment transactions or are you thinking about another design like giving him signed commitment ? That's an area we still need to think more for rust-lightning too.
Quoted text (3 lines)
> And this signature is intended to be used to identify Alice as the culprit, by also being used to sign for <Alice key>, but `SIGHASH_ALL` would strongly bind the signature to this particular transaction.
Okay, you maybe also need a special pubkey type to force signatures to use a given SIGHASH. that's a lot of tricks but that could be a use-case for taproot introducing key types.
Quoted text (7 lines)
> Now, an economically-maximizing thief would prefer to steal as much as possible, thus such a thief would initiate a channel, then send out funds until only 1% is left to the thief, then "freeze" the channel (fail all incoming HTLCs from this channel without bothering to check if they would succeed) until the participant is offline, then perform the theft attempt by using their initial commitment (the one where they own all the funds in the channel).
I think it's quite dubious to base our reasoning on current network situation and from then say on-chain fees in Eltoo model are enough to deter attackers (or even lazy parties). Channels are going to increase in size and people are learning how they are structured. With more knowledge of timeout locks and deltas, attackers may try to game them, specially by exploiting others elements like mempool congestion or eclipse your onchain node. I see penalty as the price the attacker have to pay to test your onchain monitoring setup. If it's cheap and the probabilities to win are high, given he is able to trouble confirmation of your update tx, a rational attacker will try.
"Still, a node could refuse incoming channel open requests for Decker-Russell-Osuntokun that are larger than 100 times the typical fee for a 1-input 1-output transaction, and still get similar protection to Poon-Dryja using the de facto standard 1% reserve"
And maybe people are going to limit of their channels to stay in a multiple of onchain fees, but they may also refuse to open channel with unknown or "untrusted" parties. Relying on economical incentives is better than social ones.
Quoted text (3 lines)
> Such outputs have shared ownership, as the offerer of the HTLC will be able to reclaim the money after the timelock, and the accepter of the HTLC will be able to reclaim the money before the timelock.
Yes, I think a contract design principle is that we should enforce an order of claims between different channel participants. In a multiparty channel between Alice, Bob, Caroll and Dave, if Alice offered a HTLC to Bob and then cheats, if Bob come with a preimage to unlock the HTLC, his claim shouldn't be canceled by the punitive one raised by Bob, Caroll or Dave.
"I would argue that channel factories are better used than multiparticipant channels, as channel factories allow *some* limited transport of funds even if one participant is offline, whereas multiparticipant channels prevent *all* transport of funds as soon as any one participant is offline"
I agree too, with my current proposal I was just thinking in multiparty setup and not a 2-party one because it's far more adversarial. IMO, channel factories are a better design because I would say the "valuespace" is well isolated between participants.I.e if Alice has 1, Bob has 1, Caroll has 3, Alice shouldn't be able offer a HTLC worth 3 to Bob. It's more tricky to enforce on a multiparty channel rather than on a channel factory.
Quoted text (19 lines)
> Let us consider what happens if Alice the thief performs the theft attempt during various states: > * Suppose the current state is that Charlie owns the entire funds of the channel right now. > Alice steals by publishing old state, but the old-state Alice->Bob HTLC is revocable only by Bob. > Thus the money (that rightfully belongs to Charlie) goes to Bob instead. > * Alice and Bob could be in cahoots, with Bob as the mastermind and Alice as the fall guy. > * Suppose we decide that the Alice->Bob HTLC is revocable split by Bob and Charlie. > Suppose the current state is that Bob owns the entire funds of the channel right now. > Alice steals by publishing old state, but the old-state Alice->Bob HTLC is revocable split by Bob and Charlie. > Thus the money (that rightfully belongs only to Bob) goes partly to Charlie instead. > * Alice and Charlie could be in cahoots, with Charlie as the mastermind and Alice as the fall guy.
If a HTLC output is claimable by both a preimage + sig from a channel participant or MuSig from all channel participants to a punitive tx, the punitive tx may be encumbered by some delay to let the preimage path being used first. I agree that may be tricky due to overlap between HTLC delay and this nSequence one. Easiest way is you don't punish on HLTC outputs, but that mean you need to keep higher channel reserve.
Quoted text (2 lines)
> So I think that, in terms of multiparticipant constructions, non-punitive constructions are the only possible constructions.
I think punitive constructions are possible on the channel syntax level but may not make sense on the economic due to higher funds being locked as channel reserve. This being balanced with an increased rate of attack, in which case you may want an higher insurance policy in the form of punitive provisions on your channel dishearten cheat attempts. Hard to guess if and how much the network is going to be adversarial in 2 or 3 years..
Le dim. 14 juil. 2019 à 20:12, ZmnSCPxj via Lightning-dev < lightning-dev at lists.linuxfoundation.org> a écrit :
Quoted text (93 lines)
> Good morning list, > > I had another realization about the use of punishment in a > multiparticipant (n > 2) setting. > And it has to do with contracts that have a sort of "shared ownership". > > Consider HTLC outputs. > Such outputs have shared ownership, as the offerer of the HTLC will be > able to reclaim the money after the timelock, and the accepter of the HTLC > will be able to reclaim the money before the timelock. > > Suppose we know that Alice cheated. > Suppose also that Bob offered an HTLC to Alice with a hash whose preimage > Alice secretly knows, and that Alice offered an HTLC to Charlie with a long > future lock time with a hash that Alice secretly knows has a high > probability that nobody knows the preimage. > > How should Bob and Charlie split the HTLCs? > If we do not punish the HTLCs, then Alice can arrange such that most of > her money is in HTLCs that she can recover, and thereby avoid punishment. > If we *do* punish the HTLCs, we would have to make the Bob->Alice > revocable only in favor of Bob, and make the Alice->Carol revocable only in > favor of Charlie. > > > This ties to constructions such as Channel Factories. > I would argue that channel factories are better used than multiparticipant > channels, as channel factories allow *some* limited transport of funds even > if one participant is offline, whereas multiparticipant channels prevent > *all* transport of funds as soon as any one participant is offline. > At the same time, channel factories allow arbitrary transport of funds > between any participants inside the factory if all participants are online: > if a channel is exhausted, but the paying participant has funds elsewhere, > the paying participant can initiate a channel reorganization and move funds > to the exhausted channel. > > Channel factories host channels. > Channels are shared-ownership UTXOs, in much the same way that HTLCs are > shared-ownership UTXOs. > > Thus, if we will use this construction to implement channel factories, > channels inside the factory should be punished by transferring the funds to > the other participant of the channel. > > However, things can get more complicated as the states inside the > construction change over time. > > -------- > > Let us return to the HTLC example. > > Suppose there exists an Alice->Bob HTLC in the old state that Alice the > thief publishes, and that the entire value of the construction is in that > HTLC. > > Let us consider what happens if Alice the thief performs the theft attempt > during various states: > > * Suppose the current state is that Charlie owns the entire funds of the > channel right now. > Alice steals by publishing old state, but the old-state Alice->Bob HTLC > is revocable only by Bob. > Thus the money (that rightfully belongs to Charlie) goes to Bob instead. > * Alice and Bob could be in cahoots, with Bob as the mastermind and > Alice as the fall guy. > * Suppose we decide that the Alice->Bob HTLC is revocable split by Bob and > Charlie. > Suppose the current state is that Bob owns the entire funds of the > channel right now. > Alice steals by publishing old state, but the old-state Alice->Bob HTLC > is revocable split by Bob and Charlie. > Thus the money (that rightfully belongs only to Bob) goes partly to > Charlie instead. > * Alice and Charlie could be in cahoots, with Charlie as the mastermind > and Alice as the fall guy. > > It seems to me, that punishment systems can only work if one of the > following are true: > > * 2 participants, which prevents channel factory scaling. > * OR, no smart contracts (HTLCs or subchannels), which prevents channel > factory scaling, **and** network/routing scaling. > > So I think that, in terms of multiparticipant constructions, non-punitive > constructions are the only possible constructions. > > Regards, > ZmnSCPxj > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev >
Hi ZmnSCPxj,
Awesome resume, it's better lay-out than I did myself !!
Quoted text (2 lines)
> Thus, I would like to thank you for your tolerance and continued attention.
Personally, it's a pleasure to read your weird but always thoughtful proposals in other threads :)
"We have identified two requirements:
1. We must identify which participant initiated the unilateral close
onchain.
We do so that if later, we find that the unilateral close was to an
older state, we can punish the participant that initiated the unilateral
close.
2. We must identify that a unilateral close was, in fact, to an older
state."
I think you have well-scoped the assignment problem. But it would add another requirement :
3. Identity commitment must not be replayable or counterfeited by another participant.
I thought to use unique preimage in a previous versions of my proposal but it seems really unsafe due to reorgs and mempool snooping. If another channel participant is able to take back your identity preimage and uses it to spend with a lower state update tx you are know flagged as the cheater. So we want preimage to be tied to a state number and best scheme I've thought of is not using preimage but signatures.
May we build a commitment with preimage and state number without signatures ?
Quoted text (6 lines)
> * comment: we use the common key, and the requirement to provide the
Alice fingerprint preimage, *and* the requirement to enable RBF, to force
the output to be revoked to miners as fees: when the entire output is given
as fee, no higher RBF is possible.
* comment: outputs may become too tiny to care about if we
split up a tiny reserve between dozens of honest participants.On the other side, giving back funds to participants let them cover back the expenses to pay onchain fees for last state enforcement.
Quoted text (2 lines)
> * Add branches for revocation, where proof that one side attempted to steal allows the other side to control the coin immediately.
Hmm that's the point we argue a lot, but by broadcasting a previous update, if HTLC is Bob->Caroll, Bob didn't only try to rob Caroll but potentially every others channel participants. Why they should get a part of Bob funds as compensation ?
Quoted text (3 lines)
> It is safe to publish the revocation key if you publish only the latest Update Transaction, as the latest Update Transaction cannot enable any Litigation Transaction.
Exact, even if you're a honest participant you have to commit to a secret or revocation key, because the blockchain can only know after the nSequence expiration delay of the Friendly Settlement transaction that you are honest.
Le lun. 15 juil. 2019 à 05:58, ZmnSCPxj via Lightning-dev < lightning-dev at lists.linuxfoundation.org> a écrit :
Quoted text (232 lines)
> Good morning list,
>
> As usual, I am spamming the list for my amusement.
>
> Thus, I would like to thank you for your tolerance and continued attention.
>
> ----
>
> We have identified two requirements:
>
> 1. We must identify which participant initiated the unilateral close
> onchain.
> We do so that if later, we find that the unilateral close was to an
> older state, we can punish the participant that initiated the unilateral
> close.
> 2. We must identify that a unilateral close was, in fact, to an older
> state.
>
> Thus, I will counterpropose a construction similar to that originally
> proposed here, but with the weaknesses fixed and key details filled in.
> (while part of it is similar to the Decker-Russell-Osuntokun "eltoo", it
> is different enough that I would not suggest calling it "eltoo-penalty")
>
> ----
>
> On initiation, Alice, Bob, and Charlie indicate:
>
> * Alice/Bob/Charlie "fingerprint" hash/preimage.
> Alice/Bob/Charlie publish the fingerprint hashes, but keep the
> fingerprint preimages secret.
> * Alice/Bob/Charlie "normal" pubkey.
> * Alice/Bob/Charlie "lawyer" pubkey.
> * All participants indicate a `delay`, a number of blocks.
> Funds may be locked, in worst case, up to `2 * delay`.
>
> We also introduce a "common" key whose private key is known to all
> participants.
> For example, we can use a key whose private key is `SHA256("ZmnSCPxj is a
> human being and not any kind of AI")` as a consensus-accepted fact.
>
> We have the below transactions:
>
> * Funding transaction
> * inputs: unspecified
> * outputs:
> * change output(s): unspecified
> * funding output:
> * Internal Taproot Key: `P = MuSig(Alice normal pubkey, Bob normal
> pubkey, Charlie normal pubkey)`
> * Scripts:
> * `OP_1 OP_CHECKSIGVERIFY OP_HASH160 <Alice fingerprint hash>
> OP_EQUALVERIFY`
> * `OP_1 OP_CHECKSIGVERIFY OP_HASH160 <Bob fingerprint hash>
> OP_EQUALVERIFY`
> * `OP_1 OP_CHECKSIGVERIFY OP_HASH160 <Charlie fingerprint>
> OP_EQUALVERIFY`
>
> * Update Transaction
> * comment: this transaction initiates a unilateral close attempt.
> * comment: Updates have a "hidden" `n`, which is an "update" number
> incrementing from 0.
> This number could be encoded as `nLockTime` by using `500e6 + n`, but
> in principle does not need to be encoded there (we could use the current
> encoding in Poon-Dryja, which is encrypted so that normal unilateral closes
> do not reveal how many updates occurred).
> * Update transaction might have other inputs/outputs used to pay for
> onchain fees.
> * input:
> * Funding transaction output
> * witness: one of the following, depending on which participant
> initiated the unilateral close:
> * `<Alice fingerprint preimage> sign(MuSig(A normal, B normal, C
> normal), SIGHASH_ANYPREVOUTANYSCRIPT | SIGHASH_SINGLE)`
> * `<Bob fingerprint preimage> sign(MuSig(A normal, B normal, C
> normal), SIGHASH_ANYPREVOUTANYSCRIPT | SIGHASH_SINGLE)`
> * `<Charlie fingerprint preimage> sign(MuSig(A normal, B normal, C
> normal), SIGHASH_ANYPREVOUTANYSCRIPT | SIGHASH_SINGLE)`
> * comment: which witness script appears onchain depends on which
> participant initiated the unilateral close.
> * output:
> * Internal Taproot Key: `MuSig(A normal, B normal, C normal)`
> * Scripts:
> * `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP <MuSig(A normal, B normal,
> C normal)> OP_CHECKSIG`
> * This is the "normal" unilateral path where the participant did
> not steal any funds.
> * `<500e6 + n + 1> OP_CHECKLOCKTIMEVERIFY OP_DROP <MuSig(A lawyer, B
> lawyer, C lawyer)> OP_CHECKSIG`
> * This is the "litigation" path where the participant is proven to
> have stolen funds by showing a litigation transaction with later `n` than
> the update transaction.
>
> * Friendly Settlement Transaction
> * comment: This transaction completes a unilateral close attempt and
> publishes all contracts transported in the channel without revocability
> branches.
> * `nSequence`: `<delay>`
> * input:
> * Update transaction output
> * witness: `sign(MuSig(A normal, B normal, C normal),
> SIGHASH_ANYPREVOUTANYSCRIPT)`
> * outputs: unencumbered outputs for this state.
>
> * Litigation Transaction
> * comment: The appearance of this transaction onchain is taken as proof
> that the unilateral close attempt is definitely a theft attempt.
> It can only be broadcast and confirmed if and only if the unilateral
> close Update Transaction has an `n` that is less than the latest agreed `n`.
> * comment: A Litigation Transaction can be spent by another Litigation
> Transaction with higher `n`.
> The intent is to force the current state onchain, in order to punish
> the thief using the *latest* state instead of punishing from old state.
> * `nLockTime`: `500e6 + n`, where `n` is the update index for this
> Litigation Transaction.
> * comment: a Litigation Transaction with `n` cannot spend an Update
> Transaction of same `n`, only `n - 1` or less.
> * input:
> * Update transaction output *OR* another Litigation Transaction
> output; Update/Litigation tx has `n` less than this Litigation transaction.
> * witness: `sign(MuSig(A lawyer, B lawyer, C lawyer),
> SIGHASH_ANYPREVOUTANYSCRIPT | SIGHASH_SINGLE)`
> * output:
> * Internal Taproot Key: `MuSig(A lawyer, B lawyer, C lawyer)`
> * scripts:
> * `<500e6 + n + 1> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_1 OP_CHECKSIG`
> * comment: This allows a Litigation Transaction with later
> `nLockTime` to spend this Litigation Transaction.
> * `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP <500e6 + n>
> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_1 OP_CHECKSIG`
> * comment: This is the "Hostile Settlement" path that allows
> revocation of outputs owned by the participant that initiated the
> unilateral close.
>
> * Hostile Settlement Transaction
> * `nLockTime`: `500e6 + n`
> * input:
> * Litigation Transaction output
> * witness: `sign(MuSig(A lawyer, B lawyer, C lawyer),
> SIGHASH_ANYPREVOUTANYSCRIPT)`
> * outputs:
> * Depending on type of contract, outputs are revocable:
> * Single-ownership contract (example below is Alice-owned)
> * Taproot Internal Key: `P = NUMS point` (cannot be spent via
> non-Taproot path)
> * scripts:
> * `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP <A lawyer> OP_CHECKSIG`
> * comment: This lets Alice recover its funds if it is not the
> thief.
> * `OP_0 OP_CHECKSEQUENCEVERIFY OP_DROP OP_HASH160 <Alice
> fingerprint hash> OP_EQUALVERIFY <common key> OP_CHECKSIG`
> * comment: Alice fingerprint preimage is published if Alice is
> the one who published the old Update Transaction.
> Any participant can take that preimage and re-publish it
> here.
> * comment: the `0 OP_CHECKSEQUENCEVERIFY` ensures the spending
> script has RBF enabled.
> * comment: we use the common key, and the requirement to
> provide the Alice fingerprint preimage, *and* the requirement to enable
> RBF, to force the output to be revoked to miners as fees: when the entire
> output is given as fee, no higher RBF is possible.
> * comment: outputs may become too tiny to care about if we
> split up a tiny reserve between dozens of honest participants.
> But the important point is to punish the thief, not award
> the honest participants.
> * comment: further, since the Litigation Transaction
> *should* make valid the latest Hostile Settlement, the outputs of the
> honest participants are at the latest state, already, so they cannot lose
> funds by having the thief-owned outputs be revoked in favor of miners.
> * Dual-ownership contract (example below is an HTLC from Bob to
> Charlie)
> * Taproot Internal Key: `P = NUMS point`
> * scripts:
> * `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP <locktime>
> OP_CHECKLOCKTIMEVERIFY OP_DROP <B lawyer> OP_CHECKSIG`
> * comment: Timelock branch, Bob reclaims money.
> * `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP OP_HASH160 <hash>
> OP_EQUALVERIFY <C lawyer> OP_CHECKSIG`
> * comment: Hashlock branch, Charlie claims funds in exchange
> for publishing payment preimage.
> * `OP_HASH160 <Bob fingerprint hash> OP_EQUALVERIFY <C lawyer>
> OP_CHECKSIG`
> * comment: Revocation branch, Bob attempted to steal, so
> Charlie gets the money outright.
> * `OP_HASH160 <Charlie fingerprint hash> OP_EQUALVERIFY <B
> lawyer> OP_CHECKSIG`
> * comment: Revocation branch, Charlie attempted to steal, so
> Bob gets the money outright.
> * Any two-participant contract can be made revocable by the same
> pattern:
> * Use a NUMS point for taproot internal key.
> * Give every branch explicitly as a branch in the Taproot MAST;
> prepend an additional `<delay> OP_CHECKSEQUENCEVERIFY OP_DROP`.
> * Add branches for revocation, where proof that one side
> attempted to steal allows the other side to control the coin immediately.
> * Sub-channels will need to use `SIGHASH_ANYPREVOUTANYSCRIPT`, so
> that signatures that can spend from an output of the Friendly Settlement
> can also spend from an output of the Hostile Settlement (once the
> additional encumberance has been passed).
>
> So, here are some changes to the original proposal:
>
> * We use a hash/preimage challenge to identify *who* attempted to steal.
> * The "revocation key" is the same as the "fingerprint".
> It is safe to publish the revocation key if you publish only the
> latest Update Transaction, as the latest Update Transaction cannot enable
> any Litigation Transaction.
> * Single-ownership outputs of the current state are encumbered by a
> revocability clause that revokes in favor of miners.
> * Dual-ownership outputs of the current state are encumbered by a
> revocability clause that revokes in favor of the non-thief participant if
> one of the participants is the thief.
> * Outputs with more than two owners are not supported by this construction.
>
> It was not very clear from the original proposal, but the Litigation
> Transaction path ensures we can go to the latest state, and the Hostile
> Settlement transaction represents the latest state, plus allowing
> revocability of outputs in that state.
> This behavior allows us to perform our punishments based on the latest
> state, compared to Poon-Dryja which punishes based on the old published
> state (which is simpler since it always just rewards the entire channel
> funds to the honest party).
>
> The Friendly Settlement transaction does not allow any revocability, but
> can only be published if no Litigation Transaction has been published.
>
> Regards,
> ZmnSCPxj
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>Good morning Antoine,
Quoted text (2 lines)
> Biggest gains with Eltoo are of course transaction symmetry and removing toxic waste. Reintroducing penalty on top of > this shouldn't affect this two goals,
I agree with Christian that introducing penalty introduces toxic waste. Inadvertent misuse of a backup of an old database will still result in punishment. Indeed, this is part of the toxic waste problem: operator error can lead to loss of funds.
Quoted text (31 lines)
> > If a later Litigation Tx is used, than the Update Tx that was put onchain, is the signature from the Update Tx valid on the same transaction where the Challenge Tx is valid? > > Main idea of this scheme is to used Per-Update Commitment to solve the assignment problem in a safe way. What we need > on a higher-level are messages tied to a specific party and committed to a given state number. If anyone can prove to the > blockchain you have broadcast 2 messages with different state number it means you breach the contract. > > Now how to do that with Script ? Only messages interpreted by the blockchain are bitcoin transactions. > > If we follow Taproot current transaction digest algorithm, without sighash flags set, assuming we spend a taproot output > we have the following hashed elements : epoch, hash_type, nVersion, nLockTime, sha_prevouts, sha_amounts, > sha_sequences, sha_outputs, spend_type, input_index, sha_annex. > > If we use SIGHASH_ANYPREVOUTANYSCRIPT + SIGHASH_NONE, we get the following hashed elements : > epoch, hash_type, nVersion, nLocktime, spend_type, amount, nSequence, sha_annex. > > If we force to sign 2 different transactions with these both sighashes against same pubkey, and assuming there are > spending the same amount and nSequences are equals, we should get identical signatures. If they are not, > the only difference element is the nLocktime. > > That could be a way to make script aware of committed per-party state number. > > Using this in a Eltoo-Penalty scheme, the Challenge tx script is encumbered by a branch where if you show up > with 2 valid signatures but non-identical, that's a proof the challenged party has tried to cheat. Of course, I guess > you need a bit of expansion on script primitives, like SIGHASH_ANYPREVOUTANYSCRIPTANYAMOUNT and > an OP_CHECKSIG_WITH_STATE_NUMBER with following syntax <sig> <state_number> <pubkey> OP_CSWSN > and following semantic "verify this signature against this pubkey but first mask nLocktime of transaction with the > second-to-top stack item". Because signatures need to be both valid on same transaction but they have committed > to different nLocktime, Justice tx need to have a mutable nLocktime field at verification. > > I didn't think about the need of something like OP_CSWSN in first mail, some people pointed me the issue, so here > the updated scripts.
This requires adding more at the base layer, which is much more strongly contentious (at the Lightning layer you can arrange to use whatever construction you want with your peer, and in general still be able to route, except that with anything other than Poon-Dryja channels also have a minimum CSV delay that needs to be considered by the source).
At what little I understand there is not much consensus yet at Bitcoin blockchain layer to add *any* vsriant of `SIGHASH_NOINPUT` yet. But now this construction requires, in addition to `SIGHASH_NOINPUT`:
* Pubkeys that require specific `SIGHASH` flags in their signature. * A way to validate that a particular signature commits to a particular `nLockTime`.
The only advantage this construction has on top of Poon-Dryja is the ability to have 3 or more participants. The disadvantages relative to Poon-Dryja are:
* A CSV restriction on routed HTLCs. * Needs *much* more to be added to the blockchain, including 1 controversial feature (admittedly has a reasonable chance of appearing in some form) and 2 completely new features (which will need to be very strongly reviewed in bitcoin-dev and elsewhere first).
---
Now I believe you agree that channel factories are better:
Quoted text (3 lines)
> "I would argue that channel factories are better used than multiparticipant channels, as channel factories allow *some* limited transport of funds even if one participant is offline, whereas multiparticipant channels prevent *all* transport of funds as soon as any one participant is offline" > > I agree too
So let me counterpropose instead:
* Use Decker-Wattenhofer (mostly the multiple-stage decrementing `nSequence` part, drop the duplex Spilman-like channels) or Decker-Russell-Osuntokun ("eltoo") at the Factory level.
* Do not allow participants to hold a singlesig output at the Factory level, all states at this level should have only 2-of-2s that back channels.
* Use Poon-Dryja at the Channel level for all channels inside the factory.
This prevents thieves from *practically* stealing with old factory-level state, since the funds are still in individual Poon-Dryja channels.
When you reorganize a channel (change its total balance) during a factory-level update, you go about things this way.
1. Sign new commitment transactions for the modified channels, spending the post-modified amount of the channel.
(assume we use `SIGHASH_NOINPUT` in the Poon-Dryja commitment txes, to avoid the "stale factory problem" for channels that are not modified in the factory-level update)
2. Sign the new factory-level update and settlement transactions (assuming we use Decker-Russel-Osuntokun).
3. Revoke the previous commitment transactions of the modified channels (the ones that spent from the pre-modified amounts).
If this aborts after step 1, the new commitment transactions cannot be used since the latest factory output values will not match the values expected by the new commitment transactions.
If this aborts after step 2, the individual channels that were modified will be "frozen" (cannot add/fail/fulfill HTLCs) until both sides have performed step 3. If the freeze lasts long enough to reach HTLC locktimes, then this forces a unilateral close of the entire factory and all its channels.
With this, an attacker that wants to steal using an older factory state would still contend with the fact that channels that have been modified since that state will have had their latest transaction revoked, thus will lose all their funds there. And as long as each individual Poon-Dryja channel has a reserve, there is still some money that each participant will be risking losing.
In short: replaying old factory state is pointless since the thief still has to contend with the individual channel-level punishments.
This returns punishment while still allowing channel factory scaling, which is the important thing we *actually* want (the goal of transaction symmetry is aesthetic, but not useful), at the cost of returning toxic waste.
Regards, ZmnSCPxj