Lecture 9
Bitcoin as a platform
In this lecture
We’ve built Bitcoin. What can we build on top?
A fine stew o’ ideas
Lecture 9.1:
Bitcoin as an append-only log
Secure timestamping
Goal: Prove knowledge of x at time t
If desired, without revealing x at time t
Evidence should be permanent
Hash commitments
Recall: Publishing H(x) is a commitment to x
*assuming the space of possible x is big
Can publish a commitment to x, reveal later
Secure timestamping applications
Non-application: proof of clairvoyance
Proof that FIFA is corrupt??
Proving clairvoyance requires proving you didn’t timestamp multiple predictions
Offline solution: newspaper timestamp
Timestamping in Bitcoin
Pros: compatible, easy
Cons: creates unspendable UTXO forever
Timestamping in Bitcoin: CommitCoin
Pros: compatible, “invisible”, no UTXO bloat
Cons: more expensive, low data rate
Provably unspendable commitments
OP_RETURN
<arbitrary data>
Pros: cheap, no UTXO bloat
Cons: not a standard transaction
Data rates
40-byte commitments for 1 TX fee
Enough to commit to the hash of whatever you want!
Block chain poisoning
☹
Can we prevent poisoning?
Overlay currencies
Mastercoin
Pros: more features, faster development
Cons: reliant on Bitcoin, can be inefficient
Lecture 9.2:
Bitcoins as “smart property”
Recall: the transaction graph
Every bitcoin* carries a history
Coinbase
Coinbase
*There are no “bitcoins”, just unspent tx outputs
Can this property be useful?
Adding metadata to currency
Without limitations on issuance, just a novelty
Authenticated metadata for currency
Stadium
Idea: sign desired metadata + banknote serial #
“Bill #L11180916G hereby grants the holder admission to the Yankees game on Aug 18, 2014”
SIGNK(M, #)
Authenticated metadata for currency
represent anything!
properties are inherited
Can we build this on top of Bitcoin?
Colored coins
ISSUE 5
12
5
7
ISSUE 4
4
9
4
5
9
3
1
ISSUE 9
9
5
13
Implementation: OpenAssets protocol
Colored Coins
Applications
NameCoin... stay tuned for our lecture on Altcoins!
Lecture 9.3:
Secure multi-party lotteries in Bitcoin
Real-world lotteries without trust*
*The outcome is fair, but both parties have to trust the other will actually pay up
Alice
Bob
Wanna bet $5
Sure, I’ll take heads!
Online lotteries without trust?
Alice
Bob
Problem: Alice and Bob want to bet on a coin flip remotely
I’ll bet $5 on heads!
But I can’t see your coin!
Network
Hash commitments
Recall: Publishing H(x) is a commitment to x
*assuming the space of possible x is big
A lottery with hash commitments
Alice
Bob
Carol
time
Choose random y
Choose random x
Choose random z
Round 1
Publish H(x)
Publish H(y)
Publish H(z)
Publish x
Publish y
Publish z
Round 2
w= H(x⊕y⊕z) % 3
switch (w){
case 0:
winner = Alice;
case 1:
winner = Bob;
case 2:
winner = Carol;
}
Hash function guarantees nobody can win with probability more than 1/3
Failure to reveal commitment
Alice
Bob
Carol
time
Choose random y
Choose random x
Choose random z
Round 1
Publish H(x)
Publish H(y)
Publish H(z)
Publish x
Publish y
Round 2
w= H(x⊕y⊕z) % 3
switch (w){
case 0:
winner = Alice;
case 1:
winner = Bob;
case 2:
winner = Charlie;
}
I’m about to lose...
Ø
Sorry! I, uhh, forgot z
Sorry! I, uhh, forgot z
Not cool Carol ☹
Timed hash commitments
Idea: Force x to be revealed by time t
Input: ...; Pay B to EITHER OF:
Alice & Bob, or
Alice & anybody who knows x st. H(x) = c
SIGNED(Alice)
1
MULTISIG
New script!
Input: 1; Pay B to Bob:
n_lock_time: t
SIGNED(Alice) SIGNED(Bob)
2
Bob can claim the bond at time t
Bond
Input: 1; Pay B to Alice:
SIGNED(Alice), x
3
x revealed if Alice reclaims her bond
Lottery with timed commitments
Alice
Bob
Carol
time
Choose random y
Choose random x
Choose random z
Round 1
Timed commitment to H(x)
Timed commitment to H(y)
Timed commitment to H(z)
Publish x
Publish y
Round 2
w= H(x⊕y⊕z) % 3
switch (w){
case 0:
winner = Alice;
case 1:
winner = Bob;
case 2:
winner = Carol;
}
I’m about to lose...
But I’ll lose my bond if I don’t publish ☹
Lottery with timed commitments
Pros:
Cons:
Lecture 9.4:
Bitcoin as randomness source
Public randomness protocols
NBA draft lottery
1985: Knicks win rights to Patrick Ewing
1969 Vietnam conscription lottery
Late-year birthday bias
Cryptographic beacons
Idea: service to regularly publish random data
01010001 01101011 10101000 11110000 10010100
Applications: lotteries, auditing, zero-knowledge proofs, cut-and-choose, ...
Public display of randomness
Pros: cheap, easy, simple to understand
Cons: must trust/audit operator
hard to trust remotely!
NIST beacon
Pros: quantum-mechanical randomness
Cons: must trust NIST
Natural phenomena
Sun spots
Cosmic background radiation
Weather
Pros: publicly observable, random
Cons: slow, need a trusted observer?
Stock-market beacon
Pros: good randomness, costly to manipulate
Cons: slow, insider attacks?
Why not use the block chain?
Recall: miners find random nonce for each block
If you could predict the next nonce with a greater than 1/d probability, you’d have a mining shortcut
Currently, d > 266
Turning the block chain into a beacon
mrkl_root: H( )
prev: H( )
mrkl_root: H( )
hash: 0x0000
nonce: 0x7a83
prev: H( )
hash:
hash: 0x3485...
hash: 0x6a1f...
nonce: 0x0000...
nonce: 0x0001...
hash: 0xc9c8...
nonce: 0x0002...
hash: 0x300c...
nonce: 0xffff...
hash:
nonce: 0x0000...
hash: 0xd0c7...
nonce: 0x0001...
hash: 0x0224...
hash: 0x0000...
nonce: 0xf77e...
mrkl_root: H( )
prev: H( )
hash:
hash: 0x3485...
hash: 0x6a1f...
nonce: 0x0000...
nonce: 0x0001...
hash: 0xc9c8...
nonce: 0x0002...
hash: 0x300c...
nonce: 0xffff...
hash:
nonce: 0x0000...
hash: 0xd0c7...
nonce: 0x0001...
hash: 0x0224...
hash: 0x0000...
nonce: 0xf77e...
Extract
Extract
Extract
01010001 10101000 10010100
Cost of manipulation
Attacker might mine a block but discard it
Bernoulli trials: forcing a beacon outcome with probability p requires discarding 1/p - 1 blocks
Discarding a block “costs” 25 BTC
Cost of manipulation
Single coin flip: secure if wager is < 25 BTC
N-party lottery: secure if pool is < 25 (n-1) BTC
Pros
Cons
Built-in beacon support in script
Lecture 9.5:
Prediction markets & real-world data feeds
Assertions about the outside world
Most general formulation: prediction market
Prediction markets
Example: World Cup 2014
0.12 0.09 0.22 0.01 0.05
pre-tournament
0.18 0.15 0.31 0.06 0.00
after group stage
0.26 0.21 0.45 0.00 0.00
before semis
0.64 0.36 0.00 0.00 0.00
before finals
1 0 0 0 0
final
Can immediately profit!
Should have shorted
Example: 2008 US Presidential election
source: Iowa Electronic Markets
Prediction markets
Decentralized prediction markets?
Decentralized payment & settlement
Payment & settlement - FutureCoin
Clark et al. 2014
Arbitration models
RealityKeys
Reality can be complicated!
Super Bowl XLVIII:
what color gatorade will be poured on the winning coach?
Clear:0.31 Orange:0.22 Yellow:0.22 Blue:0.08 Red:0.08 Green:0.08
Orange?
Yellow?
Order books
Predictious.com
Centralized order books
Decentralized order books
Decentralized order books
What can be built on Bitcoin?
payment | ✓ |
settlement | no trades |
arbitration | trusted arbiter only |
order books | must be external |
Bitcoin isn’t enough
In the next lecture
Bitcoin can only take us so far
What if we could start again from scratch?