2

I understand that the Bitcoin mining problem is to find a string s (hash of previous block + transaction hashes + nonce) such that sha256(s) has n leading zeros, where n determines the mining difficulty.

The result of sha256(s) is a 64-length hexadecimal string. Each position of 64 has 36 possibilities (a-z, 0-9). So, the expected number of guesses would be 36^n.

The hash of block #485891 is

0000000000000000007ea3c67381ecfcf8e44e9941dcef554e8b029068857b55 

which has 18 leading zeros. Thus, the expected number of guesses is

36^18 = 10314424798490535546171949056.

This hash was found by Antpool which has a hash power of 1284.32 PH/s. Therefore, the expected time for Antpool to find the hash would be

36^18 / (1284.32 * 10^15) = 8.03104*10^9 s = 255 years.

This time is obviously incorrect. Is there anything I missed out?

4

As you say, the result of sha256 is a hexadecimal string. Hexadecimal only uses the digits 0-9 and a-f, which is 16 possibilities, not 36.

If you redo your calculation with 16^18 instead of 36^18, you get an average time of around 3600 seconds, or 1 hour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.