Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

# How Does Bitcoin Mining Work?

It’s been hard to avoid hearing about cryptocurrencies lately, especially Bitcoin. Opinions run the gamut from it being “worthless, artificial gold” to the wave of the future and next 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 once 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.

## Pick a number, any number

The game works like this:

• I’ll 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 incredibly over-simplified, 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, on average, ten times longer 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 that long for someone to guess the right number.

## Bitcoin’s game

That explains how mining operates at a conceptual level: a bunch of people are trying to guess a number, and the winner gets a reward when they’re correct.

In order to understand why that takes so much electricity, we need to map it more closely to what actually happens when mining for Bitcoin.

The reward, as you might guess, is Bitcoin. The winner currently gets 12.5 BTC (Bitcoin), valued at around \$87,000.00 USD.1 There’s definitely 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 transaction data that takes a lot of computational work.
• It’s farmed out to anyone who wants to participate in the Bitcoin transaction protocol — i.e., anyone who wants to play the game.
• The result must meet certain criteria. The system is designed such that the calculation must be performed over and over with slight variation until the criteria is 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.

Bitcoin mining: a CPU-intensive calculation required 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 one 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.

Step two 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 three 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 cryptocurrency) 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 technologies are experimenting with less resource-intensive solutions to the problem that the calculations solve, but so far, there’s no clear winner.

It would appear this game will be with us for a while.

## 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.

3: This is why malware exists that installs a Bitcoin miner on your comparatively slow PC. The more machines it can infect, the higher the chance that the malware author might win the game.

Posted: July 4, 2018 in: Internet
« Previous post:

### New Here?

Let me suggest my collection of best and most important articles to get you started.

Of course I strongly recommend you search the site -- there's a ton of information just waiting for you.

Finally, if you just can't find what you're looking for, ask me!

### Confident Computing

Subscribe for FREE today and claim your copy of The Ask Leo! Guide to Staying Safe on the Internet – FREE Edition. Culled from the articles published on Ask Leo! this FREE downloadable PDF will help you identify the most important steps you can take to keep your computer, and yourself, safe as you navigate today’s digital landscape.

### Leo Who?

I'm Leo Notenboom and I've been playing with computers since I took a required programming class in 1976. I spent over 18 years as a software engineer at Microsoft, and after "retiring" in 2001 I started Ask Leo! in 2003 as a place to help you find answers and become more confident using this amazing technology at our fingertips. More about Leo.

### 29 comments on “How Does Bitcoin Mining Work?”

1. Obviously the article just serves to indicate how a mechanism is secured with competition based game theory by staking a currency in itself and using it as a reward, but importantly, the whole point of doing it is to guarantee that security is going to be followed by everyone that participates in the network. The fact is that when talking about Cryptocurrency, or indeed any ‘blockchain’ ecosystems, the big idea is exactly the same: Governance markets reward those who contribute to consensus. A “market” is simply created to award coins to those who enforce the governance rules of the protocol, so a ‘BlockChain’ with no underlying valuable asset has zero security, and zero incentive for people to play fair. Total Immutability occurs because of the valid proof & transparency that is presented by actually being computed in such way and not by using any ‘consortium’ of human beings (as it is conventionally in banks today).

We need to be aware that Cash is KING! The worry however is that now there is now no question that Digital Money is going to replace existing cash, because it is already more popular. We are already using Digital payment systems despite them being riddled with fraud, debt, corruption and inflation. So, the only way to get a near exact equivalent of Cash (which is peer to peer payment), is by using decentralised cryptocurrency. This way a payment can replicate an existing banknote exactly by going directly from person to person without the need to go through any third party, corporation or bank whatsoever. Such payments cannot be stopped or interfered with by authority. And the digital banknote cannot be counterfeited or even issued without such proof of work. Everyone has a choice as to how cryptocurrency experiments play out. It is a simple choice between trusting definitive mathematics or corporations with absolute power.

• And you can be robbed blind with no protection by hackers, digital coin exchanges have failed like banks before the FDIC and former FSLIC were established during the Great Depression and most of all, try finding somebody you can exchange them with for actual currencies, it will be difficult.

The social welfare systems of most nations won’t deal with them either as they require investments with a STABLE return. Digital currencies are like having a picnic with a grizzly bear, and more than a pic-a-nic basket is at stake.

In summary, bitcoin and it likes are merely pipe dreams of schemers and future workable cashless systems will still be based on so-called fiat currencies (as the virtual fans like to call it, especially when they are really criticizing the banking system) and currently nobody tends to have a clue what they are doing.

When I was in diapers the teenagers used to blame ‘the man’ or ‘the fuzz’ or ‘the system’. Your argument is about the same and each generation has their own version. See “Jack Webb”.

• BitCoin has never been hacked. That, in itself is testimony to it’s security and immutability. Yes, centralised digital coin exchanges and systems have been hacked and are failing regularly. On the contrary, it is relatively easy to exchange Bitcoins. Try decentralised exchanges (for example) because they have no central point of failure. There are already at least eight scattered around the web. Unfortunately most people don’t understand the risks of using centralised exchanges to understand the need for them. Of course nobody tends to have a clue what they are doing. Exactly why any ‘investment’ should, firstly be done in education of this technology. Forget schemers, even Regulators themselves have failed to protect consumers, regulators fail to put bankers in jail, regulators fail to stop fraud and crime on epic proportions. Since 2008 we have found out that gold is rigged and markets are rigged and that mortgages were fraudulent and rigged, that entire foreign exchange mechanisms were rigged and so far no one has gone to jail. The fines that they have charged are less than the profits made from the fraud and that is simply a licence to continue crime. Until regulators start protecting consumers, they don’t have anything to add to Cryptocurrency. BitCoin allows consumer protection by putting control into the hands of the consumers themselves. BitCoin is consumer protection because privacy is consumer protection. Bitcoin is consumer protection because user control is consumer protection. Regulators are just helping banks to avoid competition. When press releases are written by or on behalf of the very banks or financial institutions you’re supposed to be regulating, you should be in jail also.

• “cannot be counterfeited”

If I’ve learned anything in the age of computers it’s that “cannot” is not in the vocabulary of the unscrupulous. There will be a way to fraud the system and because the stakes are so high, the person(s) that figures it out will never tell anyone else. Heck, it’s probably already happened.

2. Surely there must be more to it than guessing a number Leo?
I tried to read up on the bitcoin stuff including mining, but I must be a dunce, can’t make head or tail out of it.
Any simple explanation? Other than guessing a number?

• Honestly, guessing a number is about the clearest / simplest analogy I could come up with, without diving in to really esoteric description of Bitcoin technology.

• I’ve always pictured it like a brute force attack on a password by individual computers. The first person to crack it wins. Still a guess, but it’s a similar guessing method to that used by a brute force attack. This is also a simplification because there are other controls in the algorithm.

• That’s me! And, like your first post, I gave up trying to understand it. I’ll just continue to ignore it until it becomes the standard.

• When it comes to explaining blockchain and cryptocurrency the old adage “if you can’t explain it simply, you don’t really understand it” is either true or the experts (such as Antonopoulos referred to by Mike Coulter above) are so deeply into it that they can’t think in the “simple” terms. Try these two sites for common sense explanations (with no math, programming. big words or evangelizing).

By the way, the term “mining” is a mis-characterization. Somewhere along the way, someone has put in real, government backed currency into the system to get cryptocurrency viable.

3. The reality is, that nobody is paying you anything for mining. Yes, maybe you get 12.5 bitcoin each time you are successful, but that’s really noting but some 1s and 0s. The only value attached to it is whatever someone is willing to pay you to take those bitcoins off your hands. It may be \$87,000 today, but it could be \$1 tomorrow. I’m not really sure how it can be called a currency when it is as volatile as the stock market. Except it’s worse than the stock market, because the value is tied to nothing. Yes, I know that our dollar is no longer tied to gold, but when I look at my bank account, I know that I can buy approximately a certain amount of food, etc., and if I wait a week to do my shopping, I’ll be able to buy approximately the same. Someone who has bitcoins has no idea what they can buy with it, until they find someone to take it off their hands.

