Decentralization is crucial in most projects and networks on the blockchain. Bitcoin delegates transaction validation to nodes with computational power instead of relying on a central authority. On a proof of work (PoW) blockchain like Bitcoin, the process is called mining. Participants validate crypto transactions and receive rewards.

Safety on the PoW blockchain depends on the assumption nodes will remain honest and share new blocks on the chain. But it's impossible to guarantee the honesty of every node. Some may fail to publicize newly discovered blocks to win more rewards in a process called selfish mining.

What Is Selfish Mining?

Selfish mining involves a miner or group of miners deceitfully withholding new blocks on the blockchain to monopolize the rewards for validating blocks. Mining refers to validating transactions on the Bitcoin network in exchange for the block reward and transaction fees, which is how Bitcoin mining works.

Selfish mining occurs when a miner keeps the information about a newly discovered block secret to accumulate more blocks than the public chain and gain most of the block rewards.

Selfish miners, if successful in their attack, can alter the trajectory of the blockchain. Their primary purpose is to undermine the public chain by creating more blocks, enough to dominate the main chain and monopolize the block rewards. Once they can replace the main chain with their private chain, the blocks, and transactions within the blocks on the chain are entirely different from what should ordinarily have been recorded.

How Does Selfish Mining Work?

To understand selfish mining, it is crucial to understand how blockchain mining works. When you send crypto from one wallet to another, the transaction is grouped with others to form a block encrypted with a 64-digit hexadecimal number called a hash. Miners compete to solve with computational power to guess the hash. The successful miner gains the right to validate the transactions in that block, add it to the public chain, and receive the reward.

A selfish miner will compete with other miners to guess the hash and gain the right to add the block to the blockchain. But instead of adding (publishing) the new block, a selfish miner hides that block and continues to mine blocks on top of it. The blocks mined selfishly are only disclosed to gain maximum reward on the blocks.

The mining process occurs concurrently—not simultaneously. On a large network such as Bitcoin, thousands of transactions are being processed. To save time, the transactions are grouped into blocks. Miners compete to be the fastest to solve the hash for a block, so they get to be the ones to add it to the chain.

However, when a selfish miner mines and conceals a block, he doesn't hide it under a bushel. Instead, the miner fails to add it to the distributed ledger creating what is referred to as an "accidental fork." An accidental fork is just a series of blocks running next to but not part of the blockchain. Although in the case of selfish mining, it really isn't accidental.

While the other crypto miners continuously work on the public part of the blockchain, selfish miners build onto their fork, intending to accumulate more blocks than the public chain, after which they publicize it.

At this point, one of three things could happen; if the public chain is longer than the selfish miner's fork, they forfeit, and the (honest) miners on the public chain gain their rewards. If the public chain is shorter, they win, and the accidental fork is adopted as the valid chain. This is because a proof of work blockchain is built on the assumption that the longest chain is the valid chain. The "selfish" fork then becomes part of the main chain, and duplicate blocks on the main chain are discarded, causing miners who contributed to that chain to lose their rewards.

The PoW blockchain requires a lot of computational power to validate transactions, so a group of miners often carries out a mining activity called a pool, which combines their computational power to increase their chances of gaining rewards. A selfish miner needs to hold between five to ten percent of the hash rate on the network.

Is Selfish Mining Dangerous?

Skull in triangle warning sign

One effect of a selfish mining attack is the centralization of the network. Nodes on PoW blockchains are required to adopt the longest chain as the valid version of the blockchain. Because honest nodes risk losing their rewards if the selfish chain turns out to be longer at publication, they are more likely to join the pool of selfish miners. Eventually, the selfish pool grows to become the majority on the blockchain and eliminates the decentralization on the network.

Mining centralization on the Bitcoin network can also lead to a delay in transactions. When a selfish pool becomes the majority on a network, it can dictate which transactions get added to the public chain. Selfish miners are more likely to prioritize blocks with higher rewards. This selection of transactions will lead to a pileup of transactions and make the network inefficient.

Additionally, selfish mining by introducing centralization to the blockchain creates the perfect environment for malicious actors. Issues like double spending could also be carried out because the task of validating transactions resides in the power of dishonest nodes.

Strategies for Combating Selfish Mining

Several strategies have been proposed to combat selfish mining on the Bitcoin network, and each strategy takes a different approach. While some suggest making changes to the network, other strategies include providing nodes with incentives to remain honest.

The first solution proposed is a randomization technique. This is known as a backward-compatible change. It requires miners who stumble upon more than one fork on the blockchain to select which fork to continue working on at random. In addition to randomly selecting blocks, miners must publish information on all discovered blocks and forks. Because selfish mining depends on a private chain and deliberate continuous mining on that chain, introducing a random selection process undermines the activity.

A separate strategy involves branding each block with a timestamp. The timestamp will include information on when each block was mined, so when a block is mined privately and subsequently added to the main chain with its out-of-date timestamp, it can be easily picked apart from the rest and discarded.

Selfish Mining Reduces Bitcoin's Value

Regardless of their lucrative appeal, selfish mining attacks can negatively affect the blockchain network. They can lead to centralization and transaction delays, creating the perfect environment for malicious actors.

Several strategies have been proposed to combat selfish mining, including making changes to the protocol and incentivizing nodes to remain honest. Ultimately, for miners to be profitable, it is in their best interest to act honestly and maintain the value proposition of the cryptocurrency.