2. Reaching Consensus

The central idea behind blockchain networks is not really the technology—hash algorithms and public key infrastructure (PKI) technologies have existed for many years. As we discussed in the previous chapter, the chief innovation in Bitcoin is a new incentive structure to make sure that although every individual in the network is uncooperative (i.e., decentralized), they will nevertheless collectively behave in a way that maintains the integrity and security of the network. Economic incentives from cryptocurrencies are working in tandem with technological solutions in blockchain networks to solve problems that were previously impossible to address with technology alone.

The most important example of this seamless collaboration between software engineering and economic design is the blockchain’s consensus mechanism.

What Is Blockchain Consensus?

Since a public blockchain is a distributed ledger maintained by untrusted participants, it is crucial to reach network-wide consensus on which transactions are valid and should be recorded on the blockchain. Automated consensus is the core idea behind blockchains. How to improve the efficiency of consensus without compromising security is one of the most important challenges facing blockchains today.

To be fair, the human society has long developed ways to reach consensus. For example, all types of voting systems are designed to reach consensus. Enabled by technologies, we now also have informal voting systems such as Facebook likes and Reddit upvotes. However, human voting is too slow and subject to humans’ unreliable interpretation of rules. It cannot handle high-speed, high-volume transactions required by a global computing network.

Algorithms can help us reach consensus much faster on the Internet scale. Such examples include Google page ranks, Google Ads auctions, online reputation scores, matching algorithms from Uber to Tinder, and so on. However, such algorithms are typically only appropriately correct. They cannot guarantee the accuracy of individual transactions. The blockchain network goes one step further and provides an automated computational method to definitively validate and record transactions.

While many blockchain projects innovate on the consensus mechanism to be “proof of XYZ,” we believe that, fundamentally, there are only two types of consensus—proof of work (PoW) and proof of stake (PoS).

Proof of Work (PoW)

The Bitcoin is a classic example of a PoW consensus blockchain. While it suffers from various technical problems such as low performance, poor scalability, and wasteful electricity use, it has proven secure against highly motivated attacks by individuals, organizations, and even nation-states. It builds a trillion-dollar global network without requiring trust in any of its participants. So far, no one has been able to create a fraudulent transaction in the blockchain—despite the massive financial payoff such hacks could bring. That is a monumental achievement by Bitcoin’s creator, Satoshi Nakamoto.

In a PoW system, miners compete to solve a math puzzle for each block. The first one to solve this problem is the first to propose a new block and receive the Bitcoin award associated with the block. The “winner” can include any pending transactions he chooses in the block but cannot include any invalid ones (i.e., all transactions must be properly signed, and their originating accounts must have sufficient funds). If other miners detect that there are invalid transactions in the block, they will propose competing blocks.

The community of miners “votes” by each independently choosing which competing blocks to build the subsequent new blocks upon. Let’s say that there is a malicious miner who includes a large unauthorized Bitcoin transaction to herself whenever she wins the math contest to propose a new block. But, no one else will build on her block since other miners are also selfish and have no incentive to break the rules to benefit her. If she continues to build on it, she will be the only one on that branch of the blockchain. It will become really obvious that her branch (or fork) of the blockchain is illegitimate.

Now, if a majority of miners (as measured by computing power) collude, they could all intentionally build in the invalid block and make the fork appear as the legitimate trunk of the Bitcoin blockchain. That is known as a 51 percent attack. In a large blockchain network such as Bitcoin, the amount of resources required to accumulate such computing power to reach 51 percent is enormous. With that kind of computing power, a potential attacker is economically better off following the rules to mine new Bitcoin blocks instead of trying to attack and destroy the Bitcoin value for everyone.

Note

A 51 percent attack is a way for the community to reach consensus to accept a block with invalid transactions.

Proof of Stake (PoS)

While PoW is a great invention that has been proven secure in the real world, it also suffers from many problems. It requires enormous amounts of computing power to perform wasteful computational work to artificially make it economically unfeasible for potential attackers. It encourages everyone to participate in the mining process, causing consensus to be slow to emerge and converge. When there are multiple competing blocks, it takes a long time (an hour or more) for the system to settle on a consensus branch.

