Key points:
- It protects the Bitcoin network with electricity and cryptography.
- It regulates the issuance of new coins into the system.
- It confirms new transactions and adds them to Bitcoin’s ledger, the blockchain.
Mining is one of the fundamental building blocks of Bitcoin technology. In this article I will describe it as simply as possible, hoping to make things clearer for anyone who wants to understand the subject.
Let’s start by imagining Bitcoin as an enormous ledger, which records exactly how many Bitcoin each person owns and the name of the rightful owner (in reality it is an “address” made of letters and numbers).
So let’s dispel a myth: the idea that Bitcoin are somehow held virtually inside a phone or a PC. Nobody has them physically or digitally. What we have, thanks to some key words (a kind of password called a seed phrase), is only the proof that certain Bitcoin belong to us, and so we can spend or transfer them whenever we want.
To make this clearer, let’s take an example with two imaginary friends, Alice and Bob. If Alice had 1 Bitcoin and her friend Bob had 2, the ledger would say more or less this:
- Alice has 1 Bitcoin, on September 2, 2024 at 14:32.
- Bob has 2 Bitcoin, on September 2, 2024 at 14:32.
Now imagine that, 10 minutes later, Alice wants to send 0.5 Bitcoin to Bob. The ledger would now say this:
- Alice has 0.5 Bitcoin, on September 2, 2024 at 14:42.
- Bob has 2.5 Bitcoin, on September 2, 2024 at 14:42.
As you can see, Alice’s and Bob’s balances have changed after the transaction.
Before every transaction, the rules of the Bitcoin software verify that we really have funds to transfer or spend and that we are their rightful owners. If so, the ledger is updated, and from that moment Alice’s 0.5 Bitcoin belong to Bob.
Since it is made of blocks and not of pages, the Bitcoin ledger would look like this:

This information is then broadcast to all the Bitcoin nodes on the network. We can picture Bitcoin nodes as small private servers that anyone can keep at home, which store the entire Bitcoin ledger from its creation until today. The nodes also verify independently that Bitcoin’s consensus rules are respected.
In essence, Bitcoin is a huge ledger where everything is written down exactly: the owner’s name, in the form of a code of numbers and letters, and the amount of Bitcoin they own.
Each of us has some key words, like a password, to prove ownership of our funds and to spend the Bitcoin associated with our address.
The ledger (the Bitcoin blockchain) starts from the first Bitcoin transaction, made in 2009, and runs until today. Every 10 minutes the chain is updated with another block containing new transactions.

Thanks to the website mempool.space we can see the Bitcoin chain as a picture, in real time, and analyze it.
The green blocks on the left are waiting to be written to the blockchain; the blue ones on the right have just been added. As of today (September 2, 2024) there are 859,541 blocks in total.

Every block is made of transactions: they are the small squares you see in the square above, and in the next picture you can see them in detail. As you can see, there are no names and surnames of the people making them, only addresses.

Now that we have briefly described what Bitcoin is, let’s see what mining is.
Bitcoin mining
Key points:
- Every 10 minutes a block with the new transactions is added to the Bitcoin chain. It is the miners who make this possible, by checking that the transactions are valid and respect Bitcoin’s rules (the consensus rules).
- To update the Bitcoin blockchain you do not need permission from any centralized entity, such as governments or banks. You only need to respect the consensus rules of the Bitcoin software.
- The computer of the miner that adds the new block of transactions to the blockchain wins new Bitcoin as a reward for the work done and the electricity spent.
- Bitcoin is protected by mining thanks to the electricity the computers spend to do the work. To change even a single block of the ledger, you would have to do more work (spend more electricity) than all the computers of the entire network have done since that transaction was first added to the blockchain. For this reason nobody can attack Bitcoin cheaply, so it is not worth doing.
What is Bitcoin mining
Mining is a system designed by Satoshi Nakamoto (the creator of Bitcoin) as a solution to protect the integrity of the blockchain (the ledger we talked about earlier), making it impossible to alter.
Mining also serves to distribute the production of new Bitcoin fairly, until the maximum of 21 million Bitcoin issued on the network is reached, around the year 2140.
Contrary to what many people think, mining does not consist of supercomputers solving extremely complicated mathematical problems. It works more like a game of chance (like a lottery): the ASIC computers that mine Bitcoin do work (hashing) to try to find a valid number (set by the consensus rules of the Bitcoin software). Whoever finds it wins the newly issued coins and, with them, the right to write the next block, containing the data of the latest transactions, to the blockchain.
Here is a picture of a Bitcoin miner:

