Chia-Network / clvm

[Contract Language|Chia Lisp] Virtual Machine
Apache License 2.0
86 stars 35 forks source link

Generating safe random numbers (VDF related) #88

Open exander77 opened 3 years ago

exander77 commented 3 years ago

Is there a way to generate safe random number securely in Chialisp? Can this functionality be implemented based on VDF?

exander77 commented 3 years ago

Hello, can I get some info about this. I would like to build a project which needs safe random number generation and I was waiting for the Chia as a possible platform because it has VDF.

exander77 commented 3 years ago

I am looking through codes and I am not sure if I can access VDF results inside the contract code.

arvidn commented 3 years ago

It depends on how you defined random. Clearly you can only write deterministic programs, so at best you'll have pseudo random numbers. The question then is what you seed them with.

exander77 commented 3 years ago

@arvidn I was reading through VDF and if I understand it correctly, VDF basically generates a random number that can anybody can verify, but nobody can arrive at it sooner. It is still deterministic, but because the result of the function is delayed nobody can know it beforehand. I would like to use it inside the smart contract to evaluate an event.

tommy4111 commented 3 years ago

Any progress on this?

arvidn commented 3 years ago

I don't imagine there will be any progress on this until someone makes a concrete proposal. It would be challenging, because the consensus is already set in stone, and blocks/spend bundles can be validated "in a vacuum", i.e. the clvm program can be executed and validated without knowing which block it might end up in.

fkornel commented 2 years ago

Yep, I am also interested in a solution or in a solution proposal. It would be awesome to have some similar functionality in chia like: https://chain.link/chainlink-vrf