Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

63
Metadata in the Blockchain: The OP_RETURN Explosion Coin Sciences Ltd http://coinspark.org/

description

With the addition of OP_RETURN outputs in version 0.9, it's now possible to attach arbitrary pieces of information to bitcoin transactions. This turns bitcoin into a low-level communications protocol, just like TCP/IP, on which many new applications can be built. Despite its powerful features, bitcoin is also limited, costly and inefficient compared to TCP/IP. After discussing which sorts of applications make this trade-off worthwhile, we talk about CoinSpark, a new open source protocol for enhancing bitcoin transactions, which makes extensive use of OP_RETURNs.

Transcript of Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Page 1: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Metadata in the Blockchain: The OP_RETURN Explosion

Coin Sciences Ltd http://coinspark.org/

Page 2: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

If Bitcoin = Gold 2.0 then …

What is the intrinsic value of a bitcoin?

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 3: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

What has gone wrong? (1)

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 4: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Early Internet growth

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

http

://h

omes

.cs.

was

hing

ton.

edu/

~laz

owsk

a/fa

cult

y.le

ctur

e/in

nova

tion

/hpc

c/in

tern

et/h

osts

.htm

l

Page 5: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

What has gone wrong? (2)

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 6: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Gartner hype cycle

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 7: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

What has gone wrong? (3)

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

3% (PayPal)

Page 8: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

What is bitcoin for?

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 9: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

A hypothesis…

Page 10: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Bitcoin as communication

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 11: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

What can we send?

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

An expensive way to encode information

Page 12: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Fake addresses

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Permanent burden on unspent output list

Page 13: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Multisig addresses (1 of …)

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Temporary burden on unspent output list

Page 14: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

The OP_RETURN decision

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

https://bitcoinfoundation.org/2013/10/core-development-update-5/

Page 15: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

OP_RETURNs

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Provably prunable, no unspent output

Page 16: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

OP_RETURN size limit

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 17: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

OP_RETURNs vs TCP/IP

OP_RETURNs TCP/IP Ratio

Address space 2160 (collisions) 232 → 2128 1×

Latency 5 seconds 1 second 5×

Packet size 40 bytes 1.5 KB 36×

Bandwidth ~100 bytes/s (50% of network!)

5 MB/s (50% of 100 Mbps)

50,000×

Cost $850,000/GB (at $315/BTC)

$0.10/GB 10,000,000×

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 18: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

So why use bitcoin?

Page 19: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Asynchronicity?

Bitcoin TCP/IP Email

Asynchronous Synchronous Asynchronous

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 20: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Notarization

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Bitcoin TCP/IP

Blockchain None

Page 21: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Message chaining

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Bitcoin TCP/IP

Directed acyclic graph

Request-response only

Page 22: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Privacy

Bitcoin TCP/IP

Addresses Pseudonymous but transaction chain analysis

IP geolocation, traceable to

individual via ISP

Payloads Naked in public Private but seen by ISPs, switches

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 23: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Payment model

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Bitcoin TCP/IP

Per message, with message

Subscription or pay-per-use, separate

Page 24: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

So bitcoin is suitable for…

•  Tiny payload •  High value

– Hashes in general

•  Public broadcast •  Permanently recorded •  Non-instant •  Pay-as-you-go

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 25: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Financial transactions

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 26: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Document notarization

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Bitproof, BlockSign, LaPreuve, Proof of Existence, Stampd, Stampery

Page 27: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Historical records

•  Blog post about stuff in blockchain

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Lots more: http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photographs.html

Page 28: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Email with scarcity?

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 29: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Universal family tree?

•  Show a family tree (DAG)

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

http://recursivediscursion.blogspot.com/2011/04/gentle-introduction-to-graph-theory.html

Page 30: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

0.0

0.5

1.0

1.5

2.0

2.5

3.0

25xxxx

26xxxx

27xxxx

28xxxx

29xxxx

30xxxx

31xxxx

32xxxx

33xxxx

34xxxx

35xxxx

Bitcoin block numbers (each column ~70 days)

OP_RETURNs per block

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Bitcoin 0.9 released 19th March 2014 (block 291xxx)

Page 31: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

OP_RETURNs to block 353900

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

31%

10%

9% 8% 6%

3%

33%

Open%Assets%Proof%of%Existence%CoinSpark%Factom%Ascribe%BlockSign%Other%

Page 32: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Where’s the DNS?

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

1NXckgtwL3i8yXKC3exFPcdpsQmFbL4WTF

Page 33: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark

Page 34: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark

•  Rich OP_RETURN protocol – Multiple metadata per OP_RETURN

•  Version 1.0 — September 2014 – Assets = lightweight scalable colored coins – Payment references

•  Version 2.0 — February 2015 – Transaction attachments / messaging

•  Version 3.0: simpler addressing, …

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 35: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark assets

•  Assets via OP_RETURN metadata – Not connected to bitcoin quantity

•  Genesis metadata: – Quantity, issuer transaction fees – Compressed web page URL – Hash of contract and key params

•  Transfer metadata: – Reference to genesis, quantity, outputs

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 36: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark assets for users

•  Lightweight wallet •  Asset web page

– View in browser – Hidden metadata – Domain authenticates issuer

•  Asset contract – Ready US + UK templates – Customizable

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 37: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

SparkBit wallet

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 38: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Asset web page

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 39: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Asset contract

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 40: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Bitcoin transaction model

Signed by Alice

Alice 10.000 Bob 2.000

Alice 7.999

Miner 0.001

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 41: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark asset model

•  Multiple assets per output – Low burden on network – No accidental loss

