I would like to get your opinion on the following reasoning to define the number of tries needed to find the solution to a PoW problem at 95%.
Consider a function SHA(256), the probability that this function contains just one zero is (1/16). Since the latter must be at the hash goal, the probability that it is at the very beginning is 1/64.
In conclusion the probability that function SHA(256) returns a hash containing a zero at the very beginning is (1/64*16)=1/1024
If the PoW difficulty requires C zero consequential the probability becomes (1/1024)^c
Do you think it is correct ?
Nope! Your assumption about Block Hash is wrong. Let me give you a detailed view on how it is really calculated:
Your current assumption is this (correct me if I am wrong): In order to block the mine, miner needs to find a hash having 'n' number of preceding zeros. Since the probability of finding a hash starting with '0' is 1 in 1024, the probability to find a block having 'n' preceding zeroes is 1 in (1/1024)
n, right?
However, this is not how block hash is found by the miners. Finding block hash is nothing but finding a value which is less than the target value. Target value is adjusted after every 2,016 blocks. Current difficulty is:
0x000000000000000000109bac0000000000000000000000000000000000000000 (hexadecimal form)
or
1590739304116800001454600275103718494518067345886281728 (decimal/integer number)
Now in order to find the block hash, you need to find an integer value less than the above number. But this is not very simple because you need to include 6 values in your computation:
> Version
> Hash of previous block
> Merkle Root
> Time of mining
> Bits (difficulty/current target in compact form)
> Nonce (an incrementing number)
Now let's take an example, say Block:
644,731For block 644,731, we have:
Version = 20400000 (hexadecimal)
Hash of Previous Block = 000000000000000000083d157a8a2a589a74fc2f7b91245cb3a415c23d7cc79a
Merkle Root = 9453cfc708a1cc84f3f36c2bae68202b03ad2866bb02da511d7e603a4e9d1fd1
Time = 16:42:15 as per GMT
Bits = 386,964,396 (decimal)
Nonce = 2035916310 (decimal)
Converting everything in hexadecimal form (little-endian), we will have following value,
(version+previousHash+merkleRoot+Time+Bits+Nonce):
0x000040209ac77c3dc215a4b35c24917b2ffc749a582a8a7a153d08000000000000000000d11f9
d4e3a607e1d51da02bb6628ad032b2068ae2b6cf3f384cca108c7cf539467f93f5fac9b1017169e
5979
The final step involves performing SHA-256 hashing twice on the above value and the result will be:
811802676f41d6aff67ad767517c466c4c8d3b87c81009000000000000000000
Converting it in little-endian, we have:
0000000000000000000910c8873b8d4c6c467c5167d77af6afd6416f67021881 which will become block hash of the block.
Now you can compare,
Target Value = 0x000000000000000000109bac0000000000000000000000000000000000000000 or 1590739304116800001454600275103718494518067345886281728
Block Hash (644,731) = 0000000000000000000910c8873b8d4c6c467c5167d77af6afd6416f67021881 or 868308124812842907393685749016650546999869456114653313
Since 868308124812842907393685749016650546999869456114653313 is smaller than 1590739304116800001454600275103718494518067345886281728, it is accepted block hash.