Coder Social home page Coder Social logo

three-party-lottery-protocol-using-ethereum's Introduction

Three-Party-Lottery-Protocol-Using-Ethereum

This project implements TPLP using Ethereum (Blockchain), written in solidity Description of functions used:

1. Constructor

  • Some user say(user_1) press deploy button, along with the value of initial money each user will have.
  • Each user gets initial account balance=V(entered in deploy).
  • This user is the owner or starter of the lottery.

2. getRandomLotteryTicket

  • This function returns a random number between [1, 1000]

3. init_user

  • This function assigns the calling user to one of the users user_1, user_2 and user_3

4. buyTicketUser(price)

  • Using this function each user buys a lottery ticket by paying the price(10$).
  • Each user pays price for the ticket

5. send_A_B(amount)

  • Using this function user A sends 'amount' money to the user B.

6. getBalU

  • Using this function each user checks his current account balance.

7. getNumberU

  • Using this function each user checks his lottery number, allotted to her/him.

8. getWinnerRandomly

  • This function returns a random number from lottery numbers{L1, L2, L3}.

9. startLottery

  • Owner starts the lottery.
  • Calculates the hash of the winner's lottery number.

10. checU(lottery number)

  • Using this function a user checks if his/lottery number equals to the winner's lottery number or not.

11. endTheLottery

  • The owner of the lottery calls this function to check if the winner of the lottery was found successfully.
  • Otherwise the lottery ticket price is refunded to the users.

three-party-lottery-protocol-using-ethereum's People

Contributors

methleshkoshle avatar

Watchers

James Cloos avatar  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.