0% found this document useful (0 votes)
174 views

Cryptocurrencies and Blockchain Technologies: Dan Boneh Benedikt Bünz Stanford University

This document provides an overview of a CS251 Cryptocurrencies and Blockchain Technologies course at Stanford University for Fall 2021. It includes information about the course website, instructors, videos, discussions, and homework. It then provides an introduction to blockchains and what the excitement is about, including basic applications like digital currencies, decentralized applications (DApps), and new programming models. It discusses assets managed by DApps, transaction volumes, and central bank digital currencies. It also covers what a blockchain is, consensus layers, how blocks are added to chains, challenges with consensus, blockchain computers, DApp architecture, and the course organization.

Uploaded by

Rash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
174 views

Cryptocurrencies and Blockchain Technologies: Dan Boneh Benedikt Bünz Stanford University

This document provides an overview of a CS251 Cryptocurrencies and Blockchain Technologies course at Stanford University for Fall 2021. It includes information about the course website, instructors, videos, discussions, and homework. It then provides an introduction to blockchains and what the excitement is about, including basic applications like digital currencies, decentralized applications (DApps), and new programming models. It discusses assets managed by DApps, transaction volumes, and central bank digital currencies. It also covers what a blockchain is, consensus layers, how blocks are added to chains, challenges with consensus, blockchain computers, DApp architecture, and the course organization.

Uploaded by

Rash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41

CS251 Fall 2021

