Skip to content
alimhn edited this page Dec 6, 2018 · 1 revision

homework-1-fall-2018

Authors:

  • Ali Mehran, Muhsin Ucarkus, Ramazan Arslan (Bogazici University/ Computer Engineering Department)

Introduction:

  • Modern cryptocurrency systems like Ethereum allow complex financial transactions happen through scripts called smart contracts. They are full-fledged programs run on blockchains. Smart contract programming languages like Solidity are turing-complete simply means they allow you to do much more than systems like bitcoin that uses a scripting language ,"Script", which is simple, stack-based, and processed from left to right; it is intentionally not Turing-complete with no loops for security reasons. Because of these features of smart contracts they have found their applications through different areas and they allow you to do more than just transferring money over network.

  • Some applications of smart contracts :

    • Media: email, social media, advertisement
    • Education: certification, artificial intelligence
    • Finance: smart shopping, international trade
    • Logestic: cargo tracking, digital identity
    • Entertainment: game, lottery

Objective of the project:

What is done in this project:

  • In this project we craeted smart contract in both:
    • eBloc Network
    • Ropspen Test Network
  • We will provide user interface in order to serve these data without running a node and not conflicting with network properties by using Metamask accounts in Ropspen network
    • Any person who has Metamask account can use our coming website to see what is in our smart conract
    • Website : "will be uploaded-under developement"

In our user interface you can do:

  • "This part will be implemented in second part of the project later"

Our Smart Contract:

Functions:

Function Name Parameters Description
hashGen (uint256 randomNumber) returns a byte32 which is sha256 output for concatenation of random value generated locally by participant with his address. We call this combination participant's commitment. Example: sha256(randomNumber,address) .
purchase (uint256 ticketNumber) returns nothing. It's a payable function which checks boundary conditions like submission and reveal time intervals, and the value sent by participant for buying ticket.This function also stores participant's personal information like ticket number and commitment.
result () returns nothing. In this function we extract lucky tickets among all, we check if we have enough money gathered in contract to pay all the prizes, and donate the remaning money to a charity address.
reveal (uint256 randomNumber) returns nothing. In reveal stage of lottery it does some checks, it verifies participant's commitment and stores his revealed random number in our database.
withdrawMoney (uint256 ticket) returns nothing. In this function we let participants to withdraw their prizes. In case of lottery failure, we let them to withdraw their refunded ticket prices.