Consensus mechanisms are a process for group decision-making. There is no authority in a blockchain but the consensus of the majority, therefore participants in the network need a mechanism to reach said consensus. Most of these mechanisms include a central resource that must be used in order to gain the right to say “this is the next block in this blockchain”, which is a matter of security: an attacker wanting to take complete control must expend the same amount of resources as at least half of the network.

Why do we need to reach a majority in the first place? We can understand this necessity by looking at how databases (a blockchain is fundamentally a kind of database) scale up in number of copies. This article effectively works as a summary of the “Consensus Mechanisms” series, which examines each of these much more in depth.

Warning: simplification!

It is technically not always true that you need to possess the equivalent of 50% of a blockchain’s resources to be an effective attacker – depending on the system, you might need as little as a third, or much more. It is however the most common figure, and the one that holds true for most current implementations.

First rung: “single source of truth” databases

Most online services work with a single centralized database: there is only one actor who is concerned with the contents of the database because they are specific to their service. Most WordPress blogs, for example, have a single database, which is the “single source of truth” for everything related to that blog. All information is stored there, and there’s a single copy of it. In the case of transactions, that single database would contain information about your balance, my balance, and recording a transfer is a simple matter of adjusting our balances.

Second rung: “federated” databases

For resilience and scalability, most successful services move to a “federated” database structure, in which there are multiple databases, often geographically distributed, that are kept in sync. They are still all controlled by one actor, so they are distributed like a blockchain, but only in a limited sense. For example, the data that Google collects is owned solely by Google, the company won’t give me a copy of their whole database – if we were instead validators of the same blockchain, we would both have a copy of that data.

This type of database still offers a single source of truth, technically – the data is simply replicated across a number of copies.

Third rung: blockchain

With the next step up on the decentralization ladder we arrive to a blockchain: anybody can host a complete copy of the database, and (many) copies are vying to add to that shared truth. In this system, there is no single source of truth to rely upon, but it’s absolutely necessary to find consensus, otherwise it is impossible to interact with the system in a sane way: how am I supposed to send you money if one copy says I have ten coins and another says I have zero?

To have a truly distributed database we need a potentially infinite number of copies, but we cannot trust any single one, as they might be malicious and give us a false version of the truth; here is where consensus mechanisms come into play: they serve to incentivize good behaviour in all database copies, and establish processes to make sure that only valid data (i.e. data that a majority recognizes as valid) is recorded and eventually broadcast to all databases.

Some examples of consensus mechanism

Consensus mechanisms increased in number in the last few years, after an initial reliance on Proof of Work. Although the total is far higher, we can mostly organize them in three categories: Proof of Work, Proof of Stake, and Proof of Authority.

Proof of Work

This is the consensus mechanism used by Bitcoin, and at the time of writing it is still used by the majority of public blockchains. In this system, every validator, or “miner”, races to solve a computationally-intensive puzzle. The solution includes a record of the transactions the validator wants to add to the blockchain. As soon as they solve the puzzle, validators broadcast their solution, and the first solution that reaches (and is validated by) the majority of others is added to that blockchain.

The resource that Proof of Work requires is computational power, sometimes referenced more technically as hash power. This is why Bitcoin is often referred to as consuming terawatts of electricity: its security, given by its consensus mechanism, is derived by the computations used to validate new blocks in a blockchain, which are in essence electricity and its price.

Proof of Stake

In Proof of Stake the right to validate transactions is given by one’s “stake” in a blockchain. Every validator (or “minter”) must commit part of their tokens to the system, an act known as “bonding”, to be used as collateral. An algorithm then selects the next validator based on a number of factors, the most important of which is the size of their stake in relation to the total amount of stakes in the network. If the minter’s amounts to 1% of the total, they will validate 1% of the blocks. After a validator finishes their block, it’s broadcast to the rest of the chain. If at some point the minter is determined to be acting in bad faith, their stake is “slashed”, i.e. they lose it. This is what provides security: a minter has both a psychological incentive in the well being of the network, since they are required to buy into it to get a stake, and an economic one to not lose their stake by acting mischievously.

The security of Proof of Stake versus Proof of Work is quite a controversial topic, as it is still unclear how costly it is to acquire (for a majority attack) 51% of the tokens in a blockchain versus 51% of the computing power, and how resilient Proof of Stake is to events that temporarily bring down part of the network.

Proof of Authority

Proof of Authority is quite interesting, as validators are trusted individuals or organizations chosen by the network through a strict vetting process, usually even requiring their identity to be public on the blockchain among other things. These validators (or “sealers”) create new blocks in a round-robin fashion, until all of them have sealed a block, and the process repeats. Sealers that do not respect the rules are ousted from their position, and since to become a validator in such a blockchain one needs to bind their identity to it, the resource at stake is their reputation: actors are incentivized to maintain a pristine conduct, at the cost of having their status revoked and losing their ability to collect fees from transactions.

Proof of Authority has many advantages, the biggest of which is very quick block-creation timeframes and low resource usage, but it is quite a departure from the trustless nature of other consensus mechanisms.

That’s it!

These are the most common consensus mechanisms at the time of writing, though as more types are used in “popular” projects they will be included in this list. A more detailed explanation of each of the consensus mechanisms is here: Proof of Work, Proof of Stake, Proof of Authority. Enjoy!

    Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.