Wooy
Search…
⌃K
Links

How are winners chosen?

Randon Number Generator

Wooy has abstracted the generation of random numbers by creating a request-based Random Number Generator interface. This is how it works:
  1. 1.
    The user will first get the request fee. The fee will be expressed using an (address, amount) pair representing the required ERC20 and amount.
  2. 2.
    The user will then approve the RNG to spend that ERC20 of the amount.
  3. 3.
    The user will then request the random number. The RNG will transfer the cost into itself and begin the request. The request returns a request identifier.
  4. 4.
    The user may check to see if the random number is available using the identifier.
  5. 5.
    When the random number is available the user may retrieve it with the identifier.
A verifiable random function is a pseudo-random function with an output that is unique and can be publicly verified.
ChainLink has implemented their VRF using public key cryptography. It works like so:
  1. 1.
    The user creates a “seed” value
  2. 2.
    A ChainLink operator, who has publicly committed to a keypair, uses their secret to sign the seed value.
  3. 3.
    The user is able to verify that the operator has signed the seed value, and consume the signature as the “random number”.
ChainLink VRF Documentation: https://docs.chain.link/docs/chainlink-vrf
This approach has some benefits in that the operator cannot “lie”: they must sign the seed using the secret they have committed to. The algorithm is also immediate: there is no delay or waiting period to get the answer.

Blockhash RNG

The Blockhash RNG uses a future blockhash as the random number. This is the least secure method of random number generation, but also the simplest and cheapest.
When a user requests a random number, their lock block will be the current block. Their request is considered complete when at least one block has been mined since the lock block. Upon retrieval, the last blockhash will be stored as the random number and returned.