Share and get +16 +16

In this guide, we present to you the definitive guide to ethereum Casper and how it will change Ethereum forever.

If you are interested in Ethereum or Cryptocurrency in general, then you must be aware of the terms proof-of-stake and ethereum Casper. There is no running away from these terms, they are everywhere. (If you are not and want to learn more in greater detail, please check out our courses.) Now because there is so much data out there, anyone interested in the topic may go through “paralysis via analysis”.

What is ethereum Casper Protocol? Crash Course

What is proof of work?

Most cryptocurrencies including Bitcoin run on “proof-of-work.” Proof-of-work as a process has the following steps to it:

The miners solve cryptographic puzzles to “mine” a block to add to the blockchain.

This process requires an immense amount of energy and computational usage. The p uzzles have been designed in a way which makes it hard and taxing on the system.

uzzles have been designed in a way which makes it hard and taxing on the system. When a miner solves the puzzle, they present their block to the network for verification.

Verifying whether the block belongs to the chain or not is an extremely simple process.

Train to Become A Blockchain Developer Start Your Free Trial Today!

That, in essence, is what the proof-of-work system is. Solving the puzzle is difficult but checking whether the solution is actually correct or not is easy. This is the system that Bitcoin and ethereum (till now) have been using. However, there are some fundamental flaws in the system.

The problem with proof of work.

As it turns out, there are quite a few problems with proof-of-work.

First and foremost, proof of work is an extremely inefficient process because of the sheer amount of power and energy that it eats up.

People and organizations that can afford faster and more powerful ASICs usually have a better chance of mining than the others.

As a result of this, bitcoin isn’t as decentralized as it wants to be. Let’s check the hashrate distribution graph: ethereum Casper Protocol? Crash Course” width=”685″ height=”524″ />Image Credit: Blockchain.info

As you can see, ~65% of the hashrate is divided among five mining pools alone!

Theoretically speaking, these big mining pools can simply team up with each other and launch a 51% on the bitcoin network.

So, to solve these problems, ethereum looked to Proof of Stake as a solution.

What is Proof of stake?

Proof of stake will make the entire mining process virtual and replace miners with validators.

This is how the process will work:

The validators will have to lock up some of their coins as stake.

After that, they will start validating the blocks. Meaning, when they discover a block which they think can be added to the chain, they will validate it by placing a bet on it.

If the block gets appended, then the validators will get a reward proportionate to their bets.

The Biggest Roadblock to Proof of Stake

Ethereum developers always planned to eventually move on to proof of stake, that was always their plan. However, before they could do so, they had to address one of the biggest flaws of proof of stake(POS).

Consider this scenario for a moment:

ethereum Casper Protocol? Crash Course” width=”1018″ height=”537″ />

Suppose we have a situation like the one above. There are a main blue chain and a red chain which sort of branches from the main itself. What is there to stop a malicious miner from mining on the red blocks and force a hardfork?

In a proof-of-work(POW) system, this risk can be mitigated.

Suppose malicious miner Alice wants to mine on the red chain. Even if she dedicates all of her hash power to it, she won’t get any other miner to join her on the new chain. Everyone else will still continue to mine on the blue chain, because it is more profitable and risk-free to mine on the longer chain.

Now, remember, POW is extremely expensive resource-wise. It makes no sense for a miner to waste so much resource on a block that will be rejected by the network anyway. Hence chain splits are avoided in a proof of work system because of the amount of money that the attacker will have to waste.

However, things look a little different when you bring in POS. If you are a validator, then you can simply put your money in both the red chain and blue chain without any fear of repercussion at all. No matter what happens, you will always win and have nothing to lose, despite how malicious your actions maybe.

This is called the “Nothing at Stake” problem, and this is something that ethereum had to address. They needed a protocol which could implement POS and mitigate the “Nothing at Stake” problem.

Enter Etheruem Casper

Casper is the POS protocol that ethereum has chosen to go with. While there has been an entire team busy creating it, Vlad Zamfir is often credited as being the “Face of Casper.”

Image Credit: Blocknomi.

So how is Casper different from other Proof of Stake protocols?

Casper has implemented a process by which they can punish all malicious elements. This is how POS under Casper would work:

The validators stake a portion of their Ethers as stake.

After that, they will start validating the blocks. Meaning, when they discover a block which they think can be added to the chain, they will validate it by placing a bet on it.

If the block gets appended, then the validators will get a reward proportionate to their bets.

However, if a validator acts in a malicious manner and tries to do a “nothing at stake”, they will immediately be reprimanded, and all of their stake is going to get slashed.

