+ All Categories
Home > Documents > Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger:...

Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger:...

Date post: 14-Jun-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
102
Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller *Acknowledgement: We thank Roger Ver for letting us use his name in the paper’s title. paddyncl
Transcript
Page 1: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trading with Roger: Gambling on the success of a hardfork*

Patrick McCorry, Ethan Heilman, Andrew Miller

*Acknowledgement: We thank Roger Ver for letting us use his name in the paper’s title.

paddyncl

Page 2: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

What is interesting in the paper? ● Brief history on soft and hard forks in Bitcoin/Ethereum. ● An overview of replay protection proposals (including a new one we call

migration inputs) ● This Talk: Hard Fork Atomic Trade Protocols for Bitcoin

○ How to set up trade prior to hardfork and perform it once hardfork occurs.○ With and Without a transaction malleability fix!

● Hard Fork Atomic Trade Protocol for Ethereum○ How to use a Hardfork Oracle to set up and perform the atomic trade.

I hope to leave everyone with one message:

Transaction malleability *was* a pain in the ass and designing bitcoin contracts that accounts for malleability is non-trivial.

paddyncl

Page 3: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Loaded Challenges Roger (and he accepts)

paddyncl

Page 4: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

paddyncl

Loaded didn’t want to use an escrow.

Page 5: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

paddyncl

Eventually.. I seen Ethan tweeting about the bet…

Page 6: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

paddyncl

Page 7: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.

Alices Deposit

Bobs Depositpaddyncl

Page 8: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.

Alices Deposit

Bobs Depositpaddyncl

Page 9: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.

Alices Deposit

Bobs Depositpaddyncl

Page 10: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.

Alices Deposit

Bobs Depositpaddyncl

Page 11: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.

Alices Deposit

Bobs Depositpaddyncl

Page 12: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.

Alices Deposit

Bobs Depositpaddyncl

Page 13: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.

Alices Deposit

Bobs Depositpaddyncl

Page 14: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.

Alices Deposit

Bobs Depositpaddyncl

Page 15: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

HARDFORK

BLOCK

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.2. HARDFORK ACTIVATES

Alices Deposit

Bobs Depositpaddyncl

Page 16: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

HARDFORK

BLOCK

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.2. HARDFORK ACTIVATES 3. Alice withdraws both coins in FORK-2

FORK-1

FORK-2

Alices Deposit

Bobs Depositpaddyncl

Page 17: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

HARDFORK

BLOCK

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.2. HARDFORK ACTIVATES 3. Alice withdraws both coins in FORK-2 4. Bob withdraws both coins in FORK-1

FORK-1

FORK-2

Alices Deposit

Bobs Deposit

Page 18: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

HARDFORK

BLOCK

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.2. HARDFORK ACTIVATES 3. Alice withdraws both coins in FORK-2 4. Bob withdraws both coins in FORK-1

FORK-1

FORK-2

Alices Deposit

Bobs Deposit

Page 19: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

HARDFORK

BLOCK

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.2. HARDFORK ACTIVATES 3. Alice withdraws both coins in FORK-2 4. Bob withdraws both coins in FORK-1

FORK-1

FORK-2

Alices Deposit

Bobs Deposit

Page 20: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

HARDFORK

BLOCK

Atomically Trade across two forksAlice Bob

1. Deposit coins into a single transaction.2. HARDFORK ACTIVATES 3. Alice withdraws both coins in FORK-2 4. Bob withdraws both coins in FORK-1

FORK-1

FORK-2

Alices Deposit

Bobs Deposit

Page 21: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

With and Without a Transaction Malleability fix● Transaction malleability

○ The identification hash of a transaction (i.e. transaction id) can is malleable (i.e. changable) any time before it is accepted into the blockchain.

○ It is not safe to sign a chain of unconfirmed transactions.

● Without Transaction Malleability fix○ Deposit must be stored in the blockchain - before both parties can sign atomic trade

● With Transaction Malleability Fix○ All atomic trade transactions can be signed before the deposit is stored in the blockchain

… Small difference? Huge implications for bitcoin contract design.

Page 22: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Atomically Trade across two forks without a fix for transaction malleability?

● Funding Stage○ Both parties deposit coins into the blockchain

● Setup Cancellation: ○ Bob will be able to cancel the atomic trade before Δcancel

