Bitcoin Tutorial Ec14
Bitcoin Tutorial Ec14
The Rachel & Selim Benin School of Eng. and Computer Science
The Hebrew University
In this tutorial:
• Increase
competition
• Disrupt
Blue: 2
Red: 1
Blue: 2
Blue: 2 Red: 1
Blue: 2
Red: 1
Red: 1
Blue: 2
Blue: 2 Red: 1
Red: 1
Blue: 2
Blue: 2 Red: 1
Red: 1
Transactions are thus public, addresses are (free) pseudonyms
The Double-spend problem
2
Blue: 3
Red: 1
Blue: 2
Green:
Red: 11
Hash
Inconsistency may occur if blocks
are created simultaneously by
different nodes
Crypt. Hash
Solution: 00000001011011001
10101001011011001
1. Make block creation hard.
2. Adopt conflicting blocks if they make Must be a small number for
up a longer chain. valid block
(under some target value)
If not, change Nonce & try again
A 𝐵12 C
A 𝐵1 C
A 𝐵1 C
𝐵2
The Double-Spend Attack
A payment can be reversed!
Easy if attacker has >50% of compute power
Possible with less than 50%
New Block
Hash Nonce
Reward the
authorizer with
fees from each
transaction
(+ newly minted
Coinbase Tx
money)
Honest chain
length minus -1 0 1 2 3
attacker’s
If we ever
get here,
Attacker
wins 𝑛 blocks built by honest nodes, attacker
has strength 𝑞 → probability distribution
over initial states ∈ {𝑛, 𝑛 − 1, 𝑛 − 2, … }.
The Result:
Attacker’s strength: 𝑞 < 0.5
Receiver’s policy: wait for 𝑛 confirmations
Security matters!
paper wallets / cold
storage.
Transactions
Each transaction is a transfer of money
from inputs to outputs
(many-to-many)
1 BTC
1.1 BTC
Inputs 1 BTC
Txn Outputs
1.5 BTC 0.5 BTC
Txn
Transactions Txn
Some outputs
cannot be redeemed.
Scripts allow for much more…
k out of n signatures
Delayed payments
Savings accounts
P2P bets
Derivatives
Distributed exchanges
or in alternative chains
Altcoins
Many Bitcoin clones
Zerocoin / Zerocash
[Ben-Sasson, Chiesa, Garman, Green, Miers, Tromer, and Virza]
2.5 minutes
12 seconds
More forks in
chain
More forks in
chain
Modest
increase in
TPS
Higher block
Larger blocks
creation rates
More forks in
chain
Modest
Lower
increase in
security
TPS
B GHOST
Longest
B’ Chain
Attacker’s
Secret
Chain
The Pull Towards
Centralization
Advantage of large miners:
Economies of scale (e.g. datacenters in Iceland)
Block distribution to self not needed.
Attractive connections for other miners
Outcome:
Large miners gain more than proportional share.
Drive small miners out of business.
System becomes centralized.
Miner
Hash rate distribution (from Blockchain.info)
How (not) to split rewards
Miners that contribute more should get
higher reward.
Mining
Split wins proportionately Pool
Server
Miner
The first share may be worth a lot (if block found right
after)
The 50th share is already very “diluted”
Hash Hash
P. Block Hash
…
…
Nonce
Merkle Root
Other Fields…
Hash
00001001011011001
Smaller than
target value
Light nodes
Running a full Bitcoin node root
Hash
Hash Hash
Other Fields…
Show a Merkle branch to the
output.