What is Bitcoin Mining?

Bitcoin
Bitcoin
BTC
Select...
BTC

The process of minting new bitcoins is in some ways similar to the process of extracting precious metals from the earth. For this reason, it has come to be known as 'Bitcoin mining.'

As stated in the Bitcoin white paper:

The steady addition of a constant amount of new coins is analogous to gold miners expending resources to add gold to circulation. In our case, it is CPU time and electricity that is expended.

A simplified overview of bitcoin mining is as follows:

  • People compete to earn bitcoin rewards by applying computing power in a process known as 'Proof of Work' (PoW). The process is named such because only participants (miners) who have proven they've dedicated sufficient resources (work) will have a chance at winning the rewards.
  • Approximately every 10 minutes, rewards are distributed to a single winning 'miner.'
  • Rewards are twofold: (1) the 'block reward,' which is newly minted bitcoin. The block reward is currently set at 6.25 bitcoins (but will be cut in half from early May 2024, then cut in half again four years later and so on). (2) the fees associated with all transactions in the current block. End users wishing to make a transaction must attach a fee to the proposed transaction as incentive for miners to include it in the next block.

Why is Bitcoin mining needed?

Bitcoin mining is an essential component of the network's system for arriving at consensus as to the current state of the ledger. It is central to enabling people to securely make Bitcoin transactions.

The Bitcoin network is a globally distributed public ledger consisting of a giant list of timestamped transactions. For example, one ledger entry might indicate that Person A sent 1 bitcoin to Person B at 10am on Monday. The ledger is updated approximately every 10 minutes by adding 'blocks' that contain a list of new transactions. The existence of the ledger, which is voluntarily stored by thousands of participants known as 'nodes,' allows anyone to see both the current state and complete history of bitcoin ownership.

By design, there is no centralized authority deciding which transactions should be added to new blocks. Instead, the state of the ledger (ie. the 'truth') is arrived at collectively and through coordination by nodes in accordance with the Bitcoin protocol. This decentralization is what gives Bitcoin some of it's most interesting properties - namely, censorship-resistance and permissionless-ness.

Most nodes simply validate the authenticity of transactions, store the ledger, and pass on updates to other nodes (again, updates take the form of new blocks added to the chain). However, a smaller group of nodes, called miners, compete to create new blocks. When miners create new blocks, they are effectively updating the state of ledger, or the 'truth' about who owns what.

What is the purpose of Bitcoin mining?

Bitcoin mining serves several functions:

  1. It is a method for distributing new coins.
  2. It is part of a more complete system for ensuring only valid transactions are added to the blockchain.
  3. It is a method for prioritizing transactions given limited throughput (it creates a fair market for limited block space).
  4. It provides financial incentive for participants (miners) to dedicate resources to the network, and the resources dedicated help secure the network from attackers. Note that attackers here primarily refers to miners themselves. In other words, by making it expensive to mine, Bitcoin ensures miners follow the rule.

How does Bitcoin mining secure the network?

Proof-of-Work mining helps to secure the Bitcoin network by requiring potential attackers to commit more resources to an attack than they could hope to gain from the attack itself. In other words, it ensures that attacking Bitcoin is a money-losing (and very costly) prospect, making it exceedingly unlikely to occur.

How does Bitcoin mining work?

The process is summarized in the Bitcoin white paper:

  1. New transactions are broadcast to all nodes.
  2. Each node collects new transactions into a block.
  3. Each node works on finding a difficult proof-of-work for its block.
  4. When a node finds a proof-of-work, it broadcasts the block to all nodes.
  5. Nodes accept the block only if all transactions in it are valid and not already spent.
  6. Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.

Let's break that down into a little more detail.

To begin, miners are the ones who propose updates to the ledger and only miners who have successfully completed the Proof of Work are permitted to add a new block. This is coded into the Bitcoin protocol.

Miners are free to select valid transactions from a pool of potential transactions that are broadcast to the network by nodes. Such transactions are collected into the 'mempool.' Rational and honest miners select transactions from the mempool based on the fees attached to them, optimizing for higher fees. This gives rise to the fee market which helps to ensure the limited block space is used fairly and efficiently.

The first miner to complete the Proof of Work broadcasts her proposed new block to the wider network of nodes who then check to ensure that the block follows the rules of the protocol. The key rules here are (1) all transactions in the block are valid (ie. there are no double spends), and (2) the new block appropriately references the previous block and is numbered as the next in the chain (ie. the new block constitutes the latest block in the longest chain). If it does, nodes send it on to other nodes who complete the same process. In this way, the new block propagates across the network until it is widely accepted as the 'truth.'