I’m more interested in hearing about blockchain technology and whether it is the future of computing/data storage as some people say it is.

• BlockChain does not work without Cryptocurrency. The characteristic of the total security and immutability is the product of the very proof of work that has to be computed, not the product of the BlockChain itself. All that a ‘so called’ BlockChain offers is a record of transactions as a database. If such a database is not wholly censorship resistant then this represents a fundamental failure to understand what is the real value proposition which is the actual decentralised system in itself. Anyone can do with BitCoin whatever they please or use it anywhere in the world in whatever way they like. It’s not just a technology. It is not just a currency. It is the very first decentralised currency that is also a complete 24/7 payment network. Without currency you cannot do it’s level of security because you then have to have a “central” authority that has to actually decide if a transaction should be included or not. At that stage it is no longer borderless, censorship resistant, neutral or open since every participant must then be vetted. Where someone has control in systems, they immediately have a duty and a responsibility which means that all of the advantages of a BlockChain then go away. Today we are seeing desperate attempts to coopt, embrace and extend this technology, and many companies and governments out there who are really looking at opportunities to simply create centralised versions, despite, the fundamental point being the decentralisation. BlockChain is not yet efficient, it is just Liberty- an inherent design trade off. The only system in existence that has successfully run 24/7 for a decade or so without any single point of failure despite being totally open on the internet to attack. And all because it is impossible to rewrite, censor or alter any of the recorded history already written. Immutability and censorship resistance is baked within this technology and no transaction can be reversed. It is simply what it is, but not yet what it could become.

• “I’m not really sure how it can be called a currency when it is as volatile as the stock market.” – Yup. At this point in time, crypto only makes sense for cash you can afford to lose. Buying it is a bit like going to a casino. You may win big, or you may lose your shirt. Whether it’ll achieve grater stability remains to be seen.

4. At one point, long ago, currency was, in fact, based on gold. Today it is not. Today, the dollar is based on nothing more than confidence. It works simply because enough of us believe that it does. In the Great Depression, no money was destroyed. Yes, stocks lost value, but the money supply after the crash was the same as it was before. What was lost was confidence. People stopped spending and the economy ground to a halt.

• That’s the same thing that gives Bitcoin its value: it’s worth something because people believe it’s worth something. Nothing more, nothing less. Same as the US Dollar. But WAY more volatile, since the number of people believing it’s worth something is constantly in flux, and exactly what they believe it’s worth is similarly ever-changing.

• BitCoin is priced in exactly the same way that every other currency works. It is traded on international markets against over 35 currencies in real time, directly and indirectly, being affected by fluctuations of other currencies by supply and demand defined by market dynamics. Because it is an extremely small currency in comparison to the others it has huge volatility but as it grows in size it is actually becoming more stable over time. In fact, there are already 20 of the roughly 194 currencies in the world that are already more volatile than BitCoin. It is a misunderstanding to compare BitCoin to Stocks or Shares because it is not an equity and BitCoin is not a company. What it is is a complete industry, a currency, a payment system and a technology platform that is erecting a monument of trust. It is an instrument that when traded does have an extremely small but very distributed economy behind it which is buffeted to extremes also by daily events and media announcements (like ‘BitCoin is dead’) which tend to move its price a lot.

If anything needs to be invested in BitCoin it is skills and knowledge because so far it is the most secure system that has ever been created. Anyone that sees just the impact of traditional economics in the cryptocurrency space means that they are missing the bigger picture of the disruptive technology that it represents to conventional accounting and transparency methods alone. The only way to learn how to use programmable money is with real money but the hype around BlockChain is entirely out of sync with its actual implementation. The only exception to this so far is, in fact, the very BitCoin BlockChain itself. It is a global experiment being proven in the real world. Proof of work as described producing thermal dynamically guaranteed immutability which so far has not been wholly achieved in any other way.

