SlideShare a Scribd company logo
Basic
Consensus Algorithms
Mar. 2020
Sangmoon Oh (halfface@chollian.net)
v1.0
2
목차
• Byzantine Fault
• Byzantine Fault Tolerance (BFT)
• 3m + 1 Processors Algorithm
• pBFT
• Proof of Work (PoW)
• Ethash
• PoW Finality Problem
• Casper FFG
3
II. Consensus AlgorithmByzantine Fault (Byzantine General Problem)
Enemy
attack
retreat
retreat
retreat
retreat
retreat
attack
attack
attack
attack
Agree on Attack/Retreat
Protocol or Algorithm
 SIFT: design and analysis of a fault-tolerant computer for aircraft control (1978)
 



4
II. Consensus AlgorithmByzantine Fault - Simple Example
2 Loyal Generals with 1 Unknown Traitor
1
3
2
Traitor
att
att
att
ret
att
att
(att,att,att)
Attack
(att,ret,att)
Attack
1
3
2
Traitor
att
ret
ret
ret
ret
ret
1
3
2
Traitor
att
att
att
ret
ret
ret
(ret,att,ret)
Retreat
(att,att,ret)
Attack
(ret,ret,ret)
Retreat
(att,ret,ret)
Retreat
Not Agreed !!
Case 1) Case 2) Case 3)
5
II. Consensus AlgorithmByzantine Fault Tolerance (BFT)
Enemy
General
Traitor
General Traitor
General
General
Attack
G
T
G T
G
G
Attack
Attack
Attack Retreat
G
T
G T
G
G
Retreat Retreat
Retreat
Algorithm 1
Retreat
Attack
G
T
G T
G
G
Attack
Attack
Retreat
G
T
G T
G
G
Retreat Retreat
RetreatAlgorithm 2
Always
Agreement
No Agreement
Possible
A1: BTF
A2: Not BTF
6
II. Consensus AlgorithmByzantine Fault Revisited
Enemy
 Synchronous or Asynchronous
Message Delivery
 Forgeable vs. Unforgeable Message
 Level of Connectivity
 Option Space
Is BTF Possible ?
What Algorithms ?
7
II. Consensus Algorithm3m + 1 Processors Algorithm - Overview
With m faulty processors,
Min. (3m +1) processors are needed
to tolerate the fault.
Algorithm OM(m)
n  3m + 1
General
Traitor General
General General
GeneralTraitor
General General
General
General
Traitor
Traitor
General General
General
General
Traitor
Traitor
General

m=1, n=3 (< 3m+1) m=1, n=4 ( 3m+1) m=2, n=6 (< 3m+1) m=2, n=7 ( 3m+1)
(Synchronized message delivery, Forgeable message, Full connected)
OM(1) OM(2)
8
II. Consensus Algorithm3m + 1 Processors Algorithm - Instructions
m nmin
Instruction
1 4 OM(0), OM(1)
2 7 OM(0), OM(1), OM(2)
3 10 OM(0), OM(1), OM(2), OM(3)









Recursive Relay
v:1:4
v:1:2:4
v:1:2
v:1:2:3 v:1:2:3:4
4
1
2
3
v:1:4
v:1:2:4
v:1:3:4
v:1:2:3:4
v:1:3:2:4
 1 + 2C1 + 2C11C1 = 5
v:1:::4
9
II. Consensus Algorithm3m + 1 Processors Algorithm - Simplest Case
Case v:2:1 v:2:3:1 v:2:4:1 v:2:::1 v:2:3 v:2:1:3 v:2:4:3 v:2:::3 v:2:4 v2:1:4 v:2:3:4 v:2:::4
1) A A R 2A + R A A R 2A + R R A A 2A + R
2) A R A 2A + R R A A 2A + R A A R 2A + R
3) A R R A + 2R R A R A + 2R R A R A + 2R
4) R A A 2A + R A R A 2A + R A R A 2A + R
5) R A R A + 2R A R R A + 2R R R A A + 2R
6) R R A A + 2R R R A A + 2R A R R A + 2R
10
II. Consensus Algorithm3m + 1 Processors Algorithm - Complexity
General General
GeneralTraitor
General General
General
General
Traitor
Traitor
General
Faulty Total Recursion Number of Message
1 4 OM(0), OM(1) 4*3 + 4*3*2
2 7 OM(0), OM(1), OM(2) 7*6 + 7*6*5 + 7*6*5*4
3 10 OM(0), OM(1), OM(2), OM(3) 10*9 + 10*9*8 + 10*9*8*7 + 10*9*8*7*6









