Instructors

Dan Boneh Arthur Gervais Andrew Miller Christine Parlour Dawn Song
Dan Boneh Arthur Gervais Andrew Miller Christine Parlour Dawn Song
Stanford UCL UIUC UC Berkeley UC Berkeley

Volunteer Teaching Assistant

Kaihua Qin, Liyi Zhou

Meetings

Lectures: Online, Pre-Recorded (Asynchronous)

Guest Speaker AMAs: Tuesday, 10:00 AM - 11:59 AM
Online (Zoom) or 438 Soda Hall

Syllabus (subject to change)

Course Work

Quizzes

All quizzes are released in parallel with (or shortly after) the corresponding lecture and will be due at midnight the following Wednesday. Please remember to complete the quiz each week. Although it’s graded on completion, we encourage you to do your best. The questions are all multiple-choice and there are usually at most 5 per quiz.

Lab

Labs 1 and 2 have been released and are available on GitHub here: GitHub Repository. If you clone the GitHub repository, please ensure your code remains private. You are expected to complete these labs on an individual basis (not in groups), but you may have conceptual discussions with your peers as long as no code is shared. Students in the Haas version of the course are encouraged, but not required, to attempt the labs.

In these exercises, you are expected to implement a smart contract that performs a flash loan and liquidation. For more details, please read through the README.md file in the GitHub repository. Lab 1 serves as a checkpoint on the way to the full contract implementation, ensuring that students have their development environment set up by early next week. The majority of your lab grade will come from your performance in Lab 2.

In addition to the labs, this course will cover the handling and operation of cryptocurrency swaps, specifically focusing on platforms such as AAVE, CURVE, and UNISWAP. You will learn how to recognize the strengths and unique features of each platform, enabling you to make informed decisions when swapping cryptocurrencies. The curriculum is designed to guide students with limited knowledge of cryptocurrencies through the essential aspects of liquidity pools, yield farming, and leveraging these protocols for optimal financial strategies.

By March 14th, you should submit a single LiquidationOperator.sol file that successfully performs a Uniswap flash loan (“Lab 1”). Your score out of 5 possible points will be determined as follows:

Then, by March 21st, complete and submit the full implementation (“Lab 2”). Your submission should be a single LiquidationOperator.sol file, and your score out of 15 possible points will be based on the actual profit you earn in the test case:

Assignment Timeline

Assignment Released Deadline
Group formation 3/01/2025 3/15/2025
Project proposal 3/16/2025 4/05/2025
Assignment 1 (Link) 4/06/2025 4/12/2025
Assignment 2 (Link) 4/13/2025 4/19/2025 / 5/03/2025
Project milestone 4/20/2025 4/26/2025
Lab 1 (Github) (Submission) 5/01/2025 5/07/2025 / 5/14/2025
Lab 2 (Github) (Submission) 5/08/2025 5/21/2025
Project presentation 5/22/2025 6/05/2025
Project final report 6/06/2025 6/12/2025

Course Completion NFTs

We will distribute NFTs for completion of the course. Below are the rules for different tiers (subject to change):

Legendary Tier: Students must:

Ninja Tier: Students must:

Course Description

The purpose of this class is to bring together students and interdisciplinary experts in Computer Science and Finance to discuss the emerging area of Decentralized Finance (or DeFi). DeFi has experienced unprecedented growth, with hundreds of projects and a countless stream of financial, distributed systems, and blockchain innovations. The total value locked (TVL) in decentralized finance — a measure of the total value of assets committed to the DeFi ecosystem — has reached over $80 billion. When compared to the traditional centralized finance (CeFi), DeFi offers products and services serving similar financial goals, but critically innovates with novel capabilities such as instantaneous multi-billion USD flash loans. By utilizing blockchain and smart contract technologies, DeFi aims to provide a new platform for programmable, automated financial services that remove the reliance on central trust and intermediaries.

Our goal is to provide a framework to understand this new area of financial services. For each finance function, we will consider 1) the current intermediated structure, and then 2) the DeFi version (actual or proposed) that fulfills the function. Is either one of these optimal? We will evaluate both through the lens of CS and finance. Is the application computable (efficiency, decidable), programmable (automatic)? Is the application welfare-enhancing and stable (not a source of systemic risk)? How do the new and old systems interact? We aim for students to be able to critically evaluate whether a new DeFi protocol is novel and practical. We further will capture the security dangers in DeFi, as well as their impact on the underlying consensus security. Lastly, we hope to give insight into how to program and structure secure and incentive-compatible DeFi applications.

Through exposure to cutting-edge research as well as remaining open challenges, we hope for our students to quickly integrate into academic as well as industrial projects related to DeFi. Summarizing, we will cover a broad spectrum of topics, including:

  1. To link blockchains with financial information from the real-world, we will provide a deep-dive into oracles. We will discuss decentralized reputation, identities and proof of properties. Because most DeFi is transparently readable, including transaction amounts, fees, dates/times, etc, privacy plays an increasingly important role in DeFi. We will cover various privacy technologies including zero-knowledge proofs and their applications in DeFi. We will also discuss various attempts at how to enforce data ownership, data monetization and valuation as well as controlled use and misuse of data.

  2. A digital economy would not thrive without strong security. We will outline the many past security attacks, introspect a few of them in closer detail and provide recommendations on how to strengthen DeFi security. We will discuss the systemic risks stemming from Miner Extractable Value (MEV) and how MEV can be minimized by design. Decentralized governance provides power to a pseudonymous collective, and we will explore how governance works, and how it may be attacked.