🎩
How Are Winners Determined?
Lottery uses works as follows:
- 1.After the on-going lottery round expires, two block numbers are selected: the latest one on the chain is obtained (Block A) and a future yet-to-be-produced block (Block B).
- 2.A third random number, is selected as a salt.
- 3.Block A and the salt s are chained together and hashed with SHA-3 to get a digest D.
- 4.The digest D is put on-chain and the round for the lottery is closed to prohibit the purchase of new tickets.
- 5.After Block B is mined, both Block A and the salt are uploaded to a random number contract, which verifies that the digest matches the uploaded block number and salt in step 3.
- 6.The random number contract verifies that the digest matches the uploaded block number and salt and then takes the block hash and salt corresponding to the block number and does a SHA hash to calculate the final lottery result.
Last modified 1yr ago