How it works

At a high level overview the oracle creates a unique signature with their private key and the provided seed, the contract verifies it and send the random number back.

A smart contract calls RequestRandomNumber on the RNDFusion contract with a request ID and some ether for the callback transaction.

RequestRandomNumber(uint256 requestId) public payable

Three oracles are chosen from all the available oracles and an event is emitted with the 3 oracles public addresses, a seed, the request ID and the amount of ether that was sent for the callback function.

Filfull(uint256 requestId, bytes memory signature)

The oracles receives the event if they are one of the oracles chosen they create a unique 'ECDSA' (Elliptic Curve Digital Signature Algorithm) signature based on their private key and the seed. That is then send back to the RNDFusion contract for validation using the amount of ether send as the gas limit. So the oracles never spend more than what they receive.

The contract checks if the data is indeed from the oracle and the same seed has been used, it then creates a true random number with this signature and is send back to the games contract calling fulfillRandomWords with the requestID and the random number

fulfillRandomWords(uint256 _requestId, uint256 _randomNumber)

The first of the three oracles transaction is used, the other two will revert and remaining gas sent back. The oracle is then paid with the amount of ether that was originally sent.

Last updated