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? – vincenzopalazzo Aug 25 '19 at 13:39
  • Yeah. That’s what I wanted to do. The nonce has already been computed. – Number File Aug 25 '19 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. – dave_thompson_085 Aug 25 '19 at 15:15
  • That’s true, I did some research and found that you can get the info as the block heading/header – Number File Aug 25 '19 at 16:24

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, privacy policy and cookie policy

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