Pettycoin: Towards 1.0? Rusty Russell rusty@rustcorp.com.au - - PowerPoint PPT Presentation

pettycoin towards 1 0
SMART_READER_LITE
LIVE PREVIEW

Pettycoin: Towards 1.0? Rusty Russell rusty@rustcorp.com.au - - PowerPoint PPT Presentation

Pettycoin: Towards 1.0? Rusty Russell rusty@rustcorp.com.au Contents Pettycoin Background Massive Detour Contains Caveats and Notes! Pettycoin v2? Pettycoin Mining cost places lower limit on transaction fees Help cut


slide-1
SLIDE 1

Pettycoin: Towards 1.0?

Rusty Russell rusty@rustcorp.com.au

slide-2
SLIDE 2

Contents

  • Pettycoin Background
  • Massive Detour

– Contains Caveats and Notes!

  • Pettycoin v2?
slide-3
SLIDE 3

Pettycoin

  • Mining cost places lower limit on transaction

fees

– Help cut Gordian knot for bitcoin miners

slide-4
SLIDE 4

Pettycoin

  • Mining cost places lower limit on transaction

fees

– Help cut Gordian knot for bitcoin miners

  • Fun project...
slide-5
SLIDE 5

Pettycoin

  • Mining cost places lower limit on transaction

fees

– Help cut Gordian knot for miners

  • Fun project...
slide-6
SLIDE 6

Sabbatical

slide-7
SLIDE 7

Sabbatical

  • 6 months off
slide-8
SLIDE 8

Sabbatical

  • 6 months off

– 1 month vacation

slide-9
SLIDE 9

Sabbatical

  • 6 months off

– 1 month vacation – 1/day week Marcus

slide-10
SLIDE 10

Pettycoin Characteristics http://pettycoin.org

  • Functionaries gateway ↔ Bitcoin network
  • Limited to small amounts
  • Simpler transactions
  • Horizon
  • Partial Knowledge
  • Payback
  • Fast block times
slide-11
SLIDE 11

Aside: A Weird F/OSS Project

  • Altcoins
slide-12
SLIDE 12

Aside: A Weird F/OSS Project

  • Altcoins

Contains

ALL NEW

Crypto!

SUPER MEGA COIN!! JUST LIKE BITCOIN!*

*Product does not contain any bitcoins
slide-13
SLIDE 13

Aside: A Weird F/OSS Project

NOISE

slide-14
SLIDE 14

Aside: A Weird F/OSS Project

2,289,384 Announcements (Altcoins)

NOISE

slide-15
SLIDE 15

Aside: A Weird F/OSS Project

2,304,695 Announcements (Altcoins)

NOISE

  • Hard to reach/find people genuinely interested in

innovative ideas.

slide-16
SLIDE 16

Meanwhile...

slide-17
SLIDE 17

Sidechains

  • http://blockstream.com/sidechains.pdf
slide-18
SLIDE 18

What I Should Have Done...

slide-19
SLIDE 19

What I Should Have Done...

slide-20
SLIDE 20

What I Should Have Done...

– Bitcoin Basics – How Sidechains Work – Other Partial Knowledge Ideas

slide-21
SLIDE 21

Bitcoin Basics

  • Cryptographic hash functions
  • Bitcoin blocks
  • Bitcoin transactions
slide-22
SLIDE 22

Cryptographic Hash Functions

  • Cryptographic hash functions

– Hash takes some data, produces number

  • “Hi Rusty!” => 113,874,859,391,549,611,678,918,264,699,517,411,490,566,824,306,315,592,
823,661,988,754,055,674,729,523 <= 78 digits
slide-23
SLIDE 23

Cryptographic Hash Functions

  • Cryptographic hash functions

– Hash takes some data, produces number – No two things hash to the same value

  • “Hi Rusty!” => 113,874,859,391,549,611,678,918,264,699,517,411,490,566,824,306,315,592,
823,661,988,754,055,674,729,523
  • “hi Rusty!” =>
50,389,223,465,001,933,639,819,032,401,253,318,319,916,409,888,064,665, 201,997,103,129,362,843,385,322
slide-24
SLIDE 24

