Peer-to-peer Affine Commitment using Bitcoin Karl Crary and Michael - - PowerPoint PPT Presentation

peer to peer affine commitment using bitcoin
SMART_READER_LITE
LIVE PREVIEW

Peer-to-peer Affine Commitment using Bitcoin Karl Crary and Michael - - PowerPoint PPT Presentation

Peer-to-peer Affine Commitment using Bitcoin Karl Crary and Michael J. Sullivan Carnegie Mellon University PLDI 15, Portland June 17, 2015 Massively Multiplayer Online Linear Logic Karl Crary and Michael J. Sullivan Carnegie Mellon


slide-1
SLIDE 1

Peer-to-peer Affine Commitment using Bitcoin

Karl Crary and Michael J. Sullivan

Carnegie Mellon University PLDI ’15, Portland

June 17, 2015

slide-2
SLIDE 2

Massively Multiplayer Online Linear Logic

Karl Crary and Michael J. Sullivan

Carnegie Mellon University PLDI ’15, Portland

June 17, 2015

slide-3
SLIDE 3

Typecoin

◮ A general peer-to-peer commitment mechanism - using

the language of linear logic

◮ Implemented on top of the Bitcoin network ◮ With applications for proof-carrying authorization

slide-4
SLIDE 4

Proof-carrying authorization

◮ Idea: represent authorization as logical propositions

(Appel and Felten 1999)

slide-5
SLIDE 5

Proof-carrying authorization

◮ Idea: represent authorization as logical propositions

(Appel and Felten 1999)

◮ ... in a logic with a notion of affirmation ◮ KA means “the principal K says A”

slide-6
SLIDE 6

Proof-carrying authorization

◮ Alice wants to give access to a file, so affirms:

◮ Alice may-read(Bob, file) ◮ Alice may-read(Charlie, file)

slide-7
SLIDE 7

Proof-carrying authorization

◮ Alice wants to give access to a file, so affirms:

◮ Alice may-read(Bob, file) ◮ Alice may-read(Charlie, file)

Alice may-read(Bob, file)

slide-8
SLIDE 8

Proof-carrying authorization

◮ Alice wants to give access to a file, so affirms:

◮ Alice may-read(Bob, file) ◮ Alice may-read(Charlie, file)

Alice may-read(Bob, file) file contents

slide-9
SLIDE 9

Proof-carrying authorization - higher order use

◮ Much more flexible policies are possible:

Alice∀K. Registrar in-Alice’s-class(K) ⊃ may-read(K, file)

slide-10
SLIDE 10

Proof-carrying authorization - higher order use

◮ Much more flexible policies are possible:

Alice∀K. Registrar in-Alice’s-class(K) ⊃ may-read(K, file)

◮ Then can derive:

∀K. Registrar in-Alice’s-class(K) ⊃ Alicemay-read(K, file)

slide-11
SLIDE 11

Implementing proof-carrying authorization

◮ Straightforward to make work even in a

decentralized/peer-to-peer system

◮ Proofs are self-contained ◮ Digital signatures used for affirmation

slide-12
SLIDE 12

Consumable credentials What if we want one time use authorization?

slide-13
SLIDE 13

Linear logic

◮ Garg et al. 2006; linear proof-carrying authorization ◮ Linear logic treats hypotheses as scarce resources that

must be used once For logicians Linear logic allows exchange, but not weakening or contraction

slide-14
SLIDE 14

Linear logic

◮ Garg et al. 2006; linear proof-carrying authorization ◮ Linear logic treats hypotheses as scarce resources that

must be used once

◮ Good for modeling state change:

bread ⊗ ham ⊸ ham sandwich ∀i. counter(i) ⊸ counter(i + 1) For logicians Linear logic allows exchange, but not weakening or contraction

slide-15
SLIDE 15

Linear authorization Alicemay-take(Bob, MilkDuds)

slide-16
SLIDE 16

Linear authorization Alicemay-take(Bob, MilkDuds) Alicemay-take(Bob, MilkDuds)

◮ How to ensure that a resource

isn’t used multiple times?

◮ Need a mechanism to irreversibly

