Bitcoin
$48,053.17+0.19%
Ethereum
$3,587.19-0.17%
XRP
$1.10-1.48%
Cardano
$2.43-1.26%
Polkadot
$36.26+0.13%
Stellar
$0.330720-2.11%
Dogecoin
$0.241651-1.42%
Chainlink
$29.89-3.47%
Uniswap
$26.32-3.89%
Polygon
$1.39-4.25%
Litecoin
$186.62-1.40%
Bitcoin Cash
$643.09-0.97%
Algorand
$2.09+7.77%
Cosmos
$37.52+14.65%
Wrapped Bitcoin
$48,052.03+0.05%
Filecoin
$84.27-1.45%
The Graph
$0.862630-3.96%
Tron
$0.118710+0.33%
Ethereum Classic
$58.14-0.93%
Aave
$386.77-4.77%
Tezos
$6.80-0.18%
NEO
$50.75-2.88%
EOS
$5.05-0.12%
Monero
$265.83-1.05%
IOTA
$1.52-4.80%
BitTorrent
$0.004067-0.97%
Waves
$30.80-0.01%
Bitcoin SV
$159.89+2.12%
Maker
$2,982.93-3.46%
Dash
$208.93-0.47%
Decred
$145.19+0.51%
Decentraland
$0.847125-2.13%
ICON
$2.02-4.19%
NEM
$0.189671+0.84%
Zcash
$139.35-3.06%
Qtum
$12.74-1.35%
NuCypher
$0.336662-0.06%
Yearn Finance
$34,983.13-3.73%
Bitcoin Gold
$67.28-2.69%
OmiseGO
$8.77-3.63%
Basic Attention Token
$0.779031-1.02%
0x
$1.12+1.34%
Fetch.ai
$0.901568-4.16%
Paxos Standard
$1.00+0.02%
Ren
$1.01-4.05%
Bancor
$4.20-2.36%
Band Protocol
$9.72+1.16%
Siacoin
$0.018893-1.83%
Kava.io
$6.35-0.80%
Nano
$5.66-3.24%
Loopring
$0.471755-7.57%
Storj
$1.42-1.61%
Civic
$0.531913+0.59%
Lisk
$3.63-4.23%
Numeraire
$44.11-1.43%
Orchid
$0.376548-2.68%
PAX Gold
$1,768.06-1.68%
Augur
$26.66+0.24%
Aragon
$5.98-3.46%
Enzyme
$117.08-7.27%
district0x
$0.176991-5.62%
Kyber Network
$1.87-0.52%
SingularDTV
$0.001240-6.32%
Tether
$1.00-0.02%
USD Coin
$1.00-0.03%
Dai
$0.999955-0.05%

How Bitcoin Mining Works

Bitcoins are discovered rather than printed. Computers around the world “mine” for coins by competing with each other.
Jul 22, 2021
Crypto Explainer+
Intermediate

Bitcoin mining is the process of discovering new blocks, verifying transactions and adding them to the Bitcoin blockchain. Here’s what that means, how it works and why it’s important.

In the traditional sense, bitcoin mining encapsulates the same steps involved in unearthing mineral resources; namely requiring huge amounts of energy, time and money to uncover something before others do. Where gold miners use heavy machinery to find gold, bitcoin miners use powerful computers to “discover” new blocks to add to the Bitcoin blockchain.

Each time a new block is discovered, the successful miner is granted the right to fill that block with new transaction data. In return for dedicating time and resources to performing this task, winning miners receive a free amount of newly minted bitcoin known as a “block reward” as well as any fees attached to transactions they store in the new blocks.

The mining process is how new transaction data is added to the Bitcoin blockchain and governs how new bitcoin enters circulation.

How do bitcoin miners discover new blocks?

In order to validate and add new transactions to the blockchain, miners must compete with each other using specialized computing equipment. They use their equipment to generate fixed-length codes known as “hashes” (see below.)  In order to discover the next block, miners must generate a hash that has an equal or higher number of zeros in front of it than the “target hash.”

The target hash is a 64-digit hexadecimal code (comprising numbers 0-9 and letters A-F) all miners are trying to get below in order to discover the next block.

As a starting point, all miners take the data from the previous block, known as the “block header”– which contains things like a timestamp of the block, the hash of the previous block data, and an empty space known as a “cryptographic nonce.” Most of the data in the block header is fixed, meaning it cannot be changed, apart from the nonce. A nonce means “a number only used once” and is the part of the previous block header which miners are allowed to tweak. Remember, just changing a single bit of the input produces a totally different hash.

The tricky part is, hashes are generated completely at random, meaning it’s impossible for miners to know what the hashes will be before they generate them. So it’s simply a case of trial and error until someone finds the right nonce value – known as the “golden nonce.”

