Post
Topic
Board Bitcoin Discussion
Merits 8 from 3 users
Re: Does it really cost $30 to mine one testnet bitcoin?
by
SilverCryptoBullet
on 27/02/2024, 05:51:52 UTC
⭐ Merited by DdmrDdmr (4) ,ranochigo (2) ,ABCbits (2)
Difficulty of Bitcoin Testnet will be reset to 1 if no testnet block found in 20 minutes.

Your estimated cost is not correct because difficulty reset.

Bitcoin Testnet Block Storms
https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp#L32

The difficulty will reset to 1 if the time since the last block is more than 20 minutes. There is no stipulation that after a difficulty reset block that the next block must be the normal difficulty; if the next block is more than 20 minutes after the current block, then it can also have a difficulty of 1.

For blocks that are found within 20 minutes of each other, the block's difficulty will be the same as the difficulty of the last block in the difficulty interval whose difficulty was not 1 OR the difficulty of the first block in the difficulty interval. This behavior is defined here: https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp#L32.

The way that the difficulty retarget works is that, at the beginning of the new difficulty interval, the difficulty of the first block in that interval takes the difficulty of the last block in that interval and multiplies that by the time it took to mine the 2016 blocks and then divides it by the target time. The result is then clamped to be at least 1. Since this is based upon the difficulty of the last block in the previous interval, if that block is difficulty 1, then the next interval will also have a difficulty of one.

So what we are seeing here is that the last block in the interval is found 20 minutes after the block before it so it has a difficulty of one. Because the next block adjust the difficulty and it only looks at the block before it (which is difficulty 1), the difficulty of the next interval is 1. So the next 2016 blocks are mined at difficulty 1, and the difficulty then slowly adjusts up again.