What is cryptocurrency mining and how does the creation of bitcoins work? [GUIDE 2024]

In recent years, bitcoins have become popular, along with the curious way they are generated. Mining is one of the key factors in creating bitcoins. In this guide, we explain what mining is and how to get started mining bitcoins.

What is cryptocurrency mining

Bitcoin mining is the process of verifying cryptocurrency transactions within a blockchain.

Miners are a type of nodes in the bitcoin network. In addition to containing the transaction history of the network (the blockchain), they provide computing power from their computers to process the transactions.

Their main objective is to find the identification number of each block registered in the bitcoin blockchain. Once they find it, they register it in the network.

This work requires a lot of computational power, so miners are incentivized with money for each block they solve. This is how a bitcoin is created.

The difficulty in mining is transmitted through the Proof of Work (PoW) system. This type of algorithm has traditionally been used to prevent spam in email accounts, but its use in digital money is a novelty. The Bitcoin PoW algorithm is called SHA-256.

Bitcoin Proof of Work Algorithm: SHA-256

Perhaps the explanation of the bitcoin algorithm is somewhat more complicated. Although we have tried to make it as simple as possible, we recommend paying special attention.

The Bitcoin system is designed to make adding a block to its blockchain very costly (in terms of time and resources). This way, the indiscriminate generation of blocks is prevented.

This is done through a Proof of Work algorithm. The Bitcoin algorithm is called Hashcash-SHA-256 or simply SHA-256 Algorithm.

This algorithm creates a hash for each of the blocks based on the data of the transfers it contains. A hash is a random number that encrypts all the information that a block contains: BTC amount, date, time, sender, recipient, verification number, etc... It also stores an identification with the previous block.

What is a hash for dummies

In terms of computing, a hash is the result of complex mathematical operations, easy to reproduce but impossible to reverse and difficult to predict.

That is, a hash is an alphanumeric code generated randomly, but very difficult to guess.

In short, all the information contained in a block of the blockchain is encoded in an unpredictable manner through mathematical operations. The result of these operations is an alphanumeric code, similar to the following:

00000000000000000030aa787fb2593a43b823f3733595b669cc07f5ad345083

The proof of work consists of finding the verification number that each block of the network contains. In other words, finding the specific hash of each block, which as we have said, is a difficult task.

The specific code of each block is called a nonce. Since a hash is generated in an unpredictable way, the nonce cannot be known in advance.

The search for that number is done iteratively, by trial and error. That is, random numbers are tested over and over again until the exact nonce is found.

This requires a lot of computational power: A computer connected to the Bitcoin system constantly performing search operations. Each of these connected computers is known as Bitcoin miners.

In short, a hash is nothing more than a very secure encryption. As it is calculated with the block data, if any original data changes, the Bitcoin algorithm would yield a completely different hash. Since the blocks are connected to the previous one through their hash, if this hash changes, the hash of the next block and so on also changes.

Cryptocurrency mining is highly competitive and requires high-powered equipment. Typically, specialized and expensive equipment is used. Additionally, these machines must be connected 24 hours a day, consuming a lot of electricity.

How Bitcoin Mining Works

In the traditional economy, Governments issue banknotes according to the needs or intentions of politicians, thereby being able to manipulate the value of money.

On the other hand, money transfers are controlled by banks, which have to authorize and verify each one of them, often manually.

Two of the main functions of cryptocurrency mining solve these two problems.

On one hand, through mining, bitcoins are generated. As we saw in the characteristics of bitcoin, it is a deflationary currency. This means that its issuance is limited, specifically to 21 million units by 2140.

» Related article: How Many Bitcoins Are There.

To maintain the Bitcoin network, miners contribute computational power from their computers and, in return, they are rewarded. Every 10 minutes, a block is generated and miners who manage to add it to the Bitcoin blockchain are rewarded with BTC. This is how bitcoins are created. There is no other way.

On the other hand, this process occurs automatically. During the 10 minutes it takes to generate a block, miners manage all transactions that take place. Computers verify that the sending wallet has enough funds and that the receiving address exists. If everything is correct, they include it in the block, which they execute after 10 minutes.

Automating this process allows for considerable time and money savings compared to traditional economy.

What is mining for?

As we have just seen, two of the main functions of mining are the creation of bitcoins and the automation of transfers. However, mining plays a very important role in bitcoin security.

Among the security goals of mining are to prevent DoS attacks and double spending.

Denial of Service Attacks (DoS)

Denial of Service attacks (DoS, for its acronym in English) is a common and somewhat old practice among hackers. It involves sending a large amount of information to a server from a computer to saturate it and interrupt its service.

This practice has evolved into what is called DDoS or Distributed Denial of Service. In this case, many computers send information to a single server to stop it. Hackers often use this technique to render, for example, government websites inoperative.

Can you imagine a network of computers attempting to saturate the Bitcoin blockchain? Bitcoin miners act as a filter to prevent DDoS attacks. Before introducing transactions into the blockchain, miners verify each one of them, denying those that are not genuine transfers.

Double Spending

Double spending is a problem that financial institutions have historically had to face and is one of the main reasons why transfers are still not instant.

It occurs when a person sends two transactions at the same time and the sum of their amounts exceeds the total balance of the account from which it is made. Can it be ensured that a computer program would process only one of the transfers? Banks have not found a secure way to guarantee this and, therefore, they still take so long to complete.

On the other hand, in bitcoin it is done automatically... How?

By waiting for up to 6 confirmations.

Each of the transactions is verified by miners, confirming that the sender has sufficient balance and including it in a block if it is valid.

When a block is created with all the transactions from the last 10 minutes, it is verified again before including it in the blockchain. But it is not verified by one miner, but rather by six. When the block receives confirmations from 6 different miners, it is validated and included in the blockchain, checking each of the transactions in the block one by one.

Therefore, there will always be one of the transactions that will be verified first, up to 6 times. As soon as that happens, the other transaction will be automatically processed as invalid, so double spending will not be possible.

Bitcoin mining is legal in all countries where virtual currency is legal, such as Spain or Latin American countries.

In most of them, specific legislation has not been developed. However, this does not mean that this activity has no tax implications.

If you decide to mine bitcoins, you will make an investment, have expenses such as electricity consumption, and benefits in the form of BTC. In other words, you will engage in a commercial activity. In these countries, all commercial activities must pay taxes.

If you want to learn more about the tax implications of bitcoin mining, you can read the section on bitcoin taxes.

How to start mining bitcoins

Bitcoin mining is very competitive. There are more and more miners using advanced equipment. Therefore, if you are determined to learn how to mine bitcoin, you will need to design a good strategy beforehand.

Get a bitcoin wallet

The first thing I need to mine bitcoins is a wallet to store the BTC you receive as a reward.

Keep in mind that you need a specific bitcoin wallet. If you use a wallet from another cryptocurrency, you will lose your BTC.

If you are not sure which wallet to use, we have created a guide where you can learn about the most secure ones in the section on how to store bitcoins.

Choose a Bitcoin miner

Once you have your wallet, the next step is to buy mining equipment for Bitcoins. You can do it with your computer, however, they are not optimized and you will probably not be able to mine anything.

Therefore, it is advisable to acquire specialized hardware that will be dedicated to mining all the time.

The hardware used in mining are CPUs or computers, which as we mentioned are inefficient, graphics cards or GPUs, more efficient in mining Ethereum, and ASIC chips. The latter are the equipment that offers the highest performance for mining Bitcoins.

These devices are not cheap, so before acquiring one, you must analyze several factors such as the hash rate (mining power), the initial cost of the hardware, its power consumption, and its profitability. You can use a mining calculator to help you make a decision.

Among the most popular and efficient machines for mining Bitcoins are the AntMiners. The latest generation is the AntMiner S9. There are also the models AntMiner D3, with higher hash rates but lower performance.

Join a mining pool

As we have mentioned, bitcoin blocks are processed every 10 minutes.

Do you think that alone, competing with the thousands of miners that exist, you will be able to process a single block? The reality is that it is very complicated.

That is why mining pools were created to mine bitcoin. Through them, many miners gather to combine the computational power of their equipment and have more chances of finding a block. If they succeed, the reward is divided proportionally to the mining power contributed by each miner.

To join a mining pool, you just need to choose one, create an account, and install the required software.

The most commonly used ones are AntPool, BTC.TOP, and BTC.com, although there are many more.

Each of them has different characteristics, such as the reward method, ease of fund withdrawal, or if they charge commissions. Therefore, it is recommended to consult forums and specialized websites to help you make the decision.

Install mining software

At this point, the last thing you need to do is install a mining client on your computer. The software depends on the mining equipment, although there are also some mining pools that require specific software.

There are clients available for Windows, such as BTCMiner or Bitcoin Miner; others are compatible with Linux, such as BFGMiner, EasyMiner, and CGMiner; and there are also specialized options for Mac, such as MacMiner or RPC Miner.

Start mining

At this point, the only thing left is to start your miner and wait for it to find blocks to receive BTC as a reward.

Connect it to the power source, then to the computer where you have installed the mining software, configure it, and start running.

The mining difficulty

The difficulty is a value that is used to show how difficult it is to find the nonce. It is a feature of the bitcoin network, which has a global difficulty set for all blocks.

The difficulty changes every 2016 blocks. If blocks are processed every 10 minutes, it should vary approximately every 2 weeks. But this is not always the case, because if the difficulty is very high, not all blocks may be found instantly.

If the previous 2016 blocks were found in more than two weeks, the difficulty will be reduced. If, on the other hand, they are found more quickly, then the difficulty will increase.

The more miners there are, with more powerful equipment, the more likely it is to find blocks on time, so it is normal for the difficulty to grow.

You can check the current mining difficulty here.

Is bitcoin mining profitable?

At first glance, bitcoin mining seems like a gold mine: Connect a machine to start generating money. However, the reality is not so pretty: The competition to find cryptocurrencies is very high and the equipment and maintenance costs are very expensive.

When calculating the profitability of mining, it is necessary to take into account several factors:

  • Your equipment's power. Your investment's profits depend on it. There are multiple calculators to estimate the BTC you will mine based on the hashrate of your equipment.
  • The cost of the miner. They are expensive devices and represent the main investment that you will have to cover with the profits you obtain.
  • The electricity cost. Mining machines work 24 hours connected to the electrical grid and are devices that require a lot of energy, so the electricity consumption will be your main expense.
  • Lifespan of the equipment. On one hand, the machines can reach the end of their useful life. This usually happens after 2 years, when they have usually been amortized. However, bitcoin mining is progressing rapidly and the technology can become obsolete much sooner, forcing you to replace it with a newer one.
  • The value of bitcoin. If the value of cryptocurrencies decreases, your investment may no longer be profitable.

But the reality is that, even if you buy one of the most modern devices of the moment, it is likely that mining will not be profitable. This is because mining has gone from being a domestic activity to an industrial one, especially in China. In this country, industrial buildings have been built full of thousands of mining machines working around the clock.

It's impossible to compete against them...

Therefore, if your idea is to invest in mining seeking profitability, it seems like it's not a good idea.

Did you find it interesting to learn how a bitcoin is created? Learn much more about the virtual currency in our bitcoin course.