Introduction
Proof of Work (often abbreviated to "PoW") is a mechanism to prevent double spending. The vast majority of cryptocurrencies use this consensus algorithm. We call this method the ledger that ensures the security of the cryptocurrency.
Proof of Work is one of the earliest consensus algorithms and is still in the mainstream today. Satoshi Nakamoto introduced this concept in the Bitcoin white paper published in 2008, but in fact the technology itself was conceived earlier.
Before the advent of cryptocurrency, Adam Back's HashCash was an early example of a proof-of-work algorithm. HashCash alleviated the spam problem that plagued recipients by requiring the sender to perform a small amount of calculations before sending an email. Such calculations are almost effortless for a legitimate sender, but the burden quickly increases for someone who sends a lot of email.
What is the double spending problem?
Double spending occurs when the same funds are used multiple times. This term is mostly exclusive to the field of digital currency, after all, the same cash cannot be used to pay twice in real life. For example, after paying the cashier for coffee, it is locked in the cash register. The customer cannot use the same money to buy another cup of coffee at the cafe across the street.
This is what would happen if a digital cash scheme were implemented. We’ve all copied computer files before, and we can email the same file to ten, twenty, or even fifty people simply by copying and pasting it.
Since digital currencies are just data, we need to be wary of others copying and spending the same currency somewhere else. Otherwise, our monetary system will quickly collapse.
For more information about the double-spending problem, please read "Detailed Explanation of the Double-Spending Problem".
Why is Proof of Work Necessary?
If you’ve read our guide to blockchain technology, you’ll know that users publish transactions to the network. However, these transactions don’t take effect immediately, but only once they’ve been added to the blockchain.
The blockchain is a huge database visible to all users, so everyone can see how funds have been used before. Imagine this: you and three other friends share a notebook. Whoever wants to transfer money in what currency is recorded. For example, Alice pays Bob 5 units of currency, and Bob pays Carol 2 units of currency.
The complexity of this process is that each transaction has to mention the source of funds. So if Bob is paying Carol two units of currency, the source of funds is actually: Bob took two units of currency from a previous transaction with Alice to pay Carol.
This way we have a way to track these coins. If Bob tries to make another transaction using the same unit of currency that he paid to Carol, everyone will know about it very quickly. The sharing group will not allow this transaction to be recorded in the journal.
This might work well for a small group. Everyone knows each other and can agree on which friend should record the transaction in the journal. But what if it is a group of 10,000 participants? In this case, the journal cannot scale effectively, after all, no one will trust a stranger to be in charge of the ledger.
This is where proof of work comes in. Proof of work ensures that users cannot spend funds they do not have the right to spend. The proof of work algorithm combines game theory and cryptography to allow everyone to update the blockchain according to the rules of the system.
How does Proof of Work work?
The blockchain is the notepad we mentioned above. But now we don't add transactions one by one, but bundle them into blocks. We publish transactions in the network, and the user who created the block will then include the transaction in the candidate block. Only when the candidate block becomes a confirmed block will the transaction take effect. In other words, the transaction has been added to the blockchain.
However, adding blocks is not cheap. Proof of Work requires miners (users who create blocks) to use their own resources for the privilege. Resources are computing power, which can be used to hash block data until a solution is found to the puzzle.
Hashing block data means feeding the data into a hash function to generate a block hash value. The block hash value acts like a "fingerprint", which is an identifier of the input data and is unique for each block.
It is almost impossible to reverse the block hash to get the input data. However, if you know the input data, you can easily confirm whether the hash value is correct. Just submit the input to the function and see if the output is the same.
The data provided in the proof of work must have a hash value that meets certain conditions. But users don't know how to do this. The only thing they can do is to feed the data into the hash function to verify whether it meets the conditions. If it doesn't meet the conditions, they can modify the data slightly and get a different hash value. Even changing just one character in the data will produce a completely different result, so the output is impossible to predict.
Therefore, creating a block is a guessing game. Generally speaking, users need to summarize all the transaction information and other important data to be added, and then perform hash operations at the same time. Since the data set does not change, a variable information needs to be added. Otherwise, the output hash value will always remain the same. This variable data is called a "random number". As long as you try to change the random number every time, you will get a different hash value. This process is called "mining".
In short, mining is the process of collecting blockchain data and performing hash operations with the help of random numbers until a specific hash value is found. If the resulting hash value meets the conditions set by the protocol, a new block can be published in the network. At the same time, other network participants can update their own blockchains to include the new block.
For today's mainstream cryptocurrencies, it is quite challenging to meet the conditions. The higher the network's hash rate, the harder it is to find a valid hash value. This is to slow down the block generation speed.
It is easy to imagine the high cost of guessing massive hash values using a personal computer. This consumes a lot of computing time and electricity. However, as long as a valid hash value is found, the cryptocurrency rewarded by the protocol can be obtained.
Let's review what we have learned so far:
Mining is expensive.
Generating valid blocks will earn you rewards.
Knowing the input data, users can easily verify the hash value. Users who do not mine can also verify whether the block is valid without consuming a lot of computing power.
So far, so good. But what happens if someone tries to cheat? How can we stop someone from entering a large number of fraudulent transactions into a block in order to generate a valid hash?
Public key cryptography was born. I won’t go into details here. Please read “What is public key cryptography?” for more details. In simple terms, we use some compliant cryptography techniques to verify whether someone has the right to use a certain amount of funds.
When you create a transaction, you sign it. Anyone on the network can compare your personal signature to your public key and verify that they match. They can also check that the person has access to the funds and that the total inputs exceed the total outputs, meaning that a person cannot spend more than they hold.
The network automatically rejects blocks that contain invalid transactions. Trying to cheat is very costly. Not only does it waste resources, but you also get no rewards.
The magic of proof of work is revealed - it is costly to cheat, but honest operation is very profitable. Wise miners will pursue return on investment (ROI), act prudently and ensure profits.
Want to start your cryptocurrency journey? Buy Bitcoin on Binance now!
Proof of Work vs. Proof of Stake
Proof of Stake (PoS) is also a major focus among the consensus algorithms. The concept dates back to 2011 and has been implemented in some smaller protocols. However, it has not yet been adopted in large blockchains.
In a proof-of-stake system, miners are replaced by "validators," and there is no competition involved in mining and guessing hash values. Instead, randomly selected users must propose or "mint" blocks. If the block is valid, the user receives a reward consisting of the block's transaction fees.
Of course, there are thresholds for the selection process, and the protocol will select users based on various factors. To qualify, participants must lock up a stake, which is a predetermined amount of blockchain native currency. The role of a stake is similar to a bail. For example, to prevent defendants from evading trial, they must pay a large bail, and validators need to lock up a "stake" to prevent cheating. In the event of cheating, all or part of the stake will be confiscated.
Compared to proof of work, proof of stake does have certain advantages. The most obvious is the reduction in carbon footprint, because proof of stake does not require high-powered mining farms and electricity consumption is only a small fraction of proof of work.
Even so, proof of stake is still far from being as popular as proof of work. Despite being considered wasteful, mining has proven itself to be the only consensus algorithm that has gained large-scale use. For more than a decade, proof of work has secured trillions of dollars worth of transactions. To determine whether proof of stake can match the security of proof of work, staking still needs to be fully tested in practice.
Summarize
Proof of Work is the original solution to the double-spending problem, and its reliability and security have been proven. Bitcoin proves that we don’t need to rely on a centralized entity to prevent the same funds from being spent twice. Participants in a decentralized environment can track the state of a financial database in unison through the clever use of cryptography, hash functions, and game theory.