This is why miners have to invest in energy-intensive computers, particularly application-specific integrated circuit (ASIC) miners, that can generate trillions of hashes per second.

An easy way to think of bitcoin mining is to imagine each new block is a treasure chest with a combination lock on it. To get the free bitcoin block reward inside and win the right to add new transaction data into it (and collect the associated fees) you have to keep turning one of the number wheels on the lock (the nonce) until you crack the combination (the target hash.)

Combination lock

Here’s an example of what a target hash might look like:

0000000000000000057fcc708cf0130d95e27c5819203e9f967ac56e4df598ee

To see just how difficult it is to generate a hash with more zeros at the front than the above target hash, try creating a winning hash yourself with this free online hash generator. Simply type anything you want in the text box provided and see if it produces a hash with more than 17 zeros at the front!

What is a hash?

A hash is a cryptographic mathematical function that converts any message or data input into a fixed-length code. Think of it as an encryption technique where messages are mathematically transposed into a sequence of numbers and letters of a fixed length.

The outputs have set lengths to make it impossible to guess the size of the input. For instance, the hash for the word “hi” would be exactly the same length as the hash of the entire text of a Harry Potter book.

These hash functions are irreversible, meaning that it’s impossible to revert the hash back to its original input. The same input will also always generate the same sequence of letters and numbers. For example, the hash of “hi” will be the same code every time. Each code generated is completely unique too, meaning it’s impossible to produce the same hash with two different inputs.

In the case of Bitcoin, the blockchain uses Secure Hash Algorithm 256 or SHA 256 to generate a 256 bit or 64 characters long output, regardless of the size of the input.

How rewarding is bitcoin mining?

For every new block added to the blockchain, the protocol – a set of rules programmed into Bitcoin – releases a fixed amount of newly minted coins to the successful miner. This block reward system doubles as the distribution mechanism for Bitcoin.

As part of the programmed measures introduced by Satoshi Nakamoto to steadily decrease the number of bitcoins released over time, the coins awarded to miners are slashed roughly every four years, or 210,000 blocks, in a process known as a “Bitcoin Halving.” In 2009, the block reward was 50 BTC. This figure was reduced to 25 BTC in 2013. The most recent halving occurred in 2020, and saw block rewards fall from 12.5 BTC to 6.25 BTC.

Note that bitcoin has a 21 million maximum supply cap, and we already have 18.7 million coins in circulation. Block rewards will no longer be distributed once 21 million BTC has been released to the market. Once this happens, miners will only be able to earn rewards from bitcoin transaction fees.

Even with this combination of two revenue sources, not every miner generates profits. To make ends meet, a miner’s earnings must exceed the amount spent on electricity and the purchase and maintenance of mining rigs. Also, as mining difficulty increases, large mining operations are forced to expand or upgrade their equipment to maintain a competitive edge.For most average miners who cannot afford to invest in expensive equipment, there’s an opportunity to combine their resources with other miners around the world. Each miner agrees to share rewards according to the contributions of each miner.  These networks of miners are called “mining pools.

Bitcoin mining difficulty

An important thing to know about Bitcoin is that when Satoshi Nakamoto created the protocol, they programmed in a target block discovery time of 10 minutes. This means it should take approximately 10 minutes for a miner to successfully create the winning code to discover the next block.

So how does the network ensure new blocks are discovered every 10 minutes?

The Bitcoin protocol has the ability to automatically increase or decrease the complexity of the mining process depending on how quickly or slowly blocks are being found.

Every two weeks, the Bitcoin protocol automatically adjusts the target hash to make it harder or easier for miners to find blocks. If they are taking too long (more than 10 minutes) the difficulty will adjust downward; less than 10 minutes, it will adjust upward. More specifically, the protocol will increase or decrease the number of zeros at the front. This might not sound like much, but just adding a single zero to the target hash makes the code significantly harder to beat, and vice versa.

The 2021 crackdown on mining activities in China caused bitcoin’s network difficulty to experience its biggest drop in history. This subsequently led to remaining bitcoin miners reporting significant rises in mining revenue.

Through this system, the Bitcoin protocol is able to keep block discovery times as close to 10 minutes as it can. You can track the mining difficulty of Bitcoin here.

While actively participating in the Bitcoin network can be a highly rewarding venture, the electricity and hardware requirements often limit its profitability – particularly for miners with limited resources.

DISCLOSURE

The leader in news and information on cryptocurrency, digital assets and the future of money, CoinDesk is a media outlet that strives for the highest journalistic standards and abides by a strict set of editorial policies. CoinDesk is an independent operating subsidiary of Digital Currency Group, which invests in cryptocurrencies and blockchain startups.

Loading...