(https://cs251.stanford.edu)

Cryptocurrencies and
Blockchain Technologies
Dan Boneh Benedikt Bünz
Stanford University

[videos on canvas, discussions on edstem, homework on gradescope]


What is a blockchain?

Abstract answer: a blockchain provides


• coordination between many parties,
• when there is no single trusted party

if trusted party exists ⇒ no need for a blockchain

[financial systems: often no trusted party]


What is all the excitement about?

(1) Basic application: a digital currency (stored value)


• Current largest: Bitcoin (2009), Ethereum (2015)
• Global: accessible to anyone with an Internet connection
What is all the excitement about?

(2) Beyond stored value: decentralized applications (DAPPs)


• DeFi: financial instruments managed by public programs
• examples: stablecoins, lending, exchanges, ….
• Asset management (NFTs): art, game assets, domain names.
• Decentralized organizations (DAOs): (decentralized governance)
• DAOs for investment, for donations, for collecting art, etc.

(3) New programming model: writing decentralized programs


Assets managed by DAPPs

Sep. 2021
Transaction volume

24h volume Sep. 2021


Central Bank Digital Currency (CBDC)

e ta il CB DC
r k i n g o n r
c ti vel y w o 9]
ra l b a nks a vey Jan . 2 0 1
30 c e nt [B I S s u r
What is a blockchain?

user facing tools (cloud servers)

applications (DAPPs, smart contracts)

compute layer (blockchain computer)

consensus layer
Consensus layer (informal)

achieved by replication
A public append-only data structure:
• Persistence: once added, data can never be removed*
• Safety: all honest participants have the same data**
• Liveness: honest participants can add new transactions
• Open(?): anyone can add data (no authentication)

consensus layer
How are blocks added to chain?
blockchain

I am the
signed leader
2 ETH
skA verify
verify block
block
skB

skC
How are blocks added to chain?
blockchain

2 ETH I am the
leader
skA

skB

2 ETH
skC
Why is consensus a hard problem?
Tx1, Tx2, Tx3, Tx4 Tx1, Tx2, Tx3, Tx4

Tx1 Tx3

Tx2 Tx4

Tx1, Tx2, Tx3, Tx4 Tx1, Tx2, Tx3, Tx4


Why is consensus a hard problem?
Tx1, Tx2, Tx3, Tx4 Tx1, Tx2, Tx3, Tx4

Tx1
Problems:
∆ Tx3
• Network delay
• Network partition
Tx2 Tx4

Tx1, Tx2, Tx3, Tx4 Tx1, Tx2, Tx3, Tx4


Why is consensus a hard problem?
Tx1, Tx2, Tx4

Tx1
Problems:
• crash
• malice
Tx2 Tx4

Tx1, Tx2, Tx4 Tx1, Tx2, Tx4


The blockchain computer
DAPP logic is encoded in a program that runs on blockchain
• Rules are enforced by a public program (public source code)
⇒ transparency: no single trusted 3rd party

• The DAPP program is executed by parties who create new blocks


⇒ public verifiability: everyone can verify state transitions

compute layer
consensus layer
Decentralized applications (DAPPS)

Run on
blockchain
computer

applications (DAPPs, smart contracts)


blockchain computer

consensus layer
Common DAPP architecture
Top layer: user facing servers

end user

DAPP DAPP DAPP


on-chain
state blockchain computer
consensus layer
[source: the Block Genesis]
lots of experiments …
locked
This course

Cryptography Distributed systems


Economics
Course organization
1. The starting point: Bitcoin mechanics
2. Consensus protocols
3. Ethereum and decentralized applications
4. Economics of decentralized applications
5. Scaling the blockchain: 10K Tx/sec
6. Private transactions on a public blockchain
(SNARKs and zero knowledge proofs)
7. Interoperability among chains: bridges and wrapped coins
Course organization

cs251.stanford.edu

• Three homework problems, four projects, final exam(?)


• Optional weekly sections on Friday

Please tell us how we can improve …


Don’t wait until the end of the quarter
Let’s get started …
Cryptography Background

(1) cryptographic hash functions

An efficiently computable function


where
32 bytes
256
megabytes hash value 𝑇 = {0,1 }
Collision resistance

Def: a collision for is pair s.t.

implies that many collisions exist

Def: a function is collision resistant if it is “hard” to find even a


single collision for (we say is a CRHF)

Example: SHA256: { : len()<264 bytes} ⇾ {0,1}256


details in CS255
Application: committing to data on a
blockchain
Alice has a large file . She posts (32 bytes)
Bob reads . Later he learns s.t.

is a CRHF ⇒ Bob is convinced that


(otherwise, and are a collision for )

We say that is a binding commitment to

(note: not hiding, may leak information about )


Committing to a list (of transactions)

Alice has 32 bytes

Goal:
- Alice posts a short binding commitment to ,
- Bob reads . Given can check that
Bob runs ⇾ accept/reject

security: adv. cannot find s.t. and


where
Merkle tree (Merkle 1989)

commitment h Goal:
• commit to list S of size n
• Later prove

Merkle tree
commitment

𝑚1 𝑚2 𝑚3 𝑚4 𝑚5 𝑚6 𝑚7 𝑚8
list of values S
Merkle tree (Merkle 1989)

commitment h Goal:
• commit to list S of size n
𝑦5 H 𝑦6 • Later prove

𝑦1 H 𝑦 𝑦3 H 𝑦 4
2 To prove ,
H H H H proof
𝑚1 𝑚2 𝑚3 𝑚4 𝑚5 𝑚6 𝑚7 𝑚8 length of proof:

list of values S
Merkle tree (Merkle 1989)

commitment h To prove ,
proof
𝑦5 H 𝑦6
𝑦1 H 𝑦 𝑦3 H 𝑦 4 Bob does:
2

H H H H

𝑚1 𝑚2 𝑚3 𝑚4 𝑚5 𝑚6 𝑚7 𝑚8
accept if
list of values S
Merkle tree (Merkle 1989)

Thm: H CRHF ⇒ adv. cannot find s.t. and


where

(to prove, prove the contra-positive)

How is this useful? Super useful. Example


• When writing a block of transactions to the blockchain,
suffices to write commit() to chain. Keep chain small.
• Later, can prove contents of every Tx.
Abstract block chain
blockchain
block header block header block header
Merkle other Merkle other Merkle other
⊥ hash hash
root data root data root data

Merkle Merkle Merkle


tree tree tree

Tx1 Tx2 … Txn Tx1 Tx2 … Txn Tx1 Tx2 … Txn

Merkle proofs are used to prove that a Tx is “on the block chain”
Another application: proof of work

Goal: computational problem that


• takes time to solve, but (D is called the difficulty)
• solution takes time O(1) to verify

How? e.g.

• puzzle: input , output s.t.

• verify(): accept if
Another application: proof of work

Thm: if H is a “random function” then the best algorithm


requires evaluations of in expectation.

Note: this is a parallel algorithm


⇒ the more machines I have, the faster I solve the puzzle.

Proof of work is used in some consensus protocols (e.g., Bitcoin)


Bitcoin uses
Cryptography background:
Digital Signatures
How to authorize a transaction
Signatures
Physical signatures: bind transaction to author

Bob agrees to pay Alice 1$

Bob agrees to pay Alice 100$

Problem in the digital world:


anyone can copy Bob’s signature from one doc to another
Digital signatures
Solution: make signature depend on document
Signer
Verifier
‘accept’
Bob agrees to pay Alice 1$
verifier or
‘reject’
signature

signing
secret signing
algorithm public verification
key (sk) key (pk)
Digital signatures: syntax
Def: a signature scheme is a triple of algorithms:
• Gen(): outputs a key pair (pk, sk)
• Sign(sk, msg) outputs sig. σ
• Verify(pk, msg, σ) outputs ‘accept’ or ‘reject’

Secure signatures: (informal)


Adversary who sees signatures on many messages of his choice,
cannot forge a signature on a new message.
Families of signature schemes
1. RSA signatures (old … not used in blockchains):
• long sigs and public keys (≥256 bytes), fast to verify

2. Discrete-log signatures: Schnorr and ECDSA (Bitcoin, Ethereum)


• short sigs (48 or 64 bytes) and public key (32 bytes)

3. BLS signatures: 48 bytes, aggregatable, easy threshold


(Ethereum 2.0, Chia, Dfinity)

4. Post-quantum signatures: long (≥768 bytes)


details in CS255
Signatures on the blockchain
Signatures are used everywhere: verify
• ensure Tx authorization, Tx
• governance votes, verify
verify Tx
• consensus protocol votes. Tx

sk1 data signatures

sk2 data signatures


END OF LECTURE

Next lecture: the Bitcoin blockchain

You might also like