Skip to content →

How does consensus algorithms Proof-or-Work and Proof-or-Stake actually work?

Proof-of-Work is an algorithm for reaching consensus in the blockchain. It is used for confirming the transaction and creating new blocks. Thanks to PoW, miners are competing with each other for the right to complete the transaction and receive the reward.

After the network users send digital tokens to each other, all transactions are gathered into blocks and recorded in the distributed ledger which is also called the blockchain. However, it is necessary to exercise caution when confirming the transaction or organizing the block.

The network operation is based on solving complicated math problems and the possibility to easily prove that the solution has been found.

Article navigation:

  1. What math problem does PoW solve?
  2. How do blockchain and transaction work?
  3. Realization of PoW within the Bitcoin network
  4. Which algorithms use PoW?
  5. The advantages of Proof-of-Work.
  6. The disadvantages of PoS
  7. What is the 51% attack and what threats does it carry?
  8. The principle of work of Proof-of-Stake
  9. The differences between Proof-of-Stake and Proof-of-Work.

What math problem does PoW solve?

This is only one problem, the solution of which requires the use of significant computing capacities. There are many such problems:

  • A hash function, or an attempt to find input, knowing the output;
  • Decomposition of the whole number into multipliers;
  • “The visitor’s puzzle”: if the server suspects a Dos attack, it asks the client to compute the hash functions, sometimes in a certain order, then this is the problem of computing the values of the hash function chain.

PoW requires the use of hashing.

As the network grows, the problems become more complicated and the hashing algorithms require even more computing capacities which make the problem difficulty an acute issue.

How do blockchain and transaction work?

The accuracy and the speed of blockchain depend on this mechanism. At the same time, the problems shouldn’t be too complicated, otherwise, the procedure of block generation will take a long time, and all unfinished transactions will “freeze” in the network. If this issue won’t be solved in the near future, the process of block creation will turn into a fluke.

If the problem is solved too simply, this would make the system vulnerable to abuse, spam and Dos attacks.

The solution should be easily verifiable, otherwise, not all nodes will be able to understand whether the calculation was performed correctly; in this situation, they will have to trust other nodes which directly contradicts one of the fundamental principles of the blockchain, which is the full transparency.

Realization of PoW within the Bitcoin network

Miners solve the problem, form a new block and confirm the transactions. The complexity of the task depends on the number of users, the current capacity and the load on the network. Besides, the hash of each block contains the hash of the previous block which increases its security and makes it impossible to jeopardize the order of the already created blocks.

A new block is formed when the miner solves the problem; it contains the next set of transactions which are considered to be confirmed.

Which algorithms use PoW?

It is used in many cryptocurrencies. Certainly, Bitcoin is the most popular of them, and it was Bitcoin that had set this trend. It uses the Hashcash algorithm that allows changing of task’s complexity, depending on the total processing capacity of the network. On average, it takes 10 minutes to form a block. The similar system was implemented in cryptocurrencies that were created on the same principles as Bitcoin, for example, Litecoin.

Ethereum is another major project that uses PoW. Taking into account that almost three-quarters of all blockchain projects are based on this platform, it can be said with certainty that most applications use the consensus model with the Proof-of-Work.

The advantages of Proof-of-Work

The main advantages of PoW are its protection against Dos attacks and the low impact of the share of the cryptocurrency in the ownership of the miner on the mining capabilities.

PoW imposes certain limitations with regard to participants’ actions because of significant efforts which are required for solving the problem. An effective attack requires enormous computing capacities and prolonged calculations, therefore it is theoretically possible but not profitable due to its high cost.

The amount of money in your wallet is irrelevant; the computing capacities, which allow solving the task and creating new blocks, are more important. Therefore, the owners of large capitals can’t make decisions for the entire network.

The disadvantages of PoS

Main problems: huge expenses, “uselessness” of calculations and the “51% attack”.

In order to perform complex calculation, specialized and expensive computer equipment is required.

The expenses are growing uncontrollably, thus mining becomes affordable only for the large groups of miners. Moreover, specialized computers consume large amounts of energy, which increases the expenses and leads to the gradual centralization of the system; it is more profitable this way, and that is exactly what is happening to Bitcoin.

The miners are creating new blocks and consuming a lot of energy in the process. However, their calculations are useless in their essence. They do guarantee the safety of the network but these calculation results can’t be used in business or science.

What is the 51% attack and what threat does it carry?

The 51% attack or the majority attack becomes possible in situations where a user or a group of users control most of the network’s power. This gives them the ability to control the occurrences on the network. They can monopolize the process of creation of new blocs and receive all the reward because it is in their power to prevent other miners from completing the blocks.

Moreover, they can cancel the transactions.

For instance, Alice has sent Bob some money via blockchain. Alice participates in the 51% attack while Bob doesn’t; their transaction should finalize the block but the attackers prevent the transaction from happening which results in the bifurcation of the network.

Then the attacking miners are joining one of the threads and, since they have more computational capacity, their chain gathers more blocks.

Due to its specific design, the network accepts only longer chains and rejects shorter ones, which means that the transaction between Alice and Bob will not go through and Bob won’t get the money.

That’s how the perpetrators can cancel any transaction.

The 51% can rarely bring any profit because it requires a lot of computing resources. Besides, as soon as the users find out that the network is compromised, they start leaving it, which inevitably leads to the decrease of the cryptocurrency’s value.

The principle of work of Proof-of-Stake

PoS works a bit differently. Instead of solving cryptographic problems, the transactions are validated “freezing” a certain amount of coins that belong to miners as a financial security. The coins will remain frozen until the “agreement” regarding the validity of the transaction is reached. In order to reach the consensus in the network, the transactions are added to the blockchain while the coins are kept frozen for a little while to protect them from possible attack as well as double-spending.

Once the coins get unfrozen, the miners are able to get all of them back plus a small commission for putting the transaction into the blockchain.

Such an algorithm is designed to discourage the hackers from validating forged transactions because of the risk of losing the “pledge”.

The differences between Proof-of-Stake and Proof-of-Work

The obvious advantage of Proof-of-Stake over Proof-of-Work which lies in the fact that t former does not require the large consumption of electricity which makes it much more efficient. However, it is not the only advantage: it also provides means for integration of the new generation of the management system by providing those who participate in the network the opportunity to choose between hard and soft forks.

Another thing that proves PoS superiority over PoW is that within this algorithm, the possible attack would be literally pointless because it requires a large number of coins to be put at risk.

At the same time, PoS may be beneficial for those who try to accumulate large amounts of coins in their hands and dictate their will to other participants in the network. Such developments would have a negative effect on the decentralization of the network.

PoW and PoS are the basic mechanisms that are used to confirm the completion of work in crypto networks. However, there are other less know and widespread algorithms that serve the same purpose.

Proof of Activity. A standard hybrid scheme which combines PoW and PoS.

Delegated Proof of Stake. A general term that describes the evolution of basic consensus PoS protocols. BitShares uses DpoS as well as other algorithms like Slasher and Tendermint.

Proof of Burn. The actual “burning” occurs by sending coins to a wallet from which it cannot be spent. By getting rid of their coins in such way, the users obtain the right for lifetime mining, which is also organized as a lottery among all owners of burnt coins;

Proof of Capacity. The realization of a popular “Megabytes as resources” concept. In essence, it is necessary to allocate a significant amount of disk space to get involved in mining;

Proof of Storage. This concept is similar to the previous one: the allocated space is used by all participants as a shared cloud storage.