main ideas

  • Proof of Work (PoW) is a consensus mechanism designed to prevent double spending in digital payment systems.

  • Proof of Work (PoW) is a key part of the mining process, which involves adding new transaction blocks to the blockchain and creating new units of cryptocurrency.

  • Bitcoin and many other cryptocurrencies use Proof of Work (PoW) as a way to secure their blockchain network and data.

the introduction

In short, Proof of Work (PoW) is a mechanism designed to prevent double spending in digital payment systems. Bitcoin and many other cryptocurrencies use PoW as a way to secure their blockchain network and data. These mechanisms are often referred to as consensus algorithms or consensus mechanisms, because they involve multiple parties achieving consensus without having to trust each other.

Proof of Work was the first consensus algorithm to appear, and remains one of the most important along with Proof of Stake (PoS), having been introduced by Satoshi Nakamoto in the Bitcoin Technical Manual in 2008, but the technology itself was invented long before that date.

Adam Back's HashCash algorithm is an early example of a proof-of-work (PoW) algorithm in the pre-crypto era, where a recipient can limit unwanted correspondence by requiring a small amount of computation from the sender before sending an email. The computation may not cost the average sender anything, but the cost is high for those sending mass emails.

What is double spending?

Double spending occurs when the same money is spent more than once. This term is often used exclusively in the context of digital money – after all, it would be difficult to spend the same physical cash twice.

When you pay for a cup of coffee, you give the cash to the cashier who puts it in the cash drawer, so you can't go to another coffee shop on the side of the road and pay the same bill to get a cup of coffee. But in digital money systems, there is a possibility to do that.

You’ve probably copied a file on your computer before using the copy and paste commands, and it’s easy to email the same file to dozens of people. Since digital money is just data, you’ll need to prevent people from double-spending—that is, copying and spending the same units in different places. A digital payment system that fails to prevent double-spending will collapse in no time.

For more detailed information about double spending, you can read our double spending explanation.

What is the importance of Proof of Work (PoW)?

If you have read our article about blockchain technology, you will know that cryptocurrency users constantly broadcast transactions to the network, however, these transactions are not considered valid immediately, until they are confirmed and added to the blockchain.

The Bitcoin blockchain, for example, acts as a public database (public ledger) of transactions that every user can see. Picture it like this: You and three friends have a notebook to keep track of your Bitcoin transactions, and whenever one of you wants to transfer a value, you write it down like this:

Alice pays Bob 5 BTC, Bob pays Carol 2 BTC, etc.

However, every time you make a transaction, you have to reference the transaction that shows where the funds came from, so if Bob pays Carol 2 BTC, the inputs would actually be:

Bob pays Carol 2 BTC from the transaction made earlier with Alice.

This gives us a way to track where the BTC came from, so if Bob tries to make another transaction using the same 2 BTC he sent to Carol, everyone will know right away, and the group won't allow that transaction to be added to the notebook because that amount has already been spent.

This might work well in small groups where everyone knows each other and they can agree on which friends should add transactions to the notebook. But what would happen in a group of 10,000 people? The notebook wouldn’t work, because no one would trust strangers to do it.

This is where the Proof of Work (PoW) mechanism comes in. It ensures that users do not spend money they do not have the right to spend. By using game theory with cryptography, the PoW algorithm allows anyone to update the blockchain according to the rules of the system.

How does Proof of Work (PoW) work?

Imagine that our notebook from the example above is the blockchain, but we don’t add transactions one by one – we collect them all at once into blocks, announce the transactions to the network, and then the users who create the blocks merge them into a candidate block, and the transactions will only be valid once the candidate block is converted into a confirmed block, meaning it has been added to the blockchain.

The process of validating transactions and appending new blocks is called mining, and it is an expensive and difficult process, but it is also rewarding. Block rewards are given from transaction fees paid by users and new bitcoins created by the protocol.

The Proof of Work (PoW) mechanism requires the miner (the user who creates the block) to use some of their own resources such as electricity and computing power in order to hash the candidate block data until a solution to the puzzle is found.

Hashing a block's data refers to passing it through a hash function in order to generate the block's hash value. The block's hash acts as a "fingerprint" - it represents the identity of your input data and each block has a unique hash value.

In other words, the miner has to verify and collect the pending transactions, organize them into a candidate block, and pass the block data through a hash function to generate a valid hash value. If he can find a valid hash value for the candidate block, he broadcasts it to the network, adds the block to the blockchain, and collects mining rewards.

When the miner broadcasts the candidate block and hash to the network, other network participants will repeat the hashing process to verify that the output is indeed correct.

Although it takes countless hash attempts to find a correct hash value, it is easy for anyone to verify the validity of the generated hash value, they just have to submit the same input (block data) through the hash function and check that the output matches.