As you can see, Casper is designed to work in a trustless system and be more Byzantine Fault Tolerant.

Anyone who acts in a malicious/Byzantine manner will get immediately punished by having their stake slashed off. This is where it differs from most other POS protocols. Malicious elements have something to lose so it is impossible for there to be nothing at stake.

This is not the only place where Casper punishes the validators.

As Hudson James and Joris Bontje note in their answers in “StackExchange,” Casper designs harsher incentives to guarantee network security, including punishing miners who go offline, unintentionally or not.

This means that validators will have to be careful about their node uptime. Carelessness or laziness will lead to them losing their stake. This property reduces censorship of transactions and overall availability.Along with all that, the “slashing” property also lends Casper a distinct edge over standard proof of work protocols.

Let’s bring back our chain diagram again:

In a proof of work protocol, it doesn’t matter whether a miner mined on the blue chain or the red chain. Both the honest and the malicious miner would have spent the same amount of resources.

In Casper, however, if an honest validator mines on the blue chain then they would get reward proportionate to their bet, however, a malicious miner will get their stake slashed off for betting on the red chain.

ethereum Casper vs. Ethereum Casper?

Image Courtesy: Medium

Casper is not one specific project. It is an amalgamation of two research projects which is currently being undertaken by the ethereum dev team. The two projects are:

Casper the Friendly Finality Gadget (FFG)

Casper the Friendly GHOST: Correct-by-Construction (CBC)

Casper FFG

Casper FFG aka Vitalik’s Casper is a hybrid POW/POS consensus mechanism. This is the version of Casper that is going to be implemented first. This is pretty much designed to ease the transition into proof of stake. The way it is designed is that there is a proof-of-stake protocol overlaying on top of the normal ethash proof of work protocol. So while blocks are still going to be mined via POW, every 50th block is going to be a POS checkpoint where finality is assessed by a network of validators.

So what is finality?

Finality, in very loose terms, means that once a particular operation has been done, it will forever be etched in history and nothing can revert that operation. This is particularly important in fields which deal with finance. Imagine that Alice owns a particular amount of an asset in a company. Just give of some glitch in the company’s processes, she shouldn’t have to revert ownership of that asset.

Some people say that proof-of-work is the one way that finality can be achieved in the blockchain. However, that is not necessarily true. The truth is far more complex than that.

As Vitalik Buterin notes, no system in the world provides 100% finality. It is possible to hack into a system, or physically break into a registry and tamper with numbers to change one’s mark sheet. That is a big problem with centralized institutions. However, decentralized systems have faced the same issue as well.

In fact, bitcoin, the poster child of proof-of-work mechanism has faced finality issues at least three times. On one instance, the chain had to fork because of a bug that existed in one version of the software and didn’t in another. This led to a split in the community where one part refused to accept a chain that was accepted by the other half. This split was resolved in 6 hours.

So, the question is, how does Casper FFG provide finality? According to Vitalik, Casper is guaranteed to provide stronger finality than proof-of-work because of three reasons:

Total Economic Finality. 2/3rd of validators make maximum odd bets to finalize the blocks. Because of this, there is very little incentive for them to collude and attack the network since they are jeopardizing their own deposits if they do so. Vlad Zamfir put it best when he said:” Imagine a version of the proof of work where if you participate in a 51% attack your mining hardware burns down”.

Imagine that the entire network is made of three people: Alice, Bob and Charlie. Suppose Alice and Bob are placing their stakes behind one claim and Bob and Charlie are placing their stakes behind a contradictory claim. No matter what happens, either Alice or Charlie stands to lose a significant amount of money.So as you can see, the validators have no incentive to collude and act in a malicious manner because they always stand to lose a lot of money.

However, if a double finality does occur, there is a contingency plan for that as well. If a double finality occurs, then users have a choice as to which chain they want to go for. Whatever chain gets the majority vote becomes the dominant chain. So basically, double finality in Casper would end up in a hard fork instead of a reversion.

Casper CBC

Casper CBC aka Vlad’s Casper uses the correct-by-construction (CBC) protocol. So what is, is the CBC protocol? (Most of the data taken from Vlad Zamfir’s edcon presentation and Jon Choi’s “Ethererum Casper 101” article).

This is what a normal protocol design looks like:

You formally specify the protocol.

Define the properties that the protocol must satisfy.

Prove that the protocol satisfies the given properties.

This is what a CBC protocol looks like:

You formally but partially specify the protocol.

Define properties that the protocol must specify.

