Here we read:

In the Bitcoin network, only blocks with certain hashes get accepted and included in the official list. The criteria for which blocks "count" is that their hash has to be below a certain number called the target. The network adjusts this number up and down according to how frequently blocks are passing the test--this is how it's able to keep the rate of block production at an average of 10 minutes per block.

This calculation is expanded on here:

The Bitcoin difficulty started at 1 (and can never go below that). Then for every 2016 blocks that are found, the timestamps of the blocks are compared to find out how much time it took to find 2016 blocks, call it T. We want 2016 blocks to take 2 weeks, so if T is different, we multiply the difficulty by (2 weeks / T) - this way, if the hashrate continues the way it was, it will now take 2 weeks to find 2016 blocks.

For example, if it took only 10 days it means difficulty is too low and thus will be increased by 40%

But who does this? Is it a collective property of the cluster? Is it the server? What gives the server the authority to determine this?

My question is: What is the mechanism by which the 'system' adjusts the difficulty of finding blocks so one is found on average every 10 minutes?

EDIT: I don't believe the question ("How is the difficulty of bitcoin mining propagated?") is a duplicate - because it doesn't explain the implementation issue - which is the essence of my question.

marked as duplicate by MeshCollider, Nate Eldredge, MCCCS, Pieter Wuille, cdecker Sep 22 '17 at 22:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 1 down vote accepted

It's enforced by the fact that every miner and every Bitcoin user is running software which implements the adjustment algorithm you described. So everyone is able to compute, and agree, what the current difficulty is supposed to be. This is the notion of "consensus" which Bitcoin relies on.

If some miner created a block with a difficulty lower than the "correct" current value, the rest of the network would reject it. The coins created by that block would not be accepted as payment by anybody else, making them effectively worthless, and the transactions contained in that block would not be considered as confirmed by anyone else (though they could still be added later to another valid block). Other miners would not use that block as the "previous" for their own blocks, and so it would not be incorporated into the block chain.

Every single node performs the difficulty adjustment calculation. Because the calculation is based upon data that is already in the blockchain, the difficulty calculation is the same for everyone; there is no element of randomness. It is deterministic so every single node will arrive at the same conclusion as to what the difficulty is for the next block.

Not the answer you're looking for? Browse other questions tagged or ask your own question.