8. Crypto
Primitives
Cryptographic Hash
● Hash any binary object to a fixed-size number
● Changing 1 bit completely changes the hash;
Impossible to reverse
● Uniformly distributed; the collision probability of
256-bit hash is 1:2128 (i.e. “never”)
9. Crypto
Primitives
Public-Key Cryptography
● Encrypt with public key
→ must have private key to decrypt
● Encrypt with private key
→ anyone with the public key can decrypt
● Latter method can be used for signing: hash a
message, encrypt the hash with your private
key. Now anyone who has your public key can
verify you are the signer
(this is in fact a more common use of PK than encryption)
10. Crypto
Primitives
State Machine
Replication
● Goal: Create a mechanisms for many
computers to agree on their memory contents
(e.g. ledger)
● Method: Start with a predefined initial state,
then periodically agree on a set of differences
● Blockchain: the initial state is the genesis block,
each set of differences is coded into a block
referencing the previous
12. Consensus
Protocols
Challenges of Consensus
● Must have consensus over
○ Content of blocks
○ Order of blocks
● Agreement on blocks has winners and losers
→ consensus is hard
● Decentralization opens the door to
Byzantine Faults
● Being permissionless opens the door to
Sybil Attacks
13. Consensus
Protocols
Proof-of-Work
● Mitigate sybil attack by requiring validator to
prove they spent money on signing a block
● Mostly, use a hash puzzle:
○ Block has placeholder for arbitrary data
○ Validators must find a number that yields
hash(block) < target number
○ Lower the target to make it harder to solve
(difficulty)
○ Solver gets fees (and optionally a reward)
● Drawbacks: Wasteful, carbon footprint, slow
14. Consensus
Protocols
Proof-of-Stake
● Mitigate sybil attack by allocating voting
power based on currency ownership (stake)
● Most implementations have validator put a
collateral;
if found cheating the collateral is confiscated
● Drawbacks: hard to engage all stake owners,
circular logic
17. Economics Bitcoin Economics
● Predetermined supply, asymptotic to 21m
● Distribution through mining: PoW rewards
(decreasing in size; started at ₿50; today ₿12.5)
● Fees determined by market price
○ Transaction sender can determine the fee
○ Miners choose which transactions to
include
○ Block size is limited, price surges when
network busy
18. Economics General Monetary Principles
● Coins can be minted or mined
(or both - e.g. Ether)
● Supply can be
○ Fixed (most ICOs)
○ Predetermined schedule (Bitcoin, Ether)
○ Dynamic (Bancor)
● Mining also creates distribution
● Minting enables funding through crowd-sale
20. Smart
Contracts
Blockchain Consensus is an
Infrastructure for Decentralized Apps
● Past: Decentralized Apps (protocols) needed
their own network
○ Fax
○ Internet
○ WWW
○ BitTorrent
○ Bitcoin
● Present: execute ĐApp code on Blockchain
○ Turing-complete virtual machine
○ Consensus on execution outcome
21. Smart
Contracts
Current Gen Smart Contracts
● Ethereum pioneers smart contract network
● Execution is duplicated on ~20,000 nodes
● Very slow and costly
● Killer app: crypto tokens; other uses very rare
● Naïve governance: immutable contracts
23. Incumbent
Limitations
Bitcoin
● Low throughput (~6 tx/s)
● High latency (10 min/block, suggested 6-block
depth for high probability of confirmation)
● Monetary system unfit as means of exchange
● Limited privacy
● Questionable compliance with AML regulation
● Messy governance, forks
24. Incumbent
Limitations
Ethereum
● Low throughput (~20 tx/s)
● Variable latency (confirmation time between
few seconds to several hours)
● Very limited privacy
● Questionable compliance with AML regulation
● Centralized governance (hard fork controversy)