Consensus Protocols: The Algorithms That the Blockchain Runs on
You have probably come across the terms blockchain consensus algorithm or consensus protocol and wondered what it’s all about. As confusing as it may seem, we’ll explore the different nuances of consensus mechanisms and how they’re crucial to a cryptocurrency network’s operation.
To familiarize you with the basic concept, a consensus is a generally accepted opinion or decision among a group of people. An algorithm, on the other hand, is a set of rules for completing a task, thus in the blockchain, we have a consensus protocol.
What is Proof of Work
Bitcoin is the most popular cryptocurrency in the world, but many are unfamiliar with how it works. Have in mind that it’s a decentralized network with thousands of users and has no single authority to control transactions and verify them. You can imagine how chaotic it could be. To combat this issue and at the same time allow for independence, while avoiding a monopoly, we have the Proof of Work consensus mechanism.
The basic idea behind it is that to create value, you need to complete a certain task. In this case, that is calculating complex mathematical problems and submitting a result to the network for validation. It is then checked by other participants, whether it complies with the set difficulty and whoever’s result is correct and the first one submitted, receives the reward for the work they’ve done. Not only do they receive the reward, but they also gain the right to create a block and add it to the blockchain, while including transactions in it and collecting fees for them as well.
While you see, Proof of Work is a secure and logical process, it is very wasteful. All the hardware used for these calculations uses a lot of electricity and the whole process is a race. It doesn’t matter whether you have found the result as well, only one entity can win the reward. One crucial flaw of this consensus protocol is that if someone owns more than 51% of the mining power, they can freely achieve consensus on their own and implement whatever changes they see fit, roll back transactions or double spend money they don’t have. That is why other blockchain protocols were developed, which we’ll discuss further in the article.
-
Hashing Functions
Keeping in line with the Proof of Work consensus mechanism, we’d like to delve a little deeper in its inner workings. To solve these mathematical problems, we have what’s called a hashing algorithm. Its function is to generate a unique value for the input data. This value changes drastically when the original data is changed even slightly. Imagine a text with a 256-symbol hash representation, which then gets a comma added to it. The resulting new hash won’t be just a number higher, it won’t be anything close to the previous result.
Bitcoin uses the SHA-256 algorithm, but other popular hashing functions include X11 (Dash), Scrypt (Litecoin), Ethash (Ethereum) and others. Different hashes are calculated using different devices with different hardware requirements.
What is Proof of Stake?
Proof of Stake’s main aim is to solve the hardware intensive and wasteful mining process by attributing importance or weight to different stakeholders, based on the amount of currency they own. Staking requires only a wallet installed on your local device, which can be a low energy consuming like Raspberry Pi, and a 24/7 connection to the internet.
The difference here is that creators of blocks are not chosen by the work they’ve done but by a random selection, altered to a degree based on the amount of currency an entity owns. For example, owning 1% of the total coin amount in the network gives you a 1% chance per block to be chosen as its creator (validator).
The logic behind this concept is that once you’ve staked a certain amount of currency, you’re invested in the overall progress of the currency and would like to see it succeed. As such, you wouldn’t aim to manipulate the currency’s network, as your coins will be worth more and with time, you’ll have a higher ROI. A key issue, however, is the fact that the rich get richer and the poor stay poor, as you could tip the scales in your favor with higher amounts of coins at your disposal. With staking, a monopoly (i.e. a 51% attack) is not that likely, since it would require a huge investment or pooling your resources which is highly risky, compared to mining pools, as you must relinquish control of your funds to someone.
You can see a summarized list of differences between Proof of Work and Proof of Stake consensus protocols.
- Block reward given to the first miner
- More computing power = more mining power
- High energy cost
- Miners pool and mining become centralized
- Must provide proof to solve block
- Miner recievs block reward
- Chance of solving block proportionate to stake wealth
- More wealth = more mining power
- Low energy cost
- Mining is decentralized
- Must provide stake to solve block
- Validator recievs block transaction fees
Other Blockchain Protocols
While we’ve covered the two major blockchain consensus mechanisms, PoW and PoS are only a part of the crypto market. Below, you’ll find other key protocols, but keep in mind that they all have different modifications.
-
Proof of Authority
Compared to the previously mentioned consensus algorithms, where validation of transactions is performed equally by all members of the community, in PoA we have pre-approved authorities which while against the basic principles of decentralization, allows for efficient and fast transfers. There’s no mining in this type of network, as the confirmation process is delegated to entities that are formally verified and absolute consensus is expected to complete the action.
-
Byzantine Fault Tolerance
An inherently complicated concept, Byzantine Fault Tolerance can be oversimplified to the following definition: It is a decentralized network where the goal is to trust each transaction, however it is expected that there are malicious entities in the fold.
Any consensus that has successfully protected itself from the Byzantine General Problem is defined as BZT compliant. Currencies that have achieved this include Stellar, Ripple and Hyperledger.
-
DAG
Still, in an experimental phase, DAG or Direct Acyclic Graph is an innovative consensus protocol that eliminates the need for a blockchain. Compared to traditional networks, it can interconnect between different nodes, offer unlimited scalability (in theory) and extremely low-cost transactions. One of the most prominent DAG projects is IOTA.