Blockchain : Proof-of-Stake (PoS)

ANURAG SINGH CHOUDHARY 12 Oct, 2022 • 7 min read

This article was published as a part of the Data Science Blogathon.

Introduction

Proof-of-stake is a cryptocurrency consensus mechanism for processing transactions and creating new blocks in the blockchain. A consensus mechanism is a method for validating records in a distributed database and keeping the database secure. In the case of cryptocurrency, the database is called the blockchain – so the blockchain provides the consensus mechanism.
Proof of Stake (PoS) is an algorithm aiming to achieve distributed consensus in the blockchain. This way of achieving consensus was first proposed here by Quantum Mechanic and later written up by Sunny King and his colleagues. This led to Peercoin based on Proof-of-Stake (PoS). A stake is a value/money we bet on a certain outcome. The process is called staking.
Proof-of-Stake
source:https://101blockchains.com/proof-of-stake/

Understanding Proof-of-Stake (PoS)

Proof-of-stake decreases the amount of computational work necessary to confirm blocks and transactions. As part of proof-of-work, it kept the blockchain secure. Proof-of-stake changes the way blocks are verified using the coin owners’ machines, so there’s not as much computational work. Owners offer their coins as collateral – bets – for the ability to verify blocks and then become validators.
Validators are chosen randomly to confirm transactions and verify block information. This system randomly selects who will collect fees rather than using a competitive reward-based mechanism such as proof-of-work.
To become a validator, a coin owner must “stake” a certain amount of coins. For example, Ethereum requires 32 ETH to be staked before a user can become a validator.
Blocks are validated by more than one validator, and when a certain number of validators verify that the block is correct, it is complete and closed.

Different proof mechanisms may use different methods to achieve consensus. For example, when Ethereum implements sharding, a validator validates transactions and adds them to the shard block, which requires at least 128 validators on the committee.

Once the shards are verified, and a block is created, two-thirds of the validators must agree that the transaction is valid, then the block is closed.
cryptocurrency transactions

source:https://www.youhodler.com/blog/proof-of-stake-vs-proof-of-work

Why Proof-of-Stake?

Before Proof of Stake, the most famous way to attain distributed consensus was through Proof-of-Work (implemented in Bitcoin). But Proof-of-Work is quite energy intensive (electricity when mining bitcoins). Thus, a consensus mechanism based on proof-of-work increases the chances of an entity mining a new block if it has more computing resources. In addition to the two points above, there are other weaknesses of the PoW-based consensus mechanism, which we will discuss later. In such a scenario, a mechanism based on Proof-of-Stake is important.

What is Proof-of-Stake?

As the name implies, nodes in the network stake a certain amount of cryptocurrency to become candidates for validating a new block and receiving a fee. The algorithm then selects a node from the pool of candidates to verify the new block. This selection algorithm combines the amount of deposit (amount of cryptocurrency) with other factors (such as selection based on coin age, and randomization process) to make the selection fair for everyone in the network.

Coin-age-based selection:

The algorithm keeps track of how long each candidate validator node remains a validator. The older the node, the higher the chance of becoming a new validator.

Random Block selection:

The validator is selected by combining “lowest hash value” and “highest stake.” The node that has the best-weighted combination of them becomes the new validator.

A typical workflow of a PoS-based mechanism

  1. Nodes perform transactions. The PoS algorithm puts all these transactions into a pool.
  2. All nodes fighting to become validators for the next block raise the stake. This stake is combined with other factors such as “coin age” or “random block selection” to select a validator.
  3. The validator verifies all transactions and publishes the block. His bet remains locked, and the forgery reward has also not yet been awarded. This is so that nodes in the network can “OK” a new block.
  4. The validator will get the stake back and the reward if the block is OK. If the algorithm uses a mechanism based on coin age to select validators, the validator for the current block has its coin age reset to 0. This puts it in low priority for the next validator election.
  5. If other nodes in the network do not validate the block, the validator loses his stake and is marked as “bad” by the algorithm. The process starts again from step 1 to create a new block.

Function

Fixed existing coins:
There are only a finite number of coins ever circulating in the network. There is no existence of bringing new coins into existence (as in mining in the case of Bitcoin and other PoW-based systems). Remember that the network begins with a finite number of coins or “from the beginning it starts with PoW, then moves to PoS in multiple cases.” This initiation with PoW is to bring coins/cryptocurrency to the network.
Transaction fee as a reward to coiners/counterfeiters:
Each transaction is charged a certain amount. This is collected and passed to the entity that creates the new block. Please note that the transaction fee will not be rewarded if the forged block is found to be fraudulent. In addition, the validator’s bet is also lost (also known as chopping).
The impracticality of 51% attack:
To perform a 51% attack, an attacker must own 51% of the total cryptocurrency in the network, which is quite expensive. This finds the attack execution too time-consuming, expensive, and not so profitable. There are problems with accumulating such a share of the total cryptocurrency, as there may not be as much currency to buy, and it will become more expensive to buy more and more coins/value. Also, validating incorrect transactions will cause the validator to lose their deposit, making the reward negative.
Proof-of-Stake