Cryptographic Hash Functions

  • Cryptographic hash functions

– Hash takes some data, produces number – No two things hash to the same value – No way to guess what data was except trying

everything

slide-25
SLIDE 25

Caveats & Notes I

  • I used SHA256. Bitcoin uses double-SHA256.
  • I know “no two things hash to the same value”

is impossible.

  • And I know there exists no mathematical proof

that it's even hard.

– There may be an efficient way to produce duplicate

hashes or calculate the reverse hash.

slide-26
SLIDE 26

Bitcoin Basics

  • Cryptographic hash functions
  • Bitcoin blocks
  • Bitcoin transactions

slide-27
SLIDE 27

Bitcoin Blocks

slide-28
SLIDE 28

Bitcoin Blocks

version prev txs timestamp target nonce

slide-29
SLIDE 29

Bitcoin Blocks

  • Bitcoin transactions are gathered into blocks

version prev txs timestamp target nonce

slide-30
SLIDE 30

Bitcoin Blocks

  • Bitcoin transactions are gathered into blocks
  • Each block refers to the last one, forming a

chain. version prev txs timestamp target nonce

slide-31
SLIDE 31

Bitcoin Blocks

  • Bitcoin transactions are gathered into blocks
  • Each block refers to the last one, forming a

chain.

  • Blocks are really hard to generate.

version prev txs timestamp target nonce

slide-32
SLIDE 32

Bitcoin Basics

  • Cryptographic hash functions
  • Bitcoin blocks
  • Bitcoin transactions

√ √

slide-33
SLIDE 33

Bitcoin Background

  • Transactions form a tree, with root in the block

header:

txs

slide-34
SLIDE 34

Bitcoin Background

  • Transactions form a tree, with root in the block

header:

txs

Tx-0 Tx-1 Tx-2 Tx-3

slide-35
SLIDE 35

Bitcoin Background

  • Transactions form a tree, with root in the block

header:

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3)

slide-36
SLIDE 36

Bitcoin Background

  • Transactions form a tree, with root in the block

header:

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1))

slide-37
SLIDE 37

Bitcoin Background

  • Transactions form a tree, with root in the block

header:

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3))

slide-38
SLIDE 38

Bitcoin Background

  • Transactions form a tree, with root in the block

header:

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3))

slide-39
SLIDE 39

Merkel Tree

http://commons.wikimedia.org/wiki/File:Angela_Merkel_August_2014.jpg http://commons.wikimedia.org/wiki/User:CDU_Sachsen CC BY-SA 4.0
slide-40
SLIDE 40

Merkle Tree

http://commons.wikimedia.org/wiki/File:Ralph_Merkle.png david.orban - http://www.flickr.com/photos/davidorban/1347574959/ CC BY 2.0
slide-41
SLIDE 41

Bitcoin Transactions

slide-42
SLIDE 42

Bitcoin Transactions

  • Every bitcoin transaction has inputs (TxIn) and
  • utputs (TxOut)
slide-43
SLIDE 43

Bitcoin Transactions

  • Every bitcoin transaction has inputs (TxIn) and
  • utputs (TxOut)

– Value of inputs >= value of outputs. – Each output can only be spent once.

slide-44
SLIDE 44

Bitcoin Transactions

  • Every bitcoin transaction has inputs (TxIn) and
  • utputs (TxOut)

– Value of inputs >= value of outputs. – Each output can only be spent once. – First tx has 1 fake input, generates coins

slide-45
SLIDE 45

Bitcoin Transactions

  • Every bitcoin transaction has inputs (TxIn) and
  • utputs (TxOut)

– Value of inputs >= value of outputs. – Each output can only be spent once. – First tx has 1 fake input, generates coins

  • Outputs have amount and a script

– “30 bitcoins. For a transaction signed by Alice”

slide-46
SLIDE 46

Bitcoin Transactions

  • Every bitcoin transaction has inputs (TxIn) and
  • utputs (TxOut)

– Value of inputs >= value of outputs. – Each output can only be spent once. – First tx has 1 fake input, generates coins

  • Outputs have amount and a script

