Proof of Work (PoW) and Proof of Stake (PoS) are ways of protecting a decentralized network against Sybil attacks.
A Sybil attack is when someone tries to get an unfair advantage by creating many nodes. If the decentralized network were to use a simple one-node-one-vote model of consensus on transactions, this would allow them to have an unfair say in how the system validates transactions. Using this dominant influence, they could then attempt to disrupt the network or affect the trustability of transactions and tokens on the network.
Both Proof of Work and Proof of Stake provide a better way of weighting the votes of nodes in conducting consensus.
Proof of Work: Here, nodes are weighted by requiring “miners” (nodes) to perform large amounts of computation. This computation involves three things: the hash of the previous block, the set of transactions to be added to the blockchain, and a nonce (a number that is changed after each wrong attempt) until the correct hash is found. That node then earns (or “mines”) a token reward.
In this way, PoW protects against Sybil attacks, as there is a scarce resource - computation - that nodes must expend in order to propose blocks to the network. Creating many nodes doesn’t help. This makes it more expensive to attack the network and is one of the innovations of Satoshi Nakamoto - using economic incentives to secure distributed systems.
Proof of Stake: Here, votes are weighted by the amount of “stake,” which are tokens that are locked to a node. This way, it doesn’t matter how many nodes the attacker creates because if stake is spread across many nodes, they each have very little voting weight.
This significantly increases the cost of attacking a PoS network, as an attacker would have to buy an overwhelming quantity of tokens to stake – typically more than a third of all of the tokens currently staked on the network. Because of this, the attacker would be disrupting a network in which they had invested a significant amount of capital!
PoS is becoming more popular as concerns around PoW energy consumption grows. The “scarce resource” in PoS systems is no more than a digital token, making all PoS systems vastly more energy-efficient than PoW systems – sometimes by 99.9%!
In most PoS blockchain systems, the more stake a node has, the more blocks they get to propose, thus earning more token rewards, similar to mining in PoW.
The stake delegated to a node incentivizes the node to confirm only valid transactions as if a majority of the network can prove that the node had voted for an invalid transaction (such as a “double-spend”), then the node may lose a part of its initial stake, in a process called “slashing.”
A prominent form of PoS is Delegated Proof of Stake (DPoS).