CertiK Logo
Products
Company
Cancel
Back to all stories
Blogs
Understanding Avalanche's Consensus Mechanism
8/15/2022
Understanding Avalanche's Consensus Mechanism

For anyone looking to get a sense of the scale of innovation that Avalanche enables, understanding its novel solution to achieving consensus is a good place to start.

In a space that is crowded with projects claiming to offer a radical new technology, it can be hard to discern whether a project is really offering innovation, or is just looking to build some hype.

To help you separate the wheat from the chaff, this blog post will take you through one of the biggest innovations that Avalanche’s technology offers, its consensus mechanism, contextualizing it within the history of the solutions to achieving consensus to show how it solves many of the limitations of the prior art.

Moving beyond this, this blog will then show how Avalanche smart contract audits are essential for any project seeking to build on the security offered by Avalanche’s novel approach to consensus, and will argue that any Avalanche smart contract audit worth its salt will need a detailed understanding of how its network handles consensus.

What is a Consensus Mechanism?

First, let’s take a look at how consensus has been formed historically to get a better understanding of how Avalanche disrupts the space.

A consensus protocol– how a system or collection of machines agrees on something– is one of the most important functions of a distributed computing system.

The problem that consensus protocols are designed to resolve was identified by the computer scientists Leslie Lamport, Robert Shostak, and Marshall Pease in their groundbreaking paper, ‘The Byzantine Generals Problem’.

In this paper, the problem of reaching consensus is explained through the analogy of a collection of Byzantine Generals who have surrounded a city, and need to coordinate on when to attack. If they attack at the same time they will have victory, if not, they will be defeated.

However, the generals can only communicate with each other via messengers, and some of the generals may be corrupted and try to confuse the others. In this situation, the Byzantine Generals Problem asks how a consensus can be formed between loyal generals.

Lamport, Shostak, and Pease’s paper shows that consensus can be formed so long as at least two-thirds of the generals remain loyal.

Classical Consensus

The first applied solution to this problem was designed by Lamport and another computer scientist, Barbara Liskov, in what is now described as ‘classical consensus’.

One big advantage of classical consensus protocols is that they achieve finality (the point at which a state cannot be altered or reversed) extremely quickly. However, a major disadvantage of these systems is that all of the nodes in the network need to know one another. This means that the system must be both relatively small, and permissioned.

This also means that classical consensus systems are not scalable, as scalability requires the number of nodes to proliferate to the point that it is impossible for each node to be known.

Because of this, whilst extremely useful in certain private instances, classical consensus could not support a scalable system such as is required in a cryptocurrency.

Nakamoto Consensus

The next major development in consensus protocols came with the now famous Nakamoto Consensus, outlined by the pseudonymous Satoshi Nakamoto in the Bitcoin whitepaper.

As you likely know, the Nakamoto Consensus constituted a paradigm shift in decentralized systems by allowing consensus to be formed without needing to know the identity of each member.

This solution’s major advantage is that it is robust, meaning that anyone can join or leave the network at any time, and no permission is required for a node to join the network and become a validator (hence the so-called ‘permissionless system). In this way, the Nakamoto Consensus allows for scalability, which consequently enabled the creation of Bitcoin as the first cryptocurrency.

However, the Nakamoto Consensus and the cryptocurrency it facilitates are not without their flaws.

Firstly, Bitcoin has high latency, meaning that it is relatively slow and it can take a long time after a transaction is submitted for it to be confirmed and immutable. This is a major barrier to Bitcoin becoming an everyday means of payment as vendors require transactions to be fast and final– you wouldn’t want to have to wait in a store for up to an hour just to buy a drink!

Secondly, Bitcoin has a low throughput, meaning that it can process about 3-7 transactions per second (tps).To put this in perspective, Visa can handle more than 65,000 tps. This low throughout makes it unrealistic as a practical form of global currency, and more a store of value.