– “30 bitcoins. For a transaction signed by Alice”

  • Inputs have a tx hash, output number, and script

– “Spend output N of TX X, and I, Alice, endorse this

transaction”

slide-47
SLIDE 47

Bitcoin Transactions

  • eg. Block 300,000:
slide-48
SLIDE 48

Bitcoin Transactions

  • eg. Block 300,000:

(Hash: 829,998,915,579,594,092,199,999,189, 296,919,999,871,189,997,254 => 48 digits)

slide-49
SLIDE 49

Bitcoin Transactions

  • eg. Block 300,000:
slide-50
SLIDE 50

Bitcoin Transactions

  • eg. Block 300,000:

TX 0: 9,399,969,399,996,839,989,456,721,927,078, 696,279,992,467,008,883,159,918,770,249,983

slide-51
SLIDE 51

Bitcoin Transactions

  • eg. Block 300,000:

TX 0: 9,399,969,399,996,839,989,456,721,927,078, 696,279,992,467,008,883,159,918,770,249,983 Output #0 Amount 25.0402836 BTC

slide-52
SLIDE 52

Bitcoin Transactions

  • eg. Block 300,000:

TX 0: 9,399,969,399,996,839,989,456,721,927,078, 696,279,992,467,008,883,159,918,770,249,983 Output #0 Amount 25.0402836 BTC Script: OP_DUP OP_HASH160 8,099,909,403, 581,993,994,608,699,192,999,412,599,691 OP_EQUALVERIFY OP_CHECKSIG

slide-53
SLIDE 53

Bitcoin Background

  • Was redeemed in block 300,588 in TX

1577232...

slide-54
SLIDE 54

Bitcoin Background

  • Was redeemed in block 300,588 in TX

1577232... TxIn #37:

Tx 9,399,969,399,996,839,989,456,721,927,078, 696,279,992,467,008,883,159,918,770,249,983 TxOut #0

slide-55
SLIDE 55

Bitcoin Background

  • Input script:

OP_PUSH<71> 3044022001005794df903dbb984f3106587a1aa848 c5067dc424f45870da9574225e85d2022017b1db57 66d1878b5076374ded3a782c9ba4b555bf8311524b 896f57aea8140201 OP_PUSH<33> 02b8c918bd169a5e669cc149549f822dd5f2c50872 eb83172a1c69172277fe378f

slide-56
SLIDE 56

Bitcoin Background

  • Input script:

OP_PUSH<71> <SIGNATURE> OP_PUSH<33> <PUBLIC KEY>

slide-57
SLIDE 57

Bitcoin Background

  • Input script:

OP_PUSH<71> <SIGNATURE> OP_PUSH<33> <PUBLIC KEY>

Signature

slide-58
SLIDE 58

Bitcoin Background

  • Input script:

OP_PUSH<71> <SIGNATURE> OP_PUSH<33> <PUBLIC KEY>

Public Key Signature

slide-59
SLIDE 59

Bitcoin Background

Public Key Signature

slide-60
SLIDE 60

Bitcoin Background

Public Key Signature

OP_DUP OP_HASH160 8,099,909,403,581,993,994,608,699,192,999, 412,599,691 OP_EQUALVERIFY OP_CHECKSIG

slide-61
SLIDE 61

Bitcoin Background

Public Key Signature Public Key

OP_DUP OP_HASH160 8,099,909,403,581,993,994,608,699,192,999, 412,599,691 OP_EQUALVERIFY OP_CHECKSIG

slide-62
SLIDE 62

Bitcoin Background

Public Key Signature 8,099,909...

OP_DUP OP_HASH160 8,099,909,403,581,993,994,608,699,192,999, 412,599,691 OP_EQUALVERIFY OP_CHECKSIG

slide-63
SLIDE 63

Bitcoin Background

Public Key Signature 8,099,909... 8,099,909...

OP_DUP OP_HASH160 8,099,909,403,581,993,994,608,699,192,999, 412,599,691 OP_EQUALVERIFY OP_CHECKSIG

slide-64
SLIDE 64

Bitcoin Background

Public Key Signature

