Where does this 2^32 come from?

Several months ago I was doing research into calculating mining revenue for several crypto currencies. When trying to calculate BTC revenue I found this value 1/2^32 which was described somewhere along the lines of the probability of finding or solving a block. I found this on some website talking about the probability of finding a new block I think investopedia.

But how is this 2^32 found and how much does it change over time?

In Bitcoin mining, there are a few related terms:

• The "target" is for a given block candidate the maximum permitted hash value (i.e., if the hash of the block ends up being lower or equal to the target, the block is proof-of-work valid). At the time of writing (block 737759), the target is `862674725460762741916416231468109512880228678412271616` in decimal, or `0x901ba0000000000000000000000000000000000000000` in hex.
• The "maximum target" is the maximum value the target can be. There are various rules that govern what the target is for various blocks. It is updated every 2016 blocks depending on the time it took those blocks to be mined. If that time is more than 2 weeks, the target goes up (making mining easier). If that time is less than 2 weeks, the target goes down (making mining harder). The target cannot change by more than a factor 4 up or down. Lastly, the target can never exceed (216-1)2208, which is `26959535291011309493156476344723991336010898738574164086137773096960` in decimal, or `0xffff0000000000000000000000000000000000000000000000000000` in hex. We don't know precisely how this value was chosen, but it is related to how the target is encoded in blocks. It is an absolute upper bound on the target; if the adjustment rule would take it higher, this value is used instead.
• The "work" for a block is the ratio between 2256 and the target. It corresponds to the expected number of hash attempts a miner needs to make for a candidate block, and is the inverse of the probability that any hash attempt is valid. If the target has its maximum value, its work equals 2256 / ((216-1)2208) = 248 / (216 - 1) ≈ 232 + 216 + 1. When determining which chain to accept among multiple valid candidates, Bitcoin nodes pick the one with the highest accumulated work (sum of all the work values in all its blocks). The current work value (per block) is `134224506433140884946014`.
• The "difficulty" of a block is the ratio between the maximum target and its target. It is a value that's only used for human consumption, and doesn't exist at the protocol level. The difficulty is always at least 1, because of the way it is defined. The current difficulty is approximately `31251101365711.12`.

Armed with all these definitions, it is easy to see that there is a fixed ratio between the work and the difficulty of a block. That ratio is exactly the work of the maximum target, or the work at difficulty 1: 248 / (216 - 1)`4295032833.000015`, which is slightly more than 232 + 216 + 1. In other words, the probability that any hash attempt leads to a valid block is approximately 1 over 232 times the difficulty. Perhaps that is the number you're wondering about.

If so, the answer is simply that this number is a side effect of how the difficulty is defined, and never changes. It has no relation to how mining actually works, because difficulty is purely a human convenience; the actual protocol works with target values.

Other systems can define difficulty however they want, but that would be off topic here.

• Very helpful thank you so much! I may ask questions in the future when I have time to read through it more but it seems you have explained everything very well.
– Joe
May 25, 2022 at 13:43

This is most likely probably tied to the difficulty. If the difficulty level were to be 32, any given hashed block would have a 1/2^32 chance of being a valid block to append to the block chain.

At the time of writing this, the difficulty is 31.25. It is possible that the article you were looking at was rounding. It changes roughly every 2 weeks to account for the varying hash power that the miners around the world are putting towards the problem. If more people are devoting energy towards mining, the blocks come a bit faster than desired, and the algorithm increases the difficulty to slow it down. If lots of people suddenly stop mining, then the blocks come slower, and the algorithm will decrease the difficulty.

All that being said, this is just a guess. If you can post a link to the article with context, it will be easier to figure out if that is truly the particular number you want. There are other numbers out there. For instance, blocks have a 32-bit nonce at the end of them, so a factor of 2^32 could appear there.

• The current difficulty is not 31.25... May 24, 2022 at 19:55
• @PieterWuille This is the site I was using. Or, more accurately, I just put "bitcoin current difficulty" into Google. Did I perhaps misinterpret it? May 24, 2022 at 20:26
• It says 31.25 T; presumably the T stands for tera. The current Bitcoin difficulty is ~31251101365711.12. May 24, 2022 at 20:28
• @PieterWuille Ahh, thank you. Gotta love missing a letter! I guess that would put the difficulty, log base 2, at 44.83. I guess that leaves me with my final comment - a number without scope is hard to explain. It seemed convenient that 31.25 was so close to the number the OP was looking at that I jumped on it. May 24, 2022 at 20:30