commit to a state change

slide-17
SLIDE 17

Bitcoin

◮ On a completely different note: consider designing a

decentralized digital currency

slide-18
SLIDE 18

Bitcoin

◮ On a completely different note: consider designing a

decentralized digital currency

◮ A coin is a chain of digital certificates ◮ A coin is spent by signing it over to somebody else

1’s pubkey 0’s signature

slide-19
SLIDE 19

Bitcoin

◮ On a completely different note: consider designing a

decentralized digital currency

◮ A coin is a chain of digital certificates ◮ A coin is spent by signing it over to somebody else

1’s pubkey 0’s signature 2’s pubkey 1’s signature

slide-20
SLIDE 20

Bitcoin

◮ On a completely different note: consider designing a

decentralized digital currency

◮ A coin is a chain of digital certificates ◮ A coin is spent by signing it over to somebody else

1’s pubkey 0’s signature 2’s pubkey 1’s signature 3’s pubkey 2’s signature

slide-21
SLIDE 21

Bitcoin - the catch

1’s pubkey 0’s signature

◮ But how do we prevent an owner from spending a coin

multiple times?

slide-22
SLIDE 22

Bitcoin - the catch

1’s pubkey 0’s signature 2’s pubkey 1’s signature

◮ But how do we prevent an owner from spending a coin

multiple times?

slide-23
SLIDE 23

Bitcoin - the catch

1’s pubkey 0’s signature 2’s pubkey 1’s signature 3’s pubkey 1’s signature

◮ But how do we prevent an owner from spending a coin

multiple times?

slide-24
SLIDE 24

Bitcoin - the catch

1’s pubkey 0’s signature 2’s pubkey 1’s signature 3’s pubkey 1’s signature

◮ But how do we prevent an owner from spending a coin

multiple times?

◮ Need a mechanism to irreversibly commit to a state change

slide-25
SLIDE 25

Bitcoin implementation

◮ Bitcoin (Nakamoto 2008) does this with a global ledger of all

transactions - the “blockchain”

◮ Ledger maintained by distributed process called “mining”

slide-26
SLIDE 26

From Bitcoin to Typecoin 5 4 9

slide-27
SLIDE 27

From Bitcoin to Typecoin cook bread ham ham sandwich

slide-28
SLIDE 28

From Bitcoin to Typecoin - transactions . . . . . . I1 Im O1 On a1 am b1 bn

◮ a1 + · · · + am = b1 + · · · + bn

slide-29
SLIDE 29

From Bitcoin to Typecoin - transactions M . . . . . . I1 Im O1 On A1 Am B1 Bn

◮ ⊢ M : (A1 ⊗ · · · ⊗ Am) ⊸ (B1 ⊗ · · · ⊗ Bn) ◮ Carry linear logic1 propositions instead of numbers

1actually affine logic

slide-30
SLIDE 30

Authorization example

slide-31
SLIDE 31

Authorization example sign Alicemay-take(Bob, MilkDuds)

slide-32
SLIDE 32

Authorization example sign ... Alicemay-take(Bob, MilkDuds) Alicemay-take(Bob, MilkDuds)

slide-33
SLIDE 33

Authorization example sign ... Alicemay-take(Bob, MilkDuds) Alicemay-take(Bob, MilkDuds)

slide-34
SLIDE 34

Authorization example sign ... Alice∀K. may-take(K, MilkDuds) Alicemay-take(Bob, MilkDuds)

◮ Quantification allows transferable permissions

slide-35
SLIDE 35

Authorization example sign ... Alice∀K. may-take(K, MilkDuds) & may-take(K, Hershey′s) Alicemay-take(Bob, MilkDuds)

◮ Quantification allows transferable permissions ◮ External choice (“with”) allows choice

slide-36
SLIDE 36

Declarations

◮ Where do may-take, MilkDuds, etc. come from?

slide-37
SLIDE 37

Declarations

◮ Where do may-take, MilkDuds, etc. come from? ◮ Transactions can declare types and propositions

may-take : principal → candy → prop

slide-38
SLIDE 38

Building a new currency