m 3m + 1 OM(0), OM(1), , OM(m) (3m+1)*3m + (3m+1)*3m*(3m-1) +  + (3m+1)*3m2m
Complexity : O(nm)
General General
General
General
Traitor
Traitor
11
II. Consensus AlgorithmState Machine Replication
a : 100
b : 100
c : 100
a : 120
b : 110
c : 70
a : 90
b : 100
c : 110
tx1
tx3
tx4
tx2
tx1 :
b a, 20
tx2 :
b c, 10
tx3 :
c b, 30
tx4 :
a c, 30
a : 100
b : 100
c : 100
a : 120
b : 110
c : 70
a : 90
b : 100
c : 110
tx1
tx3
tx4
tx2
a : 100
b : 100
c : 100
a : 120
b : 110
c : 70
a : 90
b : 100
c : 110
tx1
tx3
tx4
tx2
Ordering Txs
Decentralized way
Communication and
Corporation
12
II. Consensus AlgorithmpBFT (Practical Byzantine Fault Tolerance)
1
2
3
4
client
Pre-prepare
(~ n)
Prepare
(~ n(n-1))
Commit
(~ n(n-1))
Primary Create and share next state
candidate
Backups Validate next state candidate
 Pre-prepare
Sender Share validated(accepted) next
state candidate
Receiver Collect the acceptance of the
other nodes
Commit if enough nodes
accepted ( >
2𝑛+1
3
)
 Prepare, Commit
tx
13
II. Consensus AlgorithmProof of Work (PoW)
4 3
2
1
5
 Compute
 Solve
 Send
 Send
 Send
 Send
 Compute
 Compute
 Compute
 Verify
 Verify
 Verify
 Verify
 Compute
Try a puzzle hard to solve but easy to verify.
 Competition
 Reward
14
II. Consensus Algorithm
4 3
2
1
5
 Compute
 Solve
 Send
 Send
 Send
 Send
 Compute
 Compute
 Compute
 Verify
 Verify
 Verify
 Verify
 Compute
Hash based PoW
Data + Nonce SHA-256(Data + Nonce)
Hello, world! 0x315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3
Hello, world!0 0x1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64
Hello, world!1 0xe9afc424b79e4f6ab42d99c81156d3a17228d6e1eef4139be78e948a9332a7d8
Hello, world!2 0xae37343a357a8297591625e7134cbea22f5928be8ca2a32aa475cf05fd4266b7
Hello, world!4248 0x6e110d98b388e77e9c6f042ac6b497cec46660deef75a55ebc7cfdf65cc0b965
Hello, world!4249 0xc004190b822f1669cac8dc37e761cb73652e7832fb814565702245cf26ebb9e6
Hello, world!4250 0x0000c3af42fc31103f1fdc0151fa747ff87349a4714df7cc52ea464e12dcd4e9
Puzzle: Find Nonce for SHA-256(Data, Nonce)
to Start with 0000
15
II. Consensus AlgorithmEthash - PoW Algorithm for Ethereum 1.0
 https://github.com/ethereum/wiki/wiki/Ethash
Block # Date Difficulty Target
9,000,000 2019-11-26 2,573,664,196,528,490 0x0000000000001bff809762e524...
8,000,000 2019-06-21 2,037,888,242,889,388 0x000000000000235be453641714...
6,000,000 2018-07-21 3,483,739,548,912,554 0x00000000000014af19378e94eb
3,000,000 2017-01-16 103,975,266,902,792 0x000000000002b506bb4c196d40
4 3
2
1
5
 Compute
 Solve
 Send
 Send
 Send
 Send
 Compute
 Compute
 Compute
 Verify
 Verify
 Verify
 Verify
 Compute
