-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time locked transaction outputs #25
Comments
This belongs in the transaction signature. Yeah, it'd have to be encoded in another field. |
Given that we already sign the fee, it'd either have to get composed or added as another signature. |
Been thinking a little about this. We currently sign the We do the following to create the message (with just the fee currently) -
So there is space in there to include the timelock info. But - this limits the timelock to the entire transaction, so all outputs would be affected by this, change outputs as well. Is this an acceptable approach? I guess the general approach would be to make the necessary transactions within the wallet to build a single output of the right amount and then send the timelocked transaction creating a single timelocked output (and avoid ending up with a potentially large change output also encumbered with a timelock). |
I also saw some mention on the ML of keeping the We have the This would mean the majority of TxKernels would remain the same size (assuming most are not encumbered by timelocks). |
Yes, the only thing MW can do that I'm aware of is put a timelock on a kernel, which effectively timelocks the whole transaction. I'd prefer that every kernel have a timelock to make "real" ones inconspicuous, for privacy's sake. But it's not a strong preference. |
@apoelstra I thought I saw you recommend on the ML somewhere to avoid putting a timelock on every kernel to minimize the storage cost? Except - is it not going to be trivially easy to identify no-op timelocks or very short lock periods by just comparing the kernels to the height or timestamp of the blocks they originate from? |
There isn't any way to do relative locktimes (that I know of) -- the way kernel locktimes work is that they make that kernel invalid until the specified block is up. Relative locktimes would require validators learn when outputs were spent relative to when they were created, which isn't possible in general in MW because later validators never learn about old spent outputs. There may still be value in supporting this because typical relative locktimes are quite short-lived, but these locktimes would have a much weaker form of security than the rest of the system. They would need to be associated with outputs rather than kernels. Yes, I did comment on how I wanted to save space, but Igno (I think) convinced me that "only four bytes" per kernel was fine :). |
Oh interesting. I had not fully thought through the output validation vs kernel validation. |
Even with coinbase outputs, historical validators won't be able to validate that the funds were unmoved until maturity. I think this is acceptable, the maturity rule is only about reorg safety and to "exploit this" you have to rewrite way more blocks than you would to just replace mature coinbases in the first place. I hadn't noticed this before. Interesting. |
Initial PR up for discussion (based on conversation above) - #167 |
Another idea. Assume we have hashed switch commitments as proposed by Andrew in [1]:
By default we reuse the |
As discussed on Gitter, my proposal was for time-lock outputs, whereas the previous discussion mostly revolved around time-locked transactions (that can't be included in a block before |
For time-locked output, couldn't we introduce a new NUM base point K such that an output commits to |
@melaurent if the locktime height should be hidden until it is used (which TBH doesn't seem super useful to me), it is more verifier-efficient to just hide it behind a hash and reveal it explicitly. Then no EC math needs to be done. Further, with your suggestion |
Oops! I realize suddenly that there is a miner-collusion vulnerability with outputs that have relative locktimes. If somebody spends these before the tx is confirmed (so clearly way before the locktime is up), a miner can include both transactions. The timelocked output will get cut-through and nobody will know that any rule was violated. |
Oh - so its not valid to put the tx in the pool (this can be consensus enforced). |
A miner can include any transaction they want without telling anyone else until it's in the block, yes. Regarding output lock times, as those are in the chain, assumingly whoever relies on them would wait until they're mined and detected in the chain before proceeding with the contract? Also right now we don't support multi-kernel transactions. |
@antiochp I'm saying that these outputs are not secure at all until they've been deeply confirmed. @ignopeverell I'm actually not sure what application unconditionally locked outputs have, so I don't know how protocols using them would likely work. But this seems like a pretty serious footgun. |
(this is all assuming we can solve the issue with miner collusion and zero confirmations). Switch commit proposal -
The range proof signs the extra switch commitment @ignopeverell proposal above to use the switch commit to hide the lock_height
What if we used We could then pass
We could then preserve reuse of To spend you would need to reveal I'm sure I'm missing something really basic here as to why this falls down. Thoughts? |
Just to circle back, miner collusion is indeed an issue in the general case. And actually even without miner collusion, if we start allowing multi-kernel transactions (we don't at the moment), it will become even more of a problem. However in the particular case of time-locking miner rewards (which is what I believe you're after here), I don't see any immediate issue with this scheme. It would also be a nice way to try out switch commitment hash pre-image reveals. |
Multi-kernel transactions will come into play when we start using Schnorr signatures or is this something else? My understanding is we will have multiple kernels when multiple parties are involved in building parts of the tx independently? Could you explain how this is involved as I don't think I understand the impact here? |
Schnorr signatures are aggregates (they've actually been rebranded as aggregate signatures or aggsigs) so that would still only generate a single kernel. In short, each party generate a partial signature and all of them can then be aggregated into a single final one. Multiple kernels come into play for the current issue because if you want to do cut-through between 2 transactions, generating a single one afterward, you do need to be able to have multiple kernels. Otherwise the resulting "merged" transaction would not sum correctly with the kernel. Does that make more sense? |
Yeah ok I see how we'd end up with a tx with multiple kernels. But I don't see how this affects outputs? Just thinking through this some more - can any two txs effectively be merged like this? |
Sort of related - I know you mentioned coin-join previously. Ah I think it clicked for me - if we allow "coin-joined" txs with multiple kernels to be pushed onto the network then we no longer know if any inputs/outputs have been cut-through as a result of the merged txs. So it is not just a miners that could be colluding, any party in the network could have done this. |
How do we support them? Would likely require another output field and a signature. Maybe add to the transaction proof signature.
This would be great to have for higher level contract supports like payment channels, lightning, etc.
The text was updated successfully, but these errors were encountered: