All Proof-of-Work (PoW) blockchains validate transactions by harnessing the computing power of computers spread across the globe. These validating systems are called ‘nodes,’ and individuals running these machines are called ‘miners.’
To understand the concept of selfish mining, we must first understand the mining process and some commonly used terminology.
Recommended ArticlesView All
China COVID protest: Xi Jinping can't blame the protesters — the world will be watching
IST9 Min(s) Read
Here’s why 2022 has been a very different year for two of India’s biggest AC makers
IST5 Min(s) Read
All Proof-of-Work (PoW) blockchains validate transactions by harnessing the computing power of computers spread across the globe. These validating systems are called ‘nodes,’ and individuals running these machines are called ‘miners.’ Nodes on the blockchain network solve complex crypto puzzles to arrive at the solution. A node can only add transaction data to a block when it arrives at the correct solution.
This arrangement means that PoW blockchains consume tremendous amounts of electricity resulting in higher cost. Individual miners cannot afford to singlehandedly mine blocks on a single machine. Therefore, miners aggregate their computing power to form ‘mining pools.’
Users pay gas fees on their transactions to incentivise miners to pick up their transaction for processing. These gas fees go straight into the miner’s pocket and are a part of their rewards. Mining rewards are calculated on a per-block basis and distributed among the pool nodes.
Every block is linked with a ‘nonce’ which stands for ‘number only used once.’ The nonce is the solution that every node is trying to arrive at. If a node arrives at a solution that is very close to the nonce but not the exact answer, it is awarded a ‘share’ by the blockchain, which is that node’s ‘proof of work’.
The node that calculates the correct answer finally adds the transaction data to the block, which is then added to the blockchain. It then claims the entire pay-out for the block and distributes it among the nodes based on their share of the contribution. Unfortunately, this can be leveraged for malfeasance.
What is Selfish Mining?
Since different nodes on the network are creating different blocks, all at once, it is possible that 2 blocks may be created at the same time. The blockchain would fork into two different chains if both were to be published at once and connected to the same last block. This is the vulnerability that selfish miners exploit.
When a node successfully adds a block, it broadcasts that information to all other nodes so that the publishing does not conflict with other blocks. However, selfish miners running customised blockchain clients on their systems block the broadcast from all other nodes outside the mining pool. By doing so, they mislead the honest nodes that keep adding newer blocks and intentionally cause the honest nodes to fork the blockchain.
For example, let’s say block 10,00,001 just got mined by the selfish miners and the node that added it to the blockchain did not broadcast this to other nodes. Unaware of the update, honest nodes on the network will continue adding new blocks from block 1,000 onwards. Now this means that two blocks are linked to block 1,000 — by the selfish miners and the other by the honest nodes. The blockchain is now forked into two chains.
In the meantime, the selfish miner continues to mine and add new blocks to their private chain, which keeps growing longer. Once they have gained a sufficient advantage, they release information about block 1,001 to the blockchain. The blockchain immediately recognises that the selfish miners’ block was mined first and establishes their chain as the valid chain, thus invalidating the chain on which the honest nodes have been working.
This means that honest nodes receive no rewards in the process, and their entire computing power goes to waste. Unfortunately, this also means that the mining rewards go to the selfish miners as their chain becomes the new public chain. The reward size concomitantly incentivises other miners on the network to join the selfish mining pool. Thus, the selfish mining pool keeps growing in size. Here’s where the next problem comes in.
Each node’s computing power is called ‘hash rate,’ which, when combined with other systems, results in a higher hash rate and translates into an increased likelihood of solving the crypto puzzle. So, if the selfish mining pool keeps growing and becomes large enough to command a majority of the hash rate, it starts controlling the blockchain. Here’s how?
The PoW blockchain requires a majority of the nodes (51%) to be honest for a transaction to go through and trigger the creation of the next block. But if 51% of the overall hash rate is with the selfish mining pool, it can simply ignore transactions with negligible gas fees, thus stalling many legitimate transactions in the process. Since the selfish mining pool is now governing which transactions go through and which ones don’t, it results in centralisation of the blockchain and defeats the entire underlying principle of decentralisation (no governing authority).
However, this is unlikely because fraudulent activity, if detected, will result in a drastic drop in the cryptocurrency’s price. So, most miners will prefer to keep operating with honesty instead of blindly joining a high-reward pool.