Home
Articles
What Is Proof of Work (PoW)?

What Is Proof of Work (PoW)?

Intermediate
Published Dec 6, 2018Updated Apr 18, 2024
10m

Key Takeaways

  • Proof of Work (PoW) is a consensus mechanism created to prevent double-spends in digital payment systems.

  • PoW is a key part of the mining process, which involves adding new blocks of transactions to the blockchain and creating new units of cryptocurrency.

  • Bitcoin and many other cryptocurrencies use PoW as a method for securing their blockchain network and data.

Introduction

In short, Proof of Work (PoW) is a mechanism created to prevent double-spends in digital payment systems. Bitcoin and many other cryptocurrencies use PoW as a method for securing their blockchain network and data. Such mechanisms are often referred to as consensus algorithms or consensus mechanisms, because they involve multiple parties achieving consensus without the need to trust one another.

Proof of Work was the first consensus algorithm to emerge, and it remains one of the most important along with Proof of Stake (PoS). PoW was introduced by Satoshi Nakamoto in the 2008 Bitcoin whitepaper, but the technology itself was conceived long before then.

Adam Back’s HashCash is an early example of a Proof of Work algorithm in the pre-cryptocurrency days. By requiring senders to perform a small amount of computing before sending an email, receivers could mitigate spam. This computation would cost virtually nothing to a legitimate sender but quickly add up for someone sending emails en masse.

What Is a Double-Spend?

A double-spend occurs when the same funds are spent more than once. The term is used almost exclusively in the context of digital money – after all, you’d have a hard time spending the same physical cash twice. 

When you pay for a coffee today, you hand cash over to a cashier who probably locks it in a register. You can’t go to the coffee shop across the road and pay for another coffee with the same bill. However, in digital cash systems, there’s the possibility that you could. 

You’ve surely duplicated a computer file before using the copy-and-paste commands. It’s also easy for you to email the same file to dozens of people. Since digital money is just data, you need to prevent people from double-spending, i.e., 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 a more in-depth look at double-spending, check out Double Spending Explained.

Why Is Proof of Work Necessary?

If you’ve read our article about blockchain technology, you’ll know that cryptocurrency users are constantly broadcasting transactions to the network. These transactions aren’t immediately considered valid, though. That only happens when they get confirmed and added to the blockchain.

The Bitcoin blockchain, for example, works as a public transaction database (ledger) that every user can see. Picture it like this: you and three friends have a notepad to track your bitcoin transactions. Anytime one of you wants to make a transfer of value, you write it down:

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

But, each time you make a transaction, you refer to the transaction from where the funds came. So, if Bob was paying Carol with 2 BTC, the entry would actually look like the following: 

Bob pays Carol 2 BTC that came from this earlier transaction with Alice.

Now, we have a way to track the units of BTC. If Bob tries to make another transaction using the same 2 BTC he just sent to Carol, everyone will know immediately. The group won’t allow the transaction to be added to the notepad because those 2 BTC were already spent.

Now, this might work well in a small group. Everyone knows each other, so they’ll probably agree on which of the friends should add transactions to the notepad. What if we want a group of 10,000 participants? The notepad idea doesn’t scale well, because nobody wants to trust a stranger to manage it.

This is where Proof of Work comes in. It ensures that users aren’t spending money that they don’t have the right to spend. By using a combination of game theory and cryptography, a PoW algorithm enables anyone to update the blockchain according to the rules of the system.

How Does PoW Work?

Imagine that our notepad from the example above is the blockchain. But we don’t add transactions one by one – instead, we lump them into blocks. We announce the transactions to the network, and then users creating a block will include them in a candidate block. The transactions will only be considered valid once their candidate block becomes a confirmed block, meaning that it has been added to the blockchain database.

The process of validating transactions and appending new blocks is called mining. It’s expensive and difficult, but it can also be rewarding. The block reward is made of transaction fees from users and brand new bitcoins created by the protocol. 

The Proof of Work mechanism requires that a miner (the user creating the block) invests resources such as electricity and computing power in order to hash their candidate block’s data until a solution to a puzzle is found.

Hashing the block’s data means passing it through a hashing function to generate a block hash. The block hash works like a “fingerprint” – it’s an identity for your input data and is unique to each block.

In other words, a miner has to verify and collect pending transactions, organize them into a candidate block, and pass the block’s data through a hashing function to create a valid hash. If they manage to find a valid hash to their candidate block, they broadcast it to the network, add the block to the blockchain, and collect the mining rewards.

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

