Trinity’s Dr Hitesh Tewari proposes a decentralised application for a People’s Lottery powered by blockchain and smart contracts.
Bitcoin has fundamentally changed the way we think about achieving consensus in untrusted networks. The bitcoin blockchain has replaced the centrally controlled ledger with a decentralised public ledger in which each full participating node (AKA a miner) verifies all of the transactions it receives prior to attempting to lock them into the blockchain. A blockchain is, therefore, an append-only, immutable record of all valid transactions on the network.
Another concept that has been gaining attention over the past few years is the idea of a smart contract. The phrase was coined in the early ’90s by computer scientist Nick Szabo and refers to a piece of computer code that executes a predefined set of commands comprising a contract between two or more parties.
Smart contracts have come into their own with the advent of distributed ledger technology (DLT). DLT allows one to securely lock the code into the blockchain, thereby preventing it from ever being changed. One must, however, ensure that the code that is deployed in the first instance on the blockchain exhibits the desired functionality. Otherwise, hackers can mount attacks on the contract to fraudulently obtain funds etc.
‘Our People’s Lottery has a unique take on how the lottery is played and how the prize money is distributed’
To me, the blockchain combined with smart contracts technology seems like an ideal platform to operate an online ‘People’s Lottery’ that can be easily played using one’s mobile phone.
A lottery can distribute the prize money to its players in many different ways. National lotteries such as the Irish Lotto or the pan-European EuroMillions lottery tend to have large jackpots and a number of smaller prizes in order to attract lots of punters. Such lotteries also have very large combinatorial search spaces, which leads to the jackpot being rolled over multiple times prior to it being won by one or more players.
Our version of the People’s Lottery is an example of what is known as a decentralised application, or DApp. A DApp is akin to a perpetual motion machine that keeps on running forever, without any intervention or middlemen once it has been released onto the blockchain.
How would it work?
Our blockchain-backed People’s Lottery has a unique take on how the lottery is played and how the prize money is distributed. The winning numbers for each game are linked to an actual lottery draw (such as the EuroMillions, Powerball etc) so that there is full transparency and third-party oversight from the punters’ point of view.
Each player opens an account into which they deposit funds and is charged a small fee for managing their account by the miners in the system. A user then commits to playing one or more lines on their chosen lottery.
The size of the jackpot grows as players commit to playing lines for a particular game and it is advertised to the platform subscribers periodically.
A commitment is created on the blockchain for the lines played by a user by executing a generic smart contract. It takes, as inputs, a game ID that uniquely identifies a particular draw in a specific lottery, as well as the user ID and the numbers to be played.
When the smart contract is executed with the above parameters, funds from the user’s account are debited and transferred to an escrow account. In our utopian version of the lottery, a punter’s account is only charged if one or more players are able to match all of the numbers that are drawn. If that is not the case (as can happen multiple times due to the large search space) then no one loses their stake and the funds are returned to the user accounts. A player can then try their luck again on another draw for the same lottery or another lottery game.
Many other variations on how the jackpot can be won are possible (eg match a certain number of the first numbers drawn) so that the jackpot is won more frequently by players.
Dr Hitesh Tewari is an assistant professor in the School of Computer Science and Statistics at Trinity College Dublin. His main research interests are in the areas of network security and applied cryptography. For the past few years he has been actively researching the area of distributed ledger technologies.