Bitcoin Engineering (CS251P)

Note: we may be offering a MOOC version later this year. Sign up here if interested.

Stanford's new lab course on building Bitcoin-enabled applications. Learn how to rewire internet services on the basis of Bitcoin. Prior background in Python within a Unix environment is recommended, but no previous Bitcoin knowledge is necessary.

Stanford CS251P - Bitcoin and Cryptocurrencies Lab - 1 unit -
                    Winter 2016


Winter 2016
01/04/2016 - 03/11/2016
Stanford CS251P - Bitcoin and Cryptocurrencies Lab - Classroom -
                    Thornton 110: M 4:30-5:20
                    Thornton 208: Th 4:30-5:20


Thornton 110 (Lab): Mondays 4:30-5:20pm
Thornton 208-211 (Office Hours): Thursdays 4:30-5:20pm


Week Topic Summary
Device Setup Setup (from Lab 1), Remote SSH, and 'Genius Bar' Appointments If you need it, get help setting up your device on the Stanford Network
1/4 Logistics, Bitcoin: An Overview, Introduction to Bitcoin, Self Test 1 Learn the basics of Bitcoin in an applied setting
1/11 Introduction to Bitcoin Computing, Self Test 2 Learn how to work with Bitcoin micropayments and use them for simple grid computing
1/18 Hack Week 1 (Martin Luther King Day) Open week to hack and build on demos from previous weeks
1/25 Bitcoin Instagram
Review: Python, Flask and Python Decorators, Zerotier, Github
Forms: Github Access, Self Test 3
User-monetizable data: build a stock photo store
2/1 Bitcoin Twitter User-monetizable actions: create a social endorsement service
2/8 Bitcoin WordPress User-monetizable content: accept micropayments in lieu of AdSense
2/15 Hack Week 2 (President's Day) Open week to hack and build on demos from previous weeks
2/22 Bitcoin Linux, Self Test 4 User-monetizable command line: write fine-grained SAAS commands which are pay-by-use
2/29 Bitcoin Google, Feedback and Final Hackathon Ad-free monetization: Create a simple search engine that accepts micropayments in lieu of displaying ads
3/7 Bitcoin Dropbox Fine-grained monetization: charge clients per read/write performed on a remote machine
3/7 Final Hackathon: starts after class at 5:30pm in Thornton 110.
See also: How to install the free client, How to set up a Digital Ocean VM, and Final Hackathon: Idea Signup.
Code your own simple bitcoin-payable command line application
3/14 Review and recap Open week to study for your other finals and review demos from previous weeks

About the Course

The first two weeks of the course will provide a fast-paced introduction to Bitcoin and Bitcoin-enabled computing.

In subsequent weeks, you will build Bitcoin-powered versions of several popular Internet services, previewing a future where services are paid for not by ads or monthly fees but by per-use micropayments. There will be two weeks of open time for you to build interesting Bitcoin projects (the weeks of 1/18 and 2/15). In other weeks, we will provide you with stub code illustrating the basic mechanics of a Bitcoin-powered Internet service. You, as an individual or as part of a small group, will have a week to get the stub code running, add your own improvements, and test it with your peers in an online marketplace.

Grading will be based entirely on class participation. There is no final examination. The best student projects each week will be written up in Bitcoin Magazine.

Course Summary

Familiarity with basic programming at the level of Stanford's CS106B is required, particularly in Python. Some exposure to HTML, CSS, and Javascript will also be helpful. Students who have previously taken the Autumn 2015 versions of CS251 and CS251P will have more context, but this course is primarily new material.

  • Introduction to Bitcoin. Introduction to basic Bitcoin concepts such as transactions, digital signatures, the blockchain, and mining.

  • Introduction to Bitcoin Computing. Introduction to Bitcoin micropayments. Learn how to transparently add micropayments to any web service using payment gateways that implement the HTTP 402 error code. Gain experience by running and then modifying several demo apps.

  • Hack Week 1. A free week for your creativity. Extend any of the micropayments demos that you've worked with over the previous week to add new functionality, or build a new one entirely.

  • Bitcoin Instagram. Develop an app that allows you to set a price on your Instagram photos and build a machine-payable stock photo search engine. Project: after getting this to work, experiment with monetizing your user-generated content on other services.

  • Bitcoin Twitter. Develop an app that allows you to accept micropayments for making retweets. Add permissions and filters to ensure you only promote content that’s interesting to your followers. Project: experiment with paid endorsements on your other social networks.

  • Bitcoin WordPress. Develop an app that lets you monetize your blog by charging a small micropayment for each page view. Project: place the same micropayments wrapper around other types of content, like wikis or database result pages.

  • Hack Week 2. A free week for your creativity. Extend any of the code that you've worked with over the previous weeks to add new functionality, or build a new demo entirely.

  • Bitcoin Linux. Develop a command line program that outsources part of its code to the cloud, charging micropayments for each use. Project: build your own simple machine-payable command line app.

  • Bitcoin Google. Develop a simple web search engine funded not by ad views but by micropayments, turning the primary customer into the user rather than the advertiser. Project: extend the search functionality to search other kinds of content.

  • Bitcoin Dropbox. Develop a file server that charges clients per byte with precision even below a single satoshi (below $0.000004 USD) using Bitcoin micropayment channels. Project: build other kinds of grid computing services with fine-grained micropayments.

We think this should be an exciting course, and we encourage you to ask the students from last quarter's course (CS251/CS251P) whether they enjoyed it. We'll see you in class!


Balaji S. Srinivasan - Stanford University

Balaji S. Srinivasan

Balaji S. Srinivasan is the co-founder and CEO of 21. Funded by Andreessen Horowitz, Peter Thiel, Khosla Ventures, Qualcomm, and Cisco, 21 has developed a full stack set of technologies for practical Bitcoin micropayments. Dr. Srinivasan is also a Board Partner at Andreessen Horowitz, a board member of the Coin Center, the co-founder of Teleport, and the co-founder of Counsyl. He was named to the MIT TR35 and the Founders Fund F50, and has been a speaker at Y Combinator's Startup School. His work has won the Wall Street Journal's Innovation Award for Medicine and was named one of Scientific American's Top 10 World Changing Ideas. Prior to becoming an entrepreneur, Dr. Srinivasan taught data mining, statistics, and computational biology in the Department of Statistics at Stanford University. He holds a BS, MS, and PhD in Electrical Engineering and an MS in Chemical Engineering, all from Stanford.

Dan Boneh - Stanford University

Dan Boneh

Dan Boneh is a Professor of Computer Science and Electrical Engineering at Stanford University, and the second Andreessen Horowitz Professor-in-Residence. He is a well-known researcher in the areas of applied cryptography and computer security. He obtained his PhD in Computer Science from Princeton University in 1996 (under the supervision of Richard J. Lipton). Boneh is one of the principal contributors to the development of pairing-based cryptography. Some of his notable achievements include: the design of TCP extensions for transport security (tcpcrypt), the first broadcast encryption system with full collision resistance (PDF), a timing attack on OpenSSL (PDF), an efficient identity-based encryption system (Boneh-Franklin) based on the Weil pairing, cryptanalysis of RSA when the private key is less than N0.292 (PDF), fault-based cryptanalysis of public-key systems (PDF), collision resistant fingerprinting codes for digital data (PDF), and one of the first cryptanalyses using a DNA computer (PDF). In 2000, Boneh co-founded Ingrian Networks with Roy Thiele-Sardiña and Rajeev Chawla. In 2002, Boneh co-founded Voltage Security, which was acquired by Hewlett-Packard in 2015.