The block hash has to be below certain difficulty, right? In bitcoin this means, that there are many leading zeroes in hash value, eg. for bitcoin block #402329 hash is 000000000000000006efd706f4467e2d7ed6f0fed757ca7d59e2cc8c81a2d9e3
.
But for the ethereum blockchain the hash of block #1138224 is 0xa4f80a26aecb5fc975e12a9d3d0f6a7907c60b1d7e6b5205dfb4c984dad7f1ba
.
Why are there no leading zeroes?
Best Answer
In the Ethereum blockchain, the difficulty is used to calculate a target.
Here are the ethminer logs for block number 1257006 :
Here is a snippet of Java to compute the difficulty from the target :
And the difficulty is calculated as 24091770185844 which corresponds to the difficulty in the blockchain explorer screen.
We can use ethminer --check-pow <headerHash> <seedHash> <difficulty> <nonce> to check the proof-of-work for validity as follows:
The miner's GPU would iterate through a range of random Nonces. This Nonce, combined with the Seedhash and Header-hash using a hash function need to calculate a number below the Target. If this calculated number is below the target, the miner has successfully mined a block and the block details will be submitted to the Ethereum network nodes.
In the example above, the calculated hash Ethash is larger than the Target and is therefore an incorrectly mined block (which is mentioned in the bug report).
In Bitcoin, the target is the block hash. As difficulty rises, you will see the number of leading zeroes increase.
Block 405390 has 17 leading zeroes. Block 40539 has 8 leading zeroes (mined in 2010).
The Ethereum Target is sort of equivalent to the Bitcoin block hash.