# How is the Mining Difficulty calculated on Ethereum?

Having read various pieces of documentation, it's still not completely clear to me what dictates the difficulty rise, and how Ethereum difficulty levels differ to Bitcoin.

In the past week difficulty has jumped from around 11 to over 17, whilst GH/s has fluctuated between 800.00 - 1400.00 but with no clear correlation between the two.

Has the "difficulty bomb" now been introduced? And if yes, is there any way for approximating or calculating how much difficulty will likely rise by in the next 6-12 months?

Related: If Serenity / PoS is unlikely to be introduced until early next year, has there been any suggestion from the dev team that the effects of this "difficulty bomb" will be reduced in either the homestead or metropolis releases?

Mining difficulty is calculated from the time difference between blocks. The exact formula will change in Homestead. The symbol `//` in the following denotes integer division.

• Frontier:

`block_diff = parent_diff + parent_diff // 2048 * (1 if block_timestamp - parent_timestamp < 13 else -1) + int(2**((block.number // 100000) - 2))`

`block_diff = parent_diff + parent_diff // 2048 * max(1 - (block_timestamp - parent_timestamp) // 10, -99) + int(2**((block.number // 100000) - 2))`

EDIT:

The problem with the frontier formula and the reason for the change was that the frontier version doesn't take into account how far off from 13 seconds the block time was. A block mined 1 second after the previous one has the same effect on the difficulty as one mined after 12 seconds. This causes block difficulty to adjust to a median block time rather than a mean.

Again, check out the EIP for more details.

• Apologies that I lack the the knowledge but how exactly would I use this to calculate? Seeing the difference "< 13 else -1" vs "// 10, -99" it's not clear to me what the difference will be. If you have a moment to explain in more depth that would be greatly appreciated! Mar 13 '16 at 16:59
• In the formula the time between the latest block and the block before it is evaluated. If the time difference is smaller than 13, the difficulty goes up: `block_diff = parent_diff + parent_diff // 2048 + int(2**((block.number // 100000) - 2))` If the time between the last two blocks was larger than 13 seconds, the difficulty goes down: `block_diff = parent_diff - parent_diff // 2048 + int(2**((block.number // 100000) - 2))` Mar 13 '16 at 18:46