The Bitcoin blockchain (en)

57
Blockchain mathematical contracts and Internet of money by: Davide Carboni. March 2015 Creative Commons Attribution-ShareAlike CC BY-SA

Transcript of The Bitcoin blockchain (en)

Page 1: The Bitcoin blockchain (en)

Blockchainmathematical contracts and Internet of money

by: Davide Carboni. March 2015 Creative Commons Attribution-ShareAlike CC BY-SA

Page 2: The Bitcoin blockchain (en)

money is ...

asset but not goodsbacked by gold or other goodsbased on trust (all accept money)

Page 3: The Bitcoin blockchain (en)

money is ...

recognizabledivisiblevalidtransportabletransferabledifficult to counterfait

Page 4: The Bitcoin blockchain (en)

money is ...

organized in national currencies issued by authorities (do we trust them?)tied to political trendsexchanged directly only if cashexchanged by intermediare in all other cases

Page 5: The Bitcoin blockchain (en)

money should ...

be durablebe storable in a safe saybe minted in a fair wayhave a stable value during time

Page 6: The Bitcoin blockchain (en)

Bitcoin ...

is a digital assethas a value based on trusthas a counter value in traditional currencyis not controlled by any authority (trustless control)

Page 7: The Bitcoin blockchain (en)

Unique features

● Only “no-intermediated*” payment that can occur remotely

● Transactions are irreversible

(*)Thousands of intermediaries = no intermediaries

Page 8: The Bitcoin blockchain (en)

from Coinbase

from Google Trends

Page 9: The Bitcoin blockchain (en)

How many?

cap 21,000,000 circa

2030

time

21 millions

Page 10: The Bitcoin blockchain (en)
Page 11: The Bitcoin blockchain (en)

- Un collettivo di Hacker ?

Page 12: The Bitcoin blockchain (en)

Timeline

2008 - paper Bitcoin, sourforge, Bitcoin.org2009 - Bitcoin launch, 1st trans. Satoshi to Han Finley2010 - Lazlo buys pizza for 10000BTC

Page 13: The Bitcoin blockchain (en)

Timeline ...

2010 - MtGox ($->BTC)2010 - 1 BTC = 0,50$2011 - 1 BTC = 10$2011 - Silk Road2012 - 50K BTC stolen at Linode

Page 14: The Bitcoin blockchain (en)

Timeline ...

2012 - Coinbase2012 - BoostVC for Bitcoin startups2012 - Bitcoin foundation2012 - Wordpress accepts i Bitcoin2013 - 1 BTC = 100$

Page 15: The Bitcoin blockchain (en)

Timeline ...

2013 - Bitcoin ATM San Diego2013- Coinbase 5M$ funding2013 - FBI “closes” Silk Road2013 - Nov: 1BTC>1200$2013 - China declares BTC is illegal2014 - few people jailed for money laundering

Page 16: The Bitcoin blockchain (en)

How to receive Bitcoins

Generate a Bitcoin addressOne address --> 2 keysPrivate key is to spendPublic key is to receiveKeys are managed by a Wallet

Page 17: The Bitcoin blockchain (en)

Bitcoin address

An example of a Bitcoin address is 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy

our public key

Page 18: The Bitcoin blockchain (en)

How to spend a coin

Use the private key to sign a transaction

Send the transaction in the p2p net

...and then ...

Page 19: The Bitcoin blockchain (en)

Blockchain

Immutable, append only database of all transactions copied and synced in all peers

Transaction are grouped in blocks.

Blocks are appended in avg every 10’

Page 20: The Bitcoin blockchain (en)

Transaction

0.001 tip

Page 21: The Bitcoin blockchain (en)

Who appends on the Blockchain

every 10’ (avg time) someone solves a cryptopuzzle named proof-of-work with generate the next valid block to be appended

Who solve the puzzle is also minting new money (25BTC)

Page 22: The Bitcoin blockchain (en)

Mining

● New tx are broadcast to all nodes.

● Each node collects new tx. into a block.

● If proof-of-work, it broadcasts the block

● Nodes accept the block only if all tx in it are valid.

● Nodes express acceptance using the hash of the

accepted block as the “previous hash” for next block.

Page 23: The Bitcoin blockchain (en)

blocco

In summary

blocco blocco blocco blocco blocco

transazionein out

transazionein out

transazionein out

Blockchain

Page 24: The Bitcoin blockchain (en)

Es. proof-of-work

Es. Given A + noncefind nonce which generate one hash starting with 10 zeros

hash(A+nonce) =0000000000345872342642....

BRUTE FORCE!!

Page 25: The Bitcoin blockchain (en)

proof-of-work?

You are allowed to append a new block if you do a given amount of workIn principle you can do a try with a pencil and succeedIn practice the more computing power you have the more prob. to succeed

Page 26: The Bitcoin blockchain (en)

Mining ... minting

In avg every 10’, the whole network succeed in generating the block

The more are the participants the more the puzzle is difficult (20 zeros instead of 10)

Page 27: The Bitcoin blockchain (en)

Mining

