Introduction of Casper, the proof of stake system for Ethereum
By Inkarias - 2020-10-28
Since its creation, Ethereum has used a proof-of-work validation mechanism: miners make their computing power available to secure the blockchain and are rewarded with ethers for this. The validation method is quite similar to Bitcoin, with the one exception that the proof-of-work algorithm used, called Ethash, favors graphics card (GPU) mining at the expense of specialized integrated circuits (ASICs). However, it has been planned from the start that Ethereum will at some point adopt another consensus method known as proof-of-stake. A difficulty bomb has also been incorporated for this purpose within the protocol: mining by proof of work is becoming more and more difficult, and if nothing is done, network security could suffer. Proof of stake in Ethereum is expected to emerge with an algorithm called Casper.
Casper in few words
Casper is the name of the proof-of-stake algorithm that is under development and aims to replace Ethash as the validation mechanism for the Ethereum chain. Casper was born from the adaptation of an algorithm developed for proof of work allowing to reduce the time between each block and which is already partially implemented in Ethereum: GHOST or Greedy Heaviest Observed SubTree. Hence its name, which is a direct reference to the Casper cartoon, the Friendly Ghost. The project was formalized in August 2015. Two competing versions of Casper are currently being developed in parallel: the “original” version by Vlad Zamfir, titled The Friendly GHOST: Correct-by-Construction and commonly referred to as Casper CBC; Vitalik Buterin's version called The Friendly Finality Gadget and abbreviated as Casper FFG. It was originally intended that Casper FFG would be a hybrid transition solution that complements the proof of work, but this has not been the case since June 2018. The main difference between these two versions is that CBC seems to have better properties while FFG should be easier to implement. Along with sharding, Plasma and eWASM, Casper is one of the main building blocks of Ethereum 2.0, the evolution of Ethereum towards more efficiency and scalability which is expected to emerge with the Serenity upgrade.
A reminder about Proof-of-Stake and the benefits for Ethereum
Proof-of-Stake, is a blockchain validation method whose principle is to reproduce the mining process in a virtual way, no longer based on the computing power, but on the possession of tokens. The validators are no longer minors, but what we call forgers. A forger builds a block of transactions and signs it to prove that he is indeed the owner of the tokens. The more coins he has, the more chances he has that his block will be accepted as a solution and that he will win the reward. Since he is economically tied to the protocol, he is encouraged to be honest. In the case of Ethereum, the token to own is ether (ETH). Historically, the idea behind proof of stake is older than the concept of proof of work. It is thanks to the success of Bitcoin that proof of stake research has experienced a resurrection. The proof of stake idea for a blockchain was introduced by Sunny King and Scott Nadal in 2012. Peercoin (PPC), launched in 2013, was the first cryptocurrency to implement it: its consensus mechanism used indeed a hybrid model of proof of work and proof of stake.
Proof of stake has some major advantages over proof of work. The main one is its reduced energy consumption, which can be interesting from an ecological point of view, but especially important economically. Indeed, since validators need to use much less resources, their reward (consisting of the issuance of tokens and transaction fees) can be considerably reduced. The reduced energy consumption also results in less centralization of validation. In the case of Ethereum, the proof of stake would therefore make it possible to drastically increase the transactional capacity of the network without impacting its decentralization.
What does Casper solve?
It is planned from the start that Ethereum will move to proof of stake: that was Vitalik Buterin's wish when it was created. However, the task turns out to be more difficult than it looks. As we said, proof of stake is based on a simple principle, but its practical implementation is a complex thing to set up.
First, a naive proof-of-stake implementation leads to a problem known as the Nothing-at-Stake or “nothing to lose” problem. In the case of proof of work, if a fork in the chain occurs, a miner must necessarily choose one of the two versions. If he chooses the wrong one, he is punished: he spent energy for nothing. This encourage miners to focus on a single channel, and in so doing, maintain consensus. In the case of proof of stake, a forger is not subject to the same constraints. It can indeed validate two competing versions of the chain since it has the same number of ethers on both. Worse, he has to do it if he wants to maximize his earnings.
The solution to this problem is to institute a penalty model, which would punish forgers who do not follow the “right chain”, thus copying the situation of loss of energy that takes place in mining. This resolution was implemented in 2014 by Vitalik Buterin in Slasher, a punitive proof-of-stake algorithm that predates Casper. In Casper, this was addressed by a system of security repositories that validators must bring into play to participate. The idea is that the size of the deposit must be very large compared to that of the reward: if the validator plays the game, he wins a little; if he cheats, he loses everything. This deposit system also makes it possible to solve another problem, which is that of corruption, in particular in the case of a long-range attack. The idea behind this attack is that a malicious individual bribes ether holders to obtain their private keys in exchange for a bribe. These holders send their funds to another address and sell them. Once he has recovered enough keys, the attacker can then use these historical funds to build a "fictitious" chain which would be the longest and therefore the one to be accepted by the network. In other words, the voting power of each validator will be determined by the amount of ETH he puts into play. For example, someone who has deposited 64 ETH will have double weighting in their voting power versus someone who has deposited the minimum stake amount. To become a block validator in the first phase of Serenity, users will need a minimum stake of 32 ether (ETH) - deposited into a contract special smart based on the old/current Ethereum blockchain. If all goes well, random committees of validators will be selected to come up with new blocks and ultimately receive block rewards in return. Block rewards will likely only be a transaction fee as there will be no block subsidy. It should be noted, however, that each PoS implementation may have a different approach, with different reward models. The Casper model is still in development, and many details have yet to be worked out.
In Casper, this flaw was addressed by making all validator withdrawals final, that is, by preventing nodes from reversing a withdrawal. This is done through a list of linked validators. Of course this poses other problems such as that of weak subjectivity, but it is admitted that this problem is much less impactful than the one it solves.