Research/Bitcoin Dev Archive / lightning-dev list
commitment update steps
9 messages, Jul 23 to 27, 2015. Started by Anthony Towns.
Joseph Poon (4), Anthony Towns (3), Rusty Russell (2)
Hi *,
For my own understanding I've been trying to work out what the lightning protocol looks like at a network-protocol level. I think the following works, maybe it's interesting for others:
For notational convenience I'm going to just list the secrets that need to be known to use to spend an output. "Alice" and "Bob" are Alice and Bob's respective keys, Alice_N and Bob_N are the Nth numbers in shachain sequences [0]. I'm using TIMEOUT for the checktimelockverify construction; DELAY for the checksequenceverify construction.
Assume Alice and Bob already have a channel setup. Then their current commitments might be:
Alice's commitment txn: (fully signed) 500 Alice + DELAY | #Alice_101 + Bob 500 Bob
Bob's commitment txn: (fully signed) 500 Alice 500 Bob + DELAY | #Bob_101 + Alice
Alice knows the hash of #Bob_101 and Bob knows the hash of #Alice_101 (because they've respectively seen the full txns to sign them).
If Alice wants to update the channel to reflect a conditional payment from Bob once R is revealed, they can follow the following steps:
1) Alice proposes: (unsigned)
500 Alice + DELAY | #Alice_102 + Bob
400 Bob
100 R + Alice + DELAY | Bob + TIMEOUT | #Alice_102 + Bob
[1]
Bob checks: txn structure, amounts, R, Bob key is correct Bob stores the hash of #Alice_102
2a) Bob declines; proposal never happened
2b) Bob approves, replies:
signing Alice's proposal
requesting sig of:
500 Alice
400 Bob + DELAY | #Bob_102 + Alice
100 R + Alice | Bob + TIMEOUT + DELAY | #Bob_102 + Alice
Alice checks: signature, txn structure, amounts, R, Alice key is correct
Alice signs and stores new txn.
Alice stores the hash of #Bob_102
3) Alice discards old commitment txn.
Alice replies:
signing Bob's transaction
revealing Alice_101
Bob checks: signature,
Alice_101 hashes correctly (ie matches the hash of #Alice_101, stored
previously),
Alice_101 forms hash chain with prior secrets (Alice_100, Alice_99..)
as expected
Bob signs and stores his new commitment txn
Bob discards the hash of #Alice_101.
4) Bob discards old commitment txn
Bob replies:
revealing Bob_101
Alice checks:
Bob_101 hashes correctly (ie #Bob_101 does clear the old txn),
Bob_101 forms hash chain with prior secrets (Bob_100, Alice_99..) as
expected
Alice discards the hash of #Bob_101
If the protocol follows through to completion, then they each have matching, updated, signed commitment transactions; along with the secrets necessary to void attempts to use older commitments. If the protocol goes off track (checks fail, or no response from partner within a protocol timeout), then either party can safely close the channel after any step:
Alice can close at (500/500) up until step (3) Alice can close at (500/400/100) after step (2b)
Bob can close at (500/500) up until step (4) Bob can close at (500/400/100) after step (3)
If Alice ever tries cheating, and publishes and old commitment:
800 Alice + DELAY | #Alice_42 + Bob 200 Bob
Then Bob needs to work out which of the 100 Alice_N hashes he knows or can work out is being abused; prior to the DELAY expiring. With millions of transactions that could be a bunch of hash calculations or a 100MB lookup table. Might make more sense to have a dummy output of "0: OP_RETURN 42" to make that calculation trivial though? That could trivially be verified as part of the "forms hash chain as expect" and "txn structure" checks.
HTLCs are harder if you assume pay2scripthash is used though. If Alice published:
100 Alice + Delay | #Alice_55 + Bob 100 Bob 200 R1 + Alice + DELAY | Bob + TIMEOUT1 | #Alice_55 + Bob 200 R2 + Alice + DELAY | Bob + TIMEOUT2 | #Alice_55 + Bob 200 R3 + Alice + DELAY | Bob + TIMEOUT3 | #Alice_55 + Bob 200 R4 + Alice + DELAY | Bob + TIMEOUT4 | #Alice_55 + Bob
well after R1..R4 were known and Alice_55 was revealed in order to try stealing most of the channel's funds, I think Bob could only claim the final outputs if he could unhash the scripts, which would require having remembered R1..R4 even after those contracts had long been resolved. I guess it could be feasible in that case to have the extra output be "0: OP_RETURN 42 #R1 #R2 #R3 #R4"?
Cheers, aj
[0] It's easy to calculate Alice_N given Alice_M for some M > N, but unfeasible for any M < N.
[1] I don't understand the construction for HTLCs in 0.5.9 of the lightning paper; what I'm doing instead is taking an underlying output of "Alice + R | Bob + TIMEOUT" and mapping it through "my key becomes my key + DELAY" + "they get everything with my secret sequence and their key". I'll post about that separately so it can get shot down :)
[2] (Unattached footnote) This project's motto is "The lightning network: it's off the chain!" right? http://www.urbandictionary.com/define.php?term=off+the+chain
Anthony Towns <aj at erisian.com.au> writes:
Quoted text (11 lines)
> If Alice ever tries cheating, and publishes and old commitment: > > 800 Alice + DELAY | #Alice_42 + Bob > 200 Bob > > Then Bob needs to work out which of the 100 Alice_N hashes he knows or can > work out is being abused; prior to the DELAY expiring. With millions of > transactions that could be a bunch of hash calculations or a 100MB lookup > table. Might make more sense to have a dummy output of "0: OP_RETURN 42" to > make that calculation trivial though? That could trivially be verified as > part of the "forms hash chain as expect" and "txn structure" checks.
It might be millions. What happens is Bob sees the anchor being spent, checks if it's the latest commitment transaction. It's not, so does a backwards search to find the revocation key.
The time taken for that search is O(N), where N is the current commitment transaction number. But measurements on my laptop show that 1M transactions takes 5.4 seconds (see benchmark below), so I don't think it's worth optimizing this "never happens" case.
Quoted text (16 lines)
> HTLCs are harder if you assume pay2scripthash is used though. If Alice > published: > > 100 Alice + Delay | #Alice_55 + Bob > 100 Bob > 200 R1 + Alice + DELAY | Bob + TIMEOUT1 | #Alice_55 + Bob > 200 R2 + Alice + DELAY | Bob + TIMEOUT2 | #Alice_55 + Bob > 200 R3 + Alice + DELAY | Bob + TIMEOUT3 | #Alice_55 + Bob > 200 R4 + Alice + DELAY | Bob + TIMEOUT4 | #Alice_55 + Bob > > well after R1..R4 were known and Alice_55 was revealed in order to try > stealing most of the channel's funds, I think Bob could only claim the > final outputs if he could unhash the scripts, which would require having > remembered R1..R4 even after those contracts had long been resolved. I > guess it could be feasible in that case to have the extra output be "0: > OP_RETURN 42 #R1 #R2 #R3 #R4"?
Good point! With p2sh you need to know the R hash values and timeouts to spend the output (40 bytes). Since OP_RETURN is length-limited to 80 bytes, you can't fit more than 2.
And if the HTLC outputs are not P2SH, they're non-standard and won't be relayed.
What else can we come up with?
Thanks, Rusty.
Quoted text (3 lines)
> [2] (Unattached footnote) This project's motto is "The lightning network: > it's off the chain!" right? > http://www.urbandictionary.com/define.php?term=off+the+chain
Err.... Yeah. It's spelled "caching layer for bitcoin" but it's pronounced just like that.
On 24 July 2015 at 10:49, Rusty Russell <rusty at rustcorp.com.au> wrote:
Quoted text (13 lines)
> Anthony Towns <aj at erisian.com.au> writes: > > If Alice ever tries cheating, and publishes and old commitment: > > 800 Alice + DELAY | #Alice_42 + Bob > > 200 Bob > > Then Bob needs to work out which of the 100 Alice_N hashes he knows or > can > > work out is being abused; prior to the DELAY expiring. With millions of > > transactions that could be a bunch of hash calculations or a 100MB lookup > > table. Might make more sense to have a dummy output of "0: OP_RETURN 42" > to > > make that calculation trivial though? That could trivially be verified as > > part of the "forms hash chain as expect" and "txn structure" checks. > It might be millions.
If a channel is updated ~100 of times a second, and lasts for a month, that would be 259M updates, which on your laptop would be 22 minutes of search time. If we're talking 3 days worth of OP_CSV delay, even that would be pretty fine. So yeah, okay, seems plausible.
Quoted text (21 lines)
> HTLCs are harder if you assume pay2scripthash is used though. If Alice > > published: > > > > 100 Alice + Delay | #Alice_55 + Bob > > 100 Bob > > 200 R1 + Alice + DELAY | Bob + TIMEOUT1 | #Alice_55 + Bob > > 200 R2 + Alice + DELAY | Bob + TIMEOUT2 | #Alice_55 + Bob > > 200 R3 + Alice + DELAY | Bob + TIMEOUT3 | #Alice_55 + Bob > > 200 R4 + Alice + DELAY | Bob + TIMEOUT4 | #Alice_55 + Bob > > > > well after R1..R4 were known and Alice_55 was revealed in order to try > > stealing most of the channel's funds, I think Bob could only claim the > > final outputs if he could unhash the scripts, which would require having > > remembered R1..R4 even after those contracts had long been resolved. I > > guess it could be feasible in that case to have the extra output be "0: > > OP_RETURN 42 #R1 #R2 #R3 #R4"? > > Good point! With p2sh you need to know the R hash values and timeouts > to spend the output (40 bytes). Since OP_RETURN is length-limited to 80 > bytes, you can't fit more than 2. >
You could have multiple OP_RETURN outputs though? Your txn would look like:
version n inputs: 2 input 1: [txn] [idx] [len] [SIGA SIGB] [seq] input 2: [txn] [idx] [len] [SIGB SIGA] [seq] n outputs: 2 + x output 1: [value] [len] [p2sh] # Alice output 2: [value] [len] [p2sh] # Bob output 3: [value] [len] [p2sh] # R1 output 4: [value] [len] [p2sh] # R2 output 5: [value] [len] [OP_RETURN R1R2] ...
p2sh outputs are 32 bytes total I think; OP_RETURN is 51 bytes, so you're increasing the txn size by about 80%.
Otherwise I think you have to remember all the R's you see. But if that's okay -- 100/second for a month is just 5GB if you just store them in the order you see them; you can probably do something like:
- at the time of this transaction, I've seen 0 < N < 2^32 R's on this channel - here's a 288 bit bloom filter telling you which of the first N R's that I've seen are worth checking - add a single 0btc "OP_RETURN [N | bloomfilter]" output - (or if there are 10 or less R outputs, just concatenate their indexes as the OP_RETURN data)
Actually, I forgot about the TIMEOUT values which you'd presumably also need; so I guess that's an extra 4 bytes to include in the database of every R (+25%), and if you're not storing, I guess an extra OP_RETURN output that covers 10 R's for an additional overhead of 16%, so ~96% overhead all up.
If you consider your counterparty very reliable, then having 100% overhead in the commitment txns might not be a big deal -- you'll almost always close the channel cooperatively anyway, so the commitments don't get used and the fees for the overhead won't get paid; OTOH, if your counterparty isn't known to you, and you think it's likely they might randomly disappear off the net and you'll have to use the commitment, then trading off disk for fees might be sensible. You could change the choice while the channel's operating -- if a new R value is verbatim in the output, no need to store it locally, whether or not you've stored previous R values locally.
Cheers, aj
Hi Anthony,
If we're presuming everyone uses OP_CSV in the long-term, you can overload nLockTime with values below current unixtime as a filter/counter. It should be enough bits of entropy no matter the size (even in the billions of transactions in a single channel) Since both parties are signing the nLockTime value, it's safe to use that as an identifier in the Commitment Transaction.
Ah sorry, that only solves the Commitment Transactions, not the HTLC outputs. It's also not possible to use the pubkeys as identifiers, as Rusty said, P2SH would be used.
While it's possible to only check only recent blocks before the Commitment Transaction for the search space (e.g. 3 days worth), since you know when the Commitment Transaction was broadcast, the search space limitation sort of breaks down if you permit long-dated HTLCs.
Worst-case it may be possible to have long-dated HTLCs on a seperate hash-tree, but it's not an ideal solution.
In retrospect, this P2SH problem is somewhat exacerbated by the fact that the timeout being different numbers as well, so ideally that should be stored as part of the output. The tradeoff between having the entire script in the output (which results in larger transactions), and using P2SH (which reduces bits of entropy/identifiability) is a bit of a problem. For some reason, I've always assumed the output would be included (ignoring isStandard issues), but that may not be optimal.
For now, I think a reasonable stop-gap solution would be to have some small storage of prior commitment transactions. For every commitment, and each HTLC output, store the timeout and the original Commitment Transaction height when the HTLC was first made. That should be enough information to work with (you can work backwards if you know which Commitment Transaction the HTLC was first created) and amounts to 48 bits (6 bytes) of storage per HTLC output per fully expired Commitment Transaction. I generally dislike OP_RETURN as a solution, but it's possible.
Thanks for bringing this up, I haven't really properly considered this!
Oh, I forgot it's necessary to store the hash of the R value. That'll make it much bigger. 26-bytes or so.
Also, if OP_RETURN is viewed as acceptable, then you should be able to fit 3 outputs per OP_RETURN metadata output.
Thinking through further, using OP_RETURN metadata is objectively better than just having the nonstandard non-P2SH output when considering transaction size.
So for OP_RETURN, you could have a blob up to 80 bytes (or 40 if you want to maximize relay), which results in ~3 transactions if you assume 26-bytes per transaction. If you have a lot, you should probably just fill it all up and compact it, I guess.
16-bits is fine for timeouts since that's 65535 block heights, which is a little over a year's worth. Nothing's stopping you from supporting more than a year's worth if you can find the route, but that's a fine upper-bound for now.
32-bits is used for the Commitment Transaction. For even the most high-volume node, 10 commitments per second results in 300 million Commitment Transactions. This identifies in which Commitment Transaction the HTLC was created. By knowing the Commitment Transaction, you'll know the revocation preimage, so after the revocation information has been exchanged, you only need to know which Commitment Transaction the HTLC was originally formed, since the revocation information was originally *generated* using a merkle tree derived from the Commitment Transaction as an index.
In total that's 48-bits (6bytes) per HTLC output per Commitment. Plus 20-bytes for the hash(R), 26bytes.
If someone broadcasts an old Commitment and you don't have the HTLC data because it's expired and too old, check the OP_RETURN data for the 6-bytes, then compute the revocation data and compute a couple hundred revocations and see which one fits.
I think the tradeoff might be worth it. If you stored this data locally, the cost shouldn't be too high for end-users. However, for those that wish to do a lot of routing, this can add up. A node that does 10 commits/s with 100 HTLCs on average that results in a little over 800GB of local storage per channel if OP_RETURN wasn't used, which may very well be feasible for large hubs. Of course, whether OP_RETURN or local storage were used, it's better than having the entire script as part of the output.
On Fri, Jul 24, 2015 at 03:38:28PM -0700, Joseph Poon wrote:
Quoted text (6 lines)
> If we're presuming everyone uses OP_CSV in the long-term, you can > overload nLockTime with values below current unixtime as a > filter/counter. It should be enough bits of entropy no matter the size > (even in the billions of transactions in a single channel) Since both > parties are signing the nLockTime value, it's safe to use that as an > identifier in the Commitment Transaction.
Oh, that's clever! You can use the range between 500M and $NOW, which gives you 937,798,763 values at the time of writing, so about a billion updates per channel. If that wasn't enough, you could divide your actual n by 10, 100, 1000 etc, and just have to search through an additional 10, 100, 1000 hashes to work out which value to use when claiming cheating.
On Fri, Jul 24, 2015 at 04:24:49PM -0700, Joseph Poon wrote:
Quoted text (8 lines)
> Ah sorry, that only solves the Commitment Transactions, not the HTLC > outputs. It's also not possible to use the pubkeys as identifiers, as > Rusty said, P2SH would be used. > > While it's possible to only check only recent blocks before the > Commitment Transaction for the search space (e.g. 3 days worth), since > you know when the Commitment Transaction was broadcast, the search space > limitation sort of breaks down if you permit long-dated HTLCs.
I don't think it matters how long the HTLC was; maybe they're way old and all expired, but were payments to you. Say the current channel is:
12 -> Cheater 88 -> You
and the old transaction that Cheater just pushed to the blockchain was:
55 -> Cheater 3 -> You 10 -> You & R1 | Cheater & Timeout1 20 -> You & R2 | Cheater & Timeout2 12 -> You & R3 | Cheater & Timeout3
To get at least your 88 owed, you need all but the last transaction, so you need to be able to workout #R1 and #R2 and Timeout1 and Timeout2, no matter how long ago they were.
Quoted text (4 lines)
> For now, I think a reasonable stop-gap solution would be to have some > small storage of prior commitment transactions. For every commitment, > and each HTLC output, store the timeout and the original Commitment > Transaction height when the HTLC was first made.
I don't think you want to multiply each HTLC output by every commitment it's stored in -- if the TIMEOUT is on the order of a day, and the channel is updated just once a second that's a x86,400 blowout in storage, so almost 5 orders of magnitude.
But if everytime you see a new HTLC output (ie, R4, Timeout4), you could store those values and use the nLockTime trick to store the height of your HTLC storage. Then you just have to search back down from R4 to find the other HTLCs in the txn, ie R3, R2 and R1, which is just a matter of pulling out the values R, Timeout, dropping them into payment script templates, and checking if they match.
You could also store your commitment count to still limit the searching you have to do there. If you make the rule:
- nLockTime will increment everytime we introduce a new HTLC - nLockTime will increment everytime there's been N commitment updates since the last time nLockTime incremented
and you store:
- 47b commitment index - 1b am I being paid? - 80b R - 16b timeout
each time. If it's a new HTLC you store the info for that, if it's just a commitment bump, you store the active HTLC that's furthest from the top of the stack, or all 0s. That's 18 bytes per HTLC or n commitments. If you spend a year doing 100 new HTLC/s that's 57GB for HTLCs and if you set n to be 100k hashes to search through (so half a minute's work on Rusty's laptop), and assume 1000 commitments/s in a worst case distribution, that's just an extra 5MB.
You might have to increment by ~0.25 each time instead to last a year without nLockTime surpassing current Unix time; I don't think that causes much problem though -- you have maybe 4x as many commitment hashes to check, and up to an extra 3 HTLCs to check and skip. Reduce n by 4 to compensate, and that's an extra 20MB instead of 5MB.
~60GB after a year is about 30*12 = 360 GB-months of data, which is about $12 on Amazon S3. That seems reasonably plausible, even at scale, doesn't it?
(If you need an extra 4B per HTLC to avoid relying on OP_CTV/OP_CSV; that's ~23% more space; so say $15 over the course of a year)
Quoted text (6 lines)
> That should be enough > information to work with (you can work backwards if you know which > Commitment Transaction the HTLC was first created) and amounts to 48 > bits (6 bytes) of storage per HTLC output per fully expired Commitment > Transaction. I generally dislike OP_RETURN as a solution, but it's > possible.
Hmm, I'm not sure OP_RETURN actually works well enough for avoiding local storage of HTLC specs -- more than one OP_RETURN is non-standard :(
(Of course the scripts behind the P2SH hashes are non-standard too)
Quoted text (1 line)
> Thanks for bringing this up, I haven't really properly considered this!
Glad it's novel :)
On Fri, Jul 24, 2015 at 05:38:25PM -0700, Joseph Poon wrote:
Quoted text (4 lines)
> Oh, I forgot it's necessary to store the hash of the R value. That'll > make it much bigger. 26-bytes or so. > Also, if OP_RETURN is viewed as acceptable, then you should be able to > fit 3 outputs per OP_RETURN metadata output.
Yeah; 80 bytes works much better than 40 bytes.
Quoted text (9 lines)
> 32-bits is used for the Commitment Transaction. For even the most > high-volume node, 10 commitments per second results in 300 million > Commitment Transactions. This identifies in which Commitment Transaction > the HTLC was created. By knowing the Commitment Transaction, you'll know > the revocation preimage, so after the revocation information has been > exchanged, you only need to know which Commitment Transaction the HTLC > was originally formed, since the revocation information was originally > *generated* using a merkle tree derived from the Commitment Transaction > as an index.
I don't think this is useful if you've got OP_CTV and OP_CSV? If your script is:
Pay: (Alice & R & DELAY) | (Bob & TIMEOUT) | (Bob & REVOCATION)
then the REVOCATION has to be updated with each commitment update, or else Bob would be able to claim it immediately after the next commitment update. So you only need to know the txn's commitment id, which you work out from nLockTime anyway.
Otherwise, Alice, Bob, and DELAY are channel parameters; leaving just R and TIMEOUT which fit in 22 bytes. So you can fit ~3.6 R&TIMEOUTs in a single OP_RETURN (so 3.6 in 1, 7.2 in 2, exactly 40 in 11).
I'm not sure how the key management works for when you don't have OP_CTV or OP_CSV. I guess if the the key set used for HTLC #N is calculable given any secret M>N (but not M<=N), and you always reveal secret MIN(current active HTLC ids), then you just need to record the HTLC's index. You could again allow for a small search though; you only have to calculate the public key and hash the transaction against the calculated keys so searching should still be somewhat cheap. So yeah, I think that makes sense?
BTW, 10 commitments per second (per channel) doesn't sound /that/ high volume :) Pay per megabyte for an end user at 100Mb/s is already around that at least at peak times, eg.
Cheers, aj
Joseph Poon <joseph at lightning.network> writes:
Quoted text (5 lines)
> Oh, I forgot it's necessary to store the hash of the R value. That'll > make it much bigger. 26-bytes or so. > > Also, if OP_RETURN is viewed as acceptable, then you should be able to > fit 3 outputs per OP_RETURN metadata output.
So that's the summary of where we stand. Beyond 3 HTLCs, you need to remember HTLC values forever.
I think this has an effect on how we do anchor upgrades (to increase or decrease channel capitalization).
Naively, we just open another channel.
Alternately, we create a new anchor which spends the existing anchor(s).
While we're waiting for it to be sufficiently buried we create commitment txs (and HTLCs) against both the new and old anchor. Once the new anchor is buried enough, we drop the old one.
At that point, those ancient HTLCs all become unspendable, so we can forget those old values. I think that's a win...
(I've ignored issues with how we avoid mutation etc. with the new anchor, since I'm about to re-open that can in another thread).
Cheers, Rusty.
Hi Anthony,
On Sat, Jul 25, 2015 at 06:44:26PM +1000, Anthony Towns wrote:
Quoted text (25 lines)
> On Fri, Jul 24, 2015 at 04:24:49PM -0700, Joseph Poon wrote: > > Ah sorry, that only solves the Commitment Transactions, not the HTLC > > outputs. It's also not possible to use the pubkeys as identifiers, > > as Rusty said, P2SH would be used. > > > > While it's possible to only check only recent blocks before the > > Commitment Transaction for the search space (e.g. 3 days worth), > > since you know when the Commitment Transaction was broadcast, the > > search space limitation sort of breaks down if you permit long-dated > > HTLCs. > > I don't think it matters how long the HTLC was; maybe they're way old > and all expired, but were payments to you. Say the current channel is: > > 12 -> Cheater 88 -> You > > and the old transaction that Cheater just pushed to the blockchain > was: > > 55 -> Cheater 3 -> You 10 -> You & R1 | Cheater & Timeout1 20 -> You > & R2 | Cheater & Timeout2 12 -> You & R3 | Cheater & Timeout3 > > To get at least your 88 owed, you need all but the last transaction, > so you need to be able to workout #R1 and #R2 and Timeout1 and > Timeout2, no matter how long ago they were.
Yes, I agree, that is absolutely true. I was alluding to something different (but didn't properly explain myself), which is that if you did grinding of only recent Commitments, it's possible that there will be HTLCs with very high timeouts in the future and this may be a necessary requirement for some possible future use cases (e.g. recurring/pre-allocated billing).
Quoted text (16 lines)
> > For now, I think a reasonable stop-gap solution would be to have > > some small storage of prior commitment transactions. For every > > commitment, and each HTLC output, store the timeout and the original > > Commitment Transaction height when the HTLC was first made. > > I don't think you want to multiply each HTLC output by every > commitment it's stored in -- if the TIMEOUT is on the order of a day, > and the channel is updated just once a second that's a x86,400 blowout > in storage, so almost 5 orders of magnitude. > > But if everytime you see a new HTLC output (ie, R4, Timeout4), you > could store those values and use the nLockTime trick to store the > height of your HTLC storage. Then you just have to search back down > from R4 to find the other HTLCs in the txn, ie R3, R2 and R1, which is > just a matter of pulling out the values R, Timeout, dropping them into > payment script templates, and checking if they match.
Yes, that's a good point(!), especially when you're doing local storage. If you're relying on OP_RETURN, though, you must put in some more contextual data. If you're willing to regenerate the revocation hash every time, I guess the OP_RETURN can just be timeout and H. For local storage, you don't need to do it for every HTLC if you're willing to search back on near-dated HTLCs, but long-dated HTLCs (say, greater than a couple days) could be included (class memory vs. computation tradeoff). Agreed, the necessary data storage isn't *that bad* for core nodes, and trivial for edge nodes not doing liquidity providing (ignoring backup concerns, of course).
Quoted text (3 lines)
> BTW, 10 commitments per second (per channel) doesn't sound /that/ high > volume :) Pay per megabyte for an end user at 100Mb/s is already > around that at least at peak times, eg.
Perhaps with a relatively distributed graph and core nodes having many connections, it's possible that's the range. Either way, it should be fine. If you have enough entropy to filter by hundreds of millions using nLockTime, even if you have 10 billion (or 100 billion) to search through it should be nearly instant. If you have 1000 possible revocation hashes, just look at the first txout (the non-HTLC payouts to Alice and Bob) and see which revocation fits. Once you know the exact Commitment number, the rest of the outputs are easy.