The weird nonce pattern

The weird nonce pattern

So, yesterday I noticed this twitter post and it really caught my attention. At first, I was thinking that it's fake, there's no way that there are gaps with nonces. It would mean that sha256 is broken or there are some ranges that are less likely to produce desired outcome so miners can cheat. Of course that it wasn't the case, but still graph supposed to be the same as it is for blocks 100K – 400K. It must be fake I said to myself…

X = block number, Y = nonce

I left it as "fake", but I couldn't leave it alone. So I made a csv with block number/nonce pairs for blocks 400K – 500K and graphed it myself. Surprisingly I got the same results!!!

X = block number, Y = nonce

X = block number, Y = nonce

What does this mean many would ask. What I'm looking at? Well, when you mine a block, you do a (double) sha256 of a block and check how many leading zeroes resulting hash have. If enough, you have mined a block, if not you try with other nonce. So nonce is 32 bit integer and its output is not predictable. Graph should be like in blocks 100K – 400K and nonce should be truly random. There can be multiple nonces for a block to be valid, but first one found is the one used in new block. So, since block 400K there are 4 nonce ranges that did not produce a blocks (as often as others) for some reason. It goes beyond my knowledge of how ASICs are working but it's obvious that for some reason those 4 ranges are not really often.

Real question for me was "why those gaps exist"? How is it possible? My first assumption was that it have something to do with ASIC bug. It all started happening at similar time as S7 went out and about 4 months before S9 was announced. I was under (false) assumption that those gaps can be abused. It was because I didn't know how mining pools are working. I assumed that all miners have the same coinbase and are looking for the same nonce (but it was false). Anyway, that part isn't important for now. I asked myself who is actually mining blocks inside those gapped ranges? Guy who first made that chart posted latest 86 blocks mined inside gaps. It turned out that about 25% of those blocks are mined by "unknown" mining pool

This was interesting. How is it possible that unknown pool have that big percentage, something must be wrong. I've told myself that if something is fishy, it will be more obvious at start. So I went back to block 400K-500K, grabed all blocks mined inside first gap (approximately nonce between 975,000,000 and 1,025,000,000) and there were 445 blocks mined with nonce in that range. Here's who mined those

I haven't found a single unknown pool. I guess at that time people didn't know about the gaps and didn't force those nonces. I expected a lot of unknown miners here. I guess that I will have to check blocks 500K+ when people figured out those gaps and started enforcing them? So, I've checked blocks 500K – 557,243 and situation is similar. Those 4 gaps are still there and highly visible on graphs. I've checked who mined with nonces inside first gap (975,000,000 and 1,025,000,000) and those results are not like results from block 400K-500K:

Hm this was interesting. Biggest miner inside this gap is unknown? How so? OK, lets check second gap (nonce between 2,075,000,000 and 2,125,000,000) and results are similar (here are some example block height numbers for people curious to check "unknowns" 555305, 554725, 554646, 554372, 552924, 552254, 551046, 550839, 549309, 547503):

Results were interesting but my luck of mining pools knowledge and how asics work prevented me to make any conclusions. I had only two questions and no answers:

1) How is it possible that those 4 gaps exist? I did notice that 32bit area is divided into 4 8bit ones and that nonces from the top of those areas are gapped. How/why?

2) How is it possible that there wasn't a single unknown mining pool mined blocks inside gaped ranges from block 400K to 500K and that from block 500K unknown pools are the biggest ones inside those gapped ranges? Who are those "unknown" pools? Are they somehow abusing the knowledge og those gapped areas?

I didn't really had answers to my questions so I went to sleep really bothered with those…

When I woke up this morning I got really curious, so I did some reasearch and reading to figure out answers to those open questions. First of all, I corrected myself:

– My understanding of how pool is working was wrong. So, first generation pool protocol (getwork) was distributing nonce ranges but it wasn't fast enough for larger miners – they went through their jobs too fast. So slush pool invented extranonce protocol where every miner uses its own private extranonce field which is a part of coinbase tx, and iterates through the nonce.

– What does this mean, it mean basically that each pool member have different coinbase (different extranonce) and is iterating through it's own 32bit space (each pool member reproduce different hash for the same block, like mining on it's own).

