SlideShare a Scribd company logo
Blockchain Consensus Algorithms
Consensus on the Blockchain, Proof-of-Work,
Proof-of-Stake, DPoS, PoA, PBFT, Others
Software University
https://softuni.bg
Svetlin Nakov
Manager Training and Inspiration
Table of Contents
1. Blockchain Concepts
2. What is Consensus Algorithm?
3. Proof of Work (PoW)
4. Proof of Stake (PoS)
5. Proof of … (whatever)
6. Cryptocurrencies and Their Consensus
7. Java-Based Blockchains
2
Blockchain
Distributed Ledger Technology
4
What is Blockchain?
Distributed ledger
Immutable
Peer-to-Peer
network
Nodes hold
ledger of facts +
history of updates
Decentralized
(no owner)
Secure
Transactions are
verified by the
entire network
5
Blockchain == Chain of Data Blocks
Demo: https://etherscan.io
https://blockchain.info
6
Blockchain == Chain of Data Blocks
timestamp block_hash
all_transactions_hash
transaction #1 hash
transaction #2 hash
transaction #3 hash
…
Block #0 (genesis block)
prev_hash nonce
timestamp block_hash
all_transactions_hash
transaction #1 hash
transaction #2 hash
transaction #3 hash
…
Block #1
nonceprev_hash
timestamp block_hash
all_transactions_hash
transaction #1 hash
transaction #2 hash
transaction #3 hash
…
Block #3
prev_hash nonce
7
Mining the Next Block
Blockchain clients
create and sign
transactions
Transaction A
Transaction B
Transaction C
Transaction …
Blockchain Node #1
pending
transactions
Blockchain Network
Blockchain Node #2
pending
transactions
Blockchain Node #...
Transactions are
sent to the network
Blockchain Node #7
pending
transactions
Consensus algorithmConsensus algorithm
Validates the pending
transactions and
creates the next block
Selects the winning
node (a lucky miner)
Next (New) Block
confirmed
transactions
Propagate
for validation
Order the
transactions
Consensus Algorithms
Proof of Work, Proof of Stake, Proof of Burn, etc.
9
 Consensus algorithm (consensus protocol / consensus
mechanism)
 Algorithm to reach agreement among the blockchain nodes
 All nodes should agree about the changes in the distributed ledger
 Proof-of-work (PoW), Proof-of-stake (PoS), other algorithms
What is Consensus Algorithm?
10
 Fault-tolerance
 Some nodes will be unavailable when the ledger is changed
 Consensus should be reached by part of the nodes (e.g. majority)
 Attack-resistance
 Some nodes will intentionally behave incorrectly
 Honest nodes should win in the consensus process
 Everyone on the network can verify the next block's correctness
 Too much resources should be required for a successful attack
Consensus Algorithm – Requirements
11
 A "proof-of-work" (PoW) is a piece of data which is:
 Difficult to produce
 Easy for others to verify
 Producing a proof-of-work can be a random guessing process
 Or can be organized in mining pools (joint PoW production)
 Example:
 Find a number x, such that SHA256(text + x) has 10 leading zeroes
 10 zeroes == network difficulty
Proof-of-Work (PoW)
12
 Needs computing power
 Computationally expensive
 Energy intensive
 51% attack
 Attackers holding more than 50% of the power could potentially
reverse-back transactions (double-spend money) / deny service
 Hashing algorithm types for PoW consensus
 ASIC mineable (e.g. SHA256), CPU mineable (e.g. CryptoNight),
GPU mineable (e.g. ETHash), CPU + GPU mineable (e.g. Equihash)
Proof-of-Work: Problems
13
 Transactions speed – average wait time
 Bitcoin: new block mined in ~ 9-10 minutes
 Ethereum: new block mined in ~ 10-15 seconds
 Business needs real-time transactions (milliseconds)
 Transactions throughput – transactions per second (tps)
 Bitcoin: 2000-3000 / transactions per block  3-5 tps (up to 7 tps)
 Ethereum: 200-300 / transactions per block  10-15 tps
 Business needs thousands tps (e.g. VISA performs 2000 tps)
Proof-of-Work: Problems (2)
14
 Different cryptocurrencies use different hashing algorithms
 Bitcoin, Bitcoin Cash – SHA256 – ASIC mineable
 Ethereum, Ethereum Classic – ETHash – GPU mineable
 ZCash, Bitcoin Gold – Equihash – CPU and GPU mineable
 Monero – CryptoNight – CPU and GPU mineable
 Litecoin, Dogecoin – SCrypt – GPU mineable
 Dash – X11 – ASIC, CPU and GPU mineable
 Stratis – X13 – ASIC, CPU and GPU mineable
