Consensus: Agree and Commit

Chuong Ngo
,
Technical Consultant

What can you do when different entities can agree? Quite a lot.

In 2008, an unknown person published the paper Bitcoin: A Peer to Peer Electronic Cash System (link) under the pseudonym Satoshi Nakamoto. The world rapidly adopted Bitcoin, making it a household name. As Bitcoin surged in popularity, blockchain saw unparalleled interest from industry and academia.

Blockchain is a tamper-evident and tamper-resistant distributed ledger technology. It is also the basic technology of Bitcoin. While popularized by cryptocurrencies, blockchain is not limited to revolutionizing the financial markets. It has much broader application potential and looks to disrupt several application domains that touch all spheres of life. Blockchain is the combination of several technologies and concepts. At its core is the idea of distributed consensus.

A Long Time Coming

Leslie Lamport described the Paxos protocol in his 1998 paper The Part-Time Parliament (link). It is a seminal paper for the study of consensus algorithms. There are several different consensus protocols, but they are all mechanisms to address the consensus problem in distributed systems. In other words, they allow distributed systems to maintain genuine knowledge of system states in the presence of malicious nodes. When applied to the blockchain, consensus lets the nodes of a blockchain network keep a consistent, truthful view of the blockchain (i.e., distributed ledger) even when malicious nodes try to modify the registry to their advantage. More simply, the book of transactions can be trusted even though the nodes that hold and process it can't.

Consensus is vital when processing financial transactions, health information, or something else important.

Motivating Problem

Before going too far into discussing consensus, let's examine the Byzantine Generals Problem. The problem describes a situation where multiple actors (i.e., computer nodes) must agree on a common state. They can communicate via point-to-point channels.

For example, you and some friends are doing vacation planning over SMS. You set up a group chat to work out the details. The messaging app sends out peer-to-peer messages. That means that instead of sending your messages as broadcasts, it sends the communications to everyone individually. The app displays those individual messages on a single screen. Things work great as long as each recipient sends and receives every message honestly and promptly. There is no miscommunication, and everyone is on the same page.

Communication is needed to solve problems.

Now, say that there are bad actors in the messaging group. Two of your friends are using malfunctioning messaging apps. They struggle to send messages to all recipients or fail to receive all communications in order. Additionally, one of your friends is a scoundrel. His app doesn't send all communications to everyone. These bad actors misbehave randomly. Sometimes, they work like expected. Other times, they do something unexpected. Therefore, not all recipients get all messages on time. So, everyone in the group may not have the same understanding of the vacation plans. Therefore, some may go to the wrong destination, bring the wrong gear, or show up at the wrong time.

Consensus allows the distributed ledger to be tamper-resistant and tamper-evident.

That is the Byzantine Generals Problem. We can see that this is a big problem if we replace the friend group with computers that process financial transactions, health information, or something else important.

Reaching Consensus

So, how do you solve the Byzantine Generals Problem? In other words, how do we ensure that a network of distributed nodes agrees on the correct answers to problems? Through consensus algorithms, of course. Such algorithms provide assurances of safety and liveness in the face of faulty or failing nodes. In other words, even when malicious nodes are trying to hamper agreement or spread falsities, every node should eventually receive the correct answers. In terms of blockchain, consensus allows the distributed ledger to be tamper-resistant and tamper-evident.

Some Last Words

This time, we looked at why consensus is needed. Next time, we will look at the version of Paxos that Leslie Lamport presented.


Banner image credit to
bizvector
Blockchain
Consensus

Related Posts