), launching today, is a paid service proving random numbers to Ethereum contracts which are securely generated off-chain but can be verified on-chain. This enables, for example, a gambling contract to guarantee fairness to its users or a contract using randomness to select round leaders to guarantee that the selection process was not manipulated.How
Etherandom works in two stages: seeding and execution. Each requires a contract call.Seeding
1. Your contract invokes
, which generates an EVM event log and returns a call identifier.
2. Our servers detect this log, securely generate a random secret key (called the server seed), and store this seed along with the call identifier in fault-tolerant cloud infrastructure.
3. Our servers call back
in the invoking contract with a Keccak-256 hash of the server seed.Execution
4. Your contract stores the server seed hash and invokes
with the seed hash, a client seed, and the desired cardinality of the random number. Just like etherandomSeed, this generates an EVM event log and returns a call identifier.
5. Our servers detect this log, retrieve the previously generated server seed from storage (looking it up by the hash), and calculate the random number.
6. Our servers call back
in the invoking contract with the random number and the server seed as parameters. Your contract can verify, on-chain, that the random number was fairly generated (by asserting that the hash of the now-revealed server seed is equal to the hash your contract was initially provided and performing the random number computation on-chain), and then take action accordingly.Use It
Etherandom is live on the Ethereum mainnet and the Morden testnet.
Contract source and a simple example available on Github
; more soon to come.Questions / feedback / feature requests?
Reply to this thread or email [email protected]