So, I turn on my PC, run the software and I can mine new

money?

Page 28: The Bitcoin blockchain (en)

Difficulty

Avg Time to generate a block = Difficulty * 2^32 / hashrate

Page 29: The Bitcoin blockchain (en)

1 PC + GPU (1MHash/sec)

when difficulty avg time to mine with laptop

Jan 2010 1 1 h

Jan 2012 1E6 136 years

Jan 2015 40E9 5M years

Page 30: The Bitcoin blockchain (en)

Hashrate di tutta la rete Bitcoin

Page 31: The Bitcoin blockchain (en)

The Whole network power

350 PHash/secJan 2015

Page 32: The Bitcoin blockchain (en)

Hashrate distribution (feb 2015)

Page 33: The Bitcoin blockchain (en)

ASIC

solo mining = 400 days, generates circa 2BTC per month (Feb 2015)

Page 34: The Bitcoin blockchain (en)

Operations in Blockchain

5pm block A closed in China5pm block B closed in Italy

blocco blocco blocco blocco blocco A

Blockchain propagated from Cina

blocco blocco blocco blocco blocco B

Blockchain propogated from Italy

Page 35: The Bitcoin blockchain (en)

Biforcation

At5:01 all nodes see both heads

blocco blocco blocco blocco

blocco A

blocco B

Page 36: The Bitcoin blockchain (en)

Biforcation

Some select A as new head

blocco blocco blocco blocco

blocco A

blocco B

Some others select B

blocco blocco blocco

blocco blocco

Page 37: The Bitcoin blockchain (en)

Biforcation

The protocol says “the longest survive, the other must be pruned”

block block block block

orphan A

block B block block block

orphan orphan

Page 38: The Bitcoin blockchain (en)

51% attack

Who controls 51% of total hashing rate could:-revoke a payment (double spend)-hinder someone else payments

Also democracy is vulnerable to 51% attack

Page 39: The Bitcoin blockchain (en)

Scalability

Bitcoin blockchain is more than 30GB file and must be synced among 6000+ nodes

solutions: pruning all data related to address with zero balanceless blocks with more tx

Page 40: The Bitcoin blockchain (en)

Scalability

transactions per second

VISA 2000

Paypal 120

Bitcoin 7

Page 41: The Bitcoin blockchain (en)

Comparison

Bitcoin Litecoin Namecoinhashing SHA256 Scrypt SHA256

cap 21 M circa 84 M circa 21 M

value* 250 $ 2 $ 0,5 $

confirm Time 10 min 2 min 10 min

(*) al 18 Feb 2015

Page 42: The Bitcoin blockchain (en)

Why Namecoin

Zooko’s Triangle

Conjecture :a name space cannot be at same time

mnemonic,decentralizedsecure (aka global)

Page 43: The Bitcoin blockchain (en)

Zooko’s conjecture looks true...

Page 44: The Bitcoin blockchain (en)

...but it is not

Namecoin uses blockchain to save key,values

DNS decentralized, mnemonic and secure (global)

Page 45: The Bitcoin blockchain (en)

Namecoin

● domain .bit -- es. davide.bit● browser plugin FreeSpeechMe● one domain costs 0.01NMC● expires after 36000 blocks(ca. 200 days)

Page 46: The Bitcoin blockchain (en)

Anonymous? No, pseudonymous

A bitcoin transaction is as anonymous as exchanging notes in a crowded square wearing a mask. Someone could recognize us

Page 47: The Bitcoin blockchain (en)

Mixing transactions

A 1.0 a B

C 1.33 a D

C 1.33 a D

A 1.0 a B

Who’s paying whom?

Page 48: The Bitcoin blockchain (en)

IBM/Samsung ADEPT

Page 49: The Bitcoin blockchain (en)
Page 50: The Bitcoin blockchain (en)
Page 51: The Bitcoin blockchain (en)

Contracts: gift

Tx of100 BTC

from Alice to Bobon birthday

Alice:

Bob: 100 BTCRedeem rule:: date > birthday

Page 52: The Bitcoin blockchain (en)

Contracts: escrow

Tx100 BTC

buy with escrow

seller K3:

trusted 3rd party K2:

buyer K1:

Redeem: 2 out of 3

Page 53: The Bitcoin blockchain (en)

Contracts: Testament

Tx1000 BTC

Heir:

Oracolo

Nonno:

Redeem if: is Granpa dead?is Heir >18

granfather died ?

Page 54: The Bitcoin blockchain (en)

R.I.P

Think about your testamentYour bitcoins can be lost forever if you don't have a backup plan for your peers and family. If the location of your wallets or your passwords are not known by anyone when you are gone, there is no hope that your funds will ever be recovered. Taking a bit of time on these matters can make a huge difference.(from Bitcoin.org)

Page 55: The Bitcoin blockchain (en)

References

Satoshi Nakamoto paperhttps://bitcoin.org/bitcoin.pdf

The wikihttp://bitcoin.it/

Page 56: The Bitcoin blockchain (en)

Books

Page 57: The Bitcoin blockchain (en)

Libri