Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Consensus Algorithms - Nakov @ jProfessionals - Jan 2018

Decentralized consensus algorithms for blockchain networks: proof-of-work, proof-of-stake, delegated-proof-of-stake, PBFT, other.

Dr. Svetlin Nakov @ jProfessionals Conference, Jan 2018 - Sofia

Livres associés

Gratuit avec un essai de 30 jours de Scribd

Tout voir

Consensus Algorithms - Nakov @ jProfessionals - Jan 2018

  1. 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. 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
  3. 3. Blockchain Distributed Ledger Technology
  4. 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. 5 Blockchain == Chain of Data Blocks Demo: https://etherscan.io https://blockchain.info
  6. 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. 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. 8. Consensus Algorithms Proof of Work, Proof of Stake, Proof of Burn, etc.
  9. 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. 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. 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. 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. 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. 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. 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. 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. 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. 18  Cardano – cardanohub.org  Qtum – qtum.org  PIVX – pivx.org  BitConnect – bitconnect.co  Stratis – stratisplatform.com Popular PoS Cryptocurrencies
  19. 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. 20  Lisk – lisk.io  EOS – eos.io  BitShares – bitshares.org  Ark – ark.io  Steem – steem.io Popular DPoS Cryptocurrencies
  21. 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. 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. 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. 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. 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. 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. 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. 28. Non-Blockchain DLT Distributed Ledger Technologies (DLT) without a Blockchain
  29. 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. 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
  31. 31. Exercise: Explore Cryptocurrencies https://coinmarketcap.com
  32. 32. 32  Bitcoin  bitcoin.org  Consensus algorithm  Proof of work (PoW)  Hash function  SHA256  Mining  ASIC mineable Bitcoin
  33. 33. 33  Ethereum  ethereum.org  Consensus algorithm  Proof of work (PoW)  Hash function  ETHash  Mining  GPU and ASIC mineable Ethereum
  34. 34. 34  Litecoin  litecoin.org  Consensus algorithm  Proof of work (PoW)  Hash function  SCrypt (‘ess crypt’)  Mining  GPU and ASIC mineable Litecoin
  35. 35. 35  Dash  dash.org  Consensus algorithm  Proof of work (PoW)  Hash function  X11  Mining  GPU and ASIC mineable Dash
  36. 36. 36  Monero – getmonero.org  Anonymous blockchain  Consensus algorithm  Proof of work (PoW)  Hash function  CryptoNight  Mining  CPU and GPU mineable Monero
  37. 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. 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. 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. 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. 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. 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. 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
  44. 44. Java-Based Blockchains IOTA, NEM, TRON
  45. 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. 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. 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
  48. 48. ? Blockchain Consensus Algorithms

×