Updated: September 2020
Bitcoin mining is the backbone of the Bitcoin network. It underpins the security of Bitcoin and plays an essential role in ensuring the network keeps its key properties such as censorship-resistance, immutable transactions, and permissionless payments.
But what exactly is Bitcoin mining. How does it provide security to the Bitcoin network and how does it operate? In this HASHR8 educational, we will detail how Bitcoin mining is fueled by hashrate. We will explain why mining is needed to establish the security assurances of the Bitcoin network and how it aligns the incentives of Bitcoin miners with those of the network.
Why Bitcoin Needs Mining?
The dominant money of today’s world is fiat currency. Entities such as banks, governments, and payment processors play essential roles in governing the financial system that fiat currencies operate in.
Central banks determine the money supply and the cost of money (i.e. benchmark interest rates). Governments work closely with central banks to access credit and finance deficits.
Payments made through the system mostly go through a series of intermediary entities which comply with regulations set by governments. In return, a hefty fee is often earned by these payment processors.
Each of these entities need to be trusted. They need to be trusted not to overinflate the money supply, not to abuse the Cantillon effect, and to process our payments as we wish.
For a monetary system to function without intermediaries, a centuries old problem needs to be overcome. The Byzantine Generals Problem is a theoretical problem which has yet to be solved.
Simply put, the problem addresses how parties can reach consensus without having an intermediary to ensure trust. To date, the process of Bitcoin mining has successfully established consensus among a distributed network of nodes.
Proof-of-work (PoW) mining has incentivized participants in the network to act according to the rules of the Bitcoin network. The costly process of PoW mining means that those who mine Bitcoin but act against the consensus rules of the network lose significant sums of capital.
What is Proof-of-work?
PoW mining is the process of computers competing for a reward by hashing a cryptographic mining algorithm to meet an output of a predetermined difficulty level. Bitcoin miners hash four inputs into the SHA256 cryptographic algorithm – the transactions of a block, the hash of the previous block, the timestamp, and the nonce (a random number).
If the output of this cryptographic function meets a certain difficulty level, the block is accepted by other nodes on the network and the miner is rewarded. Because all miners are competing to append blocks to the Bitcoin network, the difficulty rises as more miners join and drops as miners fall.
The difficulty adjusts every 2016 blocks and this process keeps miners finding blocks at a rate of roughly one per ten minutes. When a block is successfully appended, a miner can send the first transaction to their own address (known as the coinbase transaction).
This coinbase transaction compensates the miner with the block reward. This block reward consists of a subsidy of newly issued Bitcoin and all fees associated with the transactions in the mined block.
The block subsidy is currently 6.25 BTC. The amount of newly issued Bitcoin halves every 210,000 blocks and will continue with this process until a total of 21 million Bitcoin are mined.
Different cryptocurrencies use different mining algorithms. The cryptographic hash function which miners hash on the Bitcoin network is SHA256.
The Evolution of Hashrate
When miners are working on the hash function, they are solving a mathematical problem. This mathematical problem can be solved by hand. In 2014, it took an experimenter roughly 1.5 days to get one output. This is one hash. At that time, the experimenter’s hash rate was 0.67 hashes per day. The most powerful mining equipment can currently carry out 110 trillion hashes every second!
Hashrate is the fuel for carrying out PoW. A miner can expect to mine more blocks as their share of total network hashrate increases. If one miner controls around 10% of the Bitcoin network hashrate, they can expect to mine roughly one in ten blocks.
When the Bitcoin network launched in 2009, the project was only known to a small group of people. The small number who mined when the network launched simply used their CPU.
As Bitcoin became more popular and the bitcoin currency began to have a market value, more people turned to mining. It wasn’t long before miners started using more powerful hardware to increase their hashrate output.
The first advancement in the evolution of mining hardware was GPUs which gave performance gains over a CPU. By deploying more powerful hardware, the difficulty level of Bitcoin mining was pushed up and CPU mining quickly became unfeasible.
FPGAs arrived shortly after GPUs. FPGAs provided further performance gains but were still programmable which meant that their performance would always be significantly lower than chips which were specialized for a single purpose.
In 2013, the first application specific integrated circuit (ASIC) Bitcoin mining equipment was delivered to market. These Bitcoin ASIC computers were specifically designed to mine the SHA256 algorithm. The difficulty level of mining Bitcoin began sharply rising in late 2013 when ASICs became widely distributed to miners.
The hashrate performance of ASICS and the consequent difficulty jumps made all other hardware types obsolete. Since the release of the first ASIC, an arms race has taken place among manufacturers of this hardware to deliver the most powerful and efficient ASIC equipment.
Hashrate as the Security Infrastructure of Bitcoin
But how does PoW mining and the hashrate that fuels it secure the Bitcoin network? The cost expended on PoW mining can be considered to be the security budget for the Bitcoin network.
How big the security budget for Bitcoin needs to be is widely unknown. However, the cost associated with PoW mining closely ties the incentives of miners with those of the network.
Bitcoin mining has advanced to the stage where billions of dollars of capital have been invested in facilities, energy contracts, and specialized mining equipment. It is currently estimated that over $17.5 billion of capital has flowed into the Bitcoin mining industry.
If miners act against the interests of the network, the capital they have invested is put at risk. As their balance sheets are tied to the value of Bitcoin and the specialized mining hardware, it is in their interests to mine according to the rules of the network.
Furthermore, the difference in cost to set up mining equipment versus to set up the hardware to be a run a node is a key factor which keeps miners honest. When the network initially launched, the miners and users were the same in most cases.
A user is considered an entity which runs a full node. Full nodes keep a record of the blockchain and distribute valid blocks to other nodes which they are connected to.
If a miner appends a block but doesn’t follow the consensus rules of the network, the block will be rejected by nodes on the network. Nodes can be set up for roughly $100 worth of hardware while miners undergo an extremely costly process to find winning blocks.
According to economic theory, if a block has rewards of $70,000, miners will bid up the cost to add that block to roughly the same value. If miners fail to comply with consensus rules when they find a winning block, nodes will reject that block and the potential rewards of $70,000 will be lost.
For instance, in July 2019, a block mined by Antpool set the block subsidy at 13.26 BTC instead of the then 12.5 BTC block subsidy. This resulted in the mining pool losing roughly $150,000 worth of rewards.
The Whole World Strives for Hashpower
To successfully attack the network, a malicious entity would need to capture over 50% of the hashpower. This would allow this entity to build a longer chain and double spend Bitcoin which they had previously used in a transaction.
However, the logistics of carrying out such an attack seem almost unthinkable to anybody with industry knowledge. For years, the entire mining industry has strived to maximize its hashrate output.
Any latest-generation ASIC rigs which are released have always secured willing buyers. To accumulate enough hashrate to attack the network would require convincing over 50% of miners to either sell or rent their hashpower.
Other Hashrate Security Considerations
The security of Bitcoin is not solely tied to the cost associated with mining. How hashrate is distributed among actors also has important ramifications for how the properties of the Bitcoin network are assured.
Bitcoin hashrate being centralized among a small number of mining pools is a recurring criticism of its security. Almost all major mining pools are based in China and typically only 4-5 will represent over 51% of the Bitcoin hash rate.
Collusion among these pools may allow them to somewhat discreetly build a longer chain and double spend transactions. The concern is commonly raised and it also argued that the network is more susceptible to takeover by the Chinese government given the high concentration of hashrate and mining management companies in China. However, some have argued that these risks are overstated.
How discreetly such an attack could be carried out is questionable. An over 50% drop in the hashpower which is mining on the current longest chain would unlikely go unnoticed. Furthermore, if miners act in a profit-maximising manner, accumulating a large portion of hashrate would be likely used to mine coins instead of attacking the network. In the event that an attack was carried out, it may not be as damaging as some would expect. The attacking entity could only double spend their own coins and users may be unphased by this event. In a more turbulent scenario, users may choose to change the mining algorithm or code to address such an attack.
Nonetheless, hashrate being concentrated among few entities does expose the network to certain risks. Many in the mining industry have been working hard to further distribute the hashrate. Mining pools and operations have set up with the main aim of attracting more hash rate to North America. Furthermore, Braiins has been working on an improved protocol between miners and mining pools that would allow individual miners to run a full node and choose their own transactions. This would effectively prevent mining pools from using their hashpower for malicious purposes.
What is Bitcoin Mining?
In summary, Bitcoin mining is the process of computers appending blocks to the Bitcoin blockchain. The blocks must adhere to the consensus rules of the Bitcoin network or will otherwise be rejected by nodes. The hardware used to mine Bitcoin quickly evolved to specialized equipment with a hashrate capacity that made other types of hardware obsolete.
Bitcoin mining underpins the security of the Bitcoin network. Mining has become an extremely costly process which closely aligns the incentives of Bitcoin miners with the long-term health of the network. It is estimated that over $17.5 billion has been invested in Bitcoin mining. It is difficult to quantify how much mining cost is sufficient to secure the properties of the Bitcoin network. Furthermore, there are more nuanced risks such as concentration of hash rate. Nonetheless, those in the mining industry have been pushing the costs associated with mining and also proposing innovative solutions to potential problems such as the concentration of hashrate.