# 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! – Ben Vickers 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))` – MrChico Mar 13 '16 at 18:46
• Missing link in the answer – Thomas Jay Rush Nov 4 '18 at 22:04

People mine what is most profitable for their hardware, it has to stay profitable to mine or it is going to go belly up.

• This does not address the question. If you like, you can create a new question and answer it yourself, if you think there is an important question that hasn't been asked about mining viability. – carver Sep 13 '17 at 15:33
• the computing cost of manufacturing 5 Ethers is way way way above the current price of Ethere right now. Note, I am not talking about the huge network that composes Ether mining process , I am talking about the inefficiency of mining procces. Thousands of nodes are fighting for a chance to win a block. The same procedure could be done with mobile phones during idle time. So, the cost of producing 5 ether, could be below 1 dollar and it will be the same valuable as produced by thousands of rigs packed with AMD GPUs right now. The problem is that there are not enough currencies to invest into. – Nulik Oct 6 '17 at 11:00

Ok so this is python the formula you can get a better understanding as using python as a calculator. https://docs.python.org/3/tutorial/introduction.html#using-python-as-a-calculator

• Hi there. I don't think your answer has anything to do with the question, which is asking about the calculation used inside the difficulty algorithms (rather than how Python can be used as a calculator... ) – Richard Horrocks Aug 29 '17 at 18:06