Keccak(header, transactions, nonce) = 0x0000...
def mine(full_size, dataset, header, difficulty):
target = zpad(encode_int(2**256 // difficulty), 64)[::-1]
from random import randint
nonce = randint(0, 2**64)
while hashimoto_full(full_size, dataset, header, nonce) > target:
nonce = (nonce + 1) % 2**64
return nonce
difficulty x target = 2256
16
II. Consensus AlgorithmPoW - Finality Problem
Solve Bm
Solve Bn
Bm
Two different miners may generate a block simultaneously.
Bm
Bn
Bn
17
II. Consensus AlgorithmPoW - Finality Problem
Solve Bm2
Solve Bn2
Bm
Another two different miners may generate a block simultaneously again.
Bm
Bn
Bn
Bn2
Bn2Bm2 Bm2
18
II. Consensus AlgorithmPoW - Finality Problem
Bm
Bn
Bm
Bn
Bm
Bn
Bm
Bn
Bn
  
  
txb(b a, 10)
txb(b a, 10)
19
II. Consensus AlgorithmCasper FFG - Finality System
 "Casper FFG" paper by Vitalik and Virgil
PoS based Finality System
which Overlays an existing
PoW blockchain.
 Accountability : Penalty
 Dynamic validators
 Modular overlay
: a partial consensus mechanism
20
II. Consensus AlgorithmCasper FFG - Process
1) Voting
 Vote for link(edge)
 2 Commandments
(Slashing conditions)
2) Justifying
  2/3 votes
3) Finalizing
 Canonical chain
1)
2)
3)
21
AppendixReferences
 Consensus
 Byzantine fault
 Reaching Agreement in the Presence of Faults (1980, M. PEASE, R, SHOSTAK, AND L. LAMPORT)
 The Byzantine Generals Problem (1982, LESLIE LAMPORT, ROBERT SHOSTAK, and MARSHALL PEASE)
 Practical Byzantine Fault Tolerance (1999, Miguel Castro and Barbara Liskov)
 pBFT— Understanding the Consensus Algorithm
 Proof-of-Work, Explained
 Hashcash
 Ethash

More Related Content

PPT
04030038 proposal presentation
PPT
Crypto theory to practice
PPTX
Cryptography
PPT
5 stream ciphers
PDF
Instruction Combine in LLVM
PPT
Transaction Timestamping in Temporal Databases
PDF
LLVM Register Allocation
PDF
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
04030038 proposal presentation
Crypto theory to practice
Cryptography
5 stream ciphers
Instruction Combine in LLVM
Transaction Timestamping in Temporal Databases
LLVM Register Allocation
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov

What's hot (20)

PDF
DWARF Data Representation
PDF
LLVM Register Allocation (2nd Version)
PDF
Week5 ap3421 2019_part1
PDF
Computer Security Lecture 3: Classical Encryption Techniques 2
PDF
Block Cipher vs. Stream Cipher
PDF
Axes Tech
PDF
Concurrency in Go by Denys Goldiner.pdf
PDF
Vectorization on x86: all you need to know
PDF
Cryptography 202
PDF
PDF
Machine Trace Metrics
PPTX
Cryptographic algorithms
PPT
Fixed order size system
PDF
Debug Line Issues After Relaxation.
PPTX
Crypto talk OpenValue meetup 20-3-18
PPT
Crypto
PDF
BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...
DOC
Timer Listings
ODP
ocelot
PDF
Ping to Pong
DWARF Data Representation
LLVM Register Allocation (2nd Version)
Week5 ap3421 2019_part1
Computer Security Lecture 3: Classical Encryption Techniques 2
Block Cipher vs. Stream Cipher
Axes Tech
Concurrency in Go by Denys Goldiner.pdf
Vectorization on x86: all you need to know
Cryptography 202
Machine Trace Metrics
Cryptographic algorithms
Fixed order size system
Debug Line Issues After Relaxation.
Crypto talk OpenValue meetup 20-3-18
Crypto
BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...
Timer Listings
ocelot
Ping to Pong
Ad

Similar to Basic Consensus Algorithms (20)

