Proof of Work (often abbreviated as "PoW") is a prevention mechanism for the double-spending problem. The vast majority of cryptocurrencies use this consensus algorithm mechanism. We call this approach a cryptographically secure ledger.
Proof-of-work is the earliest consensus algorithm and is still in the mainstream today. Satoshi Nakamoto introduced this concept in the Bitcoin white paper released in 2008, but the technology itself had actually been conceived earlier.
Before the advent of cryptocurrencies, Adam Back's HashCash was an early example of a proof-of-work algorithm. HashCash alleviates the spam problem that plagues recipients by requiring the sender to perform a small amount of calculations before the email is sent. Such calculations are almost effortless for regular senders, but for those who send large amounts of email, the burden quickly increases.
Double spending will occur if the same fund is used multiple times. This term is essentially exclusive to the world of digital currencies, as the same amount of cash cannot be paid twice in real life. For example, after you pay the cashier for your coffee, it's locked in the cash register. It is impossible for a customer to buy another cup of coffee at the café across the street for the same amount of money.
This may happen if a digital cash solution is implemented. We've all copied computer files before and can email the same file to ten, twenty, or even fifty people just by copying and pasting.
Since digital currency is just a form of data, we need to be wary of others copying it and paying for the same currency elsewhere. Otherwise, our monetary system will soon collapse.
If you want to learn more about the double-spending problem, please read "Detailed Explanation of the Double-Spending Problem".
If you have read our blockchain technology guide, you will know that users publish transactions to the network. But these transactions are not effective immediately, but only after being added to the blockchain.
The blockchain is a huge database visible to all users, so everyone can view the previous use of funds. Picture this: You and three other friends share a notepad. No matter who wants to transfer money in which currency, it will be 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 the source of funds must be mentioned for every transaction. Therefore, if Bob is paying two units of currency to Carol, the source of funds is actually: Bob pays Carol two units of currency from his previous transaction with Alice.
This way we have a way to track these currencies. If Bob attempts to conduct another transaction using the same unit of currency that was previously paid to Carol, everyone will soon know about it. Sharing group members will not allow this transaction to be recorded in Notepad.
For small groups, this approach can be very effective. Everyone knows each other and can reach an agreement on which friend will record the transaction in the notepad. What would happen if it were a group of 10,000 participants? At this point, Notepad cannot be expanded 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 spend funds that they do not have access to. The workload proof algorithm combines game theory and cryptography to allow everyone to update the blockchain according to system rules.
Blockchain is the notepad we mentioned above. But now we do not add transactions one by one, but package them into blocks. We publish transactions on the network, and the user who created the block then counts the transaction into a candidate block. Only when the candidate block becomes a confirmed block will the transaction take effect. That is, the transaction is added to the blockchain.
However, adding blocks is not cheap. Proof of work requires miners (users who create blocks) to use their own resources to gain privileges. Resources are computing power, which can be used to hash block data until a solution to the problem is found.
Hashing block data means bringing 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 obtain the input data by reversing the block hash. However, by knowing the input data, you can easily 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 to 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 pass the data into a hash function to verify that it meets the criteria. If it doesn't match, slightly modify the data and get a different hash value. Changing even one character in the data can produce wildly different results, so the output cannot be predicted at all.
So, creating blocks is a guessing game. Generally speaking, users need to aggregate all the transaction information and some other important data to be added, and then hash them simultaneously. Since the data set does not change, a variable information needs to be added. Otherwise, the output hash value will always be consistent. This variable data is called "Random number". As long as you try to change the nonce every time, you will get a different hash value. This process is the so-called "mining".
In short, 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 on the network. At the same time, other network participants can update their own blockchains to include new blocks.
For today’s mainstream cryptocurrencies, it is quite challenging to meet the conditions. The higher the hash rate of a network, the harder it is to find valid hashes. This is to slow down the block generation speed.
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 as long as a valid hash is found, the protocol rewards you with cryptocurrency.
Let’s review what we know so far:
So far, everything is normal. But what happens if someone tries to cheat? How can we stop entering large numbers of fraudulent transactions into blocks to generate valid hashes?
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 techniques to verify whether someone has the authority to access a certain amount of funds.
When you create a transaction, you sign it. Users on the network can compare your personal signature with your public key to verify whether 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 amount is higher than the total output amount, that is, personal expenditures must not exceed the holding amount.
The network will automatically reject blocks containing invalid transactions. The cost of trying to cheat is very high. Not only is it a waste of resources, but you also get no rewards.
The mystery of proof of work is revealed - the cost of cheating is high, but the profit is huge if you operate honestly. Wise miners will pursue return on investment (ROI), act cautiously, and ensure profits.
Want to start your cryptocurrency journey? Go to Binance and buy Bitcoin now!
Proof of Stake (PoS) It is also a major focus among many consensus algorithms. The concept dates back to 2011 and has been implemented in a number of smaller protocols. But it has yet to gain adoption among 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 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 must lock in a stake, a predetermined amount of the blockchain’s native currency. A pledge works like a bail bond. For example, to prevent defendants from evading trial, they must pay a large bail amount, and verifiers need to lock in "pledge" to prevent cheating. In the event of fraud, all or part of the pledge will be confiscated.
Compared with proof of work, proof of stake does have certain advantages. The most obvious is the reduction in carbon footprint, since Proof-of-Stake does not require high-power mining farms and consumes only a fraction of the electricity of Proof-of-Work.
Even so, the popularity of Proof of Stake and Proof of Work is still far apart. Although considered wasteful, mining has proven itself to be the only consensus algorithm to gain mass use. For more than a decade, proof of work has secured trillions of dollars worth of transactions. To know whether proof of stake can compete with proof of work in terms of security, staking still needs to be fully tested in actual operations.
Proof-of-work is the initial solution to the double-spending problem and is reliable and Safety has also been verified. Bitcoin proves that we don’t need to rely on a centralized entity to prevent the same money from being spent twice. Participants in a decentralized environment can coordinately track the state of financial databases through the clever use of cryptography, hash functions, and game theory.