The Bitcoin blockchain (en)

Post on 19-Mar-2017

534 views 0 download

Transcript of The Bitcoin blockchain (en)

Blockchainmathematical contracts and Internet of money

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

money is ...

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

money is ...

recognizabledivisiblevalidtransportabletransferabledifficult to counterfait

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

money should ...

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

Bitcoin ...

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

Unique features

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

● Transactions are irreversible

(*)Thousands of intermediaries = no intermediaries

from Coinbase

from Google Trends

How many?

cap 21,000,000 circa

2030

time

21 millions

- Un collettivo di Hacker ?

Timeline

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

Timeline ...

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

Timeline ...

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

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

How to receive Bitcoins

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

Bitcoin address

An example of a Bitcoin address is 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy

our public key

How to spend a coin

Use the private key to sign a transaction

Send the transaction in the p2p net

...and then ...

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’

Transaction

0.001 tip

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)

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.

blocco

In summary

blocco blocco blocco blocco blocco

transazionein out

transazionein out

transazionein out

Blockchain

Es. proof-of-work

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

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

BRUTE FORCE!!

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

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)

Mining

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

money?

Difficulty

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

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

Hashrate di tutta la rete Bitcoin

The Whole network power

350 PHash/secJan 2015

Hashrate distribution (feb 2015)

ASIC

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

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

Biforcation

At5:01 all nodes see both heads

blocco blocco blocco blocco

blocco A

blocco B

Biforcation

Some select A as new head

blocco blocco blocco blocco

blocco A

blocco B

Some others select B

blocco blocco blocco

blocco blocco

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

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

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

Scalability

transactions per second

VISA 2000

Paypal 120

Bitcoin 7

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

Why Namecoin

Zooko’s Triangle

Conjecture :a name space cannot be at same time

mnemonic,decentralizedsecure (aka global)

Zooko’s conjecture looks true...

...but it is not

Namecoin uses blockchain to save key,values

DNS decentralized, mnemonic and secure (global)

Namecoin

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

Anonymous? No, pseudonymous

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

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?

IBM/Samsung ADEPT

Contracts: gift

Tx of100 BTC

from Alice to Bobon birthday

Alice:

Bob: 100 BTCRedeem rule:: date > birthday

Contracts: escrow

Tx100 BTC

buy with escrow

seller K3:

trusted 3rd party K2:

buyer K1:

Redeem: 2 out of 3

Contracts: Testament

Tx1000 BTC

Heir:

Oracolo

Nonno:

Redeem if: is Granpa dead?is Heir >18

granfather died ?

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)

References

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

The wikihttp://bitcoin.it/

Books

Libri