Derive the protocol in a way that it satisfies all the properties that it was stated to specify.

In layman’s terms, you are sort of deriving the protocol dynamically. One of the ways to derive the full protocol is to implement an estimate safety oracle called an “ideal adversary” which does one of the following:

Raises exceptions of a fault of a justified estimate.

Lists out any future failures that can happen.

So, what this ideal adversary is going to do, is that it is going to constantly fine-tune and perfect the partially built protocol until it is complete.

As can be seen, the ethereum dev team has been hard at work with these two Casper projects. This is obviously not going to be the final version, but whatever it will be, will be heavily influenced by both Vlad’s and Vitalik’s Caspers. As has been stated, Vitalik’s Casper is going to be implemented first to ease the transition from POS to POW. Vlad’s Casper, on the other hand, is going to derive a safety proof via the utilization of an ideal adversary.

Why do we need ethereum Casper?

There are several advantages of implementing proof-of-stake. They can all be broadly listed down among the following categories. (Big shoutout to Jon Choi and his article).

Helps achieve decentralization.

Energy efficiency.

Economic security.

Scaling.

Transition to POS.

Achieving Decentralisation

As we have seen above, POW protocols are not really decentralization friendly anymore. Let’s check out the hashrate distribution chart for bitcoin again:

And here is the hashrate distribution of the mining pools in ethereum:

Image Courtesy: Etherchain.org

As you can see, the majority of the hashrate is concentrated within some specific pools, and this means that no matter what happens, they will always have a better chance of mining blocks and obtaining rewards than anyone else.

Because they can obtain more money, they can, therefore, afford better and faster ASICs. This basically means, no matter what happens, big mining pools will always have an edge over individuals and smaller pools. In other words, the rich will always get richer.

Proof-of-stake makes this completely irrelevant by making mining completely virtual. However, that’s not the only way POS mitigates the effects of centralization. In order to understand that, first we need to know what “Economies of Scale” means. (Thank ACDCLeadership youtube channel for the data).

When it comes to production, there are two kinds:

Short Run production.

Long Run production.

In the short run production, at least of the input resources are fixed. Consider a small-time pizzeria which has only one oven. It doesn’t matter if they have to produce 1 pizza of 25, there is only oven that they can use to create those pizzas.

In a long run production, all the resources are variable, and this is where economies of scale come in.

So, in a long run production where the quantity of the input resources is variable, what happens if you double the input? There are only three outcomes to this particular scenario. We call this “returns to scale”.

The output more than doubles. Meaning there is an increasing return to scale.

The output doubles. Meaning there is a fixed return to scale.

The output does not double. Meaning there are decreasing returns to scale.

The following will show you a graphical representation of economies of scale.

Image Courtesy: Wikipedia

What exactly is going on here?

When the production is increased from Q to Q2, the overall cost of the production goes down from C to C1. This is called Economies of scale.After that, it evens out for a bit. This is where you get constant returns to scale.And then when you go beyond that, the cost increases as you increase the output beyond Q2.

What this means is that large corporations can decrease the average cost of their products by increasing the quantity of their outputs! (Till a limit)

In a sense…more is less!

Let’s take a real-world example of that.

A small-time baker’s initial costs will obviously be less than a big baking company’s because the company will have to invest in a lot of machinery. However, over the long run, the average cost of every loaf of bread will be much lesser for the company than it is for the baker.

Ok, all this is fine, but how does it apply to mining pools?

Quite like big corporations, larger mining pools can decrease the cost of their input resources by:

Amortizing a fixed cost over a larger operation.

Having bargaining power by operating as a larger entity.

What this means is, a large, influential mining pool can, dollar-for-dollar, generate more hash-rate than other pool even if they spend the same amount of money.

This problem is completely mitigated in proof-of-stake because of one simple reason. In POS you invest a stake. You can’t simply pool together and make your stake more valuable dollar-for-dollar. At the end of the day, 1 dollar = 1 dollar. Economies of scale don’t work here.

Energy Efficiency

The biggest problem of Proof-of-work is the energy wastage. The worst part is that it is energy wastage for the sake of energy wastage. Bitcoin, in particular, is voracious in its appetite for energy. Check this out:

Image Courtesy: Digicnomist

How about some more numbers (courtesy Digicmonist)

There are two numbers that you should focus on.

The annual global mining costs of bitcoin is $1,423,794,674.

Bitcoin alone annually consumes 28.48 TWh worth of electricity. The country of Ecuador consumed around 21 TWh!

In fact, let’s compare bitcoin’s energy consumption when compared to some countries:

