# Using PRNG to get better mining results

When miners have a block to mine, this is comparable to finding an effectively (impossible to guess) random number in a set from 0 to n. From what I once read, since the number is random, it makes no sense to start searching from the middle of the set, or from the end - every place we choose is equally good. So we start searching the set sequentially, we check the number 1,2,3,... and so on. Because the solution can be a number 1 as well as n.

But it looks like from game theory point of view, another strategy should be more profitable. If everyone starts searching the set simultaneously in the order of numbers/blocks, and the solution sometimes ends up at the end of the set, then when we, as the only ones, search from the end - we will gain a significant advantage. Each time the solution is in the end of the set, we would be the first to find a solution, because all the rest will search from the beginning of the set.

But, if that were true, it would quickly become reality that half of the miners searched the set from one edge and half from the other - and finally we do not gain an advantage (because other miners also want to earn as much as possible). Then we can gain an advantage by attacking the middle of the set, with some frequency.

Finally, is there any strategy for searching a set of solutions that will give us the maximum benefit, or at least won't put us in a worse position? It seems to me that blocks should be searched, by generating them completely randomly. Not because block 12345 is more likely than block 1, but because we have competition in mining blocks, and if everyone started their search from the beginning of the set, it would be easy to gain an advantage here. If everyone were to use a pseudo-random number generator to select blocks, it would be impossible to come up with a strategy that would benefit anyone.

So question is - do miners always search the space of blocks in the same order? Am I right that a miner who selects blocks at random will have an advantage over those who do it according to the "one by one" scheme? Or maybe a random block search in proof of work already takes place? Does the speed of PRNGs used matter in the mining process?

So question is - do miners always search the space of blocks in the same order?

This is your misunderstanding. No two miners search the same space at all, ever. Since the block candidates miners work on include a payout to themselves, and that payout address is different for every miner, they are all searching independent parts of the block space.

If this weren't the case, the fastest miner would always win. This isn't the case: on average, mining profitability is roughly proportional to hashrate, even at fairly low hashrates. And this is independent of the order they choose to search in.

Am I right that a miner who selects blocks at random will have an advantage over those who do it according to the "one by one" scheme?

It makes no difference.

• Exactly, I felt that I did not understand something here. You're right that if this weren't the case (all of them searching independent parts of the block space), the fastest miner would always win, and yet this is not true, we see that. So now it is clear that it makes no difference how they are searching, because every block has an equal chance of being an answear.
– Tom
Commented Apr 6, 2022 at 23:58
• This is true for solo miners, but in a mining pool the payout address might be the same for many miners. Can you clarify what prevents the fastest miner to win every time in this case? Commented Apr 7, 2022 at 11:20
• @VojtěchStrnad judging by the fact that pool mining is not incredibly inefficient, I assume that pools do something similar - perhaps every participant puts their own payout address first. Note that even most parts of the block space have no valid blocks at all - every miner has to generate a stream of "block space parts" to check Commented Apr 7, 2022 at 11:46
• @VojtěchStrnad In a pool, the pool just assigns different ranges to different workers. No two miners ever try the same hash, ever - anything else would just be grossly wasteful. Commented Apr 7, 2022 at 13:53
• @user253751: the coinbase transaction contains, in addition to the 'payout', a dummy input which is used for data that extends the nonce, called extranonce. At current difficulty, even a solo miner must try millions of extranonces to find a winning block; pool members are given different ranges of extranonce to try. See bitcoin.stackexchange.com/questions/37279/… and bitcoin.stackexchange.com/questions/41989/… . Commented Apr 8, 2022 at 7:22