PDF
Consensus Algorithms: An Introduction & Analysis
PPTX
Hyperledger Consensus Algorithms
PPTX
Blockchain consensus algorithms
PPTX
BlockChain_Chap3_RP _Consensus.pptx
PDF
Byzantine Fault Tolerance problem Blockchain Technology
PPTX
unit3consesence.pptx
PPTX
Overview of Blockchain Consensus Mechanisms
PPTX
Understanding how logical clocks (e.g., Lamport clocks, vector clocks) are us...
PDF
Practical Byzantine Fault Tolernace
PDF
Ripple - XRP we know how XRP blockchain throughout Whitepaper
PDF
PDF
Distributed Consensus: Making the Impossible Possible
PDF
uiuc2016.pdf
PDF
uiuc201 6-merged.pdf
PDF
Distributed Consensus: Making Impossible Possible by Heidi howard
PDF
Distributed Consensus: Making Impossible Possible
PPTX
Consensus Algorithms - Nakov at CryptoBlockCon - Las Vegas (2018)
PPT
Aggrement protocols
ODP
Consensus algo with_distributed_key_value_store_in_distributed_system
PPTX
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1-1.pptx
Consensus Algorithms: An Introduction & Analysis
Hyperledger Consensus Algorithms
Blockchain consensus algorithms
BlockChain_Chap3_RP _Consensus.pptx
Byzantine Fault Tolerance problem Blockchain Technology
unit3consesence.pptx
Overview of Blockchain Consensus Mechanisms
Understanding how logical clocks (e.g., Lamport clocks, vector clocks) are us...
Practical Byzantine Fault Tolernace
Ripple - XRP we know how XRP blockchain throughout Whitepaper
Distributed Consensus: Making the Impossible Possible
uiuc2016.pdf
uiuc201 6-merged.pdf
Distributed Consensus: Making Impossible Possible by Heidi howard
Distributed Consensus: Making Impossible Possible
Consensus Algorithms - Nakov at CryptoBlockCon - Las Vegas (2018)
Aggrement protocols
Consensus algo with_distributed_key_value_store_in_distributed_system
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1-1.pptx
Ad

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PDF
Electronic commerce courselecture one. Pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
sap open course for s4hana steps from ECC to s4
PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation theory and applications.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding
Electronic commerce courselecture one. Pdf
Per capita expenditure prediction using model stacking based on satellite ima...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Encapsulation_ Review paper, used for researhc scholars
Dropbox Q2 2025 Financial Results & Investor Presentation
sap open course for s4hana steps from ECC to s4
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
20250228 LYD VKU AI Blended-Learning.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Spectroscopy.pptx food analysis technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation theory and applications.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Unlocking AI with Model Context Protocol (MCP)
The AUB Centre for AI in Media Proposal.docx
Programs and apps: productivity, graphics, security and other tools

