Bitcoin mining is the crucial process powering the decentralized Bitcoin network. Learn how it works and why it matters.
Blockpit employs strict editorial principles to provide accurate, clear and actionable information. Learn more about how we create and review content.
Bitcoin mining is the process by which new bitcoins are introduced into circulation and transactions are verified and added to the public ledger, known as the blockchain.
Miners solve complex math problems using powerful computers to add transaction blocks to the blockchain, earning bitcoins and fees as rewards.
This essential process generates new bitcoins, dwindling over time by design, and safeguards the network against fraud.
Want to learn more about Bitcoin first? Start with out beginner’s guide: What is Bitcoin?
{{cta-banner-generic-en="/elements/reusable-components"}}
Mining is the backbone of Bitcoin and as such it plays a crucial role in the ecosystem, serving multiple essential functions:
Mining involves verifying transaction data and adding it to the Bitcoin blockchain. This process ensures that transactions are legitimate and prevents issues such as double-spending, where someone tries to spend the same bitcoins more than once.
By requiring miners to solve complex mathematical puzzles, mining makes it computationally expensive to alter the blockchain. This secures the network against fraudulent activities and attacks, as altering past transactions would require an immense amount of computing power to redo the work of subsequent blocks.
Mining contributes to the decentralization of the Bitcoin network. Since anyone with the necessary hardware and access to electricity can participate in mining, it helps distribute control over the network, preventing any single entity from gaining too much influence.
Mining is the process through which new bitcoins are created. Miners are rewarded with new bitcoins and transaction fees for each block they successfully add to the blockchain. This reward mechanism not only incentivizes miners to keep the network secure but also controls the supply of new bitcoins, mimicking the rate at which commodities like gold are mined from the earth, hence contributing to Bitcoin's moniker as "digital gold."
Mining is a critical component of the consensus mechanism in the Bitcoin network (Proof-of-Work). It ensures that all participants in the network agree on the current state of the blockchain and adhere to the same set of rules, maintaining the integrity and continuity of the blockchain.
Bitcoin is the first digital currency to solve the double spending problem using a Proof-of-Work mechanism in a peer-to-peer network.
Proof-of-Work (PoW) is a consensus mechanism that underpins the functionality of Bitcoin and several other cryptocurrencies. It plays a crucial role in enabling a decentralized network to agree on the state of the blockchain without relying on a central authority.
PoW requires miners to solve complex mathematical puzzles (the work), a process that demands significant computational power and energy (=financial investment). They are in turn rewarded with newly created Bitcoin and transaction fees.
The reward system encourages miners to continuously invest resources in the hopes of earning rewards, making dishonest behavior, such as attempting to alter the blockchain for fraudulent gains, less attractive.
Any attempt to cheat (like double-spending) requires an impractical amount of computational power to outpace the honest network, making the cost of dishonesty significantly higher than the potential rewards.
In the context of game theory, Proof-of-Work creates a competitive environment in which miners are incentivized to act honestly for personal gain, aligning individual interests with the network's security and integrity.
This competition forms the basis of a Nash Equilibrium, a concept from game theory where no participant can gain by unilaterally changing their strategy if others keep theirs unchanged.
Bitcoin mining involves several key steps that ensure transactions are securely added to the blockchain and new bitcoins are generated as a reward for miners. Here's an overview of the entire process:
The mempool (short for memory pool) is a collection of unconfirmed transactions waiting to be included in a block.
When users make Bitcoin transactions, they first get broadcasted to the network and are temporarily stored in the mempool until miners select and confirm them in the next block.
The state of the mempool reflects the current demand for block space on the Bitcoin network. It is influenced by factors such as transaction volume, block size limit, and miner behavior.
Miners pick transactions from the mempool when they are constructing a new block. Transactions with higher fees often have a higher priority because miners are incentivized by these fees.
This means that if the network is busy, transactions with higher fees are likely to be processed faster.
The block header is a crucial component of the candidate block. It contains:
<figure class=”block-table”>
<table>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
<tr>
<td>Previous Block Hash</td>
<td>A reference to the hash of the previous block in the blockchain.</td>
</tr>
<tr>
<td>Merkle Root</td>
<td>A combined hash of all of the transactions in the block.</td>
</tr>
<tr>
<td>Timestamp</td>
<td>The current time.</td>
</tr>
<tr>
<td>Difficulty Target</td>
<td>A representation of how difficult it is to find a qualifying hash for the block.</td>
</tr>
<tr>
<td>Nonce</td>
<td>An initial value of 0, which will be varied in the mining process.</td>
</tr>
<tr>
<td colspan="2">Hashing the Block Header with SHA-256</td>
</tr>
</table>
</figure>
Once the block header is constructed, miners use the SHA-256 hashing algorithm on it to produce a fixed-size output (256 bits)–the hash.
The resultant hash is then compared against the current difficulty target. If the hash meets the criteria (i.e., it has the required number of leading zeros), then the block is valid.
However, given the astronomical odds against finding a valid hash, miners will likely need to adjust the nonce and try again.
The nonce in the block header is modified, incrementing it by one (or using other strategies to change its value) for each new hash attempt. By changing the nonce, the resultant hash changes dramatically due to the cryptographic properties of the SHA-256 algorithm.
Even a minimal change in the input value, such as the difference between "Hello" and "hello", results in a completely different hash value.
The first miner to achieve a valid hash announces the new block to the network for verification, securing their reward of new bitcoins and transaction fees.
As more miners join the network, the hashrate increases, making it more likely to find a new block in less time. To prevent this, Bitcoin automatically adjusts the difficulty about every two weeks to keep the time it takes to add a block around 10 minutes.
Conversely, if miners leave and the hash rate drops, the difficulty decreases to keep block times consistent. This adaptability ensures the network remains stable and functional regardless of changes in mining power.
Miners are remunerated for their efforts in two ways: block rewards and transaction fees.
The block reward, a set amount of bitcoins given for mining a block, decreases over time due to halving events. As the issuance of new bitcoins slows, transaction fees become a more crucial income source for miners.
This shift ensures that as the block reward reduces, miners' reliance on transaction fees increases, maintaining their incentive to secure the network.
One of the defining characteristics of Bitcoin’s tokenomics is its fixed supply cap of 21 million coins. This design was deliberately chosen by Bitcoin's pseudonymous creator, Satoshi Nakamoto, to create a deflationary asset.
Unlike fiat currencies, which can be printed in unlimited quantities leading to inflationary pressures, Bitcoin's capped supply ensures that its issuance is predictable and cannot be altered.
To ease into the 21 million cap, Bitcoin implements the so-called halving events, cutting the miners’ block rewards in half every 4 years and ensuring a gradual approach to its maximum supply limit.
Every 210,000 blocks, or roughly four years, Bitcoin undergoes a "halving" where the block reward for miners is cut in half. Starting with a reward of 50 bitcoins per block when Bitcoin was first launched in 2009, this reward has already undergone multiple halvings and will continue to do so until the block reward approaches zero.
Halvings can lead to higher prices through supply and demand dynamics and often attract increased attention, sometimes triggering bullish market cycles.
We’ve written more about this topic and how it affects Bitcoin’s value: Bitcoin Halving Explained
Let’s take block 700000 as an example.
The block-header is defined by the following parameters:
"version": 1073733636
"previousblockhash": "0000000000000000000aa3ce000eb559f4143be419108134e0ce71042fc636eb"
"merkleroot": "1f8d213c864bfe9fb0098cecc3165cce407de88413741b0300d56ea0f4ec9c65"
"time": 1631333672
"bits": "170f48e4"
Let's assume the difficulty target is
0000000000000000000f48e40000000000000000000000000000000000000000
So our block hash should also start with 19 zeros.
Using nonce = 1 in the block header would lead to a blockhash of:
cf526dcc3304320861af95bd992490caaff2b6f83009ad266a219abd65fe4fbd
As we can see, the block hash starts with cf526dcc3304320861a
This block won’t be added to the blockchain, because it doesn’t fulfill the difficulty rule.
Try nonce = 2 delivers a block hash of:
e241eebfcf7328dde1d4525b060566c719ecb515478d9b7ce9343d0dd174ff5f
We now need to guess several times to find a fitting block hash.
Nonce = 2881644503 would fulfill the requirement - the block hash now is:
0000000000000000000590fc0f3eba193a278534220b2b37e9849e1a770ca959
We just mined a block!
Initially, Bitcoin mining was done with Central Processing Units (CPUs), the versatile brains of computers that handle various tasks. This was feasible when Bitcoin was new, its community small, and mining difficulty low. Yet, as Bitcoin gained popularity and the network expanded, CPUs no longer provided the necessary computational power for efficient mining.
The transition to Graphics Processing Units (GPUs) was a game-changer in mining. GPUs, primarily designed for video game graphics, excel at complex calculations and parallel processing, making them much more effective for Bitcoin's mining algorithm.
Field Programmable Gate Arrays (FPGAs) offered a further leap in efficiency. Unlike GPUs, FPGAs can be customized for specific tasks, allowing miners to finely tune their hardware for Bitcoin's mining algorithm, achieving better performance with lower energy consumption.
The introduction of Application Specific Integrated Circuits (ASICs) represented the zenith of mining technology. ASICs are engineered exclusively for Bitcoin mining, particularly to run the SHA-256 hashing algorithm. Their unmatched speed and efficiency dwarf previous technologies.
However, their inability to perform tasks beyond mining makes them highly specialized tools in the cryptocurrency mining industry.
Bitcoin mining secures the blockchain but exposes a theoretical risk known as the 51% attack, where an entity gains majority control over the network's mining power. This control could allow for transaction manipulation and double-spending coins–first using them for transactions, then erasing those transactions from the blockchain to spend the coins again.
Attackers might use "shadow mining" to create a secret, parallel blockchain, later overtaking the legitimate one by presenting a longer chain. This would invalidate the transactions recorded on the now-discarded blocks, posing significant risks to Bitcoin's security and trustworthiness.
Although feasible in theory, the decentralized nature and significant cost of achieving over 50% mining power make such attacks impractical and unlikely, preserving Bitcoin's security and user trust in its transactional integrity.
Taxation of Bitcoin mining has emerged as a complex issue in many jurisdictions as governments grapple with how to classify and treat cryptocurrency-related activities.
Mining can be seen both as an entrepreneurial activity and as a form of income generation. Consequently, miners may be required to pay income or business taxes based on the value of the Bitcoins they mine.
Additionally, when they subsequently sell these coins, capital gains taxes could apply, depending on price appreciation and jurisdictional rules.
Be sure to check out our extensive collection of Crypto Tax Guides to learn more.
{{cta-banner-tax-generic="/elements/reusable-components"}}
Bitcoin mining's environmental impact is a topic of significant concern. This process requires an enormous amount of electricity to power the specialized hardware needed for mining, leading to a substantial carbon footprint.
The Cambridge Bitcoin Electricity Consumption Index estimates the total Bitcoin electricity consumption for 2023 to be 121.13 TWh–about 0.44% of global demand for electricity in the same year.
Additionally, the production and disposal of mining hardware, which becomes obsolete every few years, generates electronic waste. While renewable energy sources and efficiency improvements offer some mitigation, the growing energy demand of Bitcoin mining continues to pose environmental challenges.
It depends on electricity costs, hardware efficiency, and Bitcoin's market price. It can be profitable for some, costly for others. Joining a mining pool can be worthwhile, as it increases the chance of earning Bitcoin rewards by pooling computational resources.
Specialized hardware (ASICs), a stable internet connection, and access to cheap electricity.
As of now, about 19 million bitcoins have been mined, leaving about 2 million bitcoins left to be mined out of the total 21 million.
Yes, but it's challenging due to high electricity costs and the need for powerful hardware.
It takes roughly 10 minutes to mine a Bitcoin block. The mining difficulty continuously adapts to the computational power of the network, balancing the creation rate regardless of how many miners are competing.
We're glad to hear that you want to learn more about Bitcoin and the world of cryptocurrencies!
Of course, we had to simplify many technical concepts in this article in order to provide an understandable introduction to Bitcoin.
This article was just the first part of our series "What is Bitcoin and how does it work?"
Here you'll find all the entries to help you become a Bitcoin pro in no time:
Bitcoin wallets: what you need them for and how to create them
Advanced insights into the technology of Bitcoin
Or maybe you’d like to jump ahead and learn about the best cryptocurrencies to buy now?
Either way, be sure to also check out our popular crypto portfolio tracker and crypto tax calculator to learn why more than 350,000 crypto investors use Blockpit to make smarter decisions.
{{cta-banner-tax-generic="/elements/reusable-components"}}