When bitcoin miners mine, they have to solve a difficult and extremely repetitive math problem using the SHA256 algorithm. The miners are trying (basically playing lottery and almost always working in large groups) to get a hash with (currently) at least ~18.81 zeroes. (I put a decimal/float number because the value is inconsistent.) But, I want to put the hash into a hash function and get that super hard-to-compute number for a story I have where a superhero calculates this number. How do I get this string (nonce) that calculates to this zeroed hash and where do I find this on a block explorer, such as blockchain.com, or on bitcoin-cli?

  • Sorry, I'm not secure to undestend the your question, you want have a method for calculate the nonce and you want find the nonce on the explorer, right? Aug 25, 2019 at 13:39
  • Yeah. That’s what I wanted to do. The nonce has already been computed. Aug 25, 2019 at 13:45
  • 1
    Bitcoin PoW uses double SHA256, sometimes written SHA256d. See en.bitcoin.it/wiki/Block_hashing_algorithm for the format of the block header an example. Note this data is binary (aka bits) and 'string' is usually used in computing for characters, so if you are using a program or API designed to hash 'strings' it may not work for bitcoin, although some languages like C++ and python2 do support arbitrary binary strings. Aug 25, 2019 at 15:15
  • That’s true, I did some research and found that you can get the info as the block heading/header Aug 25, 2019 at 16:24

2 Answers 2


To calculate the PoW hash, all the data of the header of the block is concatenated. The nonce is also concatenated within that data. Then, that concatenated data is put through the SHA256 algorithm and the result is compared to the current target. The resulting hash needs to be smaller than the target to be valid.

So, it's not about how many zeros it has, but if it's smaller than the target. Seeing it in terms of zeros could help to understand it, but that is miss leading. There could be 1 hash that has exactly the same number of zeros as the target and still not be valid, because it may not be smaller than the target.

For example, let's assume that the target is:

00000000000000000004f34860a8c59d52c4472ec3798c16f394a699f5e6d8b6 And our SHA256 hash is:

00000000000000000005f34860a8c59d52c4472ec3798c16f394a699f5e6d8b6 It would not be a valid PoW hash because it's not smaller than the target. They both have the same amount of zeros, but our hash is greater than the target.

Both together: 00000000000000000004f34860a8c59d52c4472ec3798c16f394a699f5e6d8b6 00000000000000000005f34860a8c59d52c4472ec3798c16f394a699f5e6d8b6 If we keep changing a bit the data, by increasing the nonce by 1 and then concatenating it again with the data of the block header, and pass it through the SHA256 alright again and again, eventually we will get a hash that is smaller than the target.

For example:



Our hash:

00000000000000000003f34860a8c59d52c4472ec3798c16f394a699f5e6d8b6 As you can see, our hash now is smaller than the target and is a valid PoW hash for our block.

The hash of the block header data could even be way smaller than the target, and it's valid. It can have more zeros, but finding a hash like this is less probable in average:


To visualize it better, you can go to this site that has a simple blockchain implementation to visualize how a blockchain works: https://andersbrownworth.com/blockchain/blockchain

I've concatenated the data of the block 5 and passed it through a SHA256 function:

Concatenated data:


SHA256 hash of that data:

0000d73c6ecf38aa53a8fbace738ff59540fd5e519e6d9aa496f61ce70110a09 If we compare the hash of block 5 with this one, it's the same.


If I undestend the your question,

This is an example of the proof-of-work algorithm.

The nonce is a component of the block, the strucure of the block contain the value, inside the blockchain.com you can find the value inside the propiety "nonce"

I hope I answered your question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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