OP_DUP OP_HASH160 8,099,909,403,581,993,994,608,699,192,999, 412,599,691 OP_EQUALVERIFY OP_CHECKSIG

slide-65
SLIDE 65

Bitcoin Background

1

OP_DUP OP_HASH160 8,099,909,403,581,993,994,608,699,192,999, 412,599,691 OP_EQUALVERIFY OP_CHECKSIG

slide-66
SLIDE 66

Bitcoin Background

1

OP_DUP OP_HASH160 8,099,909,403,581,993,994,608,699,192,999, 412,599,691 OP_EQUALVERIFY OP_CHECKSIG

slide-67
SLIDE 67

Caveats & Notes II

  • Numbers being pushed on the stack are usually just

printed; I made up OP_PUSH<> here to be explicit

  • Input script is often called scriptSig
  • Output script is often called scriptPubkey
  • The “signature” actually has a byte appended which

indicates what parts of the transaction it signed.

  • The RIPEMD160 of a ECDSA secp256k1 public key

is usually encoded for printing using bitcoin's base58 encoding method, and called a “bitcoin address”

slide-68
SLIDE 68

Sidechains

slide-69
SLIDE 69

Sidechains

  • Alternative chains which use real bitcoins

– But may have different/experimental protocol rules

slide-70
SLIDE 70

Sidechains: More Wasted Work?

slide-71
SLIDE 71

Sidechains: More Wasted Work?

2

2

slide-72
SLIDE 72

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

version prev txs timestamp target nonce

slide-73
SLIDE 73

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3))
slide-74
SLIDE 74

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 Tx-0
slide-75
SLIDE 75

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(sidechain header) Tx-0 Sidechain Header
slide-76
SLIDE 76

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(sidechain header) Tx-0 Sidechain Header
slide-77
SLIDE 77

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(sidechain header) Tx-0 Sidechain Header
slide-78
SLIDE 78

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(sidechain header) Tx-0 Sidechain Header
slide-79
SLIDE 79

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(sidechain header) Tx-0 Sidechain Header
slide-80
SLIDE 80

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(sidechain header) Tx-0 Sidechain Header
slide-81
SLIDE 81

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(sidechain header) Tx-0 Sidechain Header
slide-82
SLIDE 82

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(sidechain header) Tx-0 Sidechain Header
slide-83
SLIDE 83

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(Chain1) H(Chain2) H(Chain3) H(Chain4) Tx-0
slide-84
SLIDE 84

Sidechains: More Wasted Work?

slide-85
SLIDE 85

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(Chain1) H(Chain2) H(Chain3) H(Chain4) H(H(C1) H(C2)) H(H(C1) H(C2)) H(H(H(C1) H(C2)) H(H(C3) H(C4))) Tx-0
slide-86
SLIDE 86

Sidechains: More Wasted Work?

  • Bitcoin miners can mine other chains at the

same time

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Dummy Input 0 H(Chain1) H(Chain2) H(Chain3) H(Chain4) H(H(C1) H(C2)) H(H(C1) H(C2)) H(H(H(C1) H(C2)) H(H(C3) H(C4))) Tx-0 Chain header
slide-87
SLIDE 87

Sidechains

  • Alternative chains which use real bitcoins

– But may have different/experimental protocol rules

slide-88
SLIDE 88

Sidechains

  • Alternative chains which use real bitcoins

– But may have different/experimental protocol rules

  • Special bitcoin transactions send to the

sidechain.

slide-89
SLIDE 89

Sidechains

  • Alternative chains which use real bitcoins

– But may have different/experimental protocol rules

  • Special bitcoin transactions send to the

sidechain.

  • Special sidechain transactions return bitcoins to

bitcoin.

slide-90
SLIDE 90

Sidechains

  • Alternative chains which use real bitcoins

– But may have different/experimental protocol rules

  • Special bitcoin transactions send to the

sidechain.

  • Special sidechain transactions return bitcoins to

bitcoin.

  • Prove to the bitcoin network that the return

happened in the sidechain, and bitcoin will let you spend those bitcoins again.

slide-91
SLIDE 91

To Sidechain

  • A bitcoin transaction output script would “send”

