August 2018
Intermediate to advanced
404 pages
11h 19m
English
Let's consider a lottery system that selects the winning numbers based on a future block hash. While buying a ticket, the user is asked to guess a random set of numbers and is validated against some future block. The prize is given based on how accurate the prediction was.
pragma solidity ^0.4.17;// Decentralized autonomous lotterycontract DAL { // ...}
struct Bet { // Bet amount uint256 value; // Guessed numbers uint32 betHash; ...