Simple lottery contract
A decentralized lottery contract built with Solidity that allows users to participate in a transparent and fair lottery system.
- Entry Fee System: Configurable minimum entry fee set during deployment
- Fair Winner Selection: Pseudo-random winner selection using blockchain data
- Duplicate Prevention: Each address can only enter once per lottery round
- Owner Protections: Contract owner cannot participate but receives 10% fee
- Event Logging: All major actions emit events for tracking
- Lottery Reset: Owner can start new lottery rounds
- Contract Name: SimpleLottery
- Solidity Version: ^0.8.0
- License: MIT
_entryFeeInWei: Entry fee amount in Wei (e.g.,10000000000000000for 0.01 ETH)
- 0.001 ETH:
1000000000000000 - 0.01 ETH:
10000000000000000 - 0.1 ETH:
100000000000000000
- Call
enter()function with at least the minimum entry fee - Wait for owner to call
pickWinner() - Winner receives 90% of total prize pool
- Deploy contract with desired entry fee
- Wait for players to enter
- Call
pickWinner()to select winner and distribute prizes - Optionally call
resetLottery()to start a new round
getPlayers(): Returns array of all player addressesgetPlayerCount(): Returns number of current playersgetContractBalance(): Returns current contract balanceisPlayerEntered(address): Check if specific address has entered
- This uses pseudo-random number generation (not truly random)
- Owner receives 10% fee from total prize pool
- Contract owner cannot participate as a player
- For production use, consider using Chainlink VRF for true randomness
[Add your deployed contract address here]
- Network: [Add network name]
- Block Explorer: [Add block explorer link]
- Solidity ^0.8.0
- Remix IDE
- [Add network used]
This project is licensed under the MIT License - see the LICENSE file for details.
Created as part of smart contract development practice.
Note: This is for educational/demonstration purposes. Always audit smart contracts before using with real funds.