Skip to main content

Tellor officially now has its own Random Number Generator!

After seeing such high market demand for a fully decentralized RNG, we decided to flex our muscles with our own unique approach to randomness. The new query type uses the following process to produce a random number:

  1. Takes a timestamp as the input

  2. Retrieves the next available block hash after this timestamp from both Ethereum & Bitcoin

  3. Keccak256 hashes the 2 block hashes together to get the random number in bytes32 form

  4. Submits the random hash on chain

A good example of this in action would be a lottery system:

With a lottery, you could pick a specific time in the future as a cutoff time when tickets can no longer be purchased.

Using the Tellor RNG, the developers who are building the lottery would have their smart contracts execute a request for the specific timestamp i.e. the cutoff date.

Once we reach this specified date, the contract will shoot off a request to Tellor’s reporters, who then race to find the block hashes that immediately follow that timestamp for both the Ethereum and Bitcoin blockchains.

Once the block hashes are discovered for both Bitcoin and Ethereum, these hashes are then hashed again using keccak256 to create a brand new bytes32 hash, which then gets submitted on-chain to the Tellor oracle. The lottery contract retrieves this value, converts it to an integer, and picks a lucky winner. 

Since the only parties who can technically predict the blockhash in advance are the miners who win the blocks, the Bitcoin block winner and the Ethereum block winner would actually have to collude to predict the number, a comfortably unlikely scenario.

If you’re a project looking for an RNG, check out an example contract which uses the RNG here!
You can also see the specification doc here!

Still have questions? Reach out to us in Twitter or Discord & we’ll be happy to help!