I understand how generating a SHA-256 hash containing any specified sequence requires lots of guessing and checking. The longer the specified sequence, the more rarely that it will appear.

And I understand how inserting random nonces into a block until its hash happens to begin with a certain number of 0s is a computationally expensive and ultimately random process, which demonstrates proof of work.

What I’m wondering is: why zeroes, and why leading?

Could mining work just as feasibly if the challenge were to produce a hash with, say, ends in a certain number of Fs, or has the digits 314159265358979... starting at index 32?

Or is there a technical reason why miners’ goal is to produce a hash which begins with 0s, and not any other character at any other location in the hash?


The "leading zeros" are a simplification. The difficulty is encoded as a target which is essentially a 256 bit number. Since block hashes are produced by SHA-256, they're also a string of 256 bits. If a block candidate's hash interpreted as a number is numerically smaller than the target, the block candidate is a valid block.

| improve this answer | |
  • Sensical! So if I know a target has n leading zeroes, that's shorthand for saying that the actual specific target lies somewhere between [ 16^(63-n), 16^(64-n) ), yeah? – Jacob Ford Aug 9 '17 at 20:10
  • 1
    I'd have said [ 2^(255-n)-1, 2^(256-n)-1 ), but besides that yeah. – Murch Aug 9 '17 at 20:52

Leading ones or trailing ones will work as well as leading zeroes or trailing zeroes, it looks like a random choice from four equivalent cases.

Starting index from middle point might limit that value of maximal hardness of the mining, unless using of some sophisticated bit shifts for overcoming the limit, which may be slightly awkward for supporting in future. Non-regular patterns, like mathematical constants, might add even more pain for some kinds of developers and will not be obvious at all when looking at bit string of hash sum.

| improve this answer | |

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.