What is Bitcoin Mining?

Bitcoins aren't minted, or printed. So how are they created?


Bitcoins are accepted by companies ranging from major retailers down to your local independent coffee shop. Unlike regular money, you can make your own bitcoins legally, but how? 

Bitcoins are created by the currency's users themselves, with their computers, in a process called 'mining'. In a sense, they're conjured out of thin air, using little more than electricity, computer chips, and software. In short, miners create bitcoins for themselves by solving mathematical puzzles.

How Mining Works

The bitcoin network is a vast collection of computers, all of which know which transactions are happening, and how much bitcoin is stored in which bitcoin addresses. They know this because they all have a copy of the blockchain, which is a large file containing all of this information. Think of it as a giant ledger, containing all the accounting information for the bitcoin network, going back to the beginning of time.

Every time new transactions are added to the end of the bitcoin blockchain, the computers on the bitcoin network collect information about them together into a block of data. It is cryptographically ‘sealed’ using a mathematical equation. This is where the miner comes in.

The mathematical puzzle is difficult to solve, and all of the miners on the network compete to solve it at the same time. When someone finally solves it, they alert the rest of the network, and the answer to the puzzle is used to help mathematically ‘seal’ the latest set of transactions in the blockchain.

Then, everyone starts trying to solve the next problem.

Something else happens when a miner solves a math problem: they get a reward. The bitcoin network pays a predefined number of bitcoins to their bitcoin address. As of February 2015, that reward is set at 25 bitcoins, but it halves every so often.

The Mathematical Puzzle

The mathematical equation that miners use to cryptographically seal a block is called a hashing function.

The hashing function produces a string of characters called a hash, (also known as a 'digest'), which is much shorter than the information used to produce it. Many transactions may be used to create a hash, but the hash itself may only be a few hundred characters long.

A hash has some very special properties:

  • A hash is not reversible. You cannot use a hash to find out what information was used to produce it.
  • A hash is reproducible. If you run the same information through the hashing function, you will always produce the exact same hash.
  • A hash is unique. It can only be made by the information used to create it. That particular information can only ever produce that particular hash, and no other information can produce the same hash. In fact, if any tiny piece of information is changed – even just one numeric digit – then the hash produced by the information will be completely different.

All of this means that a hash is useful for confirming that information hasn't been tampered with. The blockchain uses that to prove that information about transactions stored in a block hasn't been changed since it was created.

It does this by hashing transactions when they are first written to a block, and then including that hash in the block.

If you went back and tried to change the transactions in the block, then everyone else would be able to tell that you had been tinkering with the data, because your new data would not produce the same hash as the one originally stored in the block.

Making Hashing Harder

But wait! In most computer systems, hashing a set of information doesn't take much work. Couldn't a fraudster simply rehash their new transactions, too?

If our scammer altered the transactions in a block, then surely they could simply create a new hash from those transactions and replace the block's old hash with that one? Then, if anyone checked the information in the block, they'd run it through a hashing function and see that it matched the block's hash.

They'd think that the information was legitimate, even though it had been changed.

To stop this, the bitcoin network deliberately makes the mathematical hashing problem much harder.

Bitcoin does this so that you can't just create a new hash for a block easily on your own. It takes the entire bitcoin network 10 minutes to produce a hash, and there are a lot of computers working on it. So making a new hash from your altered information is practically impossible.

Connecting the Blockchain's Blocks Together

The blockchain uses another trick to make fraud even harder. Every time the network prepares a list of transactions for the latest hash, it also includes the hash from the previous block in the chain. Remember that a hash is created using all of the information that you feed into the hashing function. This means that the hash in every block is affected by the information in the previous block.

That's a beautiful system, because it means that if you want to alter a block in the blockchain, not only would you have to recompute the hash stored in the block, but you would have to recompute the hash in the block directly after it, and then the block directly after that – all the way down the chain.

So, the older the information in the blockchain, the more secure it becomes, because the harder it is to change. 

How to Mine Bitcoins

So, how can you mine bitcoins? You need a computer that can solve the mathematical equation, and it has to run some mining software. Find out how to choose a bitcoin miner here.

Bitcoin mining isn’t a rock solid way to make money. You need to consider a variety of factors to work out if it’s for you. Find out if you can make money with bitcoin here.