First talk: My life as a blockchain transaction
Presentation Given our Sydney Tech Share meetup with Yann Rouillard.
You are interested in the blockchain but you are still a bit confused about how it works? Don’t wait anymore to dive into it!
In this first talk, we will shed the light on all the dark mechanisms of the blockchain by following the life of an innocent transaction from its birth to its eternal rest in the blockchain immutable history.
Cryptography, Network propagation, Proof of work, Transaction execution... nothing will be hidden from you. The only sad thing is that blockchain might not seem so magical to you after this talk. :)
https://www.meetup.com/en-AU/Tech-Share-Sydney-Meetup/events/249111190/
Streamlining Python Development: A Guide to a Modern Project Setup
Blockchain: life of a blockchain transaction
1. 402/55 Lime Street Sydney 2000 NSW > AUSTRALIA> WWW.OCTO.COM
My life as a Blockchain Transaction
Yann Rouillard + Erwan Alliaume - April 2018
Deep dive into the blockchain
2. 2OCTO TECHNOLOGY > THERE IS A BETTER WAY
WHO ARE WE?
Yann Rouillard
Senior consultant / expert DevOps
Erwan Alliaume
Senior consultant / CTO
3. 3OCTO TECHNOLOGY > THERE IS A BETTER WAY
How to buy us
a beer using
bitcoin…
from your wallet to ours
through the blockchain
4. OCTO TECHNOLOGY > THERE IS A BETTER WAY 4
LIFECYCLE OVERVIEW
1F1tAaz5x1HUXrCNLM
ACCOUNT CREATION
OCTO TECHNOLOGY > THERE IS A BETTER WAY
5. OCTO TECHNOLOGY > THERE IS A BETTER WAY 5
TRANSACTION
PREPARATION
LIFECYCLE OVERVIEW
Tx
1F1tAaz5x1HUXrCNLM
ACCOUNT CREATION
OCTO TECHNOLOGY > THERE IS A BETTER WAY
6. OCTO TECHNOLOGY > THERE IS A BETTER WAY 6
TRANSACTION
SUBMISSION
LIFECYCLE OVERVIEW
Tx
1F1tAaz5x1HUXrCNLM
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
TRANSACTION
PREPARATION
ACCOUNT CREATION
OCTO TECHNOLOGY > THERE IS A BETTER WAY
7. OCTO TECHNOLOGY > THERE IS A BETTER WAY 7
TRANSACTION
EXECUTION
TRANSACTION
SUBMISSION
Tx
1F1tAaz5x1HUXrCNLM
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
TRANSACTION
PREPARATION
ACCOUNT CREATION
LIFECYCLE OVERVIEW
OCTO TECHNOLOGY > THERE IS A BETTER WAY
8. OCTO TECHNOLOGY > THERE IS A BETTER WAY 8
MINING PROCESS
Tx
1F1tAaz5x1HUXrCNLM
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
TRANSACTION
EXECUTION
TRANSACTION
SUBMISSION
TRANSACTION
PREPARATION
ACCOUNT CREATION
LIFECYCLE OVERVIEW
OCTO TECHNOLOGY > THERE IS A BETTER WAY
9. OCTO TECHNOLOGY > THERE IS A BETTER WAY 9
MINING PROCESS
LIFECYCLE OVERVIEW
Tx
1F1tAaz5x1HUXrCNLM
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx Tx
Tx
Tx
Tx
TRANSACTION
EXECUTION
TRANSACTION
SUBMISSION
TRANSACTION
PREPARATION
ACCOUNT CREATION
OCTO TECHNOLOGY > THERE IS A BETTER WAY
10. OCTO TECHNOLOGY > THERE IS A BETTER WAY 10
LIFECYCLE OVERVIEW
Tx
1F1tAaz5x1HUXrCNLM
Tx
MINING PROCESS
TRANSACTION
EXECUTION
TRANSACTION
SUBMISSION
TRANSACTION
PREPARATION
ACCOUNT CREATION
TRANSACTION
CONFIRMATION
OCTO TECHNOLOGY > THERE IS A BETTER WAY
11. OCTO TECHNOLOGY > THERE IS A BETTER WAY 11
Account creation
Transaction preparation
Transaction submission
Transaction execution
Mining process
Lifecycle of a transaction:
Some definitions first!
Transaction confirmation
12. OCTO TECHNOLOGY > THERE IS A BETTER WAY 12
THE ORIGIN: THE CYPHERPUNK MOVEMENT
13. OCTO TECHNOLOGY > THERE IS A BETTER WAY 13
WHAT IS A CRYPTO-CURRENCY?
Scarcity Fungibility
Transferability Divisibility
Durability
A crypto-currency is a virtual currency that
uses cryptography to guarantee
currency essential properties
14. OCTO TECHNOLOGY > THERE IS A BETTER WAY 14
SOME FAMOUS CRYPTO-CURRENCIES
Dogecoin
Bitcoin Dash
Litecoin
Ether Ripple
OCTO TECHNOLOGY > THERE IS A BETTER WAY
15. OCTO TECHNOLOGY > THERE IS A BETTER WAY 15
Early 19th-century German ledger
WHAT IS A LEDGER?
Not a very
new thing !
16. OCTO TECHNOLOGY > THERE IS A BETTER WAY 16
WHAT IS A DISTRIBUTED LEDGER?
Centralised Ledger Distributed Ledger
17. OCTO TECHNOLOGY > THERE IS A BETTER WAY 17
WHAT IS A BLOCKCHAIN?
A blockchain is
one of the possible implementations
of a distributed ledger
where transactions are stored
in a series of cryptography-linked blocks
18. OCTO TECHNOLOGY > THERE IS A BETTER WAY 18
Account creation
Transaction preparation
Transaction submission
Transaction execution
Mining process
Lifecycle of a transaction:
Account creation
Transaction confirmation
19. OCTO TECHNOLOGY > THERE IS A BETTER WAY 19
WHAT IS AN ACCOUNT?
An account is a uniquely identified object that will be
able to issue transactions and store currency
Two problems:
● how to create a unique identifier without
a central authority?
● how to ensure transactions has been legitimely
issued from an account?
20. OCTO TECHNOLOGY > THERE IS A BETTER WAY 20
WHAT IS AN ACCOUNT?
An account is a uniquely identified object that will be
able to issue transactions and store currency
Two problems:
● how to create a unique identifier without
a central authority?
● how to ensure transactions has been legitimely
issued from an account?
Cryptography to
the rescue!
21. OCTO TECHNOLOGY > THERE IS A BETTER WAY 2
1
3
CRYPTOGRAPHY 101: ELECTRONIC SIGNATURE
IN ONE SLIDE
Not
John
Private
key
Public
key
✗
Someone’s private key
Someone else’s private key
≠
Key
generator
Private
key
Public
key
John
Lorem ipsum
dolor alok sit
amet, tipeke
consectetur
adipiscing so
elit, sed do
eiusmod te
Document
Sign
Signature
Verify
✓
Lorem ipsum
dolor alok sit
amet, tipeke
consectetur
adipiscing so
elit, sed do
eiusmod te
22. OCTO TECHNOLOGY > THERE IS A BETTER WAY 22
IN ONE SLIDE
01010001000110001011
11010100101110101010
10010101010101010101
01010110101001010101
01010101010100101010
10100101010101010100
1010100101101
0x32ab7f65
Original input
Hash value
✗
CRYPTOGRAPHY 101: CRYPTOGRAPHIC HASH FUNCTION
01010001000110001011
11010100101110101010
10010101010101010101
01010110101001010101
01010101010100101010
10100101010101010100
1010100101101
0x32ab7f65
Any size
Fixed size
01010001000110001011
11010100101110101010
10010101010101010101
01010110101001010101
01010101010100101010
10100101010101010100
1010100101100
0x47f42e10
Small change
Big change
01010001000110001011
11010100101110101010
10010101010101010101
01010110101001010101
01010101010100101010
10100101010101010100
1010100101101
0x32ab7f65
11001000100010010101
01010101010101101010
10101011010101010101
01010101010100010101
01001010010001001010
00100010000011111101
0111011111111
≠
Original
input
Different
input
✗
23. OCTO TECHNOLOGY > THERE IS A BETTER WAY 23
ACCOUNT CREATION: STANDARD MECHANISM
Private
key
Public
key
1. Key generation
Most blockchain use
Elliptic Curve Algorithms
2. Public Key Hashing
Ensure shorter address
Protect against attack
on Public key
3. Address Encoding
0bed7abd61247635c197
3eb38474a2516ed1d884
Make it (a bit more)
readable
24. OCTO TECHNOLOGY > THERE IS A BETTER WAY 24
NICE WARNINGA NICE WARNING
OCTO TECHNOLOGY > THERE IS A BETTER WAY
YOU ARE (often)
PSEUDONYMOUS
NOT ANONYMOUS
25. OCTO TECHNOLOGY > THERE IS A BETTER WAY 25
Account creation
Transaction preparation
Transaction submission
Transaction execution
Mining process
Lifecycle of a transaction:
Transaction preparation
Transaction confirmation
26. OCTO TECHNOLOGY > THERE IS A BETTER WAY 26
WHAT IS A TRANSACTION
The pay-us-a-beer transaction
Issuer Recipients
Transactions scripts
“ Send to addresses ”
Amount
27. OCTO TECHNOLOGY > THERE IS A BETTER WAY 27
APPEND-ONLY LEDGER
Create 25 coins and credit to You
Transfert 17 coins from You to Erwan
Transfert 8 coins from Erwan to Yann
Transfert 5 coins from Yann to You
Transfert 15 coins from You to Erwan
Is it valid?
Time
Might need to scan
backwards until genesis!
asserted by miners
signed by you
signed by Erwan
signed by Yann
signed by You
Source: https://youtu.be/t7sGcST61sM
28. OCTO TECHNOLOGY > THERE IS A BETTER WAY 28
A TRANSACTION-BASED LEDGER LIKE BITCOIN
Is it valid?
Time
Input: Ø Outputs: You=25
1 1
Input: Outputs: You=8 Erwan=17
2 1 211
Input: Outputs: Erwan=9 Yann=83 1 22 2
Input: Outputs: Yann=3 You=13
4 1 2
2 1
3 2
Input: Outputs: You=-2 Erwan=24
5 1
4 2
2
3 1
Finite scan to
check validity
WTF!!!
Source: https://youtu.be/t7sGcST61sM
29. OCTO TECHNOLOGY > THERE IS A BETTER WAY 29
BITCOIN TRANSACTION BOOKKEEPING
You have
10 bitcoins
as base
balance
Tx1: pay-me-a-beer
Input 1 Output 1
Output 2
Unspent = your balance
10 - 1 = 9
easy!
1 bitcoin
9 bitcoins
unspent
Tx2: don’t forget Yann!
Input 1 Output 1
Output 2
1 bitcoin
5 bitcoins
unspent
Unspent = your balance
9 - 1 = 5 ??Really??
Yes, you gave 3 bitcoins as mining fees
9 - 1 -5 = 3
Inputs
Bitcoins to spend
Each input is a signed reference
from a previous trnx
Outputs
Assign to new
owners
Each output can be used by only 1
input do avoid double spend
Unspent outputs = balance of somebody
This is what we call bitcoins (add all unspent of a public ledger to
know how many bitcoins has the chain
Mining fees
sum(inputs) - sum(outputs)
30. OCTO TECHNOLOGY > THERE IS A BETTER WAY 30
TRANSACTION SIGNATURE
The pay-us-a-beer transaction
Input 1 Output 1
Digital
signature
Public key
1. You are paying the beer, so
you have to sign your
transaction with your private
key
2. You have to attach the the
signature and your public key
to the transaction so anybody
can check it
This process can be
done offline!
31. OCTO TECHNOLOGY > THERE IS A BETTER WAY 31
OK OK, BUT WHAT ARE THE TRANSACTION SCRIPT
YOU WERE TALKING ABOUT
Bitcoin is using a stack
based language
Often limited instructions set
No-Loops in bitcoin
Sender choose the script
(but could be refused)
ByteCode running in a
Virtual Machine
32. OCTO TECHNOLOGY > THERE IS A BETTER WAY 32
SCRIPTING CAPABILITIES ARE DIFFERENT
FROM ONE BLOCKCHAIN TO ANOTHER!
33. OCTO TECHNOLOGY > THERE IS A BETTER WAY 33
BITCOIN SCRIPT EXECUTION, A REAL LIFE EXAMPLE
<< Public Key >>
<< Signature>>
Check Transaction signature script!
99% of created transactions in bitcoin are using this script!
OP_DUP
OP_HASH160
<< PubKeyHash? >>
OP_EQUAL_VERIFY
OP_CHECK_SIG
Script
scriptPubKey
(output)
Signature
scriptSig
(input)
<< Public Key >>
<< Signature>>
Duplicate top of
the stack
<< Public Key >>
Hash top of the
stack
Source: https://youtu.be/ci1jFDRPoCw
INSTRUCTIONS MEMORY
34. OCTO TECHNOLOGY > THERE IS A BETTER WAY 34
BITCOIN SCRIPT EXECUTION, A REAL LIFE EXAMPLE
<< Public Key >>
<< Signature>>
Check Transaction signature script!
99% of created transactions in bitcoin are using this script!
OP_DUP
OP_HASH160
<< PubKeyHash? >>
OP_EQUAL_VERIFY
OP_CHECK_SIG
<< Public Key >>
<< Signature>>
<< Pub Key Hash >>
<< Pub Key Hash? >>
Public key hash
given by the
sender
Check 2 top
stack values
Check the
signature!
Source: https://youtu.be/ci1jFDRPoCw
INSTRUCTIONS MEMORY
Script
scriptPubKey
(output)
Signature
scriptSig
(input)
35. OCTO TECHNOLOGY > THERE IS A BETTER WAY 35
Account creation
Transaction preparation
Transaction submission
Transaction execution
Mining process
Lifecycle of a transaction:
Transaction submission
Transaction confirmation
36. OCTO TECHNOLOGY > THERE IS A BETTER WAY 36
FIRST STEP: FIND YOUR FRIENDS
To be able to do anything on the
blockchain, you must first...
Client node
Discover the blockchain network!
37. OCTO TECHNOLOGY > THERE IS A BETTER WAY 37
Bootstrap node
Bootstrap node
FIRST STEP: FIND YOUR FRIENDS
To be able to do anything on the
blockchain, you must first...
Client node
Discover the blockchain network!
1. Find Bootstrap nodes
139.218.14.2
92.164.12.8
Hardcoded
addresses
38. OCTO TECHNOLOGY > THERE IS A BETTER WAY 38
FIRST STEP: FIND YOUR FRIENDS
To be able to do anything on the
blockchain, you must first...
Client node
Discover the blockchain network!
1. Find Bootstrap nodes
2. Find Peer nodes
Bootstrap node
Bootstrap node
Unknown nodesKnown nodes
39. OCTO TECHNOLOGY > THERE IS A BETTER WAY 39
FIRST STEP: FIND YOUR FRIENDS
To be able to do anything on the
blockchain, you must first...
Client node
Discover the blockchain network!
1. Find Bootstrap nodes
2. Find Peer nodes
3. Connect to random nodes
Bootstrap node
Bootstrap node
Unknown nodesKnown nodes
The whole network is
eventually interconnected
40. OCTO TECHNOLOGY > THERE IS A BETTER WAY 40
SECOND STEP: GOSSIP WITH YOUR FRIENDS
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
OCTO TECHNOLOGY > THERE IS A BETTER WAY
Principle
Just forward every transaction to
your neighbours!
41. OCTO TECHNOLOGY > THERE IS A BETTER WAY 41
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Why it is cool?
● Reliable in case of failure
SECOND STEP: GOSSIP WITH YOUR FRIENDS
OCTO TECHNOLOGY > THERE IS A BETTER WAY
Tx
Tx
Tx
Principle
Just forward every transaction to
your neighbours!
42. OCTO TECHNOLOGY > THERE IS A BETTER WAY 42
SECOND STEP: GOSSIP WITH YOUR FRIENDS
OCTO TECHNOLOGY > THERE IS A BETTER WAY
Principle
Just forward every transaction to
your neighbours!
Why it is cool?
● Reliable in case of failure
● Guaranteed delivery in
bounded time
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Less
than
10s
43. OCTO TECHNOLOGY > THERE IS A BETTER WAY 43
SECOND STEP: GOSSIP WITH YOUR FRIENDS
OCTO TECHNOLOGY > THERE IS A BETTER WAY
Principle
Just forward every transaction to
your neighbours!
Why it is cool?
● Reliable in case of failure
● Guaranteed delivery in
bounded time
● Scale with the number of peers
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
44. OCTO TECHNOLOGY > THERE IS A BETTER WAY 44
BAD TRANSACTIONS SHALL NOT PASS!
Transaction validity is first checked
before being accepted and transferred ✓Valid transaction
format…………..
✓Valid transaction…..
instructions used….
✓Valid signature
from the author……
✓Transaction integrity
not tampered……….
✓Coins spent are
available…………....
There should be a consensus about
validation rules among clients
Validation rules updates are
propagated through software
updates
45. OCTO TECHNOLOGY > THERE IS A BETTER WAY 45
LET’S GO TO THE POOL!
Accepted transactions go into a transaction pool
Mining node A
Pay-us-a-beer
Buy Crypto Kitty
Buy ICO Scam Token
Transactions
Buy ICO Scam Token
Buy ICO Scam Token
TransactionPool
Fee
30
25
12
7
0
Orderedbyfee
independently maintained by each node
Mining node B
Buy Crypto Kitty
Buy ICO Scam Token
Transactions
Buy ICO Scam Token
Buy ICO Scam Token
Fee
25
12
7
0
Buy Drugs 2
TransactionPool
Non
consistent
view across
all nodesBuy Drugs 2
46. OCTO TECHNOLOGY > THERE IS A BETTER WAY 46
Account creation
Transaction preparation
Transaction submission
Transaction execution
Mining process
Lifecycle of a transaction:
Mining process
Transaction confirmation
47. Tx Buy Crypto Kitty
OCTO TECHNOLOGY > THERE IS A BETTER WAY 473
A SIMPLE EXECUTION MODEL
...that are executed sequentially
Tx Buy Crypto Kitty
Tx Buy Beer
Transaction Pool
Tx Buy Beer Tx Buy Crypto Kitty
New Potential
Blockchain State
State 3State 2
Initial
Blockchain State
State 1
Transactions are just state transition functions...
47
48. OCTO TECHNOLOGY > THERE IS A BETTER WAY 483
BUT WHAT IS A BLOCKCHAIN STATE?
It depends...
20 coins spendable by Bob
10 coins spendable by John
5 coins spendable by Bob
5 coins spendable by Lucie
Unspent transactions coins
Bitcoin State
1F1tAaz5x
1F1tAaz5x
1F1tAaz5x
Ethereum State
Account information
Bob has 25 coins
John has 10 coins
Lucie has 5 coins
Contract Foo contains A=10
}
cont
{
48
49. OCTO TECHNOLOGY > THERE IS A BETTER WAY 49
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
Tx
OCTO TECHNOLOGY > THERE IS A BETTER WAY
A MODEL NOT VERY SCALABLE
All nodes execute
all the transactions
Adding new nodes
doesn’t increase
computing power
50. OCTO TECHNOLOGY > THERE IS A BETTER WAY 503
PROTECTIONS AGAINST THE EVIL
Solution
No Loop or Goto in script langage
Pay for each instruction execution
Threat 1 Infinite loop in transaction scripts
Solution
Transaction chaining
Incremental id per transaction/account
Threat 2 Transaction Replay attack
51. OCTO TECHNOLOGY > THERE IS A BETTER WAY 51
Account creation
Transaction preparation
Transaction submission
Transaction execution
Mining process
Lifecycle of a transaction:
Block propagation
Transaction confirmation
52. OCTO TECHNOLOGY > THERE IS A BETTER WAY 52
DID WE SAY BLOCKCHAIN? WHAT IS IT?
Now that our pay-us-a-beer transaction is executed and validated,
it needs to be included in a newly created block
Previous Block
Hash
Transactions
Tree
Random
Nonce
Current
Block Hash
Our block!
Previous Block
Hash
Transactions
Tree
Random
Nonce
Current
Block Hash
Block N-1
Previous Block
Hash
Transactions
Tree
Random
Nonce
Current
Block Hash
Block N+1
The average block generation time
is usually constant
● ~10 mn for Bitcoin
● ~12 seconds for Ethereum
Why to bundle transactions in a block?
● Single unit of work for miners
( will be described later )
● Limit length of the blockchain
( faster to verify history )
Merkle Root
Hash
Hash HashHashHash
Hash
Dat
a 4
Dat
a 3
Dat
a 2
Dat
a 1
Tx4Tx3Tx1 Tx2
Transactions
pay-us-a-beer TX
53. OCTO TECHNOLOGY > THERE IS A BETTER WAY 53
HOW TO RESOLVE COMPETING STATES?
Tx1
Tx2
Tx6
Tx5
Tx4
Tx3
Tx3
Tx4
Tx5
Tx6
Tx3
Tx5
Tx4
Tx6
Tx1
Tx2
Tx3
Tx4
Tx5
Tx6
How to bundle
transactions in blocks
pay-us-a-beer TX
Distributed process =
need to arbitrate between several valid states
?
54. OCTO TECHNOLOGY > THERE IS A BETTER WAY 54
CONSENSUS ALGORITHM
“ How to find a truth, in a world full of liars ”
● Agree on a unique blockchain state
amongst all valid possibilities
● Prevent bad actors from influencing
the outcome
● Ensure a consensus will be
eventually reached despite faulty and
evil nodes
Sybil attack
fake multitude of nodes using forged
identities
Double spend
spending the same money twice
Transaction censorship or delaying
prevent trnx to be included in the
blockchain
Long Range attack
Create a long valid blockchain and
advertise it to new nodes joining
Most well known
attacks
55. OCTO TECHNOLOGY > THERE IS A BETTER WAY 55
2 main answers to avoid those attacks
● Choose the next block producer
randomly!
● Ensure messing with the blockchain
is not for free
Solution = Mining!
56. OCTO TECHNOLOGY > THERE IS A BETTER WAY 56
hash( block + random value ) < difficulty
PROOF OF WORK, THE MOST COMMON MINING TECHNIQUE
A computational challenge must be solved
to be able to create a valid block
Challenge: Find a random hash value inferior to a threshold (difficulty)
Difficulty is regularly adjusted to keep a constant average block generation time
57. OCTO TECHNOLOGY > THERE IS A BETTER WAY 57
RESOLVING FORKS
The process continues and
What happen when 2 miners find a block at the same time?
58. OCTO TECHNOLOGY > THERE IS A BETTER WAY 58
WHAT A MINER IS DOING?
1. Collect transactions from the pool
2. Validate transactions
3. Invest power and electricity!
4. Try to create a new block as previously
described
5. Eventually, get rewards in form of new
created bitcoins
* old numbers
60. OCTO TECHNOLOGY > THERE IS A BETTER WAY 60
Account creation
Transaction preparation
Transaction submission
Transaction execution
Mining process
Lifecycle of a transaction:
Transaction confirmation
Transaction confirmation
61. OCTO TECHNOLOGY > THERE IS A BETTER WAY 61
BEFORE: THE (NOT SO SIMPLE) BLOCK PROPAGATION
● Like transactions, blocks are propagated
in the network using the Gossip protocol
● On Bitcoin
50% of blocks are propagated under 6s
Problem: High propagation time is bad for security
but 10% are often propagated > 120s
62. OCTO TECHNOLOGY > THERE IS A BETTER WAY 62
2
2
✗
✗
3
IMPACT OF A SMALL BLOCK TIME
1
12 s 18 s 24 s
25%
50%
25%
1
1
2
A
B
C
BLOCK TIME: 6 S
PROPAGATION TIME: 12 S
1'
✗
✗
2'
12 s 18 s 24 s0 s 6 s
63. OCTO TECHNOLOGY > THERE IS A BETTER WAY 63
CENTRALISATION COUNTER-MEASURES
High propagation time lead to centralisation
Solutions:
● Low block size and
high block time
1 MB Block size limit
● Make orphan blocks
count to select winner
64. OCTO TECHNOLOGY > THERE IS A BETTER WAY 643
THE TRANSACTION CONFIRMATION ISSUE
● Transactions can be re-organized in the short term as part of
forks resolution
● Problem: blockchain are eventually consistent
C
A P
Tx 1
Tx 3
Tx 3 Tx 4
Tx
Tx
Tx 1
Tx Tx 3
Tx 3
65. OCTO TECHNOLOGY > THERE IS A BETTER WAY 653
HOW TO BE SURE ABOUT YOUR TRANSACTION
The oldest is a transaction
the less likely a transaction could be reverted
Tx
Not sure we will have our beer!
0 confirmation
66. OCTO TECHNOLOGY > THERE IS A BETTER WAY 663
HOW TO BE SURE ABOUT YOUR TRANSACTION
The oldest is a transaction
the less likely a transaction could be reverted
Tx 1Tx Tx 2 Tx 3
We may have our beer!
3 confirmations
67. OCTO TECHNOLOGY > THERE IS A BETTER WAY 673
HOW TO BE SURE ABOUT YOUR TRANSACTION
The oldest is a transaction
the less likely a transaction could be reverted
Tx 1Tx Tx 2 Tx 3 Tx 4 Tx 5 Tx 6
6 confirmations
We will have our beer!
68. OCTO TECHNOLOGY > THERE IS A BETTER WAY 683
HOW TO BE SURE ABOUT YOUR TRANSACTION
The oldest is a transaction
the less likely a transaction could be reverted
6 blocks-old transactions are considered close to 100% safe
Tx 1Tx Tx 2 Tx 3 Tx 4 Tx 5 Tx 6
6 confirmations
69. OCTO TECHNOLOGY > THERE IS A BETTER WAY 69
Thank you!
CAREERS.OCTO.COM.AU
70. OCTO TECHNOLOGY > THERE IS A BETTER WAY 70
Annexes
CAREERS.OCTO.COM.AU
71. Merkle Root
Data 4Data 3Data 2Data 1
OCTO TECHNOLOGY > THERE IS A BETTER WAY 713
COINS GROWTH ON (MERKLE) TREES
Most blockchains use Merkle Trees to store
transactions list or whole blockchain state
Data 4Data 3Data 1
Hash H3
Hash(Data 3)
Hash H4
Hash(Data 4)
Hash H2
Hash(Data 2)
Hash H1
Hash(Data 1)
Merkle Root
Hash(H12+H34)
Hash H34
Hash(H3+H4)
Hash H12
Hash(H1+H2)
Data 2
Hash H2
Hash(Data 2)
Merkle Root
Hash(H12+H34)
Hash H12
Hash(H1+H2)
Data 2
Merkle Trees are cool!
● Performant
Only re-hash what changed!
● Light Client Friendly
Easy to prove a transaction
without downloading the
whole tree!
Data modified
72. Tx Root
Tx 4Tx 3Tx 1
Tx Root
Tx 2
Block
OCTO TECHNOLOGY > THERE IS A BETTER WAY 723
WHERE ARE MERKLE TREES USED?
Bitcoin Ethereum
Tx 4Tx 3Tx 1 Tx 2
Tx Root
Tx Root
Block
Receipt Root
Rc 4Rc 3Rc 1
Receipt Root
Rc 2
Account 1
State Root
State Root
Account 2 Account 3 Account 4Storage
Block
73. Tx Buy Crypto Kitty
OCTO TECHNOLOGY > THERE IS A BETTER WAY 733
BACK TO TRANSACTIONS EXECUTION
Transactions are executed sequentially by nodes
State Root
Data
4
Data
3
Data
2
Data
1
Data 4Data 3Data 1 Data 2
State Root
Data
4
Data
3
Data
2
Data
1
Data 4Data 3Data 1 Data 2
State Root
Data
4
Data
3
Data
2
Data
1
Data 4Data 3Data 1 Data 2
Tx Buy Crypto Kitty
Tx Buy Beer
Transaction Pool
Tx Buy Beer Tx Buy Crypto Kitty
New Blockchain
State Hash
Ethereumexample