What is Bitcoin mining?
In Bitcoin, where there is no central administrator, the issuance of new Bitcoins is done by mining.
The system of Bitcoin is based on the existence of miners all over the world who participate in the mining process.
In this article, I'll explain in simple terms how bitcoin mining works.
Supervisor: Kishin Kato
Has been researching Bitcoin since the end of 2016, and is responsible for explanations on media specializing in Bitcoin information, such as the "Bitcoin Institute".
CEO of Trustless Service Inc/Bitcoiner Hanseikai
This article was written in Japanese and converted to English using a translation tool.
Date of writing (Japanese version): December 2023
What is Bitcoin Mining?
I heard that Bitcoin has a system called "mining"…
To put mining in roughly speaking, it's the process of checking the transactions that take place on the bitcoin network and writing them correctly into the blockchain.
The people who participate in mining are called "miners" and are responsible for keeping the bitcoin network secure.
Miners who perform mining use computers with high computing power to perform mining.
Repeating hash calculations while changing the nance in the block, the first miner to find a hash value below the target adds the block to the blockchain.
*Nance: Number used only once
*Hash value: Irregular value obtained by hash calculation based on the created block
The reward for this is bitcoins for newly generated bitcoins and transaction fees.
The reward system creates an incentive for miners to contribute to the bitcoin network and keeps the network secure.
Mining Flow
- Collection of transactions
→Collect unconfirmed transactions made on the network - Verification of transactions
→Verify that the sender has sufficient bitcoin, that the same bitcoin has not been used before, etc. - Formation of blocks
→Collect verified transactions as a block of data - Adding blocks to the blockchain
→Continues to calculate large numbers of transactions until it finds a number that matches the criteria
The first miner to find a value receives newly generated bitcoins and transaction fees.
How many times a day does mining take place?
New blocks are being created every 10 minutes.
That's about 144 blocks per day.
How the Bitcoin Blockchain Works
I'd like to know a little more about how bitcoin mining works.
Let me start by explaining the "hash function," which is essential to understanding mining in depth, and how the blockchain works.
It's a bit difficult to explain because of the technical terms involved, but I'll try to explain it as concisely as possible.
Reference:ビットコインはどのようにして動いているのか?(How does Bitcoin work?)
(Written by Tetsuyuki Oishi)
Hash Functions
A hash function is a function that returns input data as an irregular string of a fixed length.
Hash Function
- Returns an output (hash value) of a fixed length
- The same output comes out when the same input is put in. No matter who puts in the same input, you get the same output
- If you put in different inputs, you get different outputs. The same hash value cannot be obtained from different inputs.
- Based on the hash value, it is difficult to guess what was input (so difficult that it cannot be expressed at all at the level of trillions of parts per trillion or something like that)
It is astronomically impossible to get to the original input from the hash value of the mystery string! So it's like.
Next, let's look at how Bitcoin uses the properties of the hash function to create a chain of data that cannot be tampered with.
The hash value mechanism prevents tampering.
To ensure that the blockchain can never be tampered with, a hash function is inserted in between to make the blocks intensely associated with each other.
Concept of Blockchain Mechanism
- The transaction data of block 1 is put together and put into a hash function to obtain a hash value
- The hash value of the previous block 1 and the transaction information of block 2 are added together and put into a hash function to obtain a hash value.
- The hash value of the immediately preceding block 2 is added to the transaction information of block 3 and put into the hash function to obtain the hash value.
- Arranging the hash values
When you create a new block, you're mixing in one previous hash value!
For example, even the slightest tampering with the transaction data in block 1 can change the hash value as if it were a different hash value.
This mechanism is surprisingly resistant to tampering.
But if you tamper with one and get caught, why not just tamper with everything after that?
The inventor, Satoshi Nakamoto, came up with an even more clever idea.
He made the calculation of the hash value even more difficult so that it would take a lot of computer power to tamper with it.
Making the calculation of hash values more painstaking (introduction of PoW)
PoW (Proof of Work) is a mechanism that makes the calculation of hash values even more arduous.
A parameter called nonce (nance) is added to the hash value calculation.
There are approximately 4.3 billion possible nance values, and the process must be repeated through trial and error.
When a hash value with leading zeros is obtained, mining is successful.
Every 10 minutes, miners from all over the world repeat the calculation to find the value, and only the first one to find the hash value is considered successful.
The companies that participate in bitcoin mining have a huge array of high-powered computer equipment with huge prices and power costs.
It's very impractical for someone with malicious intent to keep tampering with them.
By making the calculations so hard, you're making sure the bitcoin database can't be tampered with!
How does bitcoin mining work?
How does bitcoin mining work?
From here, I'll give you a quick rundown of the mining process.
Create a "Single Hash Value" Representing All Transaction Data
When a user sends bitcoins, the transaction (transaction data) is temporarily stored in a place called a "memory pool."
Miners select transaction data from the memory pool and combine hundreds to thousands of data entries into a single tree structure using a hash function.
The transaction fees paid by users are received by the miner who successfully mines the data.
Miners prioritize transactions with high fees to maximize their rewards.
Mining Reward
- Block Reward
→ Awarded to miners who successfully add new blocks. New bitcoins are issued and the reward decreases approximately every 4 years. - Transaction Fees
→ A fee paid when users send bitcoins. All transaction fees included in a single block are paid to the miner who successfully mines the block.
So not only the block reward, but also the transaction fee included in the block is received by the miner!
The reason why paying a lot of transaction fees tends to get you approved faster is because the miner is prioritizing taking in the transactions with the highest commission fees.
Mining
The miner who does the mining just keeps changing the nance and repeating the calculation until a hash value with a large number of zeros is found.
Block generation
- Searching for hash values while verifying unconfirmed transaction data & changing nance
- The first person to find a hash value that matches the criteria can create a new block with the transaction data
- Using the hash value found, block information including Nance and hash value is notified to other computers
The block can include a record of the transaction, sending bitcoins to the bitcoin address of the first miner found
Computers that received the block information
- Checks to see if the hash value is the one found, based on the information from the previous block and the new block
- Checks all transactions in the block for irregularities
- If there are no problems, the computer updates the end of the blockchain (database) it maintains with the new block
I was wondering how mining rewards are paid, but I'm surprised that the system includes transaction records for miners who successfully mine.
If a successful miner adds some irregularity to the reward for himself, he won't get the mining reward because it won't be approved by the network.
What do you mean?
The newly created blocks will be verified by other nodes (miners and full nodes), so the fraud will be exposed.
Since other nodes will treat the fraudulent block as invalid, the block itself will not be accepted by the bitcoin network, and you will not receive any mining rewards that you would have otherwise received.
If you do something wrong, you'll be found out!
I'm amazed that Bitcoin is structured so the network works without a central administrator.
Bitcoin Mining Block Rewards Scheduled to End Around 2140
I've heard that bitcoin mining will end in the future…
The block rewards you get for mining will decrease in the future.
But mining itself will continue even after the block reward ends.
Bitcoin mining rewards decrease with each halving
Bitcoin mining rewards decrease with each halving.
Bitcoin has a system in place that halves the amount of bitcoin you receive for generating a block every "halving"
The halving occurs approximately once every four years (every 210,000 blocks).
When bitcoin started in 2009, you got 50 BTC for mining a block.
Since then, it has been halved, and as of 2024, you will receive 3.125 BTC as a reward.
The halving will continue, and it's said that by around 2140, mining rewards will be zero.
Hmmm, if mining rewards are reduced to zero, will there be no reason for miners to mine?
What Happens if the Mining New Issue Amount Goes to Zero?
As block rewards decrease, the weight of transaction (transaction) fees included in a block is expected to increase.
Since transaction fees are freely determined by the user who pays them and fluctuate depending on the number of urgent transactions, etc., it appears that it will still be a long time before fee rewards consistently exceed block rewards.
When the mining reward goes to zero, you lose the block reward, but you get the commission reward!
If the price of bitcoin goes up, or if commission rewards increase with active bitcoin transactions, that could be an incentive for miners to continue participating in mining.
Current Rewards for Bitcoin Mining
As of 2024, the bitcoin block reward is 3.125 BTC.
Commission rewards vary by block and day, but as of November 2023 (at the time of writing), commission rewards have skyrocketed due in part to the BRC-20/Ordinal boom.
Bitcoin Mining Rewards (Example 1)
February 25, 2023: 684.71 BTC in total
- Assuming 144 blocks per day (1 block generated every 10 minutes), averaging about 4.75 BTC per block
- Block Reward: 3.25 BTC (new issues)
- Transaction Fees: on average, about 1.5 BTC
Bitcoin Mining Rewards (Example 2)
November 27, 2023: 901.95 BTC in total
- Assuming 144 blocks per day (1 block generated every 10 minutes), about 6.26 BTC per block on average
- Block Reward: 3.25 BTC (new issues)
- Transaction Fees: about 3.01 BTC on average
Not only mining rewards, but also commission rewards are pretty high!
During times when the bitcoin network is busy, it's hard to complete a transaction without a higher fee.
How to Do Bitcoin Mining
How does bitcoin mining work?
I'll give you a quick rundown on how to do bitcoin mining.
Solo Mining and Mining Pools
There are two ways to participate in bitcoin mining: solo mining, in which an individual participates, and mining pools, in which multiple miners work together.
In mining pools, multiple miners aggregate hash power (computing power), and rewards are distributed according to the level of contribution (percentage of hash power provided). Mining pools are becoming more common because the current mining difficulty is so high that solo mining is becoming more difficult.
Other types of "cloud mining" exist, in which no hardware is involved and hashing power is rented. It is more of an investment product (several cases of fraudulent cloud mining services have been raised) and has a different risk and reward structure than general mining.
Large-scale mining pools include the U.S.-based Foundry USA and AntPool, operated by a Chinese company.
I see that Binance, an overseas exchange, and SBI, a Japanese company, are also in the mining pool business!
Individuals are Likely to Lose Money
The difficulty of mining bitcoin is so high that it is impractical for individuals to participate.
Although an individual miner successfully mined in August 2023, "the probability of success by a miner of this size is about one in seven years," said Con Kolivas of the Solo.ckpool mining service.
In the early days of bitcoin, mining was so much less difficult than it is now that even individual miners could participate.
But as the value of bitcoin has increased, so has the difficulty of mining.
Now it's going to be tough for individuals to participate anymore…
Maybe it's like doing it as a hobby, with a deficit.
Is Bitcoin Mining a Waste of Electricity?
I heard that bitcoin mining is expensive in terms of electricity…
It's true that bitcoin mining uses a lot of electricity, but renewable energy is also being used.
Why Bitcoin Mining Costs Electricity
The decentralized bitcoin network employs a "very labor-intensive PoW" to prevent tampering. By incorporating a mechanism that requires significant cost and effort to attack, it makes it harder to launch a malicious attack.
In the U.S., bitcoin is considered a commodity like gold or oil.
Among financial assets, bitcoin has low emission intensity (CO2 emissions per unit of activity).
In 2020, it was 600 g per KWh, but by 2023 it will have decreased to 296.5 g per KWh!
Renewable Energy is Being Used to Power Mining
While it is true that bitcoin uses a lot of electricity, environmentally friendly mining efforts are underway, and it is said that renewable energy sources account for half of mining power consumption. Mining operators are looking for the cheapest possible electricity to make a profit, and are increasingly utilizing surplus supplies of natural energy that cannot be bought.
In addition, with the ban on mining in China in May 2021, the ratio of renewable energy has increased as the number of miners using fossil fuel-based electricity has decreased.
Reasons for Increased Use of Renewable Energy
- Renewable energy sources such as wind power generate a surplus supply (electricity that cannot be bought), which is purchased by miners during times when electricity prices are low.
- Mining is interrupted during times when electricity prices rise, so it does not compete with consumer demand.
- In Texas, there has been a problem with negative electricity prices (people have to pay if they generate too much electricity), but mining companies are buying surplus electricity at a lower price (Texas has one of the most active mining businesses in the U.S.).
Reference:データから読み解く自然エネルギーとビットコインマイニングの最前線
Renewable power is going to be a surplus at some times of the day.
It's an initiative that benefits both the mining operators and the power companies!
If the mining business spreads, maybe we'll see more renewable energy generation facilities.
The bitcoin mining business is one of the most promising areas.
Is Bitcoin More Electric than Other Virtual Currencies?
I keep hearing people say, "There is a virtual currency that is more environmentally friendly than Bitcoin." What does that mean?
Bitcoin's PoW consumes a lot more power than the PoS that most other virtual currencies use.
I'm sure there are virtual currencies out there that claim "less power than bitcoin = greener."
In contrast to Bitcoin's PoW, many PoS virtual currencies have emerged that feature low power consumption. However, PoW and PoS are completely different in structure and cannot be compared simply on the basis of power alone.
What is PoS (Proof of Stake)?
- People with larger holdings of virtual currency are more likely to be assigned the role of approving transactions (and receive rewards).
- There is a system in which people can participate even if they do not have high-performance machines (wealth is easily concentrated due to the ease of depositing coins with people who can perform the approval work for you).
- The more centralized the mechanism, the faster the processing speed tends to be.
PoW and PoS
- PoS tends to concentrate wealth because large holders of coins are rewarded more, and there is a risk that some whales (coin holders) will dominate the network (e.g., one voting whale can influence the outcome of a governance vote).
- PoW bitcoins have no say in the legitimacy of the chain, even if they hold a large amount of bitcoins (e.g., even if MicroStrategy holds a large amount of bitcoins, they cannot participate in governance voting in PoS, etc.).
- It is easy to create new PoS issues and anyone can issue new coins (some platforms can create new coins in under a minute).
- PoS have been suggested by the Securities and Exchange Commission (SEC) to be potentially securities (rewards based on coin holdings are similar to stock dividends / PoS tokens have a real operator / ICOs, a method of raising capital for virtual currencies, are similar in nature to IPOs for stocks).
It's a system that involves the verification of transactions and block generation based on the amount of tokens you're holding in a PoS. The electricity costs are lower, but there is also a tendency for wealth to be concentrated in a few areas.
You make the point that PoS may be securities. I googled it and found many articles saying "PoS is better than PoW!" I think there are advantages and disadvantages to both.
A Question and Answer on Bitcoin Mining
I'd like to know a lot more about bitcoin mining.
I'll answer your questions about bitcoin mining in a question-and-answer format.
Is Bitcoin mining centralized?
The occasional opinion that "two or three of the top mining pools combined can launch a 51% attack = Bitcoin is centralized" is a bit of a leap to make this claim.
*51% attack…a malicious miner controlling 51% of the network and approving fraudulent transactions as legitimate.
A mining pool is a collection of many small-scale miners who share the revenue, and it is the miners themselves who choose the mining pool. If a mining pool causes an attack, miners can choose to continue to participate in the attack or switch to a mining pool that is not under attack. It is not realistic for more than a few thousand miners to unite within a participating pool to intentionally launch an attack.
If a 51% attack were to happen, the price of bitcoin would plummet, and I don't think it would be beneficial to the miners… But I wonder if some people think something like "I'll make a lot of money if I short bitcoin and bitcoin crashes hard."
I think the short positions that would be worth the huge cost of a 51% attack would be tremendous, but it might be easier for the market to detect the move and prevent a 51% attack from happening. I'm not even sure if there's enough liquidity to trade, and there's also the risk of being liquidated or otherwise not being able to withdraw from the futures exchanges.
By the way, what can a miner do with a 51% attack? Like stealing bitcoins from other people?
What can and cannot be done with the 51% attack
- Can do: authorize double payments (send coins once sent to one address and again to another), refuse to send certain transactions, monopolize mining rewards, etc.
- Cannot: tampering with past transactions, transferring coins from someone else's wallet without permission, changing the issuance limit, etc.
Reference:【ビットコイン研究所Q&A】マイニングの集権化、ライトニング決済とAI、Nostrのポテンシャルと課題
51% attack sounds kind of scary, but it can't take a user's bitcoins or change the bitcoin issuance limit.
Incidentally, in the past, Monaco and Bitcoin Gold, which have smaller hash rates (computation speed) required for attacks, have been subjected to 51% attacks, but Bitcoin's hash rate is orders of magnitude different from these coins, so it is very difficult to perform a 51% attack.
What are bitcoin mining machines used for?
ASICs are used in current mining machines. ASICs are dedicated machines that specialize only in specific calculations and are developed to achieve unparalleled electrical efficiency compared to general-purpose processors.
In the early days of Bitcoin, CPUs and other machines that were relatively accessible to everyone were used. Around 2011, GPU mining spread, and around 2013, FPGA mining spread, and now only even higher-specification mining machines can survive the mining competition.
Mining today is typically a large-scale operation with a large number of ASICs.
It seems that several mining equipment manufacturers are coming out with new models.
I think we may see more competition in the development of energy-efficient and environmentally friendly machines.
[summary] What is Bitcoin Mining?
Key Points
- Mining is the process of checking the transactions that take place on the bitcoin network and writing them correctly to the blockchain.
- Miners who approve new blocks receive rewards, with block rewards decreasing approximately every four years.
- Miners who successfully mine are paid a block reward (newly issued bitcoins) and a transaction fee included in the block.
So Bitcoin is a decentralized network without an operator through the mechanism of mining!
You use a very labor-intensive PoW mechanism to prevent malicious attacks.
I was kind of nervous about bitcoin because it sounds kind of difficult and I don't really know what it is, but I wanted to know more about it.
I want to know more about Bitcoin!
Recommended Articles:What is Bitcoin?
Writer:Sigeru Minami
Creator of "Bitcoin-zukan.com."
Active as a handmade craftsman of Bitcoin goods.