Emerald Blockchain Course: 11. What Is Proof of Stake?

And how it works.

Image of Donald McIntyre

By Donald McIntyre

September 5th, 2022

post image

Emerald Blockchain Course class 11 about Proof of Stake.

You can watch this class here:

In the following sections we will explain how the Proof of Stake consensus mechanism compares to Proof of Work and how stakers validate blocks and keep the network updated.

1. Proof of Stake (PoS) as compared to Proof of Work (PoW).

PoW uses energy: As explained in previous classes, the major invention by Satoshi Nakamoto was to create a consensus mechanism that achieves very high levels of security and decentralization by putting to work many machines around the world, consuming enormous amounts of electricity, to produce cryptographic stamps per block which serve as the irrefutable proof that a block of transactions is the correct one.

PoS uses deposits of money: In order to save in electricity, PoS replaces energy consumption and miners with stakers who make large deposits in the native currency in special accounts inside the network to produce blocks and to assure the rest of the users worldwide that their blocks are the correct ones.

PoW is simple: The PoW based Nakamoto Consensus mechanism is very simple in its design and may be coded in 100 lines of software code.

PoS is complex: Because PoS eliminates the simplicity of the PoW signal to the rest of the network (the cryptographic stamp per block) then it has to replace it with a very complex set of rules and penalties for stakers to make it secure. A proof of stake consensus mechanism requires at least 100,000 lines of software code according to an Ethereum 2.0 developer.

PoW is more secure but less scalable: As a consequence of its simplicity and security guarantees PoW is more secure, but its computational effort and inefficiency (proof of work hashes plus full replication) make it less scalable, therefore processing less transactions per second.

PoS is less secure but more scalable: By removing the PoW consensus mechanism, PoS is somewhat less secure and more centralized (see next section) but it achieves orders of magnitude more scale as it may process larger volumes of transactions per second.

This inverse combination of security and scalability levels of both systems actually make them very complementary because it is very likely that PoW will be like a base layer of the blockchain industry for large settlements, and PoS will be like a second layer providing scalability of transactions enabling small transactions at low cost.

2. Removing the physical base (PoW) and replacing it with social consensus (PoS).

As shown in the diagram below, both PoW and PoS consensus systems have a subjective layer prone to be managed by the social layer or ecosystem of the networks.

Proof of Work vs Proof of Stake.

However, the PoW mechanism actually anchors the state of a blockchain (the accounts, balances, smart contracts, etc.) to the objective physical PoW layer by providing a huge barrier to modify it backwards.

As, in search of saving energy and higher scalability, the PoS consensus mechanism eliminates the objective physical base, then it is left only with the subjective guarantees of the social layer, which is subject to the social consensus, choices, and opinions of the participants.

3. How Proof of Stake works.

Validators (stakers): Validators or stakers replace miners in PoS systems, and they are the ones who produce and validate new blocks of transactions.

Deposit (stuck for a long time): Validators have to make a large deposit in a special account to gain the privilege of producing and validating blocks. The security assumption here is that, because they don't want to lose their stake and make it more valuable, they will be honest when organizing transactions and sending blocks to the network.

Block production: As the network receives new transactions, these are sent to all validators who organize them and bundle them into blocks or batches to add to the ledger or database of accounts and balances.

Reward per block: Validators, as miners in PoW, get paid a reward per block when they produce them and are successfully added to the database.

Slots: PoS blocks are not timed as in PoW where they are time stamped as they are produced. PoS blockchains have a set schedule of slots where a block has to be entered. Sometimes it is every 12 seconds, as in Ethereum 2.0, or they may be faster.

Epochs: These slots are grouped into epochs of 32 slots, which may contain up to 32 blocks, which are later subject to affirmation by the validators to create checkpoints.

Random selection of validators to make blocks: Of the many stakers that a PoS blockchain may have only one may propose and produce a block per slot, so they are chosen randomly by the algorithm. However, if a staker has a larger deposit than another, then that staker will be chosen more frequently, proportional to its deposit value.

Committee of validators per slot: When a validator is chosen randomly to produce a block, then it has to send it to a committee of other validators so they can verify and approve the block. This happens per slot and the committee is also chosen randomly among all the validators of the network.

Approval of blocks (validation): The committee per slot has the role of approving the block that is sent by the block producer validator of the current slot.

Two thirds majority (therefore, fault tolerance is 1/3): The way the committee approves a new block is by voting by two thirds majority on that block. This means that if 1/3 + 1 of validators fails to approve a block, or they approve a different block, then the network may be disrupted.

Slashing: If validators fail to perform their roles as described above (e.g. producing and approving blocks when selected, amongst other functions) then they receive a series of penalties depending on the severity of the failure. This slashing may be very high, for example it may be 33% of the stake held in the network in some cases.

Social consensus as security of last resort: As may be observed by the description above, the core of the security model of a PoS blockchain is pure subjective choices by validators. This makes such systems dependent on social consensus for the protection of accounts, balances, and smart contracts in the long term.

Thank you for following this class!

Please download and start using Emerald here: