discreetlogcontracts / dlcspecs

Specification for Discreet Log Contracts
Creative Commons Attribution 4.0 International
238 stars 36 forks source link

Numeric Outcome DLCs #110

Closed nkohen closed 3 years ago

nkohen commented 4 years ago

This introduces a new document which specifies how to construct and execute DLCs based on (multi-nonce) numeric outcomes.

This includes CET compression optimizations as well as an implementation of general payout curve support, which are combined to describe a (nearly) deterministic CET computation algorithm which is approximately minimal. (I am open to splitting this up into many files if people want).

Remaining TODOs:

And lastly I intend to create test vectors as I have almost all of this implemented in a branch on bitcoin-s but these tests shouldn't block this PR being discussed and merged as they will be added in a subsequent PR.

Fixes #65

NicolasDorier commented 4 years ago

I must say I have a hard time understanding it from the Example part, but this is probably not your fault, I am bad at understanding when things are too abstract.

I would suggest, instead of using abstraction, just assuming B=10 and take a real, concrete example of range. Or maybe as a more "concrete example" new part.

nkohen commented 4 years ago

I would suggest, instead of using abstraction, just assuming B=10 and take a real, concrete example of range. Or maybe as a more "concrete example" new part.

Great idea, I've added a concrete example before the general abstract one

NicolasDorier commented 4 years ago

Removed my comments. I think I figured out how to compute all the CET, but I fail to understand the three optimization, it would be helpful to have a concrete example.

nkohen commented 4 years ago

Removed my comments. I think I figured out how to compute all the CET, but I fail to understand the three optimization, it would be helpful to have a concrete example.

Just pushed an attempt to make the optimizations more clear.

nkohen commented 4 years ago

Ugh, and as I did that I realized that there are actually some optimizations I missed and that all of the optimizations including the ones I've missed can be stated cleverly as a single optimization, I will be pushing this change up shortly