This project is a decentralized application (dapp) for a lottery system built on the Base blockchain. The dapp allows users to participate in a lottery by purchasing tickets using ETH cryptocurrency. The smart contract governing the lottery is deployed on the Base network.
-
Ticket Price: 0.001 ETH
-
Maximum Tickets per Lottery: 100
-
Ticket Commission: 0.0001 ETH per ticket
-
Duration: 30 minutes for each lottery
-
Expiration: Timeout in case the lottery is not carried out
-
Lottery Operator: Address of the creator/operator of the lottery
-
Operator's Total Commission: Total commission balance accrued by the operator
-
Last Winner: Address of the last winner of the lottery
-
Last Winner Amount: Amount won by the last winner
-
Users can purchase tickets by sending the required ETH.
-
The operator can draw the winner randomly after the purchase period expires.
-
Winners can withdraw their winnings.
-
The operator can withdraw accumulated commission.
-
The lottery can be restarted if no tickets were purchased.
-
Solidity for Smart Contract Development
-
Next.js for the Web Application Interface
-
ThirdWeb for Smart Contract Interaction
-
Tailwind CSS for Styling
-
TypeScript for Typed JavaScript Development
-
Ensure you have a compatible Ethereum wallet (such as MetaMask) configured for the Base network and sufficient ETH to purchase tickets.
-
Access the dapp interface deployed on a web browser.
-
Connect your Ethereum wallet to the dapp and switch to the Mumbai testnet.
-
View the current lottery details, such as remaining tickets, ticket price, and total pool, in ETH.
-
Purchase tickets by specifying the quantity and confirming the transaction.
-
Monitor the countdown timer for the lottery expiration.
-
If you win, withdraw your winnings through the interface.
-
If you're the lottery operator, manage the lottery through the admin controls.
-
Clone the repository.
-
Install dependencies using
npm install
. -
Set up environment variables required for the application.
-
Run the application using
npm run dev
.
-
Improvement: Implement better UI/UX for a more engaging user experience.
-
Known Issue: Lack of extensive error handling in certain scenarios.
-
Enhancement: Add more functionalities like multiple lottery rounds, different prize structures, etc.
This dapp is powered by ThirdWeb.