What is hashing and what is a hash?
Hash
Key points:
- A hash is a function that converts an input of letters and numbers into an encrypted output of fixed length (called a digest). The result is a string of numbers and letters:
000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f - Once calculated and found, a hash is irreversible, but easy for others to verify: there is no way to run the calculation backwards and get back to the original data.
In Bitcoin, a hash is a mathematical function that converts an input (the incoming data with the latest Bitcoin transactions) into an encrypted output of fixed length. The input always includes the information of the previous block as well, so as to create a link with it and with the whole chain of blocks that comes before.
Since every Bitcoin block is linked to its predecessor, this mechanism prevents any earlier block from being modified, because that would invalidate all the blocks that follow.

So we can say that the blocks of Bitcoin’s “ledger” are protected by cryptography, thanks to the hash function. The magic that makes Bitcoin more secure and freer than the current financial system is that the ledger (the blockchain) cannot be modified for free by any centralized authority, and is protected by cryptography and by electricity, as we will see in a moment.
If the cost of adding blocks to the Bitcoin blockchain were zero, anyone could add fake transactions to the network, or censor and delete legitimate ones. In our current financial system, by contrast, governments or authorities control “the ledger” and can, at zero cost, freeze bank accounts or forcibly take our money once they find a reason to do so. History is full of such examples: they always find the reasons, and often unjustly.
Bitcoin, the only digital asset connected to the real world
Anyone who tells you that Bitcoin cannot be touched because it is not connected to the real world is wrong: it is directly connected to the electricity needed to protect it and make it work.
The energy spent on mining Bitcoin is what makes it immutable over time and guarantees that the information in the ledger is correct.
The only way to change even a single transaction in Bitcoin’s history is to do more work than all the computers of the entire network have done since that transaction was first added to the blockchain.
It is so unachievable that, even if it were possible, it would cost so much that it would not be worth doing!
Unlike the fiat monetary system (our current system), where money can be created and printed without any effort or cost, with Bitcoin you have to do work (mining) to obtain new Bitcoin and to modify the ledger (the blockchain). It is more or less like the work needed to extract gold from mines, which is not free and is very hard.
Luck and SHA-256
Thanks to the book “Bitcoin Mining Handbook” by Daniel Frumkin, let’s look at the mining process in more detail, through the example of gambling, which helps us understand the concept.
Below is a short summary of what the book says, translated and rewritten by me.
Imagine that the miners of the Bitcoin network are individuals gambling in a casino. In this example, each of these gamblers has a 1,000-sided die. Rolling their die as fast as possible, they try to get a number lower than 10. Statistically this takes a long time, but as more gamblers join the game, the time needed for a number lower than 10 to come up gets shorter. In short, more gamblers mean faster rounds, since there are more chances of finding the required number (more gamblers = more chances of rolling a number lower than 10).
Once someone gets a number lower than 10, all the players can look at the table and verify the number. The gambler who won takes a cash prize and the next round begins.

Ultimately, the Bitcoin mining process is very similar. All the miners on the network use Application-Specific Integrated Circuits (ASICs), specialized computers designed to calculate hashes as fast as possible.
More hashes per second mean more dice rolls per second, and so a higher chance of finding the solution. Miners propose a potential block of Bitcoin transactions and use it as the input. The block is fed into the SHA-256 hash function, which produces an output of fixed size, known as the digest or hash value. A single hash can be calculated in less than a millisecond, because it does not involve complex mathematics (for a computer, that is!).
If the hash value is lower than the current difficulty of the Bitcoin network, the miner who proposed the block wins. Otherwise, the miner keeps trying, calculating more hashes until it finds one that works. At that point the winning miner’s block is added to the blockchain, the miner is rewarded for the work with newly issued Bitcoin plus the transaction fees paid by those who transfer Bitcoin, and the next round begins.
Network difficulty and a block every 10 minutes
Now that we understand the randomness in the miners’ work to find a block, it is important to understand block times and difficulty.
Example: imagine that in our dice game anyone can join or leave the table at any moment. If one person is rolling a 1,000-sided die trying to get less than 10, it will take them 10 minutes on average to roll that number.
Sometimes they will manage it in 1 minute, other times it may take up to 30 minutes. But on average it will always take 10 minutes.
If a new person comes to the table and starts rolling the dice, together it will take them 5 minutes on average before someone wins the round with a number lower than 10, since more players mean more chances of finding the required result.
If another 20 people then join the table, the time is reduced significantly. The more people join the table, the shorter the time needed to find a number lower than 10.
To keep the game interesting, we have to make sure that finding a number lower than 10 always takes about 10 minutes. To do this, we can simply change the rules of the game.
As more gamblers join the table and it becomes easier and easier for someone to find the required number quickly, the rules change (that is, the gamblers now have to roll a number lower than 5 to win), so that the average stays at 10 minutes per round. As more gamblers join, the casino makes it harder and harder to win. If gamblers leave, it makes it easier. This keeps the average at 10 minutes to find a winner in every round.

