Giter VIP home page Giter VIP logo

raffle's Introduction

Raffle

Raffle is a rollup chain for Celestia. Anyone can create a Raffle and proceed fairly on the blockchain. Anyone can query the results easily.

Setup

1. Install Ignite

curl https://get.ignite.com/cli | bash

2. clone raffle & configure init sciprt

git clone https://github.com/daniel-ck89/raffle.git
cd raffle
git checkout v0.1.0
vi init.sh

> On line 49, update base_url to your celestia light node's gateway url.

3. Run init script

./init.sh

  • Simply run this script to start the chain.

Cmd list

  • raffle tx raffle create-simple-raffle
  • raffle tx raffle start-simple-raffle
  • raffle q raffle raffles
  • raffle q raffle raffle
  • raffle q raffle raffle-result

Usage

1. Create a raffle

raffled tx raffle create-simple-raffle "Event1" "This is a custom keyboard limited edition raffle." "https://docs.google.com/spreadsheets/d/1jEnEBlYIf_GfQs32WfaCJJNtrylpfQdL_2NVtegtPGM/edit?usp=sharing" 10 25 --from raffle-key-1 --broadcast-mode block --keyring-backend test --node http://localhost:27657

  • If raffle creation is successful, Id (raffle_id) will be returned.

Usage :

raffled tx raffle create-simple-raffle [title] [description] [participant-list-url] [number-of-winners] [number-of-participants] [flags]

  • title : Raffle's title. ( max 256 characters )
  • description : Raffle's description. ( max 1024 characters )
  • participant-list-url : The url of the site contains the list of participants. Give each participant a unique id in sequential order, starting from 0. ex) https://docs.google.com/spreadsheets/d/1jEnEBlYIf_GfQs32WfaCJJNtrylpfQdL_2NVtegtPGM/edit#gid=0
  • number-of-winners : This is the number of winners. ( max winners 10,000 )
  • number-of-participants : The number of participants participating in the raffle. ( max participants 30,000 )

   

2. Query your raffle when after your tx is processed successfully

raffled q raffle raffle 0 --output json --node http://localhost:27657

  • Response
    • {"raffle":{"creator":"raffle187p7dxsk3s4fujhx2q7a8ftd35fj2jmx97kfu0","id":"0","status":0,"title":"Event1","description":"This is a custom keyboard limited edition raffle.","participantListUrl":"https://docs.google.com/spreadsheets/d/1jEnEBlYIf_GfQs32WfaCJJNtrylpfQdL_2NVtegtPGM/edit?usp=sharing","numberOfWinners":10,"numberOfParticipants":25}}
  • where status is the current status of raffle. 0 means raffle has not yet exited.

Usage :

raffled q raffle raffle [raffle_id] [flags]

If the raffle_id is not returned due to broadcast timeout in the previous step, you can find your raffle by querying raffles.

raffled q raffle raffles --reverse --output=json --node http://localhost:27657

   

3. Start raffle

raffled tx raffle start-simple-raffle 0 --from raffle-key-1 --keyring-backend test --node http://localhost:27657

  • Proceed to raffle.

Usage :

raffled tx raffle start-simple-raffle [raffle_id] [flags]

   

4. Query the raffle result

raffled q raffle raffle-result 0 --output json --node http://localhost:27657

  • Response
    • {"raffleResult":"{"result":[1,5,7,8,9,10,15,16,17,21]}"}
  • This returns the participants_id(in the docs submitted through participant-list-url) of the winners.

Usage :

raffled q raffle raffle-result [raffle_id] [flags]

raffle's People

Contributors

daniel-ck89 avatar

Watchers

 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.