source:https://capital.com/proof-of-stake-definition

Advantages of PoS

  • Energy saving: Since all nodes are not competing to add a new block to the blockchain, energy is saved. Also, no problem needs to be solved (as in the case of a Proof-of-Work system), thus saving energy.
  • Decentralization: In blockchains such as Bitcoin (a Proof of Work system to achieve distributed consensus), there is the added incentive of exponential rewards for joining a mining pool, leading to a more centralized nature of the blockchain. In the case of a system based on Proof-of-Stake (such as Peercoin), the rewards are proportional (linear) to the deposit amount. So it provides no additional benefits for joining a mining pool, thereby supporting decentralization.
  • Safety: A person trying to attack the net must own 51% of the stakes (quite expensive). This leads to a secure network.

Weakness of PoS mechanism

  • Big Bet Validators: If a group of validator candidates come together and own a significant share of the total cryptocurrency, they will have a better chance of becoming validators. The increased odds lead to bigger withdrawals, leading to more rewards being earned, which leads to owning a huge share of the currency. This can be the reason for the network to come to be centralized over time.
  • New technology: PoS is still relatively new. Research is ongoing to find the flaws, fix them, and make them viable for a live network with real currency transactions.
  • The “Nothing at Stake” Problem: This problem describes little to no disadvantage for nodes if they support multiple blockchains, in the case of blockchain forking. In the worst case, each fork will lead to multiple blockchains, and validators will work, and the nodes in the network will never reach a consensus.

Goals of Proof-of-Stake

Proof-of-stake is designed to reduce network congestion and environmental sustainability concerns associated with the proof-of-work (PoW) protocol. Proof-of-work is a competitive approach to verifying transactions that naturally encourages people to look for ways to gain an advantage, especially when monetary value is involved.
Bitcoin miners earn bitcoins by validating transactions and blocks. However, they pay their operating costs such as electricity and rent in fiat currency. What happens then is that miners exchange energy for cryptocurrency, which makes PoW mining consume as much energy as some small countries.
The PoS mechanism seeks to solve these problems by effectively replacing computing power with staking, where the ability of an individual to mine randomly is the network. This means there should be a drastic reduction in power consumption, as miners can no longer rely on massive farms of single-purpose hardware to gain an edge.

Proof-of-Stake security

Long touted as a threat to crypto fans, the 51% attack is concerning when using PoS, but there are doubts that it will happen. According to PoW, a 51% attack is when an entity controls more than 50% of the miners on the network and uses that majority to alter the blockchain. In PoS, a group or individual would have to own 51% of the staked cryptocurrency.
Controlling 51% of the cryptocurrency staked is very expensive. Under Ethereum’s PoS, if a 51% attack were to occur, honest validators on the network could vote to ignore the altered blockchain and burn the offender’s staked ETH. This incentivizes validators to act in good faith for the benefit of the cryptocurrency and the network.
Most of the other security features of PoS are not advertised, as this can create an opportunity to bypass security measures. However, most PoS systems have additional security features that add to the inherent security behind blockchains and PoS mechanisms.

Conclusion

“Proof of stake” and “Proof of work” are the two major consensus mechanisms that cryptocurrencies utilize to confirm new transactions, attach them to the blockchain, and generate new tokens. Proof of work, first pioneered by Bitcoin, uses mining to achieve these goals. Proof of stake – used by Cardano, the ETH2 blockchain, and others – uses stakes to achieve the same things.

Key Takeaways:

  • With proof-of-stake (POS), cryptocurrency owners verify block transactions based on the number of coins staked.
  • Proof-of-stake (POS) was created as an alternative to Proof-of-work (POW), the original consensus mechanism used to validate the blockchain and add new blocks.
  • While PoW mechanisms necessitate miners to clear up cryptographic puzzles, PoS mechanisms need validators to squeeze and stake tokens for the privilege of collecting transaction fees.
  • Proof-of-stake (POS) is considered less risky regarding the potential for a network attack because it structures the compensation in a way that makes the attack less advantageous.
  • The next block writer on the blockchain is chosen randomly, with higher odds assigned to nodes with larger stake positions.

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.

Frequently Asked Questions

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

Responses From Readers

Clear