It is not a zero-sum national currency game wherein any particular domain there can only be one winner takes all. Many people in the world will not wait for these technologies to be adopted because of their desperate needs for a safe haven from failing monetary systems. It is entirely an opt-in use case because permission is not necessary. An interesting article Leo that simplifies greatly by reasonable analogy what mining represents.

5. sooooooo….someone pays me for correctly guessing a number. My question is what do they get for me doing that? Seems that wasn’t in the article.

• They don’t pay you with Bitcoins that they have, they generate it from thin air (actually thinner than air). I’m guessing that payoff is the incentive that keeps the system going. The inflation is offset by the growing (perceived) value of the Bitcoin. I think its value is a bubble which will eventually burst.

• Mining is an entirely automatic process. There is no human involvement whatsoever. References to “persons” or “people” really mean “nodes” or “Computers”. It is the Software that mines and validates, verifies and propagates. It is impossible for humans to be involved because even a delay of milliseconds would cost thousands. You as a “person” are free to initially choose whatever software you want to do the mining. Obviously, specialised chipsets are used for efficiency. No, cryptocurrency like BitCoin is not actually created out of thin air. It is created by the process described, by computers running the mining software that undertakes the calculations. Unfortunately, computers cannot be powered by “thin air” at all. What everyone that participates in the network gets from the actual process is the actual transaction verifications, guaranteed security, and immutability. In addition, miners themselves get fractions of a BitCoin allocated to their addresses for the completed additions to the spreadsheet. This is the “Trustware” we are talking (learning) about.

• But what is the point of creating these giant spreadsheets?

• Take a look at these videos:
They explain clearly what all this is about (not technically, by process wise).
The giant spreadsheet is the ledger – the running and continuous record of all coin transactions.

Comment: I have a feeling that someday some of these glowing characterizations will come back to haunt the cryptocurrency system (no human involvement, guaranteed security, immutability, transparency, etc.). There has never been a system that wasn’t hacked by the next guy who is smarter than the previous guy. Just common sense.

• In a word the point of creating these ‘giant spreadsheets’ is Monumentality. The BlockChain acts like a digital Monument because it is of historical significance, but immutability is really just a philosophical idea because everything actually changes, eventually, but in practical terms, it is really on a scale between what is very easy to change and what is very hard to change. BitCoin comes in at this new ‘maximum scale’ by definition because nothing is currently as immutable as Bitcoin’s digital system so it defines the current end of the ‘maximum scale’. But it is not actually the BlockChain that gives Bitcoin immutability, it is the proof of work. The proof of work ‘serves’ as a monument. A declaration to everyone that sees it as the measure because it cannot be built on the cheap without extremely extensive resources. Security is not the absence of crime, it is the presence of justice. You don’t create a secure world by removing crime you create one by increasing justice.

• Mike, can you not give a short, simple answer to a short simple question? Every response you give is very convoluted and confusing. And no, I can’t watch videos because of the speed of the internet where I am.

If the point, for example, is to do calculations for NASA, then I suppose there is some point. But it sounds like the point of creating this giant spreadsheet is to create a giant spreadsheet that means nothing for anybody. That is the height of futility. If people are going to devote large computing resources, how about devoting them to solve some of the world’s problems?

• The calculations prove that the spreadsheet is correct, AND has not changed. Since the spreadsheet grows with each bitcoin transaction, the work has to be ongoing. The calculations are difficult in part to prevent forgery. The spreadsheet is then public, meaning that there simply cannot be an undetected change to the historical record, no matter how easy or difficult it might be.

The problem is that BitCoin and blockchain are incredibly complex, and while we all try to come up with simple answers often it’s simply (*cough*) not possible.

• Sorry if I’m a TLDR responder, of course, the point is that you do not need a BlockChain at all if you can trust whatever or whoever is involved currently in any existing system you may already run or use today. You may consider you already have reliability and trust already. Money is just one application for the technology and Cryptocurrency mining is a profitable and promising industry in a slow global economy. It also requires fewer resources than the fiat system if you take into account the many other resources (too detailed to list) that are essential for that. Mining also generates heat, which there is no reason to waste (already Cryptocurrency miners are available that can replace wall heaters in the home for example). So yes, absolutely it surely is only futile if you have no incentive or get no benefit from devoting resources to the technology which is still in its infancy.

