<p>Difficulty is a function of the number of blocks and the time it took to produce them. In Bitcoin, the difficulty is calculated every 2016 blocks. At each recalculation, it calculates how long it took to mine the 2016 blocks using the block timestamps and then compares that to how long it should have taken to mine 2016 blocks (the target is 2016 blocks in 2 weeks). Then using simple proportions, it scales the difficulty accordingly.</p>

<p>Because the difficulty is based on the time it took to mine blocks, the difficulty is directly related to the amount of hash rate there is in the entire system. More hash rate means that blocks will be found more quickly, so the difficulty will increase. Less hash rate means blocks will be found more slowly, so the difficulty decreases.</p>

CC BY-SA 3.0
2018-01-16T22:02:33.267Z
Ok so I take it what you're saying then is that it is true - if 90% of miners left, it would be 90% easier to mine coins. It would just take 2 weeks for the system to re-calculate the difficulty.
Dainty Warlord
CC BY-SA 3.0
2018-01-16T22:26:24.060Z
No, it would take however long it takes to mine the 2016 blocks. The retarget is every 2016 blocks, not every 2 weeks. The goal is to make the 2016 blocks take 2 weeks to mine.
Ava Chow
CC BY-SA 3.0
2018-01-16T22:37:47.193Z
yep yep understood. I asked this question cause I wanted to ask myself what would happen if the price of bitcoin ever fell below the cost of creating a bitcoin. But it looks like the cost of creating a bitcoin is actually dependent on market factors - it doesn't just get more and more difficult.
Dainty Warlord
CC BY-SA 3.0
2018-01-16T21:36:09.190Z
2018-01-16T21:36:09.190Z
Ava Chow
<p>I'm trying to understand how difficulty works in bitcoin mining. I understand that as there are less and less bitcoins left to be mined, the amount you get for each new block is lowered.</p>

<p>The bit I don't get is how a block is mined every 10 minutes. The miners aren't connected to a single network and talking about how much mining power they have so how would the system itself be able to regulate itself to only spit out a new block every 10 minutes?</p>

<p>Also, does this mean that difficulty is really not only a function of how many bitcoins are left, but also how many miners are there in total? So say, if 90% of the miners decided to not mine bitcoins anymore, then would bitcoins be 90% easier to mine for the 10% of miners left? Likewise if bitcoin miners doubled, it would be 100% more difficult to mine? Simply due to the fact they would need to sustain the quota of a block per 10 minutes?</p>

<mining-reward><difficulty>
Is the difficulty in mining a function of how much total mining power there are in the ecosystem?
Dainty Warlord
# Is the difficulty in mining a function of how much total mining power there are in the ecosystem?

(Asked by: username_0 on 2018-01-16)

I'm trying to understand how difficulty works in bitcoin mining. I understand that as there are less and less bitcoins left to be mined, the amount you get for each new block is lowered.

The bit I don't get is how a block is mined every 10 minutes. The miners aren't connected to a single network and talking about how much mining power they have so how would the system itself be able to regulate itself to only spit out a new block every 10 minutes?

Also, does this mean that difficulty is really not only a function of how many bitcoins are left, but also how many miners are there in total? So say, if 90% of the miners decided to not mine bitcoins anymore, then would bitcoins be 90% easier to mine for the 10% of miners left? Likewise if bitcoin miners doubled, it would be 100% more difficult to mine? Simply due to the fact they would need to sustain the quota of a block per 10 minutes?

**Tags:** mining-reward, difficulty


---

## 1 answers

### Answer by username_1 on 2018-01-16. Score: 2

Difficulty is a function of the number of blocks and the time it took to produce them. In Bitcoin, the difficulty is calculated every 2016 blocks. At each recalculation, it calculates how long it took to mine the 2016 blocks using the block timestamps and then compares that to how long it should have taken to mine 2016 blocks (the target is 2016 blocks in 2 weeks). Then using simple proportions, it scales the difficulty accordingly.

Because the difficulty is based on the time it took to mine blocks, the difficulty is directly related to the amount of hash rate there is in the entire system. More hash rate means that blocks will be found more quickly, so the difficulty will increase. Less hash rate means blocks will be found more slowly, so the difficulty decreases.

> **Comments:**
> **username_0**: Ok so I take it what you're saying then is that it is true - if 90% of miners left, it would be 90% easier to mine coins. It would just take 2 weeks for the system to re-calculate the difficulty.  
> **username_1**: No, it would take however long it takes to mine the 2016 blocks. The retarget is every 2016 blocks, not every 2 weeks. The goal is to make the 2016 blocks take 2 weeks to mine.  
> **username_0**: yep yep understood. I asked this question cause I wanted to ask myself what would happen if the price of bitcoin ever fell below the cost of creating a bitcoin. But it looks like the cost of creating a bitcoin is actually dependent on market factors - it doesn't just get more and more difficult.  

---

