Proof of Work (PoW) explained

Proof of Work (often abbreviated “PoW”) is a prevention mechanism for the double-spending problem. The vast majority of cryptocurrencies use this consensus algorithm mechanism. We call this approach the ledger that secures cryptocurrencies.

Proof of Work is one of the earliest consensus algorithms and is still in the mainstream today. The concept was introduced in Satoshi Nakamoto’s Bitcoin white paper in 2008, but the technology itself was conceived much earlier.

Adam Back’s HashCash was an early example of a proof-of-work algorithm, long before cryptocurrencies. HashCash alleviates the spam problem that plagues recipients by requiring the sender to perform a small calculation before the email is sent. Such calculations are almost effortless for legitimate senders, but the burden can quickly increase for people who send a lot of email.

Visit Binance Academy

What is the double spend problem?

The double-spending problem occurs when the same funds are used multiple times. The term is basically exclusive to the realm of digital currency, after all the same cash cannot be paid twice in real life. For example, after the coffee money is paid to the cashier, it is locked into the cash register. It is impossible for a customer to go to the cafe across the street for another cup of coffee with the same amount of money.

This is likely to happen if a digital cash scenario is implemented. We’ve all copied computer files before, just copy and paste and email the same file to ten, twenty, or even fifty people.

Since digital currency is just a form of data, we need to beware of others copying and paying for the same currency elsewhere. Otherwise, our monetary system will collapse very quickly.

Why is Proof of Work Necessary?

If you’ve read our blockchain technology guide , you’ll know that users publish transactions to the network. But these transactions do not take effect immediately, but only after they are added to the blockchain.

The blockchain is a huge database visible to all users, so anyone can see how funds have been used before. Imagine this: You share a notepad with three other friends. Whoever wants to transfer the money in what currency will be recorded. For example, Alice pays Bob 5 units of currency and Bob pays Carol 2 units of currency.

The complication of this process is that the source of funds is mentioned in every transaction. Therefore, if Bob is paying Carol two units of currency, the source of funds is actually: Bob takes two units of currency from his previous transaction with Alice to pay Carol .
This way we have a way to track these currencies. If Bob tries to make another transaction using the same unit of currency that he paid Carol earlier, it will soon become known. Shared group members will not allow the transaction to be counted in Notepad.

For small groups, the above approach can work very well. Everyone knows each other and can reach an agreement to decide which friend will record the transaction in the notepad. What if it was a group of 10,000 participants? At this point, Notepad cannot scale effectively, after all, no one would trust a stranger to be in charge of the ledger.

This is where proof-of-work comes in. Proof of Work ensures that users are not allowed to pay funds that they do not have the right to use. The proof-of-work algorithm combines game theory and cryptography to allow everyone to update the blockchain according to the rules of the system.

Visit Binance Academy

How does proof-of-work work?

Blockchain is the notepad we mentioned above. But instead of adding transactions one by one now, we pack them into blocks. We publish transactions on the network, and the user who created the block then counts the transaction as a candidate block. The transaction is valid only if the candidate block becomes the confirmed block. That is, the transaction has been added to the blockchain.

However, the fees for adding blocks are not cheap. Proof of Work requires miners (users who create blocks) to use their respective resources to gain privileges. Resources are computing power, which can be used to hash block data until a solution to the puzzle is found.
Hash operation block data refers to bringing the data into a hash function to generate a block hash value. The block hash acts like a “fingerprint”, an identification of the input data and is unique to each block.

It is almost impossible to get the input data by reversing the block hash. However, by grasping the input data, it is easy to confirm that the hash value is correct. Just submit the input to the function and see if the output is the same.

The data provided into the proof of work, the hash value must meet certain conditions. But users don’t know how to do it. The only thing they can do is put the data into a hash function to verify that the conditions are met. If it does not match, the data is slightly modified and a different hash value is obtained. Changing even one character in the data can produce very different results, so the output is not predictable at all.

So, creating blocks is a guessing game. In general, users need to aggregate all the transaction information to be added and some other important data, and then do the hash operation at the same time. Since the dataset does not change, a variable information needs to be added. Otherwise, the output hash value will always be consistent. This variable data is called a ” random number “. As long as you try to change the nonce each time, you will get a different hash value. This process is called ” mining “.

All in all, mining is the process of collecting blockchain data and hashing it 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 incorporate new blocks.

For today’s mainstream cryptocurrencies, it is challenging to meet the conditions. The higher the hash rate of the network, the harder it is to find a valid hash value. This is to slow down block production.

The high cost of guessing massive hash values ​​through a personal computer can be imagined. This consumes a lot of computing time and power. But just finding a valid hash is the cryptocurrency rewarded by the protocol.

Let’s review what we’ve learned so far:

  • Mining is expensive.
  • Rewards are available for generating valid blocks.
  • Knowing the input data, the user can easily verify the hash value. Users who do not mine can verify whether the block is valid without spending a lot of computing power.

So far, everything is normal. But what happens if someone tries to cheat? How can we stop entering a large number of fraudulent transactions into blocks to generate valid hashes?

Therefore, public key cryptography came into being. This article will not go into details here, please read “What is Public Key Cryptography? , for more details. Simply put, we use some compliant cryptography tricks to verify that someone has the right to access a certain amount of money.

When you create a transaction, you sign it. Users on the network can compare your personal signature to your public key to verify that they match. At the same time, users can also check whether the person has the right to use the funds, and whether the total input is higher than the total output, that is, personal spending must not exceed the holding amount.

The network automatically rejects blocks with invalid transactions. Trying to cheat is very expensive. Not only is it a waste of resources, but there is no reward.

The magic of proof-of-work is revealed— counterfeiting is expensive, and doing it honestly is lucrative . Smart miners will pursue return on investment (ROI), tread carefully, and guarantee returns.

Visit Binance Academy

Proof of Work vs. Proof of Stake

Proof of Stake (PoS) is also a big focus among many consensus algorithms. The concept was born back in 2011 and has been implemented in some smaller protocols. However, it has not yet been adopted in large-scale blockchains.

In a proof-of-stake system, miners are replaced by ” validators ” and there is no competition for mining and guessing hashes. Instead, randomly selected users are required to propose or “mint” blocks. If the block is valid, the user will receive a reward consisting of block transaction fees.

Of course, there are thresholds for the selection process, and the agreement will comprehensively consider various factors to select users. To qualify, participants lock up a stake , a predetermined amount of the blockchain’s native currency. A pledge works like a bail. For example, in order to prevent defendants from evading trial, they are required to post a large bail, and validators are required to lock “stakes” to prevent cheating. In the event of deception, all or part of the pledge will be confiscated.

Proof of Stake does have certain advantages over Proof of Work. The most obvious is the reduction in carbon footprint, as Proof of Stake does not require high-powered mining farms and consumes only a fraction of the electricity of Proof-of-Work.

Even so, Proof of Stake is a far cry from the popularity of Proof of Work. Although considered wasteful, mining has currently proven itself to be the only consensus algorithm that has gained mass adoption. Over the past decade or so, Proof of Work has secured the security of trillions of dollars worth of transactions. Staking still needs to be fully tested in practice to see if proof-of-stake is comparable to proof-of-work in terms of security.

Summary

Proof-of-Work was an initial solution to the double-spend problem, and its reliability and security were also proven. Bitcoin proves that we do not need to rely on a centralized entity to prevent double spending of the same funds. Participants in a decentralized environment can track the state of financial databases in unison through the clever use of cryptography, hash functions, and game theory.

Visit Binance Academy