Avalanche’s Snowman Consensus protocol is the fundamental mechanism powering the Avalanche network and is crucial for its remarkable speed and security. In this report, we’ll break down the role of consensus protocols in the blockchain validation process and delve into what makes Snowman such a revolutionary breakthrough. By looking at the inner workings of Snowman, we can have a deeper understanding of the impact it has on Avalanche and the future of blockchain technology.
The Role of the Validator
To understand the role of a validator in the functioning and security of blockchains, we first need to break down the definition of a blockchain. To put it very simply, blocks make up the core components of the blockchain and contain a group of transactions or any other type of relevant information. As a literal chain of blocks, each block cryptographically stores the information of the previous block, meaning that every block is unique and the information inside cannot be changed.
Blocks can contain a range of information such as:
- Financial transaction data
- Smart contract executions
- Data storage requests
Blockchains are distributed systems, meaning that they operate across a network of computers (nodes) located around the world. This distributed nature underpins the decentralized character of blockchain technology, where control and decision-making are spread across many nodes rather than being controlled by a single entity. By having a network of nodes maintaining and validating a shared ledger, this structure provides transparency, security and resilience against centralized parties.
At the heart of this decentralized structure is the network of Validators, who are responsible for determining the validity of transactions before including them in the next block. The consensus protocol provides validators with a set of rules to ensure that they can reach a majority agreement on the current state of the network.
On Avalanche, validator nodes, queried as part of the consensus process, play a key role in influencing the network. To earn this influence, they must stake AVAX, with the quantity of AVAX bonded by a node increasing the frequency at which it is queried by others. Validators are incentivized to participate and be responsive, as they are rewarded for their honesty and active engagement in the consensus process.
The purpose of consensus is to enable validators to collectively establish a single source of truth across the network. The effectiveness of validators and the consensus protocol they follow is crucial for ensuring the network’s speed, security, and scalability.
A Brief History of Consensus Mechanisms
“How do we achieve agreement between a set of machines?”
This was the question asked by computer scientists Leslie Lamport and Barbara Liskov in the 1970s, which resulted in their pioneering research paper: The Byzantine Generals Problem. The challenge of reaching consensus is explained through the following analogy:
A group of Byzantine Generals must agree on a unified plan to attack a city, communicating only through messengers, with the possibility that some generals may be traitors who are trying to sabotage the plan. The central problem is how the loyal generals can ensure that consensus can be achieved when there is uncertainty about the loyalty of others. This problem is fundamental in understanding and designing algorithms for distributed systems where network nodes must agree on a state.
The paper demonstrates that consensus can be achieved as long as two thirds of the generals are loyal. This concept has formed the basis for various fault-tolerant distributed systems.
The first solution to the consensus problem was Classical Consensus, designed by Lamport and Liskov. It involves a key property which is all-to-all voting – meaning that every validator node must vote on whether they would like to accept or reject a transaction. As long as the number of participating nodes is small, transactions are confirmed very quickly. However, as the network grows, each node must communicate with an increasing number of other nodes, making scalability challenging. Classical Consensus also requires that each node has knowledge of every other participating node; a characteristic which limits its usability in open, permissionless networks.
The next major development in consensus protocols was introduced by Satoshi Nakamoto in the Bitcoin Whitepaper. This new approach, known as Nakamoto Consensus, operates under a fundamentally different principle where nodes do not need to identify other nodes to achieve consensus. It is built on probabilistic safety guarantees which means that nodes send the same number of messages regardless of the network’s size.
Nakamoto Consensus offers a significant advantage in decentralized environments, due to its ability to achieve consensus without requiring knowledge of all participants. However, this approach has its drawbacks. These protocols are very slow, with transactions taking up to 1 hour to be finalized. Nodes must solve complex cryptographic puzzles in order to produce the next block, requiring heavy computational power which makes it very energy-intensive to run.
Despite these challenges, Nakamoto Consensus represents a pivotal shift in enabling trustless digital systems.
The Avalanche Consensus family combines the strongest elements of the Classical and Nakamoto designs to redefine the capabilities of consensus protocols. Inspired by gossip algorithms, its probabilistic nature enables it to be a lightweight protocol that doesn’t compromise on speed, scalability or security. Rather than asking every single node to vote on a transaction, Avalanche Consensus uses repeated random subsampling of a small set of nodes – the number of messages each node has to handle doesn’t change, even as more nodes join the network. This innovation allows for lightning-fast consensus to be achieved without the need for intensive computational work.
The Snowman Consensus is an implementation of the Avalanche Consensus, specially tailored for blockchains which require linear, ordered consensus – such as those built for smart contract execution.
Avalanche Consensus is a groundbreaking milestone in the evolution of consensus protocols and has paved the way for a new generation of blockchain networks.
For a deeper look into Avalanche Consensus, read the full whitepaper here.
Breaking Down the Snowman Consensus Protocol
The distinguishing feature of Snowman Consensus, setting it apart from its predecessors, lies in the use of a sub-sampled voting process. This decision-making process is enabled by the Snowball consensus algorithm, which has pre-determined parameters to efficiently achieve consensus:
- The number of participants in the network
- Sample size – the number of nodes queried by the validator
- Quorum size – the number required to reach a majority reply
- Decision threshold – the number of times a majority must be received consecutively in order to come to a final decision
The Validation Process
When a validator receives a broadcasted transaction, it must first determine the validity of a transaction before beginning consensus.
Example: Alice has 2 AVAX in her wallet. She tries to send 5 AVAX to Bob – this transaction is clearly invalid as Alice doesn’t have enough AVAX in her wallet.
Once a transaction is determined to be valid, the consensus process can begin.
To determine whether a transaction should be accepted, the node asks a small set of randomly selected validator nodes on their preference. Each queried node then replies with their preferred transaction, with the quorum size determining the majority reply. In order to come to a final decision, the subsampling process is repeated with different sets of nodes until a majority reply is received for a pre-determined number of consecutive rounds.
Transactions can be finalized quickly if there are no conflicts. In the case of conflicts, honest validators quickly gather around the conflicting transactions. This creates a reinforced feedback loop, where each round of consensus increasingly aligns their preferences, until everyone reaches an agreement.
It’s important to note that the sub-sampling performed by nodes is not entirely random – selection is weighted by stake amount, meaning that nodes with more staked AVAX are more likely to be queried.
Through the sub-sampling process, validators actively adjust their own preference to guide the network towards a unified, collective decision.
See here for an excellent visual demo of the Snowman Consensus in action.
Benefits of Snowman Consensus
Scalability – Enabled by its subsampling process, Snowman Consensus ensures that the number of messages each node sends remains the same, whether the network is made up of 100 or 100,000 nodes.
Speed – Without the need to query every single node on the network, Snowman achieves an extremely lightweight design that can rapidly process and confirm transactions. This efficiency is amplified by the fact that the Avalanche Consensus protocol guarantees that if an honest validator accepts a transaction, all other honest validators will inevitably reach the same conclusion.
Security – Snowman’s probabilistic approach, where each node repeatedly queries a random subset of nodes, greatly reduces the chances of malicious nodes consistently influencing the network, thus maintaining the integrity of the network’s decision-making.
Decentralization – The performance of the network is unaffected by the number of nodes, promoting an open and permissionless environment where any node can contribute to securing the network.
Efficiency – Instead of operating on fixed slot times, like other consensus protocols, Snowman adopts a dynamic approach to block production based on the activity of the network. This versatility ensures a more responsive and efficient block generation, tailored to the current state of the network.
The Snowman Consensus, as a key component of the Avalanche Consensus family, represents a significant evolution in distributed systems. By addressing the limitations of previous consensus mechanisms, Snowman introduces a more scalable, swift, secure, and decentralized approach to blockchain consensus. Its innovative subsampling and probabilistic methods, coupled with dynamic block production, mark a notable advancement in ensuring faster transaction processing, robust security, and efficient network operation without compromising on decentralization. This makes Snowman Consensus a crucial element in the development of more resilient and adaptable blockchain networks, paving the way for a new era of distributed digital systems.