Finding Consensus 3/4: Proof Of Stake

Photo by Michał Parzuchowski

Hello there, awesome that you’ve made to blockwhat?. In today’s post we will continue our journey into the fascinating realms of how consensus is found in different blockchain systems!

After having taken an in-depth look into Proof of Work in the last post, this piece will focus on another highly popular consensus mechanism — Proof of Stake. We will look at it’s history, analyze how it works and what makes it stand apart from other forms of finding consensus, but also look at its potential limitations.

Ready? Then let’s get going.



Consensus

Photo by rawpixel

The importance of finding consensus and the extraordinary difficulty of it, especially in decentralized systems, has been explained in length in the prior two post on Finding Consensus, therefore we won’t dive too deep into this baseline here. If you want to recap the essentials of this interesting topic, I’d recommend you to give them a quick read:

Part one focused on Byzantine Fault Tolerance

And part two on Proof of Work

With the growing popularity of Bitcoin in the years after it has seen the day of light in 2009, more and more people started to get interested in the underlying technology, known as blockchain.

Many other blockchain projects were started in those years, which in the beginning all continued to make use of Bitcoin’s consensus mechanism, Proof of Work (PoW).

While PoW is very effective at securing the public ledger and creating a strong set of incentives to act in an honest and integer way, it tends also to be very energy consuming. That particular aspect is due to the nature of the way consensus is found — participating nodes (aka computers) try to guess the right solution to a complicated cryptographic puzzle. By utilizing a lot of computational power, they require a lot of energy, which turns into tangible costs for the users who own the computers.

Along comes the prolific developer Sunny King, who in 2012 proposed a completely new way of finding consensus, which he dubbed Proof of Stake.

His idea revolved around finding a way to achieve consensus by internalizing the whole process — instead of using external hardware, which consumes a lot of energy to run, he came up with a purely software-based mechanism to validate blocks and therefore finding consensus.

He first implemented this idea in his cryptocurrency project Peercoin.

Peercoin

Before we take a look at how this mechanism works, it’s essential to understand that public blockchains inherently need to have a cryptocurrency (aka token), since its fundamental properties of security and honesty are due to the financial incentives enabled through rewarding honest behavior by giving out these tokens.

For example, Bitcoin achieves to maintain the integrity of their public ledger due to all the miners who take part in the mining race, at which end there lays a reward of not only the transaction fees, but also an amount of newly generated Bitcoin.

With that understood, we will now examine of Proof of Stake functions:

First of all, the participating computers in a Proof of Stake network are normally not called miners but rather forgers or minters. Every node that wants to take part in the process of forming a new block of transactions and gain the right to propagate it to the whole system, need to show its commitment to wanting to perform this duty. In order to demonstrate this willingness, participants need to stake an amount of the coin that is being used on that particular blockchain.

This is done by creating a special transaction, which locks the amount of cryptocurrency in a special deposit — the amount is now considered staked.

Using a lottery style mechanism, the system then randomly chooses a participating user (who has a stake) as a validator for a block of transactions, and thus gives him a financial reward in the form of transaction fees and newly minted coins (not always though, this differs from project to project).

The more coins a user has staked, the higher is the chance of being selected.

Photo by Jonathan Petersson

Now you might think that sounds like a situation ripe for abuse of some wealthy big wales, who hold a huge chunk of the respective coins?

Well, in order to ensure a certain level of fairness, there are a couple of ideas that have been developed — their implementation again depends on the specific blockchain in question of course.

One of most widely used concepts is Coin Age Selection.

The idea behind this is simple, you multiply the amount of coins in the deposit with the number of days they have been staked — the higher the resulting cumulative Coin Age, the higher the chance of being selected. There are a couple of rules that normally tend to apply for this concept:

In order to be considered for the selection process, the coins need to be staked at least for a duration of 30 days. The maximum age that a coin can accumulate is reached after 90 days. Also, if a user has been chosen as a block validator, a new transaction is created that sends the staked coins back into the user’s wallet — this automatically resets the timer a user has to wait before being eligible for the selection process once more.

How does this system ensure an honest behavior you might ask yourself now?

It turns out that in the case of an invalid block being propagated to the rest of the system, the respective user would lose his deposit. This creates a strong incentive to act with integrity, since everything else would result in ensured financial loss.

The main advantages of Proof of Stake are mainly the following three:

A high energy efficiency, especially compared to PoW, which is due to the purely software based nature of it.

Also, the possibility of people grouping their resources together and thus creating large mining pools doesn’t lead to an exponentially growing influence, as would be the case in PoW — therefore potentially strengthening the decentralized nature of the system.

Last but not least, security plays a big role. A majority attack, in which a malicious actor controls the majority of the network, would require the attacker to be in possession if at least 51% of the total supply. If somebody would actually want to stage such an attack, the more tokens would be bought would lead to an increasing token price, making it extremely expensive. Should the attack then go through, the coin value would most certainly drop immensely — leading to a huge financial loss of the attacker.

