What are PoW and PoS?
In any blockchain network, two main types of messages are transmitted: transactions and blocks. Transactions are generated by participants in the system, and knowing the private key of the wallet is sufficient to send them. However, blocks need additional protection.
In decentralized networks, any participant can make changes to the database, but without additional security mechanisms, this can lead to various manipulations. Therefore, when cryptocurrencies were created, methods were devised to secure the blockchain from data tampering or the issue of double spending. In order for the blockchain to reflect the majority's decision, network participants need to reach an agreement using consensus mechanisms.
For example, to prevent data modification in previous information blocks, a hash function with a capture of the previous block's signature is used. In other words, to change any data in old blocks, an attacker would have to recalculate all the blocks that follow, which is usually extremely time-consuming and economically impractical.
A hash is an arbitrary set of letters and numbers created when data is processed through a hash function.
If the same data is hashed, the result will remain the same. However, if even a single digit is changed in the original data, the hash will be completely different. It is also a one-way function, meaning that seeing the final result does not reveal the information that was passed through this function.
Blocks are created by a special category of nodes in the blockchain network, known as consensus nodes.
In the case of Bitcoin, these nodes are called miners because they are rewarded for mining by generating new portions of the cryptocurrency. It is the Bitcoin miners who form its blockchain by constantly grouping incoming transactions into blocks and spreading them throughout the network.
Consensus is the process by which a group of network nodes determines which transactions in the blockchain are valid and which are not.
Proof of Work (PoW)
PoW is the precursor of all other consensus algorithms. It was first implemented in Bitcoin, but the concept itself existed long before that. Proof of Work was described as early as the 1990s and was originally used to combat spam. However, using PoW to achieve consensus in a distributed network became a significant innovation.
The term "proof of work" reflects the fact that finding a block requires performing computational work, the expected quantity of which is measurable.
The essence of the technology is that miners must shuffle the data they want to include in a block in such a way that its hash contains a specific number of zeros at the beginning, for example, 00000000022f88d2da21bd2802268966050f5a0b031058ce4562939c13727303.
Each consecutive zero at the beginning of the hash makes the task more difficult for miners, so they have to expend more computational power (to work).
The difficulty of mining lies in the complexity of finding a suitable hash to sign the block. The network's difficulty automatically adjusts depending on the computational power to maintain a relatively consistent block-finding speed.
The actual transaction ledger in the PoW mechanism consists of a chain of blocks with the highest cumulative difficulty. In other words, miners must search for new blocks on top of existing ones; otherwise, they will be rejected by other network participants as invalid. Although theoretically, there is no prohibition on creating new blocks based on an old block, the cumulative difficulty of such a chain would be lower, leading to its rejection.
Occasionally, technical blockchain splits occur when two miners find a new block almost simultaneously. In such cases, the PoW mechanism helps protect the blockchain from double spending by simply discarding the shorter branch and leaving only one of them valid. Due to such potential splits, there is an unwritten rule in the community to wait for not just one, but several confirmations (meaning the number of blocks after).
For Bitcoin, waiting for 3 confirmations is usually sufficient. It is believed that the probability of discarding a chain of three blocks tends toward zero, so it can be fully trusted.
However, the computations performed within PoW do not serve any socially useful purpose; they are merely architectural features of blockchains. In other words, an excessive amount of resources is spent on mining, which could have been used to solve more pressing problems for humanity.
PoW is used by Bitcoin (BTC), Ethereum Classic (ETC), Dogecoin (DOGE), Litecoin (LTC), Monero (XMR), Zcash (ZEC), Dash (DASH), and others.
Proof of Stake (PoS)
Against the backdrop of criticism of PoW, the community proposes numerous alternative consensus algorithms that do not require "work." The most popular category of such algorithms is based on Proof of Stake (PoS). Proof of Stake is similar to Proof of Work, except that instead of performing a specific task, the author of a new block demonstrates ownership of a necessary stake in the network's tokens. In PoS, mining only requires holding a certain reserve of cryptocurrency and earning "interest" from it.
Consensus nodes in such networks are called validators (instead of miners), and the process of reaching consensus is called staking (instead of mining).
The PoS system does not require miners' participation, the use of specialized equipment, or massive electricity consumption— a regular personal computer is sufficient. Therefore, it is considered more environmentally friendly.
PoS is used by Ethereum (ETH), Cardano (ADA), Algorand (ALGO), Tezos (XTZ), and others.
Delegated Proof of Stake (DPoS)
Both of the mechanisms mentioned above have their pros and cons, leading to the constant emergence of other versions. For example, there is a modification of the PoS consensus mechanism known as Delegated Proof of Stake (DPoS). This system relies on reputation-based voting to achieve consensus. Network users "vote" for the selection of validators from a predefined list of reliable nodes.
DPoS is used by Lisk (LSK), EOS (EOS), Steem (STEEM), Ark (ARK), and others.
In addition to Proof of Work and Proof of Stake, blockchain enthusiasts constantly experiment with other algorithms.
Proof of Authority (PoA)
"Proof of Reputation" works by selecting network validators based on reputation. In PoA, validators do not lock their coins in staking but must stake their reputation on the line to confirm blocks. This significantly differs from most blockchain protocols, which usually do not require participants to disclose their identity.
Proof of Capacity (PoC) / Proof of Space
To act as a validator in such networks, one needs to share their hard disk space. This helps in sharing unused software resources for rewards.
Proof of Elapsed Time (PoET)
Proof of Elapsed Time is used in permissioned blockchain networks (those that require participants to identify themselves). PoET utilizes trusted computing to ensure random wait times for block creation.
Proof of History (PoH)
PoH allows embedding "timestamps" into the blockchain itself, "marking" the time that passed between transactions without relying on other nodes.
Directed Acyclic Graphs (DAG)
A Directed Acyclic Graph (DAG) does not use the standard blockchain structure and processes transactions mainly asynchronously.
Nodes distribute their transactions by linking them randomly to other nodes, resulting in all transactions being intertwined.
In theory, this allows for an infinite number of transactions per second, but DAG consensus has both strengths and weaknesses.
DAG is used by Iota, Hashgraph, Raiblocks/Nano, and others.
There is still no universal method for achieving consensus. Each consensus mechanism has its own set of advantages and disadvantages, so there is no established principle that satisfies all trust criteria in distributed networks while effectively utilizing the computational resources of its users.