Challenge Task 2019

This semester's Challenge Task (CT) is to implement a Decentralized Application (DApp) deployed on the Ethereum blockchain. The application must implement a lottery system that communicates with a random number generator oracle, all implemented using Smart Contracts (SC).

Lottery systems exist since past the Medieval ages. Nowadays, a lottery game can pay out enormous amounts of money, such as USD 1.586 billion (before tax) in the US Powerball [1] and R$ 244 million in the Brazilian Mega-Sena [2]. In such systems, a user buys a ticket with random numbers of its own choice. This ticket remains in possession of the user; once the betting period ends, the lottery managers draw a fixed number of winning numbers. If the user picked the winning numbers he/she can claim the prize. In the event that nobody wins, the prize amount is accumulated for the next draw.

Lottery systems are further explained at https://en.wikipedia.or/wiki/Lottery and https://entertainment.howstuffworks.com/lottery.htm

[1] Powerball, Wikipedia. Available at https://en.wikipedia.org/wiki/Powerball
[2] Mega-Sena, Wikipedia. Available at https://en.wikipedia.org/wiki/Mega-Sena

CT Formal Description (PDF, 158 KB)

Requirements

Each CT group is free to decide on the design of the Lottery, for example, how to store the tickets and users, how to check the winner, how the Lottery system will work, how the random numbers are generated, and how the interaction with the system will be performed. However, for each CT group the following key requirements are to be met:

  1. The fully functional Lottery system (text or graphics based) must run entirely within Smart Contracts (SC) and communicate with an Oracle SC.
  2. The random number generator oracle must run on a separate SC. The generation of numbers can be performed either on the blockchain or externally.
  3. The SC must automatically pay the prize to the winner, divide the prize in case of multiple winners, or accumulate the prize for the next lottery in case of no winners.
  4. Self-contained report documenting the SC and its operation.

Further suggestions include:

  • The solution may use existing libraries and code, but those must be allowed to be published under APL or another comparable open software license.
  • The final report shall document the application and its operation, mainly with all the details needed understand the solution to be shown at the presentation and demo time slow. The report should contain approximately 4 pages.

Assumptions

The following facts may be assumed:

  • The Smart Contract can be deployed in a private testnet or in the Ropsten testnet.

  • You can use just one node (Geth client) in the blockchain with multiple addresses.
  • An address can buy more than one ticket.
  • Note: Further assumptions, which are not restricting these assumptions above, can be made according to each group's approach.

Libraries and Tools

The items below represent supporting libraries, tools, or references that are recommended to be taken into consideration.

Organization

  • The groups shall be balanced. Every group shall have one development expert. During the challenge task, the group shall meet every week during exercise hours to work on the task and discuss the next steps.
  • The groups shall utilize their homework times to work on the CT, besides the exercise time slots assigned on Thursday.
  • The groups shall determine and set-up an internal project plan with the overall milestones timings provided here.
  • Distribute the workload so that each group member gets a fair load of work (P2P load balancing, no free riding!) and make sure activities can run in parallel (non-blocking).
  • You can use your own laptop and/or the computers in room BIN 1.D.12.
  • Do not miss the opportunity of discussing details with your group supervisor, he might give you good hints.

Groups and Support

During the challenge task each group will be able to ask questions and get support from their supervisors:

# Group Name Participants Supervisor
1 Babbage

Alex Scheitlin, Nik Zaugg, Simon Bachmann, Emirald Mateli

ES/CK
2 Lovelace

Danijel Dordevic, Claude Muller, Lucas Thorbecke, Ratanak Hy

ES/CK
3 Shannon

Dominik Bünzli, Luc Boillat, Noah Berni, Jan von der Assen

ES/CK
4 Finney Lukas Yu, Simon Widmer, Daniel Klaus, Badrie Persaud ES/CK
5 Ether

Timo Surbeck, Fabio Maddaloni, Joachim Baumann, Jonathan Stahl

ES/CK
6 Ada Fan Feng, Yuang Cheng, Roger Staubli, Sven Stoll ES/CK
7 Nano Daniel Gächter, Peter Giger, Silas Weber, Alphonse Mariyagnanaseelan ES/CK
8 Einstein Ile Cepilov, Erion Sula, Tim Strasser, Elfat Esati, Ledri Thaqi ES/CK

Presentation and Evaluation

Challenge task presentations and demonstrations will take place on Tuesday 21.05.2019 from 12:15 to 13:45 and Thursday 23.05.2019 from 14:00 to 15:45 hours. On these dates, the groups will present and demonstrate their results, which will be evaluated by a jury. Presentations and demos on these two dates will take place in room BIN 2.A.10.

  • Each group will have ~20 minutes for presenting their design and to demonstrate the working application (roughly 5 min presentation and 15 min demo). The presentation shall include slides. For the demonstration, you must run at least three games showing the different outcomes (1 Winner, n Winners, No Winner) and the balance of the accounts (users and SC) being updated after the lottery finishes. Most of the demonstration, though, will be done using the machine connected to the projector(s), so all people in the class room can see what is going on. Ideally, it is the same machine that will run the slide presentation.
  • Make sure that everything will work for your demo! Test everything beforehand with given conditions, especially the blockchain/mining. If a group fails to present within its time window, it will be disqualified.
  • Remember that the audience will not only be interested in seeing whether or not your Smart Contract works, but more specifically how the designed mechanisms for a winner verification, the random number generation, the ticket storage, and the betting system work behind the scenes.
  • After the demonstration, each group will be evaluated by the jury. The jury is composed of lecturers and assistants, and each member will cast one vote per group. The following criteria will be taken into consideration: software design and implementation (fulfilment of requirements, overall design, and usability), team work, presentation and demonstration of the solution. The results of the votes will be collected and disclosed after the last presentation. The winning group will receive a  prize and the "BCOLN Challenge Champion 2019" award.
  • Each group shall hand-in by e-mail (p2p@lists.ifi.uzh.ch) the report and source-code of the Smart Contracts until 22.05.2019 - 23:58

CT Grading Impact

The CT grade will impact in the final written exam grade in the following manner:

  • All the four CT requirements met (0 missing requirements):
    • No overall grade reduction
  • Three CT requirements met (1 missing requirements):
    • 0.5 point grade reduction in the final written exam
  • Two requirements met (2 missing requirements):
    • 1.0 point grade reduction in the final written exam
  • Only one requirement met (3 missing requirements):
    • 1.5 point grade reduction in the final written exam
  • No requirement met (4 missing requirements):
    • 2.0 point grade reduction in the final written exam
  • If grade equals or below 4.0:
    • No grade reduction
Grading Table Example

Result

Fulfilment of the Requirements

Requirement / Group

1 - Babbage

2 - Lovelace

3 - Shannon

4 - Finney

5 - Ether

6 - Ada

7 - Nano

8 - Einstein

RQ 1

RQ 2

RQ 3

RQ 4

= Fulfilled = Not Fulfilled

🏆 Winner CSG-award: TBD

Reports and Source Code

The report and source code of each group can be found in this Link

Source code is licensed under open source license. In case of questions, please contact the respective supervisor.