Proof-of-Work Cryptocurrencies
See bitinfocharts.com
15
 Similar to PoW, but based on HDD, not CPU / GPU
 Pay for mining with hard drive space
 More hard drive space  better
chance of mining the next block
 Calculating hashes is slow, so hashes
are stored in the HDD for faster access
 Plots – large data files holding of precomputed hashes
 More plots  better your chance of finding the next block
 Plot size is similar to hash rate in PoW
Proof of Capacity (PoC)
burst-coin.org
16
 PoS is designed to increase network security
and reduce resource wasting
 The creator of the next block is chosen in
 Combinations of random selection and wealth
 E.g. holding 1% of the coins gives the chance to
verify (mine) 1% of the "Proof of Stake blocks“
 The "Monopoly Problem": a monopolist (holder of the most
coins) could double spend or deny / filter other's transactions
 Executing a monopoly attack is much more expensive than in PoW
Proof of Stake (PoS)
17
 Proof-of-stake (PoS) blockchains either
 Start from a PoW algorithm to mine initial amounts of currency
 Then switch to proof-of-stake, relying on the mined stakes
 Example: BitConnect (bitconnect.co)
 Or fork existing PoW blockchain with all its transactions, then
switch to PoS-based consensus
 Example: PIVX (pivx.org) forked from Dash
 Or run a hybrid PoW + PoS consensus mechanism
From PoW to PoS Consensus
18
 Cardano – cardanohub.org
 Qtum – qtum.org
 PIVX – pivx.org
 BitConnect – bitconnect.co
 Stratis – stratisplatform.com
Popular PoS Cryptocurrencies
19
 Stakeholders vote for delegates in democratic way
 Every wallet holding coins can vote for delegates
 Votes weight is proportional to the wallet's stake in the network
 Delegates generate new blocks (like miners in PoW)
 Validate transactions and take the fees as profit
 Maintain the blockchain, e.g. vote for changing the network
parameters like block intervals, transaction fees, others
 Very fast confirmation of transactions (< 1 sec)
Delegated Proof of Stake (DPoS)
20
 Lisk – lisk.io
 EOS – eos.io
 BitShares – bitshares.org
 Ark – ark.io
 Steem – steem.io
Popular DPoS Cryptocurrencies
21
 In Leased PoS users can choose:
 To be a full node or lease their stake
 Full nodes maintain the network
 Process transactions and generate new blocks
 PoS based on: own stake + leased stake
 Serve as mining pools (collect fees and distribute the profits)
 Most users lease their stake to full nodes
 Take a portion from the full node's profits, just like in pool mining
Leased Proof of Stake (LPoS)
wavesplatform.com
22
 PoB is similar to PoS, where stakes are based on burned coins
 Burning coins gives the privilege to mine
 Burn coins by sending them to a burning
address (where they are irretrievable)
 More coins you burn = better chance
to be selected to mine the next block
 Random selection process (weighted)
 Like traditional mining  invest money to get mining power
 PoW  invest in hardware; PoB  invest in burning coins
Proof of Burn (PoB)
http://slimco.in
23
 PoI is similar to PoS, where stakes
are based on coins + activity
 The mining power calculated by
the importance in the network
 More coins hold for long time 
bigger importance (like a stake)
 More transactions / activities 
bigger importance
Proof of Importance (PoI)
http://nem.io
24
 PBFT as blockchain consensus algorithm
 Nodes collecting transactions, select a leader for the next block
 Can be random (deterministic) or random based on a stake
 The leader orders the transactions + broadcasts the ordered list
 Each node validates / executes the transactions + broadcasts the
calculated hash of the new block
 When 2/3 of the nodes have the same hash
 The new block is published (mined)
 Transactions are very fast
PBFT (Practical Byzantine Fault Tolerance)
25
 Hyperledger Fabric
 https://hyperledger.org/projects/fabric
 NEO – neo.org
 Delegated Byzantine Fault Tolerance (dBFT)
 Ripple (XRP) – ripple.com/xrp
 Ripple Consensus Algorithm
 Stellar – stellar.org
 Federated Byzantine Agreement (FBA)
PBFT Variations and Cryptocurrencies
26
 Proof-of-Authority (PoA) assigns a set of trusted nodes
(authorities) to process transactions and build new blocks
 News blocks need to be signed by the majority of authorities
 Works very well in private blockchains (cross validation)
 Great performance, fast transactions, high throughput
 Examples:
 POA Network – https://poa.network
 Ethereum Rinkeby Testnet – https://www.rinkeby.io