Although it takes countless hashing attempts to find a valid hash, it’s trivial for anyone to confirm that the generated hash is correct. They just have to submit the same input (block data) through the hash function and check if the output is the same.

In Proof of Work, you must provide data whose hash matches certain conditions. But you don’t know how to get there. Your only option is to pass your data through a hash function and to check if it matches the conditions. If it doesn’t, you’ll have to change your data slightly to get a different hash. Changing even one character in your data will result in a totally different result, so there’s no way of predicting what an output might be.

As a result, if you want to create a block, you’re playing a guessing game. You typically take information on all of the transactions that you want to add and some other important data, then hash it all together. But since your dataset won’t change, you need to add a piece of information that is variable. Otherwise, you would always get the same hash as output. This variable data is what we call a nonce. It’s a number that you’ll change with every attempt, so you’re getting a different hash every time.

Summing up, mining is the process of gathering blockchain data and hashing it along with a nonce until you find a particular hash. If you find a hash that satisfies the conditions set out by the protocol, you get the right to broadcast the new block to the network. At this point, the other participants of the network update their blockchains to include the new block.

For major cryptocurrencies today, the conditions are incredibly challenging to satisfy. The higher the hash rate on the network, the more difficult it is to find a valid hash. This is done to ensure that blocks aren’t found too quickly.

As you can imagine, trying to guess massive amounts of hashes can be costly on your computer. You’re wasting computational cycles and electricity. But the protocol will reward you with cryptocurrency if you find a valid hash.

Let’s recap what we know so far:

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

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

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

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

That’s where public-key cryptography comes in. We won’t go into depth in this article, but check out What is Public-Key Cryptography? for a comprehensive look at it. In short, there are some neat cryptographic tricks that allow any user to verify whether someone has the right to move the funds they’re attempting to spend.

When you create a transaction, you sign it. Anyone on the network can compare your signature with your public key and check whether they match. They’ll also check if you can actually spend your funds and that the sum of your inputs is higher than the sum of your outputs (i.e., that you’re not spending more than you have).

Any block that includes an invalid transaction will be automatically rejected by the network. It’s expensive for you to even attempt to cheat. You’ll waste your own resources without any reward.

Therein lies the beauty of Proof of Work: it makes it expensive to cheat but profitable to act honestly. Any rational miner will be seeking a return on their investment, so they can be expected to behave in a way that is more likely to bring revenue.

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

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

In Proof of Stake systems, miners are replaced with validators. There’s no mining involved and no race to guess hashes. Instead, users are randomly selected – if they’re picked, they must propose (or “forge”) a block. If the block is valid, they’ll receive a reward made up of the fees from the block’s transactions.

Not just any user can be selected, though – the protocol chooses them based on a number of factors. To be eligible, participants must lock up a stake, which is a predetermined amount of the blockchain’s native currency. The stake works like bail: just as defendants put up a large sum of money to disincentivize them from skipping trial, validators lock up a stake to disincentivize cheating. If they act dishonestly, their stake (or a portion of it) will be taken.

Proof of Stake does have some benefits over Proof of Work. The most notable one is the smaller carbon footprint – since there’s no need for high-powered mining farms in PoS, the electricity consumed is only a fraction of that consumed in PoW. 

That said, PoS doesn’t have the same track record as PoW. Although it could be perceived as wasteful, mining is the only consensus algorithm that’s been battle-tested for over a decade. Since its launch, Bitcoin’s PoW has secured trillions of dollars worth of transactions. To say with certainty whether PoS can rival its security, staking needs to be properly tested in the long term.

Closing Thoughts

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

Further Reading

Disclaimer: This content is presented to you on an “as is” basis for general information and educational purposes only, without representation or warranty of any kind. It should not be construed as financial, legal or other professional advice, nor is it intended to recommend the purchase of any specific product or service. You should seek your own advice from appropriate professional advisors. Where the article is contributed by a third party contributor, please note that those views expressed belong to the third party contributor, and do not necessarily reflect those of Binance Academy. Please read our full disclaimer here for further details. Digital asset prices can be volatile. The value of your investment may go down or up and you may not get back the amount invested. You are solely responsible for your investment decisions and Binance Academy is not liable for any losses you may incur. This material should not be construed as financial, legal or other professional advice. For more information, see our Terms of Use and Risk Warning.