What is proof-of-work and how does it work? Explained in 5 minutes!🕛
Notes * This is a document written by Andrew Tar, a collaborator at CoinTelegraph.
Proof-of-work, often abbreviated as PoW, is a consent algorithm of a Blockchain network used to confirm transactions (which I remember are stored inside the blockchain itself) and then, subsequently, produce new blocks to be added to the chain. With PoW, the miners (those who extract coins and certified the transactions) compete against each other to complete the transactions by receiving prizes. The prizes are none other than the commission fee of the currency. (the cost necessary to make a transaction happen).
The responsibility for making the transactions be stored and collected in the blocks is of the miner, and the whole process, from storage to transaction confirmation, is called mining.
The main operating principles are a complicated mathematical puzzle and the ability to easily find the solution.
The term mathematical puzzle is described as a problem that requires a lot of computational power to solve, such as:
hash function, or how to find the input knowing the output.
whole factorization, in other words, how to present a number as a multiplication of two other numbers.
Puzzle protocol for guided tours. If the server suspects a DoS attack, it requires a calculation of the hash functions, for some nodes in a defined order. In this case, it is a problem "how to find a chain of values of hash functions".
The answer to the PoW problem or the mathematical equation is called hash.
As the network is growing, it is facing ever more difficulties. The algorithms need more and more hash power to solve. Thus, the complexity of the task is a delicate problem.
The accurate work and speed of the Blockchain system depend on this. But the problem should not be too complicated. If it is, block generation takes a long time. The transactions are blocked without execution and, as a result, the workflow hangs for some time. If the problem can not be solved in a defined period of time, the generation of blocks will be a kind of miracle. But if the problem is too easy it is subject to vulnerabilities, DoS attacks and spam. The solution must be easily controlled. Otherwise, not all nodes are able to analyze if the calculations are correct. So you'll have to trust other nodes and violate one of Blockchain's most important features: transparency.
How is this algorithm implemented in Blockchain?
Miners solve the puzzle, form the new block and confirm the transactions. How complex a puzzle depends on the number of users, the current power and the load of the network. The hash of each block contains the hash of the previous block, which increases security and prevents any block violation.
If a miner manages to solve the puzzle, the new block is formed. The transactions are placed in this block and considered confirmed.
And where is PoW usually implemented?
Proof-of-work is used in both Bitcoin and some AltCoins. (only those that need the work of mining, there are some cases of pre-mined coins such as the Ripple.) The most famous application of PoW is Bitcoin. Bitcoin was the basis for this kind of consent. The puzzle is Hashcash. This algorithm allows you to change the complexity of a puzzle based on the total power of the network. The average block formation time is 10 minutes. Bitcoin-based cryptocurrencies, like Litecoin, have the similar system.
Another great project with PoW is Ethereum. Given that almost three of the four projects are implemented on the Ethereum platform, it is safe to state that most Blockchain applications use the PoW consensus model.
Why use a PoW consensus algorithm first?
The main advantages are the defense of anti-DoS attacks and the low impact of bets on extraction possibilities.
Defense against DoS attacks. PoW imposes some limits on actions in the network. They need a lot of effort to be executed. An efficient attack requires a lot of computing power and a lot of time to perform the calculations. Therefore, the attack is possible but useless as the costs are too high.
Possibility of extraction. No matter how much money you have in your wallet. What matters is having a great computational power to solve puzzles and form new blocks. Therefore, holders of huge sums of money are not in charge of making decisions for the entire network.
Any flaws in the PoW consensus algorithm?
The main disadvantages are huge expenses, "useless" calculations and 51% attack.
Huge expenses. Extraction requires highly specia computer hardware specialized in executing complicated algorithms. Costs are unmanageable and extraction activity is becoming available only for special mining pools. These specialized machines consume large amounts of energy to meet these costs. The high costs threaten the centralization of the system as it benefits from it. It is easy to see in the case of Bitcoin.
51% attack, what are you talking about?
A 51% attack, or majority attack, is a case in which a user or a group of users controls most of the extraction power.
Attackers receive enough energy to control most of the events on the network.
They can monopolize the generation of new blocks and receive rewards as they are able to prevent other miners from completing the blocks.
They can reverse transactions.
Suppose Alice sent money to Bob using Blockchain. Alice is involved in the case of a 51 percent attack, Bob no. This transaction is inserted in the block. But the attackers do not let the money transfer. There is a bifurcation in the chain.
In addition, the miners join one of the branches. And because they have most of the computational power, their chain contains more blocks.
In the network there remains a branch that lasts longer and a shorter one is rejected. So the transaction between Alice and Bob does not take place. Bob does not receive the money.
By following these steps, attackers can reverse transactions.
The 51% attack is not a viable option. It requires an enormous amount of mineral energy. And once public exposure is achieved, the network is considered compromised, which leads to the outflow of users. This inevitably shifts the price of cryptocurrency downwards. All consequently, the funds lose their value.
"Uselessness" of the calculations. Miners do a lot of work to generate blocks and consume a lot of energy. However, their calculations are not applicable elsewhere. They guarantee network security, but can not be applied to business, science or other fields.