The Capital
Published in

The Capital

The Casper Protocols

Casper “The Friendly Ghost” — The Ethereum Proof-of-Stake Protocol

By Vince Tabora on The Capital

The Ethereum blockchain will implement a hard fork upgrade of its consensus mechanism, which is code-named Casper (As in “The Friendly Ghost”). The Casper protocols will move the Ethereum blockchain from Proof-of-Work (PoW) to Proof-of-Stake(PoS). This will alter the way Ethereum’s native token ether will be distributed. The purpose of the upgrade was to address issues of Second Generation blockchains, like efficiency and scalability.

The Limitations Of PoW

PoW is also the consensus mechanism used on the Bitcoin blockchain. On average, a block is propagated every 10 minutes for Bitcoin and 20 seconds for Ethereum. In PoW, nodes called miners compete to solve a cryptographic puzzle. The first miner to discover the value, called the nonce, will validate the block that is then added to the blockchain. The miner will receive a reward in return for their contribution.

While it is an effective solution, it is rather inefficient and not scalable enough for higher volume workloads. It is inefficient because it requires consuming plenty of electricity due to the computations, measured in hashes per second (h/sec). It also has scaling issues because the consensus by design cannot process more transactions per second (Bitcoin 3–7 tps, Ethereum 15 tps). Overall PoW has proven to be effective, but it is quite slow since it cannot scale, inefficient because of the amount of energy required to validate a block and expensive due to the costs of electricity (in some areas).

Since the requirement for mining has reached higher standards, it leaves miners with fewer resources at a disadvantage. This means miners must either join a mining pool or dedicate more resources. This requires higher costs for investing in specialized devices that provide hashing power. As a result, mining becomes more centralized under a few large mining pools. There are more barriers to entry for new miners due to these higher standards required in mining.

Some would argue that despite being slow and inefficient, the cooperation of nodes makes the network more secure. That in itself is why PoW has been effective for Bitcoin. However, the problem is when you need the network to handle more transactions it will not be able to scale. There is also the issue that mining is becoming more centralized since there are only a few large mining pools controlling most of the mining.

The Move To PoS

This is when the Ethereum community decided on implementing a successor to PoW which is PoS. This has become a common feature used in the consensus of Third Generation blockchains (e.g. EOS, Tron, Tezos). The developers who proposed to move to PoS wanted to address some of the following issues:

  • Scalability — PoS will provide enhanced scalability to the network.
  • Decentralization — Developers want a more decentralized way for nodes to participate with less barriers to entry.
  • Efficiency — Put an end to energy inefficient mining, to more efficient staking.
  • Censorship Resistance — More fairness for those who want to validate a block.

In PoS, nodes no longer need to mine for validating blocks on the network. Instead, a node will stake a portion of their funds in a special wallet. The nodes are referred to as stakers. Each staker will then place a bet on a block that they wish to validate. If the block gets appended to the blockchain, then the stakers will get a reward proportionate to their bets.

There are consequences if the staker attempts to attack the network with malicious intent. One type of attack is called “Nothing At Stake”. In a blockchain, during the mining or staking process, various chains can be formed in parallel to the main network’s chain. The chain whose blocks get validated then becomes a part of the main chain. As a staker trying to validate a block, you can just put your funds on any chain at the same time. The idea here is that whatever happens, you always win and have nothing to lose.

To address this problem, the protocol included a way to reprimand stakers who attempt to do this. In this case, the staker will lose the funds they staked, so they cannot put their stake on 2 or more chains at the same time. Stakers will be punished for malicious intents, to discourage them from attacking the network. If there is collusion among stakers, they are jeopardizing their own stake, which they can lose. This is a form of policy to protect the network.

Another important feature of PoS is mitigating against too much centralization. This problem is completely mitigated in PoS because of one reason — In PoS, nodes must invest a stake. Nodes pooling together to stake more valuable funds does not work. A node is a node, in a 1:1 relationship. Staking means a one-to-one relation to the amount of funds put into a stake. A stake cannot be made together by a pool of nodes. Staking pools can still be done, but by 1 node or staker who can be backed by several individuals or organizations who contribute to a stake. The amount of validating power is based on a node’s stake, rather than hashing power.

In PoS, the amount staked is akin to the hashing power. The main difference is that staking does not require as much energy to produce a block. According to definition, for PoS: (miner and staker are interchangeable)

This way, instead of utilizing energy to answer PoW puzzles, a PoS miner is limited to mining a percentage of transactions that is reflective of his or her ownership stake. For instance, a miner who owns 3% of the Bitcoin available can theoretically mine only 3% of the blocks.

What PoS will allow on the Ethereum blockchain is incentivization to nodes based on their ownership of the digital asset staked.

The staker who gets to validate a block is not just determined by the amount staked. Otherwise, that would not be fair to the rest of the network since the node that stakes the highest amount always wins. Instead, there are different methods that can be used. One technique uses the Randomized Block Selection method. This can select stakers by looking for nodes with a combination of the lowest hash value and the highest stake. It must be a truly random process that favors the highest stake, but not always favor the same staker in order to give other stakers a chance.

PoS moves away from a Zero-Sum Game theory in mining, to a more Coordination Game dynamic with staking. In mining, if a miner loses a block (miners can make mistakes when they create a block) they get censored during the process. It doesn’t benefit the miner, but the rest of the miners do benefit. In staking, the rewards for everyone are highest when all stakes are included. This is because stakers will need to cooperate together to validate a block. No one gets censored anymore based on hashing power, it will be randomized to give more fairness in the validator selection process. This topic can be further explained by understanding Coordination Game Theory.

