Note
For a comprehensive coverage of blockchain development in Ethereum or mastering Solidity programming, taking our below self paced courses is highly recommended:
- Blockchain Solidity Course for Beginners
- Ethereum Developer Course
- Blockchain Security Course for Beginners
Recap
In our previous article (How Sharding and Gasper work in Ethereum), we covered how Sharding and Gasper work in Ethereum
In this article, we learn how the Proof-of-Stack consensus is used in Ethereum.
PoS consensus in Ethereum
As we discussed our previous article, Ethereum Architecture and Ecosystem, Ethereum is shifting from a PoW-based consensus mechanism to PoS-based consensus mechanism, which will be implemented as part of the Casper work stream. However, there are two separate approaches proposed, Casper FFG and Casper CBC. Both will facilitate an Ethereum move to PoS, but the design philosophies behind both approaches are quite different.
Casper FFG, also known as Casper the friendly finality gadget, is a hybrid PoW and PoS consensus mechanism proposed by Vitalik. Just like the current implementation, it leverages a Stash-based PoW mechanism to create new blocks. On top of the PoW-based chains, it leverages a pool of PoS validators to check the finality of the blocks periodically, typically every 50 or 100 blocks, called one epoch.
Validators stake their ethers on the network. They get rewarded with new ether if they successfully check the finality, or get penalized otherwise. As depicted here, once one epoch of blocks is created, a validator will be selected out of a validator pool and will start assessing the finality of all blocks in the current epoch on the blockchain:
One of issues with PoS consensus, at least theoretically, is that nothing is at stake. The doubt about PoS is that the stake alone won’t deter the bad behavior. For example, in the case of a potential temporary fork, validators could potentially build on both sides of the fork, and make the temporary fork forever, since they will collect a transaction fee no matter if they win or lose. This also makes the finality issue even worse.
One-to-One Live Blockchain Classes
Coding Bootcamps school offers One-to-One Live Blockchain Classes for Beginners.
Casper CBC proposed by Vlad Zamfir, also called the Friendly GHOST Correct-by- Construction is a protocol designed to address the finality and nothing-at-stake issue. The theory behind this is that validators can make a decision about which path to build new blocks on, based on the messages they’ve seen from other nodes:
- The message includes the sender or the validator, the blocks where it arrives, and the justifications.
- It can provide knowledge regarding how other validators reach a decision on the latest blocks.
- If two messages are sent by the same validator with no knowledge links between them, it is considered as invalid, and the validator will be penalized with the stake.
Both Casper FFG and Casper CBC are active work streams in the Ethereum community. The final PoS implementation in Casper may depend on how each one works out. Casper FFG probably is the one to give you a taste of the PoS consensus mechanism in Ethereum, and CBC will give us a pure PoS implementation with a finality safety guarantee. One of the planned phases in the Ethereum 2.0 roadmap, the PoS beacon chain with sharding, will implement the PoS consensus mechanism on the beacon chain as an overlay to the Ethereum main chain and leverage Casper FFG for block finality.
Next Article
In our next article (A roadmap for Implementing Ethereum 2.0), we discuss the roadmap for implementing version 2 of Ethereum.
This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.
Resources
coming soon