Reverse Engineering A Bitcoin Miner

If you’re brave enough to have dipped your toes into the Wild West that is cryptocurrency, you probably know that people have long since abandoned trying to mine on their desktop computers. Farms of GPUs are all the rage now, but dedicated mining hardware has also enjoyed a following among those who are serious about their fictitious money. The state-of-the-art for such devices is moving just as rapidly as cryptocurrency itself is, which means older mining gear can now be picked up fairly cheap on the second-hand market. This is an excellent opportunity for those who want to experiment with this type of hardware and potentially utilize it for some other purpose, but first you’ve got to figure out how the thing works.

To that end, [Tomasz Wątorowski] wrote in to the tip line to tell us about the progress he’s made reverse engineering the control protocol for the Antminer S1. As is often the case, the documentation didn’t have all the details he needed, but it did have a schematic of the BM1380 chip at the heart of the device.

Performance of the Antminer S1 controlled via UART

The Antminer S1 contains 64 BM1380 chips on an internal UART bus. With the information from the schematic, [Tomasz] was able to tap into this UART bus with a USB adapter and start listening in on the conversation. He compiled a collection of commands and learned enough to be dangerous (which is always the goal here at Hackaday).

For example, he found that the could set the frequency of the BM1380 as high as he wished without any consideration for thermal overload. This could potentially allow somebody to run  the hardware to the point of destruction, à la Stuxnet.

Once he figured out how to give the hardware hashes to work on over the UART interface, he setup a little head-to-head competition between the software he wrote to command the Antminer S1 and the official control software. No drop in performance was found between his software and the real deal, which sounds like a win in our book.

Even if he can’t improve on the performance of this particular piece of outdated mining hardware, it still beats doing it by hand on a piece of paper.