•  Default: all assets to last output •  Metadata sends to other outputs

– 40 bytes: up to 3 assets, unlimited outputs

•  Asset independence ⇒ scalability –  Issuer provides tracking server for SPV

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 42: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Example asset transaction

Signed by Alice

Alice 0.007

Bob 0.001

Alice 0.005

OP_RETURN

Miner 0.001

A B C

B

A C

B

Output 1

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

150

60

60

90

Page 43: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark messages

•  Attach text and/or files to a bitcoin or CoinSpark asset transaction

•  Message discovery via OP_RETURN – Compressed URL / IP of delivery server – Outputs for which message intended – Hash of message + salt

•  Open source delivery server – Federated, non-centralized model

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 44: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark messages vs email

•  Hash proves message authenticity •  Notarization of message on blockchain

– Contracts, invoices, digital delivery

•  Also: public messages – Broadcast content + proof of existence

•  Future: message encryption – Requires public key, not just bitcoin address

•  Challenge: identity (Openname?)

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 45: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark OP_RETURN format

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

53   50   4B   CoinSpark marker (“SPK”)

61   FF  — Last metadata opcode

···· Last metadata (until end of script)

01   60   Length of this metadata section —

61   FF  — Metadata opcode

···· Metadata (up to 95 bytes) *

Page 46: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Metadata opcodes

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

61   7F  —

67  

72  

74  

80   EF  —

Reserved for CoinSpark

Asset genesis (“g”)

Payment reference (“r”)

Asset transfer (“t”)

Your application?

6D   Message pointer (“m”)

Page 47: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Every byte is sacred

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 48: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Every byte is sacred

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 49: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Only encode surprises

000 = omit fields. If this is the first color transfer, assume input and output indices of 0. Otherwise take the indices from the previous color transfer. 001 = omit fields. If this is the first color transfer, assume input index 0 and output index 1. Otherwise take the indices from the previous color transfer and increment the output index only. 010 = omit fields. If this is the first color transfer, assume input index 1 and output index 0. Otherwise take the indices from the previous color transfer and increment the input index only. 011 = omit input index and use 1 byte for output index. If this is the first color transfer, assume input index 0. Otherwise use the same input index as the previous color transfer. 100 = omit output index and use 1 byte for input index. If this is the first color transfer, assume output index 0. Otherwise use the same output index as the previous color transfer. 101 = use 1 byte for input index, 1 byte for output index. 110 = use 1 byte for input index, 2 bytes for output index. 111 = use 2 bytes for input index, 2 bytes for output index.

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 50: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Mantissa and exponent

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

625 trillion = 625×1012

??11001001110001  

Page 51: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Common domain strings www.  .at  .au  .be  .biz  .br  .ca  .ch  .cn  

.co.jp  

.co.kr  

.co.uk  

.co.za  .co  

.com.ar  

.com.au  

.com.br  

.com.cn  

.com.mx  

.com.tr  

.com.tw  

.com.ua  .com  .cz  

.de  

.dk  .edu  .es  .eu  .fr  .gov  .gr  .hk  .hu  .il  .in  

.info  .ir  .it  .jp  .kr  .me  .mx  .net  .nl  .no  .org  .pl  

.ps  

.ro  

.ru  

.se  

.sg  

.tr  

.tv  

.tw  

.ua  

.uk  

.us  

.vn    

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 52: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

More domain name compression

•  38 valid characters – 0 to 9, a to z, -­‐ .  

•  Two terminator characters ⇒ 40 – http:// vs https://  

•  403 = 64000 < 65536 = 216 – So 3 characters per byte pair

•  Special case: IPv4 address – Obvious encoding in 4 bytes

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 53: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Variable hash length ≥ 96 bits

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

350,000,000 × 109 × 86400 × 365 × 7178 = 296

Page 54: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

CoinSpark for Developers

•  Fully open source (MIT/AGPL) •  Multilingual libraries

– C/C++, Go, Java, JS, PHP, Python, Ruby

•  Fully decentralized – Server-side elements federated

• Let’s do for bitcoin what the web did for TCP/IP

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 55: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Back to the start…

What is the intrinsic value of a bitcoin?

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 56: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

0.0

0.2

0.4

0.6

0.8

1.0

1.2

2011 2012 2013 2014 2015 2016 2017 2018 2019

Average block size (MB)

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Current limit: 1 MB

Economic prehistory

Economic reality

Page 57: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

What happens then?

•  Transactions compete for confirmation – Bidding via miner fee, paid only in bitcoin

•  Real price discovery – Econ 101: until supply = demand

•  If enough transactions (notarization?) are worth $10 to sender, all will cost that – No more cups of coffee!

•  Increase to 20MB blocks just delays this

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 58: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

So: bitcoin = global bidding power for embedding data in

the blockchain.

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 59: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

More from Coin Sciences

Page 60: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Coin Secrets – coinsecrets.org

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 61: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

php-OP_RETURN

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

•  Send OP_RETURN using Bitcoin Core – Doing it yourself is hard work!

•  Store and retrieve any data in blockchain – Uses OP_RETURNs in chained transactions – Returns reference like 356115-052075 for

easy and fast retrieval

•  Use on command line or PHP library – Python and Ruby to come

Page 62: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

MultiChain

•  Private blockchain platform – Targeted at financial sector – Drop-in replacement for Bitcoin Core

•  Easy and quick deployment – Custom network parameters

•  Permission management •  Native asset support •  Version 1 beta in June 2015

Coin Sciences Ltd Metadata in the Blockchain http://coinspark.org/

Page 63: Bitcoin 2.0 and OP_RETURN - The Blockchain as TCP/IP?

Questions?