It’s a metaphor, but with possible real-world consequences.
We’ve heard a lot about cryptocurrencies lately, especially Bitcoin. Opinions run the gamut from “worthless artificial gold” to the wave of the future and the universal currency we’ll all be using someday. Regardless of what you think about its future, the underlying technology is fascinating to people like me.
Recent reports again question the (unverified) excessive amount of electricity being used to power Bitcoin mining operations.
The question is, of course, how does mining something that exists only as bits and bytes in a computer use so much electricity? Heck, just what is “mining” in this context, anyway?
To understand that a little better while sidestepping some of the complexity, we’ll play a game.
Become a Patron of Ask Leo! and go ad-free!
Bitcoin mining is a type of game involving exceptionally difficult calculations to “guess” a number with certain characteristics. The first miner to guess the number correctly is rewarded with Bitcoin, giving the game a very lucrative financial incentive. The result is a lot of machines using a lot of electricity to calculate as quickly as they can so as to win the game. The game is a fundamental part of Bitcoin’s blockchain architecture.
Pick a number, any number
The game works like this:
- I think of a number between 1 and 1,000,000,000 (one billion).
- You try and guess that number.
- If you guess correctly, I’ll give you a dollar.
That’s it. That’s Bitcoin mining. It’s an incredibly over-simplified analogy, but fundamentally, that’s all mining is: if you guess my number correctly, you’ll “mine” one dollar.
There are a couple of additional characteristics to our game:
- You can guess as many times as you like. (Really!)
- You’re not the only person guessing.
- The first person to guess correctly gets the dollar.
Now it’s become a competition: the more quickly you can throw out guesses, the more likely you are to win.
Finally, as soon as someone wins and guesses correctly, I hand out the dollar, pick a new number, and everyone starts guessing again.
Throttling for speed
Now, I don’t want to give my dollars away too quickly — I have a limited supply — so I throttle the competition.
If I find that people are guessing too quickly, I change the rules. Instead of one billion, I’ll choose a number between one and ten billion (10,000,000,000). Theoretically, that’ll take all the guessers ten times longer on average to guess the right number, because there are ten times as many possibilities.
If they still guess too quickly, I’ll change it to one in one hundred billion (100,000,000,000), one in a trillion (1,000,000,000,000), and so on.
If my goal is to award one dollar per day, I’ll choose my range so it takes about 24 hours for someone to guess the right number.
That explains the mining concept: a bunch of people trying to guess a number for a reward.
In order to understand why that takes so much electricity, we need to map it more closely to what actually happens when mining Bitcoin.
The reward, as you might guess, is Bitcoin. The winner currently gets 6.25 BTC (Bitcoin), valued at around $325,000.00 USD.1 There’s definitely an incentive to play the game.
Each “guess” isn’t just a guess, but a calculation that is a fundamental part of Bitcoin’s blockchain technology. Blockchain is a topic for another day, but the calculation has several characteristics:
- It’s computationally slow. It’s actually a cryptographic hash2 (hence the “crypto” in “cryptocurrency”) of Bitcoin transactional data that takes a lot of computational work.
- Anyone who wants to participate in the Bitcoin transaction protocol — i.e., anyone who wants to play the game — can perform the calculation.
- The result must meet certain criteria. The system is designed so the calculation must be performed over and over with slight variation until the criteria are met. Throttling is accomplished in this step. The criteria can be strengthened so that it takes, on average, more iterations before being met. Bitcoin aims for each “game” to last ten minutes.
- The first person to perform a calculation that meets the criteria wins and is given the reward.
- Once a winner appears, all the other players get the answer and confirm it meets the required criteria.
Bitcoin mining: a CPU-intensive calculation in a competition where the winner gets thousands of dollars. Sounds like an opportunity!
Throw hardware at it
The faster you “mine” — the faster you can perform those calculations — the more likely you are to win.
Step #1 is to use the fastest computer you can. High-end hardware is the order of the day. While you do stand a (teeny-tiny) chance running a Bitcoin miner on your desktop PC, this has become the realm of computers dedicated and specifically designed to perform these calculations. High-end GPUs (graphics processing units) are particularly useful.
Step #2 is to use as many computers as you can. If you have ten computers all calculating and making guesses simultaneously, you have ten times the chance of coming up with the correct answer.3
Step #3 is to do both: use lots of high-end computers to participate in the Bitcoin calculation game.
Of course, lots and lots of computers use lots and lots of electricity.
Throw power at it
Electricity isn’t free, but its costs vary quite a bit depending on where you are. As a result, Bitcoin (and other similar cryptocurrencies) mining operations are often established in locations where electricity is cheaper.
Sometimes that’s not an issue, but occasionally it can cause a backlash as local resources and power grids are stressed to provide the required electricity.
Raising the price of electricity sounds like a solution, but the likely effect is that cryptocurrency value would increase as well, continuing to make large-scale mining operations lucrative.
Other blockchain and cryptocurrency technologies4 are experimenting with less resource-intensive solutions to the problem, but so far, there’s no clear winner.
It would appear this game will be with us for a while.
Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.
I'll see you there!
Footnotes & References
1: One criticism of Bitcoin, and indeed most cryptocurrency, is volatility. Between the time I write this and the time my editor edits it or it’s published, the value can change dramatically.
2: SHA256, for the curious.
4: Most notably Ether, on the Ethereum blockchain, now being used for a variety of different things, including “NFTs” or Non Fungible Tokens.