6. The reason some people on this page are puzzled is because Leo’s original article described only an analogy for only one piece of the blockchain/cryptocurrency phenomenon. Then the ensuing conversations made references to things that weren’t described or explained on this page. If you can’t watch a video, there are written descriptions on the internet, although most can be convoluted.

Let me try an explanation (with no guarantees). Leo, sorry if this is long.
In today’s banking/financial system, when two people want to exchange money, they go through a trusted financial institution, such as a bank. Both parties trust this third party entity (the bank). One person gives money to the bank and the other person pulls money from the bank. The bank creates, keeps and owns the transaction record. The key elements in this transaction are (1) trusted bank, (2) centralized record keeping. Now, what if two strangers want to exchange money, without a trusted third party? Sure, they can exchange money, but nothing is guaranteed and if there is a problem (such as the one person claiming they never received the money), who do you believe? The blockchain/cryptocurrency idea tried to solve this problem. First, let’s define some terms. Bloackchain is the name given to the technology that manages transactions on computers. The cryptocurrency is the money. Bitcoin is the most famous money, but there are many others. The blockchain “technology” is software running on computers, doing lots of calculations (that’s what Leo refers to when he says “incredibly complex”). The complex calculations are related to cryptography, that is, the encryption and decryption of data. That’s where the “crypto” comes from. The term “blockchain” is explained below.

In order to replace the trusted bank, software, computers and cryptography are used to create a ledger (a running record) of ALL the money transactions (let’s calls these Bitcoin transactions). Since there is no centralized bank in the cryptocurrency system, the transaction records are maintained by the people participating in the system. A transaction record is entered into the ledger for every transaction. The ledger is essentially a database containing an entry, or a block, for every transaction. These transactions are, of course, related and therefore linked together, creating a chain of transactions blocks. Hence the term blockchain. This blockchain ledger is what was referred to as a “spreadsheet” previously. No, it’s not Excel.

So, if there is no centralized bank, where is the ledger maintained. A copy of the ledger is maintained on every computer that participates in this system. The mathematical magic is that these copies are all identical and only one person (or computer) can update it at a time. Another feature is that existing records cannot be changed, but only added (to create the chain). When a new record is added, all copies of the ledger reflect the addition (by computers broadcasting messages over the internet). One reason this blockchain ledger is said to be trusted is because there are many copies of it all over the world, on many computers, and they all match. If, for some reason, one of the copies was wrong it would be “voted” out or discarded. But, the other reason is that a ledger copy can’t be wrong or hacked in the first place – at least not theoretically. And the reason for the ledger’s trustworthiness goes back to complex and long cryptographic calculations that need to be solved in order to validate a transaction and enter it into the ledger.
Now let’s get back to Leo’s original article and the “mining” guesswork. In order to perform these complex calculations a lot of computing power (and know-how) is needed. People who provide their resources to validate and update the ledger don’t do it for free. They expect a reward and they get paid with Bitcoins. The reason this is called mining is because the Bitcoins used to pay these participants are generated by the blockchain/cryptocurrency system. This is money that didn’t exist in the system before, but is created by the system as payment (this is the 12.5 Bitcoins in Leo’s article). The rationale for this “money creation” and why it doesn’t cause inflation is a different topic, but the system is setup to half the number of Bitcoin payments at every (about) 200000 transactions. The guessing game is the process of breaking the crypto code by performing calculations so that you can be the first to enter a transaction into the ledger. The more computing resources you devote to it, the better your chances. Another mathematical magic is the statistical fact that only one person will be able to solve the puzzle at a given time. The first one that does it gets the reward. The statistical element comes in because of the big numbers of calculations and computers (miners) involved. Furthermore, to ensure that no statistical accident will occur, the blockchain technology (software) increases the difficulty level of the encryption (and thus decryption) as the number of miners increases. Get it?