A miner hashes all the transactions in a block according to a scheme (merkle tree) to produce a hash that summarizes the entire block: the merkle root.

Then the miner tries to find a number (the nonce) that, when hashed together with the merkle root, produces a hash that is lower than the target.

The word “number” can be confusing here, because both the nonce and the hash and the target are numbers.

The miner is trying out nonces, one after the other. Every nonce is concatenated with the merkle root and the result is hashed, and that new hash is compared to the difficulty target. The miner keeps repeating this process until they find a nonce that produces a hash that is lower than the target.

The length of a hash refers to the number of characters in the hash. It is a matter of notation, not a matter of value. Leading zeros add to the length of a hash, but not to the value.

eg The number 1 can be written as 1 or as 0001. Different length, same value. Conversely, 1000 and 0001 have the same length, but a different value.

That’s because secure hashing algorithms are designed to make it impossible to guess the input from looking at the output. That property is why they can be used in proof of work. An algorithm that produces a low hash when it is given a low nonce and a high hash when it is given a high nonce, would be useless, because then you could use reasoning and deduction to quickly find a suitable nonce. That would defeat the purpose. The purpose of proof of work is not to find a nonce, it is to spend a lot of time and energy trying to find a nonce. And that requires a hashing algorithm that produces an unpredictable output.

The “work” in proof of work is not merely calculating a hash, because calculating a hash is not that hard. The “work” is having to hash over and over and over again, every time with a different nonce, until you find a nonce that produces a hash that is lower than the target.

So why can’t miners just input a low nonce to produce a low hash? Because the hashing algorithm was designed to make that impossible. As a result, the only way to find a suitable nonce it to brute force your way to it, just trying nonce after nonce after nonce until you find a suitable nonce. The purpose of this is that anyone who tries to falsify the ledger will have to go through all this work again, and will most likely not have the time and resources to do so.

@Mauro, i’m still learning, i hope everything i said here was correct?