However, it can (and regularly does) happen that more than one miner completes the Proof of Work at almost the same time and simultaneously broadcasts his new block out to the network. Moreover, due to network delays and geographic separation, nodes may receive new proposed blocks at slightly different times.

Note that one miner's new proposed block could be slightly different from another's. This is because, as mentioned, miners are the ones who choose which transactions to include in a block - and even though they the tend to optimize for profitibility, location and other factors introduce variation. When two miners send out different new blocks, competing versions of the 'truth' begin to propagate across the network. The network ultimately converges on the 'correct' version of the truth by selecting the chain that grows longer faster.

Let's break down that last part. Imagine there are two competing chains. Let's say 75% of miners select version A (because it was the first version they saw) and begin their Proof of Work for the next block, building on top of version A. The other 25% of miners select version B (again, because that's the version they happened to come across first) and initiate the same process building on top of that version. Statistically, one of the miners working on version A is likely to complete the Proof of Work first, broadcasting the new version out to the network. Since nodes always select for the longest chain, version A will quickly come to dominate the network. In fact, the probability that version B will grow faster vanishes exponentially with each additional block such that by the time six blocks have been added, it's a statistical impossibility. For this reason, a transaction that has been confirmed in six blocks is considered set in stone. Note that a block which doesn't end up becoming part of the longest chain (version B in our example above) is known as an orphan block. It is estimated that such blocks are created between 1 and 3 times per day. Transactions that are included in an orphan block are not lost. If they weren't already included in the version that ends up being the longest chain, they'll end up being added to the next block of the longest chain.

What is Bitcoin's hashing algorithm?

Bitcoin uses a military-grade encryption algorithm called Secure Hash Algorithm 2 (SHA2). Bitcoin miners are awarded BTC when they find a random number that can only be generated by running the hashing algorithm over and over again. This process is analagous to a lottery (where buying more tickets increases your chances of winning). By dedicating more computing power to the hashing algorithm, miners are effectively buying more lottery tickets.

What is the difficulty adjustment in Bitcoin mining?

The difficulty level for the Proof of Work algorithm is automatically adjusted every 2,016 blocks, or roughly every 2 weeks. Adjustments are made with the goal of keeping the mining of new blocks constant at 10 minutes per block.

The difficiulty adjustment factors in the total volume of computing power, or 'hashpower,' being applied to the hashing algorithm. As computing power is added, the difficulty is increased, making mining more difficult for everyone. If computing power is removed, difficulty is reduced, making mining easier.

Note that the difficult adjustment system makes Bitcoin mining quite different from the mining of precious metals. If, for example, the price of gold rises, more miners are enticed to join the market. The addition of more gold miners will inevitably result in more gold produced. By forces of supply and demand, this will eventually lower the market price of gold. In Bitcoin's case, however, the volume of bitcoin produced (minted) is predetermined by the Bitcoin protocol (ie. not affected by the number and power of miners) so no matter how much mining power is directed towards the algorithm, the volume of Bitcoin produced will not be affected.

Is Bitcoin mining legal?

Bitcoin mining is legal in most regions, including the US, Europe, and China.

It Bitcoin mining profitable?

Bitcoin mining is a highly competitive industry with narrow profit margins. The primary input is electricity, although significant upfront investments in hardware and facilities for housing the hardware are also required. The key hardware involved is known the Application Specific Integrated Circuit (ASIC), which is a computing device specialized for running the Bitcoin hashing algorithm exclusively. Profitably relies mainly on consistent access to low-cost electricity applied to the most efficient ASIC hardware.

Bitcoin mining is a naturally equilibrating system. As the price of bitcoin rises, miner margins expand. This entices more miners to join the market. However, new entrants cause the difficulty of minting new blocks to increase. This requires all participants to expend more resources, thereby reducing profitability across the board. Sustained downturns in the price of bitcoin have historically resulted in a portion of miners quitting due to costs exceeding revenue.

How does Bitcoin mining contribute to the price of bitcoin?

In most cases, miners sell their earned bitcoins to cover the costs associated with mining. These costs, then, contribute to the net sell pressure. Miner's attempts to maximize profitibilty by holding or selling Bitcoin based on market momentum may have an impact on Bitcoin's price volatility. Here, the argument is that when the price of Bitcoin is rising, miners may attempt to hold longer in the hopes that they can extract more profit. This would result in less net sell pressure, leading to a faster rise in the price. When the price of Bitcoin is falling, however, miners are likely to sell not only their reserves, but also newly acquired bitcoin. This, in turn, would contribute to volatility on the downside.

Was this helpful?

New to Bitcoin? Get the Bitcoin.com digital wallet trusted by millions:

Get the latest Bitcoin news in your inbox

Get the latest Bitcoin news in your inbox