Coder Social home page Coder Social logo

bigchiano / crypto-lottery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skynette/crypto-lottery

0.0 0.0 0.0 420 KB

This project is a decentralized application (dapp) for a lottery system built on the Polygon (Matic) blockchain

Home Page: https://rapidraw.vercel.app/

JavaScript 2.08% TypeScript 79.31% CSS 2.72% Solidity 15.88%

crypto-lottery's Introduction

Lottery Dapp

Splash Screen

enter image description here This project is a decentralized application (dapp) for a lottery system built on the Polygon (Matic) blockchain. The dapp allows users to participate in a lottery by purchasing tickets using Matic cryptocurrency. The smart contract governing the lottery is deployed on the Polygon Mumbai testnet.

Smart Contract Details

Lottery Contract

  • Ticket Price: 0.01 Matic

  • Maximum Tickets per Lottery: 100

  • Ticket Commission: 0.001 Matic 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

Functionalities

  • Users can purchase tickets by sending the required Matic.

  • 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.

Technologies Used

  • 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

How to Use

  1. Ensure you have a compatible Ethereum wallet (such as MetaMask) configured for the Polygon network (Mumbai testnet) and sufficient Matic to purchase tickets.

  2. Access the dapp interface deployed on a web browser.

  3. Connect your Ethereum wallet to the dapp and switch to the Mumbai testnet.

  4. View the current lottery details, such as remaining tickets, ticket price, and total pool, in Matic.

  5. Purchase tickets by specifying the quantity and confirming the transaction.

  6. Monitor the countdown timer for the lottery expiration.

  7. If you win, withdraw your winnings through the interface.

  8. If you're the lottery operator, manage the lottery through the admin controls.

Installation

  1. Clone the repository.

  2. Install dependencies using npm install.

  3. Set up environment variables required for the application.

  4. Run the application using npm run dev.

Known Issues and Future Improvements

  • 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.

Credits

This dapp is powered by ThirdWeb.

crypto-lottery's People

Contributors

skynette avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.