Welcome to the Decentralized Lottery System project! This project leverages Solidity, Chainlink VRF 2.5, and Chainlink Price Feeds, developed using the Brownie framework, to create a fair and transparent lottery system on the Sepolia testnet.
- Project Overview
- Features
- Getting Started
- Deployment
- Running the Lottery
- Testing
- Technologies Used
- Contributing
- License
This project implements a decentralized lottery system where participants can enter by paying a fee of Sepolia ETH worth $50. The winner is selected using Chainlink's VRF 2.5, ensuring a verifiable and tamper-proof random selection. The entry fee is dynamically calculated using Chainlink's AggregatorV3Interface to fetch the latest ETH-USD price.
- Fairness: Verifiable random selection of the winner using Chainlink VRF 2.5.
- Transparency: All transactions and processes are visible and verifiable on the blockchain.
- Accuracy: Real-time ETH-USD pricing ensures the entry fee is always $50 worth of ETH.
- Reliability: Comprehensive unit and integration tests to ensure robustness.
- Python 3.7+
- Brownie
- Ganache (for local development)
- Sepolia ETH (for testnet deployment and participation)
-
Clone the repository:
git clone https://github.com/yourusername/lottery-system.git cd lottery-system
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up a
.env
file with your environment variables:WEB3_INFURA_PROJECT_ID=your_infura_project_id PRIVATE_KEY=your_private_key
-
Compile the smart contracts:
brownie compile
-
Deploy the contracts to the Sepolia testnet:
brownie run scripts/deploy.py --network sepolia
Use the following commands to interact with the lottery:
-
Deploy the Lottery:
from scripts.deploy_lottery import deploy_lottery deploy_lottery()
-
Start the Lottery:
from scripts.start_lottery import start_lottery start_lottery()
-
Enter the Lottery:
from scripts.enter_lottery import enter_lottery enter_lottery()
-
End the Lottery:
from scripts.end_lottery import end_lottery end_lottery()
Run the tests to ensure everything is working correctly:
brownie test