Review of Current Approaches
Random Number Generators (RNGs) are an essential component of blockchain technology. They are used to generate the cryptographic keys that secure the blockchain network. There are several approaches to RNGs in blockchain technology, each with its own pros and cons.
One approach is to use a centralized RNG, which is controlled by a single entity. This approach is simple and easy to implement but is vulnerable to attacks. Also, it is hard to ensure that the generated random numbers are unbiased. In such centralized RNGs, the system administrators usually have full power to manipulate the outcome of RNGs. For example, administrators may filter some random numbers, and only publish ones that benefit them. Theoretically, these numbers are random and are verifiable, but the whole process has been censored and only favored contents are allowed to the public.
Another approach is to use a decentralized RNG, which is distributed across the network. This approach is more secure but can be slower and more complex to implement. An example of this approach is the use of a consensus algorithm to generate random numbers. Another example is the use of a verifiable random function (VRF). A VRF is a cryptographic function that takes a series of inputs, computes them, and produces a pseudorandom output and proof of authenticity that can be verified by anyone. VRFs have found essential applications in blockchain design, such as random beacons and proof-of-stake consensus protocols.
These decentralized RNGs are secure, unpredictable, and unbiased. However, they are slow and too complicated to implement. Moreover, the implementation should be done at the core level of the chains, which is obviously hard to move across various existing blockchain platforms like Polygon, BNB chain, Avalanche, and so on.
There are other approaches to implement RNG which are based on block time and block hash. Time-based approaches are simple to implement and can provide a high degree of randomness. However, they can be vulnerable to manipulation by miners/validators who can influence the timestamp of a block. The block hash-based approaches, on the other hand, are more resistant to manipulation, but they can suffer from low entropy if the block time is too short or if there are not enough transactions in a block to provide sufficient randomness. Additionally, a transaction could not access the hash of the current block, but previous blocks. This makes the block hash-based approaches vulnerable to attack.
A promising decentralized RNG approach is the RANDAO protocol. It is a decentralized autonomous organization (DAO) that works as an RNG for the Ethereum blockchain. The protocol is designed to generate random numbers in a transparent and secure manner, with the participation of all interested parties.
The basic process of the RANDAO protocol can be divided into following phases:
Commit phase:
Anyone who wants to participate in the random number generation needs to send a transaction to the RANDAO contract with a hash of s, typically hashed by the sha3 function. In which, s is the secret number chosen by the participant. S could be a pseudo random number generated locally at the participant machine. The commit phase lasted for a predefined period of time, controlled by the RANDAO contract.
Reveal phase:
After the first phase, participants who successfully submitted a hash of s need to send another transaction with their secret s number to the RANDAO contract. The contract will verify that s is valid by running sha3 against it and comparing the result with the previously committed data. Valid s values will be saved to generate the final random number. Similarly, the duration of this phase is also predefined and controlled by the RANDAO contract.
Calculation phase:
After all secret numbers have been collected. The RANDAO contract will calculate the random number using a function f(s1, s2,..., sn). The result will be written to the contract’s storage and fed to other contracts that requested for random numbers.
The RANDAO protocol achieves security through the participation of a large number of participants. The more participants there are, the more difficult it is for any single participant or group of participants to manipulate the outcome of the random number generation. However, this also means that it takes time for enough participants to join and contribute their secret numbers to the protocol.
The RANDAO protocol is adaptable with numerous EVM-compatible chains, while RNGDAO is an adapted version of the RANDAO framework tailored for the Oasys chain. Designed to function seamlessly with smart contracts, it offers a secure and transparent mechanism for producing random numbers. Nevertheless, its design doesn't accommodate generating random numbers for every block, as it demands ample time for sufficient participants to join and contribute their secret numbers to the protocol. This balance between security and efficiency is crucial to maintain the protocol's credibility and the genuine randomness of the numbers produced.
Last updated