A Guide to Bitcoin’s Proof of Work Algorithm

Damian Grasso
Geek Culture
Published in
7 min readMar 28, 2021
Photo by Dion Beetson on Unsplash

One of the biggest features of blockchain technology is not trusting a central authority. As long as a central authority has the power to record transactions and define which are valid, there is opportunity for that authority to misuse that power and manipulate transactions.

The creators of Bitcoin and other decentralised blockchain projects recognised this, designing their systems to distribute trust across many actors in their economies.

These actors, usually called ‘miners’, are tasked with recording and grouping transactions into blocks, which are then added to the blockchain.

The process of adding blocks into the blockchain and choosing the most up-to-date version is determined using a consensus algorithm, of which there are many types. Bitcoin uses a type of algorithm called proof of work.

This article explains the algorithm and how valid transactions are decided, as well as the benefits and limitations of using it.

What’s Proof Of Work?

Proof Of Work is the method of one party proving to other parties that a certain amount of computation power was used to complete a task. When people say Bitcoin uses “proof of work”, they’re referring to an approach which could be fulfilled by a number of algorithms.

The algorithm used by Bitcoin is a variant of Adam Back’s Hashcash algorithm, which was proposed as a countermeasure to spam messaging and denial-of-service attacks. Hashcash was originally proposed as a way to slow malicious actors by making them play an expensive game of chance.

In the Bitcoin implementation, blocks are added to each miner’s blockchain when one miner solves the game of chance, which should take about 10 minutes. All miners attempt to solve the game, but only one miner wins and receives the bitcoin reward and transaction fees.

The longest copy of the blockchain held by any miner is considered the most valid, because that blockchain has the most computational work put into it.

In More Detail

In order for miners on a network to add blocks to the blockchain, they are required to guess a number which is less than or equal to a Difficulty Target. This value is anywhere between 1 and 2²⁵⁶, which is increased or decreased to change the difficulty required to guess the number.

To generate this number, the mining software takes the header of the block they are trying to add and uses SHA-256 encryption to hash it. The header contains key data required by the block to make it secure, including a nonce (number used once) value in the header.

This number is altered by miners each time they try to guess the number. If the number generated by the hash (SHA-256 hashes are hexadecimal numbers) exceeds the Difficulty Target, the process is retried until a number less than the value is found.

An example of a block in the blockchain, header data highlighted. (Source: btc.com)

The higher the target value is, the higher the probability of guessing the number and vice-versa. It is easier to guess the number if a miner has more computing power, because more computation will help find the number quicker.

The miners are rewarded in bitcoins and transaction fees if they are the first to find a number less than or equal to the Difficulty Target. Every 4 years the block reward halves, slowing inflation and making each coin more scarce, which should increase the value of 1 Bitcoin (if people recognise its value).

This is designed to keep miners invested even while as they earn less Bitcoin units.

Another key aspect of the design is that the Difficulty Target aims to ensure blocks are added to the blockchain every 10 minutes or so — regardless of the computing power on the network.

The reason for this is not specified, but it could be for a couple of reasons:

  • It impacts the blockchain’s size which directly impacts security
  • It enables for quick settlement of transactions on the network

To ensure the target value keep blocks validating around this time, the Difficulty Target is adjusted every 2,016 blocks to accommodate changes in computing power on the network.

This implies 2,016 blocks should be mined in approximately 2 weeks, because:

> 10 minutes * 2,016 blocks = 20,160 minutes = 2 weeks

If 2,016 blocks were mined in 1.5 weeks instead of 2 weeks, this would mean the average time to mine a block is 7.5 minutes. In order to move the average block mining time closer to 10 minutes, the Difficulty Target would be increased so the average chance of guessing it takes one third longer.

Benefits

Proof Of Work Is Secure By Design

The biggest benefit is the hefty computational power required to control the blockchain.

As seen above, the computation required to mine blocks is very high, and miners are only rewarded if they are the first to generate a number less than or equal to the Difficulty Target.

If a miner tried to create a block with fake transactions, they would be creating a block which is different from the other miners. Although this may be accepted initially by those miners, other miners would be producing real blocks.

In that case, there would be 2 different “paths” of the blockchain in existence, and miners are required to accept the blockchain with the most blocks. If there are 2 paths in the blockchain of the same length, they wait until one becomes longer.

For malicious actors to continue the fraud, they would need to control over half the computing power of the network to stop others from overtaking them. The energy and hardware costs would makes it infeasible to continue in the long term, and fraud could cause people to sell Bitcoin rapidly.

Both of which would reduce the size of the reward.

Difficulty Adjustment Keeps Miners Incentivised

The adjustment of mining difficulty is designed to keep miners on the network, ensuring the longevity of the Bitcoin platform.

When computing power decreases (because miners depart the network or scale down their operations), this drops the difficulty for the remaining miners. This incentivises others to join the network.

When computing power increases (because more miners join the network or computing power increases), the difficulty increases to give more chances to win and reduces the chance of miners with more computing power outperforming others.

Limitations

Inefficient (By Design)

The resource consumption of Bitcoin’s proof of work algorithm is its greatest weakness.

Although the algorithm was designed to make Bitcoin’s blockchain difficult to manipulate, the energy consumption required to securely process transactions is estimated at 88.29 TwH, similar to the energy consumption of Belgium.

If Bitcoin was a country, it would rank 37 in the world for energy consumption. (Source in image)

When the price of Bitcoin goes up, more miners are incentivised to join the network to earn revenue from the block mining reward and transaction fees. To have a better chance of revenue, miners may increase their computing power which would make other miners to upgrade to compete.

To counteract the increase in computing power, the difficulty of mining is increased to ensure blocks are added every 10 minutes on average. This creates a computing arms race which increases the power requirements of the network.

Centralisation (Ironically)

In order to send Bitcoin between wallets, users are dependent on miners to process their transactions and add those into the blockchain.

In 2021, mining has a high barrier to entry because the cost of mining equipment and electricity is unrealistic for most people.

Bitcoin was mineable on a home computer in the early days, but as the Difficulty Target and Bitcoin price rose, more people started mining and purchased more expensive computing power to be more competitive.

Ironically, profits from mining are more available to people with more capital, which gives them control of a new financial system. Adding to this is the fact that no complete list of miners exists, giving them a degree of anonymity.

Although miners can’t manipulate Bitcoin in the way a central bank can, they could decide to stop mining Bitcoin and use their computing power on more profitable ventures. This could affect the availability of basic Bitcoin functionality and cause people to stop using it.

This raises 3 interesting questions:

  1. Did Satoshi Nakamoto realise that miners would have a similar concentration of power that centralised financial systems have?
  2. Was this an intentional part of the Bitcoin’s design?
  3. Does this contradict the idea that Bitcoin is a system which is not controlled or owned by anyone?

Conclusion

Bitcoin’s proof of work algorithm is secure and trustworthy because of the resources required to hijack the blockchain.

The miners play a crucial role in maintaining a secure and trustworthy financial system, using their computing power to process transactions. They are incentivised by block rewards and transaction fees.

That said, it’s evident the computing power required to mine is Proof Of Work’s greatest weakness. Miners who provide this resource have significant leverage in the platform, because account holders require them to process transactions and keep hijacking difficult.

Despite this, there’s always chance they could take their computing power elsewhere if mining is no longer profitable, leaving Bitcoin a lot less secure.

Author’s Note: If you liked this article and want notifications for future content, visit my profile and press the “Follow” button. Thanks!

--

--

Damian Grasso
Geek Culture

Writing insightful content about the theories and realities of business, design and technology. Follow me to receive my latest content!