Basic Consensus Algorithms

  • 1. Basic Consensus Algorithms Mar. 2020 Sangmoon Oh (halfface@chollian.net) v1.0
  • 2. 2 목차 • Byzantine Fault • Byzantine Fault Tolerance (BFT) • 3m + 1 Processors Algorithm • pBFT • Proof of Work (PoW) • Ethash • PoW Finality Problem • Casper FFG
  • 3. 3 II. Consensus AlgorithmByzantine Fault (Byzantine General Problem) Enemy attack retreat retreat retreat retreat retreat attack attack attack attack Agree on Attack/Retreat Protocol or Algorithm  SIFT: design and analysis of a fault-tolerant computer for aircraft control (1978)     
  • 4. 4 II. Consensus AlgorithmByzantine Fault - Simple Example 2 Loyal Generals with 1 Unknown Traitor 1 3 2 Traitor att att att ret att att (att,att,att) Attack (att,ret,att) Attack 1 3 2 Traitor att ret ret ret ret ret 1 3 2 Traitor att att att ret ret ret (ret,att,ret) Retreat (att,att,ret) Attack (ret,ret,ret) Retreat (att,ret,ret) Retreat Not Agreed !! Case 1) Case 2) Case 3)
  • 5. 5 II. Consensus AlgorithmByzantine Fault Tolerance (BFT) Enemy General Traitor General Traitor General General Attack G T G T G G Attack Attack Attack Retreat G T G T G G Retreat Retreat Retreat Algorithm 1 Retreat Attack G T G T G G Attack Attack Retreat G T G T G G Retreat Retreat RetreatAlgorithm 2 Always Agreement No Agreement Possible A1: BTF A2: Not BTF
  • 6. 6 II. Consensus AlgorithmByzantine Fault Revisited Enemy  Synchronous or Asynchronous Message Delivery  Forgeable vs. Unforgeable Message  Level of Connectivity  Option Space Is BTF Possible ? What Algorithms ?
  • 7. 7 II. Consensus Algorithm3m + 1 Processors Algorithm - Overview With m faulty processors, Min. (3m +1) processors are needed to tolerate the fault. Algorithm OM(m) n  3m + 1 General Traitor General General General GeneralTraitor General General General General Traitor Traitor General General General General Traitor Traitor General  m=1, n=3 (< 3m+1) m=1, n=4 ( 3m+1) m=2, n=6 (< 3m+1) m=2, n=7 ( 3m+1) (Synchronized message delivery, Forgeable message, Full connected) OM(1) OM(2)
  • 8. 8 II. Consensus Algorithm3m + 1 Processors Algorithm - Instructions m nmin Instruction 1 4 OM(0), OM(1) 2 7 OM(0), OM(1), OM(2) 3 10 OM(0), OM(1), OM(2), OM(3)          Recursive Relay v:1:4 v:1:2:4 v:1:2 v:1:2:3 v:1:2:3:4 4 1 2 3 v:1:4 v:1:2:4 v:1:3:4 v:1:2:3:4 v:1:3:2:4  1 + 2C1 + 2C11C1 = 5 v:1:::4
  • 9. 9 II. Consensus Algorithm3m + 1 Processors Algorithm - Simplest Case Case v:2:1 v:2:3:1 v:2:4:1 v:2:::1 v:2:3 v:2:1:3 v:2:4:3 v:2:::3 v:2:4 v2:1:4 v:2:3:4 v:2:::4 1) A A R 2A + R A A R 2A + R R A A 2A + R 2) A R A 2A + R R A A 2A + R A A R 2A + R 3) A R R A + 2R R A R A + 2R R A R A + 2R 4) R A A 2A + R A R A 2A + R A R A 2A + R 5) R A R A + 2R A R R A + 2R R R A A + 2R 6) R R A A + 2R R R A A + 2R A R R A + 2R
  • 10. 10 II. Consensus Algorithm3m + 1 Processors Algorithm - Complexity General General GeneralTraitor General General General General Traitor Traitor General Faulty Total Recursion Number of Message 1 4 OM(0), OM(1) 4*3 + 4*3*2 2 7 OM(0), OM(1), OM(2) 7*6 + 7*6*5 + 7*6*5*4 3 10 OM(0), OM(1), OM(2), OM(3) 10*9 + 10*9*8 + 10*9*8*7 + 10*9*8*7*6          m 3m + 1 OM(0), OM(1), , OM(m) (3m+1)*3m + (3m+1)*3m*(3m-1) +  + (3m+1)*3m2m Complexity : O(nm) General General General General Traitor Traitor
  • 11. 11 II. Consensus AlgorithmState Machine Replication a : 100 b : 100 c : 100 a : 120 b : 110 c : 70 a : 90 b : 100 c : 110 tx1 tx3 tx4 tx2 tx1 : b a, 20 tx2 : b c, 10 tx3 : c b, 30 tx4 : a c, 30 a : 100 b : 100 c : 100 a : 120 b : 110 c : 70 a : 90 b : 100 c : 110 tx1 tx3 tx4 tx2 a : 100 b : 100 c : 100 a : 120 b : 110 c : 70 a : 90 b : 100 c : 110 tx1 tx3 tx4 tx2 Ordering Txs Decentralized way Communication and Corporation
  • 12. 12 II. Consensus AlgorithmpBFT (Practical Byzantine Fault Tolerance) 1 2 3 4 client Pre-prepare (~ n) Prepare (~ n(n-1)) Commit (~ n(n-1)) Primary Create and share next state candidate Backups Validate next state candidate  Pre-prepare Sender Share validated(accepted) next state candidate Receiver Collect the acceptance of the other nodes Commit if enough nodes accepted ( > 2𝑛+1 3 )  Prepare, Commit tx
  • 13. 13 II. Consensus AlgorithmProof of Work (PoW) 4 3 2 1 5  Compute  Solve  Send  Send  Send  Send  Compute  Compute  Compute  Verify  Verify  Verify  Verify  Compute Try a puzzle hard to solve but easy to verify.  Competition  Reward
  • 14. 14 II. Consensus Algorithm 4 3 2 1 5  Compute  Solve  Send  Send  Send  Send  Compute  Compute  Compute  Verify  Verify  Verify  Verify  Compute Hash based PoW Data + Nonce SHA-256(Data + Nonce) Hello, world! 0x315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 Hello, world!0 0x1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64 Hello, world!1 0xe9afc424b79e4f6ab42d99c81156d3a17228d6e1eef4139be78e948a9332a7d8 Hello, world!2 0xae37343a357a8297591625e7134cbea22f5928be8ca2a32aa475cf05fd4266b7 Hello, world!4248 0x6e110d98b388e77e9c6f042ac6b497cec46660deef75a55ebc7cfdf65cc0b965 Hello, world!4249 0xc004190b822f1669cac8dc37e761cb73652e7832fb814565702245cf26ebb9e6 Hello, world!4250 0x0000c3af42fc31103f1fdc0151fa747ff87349a4714df7cc52ea464e12dcd4e9 Puzzle: Find Nonce for SHA-256(Data, Nonce) to Start with 0000
  • 15. 15 II. Consensus AlgorithmEthash - PoW Algorithm for Ethereum 1.0  https://github.com/ethereum/wiki/wiki/Ethash Block # Date Difficulty Target 9,000,000 2019-11-26 2,573,664,196,528,490 0x0000000000001bff809762e524... 8,000,000 2019-06-21 2,037,888,242,889,388 0x000000000000235be453641714... 6,000,000 2018-07-21 3,483,739,548,912,554 0x00000000000014af19378e94eb 3,000,000 2017-01-16 103,975,266,902,792 0x000000000002b506bb4c196d40 4 3 2 1 5  Compute  Solve  Send  Send  Send  Send  Compute  Compute  Compute  Verify  Verify  Verify  Verify  Compute Keccak(header, transactions, nonce) = 0x0000... def mine(full_size, dataset, header, difficulty): target = zpad(encode_int(2**256 // difficulty), 64)[::-1] from random import randint nonce = randint(0, 2**64) while hashimoto_full(full_size, dataset, header, nonce) > target: nonce = (nonce + 1) % 2**64 return nonce difficulty x target = 2256
  • 16. 16 II. Consensus AlgorithmPoW - Finality Problem Solve Bm Solve Bn Bm Two different miners may generate a block simultaneously. Bm Bn Bn
  • 17. 17 II. Consensus AlgorithmPoW - Finality Problem Solve Bm2 Solve Bn2 Bm Another two different miners may generate a block simultaneously again. Bm Bn Bn Bn2 Bn2Bm2 Bm2
  • 18. 18 II. Consensus AlgorithmPoW - Finality Problem Bm Bn Bm Bn Bm Bn Bm Bn Bn       txb(b a, 10) txb(b a, 10)
  • 19. 19 II. Consensus AlgorithmCasper FFG - Finality System  "Casper FFG" paper by Vitalik and Virgil PoS based Finality System which Overlays an existing PoW blockchain.  Accountability : Penalty  Dynamic validators  Modular overlay : a partial consensus mechanism
  • 20. 20 II. Consensus AlgorithmCasper FFG - Process 1) Voting  Vote for link(edge)  2 Commandments (Slashing conditions) 2) Justifying   2/3 votes 3) Finalizing  Canonical chain 1) 2) 3)
  • 21. 21 AppendixReferences  Consensus  Byzantine fault  Reaching Agreement in the Presence of Faults (1980, M. PEASE, R, SHOSTAK, AND L. LAMPORT)  The Byzantine Generals Problem (1982, LESLIE LAMPORT, ROBERT SHOSTAK, and MARSHALL PEASE)  Practical Byzantine Fault Tolerance (1999, Miguel Castro and Barbara Liskov)  pBFT— Understanding the Consensus Algorithm  Proof-of-Work, Explained  Hashcash  Ethash