Bitcoin and Ether, the two most famous cryptocurrencies, currently use the proof of work (PoW) consensus algorithm. However, Ethereum has a plan of transitioning to the proof of stake (PoS) algorithm. This will be a significant change and the crypto community is eagerly debating POW vs. POS, for e.g. which provides higher security, and which will be better in the long run.
“Why is consensus algorithm important?”
Before immersing into the POW vs. PoS debate it’s important to understand why is a consensus algorithm important in the blockchain. The two central premises of blockchain are decentralization and immutable records, and the consensus mechanism provides for these.
The blockchain is a decentralized network, where computers on the network, called ‘nodes’, maintain a distributed database in a shared manner. Anyone can join a permission-less blockchain, and every node has the complete record of all transactions in a blockchain. Effectively, each node is a ledger of all transactions, hence blockchain is also called ‘distributed ledger technology‘ (DLT).
Transactions are grouped into block records, which are also called ‘blocks’. The blocks are linked via a predetermined protocol program. The only way to update a blockchain is to add a new block since no existing block can be modified or deleted. Any node can add a new block, without the intervention of any centralized authority.
Since every node can add a new block, maintaining a correct order of transactions is important for the data integrity. If a node can add a block with transactions that the rest of the community disagrees with, the new block won’t be considered valid by the majority. If the node that added the new block persists with it, by creating newer blocks on top of it, while continuing to disregard the community standards, then the rest of the community will be forced to split the network, so that they can take the state of the network before the dispute, and continue to work with that. This requires a ‘hard fork’, and frequent occurrences of such split are not good for the stability of the blockchain. A consensus mechanism is required to prevent these.
Also, a malicious node can overpower the network with ‘distributed denial of service’ (DDoS) attacks, and create false transactions, for e.g. ‘double spend’. i.e. spending the same crypto token twice. A consensus mechanism is needed to validate each transaction.
While there are several consensus algorithms, POW is the most common and used by most public blockchains. Comparatively, PoS is new.
“What’s POW algorithm?”
The concept of the POW algorithm was first published by Cynthia Dwork and Moni Naor in a 1993 article, and the term was coined by Markus Jakobsson in 1999. Bitcoin network, invented by Satoshi Nakamoto, is the most famous implementation of POW, and we’ll use examples from it to elaborate on POW.
In Bitcoin blockchain, transactions are grouped into a memory pool, called ‘mempool’, and a block is created every 10 minutes. To be included in the next block, every transaction in the mempool needs to be verified by ‘miners’, i.e. users who verify the transaction and use specially designed software and special-purpose hardware for their work.
The transaction verification process, also called ‘mining’, requires the miners to solve a cryptographic puzzle. It’s a competitive process since the successful miner gets a fraction of the cryptocurrency generated as part of the transaction.
The Bitcoin user who requested the transaction provides the transaction data to the miner, and that’s the easy part. However, the miner also needs to know the cryptographic hash of the last recorded block. The hash of the last recorded block is the reference to that block and must be referred to when the new block is created, to maintain the sanctity of the chain. That’s the difficult part.
The cryptographic hash of the last recorded block isn’t known to any miner, and they must try one number after another at high-speed to figure that out. There is no skill involved in this, only brute force of high computing power is needed. The miner who cracks this massive mathematical puzzle announces it to the network. All other miners can see the evidence of the massive number-crunching, which is the root of the name ‘proof of work’. The successful miner creates the new block, where the transactions from the mempool are now recorded.
The cryptographic puzzle is asymmetric, i.e. it’s moderately hard for the miners, but it’s very easy to see the evidence on the network. Over time the puzzle becomes a little too easy, and the block generation time tends to reduce to less than 10 minutes. Hence, the puzzle is updated every 14 days and made more difficult. This way, the puzzle continues to become more complex, and the computing power required to solve it must increase.
To stage a DDoS attack to capture the majority, i.e. 51% of the computing power in such a network is cost-prohibitive. The potential hacker is likely to spend more money than he could earn by hacking such as a network. POW makes blockchain network very secure.
Such high security comes at a high cost, though. For e.g.:
- The energy requirements of Bitcoin mining is so high, that by the time the year 2018 ends, the Bitcoin mining operations in Iceland will have consumed more energy that the country’s entire domestic energy consumption! The resultant environmental strain is giving an adverse publicity to Bitcoin. Such high energy bill is paid with fiat currency, which will have a domino effect of pushing the price of Bitcoin
- Continuously upgrading computing power and energy provisions aren’t easy for individual miners, and Bitcoin mining is increasingly becoming centralized with organized operators running giant mining rigs, for better economy of scale. Such indirect centralization goes against the basic premise of decentralization in the blockchain.
- ‘Cryptojacking’, i.e. cyber attackers hijacking unsuspecting users computers for crypto mining, is becoming increasingly common because unscrupulous miners are using unethical means to improve their chances of success in an environment of diminishing ‘return on investment’ (RoI). Regularly patching software and operating system (OS) can help guard against Cryptojacking.
“How is PoS different?”
A blockchain network with PoS algorithm has specific nodes with transaction validation responsibility. These nodes stake their crypto tokens and are called ‘stakers’. This implies ‘skin in the game’, unlike Bitcoin network where the miners may not even own any Bitcoin themselves, let alone staking their Bitcoins for transaction validation.
The higher the amount at stake, and the longer the duration of the stake, the higher is the likelihood that a staker will get more chances of transaction validation. All crypto tokens have already been created earlier, there’s no new coin for minting, and the reward for the staker is the transaction fee. The higher the reputation, the more is the earning potential for the staker.
Since there isn’t a complex cryptographic puzzle to solve, PoS algorithm requires less energy. The transaction validation process is called ‘forging’, and since all nodes needn’t be involved in the validation process, the network has higher scalability.
Eliminating the involvement of entire network in the transaction validation process allows implementation of another scaling solution called ‘sharding’. It’s a concept taken from database management, where horizontal portions of the database are stored in separate server instances, thus improving efficiency. In blockchain, a group of nodes will maintain a horizontal portion of the blockchain, will have their own staker, and lend better scalability to the network.
There are pitfalls of PoS, and the experts are formulating solutions. For e.g.:
- A malicious player can procure a very large number of crypto tokens, become a staker, and overpower all other stakers. However, market economy guards against such moves, because such sudden large buying spree will push the price of the coin up significantly, thus the hacker will be dissuaded.
- A staker may go rogue and validate malicious transactions. Ethereum project team is working on their new ‘Casper’ protocol as part of their plan of transitioning to PoS, and the new protocol will ensure that such stakers lose their coins, and are barred from staking in future.
POW vs. PoS: which one will own the future?
While POW certainly provides better-decentralized security to the blockchain network and has been widely tested in many cryptocurrency projects, the massive energy cost and environmental strain from mining digital currencies that aren’t backed by any tangible assets are attracting significant negative media coverage. The effect of such concern is already visible, for e.g. China is officially banning Bitcoin mining.
While PoS is relatively new, the adoption has started to pick up, for e.g. the well-known cryptocurrencyDASH already uses it. If the votaries of PoS can assure the wider crypto community about the ability of the algorithm to protect the network adequately, that might tilt the scale in its favor. If the highly-reputed Ethereum project demonstrates a successful transition to PoS, that’ll be a big boost to the algorithm. The next few months will tell which algorithm will become the standard-bearer.