How is the probability of winning a block calculated from the difficulty?

4

2

I have problem finding this. The Bitcoin wiki mentions the probability here, but only with a link to the current value on BlockExplorer.

The wiki page on difficulty doesn't mention the formula for the probability either.

Steven Roose

Posted 2013-04-30T00:11:14.883

Reputation: 10 855

What probability are you after? The probability of a hash solving a block (as per Peter's explanation), or a share solving a block? Or the number of blocks you might solve or shares you might submit in a given time period?organofcorti 2013-04-30T01:50:43.577

The probability of a hash solving a block. I don't know how the share system works, isn't that implemented differently for each different pool specification?Steven Roose 2013-04-30T13:47:14.137

Yes, variable difficulty shares means that strictly speaking "shares per block" is meaningless. In this context though most would take "shares per block" to mean "Difficulty 1 shares per block", which have a probability of exactly 1/Difficulty.organofcorti 2013-05-01T05:59:45.637

Answers

7

If the current difficulty is D, then the target hash (the value below which block hashes must go) is:

0x00000000FFFF0000000000000000000000000000000000000000000000000000 / D

(by definition of difficulty, which is a fraction of the maximum target), or otherwise put, the number of valid hashes is:

65535 * 2208 / D

Which means that the ratio of all hashes over valid hashes would be:

2256 / (65535 * 2208 / D) = D * 248 / 65535 = D * 4295032833

Which, at the current (January 2017) difficulty of D = 392963262344.3704 means that one hash in

392963262344.3704 * 4295032833 = 1687790113931869416948

results in a valid block, or each attempt has a chance of

1 / 1687790113931869416948 = 0.000000000000000000059 %

Pieter Wuille

Posted 2013-04-30T00:11:14.883

Reputation: 54 032

I think the third equation is the formula for all possible hashes, not "the fraction of valid hashes to all possible hashes", isn't it? Shouldn't there be a "1/" in front?Steven Roose 2013-04-30T08:23:12.807