Bitcoin

hash – What is the numerical precision of network difficulty?

Is this definition of difficulty correct?

yes.

So is it accurate to think of difficulty as some kind of ratio or ratio?

Yes, current blocks are many times more difficult to mine than blocks from the first difficulty era.

For reference, difficulty level 1 corresponds to 4295032833 hash attempts per block (very close). I have a goal of (exactly) 26959535291011309493156476344723991336010898738574164086137773096960.

The target for block 822627 is (exactly) 374406027949793378682501776760424667692437142927048704.

The ratio between these two huge numbers is (approximately) 72006146478567.1. This is the difficulty level of block 822627. Mining a block is roughly 72006 billion times more difficult today than it was in January 2009.

And if it’s a floating point number, what is its precision?

It doesn’t matter what precision you calculate. Typical implementations use floating-point data types for calculations, which limits precision.

But it’s really just the ratio of two huge numbers. It can also be calculated with much higher precision. Block 822627 has difficulty level 72006146478567.09941095874369093485414495333341140374503764945604440…

Difficulty is actually used to suggest to humans the hardness of mining a block, so that much precision is not needed. Internally the software uses the correct target.

Lastly, can you please confirm the formula used to compare the hash to the target to ensure that a valid block is mined?

The requirements are as follows: block_hash ≤ target (where block hash Block hash interpreted as a 256-bit little endian number. The lower the target, the more difficult it will be to land underneath it. In a sense, difficulty is a measure of “low goal”.

For more practical use, how would you express this formula using difficulty instead of goal?

Probably something like this: block_hash_diff ≥ difficultywhere block_hash_diff What is the ratio between the goal of the first block (presented above) and the actual goal of the block?

Related Articles

Back to top button