● Setup Atomic Trade:○ Both Alice and Bob exchange Transfer transactions. ○ Alice must reveal a secret R of H(R) after Δfork to trigger the trade

● Setup Alice’s Forfeit: ○ Alice sets up a forfeit - if she does not reveal R before then ΔB Bob can claim all the coins.

● Commit to Trade○ Alice broadcasts a transaction after Δcancel that commits both parties to the atomic trade.

● Atomic Trade○ Alice reveals R after Δfork and claims her coins in FORK-2○ Bob finds R and claims his coins in FORK-1

Page 23: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Funding Stage

1. Funding Transaction: Stores deposit of both parties.

Block #1

Page 24: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Funding Stage

1. Funding Transaction: Stores deposit of both parties.

Block #1

Page 25: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Funding Stage

1. Funding Transaction: Stores deposit of both parties.

Block #1

Page 26: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Funding Stage

1. Funding Transaction: Stores deposit of both parties.

Block #1

Page 27: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Funding Stage

1. Funding Transaction: Stores deposit of both parties.

Block #1

Page 28: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Cancellation

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3

Block #1

Refund Alice

Refund Bob

Cancellation Transaction

Page 29: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Cancellation

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3

○ Signed by Alice and sent to Bob

Block #1

Refund Alice

Refund Bob

Cancellation Transaction

A

A

A

Why do we NEED a cancellation transaction?!

Later on, Alice will commit to reveal R of H(R).If R is not revealed - she’ll forfeit all coins to Bob.

If Alice refuses to make this commitment…This transaction lets Bob cancel the atomic trade

altogether.

Page 30: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Cancellation

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3

○ Signed by Alice and sent to Bob

Block #1

Refund Alice

Refund Bob

Cancellation Transaction

A

A

A

Page 31: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Cancellation

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3

○ Signed by Alice and sent to Bob

Block #1

Cancellation Transaction

Page 32: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Cancellation

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3

○ Signed by Alice and sent to Bob

Block #1

Cancellation Transaction

Page 33: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Cancellation

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3

○ Signed by Alice and sent to Bob

Block #1

Cancellation Transaction

Page 34: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Cancellation

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3

○ Signed by Alice and sent to Bob

Block #1

Cancellation Transaction

Page 35: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.

Block #1

Cancellation Transaction

Page 36: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.

Block #1

Cancellation Transaction

To Bob

Alice -> Bob Transfer

A

A

Page 37: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.

Block #1

Cancellation Transaction

To Bob

Alice -> Bob Transfer

A

A

Condition in Alice -> Bob Transfer:

Alice: “You can claim these coins Bob, if I reveal the secret R of H(R)”.

Page 38: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.

Block #1

Cancellation Transaction

To Bob

Alice -> Bob Transfer

A

A

Page 39: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Page 40: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Page 41: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Page 42: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Page 43: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Page 44: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

Block #1

Cancellation Transaction

To Alice

Bob -> Alice Transfer

B

B

Alice -> Bob Transfer

Page 45: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

Block #1

Cancellation Transaction

To Alice

Bob -> Alice Transfer

B

B

Condition in Bob -> Alice Transfer:

Bob: “You can claim these coins Alice, if I reveal the secret R of H(R)”.

**REPLAY PROTECTION REQUIRED**

Alice -> Bob Transfer

Page 46: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

Block #1

Cancellation Transaction

Bob -> Alice Transfer

Alice -> Bob Transfer

Page 47: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

Block #1

Cancellation Transaction

Bob -> Alice Transfer

Alice -> Bob Transfer

Page 48: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

Block #1

Cancellation Transaction

Bob -> Alice Transfer

Alice -> Bob Transfer

Page 49: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

Block #1

Cancellation Transaction

Bob -> Alice Transfer

Alice -> Bob Transfer

Page 50: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Bob -> Alice Transfer

To Bob

Alice -> Bob Forfeit FORK-1

A

A

Alice -> Bob Transfer

Page 51: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Bob -> Alice Transfer

Alice -> Bob Forfeit FORK-1

Page 52: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Bob -> Alice Transfer

Alice -> Bob Forfeit FORK-1

Page 53: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Bob -> Alice Transfer

Alice -> Bob Forfeit FORK-1

Page 54: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Alice -> Bob Forfeit FORK-1

Page 55: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

To Bob

Alice -> Bob Forfeit FORK-2

A

A

Alice -> Bob Forfeit FORK-1

