This article will give you an entry-level guide on Proof of Work. You will learn what it is necessary for, the difference between Proof of Work and Proof of Stake, and more.
For easier navigation, check out the table of contents:
- What is Proof of Work?
- Why do we need PoW?
- What is double-spend?
- How does PoW work?
- Proof of Work vs. Proof of Stake
- Frequently Asked Questions
What is Proof of Work?
Proof of Work (PoW, for short) is a so-called consensus mechanism (also known as a consensus algorithm) used in cryptocurrencies. What it does is preventing double-spends. Proof of Work is commonly referred to as a cryptocurrency’s ledger security method.
Being the first consensus algorithm to be ever created, Proof of Work is still considered the dominant one among other consensus algorithms. Satoshi Nakamoto, the Bitcoin creator, introduced PoW back in 2008. But in reality, the technology that made PoW possible had been known prior to the period.
The most famous example of the pre-cryptocurrency age PoW algorithm is HashCash by Adam Back. It worked as a tool to decrease the number of spam letters by requiring senders to performs a certain amount of computing before sending an email. The amount of computing power was relatively low for an individual email sender, but it grew dramatically for someone who made massive email sending.
Why Do We Need Proof of Work?
To answer this question, we will first need to look at how blockchain technology works.
In a Bitcoin network, users need the system to confirm transactions since when they broadcast their transactions to the network, the latter don’t get their validated status right away. Transactions need to become parts of the blockchain system first. Since the blockchain is an open database, each user can follow the history of all funds within the network. The easiest way to look at it is a notepad.
Here’s the idea:
- You and three more of your friends share the same notepad;
- The four of you use this notepad to keep track of transactions and see how much money each one of you spends;
- To make each new transaction valid, when making it, you refer to the previous transaction that provided the funds;
- So if one of your friends tries to make a transaction using the same funds – such a transaction will be considered invalid and will get blocked.
But here’s the catch – such a system can only work for a small group of people who know each other and may come to terms of agreement when making transactions and writing their details own in a mutual notepad to make their operations fully transparent and traceable. But what if you want to do just the same for a vast group of online users of, say, 10,000 or more people? In this case, the notepad approach won’t work since no one will be eager to let strangers manage transactions.
And that is why the digital currency network needs a Proof of Work system. This mechanism serves as a block for a user to spend the assets that they don’t have the right to spend. The PoW algorithm combines game theory and cryptography, thus letting the Bitcoin blockchain users update bitcoin transaction data in strict accordance with the system.
How does PoW work?
What is mining?
To understand how Proof of Work actually works, we will first have to learn what mining is.
When adding transactions to the blockchain, you can’t add them separately – you must gather them into blocks. As soon as transactions appear within the network, the concept is as follows: they must be added into a certain type of block called a candidate block. Then this candidate block waits for its validation in order to become valid – in other words, to be added to the blockchain.
Creating a new block is not the cheapest process. It takes a certain resource which is computing power. Or mining power, since the one who creates a block is called a miner. A miner (by using a modern computer with enough CUP ) solving a so-called computational puzzle – i.e., hashing the block’s data.
What does hashing the block’s data? It means processing the data via a hash function that generates a block hash. Upon being processed through the hash functions, a new block receives its unique code – a sort of a fingerprint. This “fingerprint” gives an individual identity to your block’s input data.
You can’t extract the input data out of a block hash. However, if you know an input, you can tell if the block is correct. All you need for that is to process the input through the hash function and make sure that the output is just the same.
Proof of Work requires the data hash to match certain conditions. To make sure that the data hash matches the conditions, you will need to run it through the hash function. If, upon the checkup, the data will not match, you will need to just correct it by changing it a bit. It is important to know that even a one-character change will make a huge difference so that the output result is totally unpredictable.
The bottom line is creating a block is a task that you cannot predict. It all comes down to just hashing a number of transactions with other crucial data. What you will always need is to complement a constant dataset with a piece of variable data. Without it, your hash output will always be unchanged.
The piece of variable data that we mentioned is called a nonce. It is a number that changes each time giving you different hashes. The process itself is called mining.
So what is mining anyway?с
- Mining is the process of collecting blockchain data and hashing it with a nonce with the purpose of finding a particular hash. When a miner finds a hash that matches the protocol-assigned conditions, they get the right to broadcast new blocks to the network. At the same time, blockchain is updated by other network users who include new blocks.
Conditions that must be matched during the mining process differ between digital currencies. For instance, there are currencies with extremely challenging conditions. It all depends on the hash rate of the network – the higher the hash rate, the more difficult it is to find a valid hash. This is all part of a design – if hash rates were low, miners would find coins too quickly, and their numbers would be growing rapidly.
However, mining is not impossible. The idea is that it should be moderately hard. Otherwise, there would be no point for other miners to join. Mining is a competition. Each day miners compete with each other. The work miners do eventually rewarded, which boosts their enthusiasm for further mining.
Like we mentioned before, mining (i.e., solving a math puzzle) requires huge amounts of computational power. But that’s not all. As you know, computers need electricity to operate. So this makes mining a heavy task regarding electricity costs. But there’s good news – valid hashes are rewarded. This means that each time a miner finds a valid hash, they will get a block reward in cryptocurrency.
What is public-key cryptography?
With all the aforementioned information, we get the following conclusions:
- Mining costs money (mining hardware + a significant amount of electrical power used)
- Miners get block rewards for finding valid blocks
- With input data, a blockchain user can make sure that the block is valid without using too much CPU power.
But the thing is that there always will be the ones who will want to go the easy way. In this case, the ones who will want to try cheating. Is that possible? Can a person create a number of false transactions, hash them into one block, and get away with creating a new valid block? Technically speaking, the answer is yes. But there is a way to stop bad actors from misusing public blockchain for their own good.
To make sure if a user has a right to spend funds, a special cryptographic mechanism is used – it is called public-key cryptography. The concept is as follows:
- Upon creating a transaction, a user must sign it;
- The signature is publiс, and any user has access to it;
- Other users can compare the signature with the public key – if they match, then the transaction valid;
- Users can also make sure if a transaction’s creator can actually spend their funds and if the output sum is lower than the input sum.
For more details, please read this article.
The network deletes any invalid transaction block, which results in a massive monetary loss. So cheating within the blockchain network is really extremely expensive. And that is the actual idea behind the Proof of Work (and other consensus mechanisms):
- The PoW consensus mechanism makes cheating expensive, but on the other hand, it encourages you to act honestly, making large profits by doing so.
What is a double-spend?
When speaking about Proof of Work, there is a fundamental term that you should know about. The term is double-spending.
A double-spend is basically a fund that a user attempts to spend more than once. This is a common term for digital money operations. The reason is that digital funds are not the same as fiat currency – i.e., money that actually exists in the physical world. After all, at some point, every person dealing with digital currencies will have to admit that they don’t have any real-world value. But again, for a bunch of reasons, cryptocurrencies have become big for the past several years resulting in a crypto boom and a plethora of scam techniques. One of those techniques is double-spending.
Let’s make it clear:
- you cannot pay twice with physical cash, but you CAN (at least try) use the same digital currency fund to make bitcoin transactions (which is, of course, a fraud).
Picture the following situation: you bought a cup of coffee and paid with cash for it. Now, if you want another cup of coffee, you will not be able to pay for it using the same dollar bill since it has been accepted by a cashier and locked in a register. Nor will you be able to use that bill in another shop for a reason stated previously.
But with digital currencies, you can pull that trick off. Since digital money is just a bunch of zeros and ones (i.e., data compressed in a file), you can duplicate this data and email it to as many people as you choose. That is why it is so important to have mechanisms preventing people from using the same funds in different places. Without such mechanisms, double-spending will destroy a currency.
For more information on double-spending, read this guide.
Proof of Work vs. Proof of Stake
As we stated above, Proof of Work (PoW) is not the only consensus algorithm out there. In this section of our guide, we will take a look at a potential rival to the Proof of Work algorithm – Proof of Stake.
What is Proof of Stake?
Proof of Stake is another popular consensus mechanism that allows to validate transactions and reach consensus. But PoS uses an altogether different approach than PoW does. Unlike Proof of Work, Proof of Stake works virtually.
This means that while PoW requires a huge amount of computational power to perform a CPU cost function (or to solve a computation puzzle), PoS’s key feature is using validators. Validators lock up a stake to prevent cheating. After that, the validators need to decide what the next block to be added to the chain is. Then they bet on chosen blocks. If a block appears in the chain, the validators receive a reward in proportion to the entire stake.
Is PoS better than PoW?
Proof of Stake is yet to be fully integrated into crypto blockchains. And one of them to do it first is the Ethereum network. The Ethereum community is looking forward to switching from Proof of Work to Proof of Stake in the nearest future. The reason is Proof of Work is too heavy on electricity consumption – CPU pricing function requires more mining power than transaction validation via PoS. And more miners join mining pools, the more power is needed.
Many people across the world are worried about these amounts of power consumption. That is why the Ethereum blockchain wants to make use of the Proof of Stake mechanism in its attempt to go for a greener solution.
Another point in a PoW-vs-PoS competition is speed (the number of transactions per second). With Proof of Stake, users can send and receive funds in just a few seconds compared to the Proof of Work process that takes significantly longer. By the way, the latter factor also affects the growth of transaction fees within the crypto networks.
And finally, there is a matter of security. Is Proof of Stake safer than Proof of Work? The answer is yes. Thanks to the CASPER protocol, PoS is potentially safer than PoW. And even more, hacker attacks against PoS-based systems will get more expensive, thus rarer.
Back in the day, Proof of Work (PoW) was the original mechanism for detecting double-spends within the Bitcoin blockchain. Combining cryptography, hash functions, and game theory, PoW makes for a safer operation within a decentralized network creating a stable distributed consensus-based system.
What is Proof of Work protocol?
The PoW protocol is a mechanism for validating transactions within the decentralized cryptocurrency system. With Proof of Work, it becomes impossible to engage in double-spending – a scam technique of using one and the same fund for several transactions.
What is the difference between Proof of Stake and Proof of Work?
There are two main differences between the two most popular consensus protocols. The first difference is that Proof of Stake applies a more energy-efficient approach, while Proof of Work needs large amounts of electrical energy to operate. The second difference is that Proof of Stake is potentially safer thanks to the CASPER protocol and increasing costs of hacker attacks.
What do you mean by a “mathematical puzzle?”
Solving a “mathematical puzzle” is the process of mining crypto coins. Miners worldwide use expensive computing equipment and consume a lot of electricity to “mine” bitcoins (and other crypto coins) by process enormous amounts of data to create new units and add them into the blockchain.
What is a PoW token?
A PoW token is a “currency” used as a form of pseudo-payment within a number of applications such as email. If an email has a PoW token attached to it, this means that the email is spam-free. PoW tokens are also used for Reusable Proof of Work. So technically speaking, PoW tokens are elements of an anti-spam system.