This is exactly how the Bitcoin network regulates mining to keep a constant issuance schedule of new BTC (21 million Bitcoin at most). Miners calculate hashes below the difficulty target every 10 minutes on average.
Every 2,016 blocks (about 2 weeks) the average for those blocks is calculated and the difficulty is adjusted to bring block times back to 10 minutes. If more miners join the network during this 2-week period, the hashrate and the difficulty will rise accordingly.
Time in Bitcoin is measured in number of blocks; the blockchain is also called the timechain.
Note: nobody knows exactly why these arbitrary numbers were chosen. That said, it is important that 10 minutes is long enough for miners and nodes to broadcast the blockchain information around the world.
And 2,016 blocks is a long enough period to get a statistically accurate time, which is needed to adjust the difficulty.
The difficulty adjustments described above make Bitcoin the only asset with a truly fixed and known issuance schedule. Since the beginning of Bitcoin, we have known that there will never be more than 21 million coins. We will reach this number around the year 2140.
As of today, September 2024, there are already 19,747,580 in circulation out of 21,000,000 (https://www.blockchain.com/explorer/charts/total-bitcoins).
In every other industry, supply fluctuates with demand. If, for example, the demand for cars rises, the manufacturer can increase production to meet it. In Bitcoin, supply is locked and cannot change, so demand and price are tied more closely than in any other industry.
Who are the miners?
At this point you may have asked yourself: “Can I mine too?”
Of course you can, provided you do it somewhere you have access to cheap electricity, or at least that you have latest-generation mining computers, which consume less and earn more than older models.
We said earlier that mining is a kind of lottery. If we started mining as private individuals with our own Bitcoin mining hardware, we would obviously have little chance of finding the correct “solution” required by the Bitcoin software to win the block and receive the rewards.
Imagine how many thousands of computers dedicated to mining there are in the world. Winning the reward and writing the block would take a lot of luck, and years might pass before we “won this lottery” even once.
This is why mining pools were created: consortia of miners who combine their computing power to try to win the reward and add the block to the Bitcoin chain.
To take part in these pools you do not need to bring the hardware to one place: we can connect to the pool from anywhere in the world. In theory we could even have our ASICs hosted by someone in South America and connect to a mining pool in Russia, while sitting comfortably on the sofa in Italy and controlling everything from our PC.
This way the chances of winning the reward are much higher and we would receive payouts practically every day. To work out our share, the total is divided fairly among all the participants in the pool, according to the percentage of computing power (hashrate) we contribute to the total. In other words, if we contributed 200 TH/s to a mining pool with a total of 4,000 TH/s, we would be entitled to 5% of the total rewards.

The 51% attack on the Bitcoin network
Although it has never been carried out and is a challenge at the limits of the possible, a 51% attack, meaning an attack with 51% of the total computing power of the Bitcoin network (which is a huge number of computers!), could manage to modify blocks containing transactions or censor others, undermining the security and credibility of Bitcoin as an immutable chain.
Without going into technicalities, such an attack would require someone to hold at least 51% of the total computing power used in the world for Bitcoin. It would be an extremely expensive attack and could only be sustained for a short time, given the cost of such an undertaking. It is obviously counterproductive for whoever carries it out, given the expense and the difficulty. So in theory it would make no sense to do it!
Large mining pools such as Foundry, which dominate the market, could one day potentially lead to the censorship of transactions with a 51% attack (although attacking the system they earn from would go against their own interests).
Some solutions can be adopted to counter the centralization of mining:
- Home mining: private individuals mine from their own homes, distributing the hashrate more evenly.
- Mining software: it gives more power to individual miners and helps in the fight against the centralization of hashrate. Some upgrades make Bitcoin mining more decentralized, secure and efficient.
- Geographic distribution: spreading Bitcoin’s computing power around the world makes it harder for a single country to exert control or influence over the Bitcoin network.
In conclusion, decentralization is fundamental for the security and resilience of the Bitcoin network.
New solutions appear every day that allow mining to be done by private individuals and to stay decentralized: for example, modifying ASIC hardware to use it as an electric heater that warms the home while mining Bitcoin, or using mining computers to stabilize the power grid where there is a lot of supply and little demand for energy, and many other possibilities that will help Bitcoin remain decentralized and secure.