Proof of Authority (PoA)
27
 PoET relies on a trusted execution environment (TEE)
 Supported by modern CPUs from Intel, AMD and ARM
 No cryptographic puzzle (like in PoW algorithms)
 PoET ensures blocks get produced in a random lottery fashion
 Generates securely the next block + a proof of the waiting time
inside the TEE
 The proof of waiting time can be verified by all other nodes
 Problem: a small subset of compromised nodes can compromise
the entire system
Proof of Elapsed Time (PoET)
Non-Blockchain DLT
Distributed Ledger Technologies
(DLT) without a Blockchain
29
 Tangle == blockless distributed ledger
 Based on DAG (directed acyclic graph)
 Used by IOTA – iota.org
 Transactions with zero fees
 Validate 2 transactions to get your transaction validated for free
 Conflicts detected later, not fully decentralized!
 Store data from sensors and dataloggers securely and verified
 Scalable – more nodes add more processing power
 Lightweight – validators don't need the entire blockchain
DAG / Tangle / IOTA
30
 Superior distributed ledger technology system
 https://hashgraph.com
 Fast: with a very high throughput
and low consensus latency
 Secure: asynchronous byzantine
fault tolerant
 Fair: fairness of access, ordering,
and timestamps
HashGraph
Exercise: Explore Cryptocurrencies
https://coinmarketcap.com
32
 Bitcoin
 bitcoin.org
 Consensus algorithm
 Proof of work (PoW)
 Hash function
 SHA256
 Mining
 ASIC mineable
Bitcoin
33
 Ethereum
 ethereum.org
 Consensus algorithm
 Proof of work (PoW)
 Hash function
 ETHash
 Mining
 GPU and ASIC mineable
Ethereum
34
 Litecoin
 litecoin.org
 Consensus algorithm
 Proof of work (PoW)
 Hash function
 SCrypt (‘ess crypt’)
 Mining
 GPU and ASIC mineable
Litecoin
35
 Dash
 dash.org
 Consensus algorithm
 Proof of work (PoW)
 Hash function
 X11
 Mining
 GPU and ASIC mineable
Dash
36
 Monero – getmonero.org
 Anonymous blockchain
 Consensus algorithm
 Proof of work (PoW)
 Hash function
 CryptoNight
 Mining
 CPU and GPU mineable
Monero
37
 ZCash – z.cash
 Highly anonymous transactions
 Consensus algorithm
 Proof of work (PoW)
 Hash function
 Equihash
 Mining
 CPU and GPU mineable
ZCash
38
 Ripple – ripple.com/xrp
 Private blockchain for banks and financial institutions
 Semi-decentralized (the only trusted nodes in the network are
owned by Ripple Labs)
 Consensus algorithm
 Ripple consensus (federated PBFT variation)
 Mining
 Not mineable (only one company sells all XRP)
 Each transaction burns a small fee  no profit for validators
Ripple
39
 Cardano – cardanohub.org
 Decentralized public blockchain and cryptocurrency
 Smart contract platform
 Consensus algorithm
 Proof of Stake (PoS) – cardanodocs.com/cardano/proof-of-stake
 Mining
 Slot leaders are selected randomly according their stake
 Slot leaders mine the next blocks  collect transaction fees
Cardano
40
 IOTA – https://iota.org
 Public blockless distributed ledger (not a blockchain), no fees
 Consensus algorithm
 Tangle – goo.gl/ehrfEu
 The transaction issuers are also transaction approvers
 Mining
 No mining  all IOTA are pre-mined (in the genesis block)
 No transaction fees – pay by verifying at least 2 other transactions
IOTA
41
 NEM – nem.io
 Public blockchain & cryptocurrency
 Consensus algorithm
 Proof of Importance (PoI)
 Mining
 No mining, stakeholders can harvest blocks for transaction fees
 Harvesting is proportional to coins held and transactions
performed
NEM
42
 Stellar – stellar.org
 Aims to let you transact in your currency of choice (fiat or digital)
 Send money worldwide / exchange at low cost in any currency
 Uses lumens (XLM) as cryptocurrency coins
 Consensus algorithm
 Federated Byzantine Agreement (FBA), 3-5 seconds / transaction
 Mining
 No mining, all lumens are already distributed
Stellar
43
 EOS – eos.io
 Powerful infrastructure for decentralized applications (DApps)
 Asynchronous smart contracts + database + account permissions +
internet communications (like OS on the blockchain)
 Designed for millions transactions per second
 Consensus algorithm
 Delegated Proof of Stake (DPOS)
 Mining
 No mining, all EOS tokens are sold in a massive crowdsale (ICO)
