sfrontori-bitcoin-technical intro-meetup2014
DESCRIPTION
My Bitcoin presentation during the Byte-Code MeetUP 2014TRANSCRIPT
Alice send money to Bob
Alice Bob
Bank
$
2
Trusted third party
!-5 Bob payment +150 salary -100 tax - 20 phone bill
Alice Ledger !+5 Alice Income +150 salary -100 tax - 20 phone bill
Bob Ledger
$ $$
3
2007 2009
Satoshi Nakamoto start of discuss on public ml
Satoshi Nakamoto published the final paper and the code on a public repository
4
Distributed Ledger
Global Ledger !
Alice 1095 Bob 505 Charly 420 !
!
bitcoin node
5
Transactions
Alice5 ฿
Bob
A: 1095 B: 505
A: 1100 B: 500
A: 1100 B: 500
A: 1095 B: 505
A: 1095 B: 505
update
6
Digital Signature provide a kind of contract, a smart contract.
public key
message
฿ Address: 1HYigr99wWvPsQH94o9UpN8cfawrX98DXT
private key
message
signatureCreate Verify
Alice
7
Ownership expressed in a chain
tnx 159d3… !2 ฿ !
Transaction Message !inputs: (from) ! Frank addrs : 159d341… Mary addrs: a443eb… !!outputs: (to) ! Bob addrs (1C3oAzan…) 5 ฿ ! !!!
tnx a443e… !3 ฿
Alice transaction
UNSPENT UNSPENT
8
9
Alice to Bob 5 ฿
tnx
Time
t=10:00 am t=10:11 amt=10:07 am
Bob: “tnx recived”
ship to Alice
t=10:09 am
Bob product
tnx
Alice to Alice 5 ฿
Check 1-(simple double spending)
11
Alice to Bob 5 ฿
Alice to Alice 5 ฿
Bob’s tnx - double spent, invalid!
Alice
10:00 am - Alice to Bob
10:11 am - Alice to Alice
t=10:09 am
Check 1-(transaction order)
12
Blocks
Unconfirmed Unordered tnx
tnx q5ed2…
tnx 159d3…
tnx c3g5a…tnx c32aa…
tnx d3e44…
tnx af5w3…
TimeOrdered tnx
Block #w1q23… ! prev: #3w22e… !tnx 2dsf3… tnx 8yyt5… tnx 975rf3…
t = t +10 min
t
13
The Block Chain
Block #w2a1q… ! prev: #sd21w… !tnx 012qd… tnx dds55… tnx 9neg2f…
Block #x89dw… ! prev: #w2a1q… !tnx f3gf5… tnx s22wd… tnx 9vfk3…
Block #3w22e… ! prev: #d43al… !tnx f3gf5… tnx s22wd… tnx 9vfk3…
Block #sd21w… ! prev: #3w22e… !tnx sd34r… tnx 55gfe… tnx 29sdf…
t=10:00 am t=10:10 am t=10:20 am t=10:30 am
?Time
14
Block #w2a1q… ! prev: #sd21w…
Block #x89dw… ! prev: #w2a1q…
Block #3w22e… ! prev: #d43al…
Block #sd21w… ! prev: #3w22e…
t=10:00 t=10:10 t=10:20 t=10:30 Time
Block #c72ss… ! prev: #w2a1q…
Block #29dd2… ! prev: #w2a1q…
Existing block
Potential next block
t=10:40
Alice to Bob 5 ฿
Alice to Alice 5 ฿
Block
Block
BlockBlock
BlockBlock
Block
Check 2 - (flood the end of the chain)
15
Block ID #
# prev Block
# Merkle root (tnx hashtree)
# next Block
Nonce value (random guess)
New Block
f.hash (block header) < target !
output of this function is a cryptographic hash SHA-256
!difficulty (target threshold) is adjusted by the network every 2016 block !10 min per block * 2016 = 2 weeks
Proof-of-Work - (hashing)
3345125676… 7452357854… 2048238545… 7535322244…
!!
9754535353…!5746353532…
?
(difficulty)
16
Distribution of probability to validate Blocks
prob
abili
ty
time to solve a Block
17
Block
Block #w2a
Block #x89d
Block #3w2
Block #sd21
Block #c72s
Block #29dd
Time
tnx back to the Unconfirmed pool
Check 3 - (last block recived)
18
Block
Block #w2a
Block #x89d
Block #c72s
Block #29dd
Time
Block
Check 3 - (last block recived)
19
Block Chain Branches - iteration 0
Node 1 Node 2 Node 3
branches branchesbranches
switch on the longest branch!
20
Block Chain Branches - iteration 1
Node 1 Node 2 Node 3
nB 1
nB 1
nB 1
branches branchesbranches
21
Node 1 Node 2 Node 3
nB1
nB1
nB1
branches branchesbranches
nB2
nB2
nB2
Block Chain Branches - iteration 2
22
Block Chain Branches - iteration 3
Node 1 Node 2 Node 3
nB2
nB1
nB2
branches branchesbranches
nB1
nB2
nB1
23
Check 5 - Double Spending with proof of work
Block 1 Block 2 Block 3 Block 4
Block 2A Block 3A Block 4A Block 5A
฿ A B
฿ A A
TimeBob box ship to Alice
Alice is trying to double spend her money
Alice self made chain
24
Check 5 - transaction order protected by race condition
Alice
Finish (validate)find x such that
f.hash (Block + x) < t
Time
10min
25
Where do bitcoins come from?
26
Mining - Incentive
BlBlock #w1q23… ! prev: #3w22e… !tnx 2dsf3… tnx 8yyt5… tnx 975rf3…
+ 25 ฿+ 50 ฿
+ 12.5 ฿+ 6.25 ฿
+ 0 ฿
27
28
Bitcoin miner address
29
30
Mining pool
31
Mining profitability?
mining hw cost + electricity cost (+ hw failures) -
mining reward =
profitability
32
bitcoin currency - (global info)
Last bitcoin will be mine on 2140 !
Total number bitcoin = 21.000.000 BTC !
Smallest unit (transferable)= 0.00000001 BTC !
6 Block in the chain confirmed, (1h) = tnx confirmed permanently
33
!!
TRUST 3rd party authority
CRYPTOGRAPHIC PROOF
NO Trust is needed
Recap
… ?
34
Questions ?
35