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.

The 348,296th Article About Cryptocurrency

The public has latched onto the recent market events with an intense curiosity brought about by a greed for instant riches. In the last year alone, the value of Bitcoin has risen by 1,731%. We’re talking gold rush V2.0, baby. Money talks, and with a resounding $615 billion held up in cryptocurrencies, it is clear why this is assuredly not the first cryptocurrency article you have read — maybe even today. An unfortunate side effect of mass interest in a subject is the wildfire-like spread of misinformation. So, what exactly is a blockchain, and what can you still do now that everyone has finally jumped on the cryptocurrency bandwagon?

Continue reading “The 348,296th Article About Cryptocurrency”

Mine Bitcoin With An ESP8266

With all the hype surrounding cryptocurrencies and the current high not quite so high but still pretty eye-watering price of Bitcoin, there are some things which might once have been pure folly that could now be deemed worthy of pursuit. There is an excavation mission being considered to unearth a hard drive containing an early Bitcoin wallet in a Welsh landfill, for instance. But a more approachable task for you may be the possibility of mining using minimal hardware.

Take [Merlot Machina]’s project for example, implementing a Bitcoin miner on an ESP8266. Part of this is the timeless pursuit of answering the joke question: “Will it mine Bitcoin”, and the other part is looking at this like a lottery ticket. Is it a worthwhile punt at a prize for a minimal investment?

He gives us a rundown of some of the statistics involved, and comes away with the conclusion that it is something like a not-very-good lottery ticket. The ESP performs 1200 hashes per second while the entire Bitcoin community manages about 1.2 exahashes per second. This he calculates gives him a 1 in 1016 chance of mining a block every ten minutes, which for the tiny cost of an ESP and its relatively frugal power budget is a chance he sees as worth taking.

So far he has implemented the hashing algorithm and verified it against a known hash on an already-mined block. At this point though he’s hit a roadblock in the need to run Bitcoin core on a server to keep the ESP supplied with new block headers, so the ESP miner remains a proof of concept. The write-up is still an interesting read though, and given that many readers will have a few spare ESP boards it’s possible that one of you may take it to the next level and Win It Big. If that’s you, you’ll be able to sit on your private island sipping a cool drink, and laugh at the commenters who said it would never happen. Meanwhile here at Hackaday we’ll stick to tried-and-trusted revenue generation strategies, such as bringing you the latest hardware hacks.

This might seem a peculiarly slow miner, but it’s not the slowest we’ve seen by any means. The ever-prolific [Ken Shirriff] has tried it on an IBM 1401 mainframe and a Xerox Alto, and you can of course do it the old-fashioned way.

Don’t Get Caught Up In Blockchain Hype

It’s the story of the moment, isn’t it. As the price of Bitcoin continues on its wild and crazy rollercoaster ride, everyone’s talking about cryptocurrencies, and in almost mystical terms, about blockchains. Perhaps to be a little more accurate, we should report that they are talking about The Blockchain, a single entity which it seems is now the answer to all ills.

Of course, there is no single blockchain, instead blockchain technologies form the underpinnings of the cryptocurrency boom. Since little dollar signs seem to be buzzing around in front of everyone talking about that subject, it has attracted the attention of hordes of people with little understanding of it. APNIC have a good article aimed at those people: Don’t Get Caught Up In Blockchain Hype, which is worth a read even if you do understand blockchain technologies.

It makes the point that many large enterprises are considering investments in blockchain technologies, and lists some of the potential pitfalls that they may encounter. There may be a slight element of schadenfreude for some of the technically literate in seeing this in action, but given that such things can have consequences for those among us it’s too important to ignore.

As an analogy of a relatively clueless executive jumping on a tech-driven bandwagon, a software company of our acquaintance had a boss who decided in the heady days before the dotcom crash that the organisation would fully embrace open-source. Something to be welcomed, you might think, but given that the software in question was a commercially sensitive asset upon which all company salaries depended, it was fortunate that he listened to his developers when they explained to him exactly what open source entails.

Whether you are a blockchain savant or an uninterested bystander, it’s worth a read as you may sometime need its arguments to save someone from their own folly. If you fancy a simple example to help understand something of how blockchains work, we’ve got that covered for you.

Bitcoin coins image: Mike Cauldwell [Public domain].

Reconstructing A Blurry QR Code

QR Codes are a two-dimensional type of matrix barcode that are used for a variety of uses. They’re one way of turning a long piece of string data into an easily machine-readable format. For this reason, they can be used to store private keys for encryption and crypto-currency purposes. [Roger Ver] attempted to use a QR code containing a private key to give away some cryptocurrency on TV, but the code was blurred out by the broadcaster. Not ones to give up easily, [Michael] and [Clément] decided to see if they could reconstruct it anyway. 