EOS
Java-Based Blockchains
IOTA, NEM, TRON
45
Blockchain Projects and Technologies
Project Languages URL
Bitcoin Core C++, C https://github.com/bitcoin/bitcoin
Ethereum Go (primary), Rust, C++ https://github.com/ethereum
IOTA Java https://github.com/iotaledger/iri
Cardano Haskell https://github.com/input-output-hk/cardano-sl/
Bitcoin Cash C++, C https://github.com/Bitcoin-ABC/bitcoin-abc
Lisk JavaScript https://github.com/LiskHQ/lisk
NEO C# https://github.com/neo-project/neo
Stellar C++ https://github.com/stellar/stellar-core
Ripple C++, C https://github.com/ripple/rippled
46
 IOTA – https://github.com/iotaledger/iri
 Scalable, almost decentralized DLT for the IoT
 https://iota.org
 NEM – github.com/NemProject/nem.core
 Blockchain platform – public & private
 https://nem.io
 TRON – github.com/tronprotocol/java-tron
 Chinese decentralized storage platform
 https://tron.network
Java-Based Blockchains
47
 Web3j – https://github.com/web3j/web3j
 Ethereum client for Java
 BitcoinJ – https://github.com/bitcoinj/bitcoinj
 Bitcoin client for Java
Resources for Java Developers
?
Blockchain Consensus Algorithms

More Related Content

PPTX
Consensus Algorithms - Nakov at CryptoBlockCon - Las Vegas (2018)
PPTX
Overview of Blockchain Consensus Mechanisms
PDF
Understanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
PPTX
Blockchain Consensus Protocols
PDF
Blockchain, cryptography, and consensus
 
PPTX
Blockchain consensus algorithms
PPTX
Consensus Algorithms.pptx
PDF
PoW vs. PoS - Key Differences
Consensus Algorithms - Nakov at CryptoBlockCon - Las Vegas (2018)
Overview of Blockchain Consensus Mechanisms
Understanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
Blockchain Consensus Protocols
Blockchain, cryptography, and consensus
 
Blockchain consensus algorithms
Consensus Algorithms.pptx
PoW vs. PoS - Key Differences

What's hot (20)

PDF
Consensus Algorithms: An Introduction & Analysis
PDF
Ethereum in a nutshell
PPTX
Introduction Bitcoin
PDF
Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...
PPTX
Bitcoin & Bitcoin Mining
PPTX
Blockchain
PPTX
Introduction to Blockchain
PPTX
Understanding Blockchain
PPTX
Blockchain - HyperLedger Fabric
PDF
All About Ethereum
PPTX
Blockchain technology
PDF
Ethereum-Cryptocurrency (All about Ethereum)
PPTX
Blockchain ppt
PDF
Bitcoin Keys, Addresses & Wallets
PDF
Blockchain Presentation
PPTX
Introduction to Blockchain
PPTX
Understanding Cryptocurrency
PDF
Examples of Smart Contracts
ODP
Blockchain Gaming Revolution
PDF
Blockchain Security and Privacy
Consensus Algorithms: An Introduction & Analysis
Ethereum in a nutshell
Introduction Bitcoin
Blockchain Technology | Blockchain Explained | Blockchain Tutorial | Blockcha...
Bitcoin & Bitcoin Mining
Blockchain
Introduction to Blockchain
Understanding Blockchain
Blockchain - HyperLedger Fabric
All About Ethereum
Blockchain technology
Ethereum-Cryptocurrency (All about Ethereum)
Blockchain ppt
Bitcoin Keys, Addresses & Wallets
Blockchain Presentation
Introduction to Blockchain
Understanding Cryptocurrency
Examples of Smart Contracts
Blockchain Gaming Revolution
Blockchain Security and Privacy
Ad

Similar to Consensus Algorithms - Nakov @ jProfessionals - Jan 2018 (20)