For a proof of work, you need to provide data whose hash meets certain conditions. But you don't know how to do that. The only option you have left is to pass your data through a hash function and check that it matches the conditions. If it doesn't, you'll have to change your data slightly to get a different hash value. Changing a single character in your data will result in a different result, so there's no way to predict the output.

As a result, if you want to create a block, you play a guessing game. Typically, you take all the information about the transactions you want to add and some other important data, and then hash it together. But since the data set won’t change, you need to add a variable, otherwise, you’ll get the same hash value as the output. We call this variable a hash, which is a number that you’ll change every time, so you get a different hash value each time.

In short, mining is the process of collecting blockchain data and hashing it with a private code until you find a specific hash value. If you find a hash value that meets the conditions specified in the protocol, you get the right to broadcast the new block to the network. At this point, other network participants update their blockchains to add the new block.

For major cryptocurrencies at the moment, the conditions are incredibly difficult to meet. The higher the hashrate on the network, the harder it is to find a valid hash value. This is done to ensure that blocks are not found too quickly.

As you can imagine, guessing a large number of hashes can be very expensive for your computer. You will waste computing cycles and electricity. However, the protocol will reward you with a cryptocurrency if you find a correct hash value.

We'll summarize what we know so far:

  • Mining is difficult and expensive but provides security to the network.

  • Miners who successfully produce a valid block are rewarded with newly issued cryptocurrencies and transaction fees.

  • Generating a correct hash value takes time, but other users can easily verify its validity by repeating the hashing process.

Sounds good so far. But what if you want to cheat? What’s to stop you from putting a bunch of fraudulent transactions into a block and producing a valid hash?

This is where public key encryption comes in. We won’t go into detail about this in this article, but you can refer to What is public key encryption? for a more comprehensive look. In short, there are some cool cryptographic tricks that allow any user to verify whether or not someone has the right to transfer the money they are trying to spend.

When you create a transaction, you have to sign it, and anyone on the network can compare your signature with your public key, verify that they match, and also verify that you are able to spend your funds and make sure that your total input is higher than your total output (i.e., you are not spending more than you have).

The network will automatically reject any block that contains an invalid transaction. Trying to cheat will be costly for you. You will waste your resources without getting any reward.

Herein lies the appeal of Proof of Work (PoW): it makes cheating expensive, and acting honestly profitable. Any conscious miner wants a return on their investment, so they are expected to act in a way that will most likely generate revenue.

Proof of Work (PoW) vs. Proof of Stake (PoS)

There are many consensus algorithms besides Proof of Work (PoW), the most popular of which is Proof of Stake (PoS), the concept dates back to 2011 and has been implemented in Ethereum and many other protocols.

In Proof of Stake systems, miners are replaced by validators. There is no mining or competition to guess hash values. Instead, users are randomly selected – if chosen, they must propose (or “forge”) a block. If the block is correct, they receive a reward consisting of fees from the block’s transactions.

However, no user can be chosen – instead, the protocol chooses users based on several factors. To qualify, participants must stake a share, a predetermined amount of the blockchain’s native currency. The stake acts as collateral: just as defendants pay a large sum of money to prevent them from skipping trial, auditors stake a share to prevent cheating. If they try to cheat, their stake is confiscated (or a portion of it is taken away).

Proof of Stake offers more advantages than Proof of Work. The most notable of these advantages is its small carbon footprint – since Proof of Stake does not require high-powered mining farms, the electricity consumed is only a fraction of that consumed by the Proof of Work mechanism.

However, PoS does not have the same reputation and prestige as PoW, and while it can be considered wasteful, mining is the only consensus algorithm that has been proven in practice for over a decade, with Bitcoin’s PoW mechanism securing trillions of dollars worth of transactions since its launch. Staking needs to be properly tested over the long term to ensure that PoS can compete with PoW in terms of security.

Closing thoughts

Proof of Work was the original solution to the double-spending problem and has proven to be reliable and secure. Bitcoin has proven that we don’t need central authorities to prevent money from being spent twice. With clever use of cryptography, hash functions, and game theory, users can agree on the state of the financial database in a decentralized environment.

  • What is cryptocurrency mining? How does it work?

  • What is public key encryption?

  • What is the consensus algorithm in the blockchain?

Disclaimer: This content is provided to you “as is” for general informational and educational purposes only, without any representations or warranties of any kind. It should not be construed as financial, legal, or other advice, nor is it intended as a recommendation for the purchase of any particular product or service. You should seek professional advice from your own advisors. If an article is provided by a third party, please note that the opinions expressed are those of the third party and do not necessarily reflect the views of Binance Academy. Please read the full disclaimer here for more details. Digital assets may fluctuate in price, the value of your investment may go up or down, and you may not get back the amount you invested. You are solely responsible for your investment decisions, and Binance Academy is not responsible for any losses you may incur. This article should not be construed as financial, legal, or professional advice. For more information, please see our Terms of Use and Risk Warning.