1 of 70

Lecture 9

Bitcoin as a platform

2 of 70

In this lecture

We’ve built Bitcoin. What can we build on top?

  • Commitments
  • Token tracking
  • Multiparty lotteries
  • Public randomness
  • Prediction markets

A fine stew o’ ideas

3 of 70

Lecture 9.1:

Bitcoin as an append-only log

4 of 70

Secure timestamping

Goal: Prove knowledge of x at time t

If desired, without revealing x at time t

Evidence should be permanent

5 of 70

Hash commitments

Recall: Publishing H(x) is a commitment to x

  • Can’t find an x’≠x later s.t. H(x’) = H(x)

  • H(x) reveal no information* about x

*assuming the space of possible x is big

Can publish a commitment to x, reveal later

6 of 70

Secure timestamping applications

  • Proof of knowledge
  • Proof of receipt
  • Hash-based signature schemes
  • many, many more...

7 of 70

Non-application: proof of clairvoyance

Proof that FIFA is corrupt??

Proving clairvoyance requires proving you didn’t timestamp multiple predictions

8 of 70

Offline solution: newspaper timestamp

9 of 70

Timestamping in Bitcoin

  • Idea: Specify the hash of your data instead of a valid public key
  • Send 1 satoshi to the address

Pros: compatible, easy

Cons: creates unspendable UTXO forever

10 of 70

Timestamping in Bitcoin: CommitCoin

  • Clark, Essex 2012
  • Idea: Brute-force a public key & signature starting with the first n bits of your data hash

Pros: compatible, “invisible”, no UTXO bloat

Cons: more expensive, low data rate

11 of 70

Provably unspendable commitments

OP_RETURN

<arbitrary data>

Pros: cheap, no UTXO bloat

Cons: not a standard transaction

12 of 70

Data rates

40-byte commitments for 1 TX fee

  • 0.0001 BTC (currently ≈ US$0.05)

Enough to commit to the hash of whatever you want!

13 of 70

Block chain poisoning

14 of 70

Can we prevent poisoning?

  • In general, no ☹

  • Pay-to-script-hash makes it more expensive

15 of 70

Overlay currencies

  • Observation: timestamping is all we need!

  • Write all data to the Bitcoin block chain
    • No new mining/consensus required
  • Invalid transactions may now be included
    • Need new rules-first valid tx wins

16 of 70

Mastercoin

  • Goals: overlay currency with richer transaction set
    • Smart property, smart contracts
    • User-defined currency

Pros: more features, faster development

Cons: reliant on Bitcoin, can be inefficient

17 of 70

Lecture 9.2:

Bitcoins as “smart property”

18 of 70

Recall: the transaction graph

19 of 70

Every bitcoin* carries a history

Coinbase

Coinbase

*There are no “bitcoins”, just unspent tx outputs

  • Bad for anonymity
  • Enables blacklisting
  • Observation: bitcoins aren’t fungible! Every one is unique

Can this property be useful?

20 of 70

Adding metadata to currency

Without limitations on issuance, just a novelty

21 of 70

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, #)

22 of 70

Authenticated metadata for currency

  • Currency can now

represent anything!

  • Anti-counterfeiting

properties are inherited

  • Underlying value also maintained!
  • New meaning relies on trust in the issuer
  • Some users may not understand new metadata

Can we build this on top of Bitcoin?

23 of 70

Colored coins

ISSUE 5

12

5

7

ISSUE 4

4

9

4

5

9

3

1

ISSUE 9

9

5

13

24 of 70

Implementation: OpenAssets protocol

  • Coins issued by passing through P2SH address
    • Issuer declares address with an exchange
  • Special unspendable “marker” output inserted
    • Match colored inputs to outputs
    • Can add extra metadata

25 of 70

Colored Coins

  • Pros
    • compatible with Bitcoin
    • flexible to represent any asset
    • ignored by community
  • Cons
    • small cost of unspendable markers
    • must check every previous tranasction

26 of 70

Applications

  • stock certificates
  • tickets
  • deeds to real-world property
    • houses?
    • cars?
  • ownership of domain names

NameCoin... stay tuned for our lecture on Altcoins!

27 of 70

Lecture 9.3:

Secure multi-party lotteries in Bitcoin

28 of 70

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!

29 of 70

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

30 of 70

Hash commitments

Recall: Publishing H(x) is a commitment to x

  • Can’t find an x’≠x later s.t. H(x’) = H(x)

  • H(x) reveal no information* about x

*assuming the space of possible x is big

31 of 70

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

32 of 70

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 ☹

33 of 70

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

34 of 70

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 ☹

35 of 70

Lottery with timed commitments

Pros:

  • can be implemented on Bitcoin today
    • Andrychowicz, Dziembowski, Malinowski, Mazurek 2014

Cons:

  • complexity is O(N2)
  • bonds must be higher than amount bet
    • griefers still might shut down large pools

36 of 70

Lecture 9.4:

Bitcoin as randomness source

37 of 70

