Developing Bitcoin Miner Firmware in Rust for Better Efficiency and Transparency

By Lukáš Hozda

Elevator Pitch

A few years ago, we took a risk, and decided to embark into obscurities and embedded development on limited and unsupported hardware, and to bet all on a small language called Rust. :) We prevailed, and want to encourage others to use Rust in companies and make more efficient and transparent SW.

Description

I would like to present the BTC miner firmware and accompanying Linux distribution as a case study.

A couple years ago, we decided to embark on a risky adventure - we wanted to make bitcoin mining more open, transparent, and power efficient.

BTC mining is a slightly obscure and very competitive industry. New mining machines are being released all the time, while older ones slip under the threshold of profitability and become junk hardware. Mining also consumes a lot of electricity, and apart from environmental concerns, it makes it difficult for single people, the proverbial underdogs, to get into the game. The actual mining chips are often controlled by sketchy hardware and software, which is prone to issues, and very closed-off from the end user. Difficulties arise when smarter cooling solutions are employed or when there are non-standard electricity conditions.

We believe that hardware, where you don’t have the control over the firmware/software, is not hardware you own, and so decided we want to change that and develop an alternative Linux distribution with its on firmware, that: - is more open and transparent - as flexible as possible - can significantly prolong the lifetime of the device - increases power efficiency, so that less power is consumed for the same amount of hashrate - allows the user to access everything they need to meet their requirements - can handle non-standard power conditions (such as mining farms working with power plants in the US to help stabilize the power grid - this means you have to respond to signals from the power plant to consume a particular amount of power within seconds)

And finally, is written in Rust :)

When we started, Rust was far less common in companies than it is now, we faced challenges implementing it, we faced challenges finding developers, and we faced challenges reverse-engineering hardware full of bizarre choices fueled by rush to release the machines as quickly as possible by the original manufacturer. The hardware also has very limited resources, neither RAM, disk space nor CPU performance are abundance.

Implementing Rust, as a language that was not that established at the time, in a company setting provided a unique experience, but it started with worry and concerns. Now, we have internally decided to develop new projects only in Rust.

In this talk, I would like to: - Tell our story with Rust, talk about the challenges, and how Rust has helped us overcome challenges - Talk about the importance of developing software that is efficient, open, and gives freedom to the users, and how Rust helps achieved that - Encourage the adoption of Rust in companies, and share tips & tricks to get the most out of Rust when working with others

Notes

Technical requirements

At least common-use Rust knowledge, it also helps to be familiar with Bitcoin and mining

Why you’re the best person to speak on this subject

I directly worked as a developer the project, and now I have a position at the same company centered around education and mentoring, and maintain a more high-level overview of the project, the challenges, and most importantly the challenges of implementing Rust in a company setting, where technologies and design is critical - the risk is you either take it all, or you go bust.