Page 56: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Alice -> Bob Forfeit FORK-2

Alice -> Bob Forfeit FORK-1

Page 57: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Alice -> Bob Forfeit FORK-2

Alice -> Bob Forfeit FORK-1

Page 58: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 59: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Setup Alice’s Forfeit

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

Block #1

Cancellation Transaction

Block #2

Alice -> Bob Transfer

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 60: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Both Parties Commit To Atomic Trade

1. Funding Transaction: Stores deposit of both parties.

2. Cancellation Transaction: Refunds all parties before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

5. Commit Transaction: Invalidates the cancellation transaction - and commits both parties to the trade! Only valid after Δcancel = Block 3

Block #1

Cancellation Transaction

Block #2 Block #3

Alice -> Bob Transfer

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 61: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction1. Funding Transaction: Stores deposit of both

parties. 2. Cancellation Transaction: Refunds all parties

before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

5. Commit Transaction: Invalidates the cancellation transaction - and commits both parties to the trade! Only valid after Δcancel = Block 3

Block #1

Cancellation Transaction

Block #2 Block #3

Anywhere

Commit Transaction

A

Alice -> Bob Transfer

Both Parties Commit To Atomic Trade

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 62: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction1. Funding Transaction: Stores deposit of both

parties. 2. Cancellation Transaction: Refunds all parties

before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

5. Commit Transaction: Invalidates the cancellation transaction - and commits both parties to the trade! Only valid after Δcancel = Block 3

Block #1

Cancellation Transaction

Block #2 Block #3

Commitment Transaction

Alice -> Bob Transfer

Both Parties Commit To Atomic Trade

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 63: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction1. Funding Transaction: Stores deposit of both

parties. 2. Cancellation Transaction: Refunds all parties

before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

5. Commit Transaction: Invalidates the cancellation transaction - and commits both parties to the trade! Only valid after Δcancel = Block 3

Block #1

Cancellation Transaction

Block #2 Block #3

Commitment Transaction

Alice -> Bob Transfer

Both Parties Commit To Atomic Trade

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 64: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction1. Funding Transaction: Stores deposit of both

parties. 2. Cancellation Transaction: Refunds all parties

before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

5. Commit Transaction: Invalidates the cancellation transaction - and commits both parties to the trade! Only valid after Δcancel = Block 3

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Block #2 Block #3

Commitment TransactionAlice -> Bob

Transfer

Both Parties Commit To Atomic Trade

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 65: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction1. Funding Transaction: Stores deposit of both

parties. 2. Cancellation Transaction: Refunds all parties

before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed.a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

5. Commit Transaction: Invalidates the cancellation transaction - and commits both parties to the trade! Only valid after Δcancel = Block 3

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Block #2 Block #3

Commitment Transaction

Alice -> Bob Transfer

Both Parties Commit To Atomic Trade

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 66: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction1. Funding Transaction: Stores deposit of both

parties. 2. Cancellation Transaction: Refunds all parties

before Δcancel = Block 3a. Signed by Alice and sent to Bob

3. Transfer Transactions: Sends each party coins in the respective fork if R of H(R) is revealed. a. Alice signs A->B and sends to Bob.b. Bob signs B->A and sends to Alice.

4. Forfeit Transactions: Alice promises to reveal pre-image r of H(R) before ΔB = Block 7 otherwise Bob gets all coins.

5. Commit Transaction: Invalidates the cancellation transaction - and commits both parties to the trade! Only valid after Δcancel = Block 3

Block #1

Cancellation Transaction

Alice -> Bob Transfer

Block #2 Block #3

Commitment Transaction

Block #4

Alice -> Bob Transfer

Both Parties Commit To Atomic Trade

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 67: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Briefly what has happened so far…?

● Funding Stage○ Both parties deposit coins into the blockchain

● Setup Cancellation: ○ Bob will be able to cancel the atomic trade before Δcancel

● Setup Atomic Trade:○ Both Alice and Bob exchange Transfer transactions. ○ Alice must reveal a secret R of H(R) after Δfork to trigger the trade

● Setup Alice’s Forfeit: ○ Alice sets up a forfeit - if she does not reveal R before then ΔB Bob can claim all the coins.

● Commit to Trade○ Alice broadcasts a transaction after Δcancel that commits both parties to the atomic trade.

● Atomic Trade○ Alice reveals R after Δfork and claims her coins in FORK-2○ Bob finds R and claims his coins in FORK-1