Lastly, the Nakamoto Consensus is extremely energy inefficient. This is because each node is required to expend an amount of energy to ensure that they are sufficiently invested in upholding the system. Whilst this ‘proof-of-work’ system was one of the most powerful innovations that Nakamoto brought to consensus protocols, it was also one of the most problematic because, as Bitcoin has scaled, it now consumes an estimated 150 terawatt-hours of energy. That’s more than the entire country of Argentina.

Avalanche Consensus

For a long time, Classical Consensus and Nakamoto Consensus were the only games in town. Then Avalanche arrived on the scene, building on the findings detailed in a whitepaper written by the anonymous Team Rocket, entitled ‘Snowflake to Avalanche: A Novel Metastable Consensus Protocol Family for Cryptocurrencies’.

Avalanche Consensus combines the best elements of both Classical Consensus and Nakamoto Consensus to create a new, leaderless blockchain that is scalable, robust, and green.

When compared to the problems in the consensus mechanisms outlined above, Avalanche Consensus outperforms in a number of key areas.

Firstly, it is low latency and quick finality, which means that transactions are fast and arrive at completion in around 2 seconds. This allows it to function as a global currency that is practical for everyday use. To return to the example of buying a drink at a store, with Avalanche you will be out of there in just two seconds, as opposed to up to an hour with Bitcoin. Supporting this, it also has a high throughout, able to facilitate up to 1000-10000 tps, allowing it to remain fast with a wide user base.

Avalanche is also highly scalable, able to scale from 10k nodes up to potentially 10m nodes. This kind of scalability is vital for a network that is serious about supporting a global currency and is only made possible by the fact that, unlike a classical system, Avalanche is robust; there is no need for permission to be granted to for individuals to participate in it.

And, perhaps most importantly, Avalanche is a quiescent protocol, meaning that it is green and sustainable, and it does not have to deal with a separate ecosystem of miners who have their own interests that may be separate from those of the users.

For those invested in Web3 security, these metrics also have implications for the attack vectors and vulnerabilities that would be sought out by an Avalanche smart contract audit.

How Does it Work?

To get a better understanding of how Avalanche reaches consensus, it is useful to imagine a crowded stadium, with each individual in the stadium in possession of a red and blue card. Then, out of that stadium, a random sample is taken, and each individual in the sample is asked to choose between the red or blue card.

One round of polling gives a sense of which direction the stadium is leaning, and a member looking to match the color chosen by the majority of the stadium will have a basis on which to choose. Then with successive polling, a clear majority will emerge and the stadium will ultimately shift to all be holding the same color.

Within this system, even in the worst-case scenario of a 50/50 split, random sampling and successive polling will rapidly produce a clear majority.

In this way, the Avalanche consensus is designed to tip in favor of the majority, a quality that allows it to achieve consensus in a way that is scalable and has low latency. It is also so energy efficient that an individual could participate via their cellphone.

These are the fundamentals of how Avalanche reaches consensus and enables its game-changing architecture. For a more granular understanding of how this works, and for insight into the recent updates to the protocol in the form of Snowman++, click here.

Securing Avalanche with CertiK’s Avalanche Smart Contract Audit

Avalanche consensus’s resolution of the blockchain trilemma is a watershed moment in terms of Web3 security, offering a crucial foundation for anyone looking to develop innovative apps on its network.

Numerous Avalanche projects have chosen CertiK’s Avalanche smart contract audit for our unique understanding of its specific needs and architectures.

Having a firm grasp on the specific means by which a protocol achieves consensus is essential to understanding its security, and any Avalanche smart contract audit must combine a highly technical knowledge of the foundational technology, along with how it intersects with the various implementations of that technology through various projects.

As Avalanche’s unique architecture increasingly attracts developers to its platform, the need for the practice of robust and regular Avalanche smart contract audits is vital to maintaining the health of the ecosystem. Without projects building cultures of end-to-end security– starting with an Avalanche smart contract audit– the security benefits inherent in the Avalanche consensus will be diluted.

All in all, Avalanche network– in conjunction with an Avalanche smart contract audit– is equipped with the gold standard of blockchain security, making Avalanche’s ecosystem one of the most secure places on which to build the future of Web3.