Today, more and more blockchains are being created with various new offerings they seek to provide. This article seeks to briefly explore the different **consensus algorithms** used. A consensus’ **main purpose is to achieve agreement on agreed transactions among a distributed system** (on the [blockchain](https://hackernoon.com/tagged/blockchain)).\n\nAs we all know, a common danger we often hear of decentralisation highlights a hypothetical scenario of the 51% attack on a blockchain. In this scenario, a group of miners (which are people/groups/organisations who are providing computing resources to the blockchain to verify and add new transaction records to the blockchain ledger) that controls more than 50% of the network will be able to prevent other transactions from occurring, and allow their own coins to be spent multiple times — a process called _double spending_.\n\n> Common consensus algorithms that will be explored in this article include: Proof-of-Work (PoW), Proof-of-Stake (PoS), Delegated Proof-of-Stake (DPoS), Proof-of-Authority (PoA), and Proof-of-Importance (PoI).\n\n### **What is a Consensus?**\n\nSimply put, **consensus is defined as a general agreement of a state that the blockchain is in**. That means, if Alice sends $100 worth of Bitcoin to Bob, Alice will lose $100 worth of Bitcoin from her wallet, and Bob will gain $100 worth of Bitcoin in his wallet. The catch is that every clean transaction has to be recorded on the Bitcoin public ledger, and a consensus algorithm ensures no malicious transactions nor changes can be made on the blockchain itself.\n\nThis example brings us to the purpose of having a consensus mechanism — in a decentralised blockchain ecosystem, a solution to the Byzantine Generals’ Problem is essential.\n\n**Byzantine Fault Tolerance (BFT)**\n\nThe Byzantine Generals Problem was published in 1982 by Lamport, Shostak and Pease, to ensure that malfunctioning components that give conflicting information are handled within a computer system.\n\nBFT is the characteristic of a system that handles the different types of faults that belongs to the Byzantine Generals’ Problem. Having BFT is not solely used on the blockchain itself. However, in the consensus algorithms explored below, they are explained in relation to the blockchain.\n\n!(https://hackernoon.com/hn-images/1*ggpa5g9lFLp_1AFpBT7J1A.jpeg)\n\nPhoto by [rawpixel](https://unsplash.com/photos/XkKhkijcgTo?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)\n\nThere are various methods of ensuring each transaction remains valid, and that brings us to the main segment — consensus algorithms.\n\n### Consensus Algorithms\n\n> Before we dive into the consensus algorithms, a side note, it is interesting to note that these ‘proofs’ are not mathematically proven, but instead ‘to be proven’… For example, PoW has been implemented in Bitcoin for the past 10 years and had no occurrence of a failure, whereas PoS security is a much younger concept which is to be proven.\n\n#### Proof-of-Work (PoW)\n\nMost of us would have heard of PoW, especially since the first public blockchain — Bitcoin, uses PoW. In this example, PoW is explained with Bitcoin.\n\nPoW is conducted through miners (the people keeping the blockchain running by providing a huge amount of computing resources) competing to [solve a cryptographic problem](https://www.coindesk.com/how-are-bitcoins-mined/) — also known as a hash puzzle. These miners help to verify every Bitcoin transaction, where it involves producing a hash-based ([SHA256](https://en.bitcoin.it/wiki/SHA-256)) PoW that is based off previous transaction blocks (read up on the [Merkle Tree](https://www.quora.com/Cryptography-How-does-a-Merkle-proof-actually-work) for more information) and forms a new branch with a new transaction block. This means that the work is moderately difficult for the miners to perform but easy for the network to verify. The first miner who manages to produce the PoW will be then awarded some Bitcoins. Over time, the amount of Bitcoin awarded decreases over time.\n\nOver the years, as the [difficulty level](https://en.bitcoin.it/wiki/Difficulty) in mining Bitcoin has increased tremendously, resulting in PoW being notorious for the amount of energy it requires to keep the blockchain running.\n\n\\-\n\n#### Proof-of-Stake (PoS)\n\nUnlike PoW where new transaction blocks are created based on computational work done by solving a complex cryptographic puzzle, PoS allows a forger (instead of a miner) to stake any amount of [cryptocurrency](https://hackernoon.com/tagged/cryptocurrency) she has, to be probabilistically assigned a chance to be the one validating the block — the probability based on the amount of cryptocurrency staked.\n\nAdditionally, for most PoS systems, instead of receiving a cryptocurrency reward (in the above case, the Bitcoin miners receives some Bitcoins for solving a PoW), the forgers instead takes the transaction fees as rewards.\n\nThe idea of putting coins to be ‘staked’ prevents bad actors from making fraudulent validations — upon false validation of transactions, the amount staked will be forfeited. Hence, this incentivises forgers to validate legitimately.\n\nIn the recent year, PoS has gained attention, with Ethereum switching towards a PoS from a PoW consensus system.\n\n\\-\n\n#### Delegated Proof-of-Stake (DPoS)\n\nDPoS is similar to PoS in regard to staking but has a different and a more democratic system that is said to be fair. Like PoS, token holders stake their tokens in this consensus protocol.\n\nInstead of the probabilistic algorithm in PoS, token holders within a DPoS network are able to cast votes proportional to their stake to appoint delegates to serve on a panel of witnesses — these witnesses secure the blockchain network. In DPoS, delegates do not need to have a large stake, but they must compete to gain the most votes from users.\n\nIt provides better scalability compared to PoW and PoS as there are fully dedicated nodes who are voted to power the blockchain. Block producers can be voted in or out at any time, and hence the threat of tarnishing their reputation and loss of income plays a major role against bad actors. No doubt, DPoS seem to result in a semi-centralised network, but its traded off for scalability.\n\nLike PoS, DPoS has also gained attention over the years with several projects adopting this consensus algorithm. Since it was invented by Dan Larimer, DPoS has been refined continuously, from BitShares to Steem and now in EOS.\n\n\\-\n\n#### Proof-of-Authority (PoA)\n\nPoA is known to bear many similarities to PoS and DPoS, where only a group of pre-selected authorities (called validators) secure the blockchain and are able to produce new blocks. New blocks on the blockchain are created only when a super majority is reached by the validators.\n\nThe identities of all validators are public and verifiable by any third party — resulting in the validator’s public identity performing the role of proof of stake. As these validators identity are at stake, the threat of their identity being ruined incentivises them to act in the best interest of the network.\n\nDue to the fact that PoA’s trust system is predetermined, concerns has been raised that there might be a centralised element with this consensus algorithm. However, it can be argued that semi-centralisation could actually be appropriate within private/consortium blockchains — in exchange for better scalability.\n\nNewer blockchain startups has ventured into implementing PoA. In addition, Ethereum testnets like Rinkeby and Kovan explores the use of a PoA consensus algorithm.\n\n—\n\nAs these few consensus algorithms are explored in this article, it is important to note that it is non-exhaustive. Newer/modified consensus algorithms are being developed and experimented with, with the surge in blockchain projects in the recent years.