– You would ask why would you be a part of the pool if you have your own coinbase, why not mining solo? Answer is that you will actually get reward for each block you participate in instead doing it solo and waiting for a grand prize. Yes, you can be lucky and you can get grand prize, but mathematically you will earn more through pool. In other words mostly pools are not for speeding up mining but to transform lottery (xx btc once in a rare while) to job (y% of xx btc many times a day). Second reason is that pools are speeding things up a bit because they have a very effective block propagation network between them, that leads to less orphane blocks.

– Being able to understand how pools are working those days, opened 3rd question for me. Why not going back to original plan, where all pool members have the same coinbase and work on the same puzzle but in different ranges. I will try to answer that question after I try to answer first two that we opened last night.

So, first question, why those 4 gaps exists on the top of 4 8bit spaces?

– I'm fairly confident that it's a bug in bitmain asic equipment. It may be some sort of low level hardware optimisation or some sort of off by one error. I don't have concrete answer but it's 100% bitmain specific issue. It exist in various hardware generations of theirs. If it wasn't bitmain issue (optimisation?) it wouldn't be that obvious on those graphs (they have giant market share so all their bugs will be visible).

– If it's really a bitmain bug, will that give me some advantage if I try nonces in those gapped regions first? No, not really. Considering that each miner is on it's own and trying to find a needle in a haystack, you have no advantage by checking first that gapped space. Correct nonce is truly random and can be anywhere. If pools are working like they were at the start, it would be advantage, but how pools are working right now (each miner have it's own extranonce) it's not advantage.

Second question, why I couldn't find a single "unknown" pool in 400K-500K block range that mined inside gapped regions and recently those are majority in those gapped region?

– Well answer to that question is correlated to first answer. As we all know, at 400K-500K blocks bitmain was really dominant in the industry. They had a giant market share. There were other manufacturers but their share was really really small. Those "other" manufacturers were represented in major pools, so they successfully mined some blocks and within those gapped ranges where bitmain had/have a bug. Considering how small share those "other" manufacturers have, gaps are highly visible on the graphs.

– You will say that still doesn't answer the "unknown" pool that raised recently and is highly visible in those gapped regions where bitmain doesn't have presence. That's true, my best guess for now is that there's a new hardware manufacturer that's still in stealth/research phase and have it's own pool and it's own hardware. I believe that they still don't wanna announce their existence and are secretly mining before they start sending new hardware to customers. It would explain all those unknowns highly visible in bitmain gapped range, but not really visible overall, because it's still a small market share. Just to be clear, it can also be bitmain's new hardware with fixed bug that they are testing, not really some new player, but honestly have no idea and it's impossible to know.

I made up a third question, would it be a good idea to create a new pool software and go back to old days where all pool participants were mining with the same coinbase?

– Short answer is "no". First I don't think it's possible. I didn't really do my due diligence here but I think asics don't support the legacy protocol so we would have to redesign all of them or somehow implement new protocol that would work on existing legacy hardware. It's probably impossible.

– Even if we success to make a protocol that would work with legacy hardware, mathematically it wouldn't be faster. Space is too spread and hard/time consuming to go through whole area that would still make mining more or less a lottery. So no, it's not worth a trouble. Not to mention that you will need really fast interconnection with all the pools, you need to have high redundancy, take care of all the things and be really really fast to be able to check all results that miners give back to you and give them new work.

One last thing here. You would say that if "unknown" miners are leading ones inside gapped (non bitmain) nonce ranges, they would be highly visible on overall graphs? Well true, I've been thinking the same. It never catched my eye how big percentage "other" aka "unknown" pool have. I checked today manually and from last 100 blocks, 11 were from "unknown" mining pool. Last 24h graph showed 11,1% and last 7 days 6.9% of mined blocks were by "unknown" mining pool. It's a bit lower right now, but here's the graph

Unknown mining pool

PS. Apologises for my bad English

PSS. My mining pools / ASIC knowledge is limited, if I made some mistakes or false assumptions please correct me.

PSSS. I intentionally ignored weird nonce behaviour in first 100K blocks, that's a separate (and old) story.

TL;DR: Those nonce gaps are _probably_ due bitmain bug. There's no way to (ab)use those gaps and gain advantage over other miners. Unknown mining pool is probably some new hardware that's still in stealth/research phase (aka lets (ab)use it before we send to first customers). No, it will not make mining faster if all the pool members share the same coinbase.

submitted by /u/NekoNormalan
[link] [comments]

Bitcoin – The Currency of the Internet