Inside the Bitcoin Mining Bug That Traps Slow Machines

Inside the Bitcoin Mining Bug That Traps Slow Machines

Bitcoin is, at its core, a record of who owns what. To better explain, no one is in charge of it. There is no bank behind it, nor is there a company sitting in the middle to oversee the activities. Instead, thousands of computers around the world, called nodes, each keep their own full copy of the record. Think of a notebook that everyone in a town keeps a copy of. When you pay someone in Bitcoin, you are not necessarily handing over a coin, you are pretty much announcing a new line to the network, something like "this amount now belongs to Ada", and node who hears it checks it against the rules. Was the money really yours to spend? Have you already spent it somewhere else? If the line breaks the rules, they ignore it and do not pass it on. If it passes, they pass it along and keep it ready to be written down. That is the whole point of the design. Everyone who runs a node can verify the record independently. You do not have to trust a bank to tell you what you own, because you can check the record yourself. But there is a problem with having thousands of independent computers maintaining the same record. What happens when two people try to spend the same bitcoin at roughly the same time? Some nodes may hear about the first transaction before the second, while others receive them in the opposite order. Each node can only accept one of the conflicting transactions, but how does the network eventually agree on which one counts? Without a bank to settle the disagreement, who decides which payment is valid? And why should anyone trust the answer? Bitcoin's answer is proof of work. Rather than allowing anyone to decide which transactions make it into the record, the network requires participants to demonstrate that they have performed computational work. Transactions are collected into batches called blocks, which you can think of as pages in our notebook. Roughly every ten minutes, a miner proposes the next page, and other nodes check it against the rules before accepting it. Each new page also refers to the one before it, so the pages form a chain in a fixed order. When two transactions conflict, the network eventually settles on the one included in the accepted chain. The other is rejected. Putting a page together, however, is not free. If anyone could write the next page, they could include whatever transactions they wanted and expect everyone else to copy it. The rules therefore require miners to prove that they have spent real computing effort before their proposed block can be accepted. That proof of work is what mining produces, and the people doing it are called miners. So what does that effort actually look like? A miner takes a candidate block containing pending transactions, adds an extra number to it, and runs the entire thing through a hash function. This number, called a nonce, can be changed repeatedly. Each time the block is hashed, the result is a fixed-length string that looks random. Change even one character of the input and the output changes completely. There is no reliable way to predict which number will produce the result the network needs. The network only accepts a block if its hash, interpreted as a number, falls below a target set by the protocol. The miner has to keep changing the nonce and trying again until it finds a result that meets the requirement. Mining machines do this trillions of times every second. That speed is called the hash rate. It is a bit like rolling dice until a very rare combination turns up. Finding it takes an enormous number of attempts and a lot of luck. Checking the result, on the other hand, takes just one roll. Once a miner finds a valid block, other nodes can verify it independently. The successful miner receives newly created bitcoin as well as the fees from the transactions included in the block. At the time of writing, that reward is 3.125 bitcoin per block. All that computational effort is also what makes rewriting the record so difficult. Anyone attempting to change an old block would have to redo the work for that block and every block that follows it, and do so faster than the rest of the network can keep adding new ones. There is another mechanism that keeps the process predictable. Bitcoin adjusts its mining difficulty every 2,016 blocks, roughly every two weeks, to keep block production close to ten minutes. When more computing power joins the network, the target becomes harder to meet. When computing power falls, it becomes easier. Why almost nobody mines alone Suppose you buy a mining machine and plug it in. You are now racing everyone else who wants to find the next block. Some of these other miners run whole warehouses of machines for the purpose of mining. Ideally, your one machine has a very small chance of winning any given race. It could take years, and nobody can tell you when. Your electricity bill, meanwhile, still arrives every month. That is why miners team up working together and combining hash rates in order to improve their chances to compete for the next block. A group of miners working together is called a pool. Everyone in the pool works on the same block, and if anyone in the group wins the race, the reward is shared out according to how much work each member did. Every pool has an operator who runs it. The operator's server puts together the candidate block, chooses which payments go into it, and hands the same job to every member. Each machine then tries its own range of numbers, so nobody wastes effort repeating someone else's guesses. How the reward gets split is up to the pool. Some pay a fixed amount for each unit of work, whether or not the pool wins the race, so that at the end of the day, the pool carries the luck when it finds a block. Others pay only when a block is found, split by recent work. You will see these called PPS and PPLNS. The details differ, but every scheme needs the same thing, an honest count of how much work each miner did. That count is the hard part. The pool cannot see your machine, you could tell it you are running a hundred of them and it could not check, and it cannot simply trust you, because then anyone could claim a share of the pay without doing any work. All it ever gets is what you send back. If the only thing you ever sent back was a winning block, it would hear from you almost never, and a machine that was switched off would look exactly the same as an honest one that had been unlucky. So the pool needs a better way to measure you. How a pool measures your work The trick is to ask for something smaller than a winning block. Remember that the network only accepts a block if its hash result falls below a very low target. The pool sets a second target of its own, one that is far easier to hit, and tells its miners to send in every guess that gets below it. Those guesses are called shares. A die makes the idea easy to see. Landing a six a hundred times in a row almost never happens. Landing a single six happens frequently. The network asks for the first kind of luck, and the pool asks for the second. Every machine can produce shares over and over, so the pool starts hearing from everyone, constantly. And checking a share is cheap, because the pool only has to hash it once and compare the result with its target. A share cannot be faked. Nobody can steer a hash function, so the only way to produce a result that beats the target is to actually make guesses, the same as when chasing a real block. A pile of shares is honest evidence that real work happened, and once in a very long while, one of those shares also beats the network's target, and that share is the block. Now the pool has something it can count. If one machine sends ten shares a minute and another sends twenty, the second is doing about twice the work and earns about twice as much. Because shares come so often, that steady stream tells the pool two things at once: that you are still alive, and roughly how fast you are going. The pool controls how often you find shares, the settings for this is called the share difficulty. A higher difficulty means a harder chance for shares, because the hash result has to land lower to count, so you find fewer of them. A lower difficulty makes shares easy and plentiful. In the usual convention, a difficulty of 1 takes about 4.3 billion guesses on average, and a difficulty of 1,000 takes about a thousand times that. So to find how many shares a machine sends each second, take its hash rate and divide it by the difficulty times 4.3 billion. Let’s try an example, say a machine running at 100 tera hashes a second, which means 100 trillion guesses every second. At difficulty 1 it would send about 23,000 shares a second, and the pool's server would have to check every one of them. At a difficulty of 100,000 the same machine sends about one share every four seconds, which is far more comfortable. Now take a much smaller machine running at 1 tera hash a second, with that same difficulty of 100,000. It sends a share only about every seven minutes. So the right difficulty is different for every machine, and machines differ in speed by huge margins. It also changes with the moment, because a single machine speeds up and slows down through the day as it heats up, cools down or loses power. No fixed setting suits everyone, or even suits one machine for long. The pool has to pick a difficulty for each miner, and keep picking it. Vardiff, the pool's thermostat Pools handle this with something called variable difficulty, or vardiff. Instead of fixing one difficulty for everyone, the pool changes it for each miner while that miner is connected. It picks a target share rate, say one share every few seconds, and keeps adjusting the miner's difficulty to stay near it. A new miner starts at some initial difficulty, and the pool corrects from there. It works like a thermostat in a house. A thermostat does not know what the weather will do. It reads the temperature, compares it with what you asked for, and turns the heating up or down. The pool does the same with shares. If a miner speeds up and shares start flooding in, the pool raises the difficulty. If a miner slows down and shares thin out, the pool lowers it. Engineers call the code doing this a controller, the miner is the thing being controlled, and the target share rate is the goal. A thermostat has a thermometer, and the pool's equivalent is the shares themselves. That is a problem, because the pool cannot ask the machine how fast it is going. The shares arriving are all it can see, and they are noisy by nature. They come at random, like raindrops on a roof. Even in steady rain the gaps between drops are uneven, so one long gap does not mean the rain has eased. When shares come often, the controller can average over plenty of them and get a clear picture. When they come rarely, it has very little to average, and the picture is blurry. This is the detail that the article is about. There are two ways to build a controller. One wakes up only when a share arrives, looks at how long it has been since the last one, and decides what to do. The research post calls this clockless, and ckpool is one pools that defines its controller this way. The other also has a timer, so it wakes up on a schedule even if nothing arrives. The Stratum v2 reference implementation, SRI, works this way. It sounds like a small difference, but it decides what happens when a miner goes quiet. The day a miner slows down So what happens when a miner goes quiet? Picture a machine in a hot container, running fine all morning. The pool has settled on a difficulty that gives it one share every few seconds. Around noon the heat builds and the machine throttles itself down to a fraction of its speed. Nothing is broken. It is still hashing and still honest, just slower. And this happens all the time. Miners slow down when it gets too hot, when the power supply wobbles, when a fan fails, or when a site is asked to cut its electricity use for the grid. The difficulty, though, was set for the old speed. Shares that used to show up every few seconds now take minutes. Think about what that does to a controller that only wakes when a share arrives. It is woken far less often, and when it does wake it has very little to go on. So it rarely acts, the difficulty stays high, shares stay rare, and the controller stays mostly asleep. Nothing in that loop ever breaks it. A research post on Delving Bitcoin in July 2026 called this stranding a miner, and Bitcoin Optech picked it up in September. A controller with a timer escapes the loop. Because it wakes on a clock, it notices that no shares have come in for a while and lowers the difficulty anyway. A research post, A clockless vardiff strands a slowing miner, tested this in a simulation where hash rate falls to zero over minutes 60 to 64. The SRI design, which has a timer, noticed the silence and kept lowering difficulty. The clockless design did not. It stayed stuck at a difficulty the slowing miner could no longer reach. Why settings cannot rescue it The obvious reaction is to say the controller is badly tuned. Make it react faster, shorten the window it looks at, tighten the thresholds. The Delving Bitcoin post, "A clockless vardiff strands a slowing miner", argues that none of this fixes the problem, because the problem is not in the settings at all. Start with what the controller can actually know. To guess a miner's speed it counts shares over some stretch of time. When shares are plentiful, that count is a good guess. When there are only a few, it is a poor one, the same way two coin flips tell you almost nothing about whether a coin is fair. The post puts a number on it. The error in the estimate, as a fraction of the true speed, grows roughly as one over the square root of the number of shares you expect to see. As the shares dry up, that error has no ceiling, so the controller is not badly tuned. The information it needs is simply not arriving, and the post calls this "a correctness problem, not a tuning problem". The post also separates two kinds of tolerance, because one of them is a trap that is easy to build by accident. A controller can decide that small errors in its measurement are not worth acting on. That is harmless, because the next reading will correct a slightly wrong one. A controller can also have a dead zone in what it does, a range of difficulties it will not move away from. That one is dangerous, because a miner that sits at the wrong difficulty inside it will never be moved out. From this the post draws a simple test for any design. Ask where the controller comes to rest after hashrate drops, meaning the difficulty at which it stops changing anything. There should be exactly one such place, and it should be the correct difficulty. If there is a second one, at a difficulty that is too high, a miner can get stuck on it, and that is what happens in the loop above. The ladder of difficulties Silence is not the only way to get stuck. The second way works even while shares keep arriving, and it comes from how pools choose their difficulty values. Many of them allow only a short list, usually powers of two: 1, 2, 4, 8 and so on. Each value is a rung on a ladder, and the controller can move between rungs but never to a value in between. On its own that is harmless. The trouble starts when it is combined with a weak push. Say the controller only steps down a rung when the measured share rate looks well below the target. A miner that has slowed a little, so that its rate is low but not low enough, sits in the gap between two rungs, and the controller does nothing. The post shows that you need both ingredients to trap a miner this way, the coarse rungs and the weak push. Either one alone does not do it. Eric Price of MARA said on the Optech podcast that plenty of Stratum v1 pools behave like this, and that he traced the habit back to CGMiner. He also said Stratum v2 does not have this power of two quirk. What Optech and the podcast added The idea did not stay on the forum. Bitcoin Optech covered the thread in newsletter 423 on 18 September 2026 and says Price agreed with where it was heading. Four days later, on the 22 September podcast, Price explained vardiff to Mark "Murch" Erhardt in plain terms. Murch asked the obvious question: if a miner is declining, might it "starve before they reach" the lower difficulty? Price called that "the vicious cycle", and added that machines "live longer" when the share rate is pushed higher, which is one reason pools like to keep it up. The guest PortlandHODL, a former MARA engineer, brought up two more cases. One was a startup flood, where a new miner sends a burst of shares before the pool has worked out its difficulty. The other was a proxy that combines several sites with curtailments, where one site stalling gets hidden inside the total. A caution on my own sources. I could not open Optech's own pages, so the newsletter point comes from the podcast coverage and the Delving thread, and I did not read the last stretch of the podcast transcript. Check both against the originals before you publish. What can be done about it? The simplest fix is to give the pool a clock. If the controller wakes on a timer as well as when a share arrives, it notices when a miner has gone quiet and eases the difficulty, and the trap disappears. SRI, the Stratum v2 reference implementation, already works this way. The second fix is for the controller to lean less on the past. Some designs average everything since their last change, so a long healthy stretch makes them slow to notice that a miner has just fallen ill. People in the discussion added their own ideas. Anthony Towns suggested that a proxy, the middleman that sits between a farm of machines and the pool, should halve the difficulty after 30 seconds of silence. The reply was that this only moves the problem, because the proxy then needs a watchful loop of its own, and there are now two controllers that both have to get it right. Eric Price's contribution was to treat easing and raising difficulty differently, and to count the absence of shares as an event in its own right. That last idea sums up all the others. When a miner goes silent, the silence is information. A pool that waits for the next share before acting is waiting for exactly the thing it will not get. Closing thoughts The lesson is simple. A controller that only acts when it hears from the thing it controls goes quiet at exactly the moment the thing goes quiet. Miners that throttle for heat, power cuts or curtailment are the ones at risk, and as more mining sites sell flexibility to the grid, slowing down on purpose is becoming normal. One caution before you take this too far. The evidence in the post is a simulation, a test proxy and a read through the source code, and two of the three designs it tests are small examples built for the test, not copies of pools running today. Nobody has yet surveyed real pools to see how many behave this way, or checked whether real miners have lost money to it. The most useful next step belongs to anyone with access to pool logs.

Original Source

Read the full article at Hackernoon →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.