The work begins, as so many cryptographic exploits do, with the collection of as much of the plaintext key as possible. By stepping through the footage frame by frame, small pieces of the unobscured QR code were found, as well as some of the private key itself. By combining this with enhanced images of the blurred code, the team were able to put together less than one third of the QR code. The team had other tricks up their sleeve though – they knew the QR contained a private key of a particular format, and were able to figure out the QR code was 41×41 pixels.

By using this data along with a careful study of the QR code format, the team were able to put together some code in Python to brute force the key. After 838849 trials, the key was found, and the team were able to claim the prize. It’s a great example of cryptographic analysis – and so is this story on hacking your own password.

[Thanks to Esko for the tip!]

Cryptocurrency Mining Post-Bitcoin

While the age of using your own computer to mine Bitcoin during spare CPU cycles has long passed, average folks aren’t entirely shut out of the cryptocurrency game yet. Luckily, Bitcoin isn’t the only game in town anymore, and with GPUs coming down in price it’s possible to build a mining rig for other currencies like Etherium.

[Chris]’s build starts with some extruded aluminum and a handful of GPUs. He wanted to build something that didn’t take up too much space in the small apartment. Once the main computer was installed, each GPU was installed upwards in the rack, with each set having its own dedicated fan. After installing a fan controller and some plexiglass the rig was up and running, although [Chris] did have to finagle the software a little bit to get all of the GPUs to work properly.

While this build did use some tools that might only be available at a makerspace, like a mill and a 3D printer, the hardware is still within reason with someone with a little cash burning a hole in their pockets. And, if Etherium keeps going up in value like it has been since the summer, it might pay for itself eventually, providing that your electric utility doesn’t charge too much for power.

And if you missed it, we just ran a feature on Etherium.  Check it out.

Ethereum: GPU Mining Is Back But For How Long?

By now, everyone and their dog has at least heard of Bitcoin. While no government will accept tax payments in Bitcoin just yet, it’s ridiculously close to being real money. We’ve even paid for pizza delivery in Bitcoin. But it’s not the only cryptocurrency in town.

Ethereum initially launched in 2015 is an open source, it has been making headway among the 900 or so Bitcoin clones and is the number two cryptocurrency in the world, with only Bitcoin beating it in value. This year alone, the Ether has risen in value by around 4000%, and at time of writing is worth $375 per coin. And while the Bitcoin world is dominated by professional, purpose-built mining rigs, there is still room in the Ethereum ecosystem for the little guy or gal.

Ethereum is for Hackers

There may be many factors behind Ethereum’s popularity, however one reason is that the algorithm is designed to be resistant to ASIC mining. Unlike Bitcoin, anyone with a half decent graphics card or decent gaming rig can mine Ether, giving them the chance to make some digital currency. This is largely because mining Ethereum coins requires lots of high-speed memory, which ASICs lack. The algorithm also has built-in ASIC detection and will refuse to mine properly on them.

Small-scale Bitcoin miners were stung when the mining technology jumped from GPU to ASICs. ASIC-based miners simply outperformed the home gamer, and individuals suddenly discovered that their rigs were not worth much since there was a stampede of people trying to sell off their high-end GPU’s all at once. Some would go on to buy or build an ASIC but the vast majority just stopped mining. They were out of the game they couldn’t compete with ASICs and be profitable since mining in its self uses huge amounts of electricity.

Economies of scale like those in Bitcoin mining tend to favor a small number of very large players, which is in tension with the distributed nature of cryptocurrencies which relies on consensus to validate transactions. It’s much easier to imagine that a small number of large players would collude to manipulate the currency, for instance. Ethereum on the other hand hopes to keep their miners GPU-based to avoid huge mining farms and give the average Joe a chance at scoring big and discovering a coin on their own computer.

Ethereum Matters

Ethereum’s rise to popularity has basically undone Bitcoin’s move to ASICs, at least in the gamer and graphics card markets. Suddenly, used high-end graphics cards are worth something again. And there are effects in new equipment market. For instance, AMD cards seem to outperform other cards at the moment and they are taking advantage of this with their release of Mining specific GPU drivers for their new Vega architecture. Indeed, even though AMD bundled its hottest RX Vega 64 GPU with two games, a motherboard, and a CPU in an attempt to make the package more appealing to gamers than miners, AMD’s Radeon RX Vega 56 sold out in five minutes with Ethereum miners being blamed.

Besides creating ripples in the market for high-end gaming computers, cryptocurrencies are probably going to be relevant in the broader economy, and Ethereum is number two for now. In a world where even banks are starting to take out patents on blockchain technology in an attempt to get in on the action, cryptocurrencies aren’t as much of a fringe pursuit as they were a few years ago. Ethereum’s ASIC resistance is perhaps its killer feature, preventing centralization of control and keeping the little hacker in the mining game. Only time will tell if it’s going to be a Bitcoin contender, but it’s certainly worth keeping your eye on.