@mod: Since this topic is very off-topic and for reasons of clarity and sense would be better in the technical part of our forum, I hereby ask a moderator to move the last 9 posts starting from
post #46 into the subforum
Development & Technical Discussion. You could the thread title "probability / chance of hitting a block" or anything else you might find useful for it. Thanks a bunch in advance.
Hi @mikeywith and sorry for late reply. I took time today to look at this question and better understand the connections. Thank you for your detailed explanation, which helped me a lot to understand. For a better understanding I wrote a Python program in parallel to be able to implement and compare what I learned right away. Please correct me if I made any incorrect statements or thoughts about this below.
First things first.
Wikipedia says:
Probability is the branch of mathematics concerning numerical descriptions of how likely an event is to occur, or how likely it is that a proposition is true. The probability of an event is a number between 0 and 1, where, roughly speaking, 0 indicates impossibility of the event and 1 indicates certainty. The higher the probability of an event, the more likely it is that the event will occur. A simple example is the tossing of a fair (unbiased) coin. Since the coin is fair, the two outcomes ("heads" and "tails") are both equally probable; the probability of "heads" equals the probability of "tails"; and since no other outcomes are possible, the probability of either "heads" or "tails" is 1/2 (which could also be written as 0.5 or 50%).
For the sake of simplicity lets not considering the competition from other miners. In that case, if only you participate in the Bitcoin mining network as a solo miner and the difficulty remains static,
then the
probability of finding a block is equal to 1 since you provide the entire hashrate of the network. It's certain that we will hit the block. The only thing we need to know is the expected average time to hit the block. To calculate the expected time until we find a block, we can calculate the average number of hashes needed to find a block. The average number of hashes needed to find a block can be calculated by multiplying the difficulty of the network by 2^32.
So the average number of hashes needed to find a block is:
<current difficulty> * 2^32 = 37,590,453,655,497.09 * 2^32 = 161,449,769,092,163,668,279,296
To calculate the expected time until you hit the block we divide the average number of hashes/sec needed to find a block by the hashrate of the solo miner. Let's take for example the Bitmain Antminer S19 XP @ 140 TH/sec or 140,000,000,000,000 hashes/sec. Thus:
average number of hashes per second / hash rate of the miner = time in seconds needed to find a block.
161,449,769,092,163,668,279,296 / 140,000,000,000,000 = seconds
hashrate_value = 140,000,000,000,000
diff = 37590453655497.09
expected_blockhit_time_in_hours = (diff * 2**32) / hashrate_value / 3600
=
36.57 yearsNote, however, that this is an average time and it may take longer or shorter to find the block. The scenario explained so far can be compared to VanitySearch for a better understanding, where you try to search for a matching hit with your GPU. You are the only searcher and it is certain that you will land the hit in the future even if it would take light years in the case of very complex calculations. But also here, like VanitySearch, you can give an expected time at which you will find what you are looking for. The probability to find a match is 1.
I want to know the probability of a given hash rate to hit a block within the time frame of 10 minutes. Following formula only takes into account the miner's hash rate and the current network difficulty. It assumes that the miner is the only one mining on the network and that the network difficulty remains constant.
P = (hash rate of solo miner) * 600 / (difficulty * 2^32)
- 2^32 is used because Bitcoin uses double SHA-256 and thus there are 2^32 possible solutions per each block. A better explanation can be found
HERETwo examples:hash rate: 140 TH/s will result in probability of 0.0000005203 (decimal value) or expressed as a percentage value = 0.00005203 %
hash rate: 50 PH/s will result in probability of 0.0001858163 (decimal value) or expressed as a percentage value = 0.01858163 %
- this probability so far only applies to a single block for the given time frame of 10 min and not a continuous mining period
- the total network hash rate is not used directly in the calculation, but it is used indirectly through the current network difficulty we retrieved
I fully agree to:
[chance with 50 PH/s for 3h] = [chance with 25 PH/s for 6h] = [chance with 5 PH/s for 30h]
Now let's take all the other miners into consideration, so we are competing against them. I guess that @akaki meant that after a block discovery the cards are reshuffled and it has no meaning what had taken place in the past. From the time of each new block the point of view starts again from zero.
I still fully agree to akaki's statement which sounds correct to me. An essential characteristic of that is memoryless, the intervals between any two events are independent of, and statistically identical to, each other.
However, you say that you can calculate the probability of finding a block within 1 day (=24 hours) by multiplying the result we got before (probability per 10-min = 0.0000005203) by the number of 10-minute intervals in a day (=144). So you say 0.0000005203 * 144 = 0.0000749232 (decimal value) which represents the probability of hitting a block with 140 TH/s within one day. The probability is 144 times higher and if you extend this to a whole week or month the probability raises accordingly. If I understood correctly from what you said, the reason for this is that if the network difficulty remains constant the probability of finding a block within a certain time frame is directly proportional to the number of 10-minute intervals in that time frame. This is because the probability of finding a block is determined by the miner's hash rate, the current network difficulty, and the number of possible solutions for each block (2^32) which remains constant.
But this approach does not take into account the fact that once a block is found, everything is reset and you start from scratch. This is exactly what akaki says and wanted to point out and in my opinion is also correct. Other important points that should not be ignored are: the Difficulty changes every 2016 blocks and is therefore variable. You cannot simply use the previously calculated probability per block as a basis and multiply it by a time span x, that would not be correct in this context.
Another point worth considering in this context would be the difference between probability and chance. There is a lot of information about this on the Internet, e.g.
HERE. These two terms are often used mixed.
Finally, since you are competing against other miners in the real case, you can determine the probability of a block hit within a block period for the solo miner quite simply as follows. When mining Bitcoin, the miner performs a double SHA-256 hash of the block header, and the miner's goal is to find a value that is less than the target. The target is a 256-bit number that is dynamically adjusted by the protocol every 2016 blocks (about two weeks) to ensure that the average time to find a block is 10 minutes. The target is inversely proportional to the difficulty, so the lower the difficulty, the higher the target, and vice versa. The difficulty is a measure of how difficult it is to find a block relative to the easiest it can ever be. The hashrate is measured in hashes per second. The probability of adding a block as a solo miner are determined by the number of hashes the miner's rig is computing per second in relation to the total number of hashes that all of the machines on the network are computing each second. The probability of finding a block for a solo miner is determined by the miner's hashrate relative to the total network hashrate and the difficulty of the network so a miner with a higher hashrate can perform more hashes per second and thus have a higher probability of finding a block.
Here is some output from the Python program I wrote during this excursion. The part with
brown color is not correct in my opinion but I have included it in the output for comparison reasons.
Current Bitcoin network difficulty is: 37,590,453,655,497.09
Current overall hashrate of the Bitcoin network is: 288,814,703,183,075,200,000 hashes/sec
==============================================================================================================
Enter the hashrate/sec of your solo miner: 140TH
Entered hash rate of 140.0 TH/sec equals to: 140,000,000,000,000 hashes/sec
The ratio of your solo mining hash rate to the total network hash rate is: 0.000048 %
and expresses the probability of hitting the next block.
==============================================================================================================
Probability per 10min: 0.000000520 (0.000052029 %) or 1 in 1,922,021
==============================================================================================================
Probability per hour: 0.000003122 (0.00 %) or 1 in 320,337
Probability per day: 0.000074921 (0.01 %) or 1 in 13,347
Probability per week: 0.000524448 (0.05 %) or 1 in 1,907
Probability per month: 0.002247634 (0.22 %) or 1 in 445
Probability per half-year: 0.013673107 (1.37 %) or 1 in 73
Probability per year: 0.027346214 (2.73 %) or 1 in 37
==============================================================================================================
Expected average time to hit a block: 320,336.8 h = 13,347.4 days = 1,906.8 weeks = 439.3 months = 36.6 years
==============================================================================================================
In words: The chance of mining a block with the given hashrate within a 10min period is similar to
the probability of picking a red winning ball from a jar containing 1,922,021 white balls.
The chance of mining a block with the given hashrate is similar to trying to find a needle in a haystack.
Current Bitcoin network difficulty is: 37,590,453,655,497.09
Current overall hashrate of the Bitcoin network is: 288,814,703,183,075,200,000 hashes/sec
==============================================================================================================
Enter the hashrate/sec of your solo miner: 5p
Entered hash rate of 5.0 PH/sec equals to: 5,000,000,000,000,000 hashes/sec
The ratio of your solo mining hash rate to the total network hash rate is: 0.0017 %
and expresses the probability of hitting the next block.
==============================================================================================================
Probability per 10min: 0.0000186 (0.0018582 %) or 1 in 53,817
==============================================================================================================
Probability per hour: 0.0001115 (0.01 %) or 1 in 8,969
Probability per day: 0.0026758 (0.27 %) or 1 in 374
Probability per week: 0.0187303 (1.87 %) or 1 in 53
Probability per month: 0.0802726 (8.03 %) or 1 in 12
Probability per half-year: 0.4883253 (48.83 %) or 1 in 2
Probability per year: 0.9766505 (97.67 %) or 1 in 1
==============================================================================================================
Expected average time to hit a block: 8,969.4 h = 373.7 days = 53.4 weeks = 12.3 months = 1.0 years
==============================================================================================================
In words: The chance of mining a block with the given hashrate within a 10min period is similar to
the probability of picking a red winning ball from a jar containing 53,817 white balls.
The chance of mining a block with the given hashrate is similar to trying to find a needle in a haystack.
Current Bitcoin network difficulty is: 37,590,453,655,497.09
Current overall hashrate of the Bitcoin network is: 288,814,703,183,075,200,000 hashes/sec
==============================================================================================================
Enter the hashrate/sec of your solo miner: 50phs
Entered hash rate of 50.0 PH/sec equals to: 50,000,000,000,000,000 hashes/sec
The ratio of your solo mining hash rate to the total network hash rate is: 0.017 %
and expresses the probability of hitting the next block.
==============================================================================================================
Probability per 10min: 0.000 (0.019 %) or 1 in 5,382
==============================================================================================================
Probability per hour: 0.001 (0.11 %) or 1 in 897
Probability per day: 0.027 (2.68 %) or 1 in 37
Probability per week: 0.187 (18.73 %) or 1 in 5
Probability per month: 0.803 (80.27 %) or 1 in 1
Probability per half-year: 4.883 (488.33 %) or 1 in 0
Probability per year: 9.767 (976.65 %) or 1 in 0
==============================================================================================================
Expected average time to hit a block: 896.9 h = 37.4 days = 5.3 weeks = 1.2 months = 0.1 years
==============================================================================================================
In words: The chance of mining a block with the given hashrate within a 10min period is similar to
the probability of picking a red winning ball from a jar containing 5,382 white balls.
The chance of mining a block with the given hashrate is similar to winning a lottery with a few
hundred participants.
Current Bitcoin network difficulty is: 37,590,453,655,497.09
Current overall hashrate of the Bitcoin network is: 288,814,703,183,075,200,000 hashes/sec
==============================================================================================================
Enter the hashrate/sec of your solo miner: 150EH/s
Entered hash rate of 150.0 EH/sec equals to: 150,000,000,000,000,000,000 hashes/sec
The ratio of your solo mining hash rate to the total network hash rate is: 52 %
and expresses the probability of hitting the next block.
Probability of mining a block:
==============================================================================================================
Probability per 10min: 0.557 (55.745 %) or 1 in 2
==============================================================================================================
Probability per hour: 3.345 (334.47 %) or 1 in 0
Probability per day: 80.273 (8,027.26 %) or 1 in 0
Probability per week: 561.909 (56,190.85 %) or 1 in 0
Probability per month: 2,408.179 (240,817.94 %) or 1 in 0
Probability per half-year: 14,649.758 (1,464,975.77 %) or 1 in 0
Probability per year: 29,299.515 (2,929,951.54 %) or 1 in 0
==============================================================================================================
Expected average time to hit a block: 0.3 h = 0.0 days = 0.0 weeks = 0.0 months = 0.0 years
==============================================================================================================
In words: The chance of mining a block with the given hashrate within a 10min period is similar to
the probability of picking a red winning ball from a jar containing 2 white balls.
The chance of mining a block with the given hashrate is ... damn good!