NA:Consensus and Fault Tolerance

Consensus in Blockchain

The blockchain is a distributed and decentralized system, which means that it needs to have a way of tracking the official current state of the system. Since the blockchain can include financial transactions and business agreements, it is important that all parties involved are in sync regarding the terms of the agreement.  

In this section, we will discuss the details of how a blockchain network comes to agreement on the contents of the blockchain.

consensus

=======================================================

Video: Consensus

=======================================================================

Introduction to Consensus in the Blockchain

Introduction to Consensus

The blockchain is designed to be a shared, synchronized historical ledger, meaning that there needs to be a final decision at some point on what should and shouldn’t be included in the official record. Since blockchain is decentralized, there is no "higher authority" that can rubber-stamp and finalize the contents of a blockchain block.

=======================================================================

Introduction to Consensus in the Blockchain: Scarcity

Introduction to Consensus

 The method that Satoshi Nakamoto, the creator of blockchain, invented to achieve consensus is based on scarcity. In one way or another, blockchain consensus algorithms boil down to some kind of vote where the number of votes that a user has is tied to the amount of a limited resource that is under the user’s control. Based on the economic Laws of Supply and Demand, collecting enough of an asset to have a controlling share will drive up the price of the asset enough to make achieving that level of control unfeasibly expensive.

=======================================================================

Introduction to Consensus in the Blockchain: Consensus Mechanisms

Introduction to Consensus

 Satoshi Nakamoto invented a consensus algorithm called Proof of Work for the use of Bitcoin. Since then, several other consensus algorithms have been invented to fit different use cases. These include Proof of Stake, Delegated Proof of Stake, Practical Byzantine Fault Tolerance, and Directed Acyclic Graphs. The most commonly used consensus algorithms are Proof of Work and Proof of Stake.

=======================================================================

Proof of Work: Computational Resources

Proof of Work: Computational Resources (POW is based on the scarcity of computational resources)
=======================================================================

Proof of Work: Incentivizes

Proof of Work: Incentivizes (Miners in POW blockchain race to find a an acceptable solution to a cryptographic problem)

 In Proof of Work, users in the blockchain network who want to create the next block (and win the associated reward) are called miners. To win the right to mine a block, miners race to find an acceptable solution to a “hard” cryptographic problem. As we discussed previously, “hard” mathematical problems can only be solved by random guessing. When a miner finds an acceptable solution, they create a block and broadcast it to the network, finalizing that block.

Proof of Work exploits the scarcity of computational resources by choosing a problem that can only be solved by guessing. There is no limit on the number of guesses that a miner can make at once. Proof of Work, therefore, incentivizes miners to run as many mining machines as possible to maximize the probability that they are the first to find a solution to the problem. Since mining computers take money to purchase and money to run, the amount of control that a user can exert over the blockchain is limited by the amount of money they have available to invest in mining equipment.

=======================================================================

Proof of Work: 51% Security

