mining pools – Why does the Stratum protocol use a Share Difficulty of 2^32?

[ad_1]

In the comments below his answer to my recent question about Network Difficulty, Pieter noted that Stratum Share Difficulty is an entirely separate concept. See https://bitcoin.stackexchange.com/a/121133/142060 where he states:

“Inside the Stratum protocol used for pool mining there is also a notion of (share) difficulty, however it corresponds to exactly 2^32 hashes per block (so it differs from difficulty as used by the rest of the ecosystem)”

To summarize, this means that statistically, mining 1 pool share requires computing 2^32 hashes, on average. 2^32 equates to 4294967296.

By comparison, Network Difficulty at the first epoch (aka Difficulty 1) is defined such that out of 2^256 possible hashes, exactly 0xffff * 2^208 + 1 of them would mine a valid block. (0xffff * 2^208 + 1) / 2^256 equates to 1/4295032833.000015.

Is it pure coincidence that 2^32 (4294967296) is so close to the reciprocal of the Difficulty 1 ratio of valid-to-total hashes (4295032833.000015)? Or was 2^32 chosen as a convenient approximation of this number?

Here is some Python to illustrate:

# Share Difficulty
share_difficulty = pow(2, 32)

# Network Difficulty 1
possible_hashes = pow(2, 256)
valid_hashes = int(b'0xffff', 16) * pow(2, 208) + 1
valid_hash_ratio = valid_hashes / possible_hashes

print(1 / valid_hash_ratio)
# 4295032833.000015

print(1 / valid_hash_ratio - share_difficulty)
# 65537.00001525879

If my theory of 2^32 being an approximation is not correct, does anyone know why it was chosen as Share Difficulty within the Stratum protocol?

Thank you

[ad_2]

Source link

Leave a Comment