Research/Bitcoin Dev Archive / lightning-dev list
Transaction revocation within transaction malleability via anyone-can-revoke hashlocks
7 messages, Apr 26 to May 5, 2017. Started by ZmnSCPxj.
ZmnSCPxj (4), Rusty Russell (3)
One primitive that is necessary for bidirectional channels is revocable transactions. Briefly, in the absence of transaction malleability, in order to generate a revocable output, the output is encumbered such that either the receiver can receive the output after some time (via CSV opcode), or the output may be signed by both the sender and receiver. If the receiver wants to provide a proof of revocation, the receiver constructs a revocation transaction spending the output and sending it to the sender. The receiver signs that transaction and gives it to the sender. If the receiver subsequently attempts to realize the revoked output by broadcasting its transaction on the public blockchain, the sender may revoke it by sending the revocation transaction.
However, in the presence of malleability, a fraudluent receiver may simply malleate the transaction producing the output. The output will then be referred to via a different txid, invalidating the existing revocation transaction.
Another issue with this style of revocable transactions is that it is still possible for the receiver to defraud the sender via a two-prong attack: the sender DDOS'es or otherwise prevents the sender from successfully sending the revocation transaction, and transmits the revoked transaction on the network. If the receover is capable of keeping the sender off-network until the CSV expires, the receiver may defraud the sender. It would be desirable if a separate bounty hunter may be hired in order to prevent fraud, so that the fraudulent receiver needs to keep many more agents away from the Bitcoin network.
Fortunately, a single solution fixes both issues.
When constructing a revocable output, the receiver first generates a secure truely random number, the revocation key. The revocation lock is the hash of the revocation key (i.e. hashlock). The revocable output may be spent in any of the following conditions:
1. After CSV +2 days, by the receiver.
2. By the sender, if the sender can show the revocation key.
3. After CSV +1 days, by anyone who can show the revocation key (anyone can revoke).
To revoke the revocable output, the receiver of the revocable output publishes the revocation key to the sender and to any interested participants in the Lightning Network.
If the output has not been revoked, the receiver has never published the revocation key and simply needs to wait 2 days to spend.
If the output has been revoked, and the receiver attempts to realize the revoked output on the Bitcoin network, if the sender is online, it can construct a revocation transaction by itself by signing the transaction and showing the published revocation key.
In addition, if the sender is unavailable or disconnected, after 1 day, anyone who has heard and kept the revocation key may claim the receiver's coins. Thus, the receiver, in order to use a revoked output, needs to prevent everyone to whom the revocation key has been sent from the Bitcoin network during the 1 day between the CSV+1 and CSV+2 periods.
I would like to know if my consideration is correct or if I have missed or incorrectly analyzed some aspect of transaction revocation.
I hope for your discussion.
Regards, ZmnSCPxj
Hi ZmnSCPxj!
Your suggestion for a "burn window" is interesting, but it still allows the attacker to burn your coins. The attacker also has a chance to steal the coins themselves; quite a good chance if they are a miner.
The current draft uses a revocation key, which only the sender knows; this part is actually malleation-proof:
The revocationkey is a blinded key: the remote node provides the
base, and the local node provides the blinding factor which it
later reveals, so the remote node can use the secret
revocationkey for a penalty transaction.
The DoS problem is a difficult one, but in practice it's very hard to cut someone off the bitcoin network for very long; they can always send out a transaction via various web interfaces on their phone if they have to. But even the DoS problem is prevented by Tadge's watchers, though they *are* subject to malleation.
There was a suggestion in the original Lightning paper to add a TX_NOINPUT sighash flag, which would allow watchers to operate even in the case where malleation occurred. But as that would be a soft fork too, we're better off waiting for SegWit...
Thanks for your input! Rusty.
ZmnSCPxj via Lightning-dev <lightning-dev at lists.linuxfoundation.org> writes:
Quoted text (34 lines)
> One primitive that is necessary for bidirectional channels is revocable transactions. Briefly, in the absence of transaction malleability, in order to generate a revocable output, the output is encumbered such that either the receiver can receive the output after some time (via CSV opcode), or the output may be signed by both the sender and receiver. If the receiver wants to provide a proof of revocation, the receiver constructs a revocation transaction spending the output and sending it to the sender. The receiver signs that transaction and gives it to the sender. If the receiver subsequently attempts to realize the revoked output by broadcasting its transaction on the public blockchain, the sender may revoke it by sending the revocation transaction. > > However, in the presence of malleability, a fraudluent receiver may simply malleate the transaction producing the output. The output will then be referred to via a different txid, invalidating the existing revocation transaction. > > Another issue with this style of revocable transactions is that it is still possible for the receiver to defraud the sender via a two-prong attack: the sender DDOS'es or otherwise prevents the sender from successfully sending the revocation transaction, and transmits the revoked transaction on the network. If the receover is capable of keeping the sender off-network until the CSV expires, the receiver may defraud the sender. It would be desirable if a separate bounty hunter may be hired in order to prevent fraud, so that the fraudulent receiver needs to keep many more agents away from the Bitcoin network. > > Fortunately, a single solution fixes both issues. > > When constructing a revocable output, the receiver first generates a secure truely random number, the revocation key. The revocation lock is the hash of the revocation key (i.e. hashlock). The revocable output may be spent in any of the following conditions: > > 1. After CSV +2 days, by the receiver. > > 2. By the sender, if the sender can show the revocation key. > > 3. After CSV +1 days, by anyone who can show the revocation key (anyone can revoke). > > To revoke the revocable output, the receiver of the revocable output publishes the revocation key to the sender and to any interested participants in the Lightning Network. > > If the output has not been revoked, the receiver has never published the revocation key and simply needs to wait 2 days to spend. > > If the output has been revoked, and the receiver attempts to realize the revoked output on the Bitcoin network, if the sender is online, it can construct a revocation transaction by itself by signing the transaction and showing the published revocation key. > > In addition, if the sender is unavailable or disconnected, after 1 day, anyone who has heard and kept the revocation key may claim the receiver's coins. Thus, the receiver, in order to use a revoked output, needs to prevent everyone to whom the revocation key has been sent from the Bitcoin network during the 1 day between the CSV+1 and CSV+2 periods. > > I would like to know if my consideration is correct or if I have missed or incorrectly analyzed some aspect of transaction revocation. > > I hope for your discussion. > > Regards, > ZmnSCPxj > _______________________________________________ > Lightning-dev mailing list > Lightning-dev at lists.linuxfoundation.org > https://www.learnbitcoin.com/archive/lists/lightning-dev
Hi ZmnSCPxj!
Good morning Rusty, thank you for your reply.
I want to know about whether Lightning can be implemented even without SegWit, given only the current features that could be activated as of today 2017-04.
Your suggestion for a "burn window" is interesting, but it still allows the attacker to burn your coins. The attacker also has a chance to steal the coins themselves; quite a good chance if they are a miner.
Yes, although you can build a revocation transaction to claim all of your counterparty's funding.in case of fraud.
As you mentioned, also normal "watchers" cannot work if the revoked commitment transaction is malleated. However with my burn window, anyone can be a watcher, but they claim the entirety of the fraudulent counterparty's funds, rather than a watching bonus.
The current draft uses a revocation key, which only the sender knows; this part is actually malleation-proof:
The revocationkey is a blinded key: the remote node provides the base, and the local node provides the blinding factor which it later reveals, so the remote node can use the secret revocationkey for a penalty transaction.
I'm sorry. I read only the whitepaper and could not find the above text in the whitepaper, so maybe my knowledge is obsolete. My last knowledge is that the proof of revocation is a revocation transaction constructed specifically for the old commitment transaction. But, it means malleation of commitment transaction will disable the revocation transaction.
I searched your quoted text and I could find about the lightningnetwork/lightning-rfc repository on github. It seems, this is the "draft" you refer to?
Now I'm reading more about this set of documents. I started at BOLT#3 (which contains your quoted text). From what little I could understand, it seems, the conditions for a revocable Bob output are one of: (Bob's private key AND CSV+1) OR (Alice's private key and revocationkey). Thus, the data of the revocationkey is sufficient for Alice to enforce revocation. Is my understanding correct?
The DoS problem is a difficult one, but in practice it's very hard to cut someone off the bitcoin network for very long; they can always send out a transaction via various web interfaces on their phone if they have to. But even the DoS problem is prevented by Tadge's watchers, though they *are* subject to malleation.
My concern is that there are countries with difficulty to get Internet, and maybe censorship and so on. If a Lightning Network user is disconnected because of such geopolitical concerns, perhaps the counterparty may attempt to defraud him or her. So I would very much like to have watchers, even if they cannot be trusted to give the money to the poor victim of geopolitical concerns, in order to prevent taking advantage of other's inadvertent disconnection.
There was a suggestion in the original Lightning paper to add a TX_NOINPUT sighash flag, which would allow watchers to operate even in the case where malleation occurred. But as that would be a soft fork too, we're better off waiting for SegWit... I understand.
From what I can gather so far, it seems, the issue of transaction revocation even with transaction malleability appears to be solved. Although, I want to know, is my idea (which support selfish untrustworthy watchers) better than what Lightning now has? Or has different tradeoffs? It seems to me, at first glance, if the revocation key in my idea is not publicized but sent only to the counterparty, it is effectively equivalent to the current technique. But the receiving counterparty has the option of publishing this revocation key in order to allow anyone to enforce and get free money, even with malleability.
Regards, ZmnSCPxj
ZmnSCPxj <ZmnSCPxj at protonmail.com> writes:
Quoted text (4 lines)
> Hi ZmnSCPxj! > > Good morning Rusty, thank you for your reply. > From what I can gather so far, it seems, the issue of transaction revocation even with transaction malleability appears to be solved. Although, I want to know, is my idea (which support selfish untrustworthy watchers) better than what Lightning now has? Or has different tradeoffs? It seems to me, at first glance, if the revocation key in my idea is not publicized but sent only to the counterparty, it is effectively equivalent to the current technique. But the receiving counterparty has the option of publishing this revocation key in order to allow anyone to enforce and get free money, even with malleability.
That's true, actually. You can certainly have trusted watchers know your revocation keys (and they have a very compact form, so the storage is ~log2(num-transactions).
Cheers, Rusty.
Good morning Rusty,
Quoted text (4 lines)
>ZmnSCPxj <ZmnSCPxj at protonmail.com> writes: >> From what I can gather so far, it seems, the issue of transaction revocation even with transaction malleability appears to be solved. Although, I want to know, is my idea (which support selfish untrustworthy watchers) better than what Lightning now has? Or has different tradeoffs? It seems to me, at first glance, if the revocation key in my idea is not publicized but sent only to the counterparty, it is effectively equivalent to the current technique. But the receiving counterparty has the option of publishing this revocation key in order to allow anyone to enforce and get free money, even with malleability. > >That's true, actually.
Do you think it's a good idea to publish revocation keys, and have the condition (Alice && revokekey) || (CSV + 1 && revokekey) || (CSV + 2 && Bob)? That way, you can revoke immediately if iyu are online, or anyone (including Bob) can poach it if you let the CSV+1 lapse (the hope is, Bob's probability of poaching via this method is low, so, it will disincentivize Bob). If you don't want anyone to poach the money via anyone-can-revoke, you can keep the revocation key to yourself, but you must ensure you can get online before the CSV+2 period arrives.
Quoted text (3 lines)
>You can certainly have trusted watchers know >your revocation keys (and they have a very compact form, so the storage >is ~log2(num-transactions).
Maybe, you mean, counterparty's revocation key? (sorry, I want to confirm my understanding of low level of Lightning Network)
Or is there some advantage to give your own revocation key to another trusted person?
(I'm considering, "your revocation key" is the revocation key that invalidates the output that goes to you, or is my understanding wrong?)
Regards,
ZmnSCPxj <ZmnSCPxj at protonmail.com> writes:
Quoted text (8 lines)
> Good morning Rusty, > >>ZmnSCPxj <ZmnSCPxj at protonmail.com> writes: >>> From what I can gather so far, it seems, the issue of transaction revocation even with transaction malleability appears to be solved. Although, I want to know, is my idea (which support selfish untrustworthy watchers) better than what Lightning now has? Or has different tradeoffs? It seems to me, at first glance, if the revocation key in my idea is not publicized but sent only to the counterparty, it is effectively equivalent to the current technique. But the receiving counterparty has the option of publishing this revocation key in order to allow anyone to enforce and get free money, even with malleability. >> >>That's true, actually. > > Do you think it's a good idea to publish revocation keys, and have the condition (Alice && revokekey) || (CSV + 1 && revokekey) || (CSV + 2 && Bob)? That way, you can revoke immediately if iyu are online, or anyone (including Bob) can poach it if you let the CSV+1 lapse (the hope is, Bob's probability of poaching via this method is low, so, it will disincentivize Bob). If you don't want anyone to poach the money via anyone-can-revoke, you can keep the revocation key to yourself, but you must ensure you can get online before the CSV+2 period arrives.
I think it's a good idea to use segwit, and not rely on these kind of games...
Quoted text (5 lines)
>>You can certainly have trusted watchers know >>your revocation keys (and they have a very compact form, so the storage >>is ~log2(num-transactions). > > Maybe, you mean, counterparty's revocation key? (sorry, I want to confirm my understanding of low level of Lightning Network)
Ah, terminology? I meant A could share the key which allows A to spend B's old commitment transactions.
Cheers, Rusty.
Good morning Rusty,
Quoted text (3 lines)
>> Do you think it's a good idea to publish revocation keys, and have the condition (Alice && revokekey) || (CSV + 1 && revokekey) || (CSV + 2 && Bob)? That way, you can revoke immediately if iyu are online, or anyone (including Bob) can poach it if you let the CSV+1 lapse (the hope is, Bob's probability of poaching via this method is low, so, it will disincentivize Bob). If you don't want anyone to poach the money via anyone-can-revoke, you can keep the revocation key to yourself, but you must ensure you can get online before the CSV+2 period arrives. >I think it's a good idea to use segwit, and not rely on these kind of >games...
I understand.
Quoted text (8 lines)
>>>You can certainly have trusted watchers know >>>your revocation keys (and they have a very compact form, so the storage >>>is ~log2(num-transactions). >> >> Maybe, you mean, counterparty's revocation key? (sorry, I want to confirm my understanding of low level of Lightning Network) > >Ah, terminology? I meant A could share the key which allows A to spend >B's old commitment transactions.
Thank you very much your explanation!
Regards, ZmnSCPxj