What is selfish mining?
A selfish mining attack, also known as a block withholding attack, describes a malicious attempt to discredit blockchain network integrity. Selfish mining attacks occur when an individual in a mining pool attempts to withhold a successfully validated block from being broadcast to the rest of the mining pool network. After the selfish miner withholds their successfully mined block from the group, they continue to mine the next block, resulting in the selfish miner having demonstrated more proof-of-work compared to other miners in the mining pool. This allows the selfish miner to claim the block rewards (and financial rewards) while the rest of the network adopts their block solutions.
How does it work?
Initially, the forked blockchain will be shorter than the public blockchain. However, selfish miners can strategically time their display of new blocks such that honest miners from the public blockchain abandon their own chain and join the private chain. Subsequently, the private chain mines new blocks within its pool and hides the newly generated blocks. In the meantime, the public blockchain continues mining new blocks. The process is repeated until the private blockchain is greater than the public one. Now the private chain reveals its blocks again, and miners from the public chain abandon their blocks to join the private chain because it is more lucrative.
Can it harm the blockchain?
Selfish mining creates a great deal of waste, but it’s important to note that those engaging in the practice maintain a strategic advantage over other participants in the network. Selfish mining could lead to mining pools growing in hash rate, as parties will team up with the selfish entities to maximize their revenue. Once a single pool has acquired the majority of the power, it may attempt a 51% attack.
How can such attacks be avoided?
Two possible solutions have been proposed to prevent selfish mining attacks from occurring on blockchain networks. The first is to randomly assign miners to branches of the blockchain when a fork occurs, and the second is to set threshold limits for mining pools on the network that would prevent selfish miners from gaining a significant advantage over other miners operating on the network.
Cost vs benefits of selfish mining?
The key idea to evaluate the profitability of selfish mining is to compare it to the profitability of honest mining. We assume that miners are in the mining business because the operating cost (equipment, energy power, salaries, etc.) are compensated by the block reward of newly generated Bitcoins plus transaction fees. Therefore, the cost of mining per unit time is independent of the strategy if the hash rate operates at full capacity. Note that this cost is independent of the strategy and the block mined being accepted or not by the network.
Selfish mining strategy has two caveats. First, purchasing hardware to acquire a majority of hash rate in a major Bitcoin is expensive; the mining industry has moved from inexpensive CPU and GPU mining to sophisticated ASIC mining chips that are expensive. Second, as the 51% hash rate gives the attacker complete control over the network, it can easily be noticed by the network entities, and they may discard all blocks published by the selfish miner. Due to these limitations, selfish mining attacks have not been observed frequently in blockchains.