Consensus: Proof of work vs proof of stake
One problem all blockchains face is how to determine what transactions go in the next block. Each node has a copy of the current state of the blockchain, and if more than one node tries to add a block at the same time, the nodes wouldn't agree on which chain is the correct one.
Therefore, all blockchains have a system to decide which node gets to create the next block and thus agree on the next block to add to the chain. Blockchain developers call this process of getting the nodes to agree on the state of the chain consensus, and it's extremely important for the stability of the chain, both in terms of the blockchain data itself and the community that uses it.
The two major consensus mechanisms blockchains use are called proof of work and proof of stake.
Proof of work
On proof-of-work blockchains such as Bitcoin, nodes compete for the right to create the next block. The first node to solve a cryptographic puzzle creates the block and shares it with the other nodes. Then the process repeats for the next block. This process of competing to create blocks is often called mining because the node that creates the block receives cryptocurrency as a reward, like discovering something valuable in a mine.
Because proof of work is a competitive process, it becomes environmentally wasteful as miners use more and more energy and computer hardware to race to create the next block. Some proof-of-work blockchains use an enormous amount of electricity and computer hardware compared to the number of transactions that they process.
Proof of stake
By contrast, proof of stake is a collaborative process. People who want to participate must deposit, or stake, a certain amount of cryptocurrency as collateral and as proof that they are invested in the system. They then share in the rewards as new blocks are created. Because there is no competition for the next block, proof-of-stake blockchains tend to use far less energy and require far less computing power than proof-of-work blockchains.
On Tezos, blocks are created by a specific type of Tezos node called a baking node. Unlike mining nodes on proof-of-work blockchains, Tezos baking nodes don't need to be powerful computers, and adding computing power doesn't improve the baker's chances of creating the next block.
People who want to run a baking node must stake at least 6,000 tez. Then, the right to create the next block is given to a baking node at random, and that node receives the rewards for that block. The more tez the baker stakes, the more likely they are to be selected to create the next block, which encourages people to invest in the system. Also, bakers that misbehave lose all or part of their stake, which keeps the system honest.
Tezos also allows people to participate in baking without running a baking node themselves. Anyone can become a delegator by staking tez with a baker, and there is no minimum or maximum amount they can stake. Then, delegators receive a share in the rewards proportional to the amount of their stake.
Both bakers and delegators retain control of the tez that they stake, and they can withdraw it and stop baking at the end of a baking cycle.
Quiz: Consensus
In Tezos, what determines a baker's likelihood of creating the next block?
A: How many baking nodes they are running B: How much processing power their baking node has C: How much tez they stake D: How many people delegate tez to them
As a developer, you may not deal with baking directly, but you should know how the system works, how people participate, and how consensus is achieved among nodes. For more information about how Tezos handles proof-of-stake, see these resources:
- The article Liquid Proof-of-Stake on Medium
- Proof-of-stake in the Octez documentation
- Liquid Proof-of-Stake on opentezos.com