SI 486I Spring 2022 / Labs


This is the archived website of SI 486I from the Spring 2022 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

Lab 12: Project 2 work time

The last major assignment for the class is to create a decentralized application (dApp) with a smart contract. Specifically, you will:

  • Design a new decentralized application
  • Write an Ethereum smart contract in Vyper to implement your dApp
  • Deploy your dApp on our local Ethereum network from lab 10
  • Give a short presentation in the last week of class where you explain what your application does and how it works

As before, you will work in pairs of your own choosing. They don’t have to be the same partners as from project 1, but they can be if you want.

Because everyone should be working on different topics, you are encouraged to help each other as well as to find and use various online resources. The only guidelines are:

  • You need to write your own smart contract code. It’s okay (and very expected!) to need to look things up for various aspects of what you’re writing, but not for the whole thing (or significant chunks).

    For example, if you were creating an savings account dApp, it would be fine to search for resources on how savings accounts work generally (not specific to smart contracts), and for how to hold money, maintain balances, and do other specific tasks in a smart contract. But it would not be okay to search for other smart contract code that implements a savings account.

  • You must document the sources that you substantially rely on. For small coding things, you can just make a comment directly in-line in the code where you used that source. For more general resources, you should keep track of things in a list that will be submitted separately.

Topics

Your topic will be a single decentralized application, or dApp, that you create. For the purposes of this assignment, we will interpret that broadly to mean “anything that can be implemented with a smart contract on a blockchain”. So really, you are writing and deploying a new smart contract that does something interesting.

Everyone needs to choose a different topic. Your instructor will be perusing your descriptions and will let you know if two topics are too similar to each other; if you are unsure, just ask!

Difficulty/complexity level: If you think first of an interesting dApp, and then think second about how to make it work, then you should be okay. If your smart contract doesn’t have at least three or four substantial methods, and some non-trivial state storage with a few hash tables, then it might be too simple to earn an A. Please ask your instructor if you are in doubt!

I want you to be creative and come up with something that is unique and which you are interested in working on. Here are a few ideas that would work:

  • Matching charitable donations. It is common in charitable giving for a wealthy donor or institution to offer to “match” contributions. The way it works is, the donor puts up a bunch of money but doesn’t way what charity it should go to. Then, individuals contribute money to the charity of their choice, and when they do, the donor’s money is given in the same amount to that charity, until the donor money is gone.

    As a dApp, you would need to think about how the donor can ensure people don’t just take the money and send it to their friends — perhaps something like a “whitelist” of acceptable charities would be one way to solve that.

  • Concert VIP tickets. Perhaps a certain band on tour has up to 6 backstage passes for each concert that they want to sell. They want to sell these in an auction, but make it fair: for each concert date, the top 6 bidders should “win” backstage passes. But they should all only have to pay the 6th-highest price.

  • Lottery. Implement a simple gambling game on the blockchain. Players place bets and pay into the pot, and then when the round ends any winner(s) split the winnings, while any unearned winnings are “rolled over” to the next round.

    This will be difficult because getting (pseudo)random numbers on the blockchain is kind of impossible. You could look into ways of doing this via verifiable random functions, or use a trusted “dealer” who submits a random value at the end to close the round.

  • Kickstarter. This is a real website that people use to fund their start-up projects. From their help page:

    Every project creator sets their project’s funding goal and deadline. If people like the project, they can pledge money to make it happen. If the project succeeds in reaching its funding goal, all backers’ credit cards are charged when time expires. Funding on Kickstarter is all-or-nothing. If the project falls short of its funding goal, no one is charged.

Deliverables and Deadlines

By Sunday night May 1 you need to:

  • Add your smart contract code to the shared course git repo
  • Add the address where your smart contract lives on the blockchain to the repo as well
  • Submit the google form specifying how to use your dApp and what resources you used

In class on your presentation day (May 2 or May 4) you need to

  • Give an effective and entertaining 5-8 minute presentation on what your dApp does, how it does it, and why we should care
  • Email your slides to your instructor