I am trying to understand the way in which the block generation difficulty is adjusted. If people stop generating blocks, is it possible for the difficulty to decrease without 2016 blocks going by? If not, then from what I understand, it seems like the following undesirable situation could arise:
0. The value of one BTC increases dramatically (say to 100 USD).
1. More people start mining, and so the difficulty increases a lot, and the electricity cost to generate a block settles at a bit less than 5000 USD as expected.
2. The value of one BTC decreases (for unrelated reasons) to 10 USD.
3. Almost everyone stops mining, because it's not worth spending 5000 USD to generate a block. Now we only get (say) one block per day from a few people who are mining just for fun.
4. If the value of a BTC doesn't rise again, it takes about 5 years (in this case) for 2016 blocks to go by so that the difficulty can go down.
Am I missing something? Thanks for reading.
I think that kind of price move would either be a) relatively temporary due to some panic or b) permanent and associated with complete demise of bitcoins. In the first case, the price would recover as would mining interest and the situation would right itself. In the second case, it's game over for bitcoin, so who cares if it takes 5 years or 5 decades to mine the next 2016 blocks. It's hard to imagine a scenario where it loses 90% of its value and takes more than a few months to recover to the point where mining activity picks up enough that the next 2016 blocks get mined in a reasonably short amount of time. Also, I don't think it would ever be the case for very long that the electricity cost of mining a block is equivalent to the value of the reward/fees for a block. If that were the case, then mining would be a money losing proposition due to the hardware costs. And, you have to factor in new generations of hardware that would increase efficiency and hence lower the cost of mining (thus inducing people to invest in new hardware and resume mining).
But, it does raise interesting questions. I'm not sure why it couldn't be made such that the difficultly adjustment happened more frequently (say every 100 blocks), or be triggered based on thresholds set on a moving average of the block creation rate (i.e. if the average rate of block creation for the last 100 blocks is <5min or >15min, re-adjust the difficulty).