logo academy

Bitcoin mining: what is it and how does it work?

March 22, 2023

8 min

Bitcoin mining: what is it and how does it work?
Beginner

To understand what Bitcoin mining is and how it works, we have to consider the nature of cryptocurrencies: since there is no central controlling authority, there is no ‘bank’ that manages BTC exchanges and mints new coins. In fact, Bitcoin is administered by a network of independent nodes that abide by rules defined by an algorithm. This decentralised network is in charge of the shared ledger of transactions: the blockchain, whose blocks of information are created and hooked precisely through Bitcoin mining.

What is Bitcoin mining? Meaning and Purpose

Some nodes in Bitcoin‘s network solve complex mathematical problems, using sophisticated power and hardware. This fair amount of work goes into producing the blocks of the blockchain, safeguarding its security and issuing new coins. This is the starting point for understanding the meaning of Bitcoin mining, but let’s delve deeper into what it is and how it works. 

The first objective of this process is the validation of transactions: the blocks created contain the information on these exchanges, which are thus stored and confirmed without the possibility of modification. In a nutshell, the blockchain tracks all cryptocurrency movements, so as to provide irrefutable proof of their authenticity and thwart attempts at double-spending. Everything Bitcoin mining records in blocks is verified, without the need for authorities and intermediaries, and is available in an eternal and immutable history. 

The commitment of the nodes that take care of the blockchain must be rewarded, because Bitcoin mining operations are expensive and no one would participate without financial return. Each block, therefore, corresponds to a reward in BTC (block reward), sent to the wallet of the creating node. The second purpose of the mining mechanism, therefore, is the issuance of new coins as a reward: 21 million Bitcoins, the maximum set supply, will be released in this way. In this regard, as we will see in the section explaining how Bitcoin mining works, the incentives are scheduled to gradually decrease over time. In addition to the block reward, fees paid by users to carry out transactions are also distributed.

The nodes that perform the calculations to create the blocks are called miners, precisely because they ‘mine‘ cryptocurrencies as if they were minerals. This explains the meaning of Bitcoin mining from an etymological point of view. Satoshi Nakamoto‘s crypto is also referred to as Digital Gold by the community, although the comparison to gold does not relate to mining, but derives from the reserve quality of value that some recognise in BTC.

How does Bitcoin mining work?

The entire network participates in the creation of a block, but it is only one miner who receives the rewards; let’s therefore summarise in essential steps how Bitcoin mining works. First, when a transaction is made on the network, it is transmitted to all nodes. Each of them verifies its validity, based on the rules of cryptography: in a nutshell, by comparing the public key and the sender’s ‘signature’, it is ascertained that the latter is the legitimate owner of the funds. The transactions, if approved by the majority of the network, are then aggregated in the mempool: a sort of ‘waiting room’, from which they will be retrieved to be registered on the blockchain. At this point, the miners must create a new blockchain by solving a complex mathematical problem. These nodes compete with each other, because whoever finds the solution first will receive the valuable reward.

In short, this is the process that explains how Bitcoin mining works, but it is useful to set some technical parameters for a better understanding. First, it is essential to know that Bitcoin blocks must be produced every 10 minutes: this block time is programmed and stored by an algorithm. In practice, an automatic mechanism increases (or decreases) the difficulty of mining, so that the time per block is kept constant. In this way, the blockchain should be protected from spam attacks and, above all, it is possible to predict the distribution rate of new Bitcoins. Every 2016 blocks (approx. 2 weeks), therefore, the average block production period is evaluated and, if necessary, the complexity of the calculations to be performed is corrected. 

In this regard, the puzzle to be solved consists in determining the hash of the block, i.e. the alphanumeric string that identifies it. This sequence is obtained by processing and ‘summarising’ various pieces of information with a mathematical function. The data to be processed, however, are not only known elements, such as transactions. The real meaning of Bitcoin mining, in fact, lies in finding a random number (nonce) that, together with the other factors, can generate the right hash. Miners basically work by trial and error and, to see if the result is correct, they compare the calculated combination with a target value, defined by the mining difficulty. If the value of your hash is less than or equal to this coefficient, they have found the right sequence.

NB

The hash constitutes proof of the work done, which is why Bitcoin’s consensus mechanism is called Proof-of-Work. This algorithm, in general, is employed by all mining-based blockchains. 

Once the exact hash is found, the corresponding block is created and the miner is rewarded with a certain amount of BTC. Initially, the reward was 50 per block, but every 4 years or so (210,000 blocks) it has been halved. Currently, the block reward is 6.25 BTC, but with the next halving, the mining reward will again be reduced by half. This mechanism, together with the fixed time per block, schedules the issuance of the crypto so as to make it a scarce resource and control the inflation rate.

Bitcoin mining: cost or profit?

The price of Bitcoin from the genesis block (3 January 2009) to today has increased exponentially, so the profit from mining should also (in theory) be higher. Halving itself, although reducing the rewards, makes it more profitable, because it generally has a positive effect on the value of the cryptocurrency, as suggested by models such as Stock-to-Flow. In parallel, however, competition between miners has also grown, exploiting increasingly powerful devices. As a result, Bitcoin mining is increasingly difficult, but this is good because it has made the network more secure.

In practice, a hacker would need to control at least 51% of the total computing capacity (Hash Rate) to attempt to tamper with the blockchain. But since we now know how Bitcoin mining works, we can guess that this is impossible: the Total Hash Rate is very high, as is the difficulty, not to mention that mining devices are very expensive. In fact, it is no longer possible to produce blocks with the CPU of a simple computer, but mining rigs with multiple graphics cards (GPUs) or even Application-Specific Integrated Circuits (ASICs), hardware designed specifically for mining cryptocurrencies, are used.

NB

Given the costs and the fierce competition, many prefer ETFs to actual Bitcoin mining: financial instruments based on the securities of companies engaged in this activity, so as to try to earn money indirectly.

Making money from home mining, even with the most sophisticated device, however, is unlikely: the only way to get rewards is to join a mining pool. These huge data centres rely on the computing capacity of multiple devices: Foundry USA, AntPool and F2Pool are the main ones. If the devices are hosted in the same place, it’s called a farm, but to participate you can also ‘rent’ computing capacity through cloud mining solutions. In any case, participating in a pool means paying a fee and sharing the rewards, thus limiting your earnings from mining.

Total Hash Rate by Mining Pool

Finally, to complete the explanation of what Bitcoin mining is and how it works, we have to consider the cost of energy, which dwarfs its earnings. Indeed, miners have to use part of the rewards essentially to pay for electricity. In this regard, energy sustainability is one of the most critical aspects of what mining means.

However, for Bitcoin, changing the consensus mechanism from Proof-of-Work to Proof-of-Stake (as Ethereum did with Merge), so as to reduce the environmental impact, would be technically complex. Miners prefer to adopt alternative, green solutions, such as hydroelectricity, or exploit energy surpluses that would be wasted if not exploited to mine Bitcoin.

Related