2

In terms of 'proof of work' my novice understanding is that miners are tying to come up with a 64-digit hexadecimal number, "hash," that is less than or equal to the target hash.

Can't miners always get lower than the target has by inputting "63 zeros followed by a 1?

Beginner here, I apologize for my simplistic understanding.

4

The hash is a result of computing two rounds of SHA256 on the block header. If you set the hash yourself, when other nodes try to verify the hash by performing the aforementioned computation, it will not (however, there is an infinitesimal chance) result in "63 zeros followed by a 1". I suggest reading about hash functions.

The only reliable way to create a valid hash is to continuously compute the hash on the actual block header, while modifying the contents of the block so that the block is still valid (e.g. nonce, transactions, block version, etc.), but gives you a lot of tries (guesses) until you get an output that is valid. It is basically brute forcing, so having fast, efficient mining hardware is an advantage.

See also: Block Hashing Algorithm

1

As @stewbasic succinctly pointed out in a comment:

The miner does not pick a hash. The miner picks a header, from which the hash is computed.

The block hash is the digest of hashing the block header with SHA-256d. This digest must meet the difficulty requirement when interpreted as a number, and since it's unique is also used as an identifier for the block.

The hash cannot be picked arbitrarily, as that would require you to revert a hash function. This contradicts the pre-image resistance property of cryptographic hash functions which states:

Given a hash h, it is difficult to find a message m that for which h = hash(m).

In fact, the proof-of-work puzzle of trying to find a block which has a specific prefix is essentially requiring miners to solve a much easier sub-problem: finding a partial pre-image.

In conclusion, the only practical way for a miner to pick a block hash is by finding a block header whose digest meets the difficulty statement.

  • Not a programmer here, so I'm trying to understand this on simple terms. Let's use numbers 0-9. Target hash is 6. One miner picks number 2, which is below the target hash, is this sufficient? – jack Aug 29 at 17:50
  • Where does this simple analogy break down? – jack Aug 29 at 17:56
  • 2
    Yes, any number that is smaller than the target hash meets the difficulty. But they cannot just "pick" 2. They have to try many block templates until they find one which happens to hash to 2. :) – Murch Aug 29 at 18:22
  • 2
    @jack to be more explicit, the miner does not pick a hash. The miner picks a header, from which the hash is computed. – stewbasic Aug 30 at 1:14

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.