◮ Can turn Typecoin back into a currency (S-coins)

coin : nat → prop merge : ∀ N, M : nat. coin N ⊗ coin M ⊸ coin N + M split : ∀ N, M, P : nat. coin N + M ⊸ coin N ⊗ coin M

slide-39
SLIDE 39

Central banking

◮ Need some way to mint a new S-coin

print : nat → prop issue : ∀N:nat. Janet(print N) ⊸ coin N

slide-40
SLIDE 40

How to implement?

◮ We could build Typecoin in a standalone way ◮ Use adapted versions of the Bitcoin mining algorithms

and protocol

◮ Could typecheck transactions before they enter the chain

slide-41
SLIDE 41

How to implement?

◮ How to incentivize people to mine on a Typecoin chain? ◮ Bitcoin already has a lot of mining power ◮ Typechecking transactions in the chain not an obvious

win: proofs might be big or not public

slide-42
SLIDE 42

Overlaying on Bitcoin

◮ New plan: actually overlay on top of Bitcoin

M . . . . . . I1 Im O1 On A1 Am B1 Bn

slide-43
SLIDE 43

Overlaying on Bitcoin

◮ New plan: actually overlay on top of Bitcoin

hash    M . . . . . . I1 Im O1 On A1 Am B1 Bn    . . . . . . I1 Im O1 On a1 am b1 bn

◮ Embed a hash in the metadata of the Bitcoin transaction ◮ Send the Typecoin transactions to interested parties

slide-44
SLIDE 44

Metadata in Bitcoin

◮ Bitcoin historically lacked a nice place to put metadata -

  • n principle

◮ (Nodes would not forward transactions that used the

straightforward methods)

◮ Paper describes a somewhat hacky workaround

slide-45
SLIDE 45

Metadata in Bitcoin

◮ Bitcoin historically lacked a nice place to put metadata -

  • n principle

◮ (Nodes would not forward transactions that used the

straightforward methods)

◮ Paper describes a somewhat hacky workaround ◮ But the Bitcoin developers have since caved

slide-46
SLIDE 46

Receipts

◮ Receipts that attest to outputs: receipt(A ։ addr)

Alice(receipt(coin(5) ։ Alice) ⊸ ∀K. may-take(K, MilkDuds))

slide-47
SLIDE 47

Expiration/revocation

◮ Conditional modality permits revocation and expiration:

if(before(July 10)), may-write(Alice, POPL-paper))

slide-48
SLIDE 48

Implementation

◮ Implemented in Standard ML ◮ With a new Bitcoin client, in SML

slide-49
SLIDE 49

Related Work

◮ Bowers et al. 2007; consumable credentials ◮ Rosenfeld 2013; colored coins ◮ Wood 2014; Ethereum

slide-50
SLIDE 50

Conclusion

◮ Typecoin is a flexible peer-to-peer logical commitment

mechanism

◮ Based on generalizing Bitcoin to carry logical propositions ◮ Actually implemented on top of Bitcoin ◮ Details on the logic are in the paper

slide-51
SLIDE 51

Thank you!

slide-52
SLIDE 52

Why not linear?

◮ Typecoin sort of fundamentally affine - can always throw

away an output

◮ Allowing rule declarations in signatures makes it trivial ◮ trash : ⊤ ⊸ 1

slide-53
SLIDE 53

Why not linear?

◮ Typecoin sort of fundamentally affine - can always throw

away an output

◮ Allowing rule declarations in signatures makes it trivial ◮ trash : ⊤ ⊸ 1 ◮ Prohibit ⊤? trash : A ⊸ 1 ◮ Prohibit proving 1? dummy : prop. trash : A ⊸ !dummy ◮ Prohibit consuming A? trash : Kdummy ⊸ !dummy, sign

K(A ⊸ dummy)

slide-54
SLIDE 54

Metadata: “m-of-n” outputs

◮ An “m-of-n” output lists n public keys ◮ To spend it, provide signatures using m ◮ 2-of-3 outputs useful for two-party escrow ◮ We use 1-of-2 outputs to embed metadata ◮ One public key is the real destination ◮ The other is actually the hash of our transaction