Page 68: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Wait for hardfork…

1. Wait: Both parties must wait until the hardfork activates.

Block #1

Alice -> Bob Transfer

Block #2 Block #3

Commitment Transaction

Block #4

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 69: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Wait for hardfork…

1. Wait: Both parties must wait until the hardfork activates.

Block #1

Alice -> Bob Transfer

Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Alice -> Bob Transfer

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 70: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Bob -> Alice Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Alice triggers Trade

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade. She broadcasts Bob -> Alice Transfer Transaction which also reveals the pre-image R of H(R).

Block #1

Alice -> Bob Transfer

Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Bob -> Alice Transfer

Alice -> Bob Transfer

FORK-1

FORK-2

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 71: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice -> Bob Transfer

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Alice triggers Trade

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade. She broadcasts Alice -> Bob transfer transaction and reveals pre-image R of H(R).

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Bob -> Alice Transfer FORK-1

FORK-2

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 72: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Alice triggers Trade

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade. She broadcasts Alice -> Bob transfer transaction and reveals pre-image R of H(R).

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Bob -> Alice Transfer

Alice -> Bob Transfer

FORK-1

FORK-2

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 73: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Alice triggers Trade

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade. She broadcasts Alice -> Bob transfer transaction and reveals pre-image R of H(R).

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Bob -> Alice Transfer

Alice -> Bob Transfer

FORK-1

FORK-2

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 74: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Alice triggers Trade

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade: She broadcasts Alice -> Bob Transfer Transaction and reveals pre-image R of H(R).

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Bob -> Alice

Transfer

FORK-1

FORK-2

Alice -> Bob Transfer

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 75: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Bob claims his coins!

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade: She broadcasts Alice -> Bob Transfer Transaction and reveals pre-image R of H(R).

3. Bob Claims Coins: He finds R, and then broadcasts Bob -> Alice Transfer Transaction.

Block #1

Alice -> Bob Transfer

Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Bob -> Alice

Transfer

FORK-1

FORK-2

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 76: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Bob claims his coins!

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade: She broadcasts Alice -> Bob Transfer Transaction and reveals pre-image R of H(R).

3. Bob Claims Coins: He finds R, and then broadcasts Bob -> Alice Transfer Transaction.

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Alice -> Bob Transfer

Bob -> Alice

Transfer

FORK-1

FORK-2

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 77: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Bob claims his coins!

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade: She broadcasts Alice -> Bob Transfer Transaction and reveals pre-image R of H(R).

3. Bob Claims Coins: He finds R, and then broadcasts Bob -> Alice Transfer Transaction.

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Alice -> Bob Transfer

Bob -> Alice

Transfer

FORK-1

FORK-2

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 78: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Bob claims his coins!

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade: She broadcasts Alice -> Bob Transfer Transaction and reveals pre-image R of H(R).

3. Bob Claims Coins: He finds R, and then broadcasts Bob -> Alice Transfer Transaction.

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Alice -> Bob Transfer FORK-1

FORK-2Bob -> Alice

Transfer

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 79: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

Bob claims his coins!

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade: She broadcasts Alice -> Bob Transfer Transaction and reveals pre-image R of H(R).

3. Bob Claims Coins: He finds R, and then broadcasts Bob -> Alice Transfer Transaction.

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Alice -> Bob

TransferFORK-1

FORK-2Bob -> Alice

Transfer

Alice -> Bob Forfeit FORK-1

Alice -> Bob Forfeit FORK-2

Page 80: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Alice’s Deposit

Bob’s Deposit

Cancel Timer

Funding Transaction

All done!

1. Wait: Both parties must wait until the hardfork activates.

2. Alice Triggers Trade: She broadcasts Alice -> Bob Transfer Transaction and reveals pre-image R of H(R).

3. Bob Claims Coins: He finds R, and then broadcasts Bob -> Alice Transfer Transaction.

4. All done!

Block #1 Block #2 Block #3

Commitment Transaction

Block #4

HARDFORK BLOCK

Block #5

Alice -> Bob

TransferFORK-1

FORK-2Bob -> Alice

Transfer

Page 81: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

What are the problems? ● Elaborate

○ Four off-chain transaction required to set it up (and the bitcoin script is somewhat complex too)

● Potential to lock coins for long time○ If Alice doesn’t sign cancellation transaction, then coins are locked up and eventually refunded

