# How exactly does the network know if the miner has put forth a valid proof of work?

If all that the miner needs to do is find a hash with a certain number of leading 0's of the block's header, couldn't they just find a random hash with the required number of 0's that isn't necessarily the hash of the block header? How would the nodes know?

How exactly do the nodes decide if the proof of work is valid? What protocol is used for this?

• I had to do more research to understand how the network prevents this kind of thing because these answers aren't clear at all. Basically what I understood is that the node will recalculate the hash with the given nonce and see if it matches the one put forward by the miner.
– Sara
Aug 25, 2019 at 0:16
• the key is that there is no ‘hash put forward by the miner’. The miner puts forth the block, and all other nodes use it (the block’s header) to calculate the hash themselves, and ensure it is valid. The block does not explicitly contain its own hash. Aug 25, 2019 at 1:06
• What you are saying is that the nodes have to do the work to find the valid hash all over again. It doesn't make sense and I know it's not how this works. The question that you say is a duplicate also doesn't provide clear answers on how exactly does the network prevent this.
– Sara
Aug 25, 2019 at 14:24
• no, the nodes do not have to do the work again, you misunderstood my comment. The network’s nodes simply hash the header of the newly proposed block, and thus determine for themselves the validity of that block. If it is valid, they will quickly and easily determine this to be true. If it is invalid, they will discard it. No iterative proof of work required, and no opportunity to just ‘propose a random hash’, as you suggested. Aug 25, 2019 at 17:30
• @Sara A miner tries to mine billions of possible blocks until they find one that works. They then propose that block and everyone else just has to try that one block one time to see if it works or not. Aug 25, 2019 at 23:32

When a miner authors a new block, the block contains a block header. The block header is used to put the new block in relation to previous blocks and gives a summary of the transactions. In detail, the block header contains:

• a version byte
• the block hash of the previous block
• the Merkle root that commits to all transactions in the block
• a timestamp
• a field corresponding to the current difficulty
• a nonce that provides some randomness.

This block header has only 80 bytes of data. When these 80 bytes are put through SHA-256d once, they result in a hash which we use as the unique identifier of the block, the "block hash". The block hash is used to announce the block to peers and in the next block to commit to this one. This same "block hash" interpreted as a number has to meet the difficulty requirement ("have a certain number of leading zeros").

What you are saying is that the nodes have to do the work to find the valid hash all over again.

Not quite! Finding a block header for which the hash meets the difficulty requires a multitude of tries. Since it is impossible to predict which block header will succeed except by hashing and checking, the fact that a valid block has been found proves that a large number of tries have been expended (about 4,92×10²² in average currently). We call this concept proof-of-work. However, the validation of the work only requires to put the provided block header once through a hash function and then to compare the resulting hash with the difficulty which is trivial to do! In fact, this is the first of a number of validity checks that other network participants do when they receive a new block candidate.