On an interesting side note, there are two things that I’d love to share with you.

The first one revolves around the creator of this consensus mechanism, Sunny King, who created another very interesting blockchain in 2013, which goes by the name of Primecoin. This system used Proof of Work as the underlying consensus mechanism, but combined the mining with something really useful — searching for Prime numbers, which then in turn can be used by scientist free of charge.

From a historic perspective it might also be very interesting for you to dive into the story of Wei Dai’s b-money idea from 1998. In it, Dai proposed a similar concept of using staked deposits as a mean of dis-incentivizing bad behavior.

Next up, we’ll take a look at some alternative consensus mechanisms that have been created based upon Proof of Stake.


Alternative PoS Mechanisms

Photo by Adi Goldstein

One of the best known alternatives is the so-called Delegated Proof of Stake model.

It works by combing real time voting with a social system of reputation. All the users of the system can vote for delegates (sometimes also called witnesses), with the voting power increasing proportionally to the amount of tokens (aka coins) hold.

The elected delegates now have the responsibility to ensure that the nodes are up and running, that all the transactions across the network are collected into blocks, are subsequently validated and in the case of dispute, resolve the issues.

If a delegate would act in a dishonest way, he can easily be voted out of the network and the delegate would lose his stake. The smaller amount of elected delegates leads to a more efficient and more effective consensus mechanism, with a high transaction throughput.

Another idea is called Leased Proof of Stake. This concepts revolves around the idea, that users are able to lease their coins to a node that they trust — without giving up ownership of the coins though. Any financial reward that that node that gets, by successfully validating blocks, is shared with the respective users who leased their stake.


Potential Limitations

Photo by Ksenia Kudelkina

There are two big potential limitations to the overall security of a Proof of Stake blockchain, both of these were coined for the first time by Andrew Poelstra in his paper “On Stake and Consensus” — a worthwhile, even though quite technical read.

The first one is the so-called nothing at stake problem.

After consensus has been found in a Proof of Work blockchain, the validated block is then added to the chain. Due to the inherent latency of the underlying communication channel (the Internet), it can happen that two valid blocks are mined at the same time. The network achieves to agree on the valid chain by always selecting the longest chain, since the most work went into producing it. If somebody wants to change the transaction history in the past in a PoW system, that actor would need to redo all the work that went into producing the prior blocks — which would amount to an enormous amount of energy, ergo cost being required.

If we break all of this down to its core, it’s actually not a technical thing, but rather social norms that lay behind this. The choice of which software to use is up to every participant, so technically everybody’s free to implement whatever consensus rule they fancy — yet, if the rest of the network chooses not to use that same software, that would be a senseless endeavor.

When it comes to Proof of Stake blockchains, there is no special hardware required in order to secure the system. Due to this, users can theoretically vote on many different versions of a blockchain in order to increase their chance of a financial reward — this would lead to consensus becoming incredibly difficult to be found. Since users have nothing at stake, it’d be in their best interest and logical rational to engage in this behavior.

A possible solution to this is to penalize nodes who vote on two different versions of one block or to penalize those voting on a wrong block.

Photo by John Matychuk

The second issue is known as long range problem.

This issue revolves around the problem that people who participated in the early days of a Proof of State blockchain could theoretically revert all of the blockchain history. How exactly would that play out?

Well, these early users could go back in the blockchain’s history and start from a point where they exerted a big influence. Since there is no need to provide enormous amounts of computational power in a Proof of Stake blockchain, chains can be grown very long very fast.

Now a problem known as weak subjectivity enters the stage.

Let’s say you chose to become a new participant in a Proof of Stake blockchain. Once you’ve set up your computer, the installed software now needs to know which chain that circulates in the system can be trusted (aka the so-called main chain). Your computer know finds itself in the situation that it needs to ask another computer for that information — and trust it that the information is correct. This leads to a big problem of trust arising, because you could fall prey to one of those doctored chains mentioned above.

Since trust is at the core of blockchain technology and is considered as the most essential invention, the need to trust a third party leads to a fundamental problem. There are workarounds to this problem, such as having trusted servers that frequently send out a hash of the correct main chain, yet this degree of centralization lingers along.

I’d love to end this post with a quote by my fellow Medium writer Abhishek Sharma:

“There appears to be a clear trade-off between mining costs and the level of trust required of other participants in the blockchain.
It may be the case that if we want to curb the immense resource consumption of cryptocurrencies, we will have to once again trust each other instead of mathematical proofs.”

If you’ve reached this point you can pad yourself on your back — you’ve made it through the whole post. I’d love to thank you for the time and attention that you’ve invested into this read and hope that you’ve enjoyed it!

Do you have any comments, questions or constructive feedback? If yes, please let me know, I’d love to hear from you(:

All the best

Till

PS: If you’re looking for helpful and great resources to learn more about blockchain’s paradigm shifting technological potential, check out these awesome resources.