Home Guides Beginners Guide to Bitcoin Concept of Consensus & Everything About ‘Proof of Work’

Concept of Consensus & Everything About ‘Proof of Work’

298
0

Introduction

In almost all of our previous articles, we have discussed various properties of blockchain such as transparency, immutability, security, and so on. Now it is time for us to know what makes the blockchain adhere to these properties. Fundamentally, Blockchain is run via a peer to peer (P2P) network. This network is comprised of distributed nodes which are nothing but computing machines. Every blockchain runs on a consensus algorithm. The consensus is a general agreement within all the nodes in a network. To understand what a consensus algorithm is and why a consensus algorithm is required in a blockchain, let us see how a bitcoin blockchain works.

Working of a Bitcoin blockchain in technical terms

The bitcoin blockchain is essentially a distributed ledger storing all the transactions being performed on a network. Hence bitcoin blockchain contains all blocks, each block comprising of several transactions. Each block is connected to the next block using a unique hash value. Now, what is a hash? Blockchain uses cryptographic hash functions for its tamper-proof property (immutability) to hold true.

Cryptography is a way of transferring information securely in a way that cannot be read by other people even when they might be receiving it. To put it in simple terms, the information which should be secured is passed through an encryption algorithm. Then the encrypted message, when passed through a hash function, will deliver a unique value representing a kind of mathematical summary of that information. This hash value is generally called a message digest. The uniqueness of cryptography is that even if with a slight change in the original data, the message digest would be different, and it is almost impossible to find the original value from the given hash.

Bitcoin uses SHA256 (Standard Hash Algorithm 256) that generates a unique 256-bit message digest. Thus, making all the message digests to have a unique size. Each block has a header which contains the hash of a previous block, nonce (we will be discussing this in a bit), a hash of the transactions in the present block and other technical stuff. So, blocks in the blockchain are tied up using these unique hash values. If we try to tamper any previous block, the hash value of that block would be changed. Since the hash value of that block is updated in the next block, that block would be changed as well and so on. Thus, achieving the tamper-proof property.

So to speak in practical terms, we can possibly tamper the previous records, but that should have to be done before the new block gets added to the blockchain. Also, since this action will take place in a distributed network, the consensus algorithm will disallow that attempt. That is so because in the rest of the nodes the hash would be different, and the consensus algorithm would adjust all nodes to the consensus value, thus making it impossible to tamper the blockchain.

The purpose of the consensus algorithm:

This is how blocks are added to the blockchain. Now how are the new blocks proposed in the blockchain? Bitcoin is a permissionless blockchain, and anyone can join the network. People in the bitcoin network are called miners, which is why it is said that bitcoins are being mined. Hence these miners propose new blocks with the transactions which are not committed to the blockchain so far. Anyone can propose a block with any number of transactions.

Now comes the requirement of a consensus algorithm. N number of miners can propose X number of blocks. Being a permissionless blockchain, one miner is not known to the other. Here comes the role of the consensus algorithm. Essentially, consensus serves two purposes. Firstly, it doesn’t allow any single person or entity controlling the entire blockchain system. The second purpose is that this algorithm keeps the blockchain updated and ensures every block that is getting added to the blockchain is true and unique. Also, the participates, AKA. Miners in the blockchain network get paid through this consensus algorithm only.

Proof of Work

A consensus is essential for any blockchain to work, and there are many consensuses that serve different purposes. For instance, Bitcoin blockchain works on the ‘Proof of Work‘ consensus. While NEO blockchain works on ‘Proof of Stake.

In this article, let us discuss THE most popular consensus, Proof of Work. It is the consensus algorithm of the Bitcoin blockchain and majority of the cryptocurrencies till date work on this algorithm alone.

In PoW, network proposes a challenge to the miners. This challenge is nothing but a complex mathematical problem which is relatively difficult and takes a lot of computing power to derive the solution. Whoever comes up with a solution first, broadcasts a message to other miners in the network saying that the solution has been achieved. When all the miners agree on that solution, the proposed block is committed after validating the transactions. This solution that is found out is known as ‘nonce’. This nonce is stored in the header of each block. Also, A fee is charged for every transaction that takes place on the network. This transaction fee is used as an incentive to the miner who found out the solution. These rewards keep the miners motivated to keep mining. Without miners, the bitcoin network could not keep running. This incentive is in the denomination of bitcoins in the bitcoin network.

The working of ‘Proof of Work’ consensus

Now, what is this challenge that the network poses, and what is PoW? PoW is an economic measure typically used to prevent the service abuses/scams by requiring some work from the service requester, generally, processing time by a computer. This is not a new idea; the idea was proposed by Dwork and Naor to combat junk emails. One must do some work to send a valid email so that one who is not genuinely interested would be discouraged to send junk emails.

There are some features for the PoW consensus. The challenge proposed, or work must be moderately hard but feasible for the service requester. At the same time, the work must be easy for the service provider to check. Such that the service requesters will not request the service unnecessarily. If we talk this in bitcoin perspective, after every specific time, new transactions are stopped so that the existing transactions can be committed.

To commit to the existing transactions, the challenge should be resolved. If this challenge takes too much time to settle the latency of the network, i.e. transactions per second will decrease, making the platform slow and unreliable to transfer funds. But as the number of blocks is being increased every day, the complexity of the challenge being proposed increases, which takes more and more computing power to resolve the challenge. This difficulty is periodically adjusted to maintain the target rate to mine a block.

Bottom line

PoW is a costly methodology and not an environment-friendly mechanism to be adopted widely. It is not eco-friendly as it consumes too much power, but it is the most reliable one in the blockchain so far. Bitcoin uses PoW and to mine the bitcoins, mining pools usually look for places where electricity is cheaper.

LEAVE A REPLY

Please enter your comment!
Please enter your name here