0

I went through this. And I could not comprehend well.

For example, in SHA-256, it takes any type of input and gives a 256-bit output. And if we add a random number as a tail in the input, the output generates a certain number of zeros in the beginning.

In case of CryptoNight, how does this work?

And what nodes verify as proof of work to accept a block?

0

Your understanding is nearly correct regarding SHA-256 PoW.

Let's break it down. SHA-256 is a cryptographic hashing algorithm (that happens to be used as a PoW mechanism in some crypto currencies). CryptoNight is also a cryptographic hashing algorithm, although it's specifically used as a PoW mechanism (I don't know of it being used for anything else). They are both hashing algorithms though, they just internally work differently and have different properties. They both take input data and create a unique one way hash of that data.

The PoW mechanism is ultimately the same (which ever hashing algorithm you use). You take a block template, add a nonce (some random number), then hash. The output hash is a number. If that number is smaller than the current network difficulty target, you submit that block data (which has your nonce in it) to the network. If not, you increment the nonce (to simply change your input data) then repeat.

Verification of PoW is taken care of by the nodes receiving the submitted block data. Nodes hash (using the same hashing algorithm) the block data and if the resulting hash is smaller than current difficulty target, PoW is verified. Of course, to be added as the next top-block (and therefore get a reward) it also has to be first-seen (amongst other things).

TL;DR

It's better not to think about generating a certain amount of zero's, but rather finding a number (a hash) that's smaller than the current network difficulty target.

  • So, what they do is similar. But how they do is different, Correct? – Raghu May 20 '18 at 18:26
  • "what they do is similar." if you are talking about hashing algorithms then yes. They both take input and create a one way hash as output. "how they do is different" yes. Just like MD5 is different from sha 256. Hashing algorithms work differently and with different properties. In the case of CryptoNight it's designed purely as a PoW hashing algorithm and designed to work well on commoditized hardware (as an egalitarian PoW hashing algorithm). – jtgrassie May 20 '18 at 22:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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