• Hash256
  • Hash160
  • Reverse Bytes
  • Hexadecimal
  • Satoshis


The process of adding blocks to the blockchain.

What is Mining?

Mining is the process of adding transactions to the blockchain.

How does it work?

Every node on the bitcoin network shares information about new transactions. They store these transactions in their memory pool.

The memory pool is a node’s temporary storage area for transaction data.

Each node also has the option to try and “mine” the transactions in their memory pool in to a file. This file is a ledger of every bitcoin transaction, and it’s called the blockchain.

You could think of the memory pool as “floating” transactions and the blockchain as “archived” transactions.

However, to add transactions from the memory pool to the blockchain, a node has to use a lot of computer processing power.

This processing power is forced through the existence of a challenge in the memory pool.

What is this challenge?

Okay, imagine you’re a node. At any moment in time you can condense the transactions in your memory pool in to a single “string” of numbers and letters.

This string represents all of the transactions in your memory pool.

Now, your objective is to hash this string with another number to try and get a new string that begins with a certain number of zeros.

Most of the time you will get a result that isn’t even close.
But if you keep going you may stumble upon a number that works.

Now, this sounds easy enough, but it’s actually difficult. It’s utterly random, and you can only hope to find a winning result through trial and error. And that’s what Mining is – lots of hashing (using lots of your computer’s processing power) and hoping to get lucky.

But if you are lucky enough to find a successful hash result, the transactions in your memory pool get added to the blockchain, and every other node on the network adds your block of transactions to their blockchain.

You’ll also receive a 25BTC reward for your effort, as well as picking up any fees that were tacked on to the transactions that you just added to the blockchain.

The “certain number of zeros” comes from the difficulty. This is set by the network and changes based on the volume of miners – the more people mining, the greater the difficulty and the more zeros are needed at the start (which makes it harder to find a winning result).

Why is Mining necessary?

Good question. Why not add transactions directly to the blockchain?

Because mining allows the entire Bitcoin Network to agree on which transactions get “archived”, and this is how you prevent fraud in a digital currency.

Go on…

When you make a bitcoin transaction, nodes on the network do not hear about it instantly. Instead, transactions travel across the bitcoin network by being passed from one node to the next.

A fun word for describing the way transactions travel across the network is propagation.

However, it’s actually possible to make another transaction using those same bitcoins and insert that transaction in to the network too. For example, you could buy a beer with some bitcoins, then quickly attempt to buy a slice of pizza with those same bitcoins too.

In other words, some good ol’ fraud.

Some nodes would get the pizza transaction first (and ignore the beer transaction), whereas others would get the beer transaction first (and ignore the pizza transaction).

Yet even though you make the pizza transaction after the beer transaction, due to the way transactions travel across the Bitcoin Network, the network would be in a disagreement about whether you should get the beer or the pizza.

So how does the network decide which transaction to go with?

Mining, of course.

If a node on the network completes the challenge, then it’s the transactions in their memory pool that get added to the blockchain.

If a node with the pizza transaction successfully mines a block, then that’s the transaction that gets added to the blockchain, and the beer transaction evaporates from the network.
It seems like a little unorthodox way to select transactions, I know, but this is the solution the bitcoin network uses to reach a consensus when dealing with conflicting information.

On the plus side, it only takes about 10 minutes for each new block of transactions to be added to the blockchain, so you only need to wait 10 minutes for a confirmation that bitcoins have “arrived” at a new address (and haven’t been sent to an alternative address).

Another benefit of Mining.

If you want to try and control the blocks (i.e. transactions) that get added to the blockchain, you have to compete to solve block puzzles with every other mining node on the bitcoin network.

In other words, you need to have a computer with enough processing power that is able to out-work the combined processing power of every other bitcoin miner.

Which is entirely possible – you just need to spend a few billion on hardware and you’re good to go (although this figure increases with every new miner who joins the network).

How do I start mining?

Fancy a crack at that 25BTC reward eh?

To start mining, you flick a switch in the bitcoin client.

However, due to the fact that trying to mine bitcoins using the CPU on your laptop is horribly inefficient, the “mine” switch has been taken out of the software interface.

But not worry, because the functionality is still there… you just have to enter a command instead:

This is the command to “turn mining on”. Your client will now generate blocks (of transactions) from the transactions in your memory pool and start hashing them.

You will know it’s working because your processor will start whizzing as it hashes away at the blocks it generates to try and get a result that works.

It probably won’t solve a block (it would be a miracle), but it’s fun to give it a shot.

By Greg Walker,

Last Updated: 28 Mar 2020
  • 28 Mar 2020: updated html for h1 headers and subheadings - now dynamic from yaml
  • 28 Mar 2020: updated html for h1 headers and subheadings
  • 09 Oct 2019: renamed browser to explorer, glossary to guide, and guide to beginners
Back to Top

Hey there, it's Greg.

I'll let you know about cool website updates, or if something seriously interesting happens in bitcoin.

Don't worry, it doesn't happen very often.