- Solidity programming language.
- Ethereum.
- Remix IDE.
Global Variables :-
- Owner -> The real owner who deployed the contract ( type address ).
- Players -> All the players address will be stored in this dynamic array ( type address[] ).
- lotteryNo -> keep track of total lotteries done.
- winners -> key value pair to keep track of lottery winners history.
Functions :-
- Enter Lottery
- Pick winner
- Get random number.
- get balance.
- get players
- get winners by lottery id.
-
The lottery starts accepting transactions, anyone having an ethereum wallet can send a minimum amount of 0.001 Ether.
-
The Player send Ether directly to the contract address and after that their ethereum address is registered. A user can send more transactions and we don't impose the maximum amount allowed to be sent.
-
There will be a manager, The owner who will deploy the contract.
-
At some point, randomly chosen by the manager, he'll pick a random winner from the player list. Only the manager is allowed to see the contract balance and randomly select the winner.
-
The contract will transfer the entire balance to the winner address and the lottery is reset and ready for the next round.