Giter Site home page Giter Site logo

nahss / algorand-lottery-dapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joe11-y/algorand-lottery-dapp

0.0 0.0 0.0 566 KB

Lottery DApp using a linear congruential generator on algorand layer one blockchain

Home Page: https://joe11-y.github.io/Algorand-Lottery-DApp/

JavaScript 56.44% Python 37.23% CSS 4.15% HTML 2.18%

algorand-lottery-dapp's Introduction

Algorand Lottery DApp

-----------------------------------------------------

A simple lottery contract that awards a lucky winner with a half of the generated prizepot.

The Lottery is controlled by anyone as everyone who has opted in can start and end the lottery, within is allocated time.

link to dapp

Prize Pool

Here's how prize money is distributed:

  • Lottery Winner (Lucky winner) - 50%

  • Lottery Creator (User who creates the new lottery) - 5%

  • Lottery Starter (User who starts the lottery) - 5%

  • Lottery Ender (User who ends the Lottery) - 5%

  • Next Lottery (Prizepool of next lottery) - 35%

Lottery Flow

  • Before a lottery session can be started, The Lottery application is first created, this is where the user inputs the duration in minutes and the price of the tickets for that session.

  • Now after creation, To start the lottery session, the user has to deposit 1 Algo as that is the minimum required amount for an application to be able to do transactions on it's own.

  • Next the user has to opt in, as before you can use this lottery (due to it being a stateful application) the user must subscribe to it.

  • After which the user is now able to buy tickets, until the lottery duration expires.

  • When session duration expires, and the end lottery function is called by any user (note: User must have opted in to lottery, and user pays 1 algo fee to end lottery) the lottery is subjected to checks to see if it's valid or not

      Minimum of 5 tickets and 2 Players
    
    • If Valid, then the prize pool is distributed and the lucky winning ticket position is generated, then the creator, starter and ender are rewarded.

    • If not Valid, then the lottery end time is reset using the duration provided by the lottery creator.

  • Finally after the lottery session is over, user's can then check to see if they possess the winning ticket and whoever finds it, triggers the function that sends the reward to him.

  • On next lottery restart the lottery itself calls the previous lottery and requests for the fund allocated for it.

1. Tech Stack

This boilerplate uses the following tech stack:

  • React - A JavaScript library for building user interfaces.
  • algosdk - A frontend library for interacting with the Algorand Blockchain.
  • Bootstrap - A CSS framework that provides responsive, mobile-first layouts.

๐Ÿ‘‡ Getting Started

Prerequisites

Run locally

  1. Clone repo

    git clone https://github.com/JoE11-y/Algorand-Lottery-DApp.git
  2. Install packages

    npm install
  3. Run application

    npm start
  4. Open development server on http://localhost:3000

(back to top)

-----------------------------------------------------

๐Ÿ’ป Development: Connect to testnet wallet

  • Create account on testnet using MyAlgo Wallet
  • Add funds using faucet
  • Start app, click "Connect Wallet" and use MyAlgo Wallet UI to connect testnet wallet

(back to top)

-----------------------------------------------------

โœ๏ธ Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

-----------------------------------------------------

๐Ÿ‘ฎโ€โ™‚๏ธ License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

-----------------------------------------------------

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.