DeFi Academy All you need to know

What is the difference between Proof of Work and Proof of Stake?

1inch Network-photo

by 1inch Network

• 4 min read

By leveraging the Proof of Work and Proof of Stake algorithms, blockchain networks achieve consensus, ensuring integrity and security by employing different approaches to qualifying participants for block creation.

Key takeaways:

Consensus algorithms facilitate finding an agreement between all nodes participating in the network. They coordinate the network’s operation by defining rules for the transaction validation process.
The two most widely used consensus algorithms are Proof of Work (PoW) and Proof of Stake (PoS).
PoW sets rules for miners’ work, while PoS regulates validators. Miners and validators process transactions and add new valid blocks to the blockchain.
PoW involves competition between miners who need to solve computational tasks. The more processing power miners use, the faster they perform computations and start forming new blocks.
Miners profit from transaction fees and rewards for completing blocks.
Under PoS, validators are selected randomly but taking into account their amount of staked native tokens. A validator node is required to process a block of transactions.
Validators profit from network fees and tips for prioritizing a transaction.

Consensus algorithms define a stack of rules that coordinate the operation of a blockchain network. These rules include an algorithm for nodes’ operation, a reward plan and protocols established to achieve an agreement on the correct state of the blockchain and transaction records.

The two most prevalent consensus algorithms are Proof of Work (PoW) and Proof of Stake (PoS). 

Under these consensus models, nodes perform an essential role related to network security.  First, each new transaction submitted to the blockchain must be confirmed by a certain number of nodes.Then it goes to the mempool, where it is broadcasted to other nodes. Pending transactions wait to be picked and added to a block by mining nodes (miners) or validating nodes (validators). PoW sets rules for miners’ work, while PoS regulates validators. Both miners and validators process transactions and add new valid blocks to the blockchain, but the two algorithms differ foremost in the mechanism used to select the nodes to validate the blocks.

How does PoW work? 

PoW is the oldest consensus algorithm introduced with the appearance of Bitcoin. In addition to the Bitcoin network, PoW is used in the Dogecoin and Litecoin networks, as well as in many other chains.

PoW uses a competitive validation method. Miners compete to validate blocks by first trying to guess a 64-bit hash value. Hash is data passed through a formula and generated in a string of characters of a certain length.

Transaction and block data are converted into the hash with each block featuring a unique header that serves as its identifier. It contains a substantial amount of data, including a nonce and a target hash. The target hash is a numeric value that the hashed block header must not exceed. Meanwhile, the nonce, which stands for a  “number used only once,” is added to the hashed block to ensure its uniqueness.

The hash solution starts with this data. A miner adds the nonce value into the hashed data from the previous block, and this combined data is hashed again. If the resulting hash value is less than or equal to the target hash, the miner who has solved the puzzle can add the newly validated block of transactions to the blockchain.

Sometimes, multiple miners come up with the solution at the same time. Then everyone mines their block as extended branches of the most recent block. After adding a few more new blocks, the length of each extended branch chain is evaluated. Only the chain with the most extended length remains, and the rest of the branch chains are discarded. All transactions recorded in the discarded blocks are canceled, and users get their funds back.

By spending more processing power on the hashing algorithm, miners get a higher capacity to solve the task. This is the reason why the consensus is called Proof of work - those who have committed significant resources (work) have a better chance of being rewarded. The more powerful hardware is connected to the system, the faster the count.  

After being verified within the formed block, the transaction is considered to be completed. When new blocks are added, new coins are minted, and a miner receives a reward. It comes as a certain amount of newly mined coins for a block.

The main feature of the PoW algorithm to be criticized is that it is not environmentally friendly. As blockchain tech evolves and hashes become more challenging to solve, mining requires greater computing power, consuming large amounts of electricity.

Another weakness is low transaction speed. Typically, it takes about ten minutes to confirm a block, though approving a single transaction can often take much longer, especially during periods of high network demand.

How does PoS work?

PoS is the consensus mechanism in Ethereum, BNB Chain, Cardano, Avalanche and many other networks. The first condition of activating the validator node is to stake - lock - a certain amount of native network tokens in a smart contract. For example, on Ethereum, a user must stake at least 32 ETH. Staking is similar to a bank deposit and allows for earning passive income and withdrawal of funds after a certain time period. 

Secondly, to become a validator, a stakeholder must run a node – a piece of software that provides transaction verification on devices that are supposed to function 24/7 and be connected to the internet.

After users have staked the required amount of native network tokens, received validator privileges and programmed their nodes, they have to wait to be selected for validating a transaction as part of the block creation process. A block is generated within 12 seconds. Participants who stake more native tokens over a longer period of time are more likely to be selected to add blocks. The block value depends on the size of the validator’s stake and on the number of validators in a blockchain.

When completing the validation process, a committee of automatically selected validators vote on each block. Once added to a block, transactions cannot be changed or reversed.

Validators profit from priority fees sent by users to speed up block creation. They have the ability to rearrange pending transactions to form a specific queue order, optimizing their earnings from block creation. Additionally, validators receive yield from staking.

Although staking requires no investment in expensive equipment and no power consumption, while offering high transaction speeds, it also has some drawbacks. For instance, validators with more significant amounts of staked funds can have more weight within the network and impact transaction validation. Plus, staking carries the risk of changing the value of locked assets either upwards or downwards.

1inch Network-photo

1inch Network

Share the article

Copy done!
Copy done!