Using Ethereum to build a lottery system


I was wondering if it would be possible to build such a system using Ethereum.

A participant can either text or email the numbers they would like to buy. The money is then automatically deducted from their linked account. Using information from actual lottery operators, the system will then pay out automatically if the numbers are a match.

There are a few advantages to doing this.

1. Automation
2. a truly worldwide system

I'm totally new to this system and I'm just wondering about the possibilities.

Thank you.


  • dittoditto Member Posts: 139 ✭✭
    You mean more like:

    > User sends Ethereum to lottery wallet with message (the numbers in this case)
    > Lottery wallet draws numbers (or pulls them from existing system?)
    > Winner is sent the Ethereum to the original source of funds.
  • shafiq87shafiq87 Member Posts: 3

    Yeah something like that.

    But i was thinking of using an already existing lottery system. Like the National Lottery in the UK or Singapore Pools in Singapore.

    I guess it's something very do-able. The thing here is how to collect the bets (money) and disperse the winnings.

    I'm not even sure where to start looking into this.
  • o0ragman0oo0ragman0o Member, Moderator Posts: 1,291 mod
    @shafiq87 There are already quite a number of provably fair gambling contracts on Ethereum. A typical scenario is where the contract will take bets and then some time later look to some future block's 'nonce' (an effectively random number) then calculate and send payouts.

    Ethereum as a platform cannot see anything outside of itself. Any outside data needs to be provided to the system by what is called an 'Oracle', be that Oracle a human or some automated weather station. So for ethereum to pay out against an existing lottery system, some trusted person/s need to enter that data into the contracts manually. This inevitably leads to 'trust problems', what if the person just enters their own numbers instead? is one such platform designed to crowd-source data for exactly this kind of application. With a crowd, it's much easier to detect self interest anomalies and penalize the dishonest agents while rewarding the honest ones.

  • shafiq87shafiq87 Member Posts: 3
    hey @o0ragman0o thanks for the explanation.

    I did not really understand the part about the "nonce" - what is that about?

    So effectively, this would have to be a series of one-to-one contracts with a human checking the numbers and entering the data manually. The idea of a platform using the crowd is great, helps to get rid of the trust issues and at the same time ensures that the system can continue running.

    The current gambling contracts on Ethereum i've seen are usually one-on-one bets on sports. Which is actually a really smart thing - you can get the results from any news outlet or stuff like that. But since you mentioned that Ethereum can't get information from outside the platform, I wonder how they do it now.

    I'm not much of a gambler, but I just figured this would be a very good system to start this exploration.
  • o0ragman0oo0ragman0o Member, Moderator Posts: 1,291 mod
    @shafiq87, A general understanding it that the nonce (a nonsense number) is the a random operand feed into the hashing algorithm along with block information. If the the digest (a constant length number that the hash algo spits outs) is less than difficulty, then the nonce is a solution to the block. A block can be quickly validated by the rest of the network once that nonce is known. This is the basic principle behind PoW block timing.

    So, in effect, the nonce of some future block can be an acceptable pseudo random source for things like lotteries and gambling.
  • vdicevdice Member Posts: 2
    It is really difficult to get around involving an oracle at some point. oraclize is the best service we know of in the space, at this time. They're a pleasure to work with.

    In terms of interacting with the real world, at vDice we use 2x 3rd parties; Oraclize and

    But we have to generate randomness too. In your example this does not seem necessary.

    I may be biased, but I think we're doing the best job of implementing such a system at the moment, in a production environment. Some come close (other gambling games). But they're still on blockchain for their randomness.

    Feel free to check out our code for ideas. Or talk to us if you're serious about building such a game. We'd love to help.

Sign In or Register to comment.