tlock-js icon indicating copy to clipboard operation
tlock-js copied to clipboard

Details on the Approximation of time

Open wighawag opened this issue 2 years ago • 2 comments

Hi,

Reading the doc it says about timeForRound:

timeForRound

Given a NetworkInfo object, it calculates the approximate time the given round will be emitted at (approximate because the network must work together to create the randomness).

It would be great if it gave also worst case scenario in both direction or even better a probability distribution on a range of time, so applications can predict accordingly.

I also could not find what to expect on the mainnet, Is it a one minute kind of difference we can expect or a lot more ? Thanks

wighawag avatar Aug 20 '22 08:08 wighawag

Right now the network emits random numbers every 3s in testnet, so you can timelock encrypt something for that precision. The network takes 0.8 seconds right now to generate the randomness together, so the precision isn't ms perfect - we think we can reduce that though!

Our timevault demo works on the order of minutes for nicer UX, but you can definitely have finer grained control.

CluEleSsUK avatar Aug 20 '22 08:08 CluEleSsUK

Thanks @CluEleSsUK for the info. For my use case this should actually be plenty enough.

I leave the issue open as instead of returning a single number it could ideally return more data like mentioned above.

wighawag avatar Aug 20 '22 09:08 wighawag