Bitcoin consumes more power than Ireland, Bahrain, and the Slovak Republic!

Ok, let’s even the playing field.

What if we compare Bitcoin to other payment systems? Say…Visa.

How does the power consumption of bitcoin compare to that of visa?

Yeah…not good.

So it is obvious that bitcoin eats a lot of power, and there is a lot of money spent on the resources. However, what about the external costs? The effect that this amount of power consumption has on the environment must be immense.

While there is no doubt that bitcoin and POW has made a lot of positive social changes, we should at least see what a large scale POS system can do and whether it work just as well without consuming so much power.

Economic Security

The biggest advantage that POS, and especially Casper, has is its economic security. Think about this, suppose you are a validator and you have your own money stored up as the stake in the network. It is in your own interests to act in the best interest of the network. Why would you act maliciously knowing that there is a huge part of your stake which can be slashed away and taken over if you do?

Why would you attack a network and harm the coin’s value when you have so much of your currency locked up in it?

Also, this “slashing effect” removes the chance of a “spawn camping attack” as Vitalik coins it:

Image Courtesy: Vitalik Buterin Twitter.

Spawn attacks can be prevented in POS by the simple fact that just one attack will lead to the slashing and removal of the invested stake. And if you don’t have any stake invested you cannot take part in POS validating.

Scaling

The most obvious way that POS is going to help scalability is by enabling sharding.

As Vlad Zamfir says, sharding with POW is not impossible, but it is hard.

What is sharding?

Sharding is a term that has been taken from database systems. Let’s see what sharding means with respect to the database. Suppose you have a huge bulky database for your website. Having a bulky database not only makes searching for data slower, but it also hinders your scalability. So, what do you do in this case?

What if you do a horizontal partition on your data and turn them into smaller tables and store them on different database servers?

Like so?

Now, you might be asking, why a horizontal partition and not a vertical partition? That is because of the way tables are designed:

Consider this. Suppose this is our main table:

You see what happens? When you vertically partition a table, they tend to become two completely different tables altogether.

However, if we were to partition them horizontally:

You see? It is the same table/database but with lesser data. These smaller databases are known as shards of the larger database. Each shard should be identical with the same table structure.

So what will happen if we do implement sharding in a POW protocol?

Sharding will make processing faster by splitting a state into different shards. However, if we are using POW, the smaller shards will be in danger of being taken over by malicious miners because of its low hashrate. In fact, this is the biggest reason why POW blockchains can never implement sharding, any and all small shards can be easily taken over.

This risk is completely mitigated in POS since it doesn’t have the concept of mining.

Transition to POS

Now, this is more of a philosophical discussion.

People, in general, are not that good with change. When they get used to something, it is very difficult for them to get out of that comfort zone.

This can be particularly tricky for a currency system whose value is entirely based on its perceived value by the masses. As of writing, ethereum is worth ~ billion.

It will be incredibly irresponsible to drop the POS bomb on the people and expect them to just get with the times. It might reduce the public’s faith in the system, and the value of ethereum may drop. Hence, it is much more prudent to have a gentle transition from POW to POS that Casper FFG is planning to do.

So do the “rich get richer”?

One of the most recurring criticisms of the POS protocol is that it is just making the rich people richer. Since in order to even qualify as a validator, you need to lock up a significant portion of your fund as a stake and even then, you will get rewards in proportion to the amount that you are betting. So, if you have more money in the system you will get more money.

However, Jon Choi in his article refutes this as so:

“The main takeaway here should be that Proof of Stake is considerably more egalitarian (i.e., gives less benefit to having more capital) than the incumbent Proof of Work-based algorithm of Bitcoin.”

The main reason behind this is the Economies of scale discussion that we have had above. In a POS a dollar is still a dollar, and big pools can’t get away with having more hashrate for the same amount of money invested.

The Future of Ethereum Casper

Recently, as of writing, Vitalik Buterin said that not only is Casper ready for testing but it could provide a security boost when testing code across clients. While it doesn’t look like it is ready for widespread adoption yet, it looks like the date of the first Casper testnet is coming closer and closer.

It is not a question of IF proof of stake is going to be implemented or not, it is a question of WHEN. ethereum Serenity is supposed to be a proof-of-stake network. It is not like we have never seen an implementation of POS before, Peercoin implemented it quite successfully. However, we have never seen the adoption of the protocol at this level before.

Maybe, if Casper is implemented successfully, the other cryptocurrencies may follow suit and make the transition as well. Whatever be the case, Casper brings in a lot of enticing possibilities.