Principles of Blockchains


Prof. Pramod Viswanath, Princeton,

Teaching assistants

Ashwin Hebbar,
Viraj Nadkarni,
Tianle Cai,

Course Material

Lecture Number Date Theme Topic Lecture notes Summary video Full video Course materials HW Due
1 Sep 07 Bitcoin Introduction Notes Video Video Slides  
2 Sep 12 Cryptographic primitives Notes Video Video Slides  
3 Sep 14 Nakamoto consensus Notes Video Video Slides  
4 Sep 19 P2P network Notes Video Slides  
5 Sep 21 Bitcoin system Notes Video Video Slides Part 1
6 Sep 26 Bitcoin safety Notes Video Video Slides  
7 Sep 28 Bitcoin liveness Notes Video Video Slides Part 2
8 Oct 03 Scaling Bitcoin: Layer 1 Scaling Scaling throughput Notes Video Video Slides  
9 Oct 05 Scaling latency Notes Video Video Slides Part 3
10 Oct 10 Sharding Notes Video Video Slides  
11 Oct 12 Proof of stake Notes Video Video Slides Part 4
12 Oct 24 Scaling Bitcoin: Layer 2 Scaling Side Blockchains Notes Video Video Slides  
13 Oct 26 Payment Channels Notes Video Slides Part 5
14 Oct 31 Rollups Video Video Slides  
15 Nov 02 Beyond Bitcoin Streamlet and Hotstuff Notes Video Slides Part 6
16 Nov 07 Algorand Notes Video Slides  
17 Nov 09 Finality gadget: bridge BFT and
longest chain protocols
Notes Video Slides Part 7
18 Nov 14 Bootstrapping blockchains Notes   Slides  
19 Nov 16 Zcash architecture Notes Video Slides Part 8
20 Nov 21 Privacy bridge Notes Video    
21 Nov 28 Fair transaction ordering Slides
22 Nov 30 MEV and PBS architecture Slides
23 Dec 05 Programmability in Blockchains: VM designs

Course Outline

Blockchains are decentralized digital trust engines and are a potential replacement to “digital platforms” that we encounter in today’s world. Digital platform companies occupy 7 of the largest companies in the world based on market capitalization (eg: Apple, Google, Microsoft, Amazon, Alibaba, Tencent). Blockchains came into prominence through Bitcoin, a cryptocurrency, introduced in 2009. In the decade since its inception, blockchain designs have evolved significantly, although the corresponding evolution of applications (beyond cryptocurrencies) have not caught up yet. In this course, we study a full-stack design of blockchains: we view the blockchains as a whole integrated system involving networking, incentives, consensus, application layer support. The course covers the foundations of blockchains, and is divided into 3 parts: in the first part we study the Bitcoin design in detail. Although very secure and remarkably incentive compatible in the real world, Bitcoin has very poor performance in many ways: throughput, latency, energy, compute, storage and communication. In the second part we study the various efforts to scale the performance of Bitcoin in all the different dimensions, while maintaining the incentive compatibility and security of Bitcoin. In the final part, we study aspects of blockchain design that were simply not considered in Bitcoin (e.g., privacy, finality). In the spirit of Nakamoto (who implemented and tested the Bitcoin client before writing the white paper), this course will be implementation-heavy. We will use the Rust programming language for our assignments and projects for the foundation component of the course. By the end of the course, you will implement a Bitcoin client in Rust. 

Course Notes

  • Lecture notes, slides and supplementary reading material will be provided for each lecture.
  • Supplemental reading:
    • Bitcoin and Cryptocurrency Technologies, A. Narayanan, J. Bonneau, E. Felten, A. Miller and S. Goldfeder, Princeton University Press. Henceforth termed as PUP (Princeton university press).
    • Introduction to Cryptocurrencies, a basic online course by Haseeb Qureshi.


The basic technical prerequisites are a background in probability and algorithms. Decent amount of software programming background is essential. 

Bitcoin Client Project

We are going to build a simplified Bitcoin client with full node functionality as part of the course assessment. The client is built over the course of 8 programming assignments in the Rust programming language. Each student will work on their own on the sequence machine problems. At the end of the project, students will create a private test net amongst themselves and have fun changing various parameters of the client.

Part 1: In this introductory assignment, you will get to learn the basics of Rust programming language and useful libraries. The assignment will be accessed and completed on Github, available here: [ Part 1 ]. Due date: 3:00PM, September 21, 2022.

Part 2: In this assignment, you will get to learn to basic cryptographic primitives (hash functions and signatures) and build fundamental data structures that form the core of blockchains: block chains and Merkle trees. The assignment will be accessed and completed on Github, available here: [ Part 2 ]. Due date: 3:00PM, September 28, 2022.

Part 3: Block and Blockchain structure – Create block and blockchain struct and add some functions related to it. More detailed instructions can be found at [ Part 3 ]. Due date: 3:00PM, October 5, 2022.

Part 4: Mining – Implement a mining module of the bitcoin client. The mining module(miner) will produce blocks by solving the proof-of-work puzzle. More detailed instructions can be found at [ Part 4 ]. Due date: 3:00PM, October 12, 2022.

Part 5: Network – Implement the network module of Bitcoin client. The network module is in charge of communicating with other nodes/clients. It forms the peer-to-peer (p2p) network and uses gossip protocol to exchange data, including blocks and transactions. More detailed instructions can be found at [ Part 5 ]. Due date: 3:00PM, October 26, 2022.

Part 6: Putting together a data blockchain – Combine last 3 week’s work to make a functioning data blockchain. Most of this week’s work will be combining mining, network, and blockchain modules. You will need to add PoW validation and a block buffer to handle orphan blocks. More detailed instructions can be found at [ Part 6 ]. Due date: 3:00PM, November 2, 2022.

Part 7: Transactions – Include transactions in the codebase. Integrate the transaction structure inside the block content, add network functionality to transaction propagation and adding a transaction mempool to be used by the miner to include transaction content in the block being mined. More detailed instructions can be found at [ Part 7 ]. Due date: 3:00PM, November 9, 2022.

Part 8: State transition and validation – This is the last part of midterm project, and you are going to finish the Bitcoin client. You need to maintain a state for the ledger that the blockchain creates and add all the necessary checks related to it. More detailed instructions can be found at [ Part 8 ]. Due date: 3:00PM, November 16, 2022.

Final Exam

[Take-home exam link] : Due date: 11:59pm, December 16, 2022

Instructions :
– Exam is open-book.
– No collaboration allowed (with students, instructors, etc.)