after the hardfork.

● Hardfork Time must be FIXED. ○ If the hardfork is delayed after setup - Bob can potentially run away with all the coins!

…… What if Transaction Malleability is fixed?

paddyncl

Page 82: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Create 3 Transactions

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

To Bob

Alice claims coins in fork-2

To Alice

Bob claims coins in fork-1

Page 83: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Sign Transfer Transactions

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

To Bob

Alice claims coins in fork-2

A B

To Alice

Bob claims coins in fork-1

A B

Page 84: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both Parties Sign and Publish Funding Tx

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

Block #1

To Bob

Alice claims coins in fork-2

A B

To Alice

Bob claims coins in fork-1

A B

Page 85: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both Parties Sign and Publish Funding Tx

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

Block #1

To Bob

Alice claims coins in fork-2

A B

To Alice

Bob claims coins in fork-1

A B

Page 86: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both Parties Sign and Publish Funding Tx

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

Block #1

To Bob

Alice claims coins in fork-2

A B

To Alice

Bob claims coins in fork-1

A B

Page 87: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both Parties Sign and Publish Funding Tx

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

Block #1

To Bob

Alice claims coins in fork-2

A B

To Alice

Bob claims coins in fork-1

A B

Page 88: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both Parties Sign and Publish Funding Tx

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

Block #1

To Bob

Alice claims coins in fork-2

A B

To Alice

Bob claims coins in fork-1

A B

Page 89: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Wait for hardfork

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate

Block #1 Block #2

To Bob

Alice claims coins in fork-2

A B

To Alice

Bob claims coins in fork-1

A B

Page 90: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Wait for hardfork

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate

Block #1 Block #2 Block #3

To Bob

Alice claims coins in fork-2

A B

To Alice

Bob claims coins in fork-1

A B

Page 91: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Wait for hardfork

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

To Bob

Alice -> Bob Transfer

A B

To Alice

Bob -> Alice Transfer

A B

Page 92: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

Bob claims

coins in fork-1

Alice claims

coins in fork-2

FORK-1

FORK-2

Page 93: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

Bob claims

coins in fork-1

Alice claims

coins in fork-2

FORK-1

FORK-2

Page 94: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

Bob claims

coins in fork-1

Alice claims

coins in fork-2

FORK-1

FORK-2

Page 95: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

Bob claims

coins in fork-1

Alice claims

coins in fork-2 FORK-1

FORK-2

Page 96: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

Bob claims

coins in fork-1

Alice claims

coins in fork-2

FORK-1

FORK-2

Page 97: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

Bob claims

coins in fork-1

Alice claims

coins in fork-2

FORK-1

FORK-2

Page 98: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

Bob claims

coins in fork-1

Alice claims

coins in fork-2

FORK-1

FORK-2

Page 99: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5

Bob claims

coins in fork-1

Alice claims

coins in fork-2

FORK-1

FORK-2

Page 100: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5Alice

claims coins in fork-2

FORK-1

FORK-2

Bob claims

coins in fork-1

Page 101: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

Both Deposits

Funding Transaction

Both parties can claim after hardfork!

1. Create Transactions: One party (i.e. Alice) creates Funding Transaction, and both Transfer Transactions.

2. Sign Transfers: Both parties sign the transfer transactions off-chain.

3. Sign/Publish Deposit: Both parties sign Funding Transaction and publish to the blockchain.

4. Wait: Must wait for hardfork to activate 5. Claim: Both parties claim coins in respective

blockchain.

Block #1 Block #2 Block #3 Block #4

HARDFORK BLOCK

Block #5Alice

claims coins in fork-2

FORK-1

FORK-2

Bob claims

coins in fork-1

Page 102: Atomically Trading with Roger: Gambling on the withRoger.pdf · Atomically Trading with Roger: Gambling on the success of a hardfork* Patrick McCorry, Ethan Heilman, Andrew Miller

How easy was that? ● Similar to establishing a basic payment channel ● No need for either party to trigger the exchange● Hardfork time must still be FIXED… but no need for elaborate setup. ● Coins not locked for long time… (1 block after hardfork time).

… but when will this *actually* be useful?

...Segwit2x if replay protection is incorporated...

paddyncl http://homepages.cs.ncl.ac.uk/patrick.mc-corry/atomically-trading-roger.pdf


Recommended