What is proof of work on Bitcoin? (Proof-of-work)

Disponible en podcast
Share article:

The proof of work (Proof-of-Work (in English) is a mechanism used in Bitcoin, within the principle of Nakamoto Consensus, so that the payment system is resistant to Sybil attacks. This type of attack is characterized by the creation of multiple false identities in order to corrupt the peer-to-peer network.

The Nakamoto Consensus is the principle that allows Bitcoin users to agree on a single version of the blockchain in order to reach an agreement on the question: “who owns what? ”. It's called “proof-of-work consensus” because it specifies that nodes agree on which blockchain has the largest amount of accumulated work. This proof of work is done by computers called “miners”, in reference to the gold mining process. Bitcoin mining (Mining) is thus the action of engaging in proof of work.

This article on proof of work is a logical continuation of last week's article on how Bitcoin generally works. I also advise you to read it by clicking on the link below.

➤ Learn more about how Bitcoin works.

How does proof of work work? (Proof-of-work)

Proof of work is simply the search for a value that, once passed into a random mathematical function, gives a result that is less than a target number.

Concretely, miners gather pending transactions into a block, respecting the maximum weight limit, and increment modifiable values.

The technical term for these modifiable values is “nonces”, the abbreviation in English for “number only used once”. It is a number chosen arbitrarily that is used only once, and that is replaced by another number during the next manipulation.

They will pass the header of this candidate block into a random and irreversible function. The objective is to find a footprint (result of the function) that is smaller than the target. If their block does not meet the condition, they can change the editable values (Nunces) and try to pass their new header into the function again. They will then have a completely different result than the first one. The miner continues this process of modifying the nonces and comparing the result obtained with the target until a valid block is found.

The random mathematical function (hash function) used for bitcoin mining is a SHA256 double (SEcure HAsh Algorithm), also called SHA256d or HASH256.

Since the SHA256 function cannot be reversed, miners can only try all the possibilities one by one. It's a trial and error calculation. The first miner who finds a block that meets this condition wins the right to register it on the blockchain of all users, and gets the associated monetary reward. This remuneration for minors is composed of two distinct parts:

  • the transaction fees included in the block,
  • and the coinbase reward that creates new bitcoins.

➤ Learn more about the coinbase reward, halvings, and degressive currency issuance.

The validation of a block also involves an initial confirmation of payment for all transactions included in it.

Bitcoin network users, represented by their nodes, can thus all agree on a version of the account register by adding valid blocks created by miners to their database. Each node remembers a state of the blockchain and records the new blocks created after having individually verified them. The authentic blockchain is the one with The greatest amount of accumulated work. This principle of agreement between all users is what we call: “Nakamoto consensus by proof of work”.

The information that nodes would consider the longest chain to be valid is a common misconception. Although this consensus principle was true until 2010, it could be exploited to destroy Bitcoin and was then modified. Since that date and Bitcoin's 0.3.3 update, the nodes agree on which chain has the most accumulated work, which may be a different chain from the longest chain.

Adjusting the mining difficulty

The consensus algorithm includes adjusting the target value to maintain a stable block creation speed at 10 minutes. When blocks are found too quickly for the objective, the mining difficulty increases, and vice versa. This large interval between blocks allows time for all nodes to synchronize properly to the same state of the block chain.

Concretely, every 2016 blocks (approximately every two weeks), the nodes will calculate a new target for the proof of work in order to adjust the mining difficulty.

As a reminder, miners must find a block that, once passed through a random function, will result in a lower number than the target. If during the last period of 2016 blocks, they were found on average faster than 10 minutes each, this means that there was an increase in the computing power deployed on the network. The nodes will therefore increase the difficulty of mining by adjusting the target downwards in order to increase the time needed to find a valid block. The aim is for this value to approach 10 minutes on average. Conversely, if during the last period of 2016 blocks, they were validated on average more slowly than 10 minutes each, this means that there was a decrease in the computing power deployed by miners. The nodes will then lower the difficulty by adjusting the target upward.

To calculate the new target, every 2016 blocks, the nodes will perform the following calculation:

  • New target = Old target * (total time of the last 2016 blocks in seconds/1,209,600 seconds)

New target = Old target * (total time of the last 2016 blocks in seconds/1,209,600 seconds)

This target number is thus an adjustment tool. By modifying it, we change in terms of probability the time required to find an imprint that meets the condition. Thanks to this, the production of blocks on Bitcoin naturally tends to a stable frequency with intervals of 10 minutes, regardless of the number of computers that mine.

This 10-minute interval was chosen arbitrarily by Satoshi Nakamoto when creating Bitcoin. The target time between each block represents a compromise between network security and the efficiency of the payment system. A shorter time allows for faster confirmations for users, while a longer time allows you to avoid chain separations. These “splits”, in English, cause a waste of computing power on orphan blocks, and therefore reduce the overall security of the system. A target time of 10 minutes is a good compromise between efficiency and safety. This is why this interval is not a “weakness” of Bitcoin, but an essential feature.

What is the purpose of proof of work on Bitcoin?

Proof of work protects the Bitcoin network from Sybil attacks. Indeed, this mechanism makes it possible to prevent a malicious actor from taking control of the payment network by multiplying identities. Instead of being established on a computer voting system, Bitcoin is established on a voting system by computing power. Since this calculation requires energy expenditure, we then have a tangible, universal and external to the network to choose who has the right to register a block in the distributed register.

An attacker who wants to change the ownership status of bitcoins will necessarily have to broadcast his own version of the channel. For this malicious state to be accepted, it must respect the Bitcoin protocol and in particular the chaining of blocks between them. He will also need to have more amounts of accumulated work than the honest chain. This means that the attacker must redo all the calculation work after the block that was fraudulently modified. If he does not have more computing power than all other honest miners, he will never be able to get his version of the chain accepted by honest nodes, and will fail in his attempt to attack.

Through the use of proof of work, minors are naturally encouraged to remain honest. Indeed, an attack would require deploying phenomenal computing power and maintaining it over time. This means that an attack would consume a lot of electricity, and would therefore be particularly expensive, without having a guaranteed result. It is then much more interesting to use your machines to mine honestly and receive the rewards given for finding a valid block.

Beyond this work of protection against Sybil attacks, Proof-of-Work also plays an essential role in the resistance to censorship of the payment system. Indeed, with the Nakamoto Consensus, it makes it possible to assign the right to enter a block in the register from time to time by choosing a minor randomly, in proportion to the computing power deployed. Every 10 minutes, this mechanism will give a new miner the right to push his block, with all the transactions it contains. Thanks to this, Bitcoin users benefit from the incensurability when it comes to confirming their transactions. If a minor censors a user and refuses to include his transactions in his block for a reason outside the rules of the protocol, that's okay. Other minors who don't censor that same user will include it. It will be confirmed as soon as they provide a block that meets the proof of work condition.

In addition, the censored user can increase his transaction fees in order to encourage other miners to include him in a block. This will create financial pressure on censoring minors, and will naturally favor loyal miners through a natural market process.

Conclusion

The Nakamoto proof-of-work consensus is the principle used to establish an agreement on a single version of the distributed ledger between the various nodes in the network. It is based on the proof-of-work mechanism, which is simply a system for resisting Sybil attacks.

Proof of work is the search for a value that, when passed into a random function, gives a result that is lower than a specific target. This research work is carried out by actors, using specialized computers, who are called “minors”.

The proof-of-work target is adjusted every 2016 blocks by the nodes. This is called “difficulty adjustment.” We lower the target number to increase the mining difficulty, or we increase it to lower the difficulty, depending on the evolution of the computing power deployed by the miners during the previous period.

Be careful not to confuse proof of stake (PoS) with proof of work (PoW). These two mechanisms are very different. Unlike proof of work, the majority decision process of proof of stake is not based on any tangible element external to the network and this brings many problems to payment systems using it. This PoW/PoS comparison will be the subject of a detailed next article.

➤ Learn more about the differences between Bitcoin and other cryptocurrencies.

Podcast available

Table of contents

Share article

You may also like these articles

Bitstack SAS, a company registered with the Aix-en-Provence Trade and Companies Register under number 899 125 090 and operating under the trade name Bitstack, is licenced as an agent of Xpollens — an electronic money institution authorized by the ACPR (CIB 16528 – RCS Nanterre no. 501586341, 110 Avenue de France, 75013 Paris) — with the Autorité de Contrôle Prudentiel et de Résolution (ACPR) under number 747088, and is also licensed as a Crypto-Assets Service Provider (CASP) with the French Financial Markets Authority (AMF) under number A2025-003 for the following activities: exchange of crypto-assets for funds, exchange of crypto-assets for other crypto-assets, execution of orders for crypto-assets on behalf of clients, providing custody and administration of crypto-assets on behalf of clients, and providing transfer services for crypto-assets on behalf of clients, with its registered office located at 100 impasse des Houillères, 13590 Meyreuil, France.

Investing in digital assets carries a risk of partial or total loss of the invested capital.
Past performance is not indicative of future results.
DOWNLOAD BITSTACK