Bitcoin block propagation examples

Unpacking Crypto Mining's Stranded Difficulty Issue

Stranded issue is caused by a significant amount of hashrate migrating from one network to another and then switching back, which jacks up the difficulty and makes it difficult for other miners to mine blocks.

Ethan Vera
Ethan Vera

Since Jan-2018 Luxor has been supporting mining of various projects. We have helped many projects as they went through transformative periods in their mining lifecycle, such as Equihash miners coming out in mid-2018, Sia ASICs coming online and so forth. We try our best to help support the network and community during these times.

One trend we see emerging is miners becoming more sophisticated in finding ways to maximize their profitability. One result is that profit switching pools are becoming more popular. While we think this is good for miners, we also think there are some risks that come with moving large amounts of hashrate between coins.

The Stranded Difficulty Issue is a problem that has existed much longer than profit switching pools but may become more prevalent with their rise in popularity.

In summary, the issue results when a large amount of hashrate jumps over to a smaller network, resulting in a higher network difficulty, then jumps back, leaving the network’s remaining miners to work on a difficulty not meant for that level of hashrate (essentially stranding miners).

Before we dissuss the issue it is important to understand the relationship between hashrate & difficulty, how difficulty adjusts and profit switching.

Relationship Between Hashrate and Difficulty

PoW blockchains have a target block time, which means that on average it should take X amount of seconds to solve 1 block.

For example Bitcoin has a target block time of 600 seconds (10 minutes) which should result in 144 blocks per day. However, mining is a variable process so block times can vary based on Luck and changes in hashrate.

In the example below, block at height 610544 was found in less than a minute, 610543 took ~13mins, 610542 took ~3mins and 610541 took ~18mins.

Bitcoin's block propagation times can experience volatile variance 

As more hashrate comes onto the network, holding all else equal, the speed at which blocks are found will increase. And vice versa, if the network hashrate drops so too will the rate at which blocks are found. This impacts the target block time set by the network.

To deal with this, networks have a Difficulty Adjustment Algorithm (DAA). Which is essentially a built-in hashrate measurement that adjusts the difficulty of the math problem miners need to solve. Holding all else equal, the higher the Difficulty the lower amount of blocks found.

So Difficulty acts as a natural balancing mechanism for fluctuating hashrate to ensure that the network meets its target block time. This ensures that miners aren’t finding blocks too quickly, which would be the case if the math problems (difficulty) were too easy. It also prevents long periods of time where no blocks are found at all, which would be the case if the math problems (difficulty) were too hard.

Difficulty Adjustment Algorithm (DAA)

The DAA is one of the key elements to a PoW coin. It was first implemented by BTC, but has since been built on by new coins.

Taking BTC blockchain, the difficulty adjustment comes every 2,016 blocks (roughly 2 weeks). The adjusted difficulty is calculated as the network’s average hash rate from the previous period. Based on that average, the new difficulty is set such that, if that average hash rate is maintained, the network will find a new block every 600 seconds (144 blocks per day).

Many other coins have implemented more frequent difficulty adjustments. A common DAA for Equihash coins like ZEC and ZEN is DigiShield v3 which adjusts after every block.

Profit Switching

Profit switching as a concept will look at an algorithm (for example Equihash) and choose which Equihash based coin is the most profitable to mine (i.e. ZEC, ZEN, KMD, ARRR, etc) at a certain point in time.

From a technical standpoint it will be implemented either at the pool level or by a 3rd party application. At a pool level, the mining pool would automatically assign work to your machine and collect your Equihash share. The pool would then use it to mine one of the Equihash coins based on a profitability formula it runs and then pay out the miner for the share they submit (hypothetically a higher payout than a normal pool).

For a more detailed explanation of Algorithms and Profit Switching you can check out this article.

Stranded Difficulty Issue

If a large profit switching pool (or miner) were to point their hashrate at a smaller network, the difficulty adjustment algorithm would kick in, increasing the difficulty level of the network. If the pool (or miner) then switched to another coin (leaving the network), the difficulty would still be set for the higher amount of hashrate. Since the difficulty only readjusts every X blocks, the network would still need to find X number of new blocks before the difficulty is reduced again to reflect the lower amount of hashrate. The existing miners may need days or weeks to find a single block at that difficulty level.

If a network has a target block time of 150 seconds (2.5mins), not producing a single block for a long period of time could have detrimental effect on it.

Example — Equihash

Looking at the Equihash algorithm we do see some risk of Stranded Difficulty. There is over 6,000 MSol/s of Equihash hashrate around the world. The majority is pointed toward Zcash and it exponentially declines from there. The networks with less hashrate inherently have a larger risk of Stranded Difficulty.

For example if just 10% of ZEC hashrate (500Msol/s) came over to Commercium it would ~500x the Commercium network hashrate, resulting in a massive increase in difficulty (~500x). If the new hashrate then left the network, the difficulty would stay high, making it very difficult for the remaining miners to find the next block. It could take roughly 500x the target block time (around a day) to find the next block. In this scenario, likely some of the remaining miners would switch over to another coin as the cost of competing over this block would be much higher than expected payout. This would increase the impact of the issue.

Equihash network hashrate by coin (Dec-2019)

Our focus on this piece is around profit switching pools, but to be clear this problem can also happen through other methods such as miners renting power on Nicehash (or other hashrate marketplaces) and even large solo miners doing their own switching.

When looking at the entire ecosystem, pools do control the largest portion of hashrate. So the pools must make sure that they are acting in a way that supports the networks rather than hurts them.

Equihash hashrate share by pool (Dec-2019)

How to Prevent the Stranded Difficulty Issue

Responsible Players

  • Services like Nicehash must implement ways to control the amount of hashrate being directed at smaller networks at a given time
  • Large solo miners must be conscious of the issue
  • Mining pools need to be careful in implementing their switching algorithms to account for this

Ultimately, all three groups above are stakeholders in the project (mining reward comes in the respective coin) so they should work to protect and help support the projects they mine.

Network Defence

Decreasing the difficulty adjustment time is the best way to mitigate this issue. Having difficulty adjustments every block is much better than every 2,016 blocks.

The Komodo team has been working on a new implementation of PoW they call Adaptive Proof-of-Work (aPoW). This will effectively allow the network difficulty to adjust in-between blocks, making this issue much less impactful.

Contingency

As a last resort, if the project has a dev fee or some type of dev fund then some of it could be used to purchase hashrate to help speed up the discovery of a block and slowly bring the difficulty back down to a more natural level of hashrate.

Bitcoin Mining Concepts

Ethan Vera Twitter

COO at Luxor Technology