Week 1
Money, Trust And Ledgers
- Blockchain from zero, week 1 of 12
- Learn why blockchains exist and what problem they solve
Outcomes
What You Will Be Able To Do
- Explain the three jobs of money
- Describe why digital copies break digital cash
- Define double spending and how a ledger stops it
- Name what intermediaries do and cost
- Build a tiny ledger in Python
Barter problem
Why Money Exists
- Barter needs both sides to want what the other has
- Money is a shared middle token
- Everyone accepts it because they expect others will too
Definitions
Three Jobs Of Money
- Medium of exchange: accepted as payment
- Store of value: keeps worth over time
- Unit of account: prices are quoted in it
| Job | Meaning |
|---|
| Medium of exchange | Accepted in trade |
| Unit of account | Common yardstick for prices |
| Store of value | Holds worth over time |
Ledgers
A Balance Is A Ledger Entry
- Gold coins carry value in the metal
- Bank balances are rows in a database
- A ledger lists who owns what and who paid whom
- Key question: who may write to it?
Alice 10
Bob 0
Alice -> Bob : 4
Alice 6
Bob 4
The core problem
Digital Things Are Easy To Copy
- A copy of a file equals the original
- A file saying 'worth 10 euros' can be pasted twice
- Shops cannot tell original from copy
Definition
Double Spending
- Same value used in two different payments
- Digital counterfeiting
- Every digital cash system must prevent it
Trusted ledger keeper
The Classic Fix: A Referee
- A bank checks the balance before each payment
- It deducts the amount and records the payment
- The second payment fails with zero balance
- The key is one agreed order of events
pay(Alice, ShopA, 10) -> ok, balance 0
pay(Alice, ShopB, 10) -> refused
Banks and networks
What Intermediaries Provide
- Identity checks
- Safe custody of funds
- Dispute handling
- Fraud protection
Trade-offs
What Intermediaries Cost
- Fees on each payment
- Delays, especially across borders
- Opening hours and cut-off times
- Account rules can exclude people
- Power to freeze or reverse payments
History
Early Attempts At Digital Cash
- 1980s: David Chaum and DigiCash, with a central issuer
- 1997: Adam Back's Hashcash, costly puzzles against spam
- Late 1990s and 2000s: b-money and bit gold proposals
- Missing piece: agreement among strangers without an owner
| Year | Attempt |
|---|
| 1989 | DigiCash |
| 1997 | Hashcash |
| 1998 | b-money |
| 2008 | Bitcoin whitepaper |
The whitepaper
31 October 2008
- Satoshi Nakamoto posts a nine-page paper
- Title: Bitcoin, a peer-to-peer electronic cash system
- Goal: payments without a trusted third party
The blockchain idea
Many Copies, One History
- Many nodes each keep the full ledger
- Transactions are grouped into blocks
- Each block holds a fingerprint of the previous block
- Rewriting history breaks every later link
[Block 1] <- [Block 2] <- [Block 3]
hash A prev: A prev: B
hash B hash CJudgment
When A Blockchain Fits
- Participants who do not trust one another
- No single party should control the record
- Open access matters
- If one trusted owner exists, a database is simpler
Week 1 in five lines
Recap
- Money is a shared belief used for exchange
- Ledgers record ownership
- Copying makes digital cash hard
- A ledger keeper blocks double spending
- Blockchains share that keeper's job across many nodes
Week 2
Next Week: Cryptography You Need
- Hash functions as digital fingerprints
- Public and private keys
- Digital signatures and Merkle trees
- Short Python demos
Hands-on
Questions And Exercise
- Build ledger.py with three balances
- Make an overspend raise an error
- Write three sentences about the referee in your code
def pay(sender, receiver, amount):
if balances[sender] < amount:
raise ValueError('insufficient funds')
balances[sender] -= amount
balances[receiver] += amount
history.append((sender, receiver, amount))