en
Back to the list

How Bitcoin Mining Works

source-logo  coindesk.com 06 January 2022 13:13, UTC

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.

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.9 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 in the form of 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.

Read more: What Does Hashrate Mean and Why Does it Matter?

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.

This article was originally published on Jul 22, 2021.
coindesk.com