# How does the difficulty adjustment for monero work?

For context, the Monero hashrate has recently experienced a large, sudden drop in hashrate.

The network will adjust the hash rate accordingly, however it will take a certain amount of time for this adjustment to take place.

How is the adjustment calculated and how long will the adjustment take when the hashrate drops like it has today?

The difficulty adjusts with each block.

The adjustment algorithm examines 720 prior blocks, starting from 15 blocks ago.

Of those 720 blocks, the 60 highest and lowest block times are excluded from the analysis, which leaves 600 blocks.

Out of those 600 blocks, the average block time is determined. This average is then used to adjust the difficulty proportionally in order to target a 120 second block time. Difficulty is defined as the number of hash attempts required, on average, to find a valid hash for the block every 120 seconds. The unit of difficulty is therefore "hashes".

When there is a large and sudden change in hashrate, e.g. due to the April 6th 2018 PoW change, it will therefore take 15+60=75 blocks before the change in hashrate starts to affect the difficulty. The change to difficulty when adjusting to the new hashrate will be gradual, and after 15+60+600=675 blocks the new hashrate will have been fully taken into account by the algorithm.

When you see web sites display a "network hash rate" statistic, what those sites are actually doing is inferring the network hash rate from the current difficulty. The actual current network hash rate can only be indirectly inferred by observing how quickly blocks are being mined.

Credit for this answer goes to smooth from his comment here: https://www.reddit.com/r/Monero/comments/8a9wof/the_actual_drop_on_hash_power/dwxxiek/

This is how I understand it to work, and some of it may not be entirely accurate. Monero is set such that a block can be mined approximately every 120 seconds(or two minutes). The difficulty is set in place to allow this to happen; this allows us to have a relative roadmap and control as to how much monero is being "distributed". So if everyone was mining on garbage pc's(or cell phones) the difficulty would be very VERY low. However since asics were introduced the difficulty sky rocketed to maintain the 120 second/block timeline. In order to have a decent metric for measurement, 720 blocks is what monero uses to make accurate adjustments in difficulty, relative to current network hashrates. Certainly the blockchain is, and will continue to decrease/adjust difficulty before then, but it will be most accurate after 720 blocks(from fork block).

tl:dr Difficulty is calculated based on current network hash rate to maintain the 120 seconds per block mining ability, but needs a large enough sample size to do so accurately(i.e. 720 blocks).

• But how does the adjustment work? Is there a gradual adjustment or will it take 720 very slow block times before a massive adjustment?
– user1076
Apr 7, 2018 at 8:47
• Its explained in more detail here: reddit.com/r/Monero/comments/8ae506/… Apr 7, 2018 at 9:01