Blockchain & Money: Session 3: Blockchain Basics & Cryptography by M.I.T. Sloan School of Management with Professor Gary Gensler
Session 3: Blockchain Basics & Cryptography
Session 3 Study Questions:
- What are the design features–cryptography, append-only, time-stamped blocks, distributed consensus algorithms, and networking– of Bitcoin, the first use case for blockchain technology?
- What are cryptographic hash functions, asymmetric cryptography and digital signatures? How are they utilized to help make blockchain technology verifiable and immutable?
- What is the double spending problem and how it is addressed by blockchain technology?
Session 3 Readings:
- Bitcoin: A Peer-to-Peer Electronic Cash System; Satoshi Nakamoto whitepaper.
- ‘Blockchain Technology Overview’ NIST (pages 9-23, sections 1 & 2)
- ‘Blockchain 101-A Visual Demo’ Brownworth; Youtube video.
Bitcoin is just the first use-case of blockchain technology. We’re going to look at the technical underpinnings of blockchain technology, through the lens of Bitcoin. (NOTE–Because bitcoin was the first use-case of blockchain technology, the two terms sometimes get used interchangeably, whether correct or not.
Double Spend problem–when you have a piece of info and use it twice. When it comes to money, it is critical that it not be used twice.
Overview: Bitcoin Design Features, Cryptographic Hash Functions, Timestamped Append-only logs, Block Headers & Merkle Trees, Asymmetric Cryptography & Digital Signatures, Bitcoin Addresses.
Class/Session 2 Review:
- Money is a Social & Economic Consensus
- Fiat Money is but the current lead in a long evolution of money.
- Fiat Currency has had challenges & instabilities as well. [Fiat currencies aren’t going away but they have their instabilities, particularly around weak monetary policy (like when you debase a currency and allow a low of it to be issued) and/or usually around unstable fiscal policy (like when the government is spending a lot).]
- Ledgers are a method for recording economic activity and financial relationships. (Transaction records or balance records. Bitcoin is a transaction record ledger, but other blockchain technologies can use a balance ledger system.) Transactions & ledgers are at the core of Bitcoin.
- Central Banking & Financial Sector are built upon a series of ledgers. The master ledger of the Central Bank, and then commercial banks have sort of sub-ledgers. And maybe a digital wallet like Starbucks may be thought of as a 3rd tier ledger.
- We now live in an electronic currency age.
- Many efforts have been made at cryptographic digital currencies. They all died until Bitcoin was able to address the riddle of how to solve peer-to-peer money, without a central authority.
- Nakamoto’s whitepaper & related Blockchain Technology builds upon the long history of money & ledgers. (“I’ve been working on a new electronic cash system that’s fully peer-to-peer, with no trusted third party.”)
- Interestingly, Satoshi Nakamoto did not reference the term ‘blockchain’ specifically by name. That’s just the literal term that the layer became know as.
BLOCKCHAIN TECHNOLOGY–What is Blockchain?
- Timestamped
- Audit-able database
- Network consensus protocol
Secured via cryptography:
- Hash functions for ‘tamper resistance’ and ‘integrity’.
- Digital signature for ‘consent’.
- Consensus for ‘agreement’.
Addresses ‘Cost of Trust’
Byzantine Generals Problem
Permissioned vs. Permissionless
Merkle Tree Structure–a way to compress a lot of data and also sort through that data.
Nonce–a random number used once. ‘N’ for ‘number’, attached to ‘once’.
Blockchain/Bitcoin Technical Features:
- Cryptographic Hash Functions
- Timestamped Append-only logs (Blocks)
- Block Headers & Merkle Trees
- Asymmetric Cryptography & Digital Signatures
- Addresses
- Consensus through ‘Proof-of-Work’
- Network of Nodes
- Native Currency
- Transaction Inputs & Outputs
- Unspent Transaction Output (UTXO)
- Scripting Language
Cryptography–communications in the presence of adversaries.
Cryptographic Hash Functions (Digital Fingerprints for Data)
- General Properties:
- Maps input ‘x’ of any size to an output of fixed-size (called a ‘Hash’)
- Deterministic: Always the same Hash for the same ‘x’.
- Efficiently computed
- Cryptographic Properties:
- Pre-image resistant (one-way): infeasible to determine ‘x’ from Hash(x). (Infeasible, NOT impossible!)
- NOTE: Bitcoin–We can’t assume that Bitcoin can’t be broken. It is immutable until the hash functions that are inside of Bitcoin might be broken. Even Satoshi wrote in 2010 emails “What if SHA-256 became broken?” Satoshi suggested that we’d have evolved to something better than SHA-256 to hash (or encrypt things with) by that time. A better hash function. Satoshi suggests that Bitcoin could eventually move to a better hash function. Further note: A 51% attack (or taking over all the nodes) is different than from talking about breaking the cryptography. Satoshi doesn’t talk about ‘breaking’ the cryptography in the whitepaper. Satoshi mentions it in an email sent later.
- Collision resistant: infeasible to find an ‘x’ and ‘y’ where Hash(x) = Hash(y)
- Avalanche effect: Change ‘x’ slightly and Hash(x) changes significantly.
- Puzzle friendliness: knowing Hash(x) and part of ‘x’ it is still very hard to find the rest of x.
- Pre-image resistant (one-way): infeasible to determine ‘x’ from Hash(x). (Infeasible, NOT impossible!)
- Digital Fingerprints for Data:
- Uses as:
- Names
- References
- Pointers
- Commitments
- Bitcoin Hash Functions
- Header & Merkle Trees-SHA-256
- Bitcoin Addresses-SHA-256 and RIPEMD160
- Uses as:
- “How to Time-Stamp a Digital Document” by Stuart Haber & W. Scott Stornetta (1991)
- Surety 1995–Present in NY Times every week in the “Notices” section.
- Thus recognized as the longest running blockchain (Timestamped b/c it’s in the NYT’s).
- Haber is listed as Blockchain’s co-founder on his website! Also, just google “Stuart Haber blockchain” and go enjoy that rabbit hole! (:
Timestamped Append-Only Log–Blockchain
- Block Header (5 pieces of key information):
- Version
- Previous block hash
- Merkle Root hash
- Timestamp
- Difficulty target
- Nonce
Merkle Tree–Binary Data Tree with Hashes:
Merkle roots are a very efficient way to take 1,000’s of transactions and store it up (like ‘zipping’ it up???) in one spot.
- Asymmetric Cryptography & Digital Signatures:
- Digital Signature Algorithms
- Generate Key pair–Public Key (PK) & Private Key (SK-secret key) from random number.
- Signature–Creates Digital Signature (Sig) from message (m) and Private Key (SK).
- Verification–Verifies if a signature (Sig) is valid for a message(m) and a Public Key (PK).
- Properties
- Infeasible to find Private Key (SK) from Public Key (PK).
- All valid signatures verify
- Signatures infeasible to forge.
- Bitcoin Digital Signature Function
- Elliptic Curve Digital Signature Algorithm (ECDSA)…y2=x3+7
- Digital Signature Algorithms
Transaction format:
- Conclusions–Cryptocurrency is 1). Cryptography, 2). Consensus Mechanisms, and 3). Transactions
- Discussed Bitcoin Design Features
- Timestamped Append-only logs (Blocks)
- Secured through Cryptographic Hash Functions & Digital Signatures
- Consensus Protocol–consensus thru Proof-of-Work; Network of Nodes; Native Currency
- Transaction Ledgers–Transaction Inputs & Outputs; Unspent Transaction Output (UTXO); Scripting Language;
- Discussed Bitcoin Design Features
- Biblio:
- Gary Gensler. 15.S12 Blockchain and Money. Fall 2018. Massachusetts Institute of Technology: MIT OpenCourseWare, https://ocw.mit.edu. License: Creative Commons BY-NC-SA.
- How to Time-Stamp a Digital Document. Stuart Haber & W. Scott Stornetta. https://link.springer.com/content/pdf/10.1007/3-540-38424-3_32.pdf.
Video link: Session 3: Blockchain Basics & Cryptography.