CPSC 3640

Decentralized Payments, Contracts, and Finance for Humans and AI

Announcements

  • CPSC 3640 will be offered in Fall 2026. The course website is now live with the schedule and logistics.

Course Information

Time/location

  • MW, 11:35am-12:50pm
  • TBA

Platforms

Instructor

Prof. Fan Zhang

Prof. Fan Zhang

Office hours: TBD, TBD

Teaching Assistance

TBA

TBA

๐Ÿ“– Course Description

Blockchains provide a platform for humans to coordinate economic activity without relying on centralized intermediaries. Emerging standards such as EIP-8004 aim to extend these capabilities to autonomous agents, enabling AI systems to transact and coordinate through shared protocols. This introductory course explores such decentralized applications, including tokens, exchanges, lending protocols, stablecoins, oracles, decentralized governance, and emerging standards for AI coordination and interoperability. Students will learn system architecture, security intuition, and how to build and debug decentralized applications.

Course Units (click for details)

This course is organized into three units that build progressively from foundational concepts to the frontier where AI and blockchain intersect.

Unit 1 โ€” Foundation covers why decentralized systems are needed by tracing the path from digital money to trusted computers. The unit introduces Bitcoin fundamentals, Bitcoin payment methods, contracts on Bitcoin, and Ethereum’s smart contract platform with programming in Solidity. It concludes with a unified view of blockchains through State Machine Replication, virtual machines, and modular designs.

Unit 2 โ€” DeFi the new fintech front covers the major building blocks of the decentralized finance ecosystem and the opportunities and risks that come with them. Students learn how tokens, stablecoins, decentralized exchanges (DEXes), automated market makers (AMMs), oracles, and lending and borrowing protocols work under the hood, along with opportunities such as auditability and interoperability. The unit then turns to risk: smart contract bugs, Miner/Maximal Extractable Value (MEV), privacy, key management, and performance challenges.

Unit 3 โ€” Crypto for AI <> AI for Crypto explores the two-way relationship between blockchains and AI. In one direction, students examine how decentralized infrastructure can serve autonomous AI agents: payment protocols such as x402, confidential AI using Trusted Execution Environments (TEEs), securing the plumbing of AI, and identity, reputation, and coordination through emerging standards such as EIP-8004. In the other direction, the unit examines how AI systems participate in crypto markets, including trading algorithms and their privacy problems.

Prerequisites

Required: CPSC 201 and 202 (or equivalent), and a basic understanding of computer systems and networks.

Grading

Assessment Weight Details
Class Participation 10% Ongoing throughout the semester; includes in-class discussion and engagement
Homework & Labs 40% ~6 problem sets and hands-on Solidity labs, distributed roughly every 1โ€“2 weeks
Group Presentation 30% Students form a team to investigate a technical or societal topic related to the course and present to the class (~20 minutes), scheduled during the final weeks of the semester
Final Exam 20% In-class final exam on fundamental concepts across all three units

Lecture Schedule

Section I: Foundation: Bitcoin and Ethereum

Lecture 1: Course intro: from digital money to trusted computer

Why digital money needs more than a trusted intermediary: preventing counterfeiting and double spending while addressing privacy, censorship, and distributed consensus.

Lecture 2: Bitcoin Fundamentals

The cryptographic and economic foundations of Bitcoin, including digital signatures, hash functions, and proof of work.

Lecture 3: Payment methods in Bitcoin

How Bitcoin represents spending conditions through common payment constructions such as pay-to-public-key-hash and pay-to-script-hash.

Lecture 4: Contracts on Bitcoin

Building richer protocols on Bitcoin, including payment channels, atomic swaps, fair exchange, and the challenges of post-quantum migration.

Lecture 5: Ethereum and smart contracts

Ethereum's account and state model, gas mechanism, and the fundamentals of writing smart contracts in Solidity.

Section II: DeFi as new fintech front

Lecture 7: Tokens and tokenization

How blockchains represent fungible and non-fungible assets, and how tokenization connects ownership and programmability.

Lecture 8: Privacy-preserving asset transfer

Techniques for private on-chain transfers, from zero-knowledge proofs to systems such as Tornado Cash, Zerocoin, Zerocash, and Zcash.

Lecture 9: Oracles and real world assets

How smart contracts obtain external data, with applications in insurance and prediction markets and risks such as oracle manipulation.

Lecture 10: Bridges and interoperability of DeFi

How assets and messages move across blockchain networks, along with the trust assumptions and security challenges of interoperability.

Lecture 11: Decentralized Exchanges (DEX)

How decentralized exchanges enable on-chain trading, with a focus on automated market makers and liquidity pools.

Lecture 12: Order manipulation and MEV

How transaction ordering creates extractable value, including frontrunning and sandwich attacks, and how mechanisms such as proposer-builder separation respond.

Lecture 13: No class

Class is canceled due to the instructor's NSF service responsibilities.

Lecture 14: Auditability and transparency

How cryptographic proofs and formal verification can make financial systems more transparent and support claims such as proof of liabilities.

October recess, October 20โ€“25

Lecture 15: (Re-)staking

How proof-of-stake security, slashing, and restaking use economic commitments to secure blockchain protocols and additional services.

Lecture 16: Governance and DAO

How decentralized organizations coordinate decisions and allocate voting power, including governance risks such as vote buying.

Lecture 17: Key management

How users and applications securely control blockchain accounts, including newer approaches such as zkLogin.

Lecture 18: DeFi risk: human-factor attacks

How attackers exploit user behavior and interface conventions through techniques such as address poisoning and related social-engineering attacks.

Lecture 19: Infra: Confidential smart contracts

How trusted execution environments and confidential blockchain designs protect smart-contract data and computation.

Lecture 20: Infra: Scalability and modular blockchains

How rollups, interoperability protocols, and data-availability layers divide blockchain responsibilities to improve scale.

Section III: Crypto for AI <> AI for Crypto

Lecture 21: Payment protocols for agents (x402)

How autonomous agents can discover, authorize, and settle payments over the web using emerging protocols such as x402.

This class will be taught remotely.

Lecture 22: No class

Class is canceled while the instructor attends ACM CCS 2026.

November recess, November 20โ€“29

Lecture 23: Identity, reputation & coordination (EIP-8004)

How decentralized identity and reputation can help autonomous agents discover one another, establish trust, and coordinate.

Lecture 24: Securing the plumbing of AI (Props)

How confidential computing, including trusted execution environments, can protect AI infrastructure, data, and computation.

Lecture 25: [Presentation slot]

Student group presentations on selected technical or societal topics related to decentralized systems.

Final exam (in class)

Lecture 26: In-class Final

An in-class assessment covering foundational concepts across the course's three units.