ZmnSCPxj [ARCHIVE] on Nostr: š
Original date posted:2021-05-23 š Original message: Good morning list, I have ...
š
Original date posted:2021-05-23
š Original message:
Good morning list,
I have decided to dabble in necromancy, thus, I revive this long-dead thread from two years ago.
Ph34R mE and my leet thread necromancy skillz.
A short while ago, LL and Steve Lee were discussing about ways to reduce the privkey onlineness requirement for Lightning.
And LL mentioned that this proposal could allow privkeys to be kept offline for a receiver.
* The receiver has to be online, still.
* Its privkeys can be kept offline.
* The receiver can still receive even if its privkeys are offline (for example the privkeys are in a hardware signing module that is typically kept offline and is only put online at rare intervals).
* The sender has to be online and the sender privkeys have to be online.
* Forwarders and their privkeys have to be online.
Unfortunately, I think the proposal, as currently made, cannot support the above feature, as stated.
When an HTLC transaction is provided by the sender under a Fast Forward scheme, it provides a transaction that spends from "its" output in both versions of the latest Poon-Dryja commitment transaction.
However, this output, as provided in the Fast Forward scheme, requires *two* signatures.
Here are the scripts mentioned in the previous post:
OP_IF
# Penalty transaction/Fast forward
<local_revokepubkey> OP_CHECKSIGVERIFY <remote_penaltyclaimpubkey>
OP_ELSE
`to_self_delay`
OP_CSV
OP_DROP
<local_delayedpubkey>
OP_ENDIF
OP_CHECKSIG
And:
OP_IF
# Penalty transaction/Fast forward
<local_revokepubkey> OP_CHECKSIGVERIFY <remote_penaltyclaimpubkey>
OP_ELSE
`to_self_delay`
OP_CSV
OP_DROP
<remote_delayedpubkey>
OP_ENDIF
OP_CHECKSIG
Now, the first branch is what is used in the Fast Forward scheme.
And we can see that in the first branch, two signatures are needed: one for local, and one for remote.
Thus, any HTLC-bearing transactions are signed by both the sender and receiver.
Fast Forwards works its low-latency magic by simply having the sender send the signature spending from the current channel state, outright, to the receiver, and until the channel is updated, the HTLC is "safe":
* The current channel state (represented by some commitment tx) cannot be replaced with an alternative, without the replacer risking funds loss (Poon-Dryja punishment mechanism).
* The spending tx that instantiates the HTLC is safe because the receiver will not willingly sign an alternate version.
***HOWEVER***, the HTLC is safe on the assumption that *the receiver can provide its signature* if the channel is dropped onchain.
And channels can be dropped onchain *at any time*.
If the receiver is unable to provide its signature before the `to_self_delay` finishes, then the sender can revoke ***all*** HTLCs it sent!
Thus, at least as initially stated, Fast Forwards cannot be used for this "receiver online, privkeys offline, can receive" feature.
***HOWEVER HOWEVER***, we should note that the caveats are something we can actually work with:
* The privkeys can only be offline for up to `to_self_delay` blocks.
* We ***need*** privkeys to be periodically online more often than `to_self_delay` anyway, ***in case of theft attempts***.
So this is not an ***additional*** requirement at least.
* Watchtowers cannot guard against attempts to steal Fast Forwarded HTLCs --- they need to receive the signatures for the HTLC transactions as well, otherwise they can do nothing about it.
* However, whenever the receiver sends to a watchtower it *does* need to send signatures anyway, so it still needs to get privkeys online for signing.
* Since we need the privkeys to be made online a little more often than every `to_self_delay` blocks anyway, this is *not* an additional requirement!
***THUS***, we *can* provide a tweaked version of the above desired feature:
* The receiver has to be online, still.
* Its privkeys can be kept offline, ***BUT***, it has to be regularly brought online a little more often than `to_self_delay`.
* The receiver can still receive even if its privkeys are offline (for example the privkeys are in a hardware signing module that is typically kept offline and is only put online at rare intervals).
* The sender has to be online and the sender privkeys have to be online.
* Forwarders and their privkeys have to be online.
The additional requirement --- that the receiver privkeys have to be regularly brought online --- is not actually an onerous one *since we need it for channel safety*.
So this feature is indeed supported by Fast Forwards (with fairly minimal caveats!) and kudos to LL for thinking of it!
Against this, we should remind the drawbacks of Fast Forwards:
* Onchain space is much higher (in the unilateral close case only --- channel opens and mutual closes remain small) due to chaining of transactions instead of strict replacement.
* Fast Forwarded HTLCs need to have their signatures stored on replicated storage, and is O(n) (current Poon-Dryja requires O(1) storage for revocation keys but O(n) storage for HTLC hash/timelock details).
If you lose your data storage, you lose received HTLCs, including those whose preimages you have already released.
For this, we should also take note that:
* Payment latency is greatly improved.
* The above "receiver online, receiver privkeys offline, can receive" feature is now possible, with the caveat:
* The privkeys need to be periodically brought online for short amounts of time in order to "collapse" chains of HTLC transactions, recover from theft attempts, and update watchtowers etc.
---
Now, Fast Forwards is a scheme that is designed for a modified form of Poon-Dryja.
Unfortunately, at least for now, it seems the scheme cannot be used in Decker-Russell-Osuntokun ("eltoo").
In particular, Fast Forwards work because it is safe (and even required!) for a Poon-Dryja scheme to impose timeouts on the "main" outputs of a channel.
And those timeouts have a branch that is a 2-of-2 between the channel participants.
That branch is where Fast Forwards hook into.
In Decker-Russell-Osuntokun, the "main" outputs are not encumbered by any timeouts; they are simple singly-signed outputs.
The timeout is instead placed "before" the state transactions that contain the "main" outputs.
The HTLC transactions are not safe without a 2-of-2, as otherwise the sender could just spend the main output to a different address, removing the HTLC.
Because of this, the "main" output of a Decker-Russell-Osuntokun cannot be used in a Fast Forwarded manner, as the Fast Forwarded transaction needs to be signed by both participants.
We *could* add *another* timeout at the main output simply to support Fast Forwards, using a similar "2of2 or OP_CSV+singlesig".
However, this increases the effective delay in the case the channel is dropped unilaterally onchain.
In addition, we should remind that when forwarding, Decker-Russell-Osuntokun requires that the CLTV at a particular hop be larger than the `to_self_delay` at that hop i.e. it imposes a "minimum CLTV" cost that is combined with `max` instead of `+`, which pathfinding algorithms (that I know of) are totally not designed for.
Furthermore, properly designed, a Decker-Russell-Osuntokun construction could also have payment latency approaching the latency of the Fast Forward scheme, so that advantage of Fast Forwards is lost as well, so we are paying for more inconvenience for a smaller feature set (only the "receiver online, privkey offline" feature remains; maybe worth it?).
Of note, is that there also exists a Poon-Dryja variant that has a similar structure to Decker-Russell-Osuntokun (and has the same drawback of requiring a "minimum CLTV" at each hop) --- Fast Forwards would also not work well with that particular Poon-Dryja variant, too.
Regards,
ZmnSCPxj
Published at
2023-06-09 13:02:28Event JSON
{
"id": "3a1128e58913394ffc357fa57bb9a3cdb86d0084cd1a47df75bd94d527aa8d45",
"pubkey": "4505072744a9d3e490af9262bfe38e6ee5338a77177b565b6b37730b63a7b861",
"created_at": 1686315748,
"kind": 1,
"tags": [
[
"e",
"06e34eda5a8a0c7de05c6d7fb765c1b1b6244f4127232ba197792f82a60b593c",
"",
"reply"
],
[
"p",
"9456f7acb763eaab2e02bd8e60cf17df74f352c2ae579dce1f1dd25c95dd611c"
]
],
"content": "š
Original date posted:2021-05-23\nš Original message:\nGood morning list,\n\nI have decided to dabble in necromancy, thus, I revive this long-dead thread from two years ago.\nPh34R mE and my leet thread necromancy skillz.\n\nA short while ago, LL and Steve Lee were discussing about ways to reduce the privkey onlineness requirement for Lightning.\nAnd LL mentioned that this proposal could allow privkeys to be kept offline for a receiver.\n\n* The receiver has to be online, still.\n* Its privkeys can be kept offline.\n * The receiver can still receive even if its privkeys are offline (for example the privkeys are in a hardware signing module that is typically kept offline and is only put online at rare intervals).\n* The sender has to be online and the sender privkeys have to be online.\n* Forwarders and their privkeys have to be online.\n\nUnfortunately, I think the proposal, as currently made, cannot support the above feature, as stated.\n\nWhen an HTLC transaction is provided by the sender under a Fast Forward scheme, it provides a transaction that spends from \"its\" output in both versions of the latest Poon-Dryja commitment transaction.\n\nHowever, this output, as provided in the Fast Forward scheme, requires *two* signatures.\n\nHere are the scripts mentioned in the previous post:\n\n OP_IF\n # Penalty transaction/Fast forward\n \u003clocal_revokepubkey\u003e OP_CHECKSIGVERIFY \u003cremote_penaltyclaimpubkey\u003e\n OP_ELSE\n `to_self_delay`\n OP_CSV\n OP_DROP\n \u003clocal_delayedpubkey\u003e\n OP_ENDIF\n OP_CHECKSIG\n\nAnd:\n\n OP_IF\n # Penalty transaction/Fast forward\n \u003clocal_revokepubkey\u003e OP_CHECKSIGVERIFY \u003cremote_penaltyclaimpubkey\u003e\n OP_ELSE\n `to_self_delay`\n OP_CSV\n OP_DROP\n \u003cremote_delayedpubkey\u003e\n OP_ENDIF\n OP_CHECKSIG\n\nNow, the first branch is what is used in the Fast Forward scheme.\nAnd we can see that in the first branch, two signatures are needed: one for local, and one for remote.\n\nThus, any HTLC-bearing transactions are signed by both the sender and receiver.\nFast Forwards works its low-latency magic by simply having the sender send the signature spending from the current channel state, outright, to the receiver, and until the channel is updated, the HTLC is \"safe\":\n\n* The current channel state (represented by some commitment tx) cannot be replaced with an alternative, without the replacer risking funds loss (Poon-Dryja punishment mechanism).\n* The spending tx that instantiates the HTLC is safe because the receiver will not willingly sign an alternate version.\n\n***HOWEVER***, the HTLC is safe on the assumption that *the receiver can provide its signature* if the channel is dropped onchain.\nAnd channels can be dropped onchain *at any time*.\nIf the receiver is unable to provide its signature before the `to_self_delay` finishes, then the sender can revoke ***all*** HTLCs it sent!\n\nThus, at least as initially stated, Fast Forwards cannot be used for this \"receiver online, privkeys offline, can receive\" feature.\n\n***HOWEVER HOWEVER***, we should note that the caveats are something we can actually work with:\n\n* The privkeys can only be offline for up to `to_self_delay` blocks.\n * We ***need*** privkeys to be periodically online more often than `to_self_delay` anyway, ***in case of theft attempts***.\n So this is not an ***additional*** requirement at least.\n* Watchtowers cannot guard against attempts to steal Fast Forwarded HTLCs --- they need to receive the signatures for the HTLC transactions as well, otherwise they can do nothing about it.\n * However, whenever the receiver sends to a watchtower it *does* need to send signatures anyway, so it still needs to get privkeys online for signing.\n * Since we need the privkeys to be made online a little more often than every `to_self_delay` blocks anyway, this is *not* an additional requirement!\n\n***THUS***, we *can* provide a tweaked version of the above desired feature:\n\n* The receiver has to be online, still.\n* Its privkeys can be kept offline, ***BUT***, it has to be regularly brought online a little more often than `to_self_delay`.\n * The receiver can still receive even if its privkeys are offline (for example the privkeys are in a hardware signing module that is typically kept offline and is only put online at rare intervals).\n* The sender has to be online and the sender privkeys have to be online.\n* Forwarders and their privkeys have to be online.\n\nThe additional requirement --- that the receiver privkeys have to be regularly brought online --- is not actually an onerous one *since we need it for channel safety*.\n\nSo this feature is indeed supported by Fast Forwards (with fairly minimal caveats!) and kudos to LL for thinking of it!\n\nAgainst this, we should remind the drawbacks of Fast Forwards:\n\n* Onchain space is much higher (in the unilateral close case only --- channel opens and mutual closes remain small) due to chaining of transactions instead of strict replacement.\n* Fast Forwarded HTLCs need to have their signatures stored on replicated storage, and is O(n) (current Poon-Dryja requires O(1) storage for revocation keys but O(n) storage for HTLC hash/timelock details).\n If you lose your data storage, you lose received HTLCs, including those whose preimages you have already released.\n\nFor this, we should also take note that:\n\n* Payment latency is greatly improved.\n* The above \"receiver online, receiver privkeys offline, can receive\" feature is now possible, with the caveat:\n * The privkeys need to be periodically brought online for short amounts of time in order to \"collapse\" chains of HTLC transactions, recover from theft attempts, and update watchtowers etc.\n\n---\n\nNow, Fast Forwards is a scheme that is designed for a modified form of Poon-Dryja.\n\nUnfortunately, at least for now, it seems the scheme cannot be used in Decker-Russell-Osuntokun (\"eltoo\").\n\nIn particular, Fast Forwards work because it is safe (and even required!) for a Poon-Dryja scheme to impose timeouts on the \"main\" outputs of a channel.\nAnd those timeouts have a branch that is a 2-of-2 between the channel participants.\nThat branch is where Fast Forwards hook into.\n\nIn Decker-Russell-Osuntokun, the \"main\" outputs are not encumbered by any timeouts; they are simple singly-signed outputs.\nThe timeout is instead placed \"before\" the state transactions that contain the \"main\" outputs.\nThe HTLC transactions are not safe without a 2-of-2, as otherwise the sender could just spend the main output to a different address, removing the HTLC.\n\nBecause of this, the \"main\" output of a Decker-Russell-Osuntokun cannot be used in a Fast Forwarded manner, as the Fast Forwarded transaction needs to be signed by both participants.\n\nWe *could* add *another* timeout at the main output simply to support Fast Forwards, using a similar \"2of2 or OP_CSV+singlesig\".\nHowever, this increases the effective delay in the case the channel is dropped unilaterally onchain.\n\nIn addition, we should remind that when forwarding, Decker-Russell-Osuntokun requires that the CLTV at a particular hop be larger than the `to_self_delay` at that hop i.e. it imposes a \"minimum CLTV\" cost that is combined with `max` instead of `+`, which pathfinding algorithms (that I know of) are totally not designed for.\n\nFurthermore, properly designed, a Decker-Russell-Osuntokun construction could also have payment latency approaching the latency of the Fast Forward scheme, so that advantage of Fast Forwards is lost as well, so we are paying for more inconvenience for a smaller feature set (only the \"receiver online, privkey offline\" feature remains; maybe worth it?).\n\nOf note, is that there also exists a Poon-Dryja variant that has a similar structure to Decker-Russell-Osuntokun (and has the same drawback of requiring a \"minimum CLTV\" at each hop) --- Fast Forwards would also not work well with that particular Poon-Dryja variant, too.\n\n\nRegards,\nZmnSCPxj",
"sig": "f2cfd0988bb566726ddb3a6b0b8bb0dfce839ba51e641e83f2420bed87f99499bfa9a580b73aceda50a18755546201c1fc74adbacccd487288f409573cc1f4ff"
}