When cryptocurrencies were first created, there was a significant problem that developers had to overcome to make a currency digital. This was the double-spending problem.
Anything that is digital can be easily copied. Blockchain technology avoids this problem by creating an open ledger that anyone can look at to verify transactions. An outsider can see who has how much money. They can also make sure that any previous transaction is valid.
But the key to blockchain functioning in an independent, trustless way, is through decentralization. Instead of having one central authority, organization, or computer authenticating each transaction that goes onto the blockchain, you have a network of computers. These computers use something called consensus on the blockchain to make sure that all transactions entered are authentic and accurate.
What Is Consensus?
In short, consensus on the blockchain occurs when a majority of the computers in a network reach an agreement. In a decentralized network, you have no central body to overlook transactions.
This presents a problem if someone attempts to tamper with the integrity of the system. Therefore, there needs to be a mechanism in place that guides the system to an agreed upon result. If a majority of the computers on the network agree with the transaction (reach consensus), it’s valid. If not, it’s ignored.
What Is a Node?
To understand consensus on the blockchain, you must understand what a node is. Simply put, a node is one of many computers on the network that is responsible for securing the blockchain. Each node holds a copy of the entire blockchain as well.
Nodes can be either miners or validators, depending upon the type of consensus mechanism being used. Nodes work to secure transactions on the blockchain through a process known as consensus.
How Does Consensus Occur on the Blockchain?
A consensus is the attempt to have a majority of the nodes on a blockchain network approve a set of transactions. This occurs through something called a consensus mechanism. Once a transaction is approved, it “linked” to the blockchain, and the network moves onto the next one.
There’s no way to go back and alter the blockchain because it is immutable. This means that the consensus mechanism needs to be accurate before securing nodes on the blockchain. Each blockchain has a unique consensus mechanism. And each method comes with their positives and their negatives. Here are a few consensus mechanisms:
- Proof of Work
- Proof of Stake
- Delegated Proof of Stake
- Byzantine Fault Tolerance
- Directed Acyclic Graph
- And quite a few other, less popular ones
We will look at the two main types of consensus mechanisms to better understand how consensus is achieved on the blockchain.
What Is Proof of Work (PoW)?
Proof of Work is a resource and labor-intensive process that cryptocurrencies like Bitcoin go through to secure their network. In PoW, nodes secure the network through a process called mining. With mining, computers are presented a cryptographic puzzle that takes an intense amount of energy and computational power to solve.
Computers on the network rush to break the cryptographic puzzle. The first computer to reach to solve it receives a certain amount of coins. That computer then shares it with the other computers on the network. If the majority of the computers agree with the transactions on the network, the transaction gets verified and placed on the blockchain.
The main problems with PoW rest in the actual mining process. With mining, expensive graphics cards are needed to create mining rigs. And more rigs are required to increase the speed at which the miners function, thus increasing the chance of earning coins from securing transactions. Remember, it is a race to see which computer solves it first.
The result is that massive amounts of rigs collect together in what is known as mining pools. These pools use up a great deal of electricity, making them potentially harmful for the environment. And because you have a better chance of earning rewards when you work with others, half of the mining for Bitcoin occurs in three mining pools.
This means that the current reality behind Bitcoin’s consensus mechanism is a lot more centralized than many believe the original creator, Satoshi Nakamoto, wanted.
How Is Proof of Stake (PoS) Different Than Proof of Work?
PoS use validators as nodes that mint new blocks instead of mining them. These validators are selected by the network based upon how much stake an individual has in the cryptocurrency. This is can be a substantial amount depending on the crypto. Staking allows nodes to validate transactions and receive rewards for doing so. And if a node approves an inaccurate transaction, they lose part of their stake. This helps make it cost prohibitive to attack the network.
In PoS, while there is no need to buy expensive mining cards or use incredible amounts of electricity to mine, there are drawbacks. The main one being that to stake enough crypto to run as a node, you would need to have a significant amount of money to invest in the cryptocurrency. PoS, therefore, can also result in centralizing the consensus in the wealthy.
The Vulnerability of Consensus
Because consensus relies on a majority from a collection of decentralized computers, it is mostly impervious to tampering. Any faulty entry into the blockchain will be recognized by neighboring nodes and will be shut down. The one exception to this is the 51 percent attack.
In a 51 percent attack, a majority of the network has been compromised. The malicious party behind this attack would control a majority of the network and could verify inaccurate transactions. During a 51 percent attack, hackers could create a side chain to the main chain where they double spend cryptocurrency and essentially rob users out of money in the system.
Many of these consensus methods work to alleviate the danger of a 51 percent attack. However, because consensus relies on a majority of the network to “okay” a transaction, the threat of a 51 percent attack exists in many of the consensus methods on the blockchain.
The Benefits of Consensus
Whether or you’re interested in investing in cryptocurrencies or merely curious about blockchain in general, it helps to have an underlying knowledge about how the technology works. Consensus on the blockchain functions to keep it secure. Through decentralization, blockchain offers a beneficial alternative to traditional systems. And while not perfect, consensus ensure that transactions are accurate, authenticated, and protected.