PDF
This pdf contains consensus mechanism its types and its need.
PPTX
different consensus protocols in blockchian.pptx
PPTX
Blockchain
PPTX
4thSem_Blockchain Technology Unit 3.pptx
PPTX
4thSem_Blockchain Technology Unit 3.pptx
PPTX
20190606 blockchain101
PPTX
Introduction to Blockchain
PPTX
S2Blockchain-2-BC-DLT-040221-rfs blockchain.pptx
PDF
2019 blockchain economy
PPTX
Unit 1.pptx
PPTX
Blockchain Ecosystem and Cryptocurrency Regulations
PPTX
Introduction to Blockchain Web3 Session
PPTX
3_consesus_defence mechanism in blockchain.pptx
PDF
Cryptomania! The Past and Future of Digital Distributed Consensus
PPTX
unit3consesence.pptx
PDF
Indjic fintech module 6
PPTX
Understanding Consensus Mechanisms in Blockchain: Proof of Work, Proof of Sta...
PPTX
Fundametals of Blockchain and basics_L1.pptx
PPTX
IEEE ICDM 2018 Tutorial on Blockchain Data Analytics
PDF
Can we safely adapt the construction of permissionless blockchain to user dem...
This pdf contains consensus mechanism its types and its need.
different consensus protocols in blockchian.pptx
Blockchain
4thSem_Blockchain Technology Unit 3.pptx
4thSem_Blockchain Technology Unit 3.pptx
20190606 blockchain101
Introduction to Blockchain
S2Blockchain-2-BC-DLT-040221-rfs blockchain.pptx
2019 blockchain economy
Unit 1.pptx
Blockchain Ecosystem and Cryptocurrency Regulations
Introduction to Blockchain Web3 Session
3_consesus_defence mechanism in blockchain.pptx
Cryptomania! The Past and Future of Digital Distributed Consensus
unit3consesence.pptx
Indjic fintech module 6
Understanding Consensus Mechanisms in Blockchain: Proof of Work, Proof of Sta...
Fundametals of Blockchain and basics_L1.pptx
IEEE ICDM 2018 Tutorial on Blockchain Data Analytics
Can we safely adapt the construction of permissionless blockchain to user dem...
Ad

More from Svetlin Nakov (20)

PPTX
AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)
PPTX
AI за ежедневието - Наков @ Techniverse (Nov 2024)
PPTX
AI инструменти за бизнеса - Наков - Nov 2024
PPTX
AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024
PPTX
Software Engineers in the AI Era - Sept 2024
PPTX
Най-търсените направления в ИТ сферата за 2024
PPTX
BG-IT-Edu: отворено учебно съдържание за ИТ учители
PPTX
Programming World in 2024
PDF
AI Tools for Business and Startups
PPTX
AI Tools for Scientists - Nakov (Oct 2023)
PPTX
AI Tools for Entrepreneurs
PPTX
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
PPTX
AI Tools for Business and Personal Life
PDF
Дипломна работа: учебно съдържание по ООП - Светлин Наков
PPTX
Дипломна работа: учебно съдържание по ООП
PPTX
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
PPTX
AI and the Professions of the Future
PPTX
Programming Languages Trends for 2023
PPTX
IT Professions and How to Become a Developer
PPTX
GitHub Actions (Nakov at RuseConf, Sept 2022)
AI and the Future of Devs: Nakov @ Techniverse (Nov 2024)
AI за ежедневието - Наков @ Techniverse (Nov 2024)
AI инструменти за бизнеса - Наков - Nov 2024
AI Adoption in Business - Nakov at Forbes HR Forum - Sept 2024
Software Engineers in the AI Era - Sept 2024
Най-търсените направления в ИТ сферата за 2024
BG-IT-Edu: отворено учебно съдържание за ИТ учители
Programming World in 2024
AI Tools for Business and Startups
AI Tools for Scientists - Nakov (Oct 2023)
AI Tools for Entrepreneurs
Bulgarian Tech Industry - Nakov at Dev.BG All in One Conference 2023
AI Tools for Business and Personal Life
Дипломна работа: учебно съдържание по ООП - Светлин Наков
Дипломна работа: учебно съдържание по ООП
Свободно ИТ учебно съдържание за учители по програмиране и ИТ
AI and the Professions of the Future
Programming Languages Trends for 2023
IT Professions and How to Become a Developer
GitHub Actions (Nakov at RuseConf, Sept 2022)

Recently uploaded (20)

PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Cell Types and Its function , kingdom of life
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Cell Structure & Organelles in detailed.
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Pharma ospi slides which help in ospi learning
human mycosis Human fungal infections are called human mycosis..pptx
Renaissance Architecture: A Journey from Faith to Humanism
Complications of Minimal Access Surgery at WLH
Cell Types and Its function , kingdom of life
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Microbial diseases, their pathogenesis and prophylaxis
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Cell Structure & Organelles in detailed.
FourierSeries-QuestionsWithAnswers(Part-A).pdf
01-Introduction-to-Information-Management.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
O7-L3 Supply Chain Operations - ICLT Program
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Pharma ospi slides which help in ospi learning

