Proof-of-Work Consensus Algorithm

Pranav BawgikarPranav Bawgikar
5 min read

[10]

Understanding Consensus

Blockchain is a public distributed ledger that offers decentralized, anonymous, and secure transactions. Despite the absence of a central authority, every blockchain transaction is considered completely secure and validated. The consensus protocol, which is vital to any blockchain network, makes this possible. They're the bedrock of trust, security, and immutability in decentralized systems. Every peer in the blockchain network can agree on what is happening with the distributed ledger by using this consensus algorithm. In decentralized systems, achieving consensus is paramount. It establishes a unified view of the system's state among all participating nodes, even in the presence of Byzantine faults or malicious actors. This ensures the system's integrity, immutability of the shared ledger and prevents issues like double-spending.

The Genesis

Proof-of-Work (PoW) is a consensus algorithm which is used to confirm transactions and produce new blocks on the chain. The concept of Proof of Work (PoW) has deep resonances with the most primal of human endeavors: physical labor. Representing the immense effort needed to validate and maintain a decentralized network. In a trustless environment, PoW provides evidence of confidence. The objective of PoW algorithms isn't to demonstrate that specific work was performed or that a computational problem was "solved", but rather to deter data modification by imposing significant energy and hardware-control demands.

Working of PoW

In order to add a new block to the blockchain, a miner has to solve a mathematical problem that requires a lot of computational power. Since the mathematical problem is computationally expensive, it reduces the likelihood of a malicious node successfully solving it. Here's an abstract way to write the 'hard mathematical problem':

Given data A, find a number x such as that the hash of x appended to A results is a number less than B.

  1. Transaction data is distributed across the users of the bitcoin network.

  2. Miners will validate the unverified transactions and add them to a block. Miner is an application that performs the validation of the transactions using consensus algorithm.

  3. To do so, miners compete to solve a difficult mathematical puzzle based on cryptographic hash function known as proof-of-work.

  4. The first miner who solves the puzzles gets rewarded.

  5. The verified block is added to the blockchain.

The mathematical problems in Proof of Work (PoW) are solved through brute force methods. Major issues with PoW include the risk of a 51% attack, and its time and resource-intensive nature. On average, a miner takes about 10 minutes to solve a PoW problem. After successful verification, miners earn rewards along with transaction fees paid by users. This serves as an incentive for miners to continue participating in the network. Proof of Work creates an additional, costly step that cannot be spoofed. This prevents bad actors from flooding the network with fraudulent or empty blocks and prevents excessive mining by increasing the complexity of confirming each block.

In addition, it helps facilitate Nakamoto Consensus, which is basically the golden rule: the longest chain wins. If the longest chain is provably expensive to spoof, nodes can safely synchronize based on this. The nodes play a crucial role in protecting the network. There are tens of thousands of nodes in the network. Each node decides which version of the code or protocol to run and also maintains a copy of the ledger.

PoW comprises of 3 main components

  1. Nonce: Nonce stands for Number Used Once. It is a random number whose value is set so that the hash of the block will contain a run of leading zeros.

  2. Hash: Hash Pointer is a pointer to the location where information or hash of that information is stored.

  3. Transaction: It is the process to determine a number called nonce along with a cryptographic hash algorithm to produce a hash value lower than a predefined target. It involves several miners around the world using computational algorithms to try and find the nonce value that satisfies certain predefined conditions regarding the hash value.

In order to determine the nonce, the miners need to try about 20.6 quadrillion nonce values to get a valid hash. A candidate block is a temporary block which a miner hopes to add to a blockchain or a block which is waiting to get mined by the miners in the transaction pool. Most Proof-of-Work blockchains are permission-less that is you don’t need any permission to join the network. The Bitcoin network uses Proof of Work.

Challenges with PoW

The Proof-of-Work (PoW) consensus mechanism has several issues:

  1. The 51% risk: If a controlling entity owns 51% or more of the nodes in the network, it can corrupt the blockchain by gaining majority control. This allows the entity to manipulate the network.

  2. Time-consuming: Miners have to sift through numerous nonce values to find the correct solution to the puzzle required for mining a block. This process is time-consuming.

  3. Resource Consumption: Miners utilize significant computing power to solve the complex mathematical puzzle, resulting in a waste of valuable resources such as money, energy, space, and hardware. It's projected that by the end of 2028, approximately 0.3% of the world's electricity will be consumed to verify transactions.

  4. Non instantaneous transaction: Transaction confirmation typically takes between 10 to 60 minutes. Therefore, transactions are not instantaneous, as they require time to be mined and added to the blockchain, thereby confirming the transaction.

Final Thoughts

Proof of Work (PoW) consensus is the preferred mechanism for the majority of cryptocurrencies in circulation today. This algorithm verifies transactions and creates new blocks in the blockchain. The concept for PoW was initially introduced in 1993 by Cynthia Dwork and Moni Naor, and later adopted by Satoshi Nakamoto in the Bitcoin paper in 2008.

However, the PoW method has several flaws that need addressing, including the high energy consumption, the concentration of power in mining pools, and the risks of a 51% attack. Additionally, the winner is often determined by who possesses the most hardware equipment.

0
Subscribe to my newsletter

Read articles from Pranav Bawgikar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pranav Bawgikar
Pranav Bawgikar

Hiya 👋 I'm Pranav. I'm a recent computer science grad who loves punching keys, napping while coding and lifting weights. This space is a collection of my journey of active learning from blogs, books and papers.