This answer mentions an improved way for an oracle to provide random numbers to a contract.

use commitments, i.e. the oracle would push a hash in the contract before the game, and send the random number (and a nonce) after the game, the contract checking that the hash and the random number match (with the nonce). Commitments prevent oracles from changing the random number during the game...

I do not have a background in cryptography, but from searching around this seems to be referring to the Commitment scheme. The main idea is that the oracle could choose a random value before hand, send the hash to the contract, then later send the random value to the contract and the contract can check that the random number matches the hash.

I have the following questions:

  1. What vulnerabilities exist in the model (one I can think of is that we need to trust the oracle to not divulge the secret before the end of the game)?

  2. What are some secure and proven libraries that implement a form of the Commitment scheme that would be adequate for implementing the oracle as described as above? (any programming language is fine)

  3. Give the solution in 2, is Michelson able to check the hashed value?

1 Answer 1


Some sketches of a response:

  1. You also need to trust that the oracle actually generates random values. Note that you can distribute the trust by using the several oracles and combining the result.

  2. I don't know of any such libraries.

  3. Hard to say without knowing the exact details of 2, but there are no conceptual difficulties. Michelson supports several hash functions: Blake2B, Keccak-256, SHA-256, SHA3-256 and SHA-512 at the time of writing.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.