Consensus Algorithms - Nakov @ jProfessionals - Jan 2018

  • 1. Blockchain Consensus Algorithms Consensus on the Blockchain, Proof-of-Work, Proof-of-Stake, DPoS, PoA, PBFT, Others Software University https://softuni.bg Svetlin Nakov Manager Training and Inspiration
  • 2. Table of Contents 1. Blockchain Concepts 2. What is Consensus Algorithm? 3. Proof of Work (PoW) 4. Proof of Stake (PoS) 5. Proof of … (whatever) 6. Cryptocurrencies and Their Consensus 7. Java-Based Blockchains 2
  • 4. 4 What is Blockchain? Distributed ledger Immutable Peer-to-Peer network Nodes hold ledger of facts + history of updates Decentralized (no owner) Secure Transactions are verified by the entire network
  • 5. 5 Blockchain == Chain of Data Blocks Demo: https://etherscan.io https://blockchain.info
  • 6. 6 Blockchain == Chain of Data Blocks timestamp block_hash all_transactions_hash transaction #1 hash transaction #2 hash transaction #3 hash … Block #0 (genesis block) prev_hash nonce timestamp block_hash all_transactions_hash transaction #1 hash transaction #2 hash transaction #3 hash … Block #1 nonceprev_hash timestamp block_hash all_transactions_hash transaction #1 hash transaction #2 hash transaction #3 hash … Block #3 prev_hash nonce
  • 7. 7 Mining the Next Block Blockchain clients create and sign transactions Transaction A Transaction B Transaction C Transaction … Blockchain Node #1 pending transactions Blockchain Network Blockchain Node #2 pending transactions Blockchain Node #... Transactions are sent to the network Blockchain Node #7 pending transactions Consensus algorithmConsensus algorithm Validates the pending transactions and creates the next block Selects the winning node (a lucky miner) Next (New) Block confirmed transactions Propagate for validation Order the transactions
  • 8. Consensus Algorithms Proof of Work, Proof of Stake, Proof of Burn, etc.
  • 9. 9  Consensus algorithm (consensus protocol / consensus mechanism)  Algorithm to reach agreement among the blockchain nodes  All nodes should agree about the changes in the distributed ledger  Proof-of-work (PoW), Proof-of-stake (PoS), other algorithms What is Consensus Algorithm?
  • 10. 10  Fault-tolerance  Some nodes will be unavailable when the ledger is changed  Consensus should be reached by part of the nodes (e.g. majority)  Attack-resistance  Some nodes will intentionally behave incorrectly  Honest nodes should win in the consensus process  Everyone on the network can verify the next block's correctness  Too much resources should be required for a successful attack Consensus Algorithm – Requirements
  • 11. 11  A "proof-of-work" (PoW) is a piece of data which is:  Difficult to produce  Easy for others to verify  Producing a proof-of-work can be a random guessing process  Or can be organized in mining pools (joint PoW production)  Example:  Find a number x, such that SHA256(text + x) has 10 leading zeroes  10 zeroes == network difficulty Proof-of-Work (PoW)
  • 12. 12  Needs computing power  Computationally expensive  Energy intensive  51% attack  Attackers holding more than 50% of the power could potentially reverse-back transactions (double-spend money) / deny service  Hashing algorithm types for PoW consensus  ASIC mineable (e.g. SHA256), CPU mineable (e.g. CryptoNight), GPU mineable (e.g. ETHash), CPU + GPU mineable (e.g. Equihash) Proof-of-Work: Problems
  • 13. 13  Transactions speed – average wait time  Bitcoin: new block mined in ~ 9-10 minutes  Ethereum: new block mined in ~ 10-15 seconds  Business needs real-time transactions (milliseconds)  Transactions throughput – transactions per second (tps)  Bitcoin: 2000-3000 / transactions per block  3-5 tps (up to 7 tps)  Ethereum: 200-300 / transactions per block  10-15 tps  Business needs thousands tps (e.g. VISA performs 2000 tps) Proof-of-Work: Problems (2)
  • 14. 14  Different cryptocurrencies use different hashing algorithms  Bitcoin, Bitcoin Cash – SHA256 – ASIC mineable  Ethereum, Ethereum Classic – ETHash – GPU mineable  ZCash, Bitcoin Gold – Equihash – CPU and GPU mineable  Monero – CryptoNight – CPU and GPU mineable  Litecoin, Dogecoin – SCrypt – GPU mineable  Dash – X11 – ASIC, CPU and GPU mineable  Stratis – X13 – ASIC, CPU and GPU mineable Proof-of-Work Cryptocurrencies See bitinfocharts.com
  • 15. 15  Similar to PoW, but based on HDD, not CPU / GPU  Pay for mining with hard drive space  More hard drive space  better chance of mining the next block  Calculating hashes is slow, so hashes are stored in the HDD for faster access  Plots – large data files holding of precomputed hashes  More plots  better your chance of finding the next block  Plot size is similar to hash rate in PoW Proof of Capacity (PoC) burst-coin.org
  • 16. 16  PoS is designed to increase network security and reduce resource wasting  The creator of the next block is chosen in  Combinations of random selection and wealth  E.g. holding 1% of the coins gives the chance to verify (mine) 1% of the "Proof of Stake blocks“  The "Monopoly Problem": a monopolist (holder of the most coins) could double spend or deny / filter other's transactions  Executing a monopoly attack is much more expensive than in PoW Proof of Stake (PoS)
  • 17. 17  Proof-of-stake (PoS) blockchains either  Start from a PoW algorithm to mine initial amounts of currency  Then switch to proof-of-stake, relying on the mined stakes  Example: BitConnect (bitconnect.co)  Or fork existing PoW blockchain with all its transactions, then switch to PoS-based consensus  Example: PIVX (pivx.org) forked from Dash  Or run a hybrid PoW + PoS consensus mechanism From PoW to PoS Consensus
  • 18. 18  Cardano – cardanohub.org  Qtum – qtum.org  PIVX – pivx.org  BitConnect – bitconnect.co  Stratis – stratisplatform.com Popular PoS Cryptocurrencies
  • 19. 19  Stakeholders vote for delegates in democratic way  Every wallet holding coins can vote for delegates  Votes weight is proportional to the wallet's stake in the network  Delegates generate new blocks (like miners in PoW)  Validate transactions and take the fees as profit  Maintain the blockchain, e.g. vote for changing the network parameters like block intervals, transaction fees, others  Very fast confirmation of transactions (< 1 sec) Delegated Proof of Stake (DPoS)
  • 20. 20  Lisk – lisk.io  EOS – eos.io  BitShares – bitshares.org  Ark – ark.io  Steem – steem.io Popular DPoS Cryptocurrencies
  • 21. 21  In Leased PoS users can choose:  To be a full node or lease their stake  Full nodes maintain the network  Process transactions and generate new blocks  PoS based on: own stake + leased stake  Serve as mining pools (collect fees and distribute the profits)  Most users lease their stake to full nodes  Take a portion from the full node's profits, just like in pool mining Leased Proof of Stake (LPoS) wavesplatform.com
  • 22. 22  PoB is similar to PoS, where stakes are based on burned coins  Burning coins gives the privilege to mine  Burn coins by sending them to a burning address (where they are irretrievable)  More coins you burn = better chance to be selected to mine the next block  Random selection process (weighted)  Like traditional mining  invest money to get mining power  PoW  invest in hardware; PoB  invest in burning coins Proof of Burn (PoB) http://slimco.in
  • 23. 23  PoI is similar to PoS, where stakes are based on coins + activity  The mining power calculated by the importance in the network  More coins hold for long time  bigger importance (like a stake)  More transactions / activities  bigger importance Proof of Importance (PoI) http://nem.io
  • 24. 24  PBFT as blockchain consensus algorithm  Nodes collecting transactions, select a leader for the next block  Can be random (deterministic) or random based on a stake  The leader orders the transactions + broadcasts the ordered list  Each node validates / executes the transactions + broadcasts the calculated hash of the new block  When 2/3 of the nodes have the same hash  The new block is published (mined)  Transactions are very fast PBFT (Practical Byzantine Fault Tolerance)
  • 25. 25  Hyperledger Fabric  https://hyperledger.org/projects/fabric  NEO – neo.org  Delegated Byzantine Fault Tolerance (dBFT)  Ripple (XRP) – ripple.com/xrp  Ripple Consensus Algorithm  Stellar – stellar.org  Federated Byzantine Agreement (FBA) PBFT Variations and Cryptocurrencies
  • 26. 26  Proof-of-Authority (PoA) assigns a set of trusted nodes (authorities) to process transactions and build new blocks  News blocks need to be signed by the majority of authorities  Works very well in private blockchains (cross validation)  Great performance, fast transactions, high throughput  Examples:  POA Network – https://poa.network  Ethereum Rinkeby Testnet – https://www.rinkeby.io Proof of Authority (PoA)
  • 27. 27  PoET relies on a trusted execution environment (TEE)  Supported by modern CPUs from Intel, AMD and ARM  No cryptographic puzzle (like in PoW algorithms)  PoET ensures blocks get produced in a random lottery fashion  Generates securely the next block + a proof of the waiting time inside the TEE  The proof of waiting time can be verified by all other nodes  Problem: a small subset of compromised nodes can compromise the entire system Proof of Elapsed Time (PoET)
  • 28. Non-Blockchain DLT Distributed Ledger Technologies (DLT) without a Blockchain
  • 29. 29  Tangle == blockless distributed ledger  Based on DAG (directed acyclic graph)  Used by IOTA – iota.org  Transactions with zero fees  Validate 2 transactions to get your transaction validated for free  Conflicts detected later, not fully decentralized!  Store data from sensors and dataloggers securely and verified  Scalable – more nodes add more processing power  Lightweight – validators don't need the entire blockchain DAG / Tangle / IOTA
  • 30. 30  Superior distributed ledger technology system  https://hashgraph.com  Fast: with a very high throughput and low consensus latency  Secure: asynchronous byzantine fault tolerant  Fair: fairness of access, ordering, and timestamps HashGraph
  • 32. 32  Bitcoin  bitcoin.org  Consensus algorithm  Proof of work (PoW)  Hash function  SHA256  Mining  ASIC mineable Bitcoin
  • 33. 33  Ethereum  ethereum.org  Consensus algorithm  Proof of work (PoW)  Hash function  ETHash  Mining  GPU and ASIC mineable Ethereum
  • 34. 34  Litecoin  litecoin.org  Consensus algorithm  Proof of work (PoW)  Hash function  SCrypt (‘ess crypt’)  Mining  GPU and ASIC mineable Litecoin
  • 35. 35  Dash  dash.org  Consensus algorithm  Proof of work (PoW)  Hash function  X11  Mining  GPU and ASIC mineable Dash
  • 36. 36  Monero – getmonero.org  Anonymous blockchain  Consensus algorithm  Proof of work (PoW)  Hash function  CryptoNight  Mining  CPU and GPU mineable Monero
  • 37. 37  ZCash – z.cash  Highly anonymous transactions  Consensus algorithm  Proof of work (PoW)  Hash function  Equihash  Mining  CPU and GPU mineable ZCash
  • 38. 38  Ripple – ripple.com/xrp  Private blockchain for banks and financial institutions  Semi-decentralized (the only trusted nodes in the network are owned by Ripple Labs)  Consensus algorithm  Ripple consensus (federated PBFT variation)  Mining  Not mineable (only one company sells all XRP)  Each transaction burns a small fee  no profit for validators Ripple
  • 39. 39  Cardano – cardanohub.org  Decentralized public blockchain and cryptocurrency  Smart contract platform  Consensus algorithm  Proof of Stake (PoS) – cardanodocs.com/cardano/proof-of-stake  Mining  Slot leaders are selected randomly according their stake  Slot leaders mine the next blocks  collect transaction fees Cardano
  • 40. 40  IOTA – https://iota.org  Public blockless distributed ledger (not a blockchain), no fees  Consensus algorithm  Tangle – goo.gl/ehrfEu  The transaction issuers are also transaction approvers  Mining  No mining  all IOTA are pre-mined (in the genesis block)  No transaction fees – pay by verifying at least 2 other transactions IOTA
  • 41. 41  NEM – nem.io  Public blockchain & cryptocurrency  Consensus algorithm  Proof of Importance (PoI)  Mining  No mining, stakeholders can harvest blocks for transaction fees  Harvesting is proportional to coins held and transactions performed NEM
  • 42. 42  Stellar – stellar.org  Aims to let you transact in your currency of choice (fiat or digital)  Send money worldwide / exchange at low cost in any currency  Uses lumens (XLM) as cryptocurrency coins  Consensus algorithm  Federated Byzantine Agreement (FBA), 3-5 seconds / transaction  Mining  No mining, all lumens are already distributed Stellar
  • 43. 43  EOS – eos.io  Powerful infrastructure for decentralized applications (DApps)  Asynchronous smart contracts + database + account permissions + internet communications (like OS on the blockchain)  Designed for millions transactions per second  Consensus algorithm  Delegated Proof of Stake (DPOS)  Mining  No mining, all EOS tokens are sold in a massive crowdsale (ICO) EOS
  • 45. 45 Blockchain Projects and Technologies Project Languages URL Bitcoin Core C++, C https://github.com/bitcoin/bitcoin Ethereum Go (primary), Rust, C++ https://github.com/ethereum IOTA Java https://github.com/iotaledger/iri Cardano Haskell https://github.com/input-output-hk/cardano-sl/ Bitcoin Cash C++, C https://github.com/Bitcoin-ABC/bitcoin-abc Lisk JavaScript https://github.com/LiskHQ/lisk NEO C# https://github.com/neo-project/neo Stellar C++ https://github.com/stellar/stellar-core Ripple C++, C https://github.com/ripple/rippled
  • 46. 46  IOTA – https://github.com/iotaledger/iri  Scalable, almost decentralized DLT for the IoT  https://iota.org  NEM – github.com/NemProject/nem.core  Blockchain platform – public & private  https://nem.io  TRON – github.com/tronprotocol/java-tron  Chinese decentralized storage platform  https://tron.network Java-Based Blockchains
  • 47. 47  Web3j – https://github.com/web3j/web3j  Ethereum client for Java  BitcoinJ – https://github.com/bitcoinj/bitcoinj  Bitcoin client for Java Resources for Java Developers