Proof of Work: 51% Security (POW assumes no one controls more than half of a network's resources)

 The security of the Proof of Work consensus is based on the assumption that no one controls more than half of the computational resources of a blockchain’s mining network. If this was the case, the miner has a high probability of finding an acceptable solution to the mining puzzle before anyone else for every block in the blockchain. This gives the miner complete control of the blockchain and breaks the decentralization of blockchain.

=======================================================================

Proof of Stake: Scarce Commodity

Proof of Stake: Scarce Commodity (POS is based on the scarcity of the given cryptocurrency)
=======================================================================

Proof of Stake: Stake

Proof of Stake: Stake (The forger of the next block is psuedo-randomly selected from all users with a stake. The probability of being chosen is roughly proportional to the size of the user's stake)

 Users in a Proof of Stake blockchain can "stake" or promise not to use the tokens they own. This gives them the opportunity to be selected as the next user to create or "forge" a new block and earn the reward. A block forger is pseudo-randomly selected from all of the users who have staked some of their assets, and the selection process is biased based on the size of the stake.

For example, imagine that a wheel is divided into sections where the size of a section is proportional to the size of a user’s stake. The next block creator would be chosen by spinning the wheel and seeing whose section comes out on top. In Proof of Stake, each user has a copy of the wheel and they are all synchronized so that each person can independently determine the selection and get the same result. This is why Proof of Stake uses a pseudo-random instead of a random selection process.

=======================================================================

Proof of Stake: Economic Infeasibility

Proof of Stake: Economic Infeasibility (POS assumes that no user controls an overwhelming % of a cryptocurrency. If so, they will be selected to forge most blocks, giving them control of the cryptocurrency)

 In Proof of Stake, an attacker needs to control enough of the staked currency to guarantee they will be selected to create every block. Since cryptocurrency is a limited asset, buying up enough of it to do this is expensive, making attacks on Proof of Stake systems economically infeasible.

=======================================================================

Specific Consensus Implementations: Ethereum

Ethereum currently uses Proof of Work for consensus. And Casper is the planned migration of Ethereum from Proof of Work to Proof of Stake.

Of the three blockchains studied, Ethereum is the only one that uses a standardized consensus mechanism. Ethereum was designed from the beginning to use Proof of Work for consensus, until a forced hard fork to the Proof of Stake implementation (codenamed Casper). This forced hard fork is baked into the Ethereum protocol and will be accomplished by slowly increasing the difficulty of the Proof of Work problem until the time taken to solve it increases to the point where Proof of Work becomes unusable. Proof of Stake does not require the same energy consumption as Proof of Work and is a more sustainable and scalable consensus mechanism.

=======================================================================

Specific Consensus Implementations: Hyperledger Fabric

Hyperledger Fabric breaks out consensus into components, allowing users to pick a consensus algorithm for their particular use.

Hyperledger Fabric deliberately avoided hard-coding a consensus mechanism into the protocol by defining an “orderer component” that performs all of the consensus-related operations. This allows users of Hyperledger Fabric to select a consensus algorithm that fits their use case without being forced to make large-scale code edits.

=======================================================================

Specific Consensus Implementations: Corda

Each Corda network has a notary service made up of independent parties that approve blocks using any applicable consensus algorithms.

Corda does not follow the standard blockchain model of transactions being bundled into blocks and then being finalized by the network as a whole. Instead, a Corda network contains one or more notaries consisting of several independent parties. Transactions in Corda are finalized by a notary with a multiparty digital signature using an algorithm like Raft.

=======================================================================

Fault Tolerance in the Blockchain

Blockchain is a distributed, decentralized system that maintains a shared state. While consensus algorithms are designed to make it possible for the network to agree on the state, there is the possibility that agreement does not occur. Fault tolerance is an important aspect of blockchain technology.
=======================================================================

Video: Fault Tolerance

=======================================================================

The Byzantine Generals' Problem

The Byzantine Generals' Problem (discussed in the previous video):

    • Several generals needing to agree on a coordinated plan of attack.
    • One or more generals may be traitors.
    • All generals will abide by the majority decision, but may try to influence it.

Blockchains are designed to have Byzantine Fault Tolerance:

    • All nodes are untrusted.
    • Nodes must come to a consensus on the official state of the blockchain.

The Byzantine Generals' Problem is a scenario designed to demonstrate the difficulty of multiple parties coming to an agreement when communication can only be accomplished on a one-to-one basis and is untrusted. In the story, several Byzantine Generals are besieging a city with their separate armies. If they all attack together or all retreat together, they will be ok, but if some attack while others retreat, they will be destroyed.

The generals can only communicate by messengers, who could be intercepted and forced to carry fake messages, and one or more generals may be a traitor. The goal is to find a way to achieve a consensus on strategy despite the possibility of traitors and false messages. Presumably, all generals will abide by what they believe is the majority consensus. The Byzantine Generals' Problem is solvable as long as two-thirds of the generals are honest.

Blockchain is designed to be Byzantine Fault Tolerant, meaning that the network will come to a consensus on the official state of the blockchain, despite the fact that some members may misbehave. The solution to the Byzantine Generals' Problem is inefficient, so the blockchain needs some way of being confident of consensus without going through a full solution.

=======================================================================

Video: Proof of Work vs. Proof of Stake

=======================================================================

Proof of Work vs. Proof of Stake

Proof of Work

Proof of Stake

Distributed consensus among untrusted and unidentifiable nodes

Distributed consensus among untrusted and identifiable nodes

Incentives are reworded within the system for work done outside of the system

Incentives are rewarded within the system for escrow inside the system

Relatively high cost of entry, but high returns

Low cost of entry, but low returns

Empirically proven

Experimental

 

Proof of Work provides a game-theoretical distributed consensus algorithm:

      • Proof of Work incentivizes mining nodes on the network to reach for the thermodynamic limit of computational cycles. This incentivizes decentralization because heat from mining nodes dissipates better in two separate places rather than one centralized location. Note, this decentralization is solely physical and a network distribution.
      • Proof of Work has empirically proven that game-theory can be weaved into a protocol because it successfully applies incentives at every possible action within the network.
      • Proof of Work only works because it is optimization-free and approximation-free.
        1. Optimization-free means there is no possible way to circumvent the hashing of the mining protocol necessary to secure a block.
        2. Approximation-free means there is no possible way to almost have a block. The process is binary; there are blocks and not blocks.

Proof of Stake provides an experimental internally game-theoretical consensus algorithm:

    • It relies on nodes already having cryptocurrency to stake. It rewards nodes with the most money staked, and not the most computational power.
    • It requires that each validating node be identifiable. This is because the staked coins must be held accountable for any malicious acts. Proof of Work does not require identification.
    • In Proof of Stake,you are competing with a much larger group of nodes. There is no transactional friction involved in staking coins, unlike in Proof of Work, which requires buying mining hardware, hooking up internet, providing cooling systems, etc.