Consensus Algorithm Walkthrough

Consensus algorithms, as the name suggests, are a set of rules or processes to arrive at a general agreement or decision.

In blockchain technology, consensus algorithms play a vital role because they serve as a guideline to describe the sequence of events in a network. In a decentralized system such as the blockchain, consensus algorithms map out the consequences of each action that takes place in the network. Without consensus algorithms in place, there is no standard by which people can know whether a transaction is valid or even authentic.

Transactions in the blockchain context do not only refer to financial transactions. It also applies to the exchange of data, ownership rights, dApp access, and more. In other words, as long as there is an exchange between two parties, that is considered a transaction.

Types of Consensus Algorithms

Each cryptocurrency has its own consensus algorithm. Some have just been created while some have been around since the first cryptocurrency was introduced.

Here are three of the most common:

Proof of Work

Proof of work is the first consensus algorithm created by the father of Bitcoin himself, Satoshi Nakamoto. It is used (yes, you guessed it right) for the Bitcoin blockchain. This type of consensus operates on the premise that the value of something depends on the effort that has been done to achieve it.

Work, in the context of proof of work, means that the miners have to spend a significant amount of time and effort doing complex mathematical computations to create blocks in the blockchain. The number of blocks they add is the proof that they have done something. Therefore, the more blocks you can place, the more work you have done, and the more secure the transaction become as it gets buried deep into the blockchain.

To understand how it works, think of it as a puzzle. As an example, let’s use the SHA-256 algorithm which looks like this:

SHA256(“blockchain” + Nonce) = Hash Digest starting with “000000”

The series of zeros is the hash value that meets the target criteria or difficulty level. Every time the puzzle is solved, another zero is added to the series, and the difficulty level increases. Once solved, the puzzle above will look like this:

That computation was solved within 54 seconds using a computer with old hardware. The computing process starts with 0 and tests the values one at a time. Solving the puzzle is long and tedious, taking up to millions of guesses. As difficult as solving the puzzle is, however, verifying the nonce is easy. That’s because only a single hash is needed to verify whether the solution is correct or not.

As the zero increases, so does the difficulty level and the computing time. A considerable amount of energy and hardware equipment are also used. Its complicated process is also what makes proof of work one of the most secure types of consensus algorithm.

Bitcoin and Litecoin are some of the cryptocurrencies that use the proof of work algorithm.

Proof of Stake

Proof of stake is the alternative to proof of work. Here, there are no miners who toil day and night to validate a transaction. Hence, it is more energy efficient than proof of work.
Instead, some minters bet their stakes on whether a block is valid or not. Therefore, if the block turns out to be valid, they get rewarded.

In this algorithm, those who have more stakes have more influence on the network. Proof of stake operates on the principle that the more stakes a person owns, the less likely he is to corrupt the system because he will protect his assets.

Some of the cryptocurrencies that use this algorithm are Peercoin and Decred. Ethereum is planning to use this algorithm for its transactions within the next few years.

Delegated Proof of Stake

Despite the similarity of its name to the proof of stake algorithm, this consensus algorithm is far different because it works like a democracy where people can vote for someone who will represent them.

Created by Dan Larimer, who is also the programmer of several crypto projects like Bitshare and Steem, those who are using this system task the delegates they voted to verify the validity of a transaction and newly minted coins.

The voting process is done several times depending on the reputation of the delegate. If a delegate underperforms or is suspected of malpractice, network members can pull him out and render his vote useless; then, they will place someone with a better reputation.

Conclusion

There are still a lot of consensus algorithms as new cryptocurrencies make their way into the blockchain technology. No matter the number, they still have the same primary purpose – to make the network safe and secure from any attacks and abuses.