Inspiration
Random number generation is one of those seemingly-simple exercises that is in fact devilishly complicated. Computers and programming languages are founded on predictability, and creating a number that is truly and verifiably random is much more troublesome than the layman would assume.
One of the biggest challenges for any developer is making an RNG system that is 100% trustworthy. Whether it's a competitive videogame or an online casino, there are plenty of scenarios where user trust is essential. Blockchain technology opens up a whole new set of possibilities for trust and verifiability, and allows users to have total confidence that the RNG is free from manipulation.
Bitcoin block hashes have been used to generate random numbers in the past, and we saw the need for a trusted RNG native to the Solana blockchain.
Our goal was to create a simple service that would give projects and applications on the Solana blockchain easy access to an effective and fully verifiable RNG.
Challenges we ran into
One major challenge was that unlike in Bitcoin, a Solana leader node can change the block hash for little cost. This means that if the block hash is used as the source of a random number, it could be controlled by the leader. However, if we use the block hash as input for a verifiable delay function (VDF), then take the VDF output as the random number, it will take 10s or more for anyone to calculate the random number after obtaining the block hash. This is long enough so that the Solana leader will miss the block generation window and will be unable to control the random number through changing the block hash. Therefore, by taking the Solana block hash as VDF input, and using the VDF output as a random number, we can construct a decentralized random number generator (RNG).
What it does
The RNG service we will provide is as follows: when a Solana block is generated, we will immediately input the block hash into the VDF, and output the result as a random number. Because we will output a random number sequence, the random numbers correspond one-to-one to the Solana block hash and the interval between random numbers is the same as Solana's block interval (about 0.5s). However, the key difference is that the random number is generated about 10 seconds later than the block hash.
Note that due to propagation delays and other reasons, although the leader cannot control the random number, they may be able to calculate the random number a little in advance (about 0.5s). Therefore, when selecting a random number, the application should choose a random number about 3s or more into the future.
Accomplishments that we're proud of
We were very proud to come up with such an effective solution to the issue of the leader being able to control the block hash.
What's next for Solrand
A test version should be live soon, providing random number oracle services for external projects.
Log in or sign up for Devpost to join the conversation.