Coder Social home page Coder Social logo

bilyuner / chainlink-lottery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cyfrin/chainlink-lottery

0.0 0.0 0.0 1.67 MB

A web3 implementation of a lottery using Chainlink VRF and Chainlink alarm clock to have a totally decentralized lottery

JavaScript 89.78% CSS 3.58% HTML 6.63%

chainlink-lottery's Introduction

chainlink-lottery

You can play with this in remix here

A web3 implementation of a decentralized provably random lottery using Chainlink VRF and Chainlink alarm clock to have a totally decentralized lottery. Check the ETH readme for how to do the truffle stuff.

The front end is super broken.

If you play with it in remix, do the following:

  1. Compile all contracts and interfaces
  2. Deploy the governance contract
  3. Deploy the randomness contract with the governance contract address as a parameter
  4. Deploy the lottery contract with the governance contract address as a parameter
  5. call the governance function init with the lottery address, followed by the randomness address as parameters
  6. fund the randomness and lottery contract with some LINK
  7. Call the start_new_lottery function, with a duration you'd like it to last in seconds.
  8. Enter the lottery and have fun.
  9. After the duration is up, the winner should be automatically randomly chosen via Chainlink VRF - and the lottery will totally reset, so you can start another one.

You'll notice there are a few permission hiccups, but this is a beta so whatever.

To run:

git clone <this_repo>
cd chainlink-lottery
npm install

Make sure you have RPC_URL and MNEMONIC in your environment variables

To set this template up from scratch, you can run:

Setup:

npx create-react-app chainlink-lottery
cd chainlink-lottery
mkdir ethereum
cd ethereum
truffle unbox smartcontractkit/box

Mirgrate

truffle migrate --network live

TODO

  • Fix all the permission issues (random people can break the lottery at the moment, should be an easy fix)
  • Add more VRF nodes to decentralize the random number part
  • Add more Alarm clocks to decentralize the alarm clock part
  • Write tests
  • write scripts to make stuff easier
  • Cool frontend

chainlink-lottery's People

Contributors

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