A decentralized lottery application built with Next.js, React, and Solidity to enable fair and transparent lottery games on the blockchain. This project integrates a smart contract powered by Chainlink VRF for randomness and uses modern web technologies for an engaging user interface.
- Blockchain-Powered: Leverages Ethereum blockchain and smart contracts for secure and decentralized lotteries.
- Chainlink VRF Integration: Ensures verifiable randomness for selecting lottery winners.
- Modern Frontend: Built with Next.js and React, styled using TailwindCSS for a responsive design.
- Wallet Integration: Supports MetaMask for seamless user authentication and transaction handling.
- Thirdweb Deployment: Streamlines smart contract deployment and interaction.
- Frontend: React, Next.js, TailwindCSS
- Blockchain: Solidity, Chainlink VRF
- Libraries: ethers.js, thirdweb
- Tools: MetaMask, Yarn/NPM
- Node.js and Yarn/NPM installed.
- A Web3 wallet like MetaMask.
- Access to an Ethereum-compatible network (e.g., testnet or local blockchain).
git clone https://github.com/junaid5598/react-next-lottery.git
cd react-next-lottery
npm install
# or
yarn install
- Update the smart contract address in the application configuration (usually in a constants or environment file).
- Ensure your blockchain node or provider (e.g., Alchemy or Infura) is set up.
npm run dev
# or
yarn dev
Navigate to http://localhost:3000 in your browser to see the app.
- Connect your MetaMask wallet to the application.
- Enter the lottery by paying the required entry fee in ETH.
- Wait for the draw, powered by Chainlink VRF, to determine the winner.
- If you're the winner, claim your prize directly through the application.
The smart contract used in this project ensures transparency and fairness. Key functionalities include:
- Create Lottery: Admins can create a new lottery with specific start and end times and an entry fee.
- Enter Lottery: Users can participate by paying the entry fee.
- Draw Winner: Calls Chainlink VRF for randomness to select a winner.
- Withdraw Winnings: The winner can claim their prize securely.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for details.
Let me know if additional sections or edits are needed!