I've been told "the network" sets the difficulty level such that there will be one new block mined every ten minutes.

I imagine the rich would instead prefer to keep difficulty as high as possible to prevent other people winning their 50 BTC and causing inflation, whereas the poor would prefer as low a difficulty as possible in order to get a greater share of the BTC available.

(By rich and poor, I mean only according to how many BTC someone has.)

What's the force saying "No, forget your petty self-interest and set the difficulty to 10 minutes."?

up vote 46 down vote accepted

The bitcoin network rules define which difficulty each block has. This is done through a simple formula that only depends on the block chain itself. This means that if you give me a blockchain with blocks 1 through N, I can tell you with 100% accuracy what the difficulty of block N+1 will need to be, and I can reject any block which has the wrong difficulty. This means it is not really "the network" deciding on a difficulty, but really each separate node calculating and enforcing it independently.

The actual formula is this: at every block N which is a multiple of 2016, look at the time stamps of the past 2015 blocks, and change the difficulty for what follows to old_difficulty*(2 weeks)/(time the past 2015 blocks took). Additional rules on which time stamps are allowed in blocks prevent cheating (mostly).

In short, by using a bitcoin client, you agree to its network rules, and those include the difficulty adjustment.

  • 2
    Hmm, could you be more precise about the "time stamp" used? Afaik the time in the block header can be very inaccurate, and block propagation can induce some delay between nodes (so, if they record the time they first heard of the block, not everyone would exactly agree on the same difficulty). And, what would happen if one generated blocks with a computer whose clock is out-of-sync (like, days in the past/future)? (If this is not adequate as a comment I can make a separate question.) – Artefact2 Sep 10 '11 at 19:30
  • 2
    @Artefact2: from the wiki: "A timestamp is accepted as valid if it is greater than the median timestamp of previous 11 blocks, and less than the network-adjusted time + 2 hours. "Network-adjusted time" is the median of the timestamps returned by all nodes connected to you." – user220 Sep 10 '11 at 21:55
  • I think the important thing is that it's not a buncha servers voting on what the difficulty should be, which is what it sounds like when people tell me that the difficulty is set by the network. – billpg Sep 11 '11 at 0:00
  • 1
    @billpg - Correct. It would be more accurate to say difficulty is set by the algorithm. It is adjusted every 2016 blocks based on average execution time for prior 2016 blocks to ensure future average execution time remains ~10 minutes. Of course a miner could ignore/break this algorithm but then they wouldn't be mining valid bitcoin blocks (they would be mining a fork). – DeathAndTaxes Oct 10 '11 at 13:20
  • Just to be completely clear: "time the past 2015 blocks took" means "Timestamp of block 2016N-1 minus timestamp of block 2016N-2016"? And without the off-by-one bug, it would have been block 2016N-2017? – Meni Rosenfeld Jan 22 '12 at 6:09

Each individual client checks the validity of each block it receives. If it receives an invalid block, it ignores that block as if it didn't exist.

If you mine a block and other clients ignore it, you don't get your 50 Bitcoins. You only get to keep your 50 Bitcoins if the block you mined becomes a link in the accepted public chain.

One of the first things that is checked by the client when it receives a block is that the block meets the difficulty target that it calculates based on how quickly blocks have been generated. If that client doesn't think that block meets the difficulty target that it calculated, then it ignores the block.

So you have to mine a block that other clients will accept, or you don't get your 50 Bitcoins.

The difficulty is adjusted every 2016 blocks by the whole network so as to average the Bitcoin generation to a block every 10 minutes. If the coins were on average generated too fast since the last adjustment, the difficulty is increased, if they were generated too slow - it is decreased.

What the rich can only do is do their best to have the highest possible hashing speed. This would make them brake the block more often (they would earn more money), as well as increase the difficulty higher, so people with lower-end machines could not brake a block without using a pool in a reasonable time (as is the case currently).

What the rich can also do is hoard the Bitcoins, so their value would increase. Keep in mind that even if someone would own 99+% of all the Bitcoins the currency would still be as usable as with bigger pool of coins (Bitcoins currently can be divided to up to 8 decimal places, and there is nothing stopping a future implementation from dividing them up even further).

Of course if someone wants to depreciate the value he or she can undermine the trust people have in the coins. For example, the hacking of Mt.Gox caused a lot of people to be more reserved when handling the coins. On the other hand, if one wants to increase the value of Bitcoins, one should promote them, convince new people to invest in them and be a contributing member of the community.

Software. The Bitcoin network runs on a set of previously-agreed-upon rules that are built into the Bitcoin client software.

One such rule is that the difficulty should be changed every 2016 blocks to make a new block take, on average, 10 minutes to mine. As the economics change, miners will startup and shutdown making the average block take more or less than 10 minutes to find but the next time another 2016th block is mined, the difficulty will again be re-adjusted.

I would actually reword your question as well since a block's difficulty isn't technically set to a time but a number. Instead you might want to ask, "What keeps the average time to mine a block at 10 minutes?"

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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