bitcoins to the sidechain:

– <hash-of-sidechain-block>

OP_SIDECHAINPROOFVERIFY

slide-92
SLIDE 92

On the Sidechain...

  • Hey, a new OP_SIDECHAINPROOFVERIFY

bitcoin output for us!

slide-93
SLIDE 93

On the Sidechain...

  • Hey, a new OP_SIDECHAINPROOFVERIFY

bitcoin output for us!

… some time later...

slide-94
SLIDE 94

On the Sidechain...

  • Hey, a new OP_SIDECHAINPROOFVERIFY

bitcoin output for us!

… some time later...

  • That can now be spent like any other unspent

transaction output.

slide-95
SLIDE 95

On the Sidechain...

  • Hey, a new OP_SIDECHAINPROOFVERIFY

bitcoin output for us!

… some time later...

  • That can now be spent like any other unspent

transaction output.

… coins move around sidechain...

  • A special unspendable output script returns the

funds to the bitcoin network.

slide-96
SLIDE 96

Caveats & Notes III

  • In practice, would use proofs for bitcoin →

sidechain (as we'll see for the other way)

  • There's no BIP yet describing this, but the

unspendable output could be as simple as OP_RETURN.

  • My guess is:

– <bitcoin-genesis>

OP_RETURN <extra-script-to-be-evaluated-on-bitcoin-side>

slide-97
SLIDE 97

On The Sidechain

... ...

Block 0 Block 1 Block 2 Block 3 Block 4 Block N-1 Block N N+1 N+3 N+2

Return-to-bitcoin tx output
slide-98
SLIDE 98

… Back To Bitcoin

... ...

Block 0 Block 1 Block 2 Block 3 Block 4 Block N-1 Block N N+1 N+3 N+2

  • To spent the bitcoin

OP_SIDECHAINPROOFVERIFY output

– Prove the return-to-bitcoin tx is in the sidechain

... ...

Block 0 Block 1 Block 2 Block 3 Block 4 Block N-1 Block N N+1 N+3 N+2

Return-to-bitcoin tx output
slide-99
SLIDE 99

… Back To Bitcoin

... ...

Block 0 Block 1 Block 2 Block 3 Block 4 Block N-1 Block N N+1 N+3 N+2

  • Prove the tx is in block N
  • Prove block N is in sidechain.

... ...

Block 0 Block 1 Block 2 Block 3 Block 4 Block N-1 Block N N+1 N+3 N+2

Return-to-bitcoin tx output
slide-100
SLIDE 100

Prove TX in Block

txs

Tx-0

slide-101
SLIDE 101

Prove TX in Block

txs

H(Tx-0) H(Tx-1) H(Tx-2) H(Tx-3) H(H(Tx-0) H(Tx-1)) H(H(Tx-2) H(Tx-3)) Tx-0

slide-102
SLIDE 102

Prove Block in Sidechain

slide-103
SLIDE 103

Prove Block in Sidechain

  • Provide every block back to genesis?
slide-104
SLIDE 104

Compact SPV Proofs

slide-105
SLIDE 105

Compact SPV Proofs

  • Since every block has to hash below some

target value...

slide-106
SLIDE 106

Compact SPV Proofs

  • Since every block has to hash below some

target value...

– ½ the blocks will be ½ the target or less. – ⅓ the blocks will be ⅓ the target or less. – 1/100 will be 1/100 of the target...

slide-107
SLIDE 107

Compact SPV Proofs

  • Since every block has to hash below some

target value...

– ½ the blocks will be ½ the target or less. – ⅓ the blocks will be ⅓ the target or less. – 1/100 will be 1/100 of the target...

  • You may skip back N if your hash is <=

target/N. => log(N) steps to get back to genesis.

slide-108
SLIDE 108

Compact SPV Proofs

  • How do we put all the previous block hashes in

the block header?

slide-109
SLIDE 109

Compact SPV Proofs

  • How do we put all the previous block hashes in

the block header?

slide-110
SLIDE 110

Compact SPV Proofs

  • How do we put all the previous block hashes in

the block header?

– Merkle Tree!

  • For 1M blocks, ~60 block headers and ~550

merkle proof hashes

slide-111
SLIDE 111

Caveats & Notes IV

  • Number of hashes is very sensitive to topology of

merkle tree. See rustyjunk on github (WIP)

  • Your path from N+<number> to genesis must

include N, so it won't be quite this good.

  • Target changes, so you need to include the actual

distance in difficulty steps in your tree.

  • CSPV proofs do not ratchet like normal blockchain:

a 10% attacker has 10% chance of producing a valid-looking winner.

slide-112
SLIDE 112

...Back To Bitcoin

... ...

Block 0 Block 1 Block 2 Block 3 Block 4 Block N-1 Block N N+1 N+3 N+2 Return-to-bitcoin tx output
slide-113
SLIDE 113

...Back To Bitcoin

Return-to-bitcoin tx output

... ...

Block 0 Block 1 Block 2 Block 3 Block 4 Block N-1 Block N N+1 N+3 N+2 Block N' N'+1 N'+3 N'+2 N'+4
slide-114
SLIDE 114

...Back To Bitcoin

  • We need to wait for some contest period to

allow “reorganization proofs”.

Return-to-bitcoin tx output

... ...

Block 0 Block 1 Block 2 Block 3 Block 4 Block N-1 Block N N+1 N+3 N+2 Block N' N'+1 N'+3 N'+2 N'+4
slide-115
SLIDE 115

Caveats & Notes V

  • Reorganization proofs will presumably “invalidate”

by consuming transaction outputs and producing a new OP_SIDECHAINPROOFVERIFY output.

  • Gregory Maxwell suggests that transactions which

simply consume OP_SIDECHAINPROOFVERIFY

  • utputs to combine them into a single

OP_SIDECHAINPROOFVERIFY output could be done without proofs, to make return txs smaller.

slide-116
SLIDE 116

OP_SIDECHAINPROOFVERIFY

slide-117
SLIDE 117

OP_SIDECHAINPROOFVERIFY

  • Adding a new script opcode to bitcoin forks the

protocol.

slide-118
SLIDE 118

OP_SIDECHAINPROOFVERIFY

  • Adding a new script opcode to bitcoin forks the

protocol.

– Old clients must still see the transaction as valid. – eg. rename OP_NOP3.

slide-119
SLIDE 119

http://www.vitacost.com/momma-toddler-soft-fork-orange-1-piece

slide-120
SLIDE 120

OP_SIDECHAINPROOFVERIFY

  • Expensive
slide-121
SLIDE 121

OP_SIDECHAINPROOFVERIFY

  • Expensive:

– Block headers of merge-mined sidechains are

about 500 bytes.

– Hashes are 32 bytes. – => Block 1M == 60*500 + 550*32 == 48k.

slide-122
SLIDE 122

OP_SIDECHAINPROOFVERIFY

  • Expensive:

– Block headers of merge-mined sidechains are

about 500 bytes.

– Hashes are 32 bytes. – => Block 1M == 60*500 + 550*32 == 48k.

  • Slow:

– Maybe 1 day confirmation requirement, 1 day

contest period.

slide-123
SLIDE 123

Atomic Swaps

slide-124
SLIDE 124

Atomic Swaps

  • Alice has 1 pettycoin. Bob has 1 bitcoin.
slide-125
SLIDE 125

Atomic Swaps

  • Alice: “To redeem this 1 pettycoin you need to

present the value that hashes to X, and Bob's signature”

slide-126
SLIDE 126

Atomic Swaps

  • Alice: “To redeem this 1 pettycoin you need to

present the value that hashes to X, and Bob's signature” OR “Alice can have it after 48 hours”

slide-127
SLIDE 127

Atomic Swaps

  • Alice: “To redeem this 1 pettycoin you need to

present the value that hashes to X, and Bob's signature” OR “Alice can have it after 48 hours”

  • Bob: “To redeem this 1 bitcoin to need to

present the value that hashes to X, and Alice's signature” OR “Bob can have it after 24 hours”

slide-128
SLIDE 128

Atomic Swaps

  • Alice: “To redeem this 1 pettycoin you need to

present the value that hashes to X, and Bob's signature” OR “Alice can have it after 48 hours”

  • Bob: “To redeem this 1 bitcoin to need to

present the value that hashes to X, and Alice's signature” OR “Bob can have it after 24 hours”

  • Alice uses the 1 bitcoin output, revealing the

value that hashes to X.

slide-129
SLIDE 129

Atomic Swaps

  • Alice: “To redeem this 1 pettycoin you need to

present the value that hashes to X, and Bob's signature” OR “Alice can have it after 48 hours”

  • Bob: “To redeem this 1 bitcoin to need to

present the value that hashes to X, and Alice's signature” OR “Bob can have it after 24 hours”

  • Alice uses the 1 bitcoin output, revealing the

value that hashes to X.

  • Bob can now use the 1 pettycoin.
slide-130
SLIDE 130

Caveats & Notes VI

  • Requires transaction malleability to be resolved

(BIP 62) or OP_CHECKTIMELOCKVERIFY (BIP 65) (better!)

slide-131
SLIDE 131

Sidechains Technology

  • Merkle trees
  • Merge mining
  • Sophisticated scripting language
  • Soft fork
  • Compact SPV proofs
  • Atomic swaps
slide-132
SLIDE 132

Sidechains Technology

  • Merkle trees[1]
  • Merge mining[2]
  • Sophisticated scripting language[3]
  • Soft fork[4]
  • Compact SPV proof[5]
  • Atomic swaps[6]
[1] 2008: S Nakamoto Bitcoin: A Peer-to-Peer Electronic Cash System [2] 2009? [3] 2014: BIP 65 https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki [4] 2012: BIP 16, BIP 30, BIP34 [5] 2012: The High Value Hash Highway https://bitcointalk.org/index.php?topic=98986.0 [6] 2013: T. Nolan, Re: Alt chains and atomic transfers, https://bitcointalk.org/index.php?topic=193281.msg2224949
slide-133
SLIDE 133
slide-134
SLIDE 134

Sidechains Paper Side Effect

slide-135
SLIDE 135

Exposure To Other Ideas

slide-136
SLIDE 136

Exposure To Other Ideas

  • Funding protocol bootstrap
  • Proving Flaws using Partial Knowledge
  • Calculating Fees with Partial Knowledge
  • Proving Non-existent TX Inputs
  • Proving Double Spends
  • Proving All Block Information Is Available
slide-137
SLIDE 137
  • Funding protocol bootstrap
  • Proving Flaws using Partial Knowledge
  • Calculating Fees with Partial Knowledge
  • Proving Non-existent TX Inputs
  • Proving Double Spends
  • Proving All Block Information Is Available

Exposure To Other Ideas

slide-138
SLIDE 138

Exposure To Other Ideas

  • Funding protocol bootstrap
  • Proving Flaws using Partial Knowledge
  • Calculating Fees with Partial Knowledge
  • Proving Non-existent TX Inputs
  • Proving Double Spends
  • Proving All Block Information Is Available

See https://en.bitcoin.it/wiki/User:Gmaxwell/features#Proofs And http://rustyrussell.github.io/pettycoin/ Pettycoin Revisited parts 1-7.

slide-139
SLIDE 139

Partial Knowledge

  • Is the miner collecting fair rewards?
slide-140
SLIDE 140

Partial Knowledge

  • Is the miner collecting fair rewards?

– Pettycoin uses a lottery, “random” transaction

chosen and multiplied.

slide-141
SLIDE 141

Partial Knowledge

  • Is the miner collecting fair rewards?
slide-142
SLIDE 142

Partial Knowledge

  • Is the miner collecting fair rewards?

H(Tx-0)

Fee(Tx-0)

H(Tx-1)

Fee(Tx-1)

H(H&Fee(Tx-0) H&Fee(Tx-1))

Fee(Tx-0) + Fee(Tx-1)

H(H&Fee(Tx-0) ... H&Fee(Tx-3))

Fee(Tx-0) + ... + Fee(Tx-3)

slide-143
SLIDE 143

Non-existent Inputs

  • Block N contains TX1 which spend output from

TX <made-up-hash>?

slide-144
SLIDE 144

Non-existent Inputs

  • Block N contains TX1 which spend output from

TX <made-up-hash>?

– Pettycoin miners attach backrefs which say where

in chain you can find the input transactions:

txs

H+R(Tx-0) H(H+R(Tx-0) H+R(Tx-1)) H(H+R(Tx-2) H+R(Tx-3)) Tx-0 Input Refs
slide-145
SLIDE 145

Non-existent Inputs

  • Block N contains TX1 which spend output from

TX <made-up-hash>?

– UTXO commitments.

slide-146
SLIDE 146

UTXO Commitments

  • Include every Unspent Transaction Output in

the header.

slide-147
SLIDE 147

UTXO Commitments

  • Include every Unspent Transaction Output in

the header.

slide-148
SLIDE 148

UTXO Commitments

  • Include every Unspent Transaction Output in

the header.

– For each input, attach proof that it was in UTXO

tree.

– For each output, attach proof showing where it goes

in (updated) UTXO tree.

slide-149
SLIDE 149

UTXO Commitments

  • Include every Unspent Transaction Output in

the header.

txs

H+U(Tx-0) H(H+U(Tx-0) H+U(Tx-1)) H(H+U(Tx-2) H+U(Tx-3)) Tx-0 UTXO Proofs

UTXOs

slide-150
SLIDE 150

Caveats & Notes VII

  • A patricia trie is usually suggested for this

structure.

  • If it's keyed by Txid then output, it's fairly trivial

to group output insertion into a single proof.

slide-151
SLIDE 151

Proving Double Spends

slide-152
SLIDE 152

Proving Double Spends

  • Pettycoin relied on someone reporting (with

proof) that a TX output was used before.

  • UTXO commitments make this impossible

anyway.

slide-153
SLIDE 153

Fast Block Times

slide-154
SLIDE 154

Fast Block Times

  • 10 second blocks.
slide-155
SLIDE 155

Fast Block Times

  • 10 second blocks.
  • 1% of blocks take over 46 seconds.
  • Accept “easy” block after 20 seconds passed,

with a modified heuristic to determine which easy block wins.[1]

[1] http://rustyrussell.github.io/pettycoin/2014/10/30/More-Regular-Block-Times.html
slide-156
SLIDE 156

Caveats and Notes VIII

  • Convergence difficult unless propagation time

>> block time.

– GHOST helps here[1] – 10 seconds is probably close to lower bound.

  • Bitcoin's testnet does this horribly using

timestamps: don't copy!

[1] Accelerating Bitcoin's Transaction Processing Y Sompolinsky, A Zohar https://eprint.iacr.org/2013/881.pdf
slide-157
SLIDE 157

What Does This Mean for Pettycoin?

slide-158
SLIDE 158

What Does This Mean for Pettycoin?

slide-159
SLIDE 159

What Does This Mean for Pettycoin?

  • Need to be more bitcoin-like.

=> Just use the bitcoin reference code.

(But there may be many sidechains to copy)

slide-160
SLIDE 160

What Does This Mean for Pettycoin?

  • Need to be more bitcoin-like.

=> Just use the bitcoin reference code.

(But there may be many sidechains to copy)

  • We now have a name for what we built.

– Pettychain?

slide-161
SLIDE 161

What Does This Mean for Pettycoin?

  • Need to be more bitcoin-like.

=> Just use the bitcoin reference code.

(But there may be many sidechains to copy)

  • We now have a name for what we built.

– Pettychain?

  • Fastchain should be a separate sidechain

experiment.

slide-162
SLIDE 162

Thanks

  • My family.
  • Robert Collins
  • Bitcoin wizards, esp. Gregory Maxwell.
  • IBM
slide-163
SLIDE 163

Thanks

  • My family.
  • Robert Collins
  • Bitcoin wizards, esp. Gregory Maxwell.
  • IBM
slide-164
SLIDE 164

Thanks

  • My family.
  • Robert Collins
  • Bitcoin wizards, esp. Gregory Maxwell.
  • IBM
slide-165
SLIDE 165

Questions?