Blockchain
mathematical contracts and Internet
of money
by: Davide Carboni. March 2015 Creative Commons Attribution-ShareAlike CC BY-SA
money is ...
asset but not goods
backed by gold or other goods
based on trust (all accept money)
money is ...
recognizable
divisible
valid
transportable
transferable
difficult to counterfait
money is ...
organized in national currencies
issued by authorities (do we trust them?)
tied to political trends
exchanged directly only if cash
exchanged by intermediare in all other cases
money should ...
be durable
be storable in a safe say
be minted in a fair way
have a stable value during time
Bitcoin ...
is a digital asset
has a value based on trust
has a counter value in traditional currency
is 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.org
2009 - Bitcoin launch, 1st trans. Satoshi to
Han Finley
2010 - Lazlo buys pizza for 10000BTC
Timeline ...
2010 - MtGox ($->BTC)
2010 - 1 BTC = 0,50$
2011 - 1 BTC = 10$
2011 - Silk Road
2012 - 50K BTC stolen at Linode
Timeline ...
2012 - Coinbase
2012 - BoostVC for Bitcoin startups
2012 - Bitcoin foundation
2012 - Wordpress accepts i Bitcoin
2013 - 1 BTC = 100$
Timeline ...
2013 - Bitcoin ATM San Diego
2013- Coinbase 5M$ funding
2013 - FBI “closes” Silk Road
2013 - Nov: 1BTC>1200$
2013 - China declares BTC is illegal
2014 - few people jailed for money laundering
How to receive Bitcoins
Generate a Bitcoin address
One address --> 2 keys
Private key is to spend
Public key is to receive
Keys 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
transazione
in out
transazione
in out
transazione
in out
Blockchain
Es. proof-of-work
Es. Given A + nonce
find 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 work
In principle you can do a try with a pencil and
succeed
In 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/sec
Jan 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 China
5pm 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 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
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
balance
less blocks with more tx
Scalability
transactions per second
VISA 2000
Paypal 120
Bitcoin 7
Comparison
Bitcoin Litecoin Namecoin
hashing 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,
decentralized
secure (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 of
100 BTC
from Alice to Bob
on birthday
Alice:
Bob: 100 BTC
Redeem rule::
date > birthday
Contracts: escrow
Tx
100 BTC
buy with escrow
seller K3:
trusted 3rd party K2:
buyer K1:
Redeem:
2 out of 3
Contracts: Testament
Tx
1000 BTC
Heir:
Oracolo
Nonno:
Redeem if:
is Granpa dead?
is Heir >18
granfather died ?
R.I.P
Think about your testament
Your 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 paper
https://bitcoin.org/bitcoin.pdf
The wiki
http://bitcoin.it/
Books
Libri

The Bitcoin blockchain (en)