51 thoughts on “Reverse Engineering A Bitcoin Miner

    1. If your prize is fleeting digital tokens that are bound to be worthless in moments, then no. Because you’ll never get that time back.

      But if you enjoy super volatile worthless hashes of data, be my guess.

      1. I love how Bitcoin value dropped and everyone suddenly is a critic. Especially considering at least half the arguments used against cryptocurrency also apply to fiat currency. It’s both trust and make belief.

        1. Yes, all currencies (including gold) are based on faith and trust, but fiat currency issued by a country with some political, economic and military clout is actually backed up to some extent. Central banks tend to have massive amounts of other countries’ currencies, and also gold, silver etc. Bitcoin has nothing. The faith placed in national fiat currency is faith in the belief that the country will do whatever it takes (right or wrong) to keep its economy going, including selling of national assets if needed. Bitcoin is just a list of numbers on a computer. The only things keeping it going are the demand for a method of keeping criminal money secret, and all the hot air spouted by the tech/hipster going on about blockchain.

          1. > issued by a country

            Correction: Issued by a government. Huge difference! Government is something which always will establish in a human society, as a power distributing the common resource. Would it be US government in the White House, or Dominican gang in favela. The difference isn’t that huge. I don’t believe that government can do effectively what you described. (Could it do anything effectively, at all?)

          2. The past crisis has shown us how vulnerable the system is to different parties manipulating it for their own good. The fact that fiat currencies can be manipulated when the market demands it can be used for good and for bad. The question is whether the parties with this power have interests aligned with yours, and whether they can be considered competent enough to use it wisely. I’m not quite that sure of either.

            Crytocurrencies being used by criminals to hide behind is FUD from the early days. I honestly thought we moved past that a long time ago. Blockchain technology means transactions are traceable and it’s not as if we can pretend that fiat currency isn’t used by criminals on a massive scale. It’s quite likely the value of fiat currency in criminal hands is many times that of all the cryptocurrency combined.

            Mind you, I’m not advocating cryptocurrency. I don’t even own any, not do I think it’s going to solve all the problems that plague our financial system. It just irks me that most people who criticize cryptocurrency don’t seem to have very sound arguments and understanding of how fiat currency actually works. It’s a lot of emotion, mixed with a fair bit of fear and a few facts taken out of context. Anyone saying Bitcoins are just numbers on a computer is seriously misunderstanding the nature of the fiat banking system and how that creates money from thin air. That too is a rug that could get pulled out from under us at any time, and it recently nearly happened too.

        2. Bitcoin is fundamentally flawed and many have always said the same. Some of those did mining anyway not because they thought of the scheme as something useful but because it was easy “money”.

          IMO the problems that doesn’t apply to fiat money are the ones that kills the use as a currency but even shared weaknesses are a problem for bitcoin. It’s truly based on nothing, it’s built as a pyramid scheme and have no use in itself, it is not protected against manipulation etc.

          And it’s not even anonymous. The only advantage is that of being distributed.

      2. If you believe that bitcoin is extremely overvalued, you may or may not be right.
        If you don’t believe that bitcoin (or cryptocurrencies in general) is the best currency that has ever been created and used, you may or may not be a complete idiot, you just don’t know what bitcoin is.

        1. ‘ currency that has ever been created and used…’? Can you expand on that?, because I genuinely would like to be convinced. It has no backing whatsoever. If the price falls to zero, who cares? If a fiat currency falls to zero, its generally a turd sandwich politically, so people try to avoid this. And bitcoin also needs an electrical output equivalent to a small country to sustain all the calculations (which will probably increase year on year as the list of numbers gets longer and longer).

  1. I’m really interested in what people will be able to do with mining hardware once the bubble collapses. There’s gonna be an awful lot of high-power ASICs going for dirt-cheap prices.

    1. That’s already happened many times over. Each new generation obsoletes a previous one by increasing complexity and efficiency. I think the consensus is that hardware is now at generation 9, but it’s a fair few either way.

      And yes, it’s basically junk at that point.

    2. If the “bubble” burst and assuming that means the interest in mining were to wain and lots of folks stopped mining then the remaining miners would end up winning more blocks and make more tokens.

    3. Many ASIC miners are underwater without super cheap or free electricity. Bitmain tried just this past week to dump a bunch of old S7 miners renamed. They will likely never make more value than they waste electricity even in China. If BTC drops much more even the S9 will be hardly profitable.

  2. “If you’re brave enough to have dipped your toes into the Wild West that is cryptocurrency, you probably know that people have long since abandoned trying to mine on their desktop computers.”

    Only if you only bothered to dip your toes in it, and only think bitcoin exists. Most cryptocurrencies are pretty much exclusively mined on desktop computers, and all but bitcoin is profitable to mine in desktops.

        1. Most recent cryptocurrencies focus memory usage else than raw computing power, so we get limited to memory speeds, and memory costs. GPUs end up being cheaper and more effective than ASICs there.

          1. So, in other words, once the price of RAM falls… Which it always has.

            Hype, scams, and drugs, are the three main uses for Bitcoin. Hype and scams are traditional in the finance industry (so’s drugs). So currently there’s demand from all of that. Old scams are finding new homes with the cyber-rubes of the 21st Century.

            Once the bubble pops, who knows? Currently Bitcoin has the inertia, even if it’s not the best design for whatever parameters one might like. It’s probably worth a few grand right now for anybody to make up their own crypto currency, mine a few, and persuade some sucker to swap you some Bitcoins for it. Sell them off, then find some new meme to invent a currency after, why not? I hear misogyny’s quite popular in the nerd world these days, maybe Bitchcoin will buy me a new house?

          2. Even if the price of ram falls, ASIC cannot supplant GPU. ASIC is too fast for desktop memory; the memory would be the bottleneck. Could you manufacture faster memory? Sure, just like the L1 cache in CPUs, but then it’s going to cost ridiculous gobs of money and then you may as well spend that money on more GPU miners.

        2. Most of the newer coins are designed to use resources that are hard to provide in ASIC (usually lots of memory), and some of them are designed to fit in CPU but not GPU (though that’s been a losing battle, but at least they’re ASIC-proof.)
          One big weakness of blockchain systems is that if somebody can corner enough of the hashing power, they can outvote everybody else and basically steal all the coin that’s being mined. CPU-only systems encourage wide distribution of mining activity, because anybody can do it; ASIC systems encourage concentration of mining among people who have the capital to buy the latest miners (which let them make more money faster, and spend it on the next generation of ASICs, etc., while also using less electricity per hash), and which also radically decrease the ability of anybody who’s not using ASICs to make money mining. GPUs are in between (and some “CPU-only” systems have turned out to be mineable on GPUs even though they weren’t intended to, because there are some good GPU hackers out there.)

  3. I wonder if it would be profitable for someone in an area that gets a lot of sun to hook up some of these to a bank of solar panels and mine bitcoin using solar power. Or would it take too long for the miners (even in a really sunny place) to mine enough coin to offset the costs of the solar install?

    1. One of these has around 4$ revenue in Bitcoin per month. Even if you could get the device for free, you cannot make any profit when electricity is not free. So no. Solar Power is not an option.

      1. an (antminer) S9 (14TH/s) will make about $950 in USD (0.1 BTC) a month at the current exchange rate (8450USD/BTC) and difficulty, while constantly sucking up about 1400 Watt. A little while ago, in december this was $1600 / month. Even with the crazy electricity prices here in Belgium (~0.30EUR/kWh) it is still profitable to run them, albeit you will probably barely break even with the cost of the hardware. To be profitable on solar you’d have to scale up massively, which would require quite the investment.

    2. Solar power doesn’t magically make things free. If you’ve got the panels, rig them up to your house instead and save on buying electricity. Or cut down how much you use, and don’t use the rest for coin mining.

      As long as there’s other uses for electricity, and solar panels aren’t free, solar power isn’t free. It’s still not cheaper than, say, coal or gas. If you have abundant solar electricity, sell it to people for their fridges and TVs, don’t waste it on a money-generating machine that produces less cash than it costs to run.

      1. I have a solar powered mining setup but it mines altcoins, not Bitcoin. I managed to break even on the cost of the setup in about a month when the difficulty is low, but now it would take over 5 months to break even assuming the difficulty does not rise further as it probably will.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.