This repository contains the code for a decentralized lottery application built with Solidity, Hardhat, Chainlink VRF and a Next.js frontend. The application allows users to enter a raffle by paying a specified entrance fee. A winner is selected randomly at regular intervals using Chainlink VRF to ensure fairness.
- Introduction
- Features
- Technologies Used
- Smart Contract
- Frontend
- Installation
- Usage
- Contributing
- License
The Decentralized Lottery Application is an automated raffle system where users can participate by paying an entry fee. The smart contract, written in Solidity, handles the logic for entering the raffle, selecting a random winner using Chainlink VRF and distributing the prize. The frontend, built with Next.js, provides an interface for users to interact with the raffle.
- Decentralized and transparent lottery system
- Fair winner selection using Chainlink VRF
- Automated processes with Chainlink Automation
- User-friendly interface built with Next.js
- Secure and efficient contract design
- Solidity: Smart contract programming language
- Hardhat: Ethereum development environment
- Chainlink VRF: Verifiable random function for fair randomness
- Next.js: React framework for building the frontend
- Ethers.js: Library for interacting with the Ethereum blockchain
The smart contract is located in the contracts
directory. It is implemented using Solidity and Hardhat.
- Raffle Contract: The main contract that handles the raffle logic.
- Chainlink VRF Integration: Ensures fair and random winner selection.
- Automation: Utilizes Chainlink Automation for periodic winner selection.
The frontend is built using Next.js and is located in the frontend directory.
- Homepage: Allows users to enter the raffle, view current number of participant and last winner
- Winner Announcement: Displays the recent winner of the raffle.
- User Interaction: Provides a seamless interface for interacting with the smart contract.
- Node.js
- npm or yarn
git clone https://github.com/ExtraCaterpiller/Decentralized-Lottery
cd decentralized-lottery
cd LotteryHardhat
npm install
open a new terminal and execute the following:
cd lotteryfrontend
npm install
- Configure your environment variables in .env.
- Deploy the contract using Hardhat
npx hardhat deploy --network <your-network>
- start the Next.js development server:
npm run dev
- Open your browser and navigate to http://localhost:3000
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for details.