Public randomness protocols

  • Too many interested parties to use hashes?
  • More convincing randomness to the public?
  • Designers don’t know alternatives available?

38 of 70

NBA draft lottery

1985: Knicks win rights to Patrick Ewing

39 of 70

1969 Vietnam conscription lottery

Late-year birthday bias

40 of 70

Cryptographic beacons

Idea: service to regularly publish random data

  • Uniform randomness
  • No party can predict in advance
  • All parties see the same values

01010001 01101011 10101000 11110000 10010100

Applications: lotteries, auditing, zero-knowledge proofs, cut-and-choose, ...

41 of 70

Public display of randomness

Pros: cheap, easy, simple to understand

Cons: must trust/audit operator

hard to trust remotely!

42 of 70

NIST beacon

Pros: quantum-mechanical randomness

Cons: must trust NIST

43 of 70

Natural phenomena

Sun spots

Cosmic background radiation

Weather

Pros: publicly observable, random

Cons: slow, need a trusted observer?

44 of 70

Stock-market beacon

Pros: good randomness, costly to manipulate

Cons: slow, insider attacks?

45 of 70

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

46 of 70

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

47 of 70

Cost of manipulation

Attacker might mine a block but discard it

  • Or bribe other miners to do so

Bernoulli trials: forcing a beacon outcome with probability p requires discarding 1/p - 1 blocks

Discarding a block “costs” 25 BTC

48 of 70

Cost of manipulation

Single coin flip: secure if wager is < 25 BTC

N-party lottery: secure if pool is < 25 (n-1) BTC

49 of 70

Pros

  • First proposal for fully decentralized beacon
  • Output every 10 minutes
  • Can precisely analyze manipulation costs
  • Can extend security with multiple blocks
    • Not very efficient

50 of 70

Cons

  • Timing is imprecise
    • Block chain not synchronized w/ real time
  • Need to delay to insure against forks
  • Manipulation may be too cheap for some applications

51 of 70

Built-in beacon support in script

  • Idea: add an opcode for a beacon call
  • Can build multi-party lotteries
    • only one round
    • no bonds
    • no time delay for refunds

52 of 70

Lecture 9.5:

Prediction markets & real-world data feeds

53 of 70

Assertions about the outside world

  • Idea: add a mechanism to assert facts
    • election outcomes
    • sports results
    • commodity prices
  • Bet or hedge results using smart contracts
  • Forwards, futures, options...

Most general formulation: prediction market

54 of 70

Prediction markets

  • Idea: trade shares in a potential future event
  • Shares worth X if the event happens, 0 if not
  • Current price / x = estimated probability

55 of 70

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

56 of 70

Example: 2008 US Presidential election

source: Iowa Electronic Markets

57 of 70

Prediction markets

  • Economists love them
    • reveal all knowledge about the future
      • (under a number of assumptions)
    • allows profit from accurate predictions
    • “a tax on BS”
  • Often beat polls and expert opinions
  • Significant regulatory hurdles
    • InTrade shut down in 2013

58 of 70

Decentralized prediction markets?

  • Decentralized payment & enforcement
  • Decentralized arbitration
  • Decentralized order book

59 of 70

Decentralized payment & settlement

  • Simple solution: Bitcoin + trusted arbiters
  • Better solution: altcoin with built-in support

60 of 70

Payment & settlement - FutureCoin

  • BuyPortfolio(event e)
    • one share in every outcome for $1
  • TradeShares(...)
    • exchange shares for each other or currency
    • one way of profiting
  • SellPortfolio(event e)
    • redeem one share in every outcome for $1

Clark et al. 2014

61 of 70

Arbitration models

  • Trusted arbiters
    • allow anybody to define & open a market
    • risk of incorrect arbitration, absconding
  • Users vote
    • requires incentives, bonds, reputation
    • keynesian beauty contest?
  • Miners vote
    • may be disinterested or not know

62 of 70

RealityKeys

63 of 70

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?

64 of 70

Order books

  • Goal: match best bid and ask offers

Predictious.com

65 of 70

Centralized order books

  • Traditional model
  • Promise to split surplus between buyer, seller
  • Front-running is considered a serious crime!
    • require regulation, auditing, monitoring

66 of 70

Decentralized order books

  • Idea: Submit orders to miners, let them match any possible trade
  • Spread is retained as a transaction fee
  • Front-running now not profitable!
  • May be less efficient
    • Higher fees
    • Slower trades to avoid higher fees

67 of 70

Decentralized order books

  • Idea: Submit orders to miners, let them match any possible trade
  • Spread is retained as a transaction fee
  • Front-running now not profitable!
  • May be less efficient
    • Higher fees
    • Slower trades to avoid higher fees

68 of 70

What can be built on Bitcoin?

payment

settlement

no trades

arbitration

trusted arbiter only

order books

must be external

Bitcoin isn’t enough

69 of 70

In the next lecture

70 of 70

Bitcoin can only take us so far

What if we could start again from scratch?