The Ethereum Ice Age And Difficulty Bomb

During the transition process, Ethereum will undergo what is called an “Ice Age” after the Casper hard fork. During this period, PoW and PoS will be allowed on the network. Nodes can still mine, but will now have the option to stake. The Ice Age will implement a difficulty adjustment on the validation of blocks on the network. This will gradually increase difficulty for mining blocks, with more incentive placed on staking blocks.

This is a way to incentivize more nodes to stake rather than mine. This will lead to the Ethereum “Difficulty Bomb” in which it will be so difficult to mine for blocks, nodes will be discouraged from mining. It will become so difficult that it will reach a point where the network becomes “frozen” from further mining activity. This aims to move toward staking as the block validation for consensus.

The following is an excerpt from a mining difficulty simulation:

The increase in difficulty will push the average block time to the point where it will become so difficult, the block time will be “infinitely” impossible to producing any blocks.

A proposal was drafted to delay the difficulty bomb as the the development community felt it was not yet ready. It became better known as the Muir Glacier Network Upgrade (hard fork), and was activated at block number 9,200,000 on January 2, 2020. This was drafted in EIP 2384: Muir Glacier Difficulty Bomb Delay. This follows the Istanbul Hard Fork to delay the difficulty bomb for another 4,000,000 blocks (~611 days). More information about this can be found on the EIP2384 website.

The Two Caspers

There are two proposed versions of Casper, which is why I refer to them as protocols (plural form). These protocols resulted from research by Ethereum developers to come up with improvements to the blockchain.

Casper FFG (Friendly Finality Gadget)
The FFG code was first released in May 2018 for peer review. This was seen as the first transition of the main network from PoW to PoS. The FFG proposed a hybrid PoW/PoS model. Existing PoW mechanics are used to create new blocks, while Casper the FFG is layered on top using a smart contract. Every 50th block on the network goes through a PoS checkpoint where finality is assessed by a network of validators. This aims to provide a smooth transition to PoS and stronger finality when it comes to block validation.

According to Vitalik Buterin (Ethereum founder), there are 3 main reasons Casper FFG provides stronger finality than PoW:

  • “First, there is a standard definition of “total economic finality”: it takes place when 2/3 of all validators make maximum-odds bets that a given block or state will be finalized. This condition offers very strong incentives for validators to never try to collude to revert the block: once validators make such maximum-odds bets, in any blockchain where that block or state is not present, the validators lose their entire deposits. As Vlad Zamfir put it, imagine a version of proof of work where if you participate in a 51% attack your mining hardware burns down.”
  • “Second, the fact that validators are pre-registered means that there is no possibility that somewhere else out there there are some other validators making the equivalent of a longer chain. If you see 2/3 of validators placing their entire stakes behind a claim, then if you see somewhere else 2/3 of validators placing their entire stakes behind a contradictory claim, that necessarily implies that the intersection (ie. at least 1/3 of validators) will now lose their entire deposits no matter what happens. This is what we mean by “economic finality”: we can’t guarantee that “X will never be reverted”, but we can guarantee the slightly weaker claim that “either X will never be reverted or a large group of validators will voluntarily destroy millions of dollars of their own capital.”
  • “Finally, even if a double-finality event does take place, users are not forced to accept the claim that has more stake behind it; instead, users will be able to manually choose which fork to follow along, and are certainly able to simply choose “the one that came first”. A successful attack in Casper looks more like a hard-fork than a reversion, and the user community around an on-chain asset is quite free to simply apply common sense to determine which fork was not an attack and actually represents the result of the transactions that were originally agreed upon as finalized.”

Casper CBC (Correct By Construction)
This version relies on a safety oracle also called the “ideal adversary”. This is to constantly fine-tune a partially built PoS protocol until the system has been completed. CBC uses the idea of an ideal adversary to create a sort of sandbox environment for development. It is not a final solution to PoS, but one that is constantly in progress. This allows developers to identify bugs in the process and introduce solutions to fix them.

According to ethstaking:

CBC’s Validator Slashing Trilemma solution is designed to force a reasonable compromise among these Zamfir’s Triangle (Named after Vlad Zamfir, creator of CBC) tradeoffs:

a. Finality Latency: how long it takes the network to finalize a proposed block.
b. Resource Overhead: how many blocks per second must validators verify.
c. Decentralization: how many validators can exist in the network.

The goal of the solution is to create the optimal balance (a “You can’t have it all” compromise) between three competing desired outcomes:

a. High Cost of Attack (defense)
b. High Valuation Yield (maximum rewards)
c. Low ETH Issuance (inflation control)

The Final Protocol

The implementation or final release of Casper will use both versions FFG and CBC, but more developments can always arise. What is for sure is that this has been a part of the Ethereum roadmap to move Ethereum away from PoW to PoS. There is plenty of excitement in this area and that surely affects investment speculations on the price of ether. However, the technology must be separated from the speculation.

There are still challenges in PoS that are being questioned by critics. This includes security in which the vulnerabilities of PoS were pointed out, namely the risk associated with staking. These are surely being addressed by developers because it is not something to put aside when it concerns the entire network.

Improving the network efficiency, scaling and security is always a priority. When Ethereum successfully implements Casper and slowly transitions to PoS, we will see just how prepared the developers were in addressing those issues.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store