Stanford CS251: Cryptocurrencies, blockchains, and smart contracts

Lectures Introduction Creating a Digital currency Bitcoin Overview Bitcoin Blockchain Bitcoin Mining Bitcoin Miner interactions and Game Theory Cryptocurrencies: Community, Economics, and Politics Alternative Consensus Wallet & Anonymity Anonymity on Blockchain Altcoins Ethereum Ethereum Ethereum Governance Bitcoin Side-chains (guest talk) Bitcoin Payment channel Guest talk on Legal by Ben Lawsky - does not seem worthy of transcribing Advanced Topics - Quantum Computing, Threshold Signatures, and storing secret state on public chains Advanced Topics - Smart property, publicly verifiable randomness, and prediction markets Guest talk by Adam Ludwin (CEO, chain....

Stanford CS251: Lecture 19

Lecture 19: Advanced Topics Topic 1: Smart Property Manage ownership of some property like stocks on the blockchain. Colored coins allow arbitrary properties on Smart Contract. Similar to Namecoin, there cannot be a light node/SPV for this. Another example is rental, car’s ownership goes from Alice to Carol in a 2-of-2 transaction from Alice to Carol and locked transaction to return the car’s possession after a fixed time. One still has to trust the car’s hardware and manufacturer....

Stanford CS251: Lecture 18

Lecture 18: Advanced Topics Three topics are chosen by students (another three for the next lecture) Topic 1: Quantum Computing An electron has two states top and bottom spins, represented as |1> and |0>. An electron is in a superposition of those two states with wave functions Ψ0 and Ψ1, so, the combined wave function is Ψ = Ψ0. |0> + Ψ1. |1> with |Ψ0|2 + Ψ12 = 1. |Ψ0|2 is the proability of seeing state |0> and Ψ12 is the probability of seeing state |1> respectively....

Stanford CS251: Lecture 16

Lecture 16: Bitcoin payment channel Visa ~ 10, 000 transactions per second Bitcoin ~ 3 transactions per second => 60 GB of blockchain data per year Waiting for 6 blocks ~ 60 mins is a huge wait for Bitcoin. Therefore, tipping or having an ongoing channel of payments on the blockchain is hard. Payment channels help with that. Funding channel - unidirectional payment channels Alice is planning to pay Bob....

Stanford CS251: Lecture 15

Lecture 15: Bitcoin guest talk (Greg Maxwell & Pieter Wuille - Blockstream) on sidechains Forking does not advance Bitcoin since forks suffer from economic acceptance. UTXO model UTXO model is less intuitive, more private, and smaller persistent storage footprint. UTXO implicitly prevents a replay attack. Ethereum carries nonce around even for empty accounts to prevent replay attacks. Validation not computation Bitcoin addresses are a 160-bit hash of the public key since the public key is unusually long (512-bit)....

Stanford CS251: Lecture 13

Lecture 13 - Ethereum Code: ROM (Read-only memory) calldata: arguments There are two types of instructions: Arithmetic including SHA3 and sys operations like create [contract], call [contract], and delegate call, etc. CALL - called code is executed in the context of called contract CALLLOAD - called code is executed in the context of the current contract, msg.sender is calling contract DELEGATECALL - similar to callload except for msg.sender remains unchanged...

Stanford CS251: Lecture 14

Lecture 14: Ethereum Governance When contracts call other contracts, there are four major parameters, g - gas, v - value, in - in size of inputs, out - out size of outputs. The gas must come from the initial transaction, the ongoing calls to different cannot refuel the gas. By default, all the gas is passed during the contract call and the value passed is 0. A contract can receive money via contract....

Stanford CS251: Lecture 12

Recap: alt-coins Bitcoin is a replicated state machine, the system moves within S States with I inputs producing O outputs. For Bitcoin, S is the set of UTXOs. For Namecoin, the state consists (name, value). Ethereum’s goal was to implement this functionality in a general way by building a “consensus computer” expressed in a Turing-complete language. Ethereum State: Great arbitrary storage space, arbitrary code (isolated memory space), and account balance. Inputs: (address, input data) Transition: update storage and change account balance...

Stanford CS251: Lecture 11

Lecture 11: Altcoins Three ways to improve Bitcoin Code update - This can update or change the P2P network Soft fork - To introduce a stricter verification for example P2SH Hard fork - transaction improvements and consensus change Altcoin = Any cryptocurrency except Bitcoin Launching an altcoin Sales pitch - new features Value/exchange rate Code Miners - the value of the currency will bring them or go for merge mining (explained below) Genesis block - For bootstrapping the right blockchain, it can be rooted in Bitcoin as well Examples,...

Stanford CS251: Lecture 10

Lecture 10: Anonymity on Blockchain (Coinjoin continued from the previous lecture) Each participant writes an input transaction (input address, change address) on say Pastebin. Over Tor, each participant writes an output address. These two entries and not linkable to each other. Now, each participant signs a CoinJoin transaction only if they like their own input and output entries. Someone sends the final transaction to the miner. DoS attacks on CoinJoin:...