To solve PoW’s problems, a new consensus mechanism called proof of stake was proposed. A PoS system allows a straight vote for each new block by the network’s stakeholders (account holders for the blockchain’s native cryptocurrency or token). The proposer of a new block is randomly chosen. Your voting power is proportional to the tokens you hold in your account. With voting, the blockchain can achieve finality in each block with a minimal amount of computation. The proposer of an accepted new block receives an award in the blockchain’s native cryptocurrency.

This process is called minting new cryptocurrency as opposed to POW’s mining. A PoS system is typically much more performant than a PoW system. Examples of large public PoS blockchains include the following:

  • The Casper project (https://github.com/ethereum/casper) aims to transform the Ethereum blockchain from a PoW system to a PoS system. Once completed, it will be the largest PoS blockchain ecosystem in the world.

  • The QTUM blockchain (https://qtum.org/) is designed to be a PoS blockchain based on a Bitcoin-like infrastructure.

Note

An interesting side effect of a PoS cryptocurrency is that stakeholders are encouraged to stake their tokens to participate in the voting process and receive new block awards. They are financially dis-incentivized to trade their tokens. That decreases the “money” supply and could make such cryptocurrency more valuable in the market.

The voting mechanism in a PoS system is the subject of intense research and innovation. Specifically, the system must assume uncooperative or even malicious voters. This is commonly known as the Byzantine Generals Problem in game theory. A voting mechanism that can be mathematically proven to withstand up to one-third of fraudulent voters has to be Byzantine fault tolerant (BFT). BFT consensus engines are now widely used in blockchain design.

However, a plain PoS system also has significant shortcomings. Here are some examples:

  • Participants could have nothing to lose by voting yes on invalid block proposals. Some kind of penalty (or slashing) must be introduced to “punish” misbehaving participants.

  • Voting itself is a technical endeavor few people master, as the performance and security requirements are high for a high-performance network.

  • Allowing all stakeholders (even ones with a single token) to vote could result in the same performance degradation seen in PoW systems.

  • The large voting power from large stakeholders could result in a concentration of power over time.

A few improvements to PoS have been suggested. A leading candidate is called delegated proof of stake (DPoS).

Delegated Proof of Stake (DPoS)

A DPoS system has only a limited number of validators who can propose and vote on new blocks. Stakeholders can “delegate” their cryptocurrencies to validators they choose, and validators will vote on their behalf. That allows validators to become professional operators (similar to a mining pool in a PoW system) and can be subject to penalties if they vote for invalid blocks (or are careless and hacked). Examples of DPoS blockchains include the following:

  • The Bitshares project (https://bitshares.org/) is the pioneer of the DPoS concept. It is a public blockchain with 21 elected validators.

  • The Cosmos project (https://cosmos.network/) is a public network of blockchains all built on the Tendermint DPoS consensus engine that can exchange information with each other. We will cover Cosmos in later chapters.

  • The CyberMiles project (http://cybermiles.io/) is a public blockchain network specifically optimized for smart contracts and compliant token issuance for commercial businesses. We will use CyberMiles as an example of blockchain system design in later chapters.

In political economy terms, DPoS is similar to a representative democracy with landowner (or property owner) suffrage.

  • Validators, or representatives, are delegated by the community to decide the day-to-day questions, such as the consensus for each block and each transaction, to maintain the integrity of the ledger (no double spend) and the smart contract executions.

  • The right to vote on representatives is given to participants who hold a certain form of property. This property represents a commitment to the community and also a loss of liquidity. In this case, the crypto tokens that represent the value of the blockchain network as a whole are the property. This model resembles the historical landowner suffrage.

Notice that, similar to the democratic system, the property (or tokens) is used only for staking a delegate. The staked tokens are locked by the network to prevent trading and are made available for penalties. The ownership of the staked tokens is never transferred to the validator.

In the end, the purpose of the blockchain is to reach consensus. It is natural for us to model consensus after representative democracy mechanisms that human society has used for thousands of years.

Conclusion

In this chapter, I explained how economic engineering works hand in hand with software engineering to secure blockchain networks. Such a trustless network requires, and also enables, valuable cryptocurrencies to function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.156.140