5 min read

Unboxing Ethereum's Proof of Stake

Unboxing Ethereum's Proof of Stake

Proof of Stake is coming in big steps and is much closer to a full release than you can imagine. This article will cover what Proof of Stake (PoS) is and how it will work. Grab the popcorn 🍿 and ☕, and enjoy!

What is PoS?

Proof of Stake is the next consensus model, an upgrade from Proof of Work found in Ethereum 1.0. There are no miners. Instead, participants, known as validators, can propose new blocks and validate blocks from another validator, but only if they stake 32 ETH by depositing the funds to the official deposit contract. Only then can validators run client nodes to participate in PoS.

Validators are randomly chosen by the beacon chain, correctly propose and attest blocks will receive a reward in ETH as a percentage of their stake.  However,  if a validator attempts to compromise the truthful continuation of the blockchain, their deposit will be “slashed” – meaning they will lose some or all of their 32 staked ETH.

This expands even further. If a validator fails to stay online and complete their share of duties, the block reward will decrease for them. These incentives validators to remain online as consistently as possible.

Proof of stake mechanism offers more crypto-economic security (staked ETH) than the more abstract disincentive of losing the cost associated with electricity. Previously, mining costs were buying/investing in mining equipment and paying high electricity bills.

Now Ethereum 2.0 will only require consumer-level hardware to run a validator node. Thanks to that, the network could be more decentralized as a point of entry is much lower.  You don’t need even to have total 32 Eth to become part of the validation network. Some staking services offer pooled staking, and if you don’t have technical knowledge to run your own validator with 32 eth, staking service will do that for you while you remain in control of the funds. Proof of Stake launched in the first stage of Ethereum 2.0 known as Phase 0.

Beacon Chain

The key function of the Beacon Chain is to manage the proof of stake protocol itself and all of the shard chains (this will come in Phase 1). Beacon chain operates validators and their stake, is responsible for choosing validators every epoch (6.4minutes) for different duties i.e. block proposals and attestation of proposes blocks and organize validators into committees to vote on propose block and applies consensus rules.

Managing Validators

Validators can join the common set of validation nodes by sending the required stake of 32 Ether to a deposit smart contract deployed on the current version of Ethereum. When the proposal validation is completed, the state is locked, and the deposit contract emits an appropriate event so the Beacon chain can pick it up.

After being processed by the beacon node and waiting in the queue, the validator will be put into the common validator set on the beacon chain and considered active. It’s important to understand only “Active” validators can propose and validate various beacon blocks and in Phase 1 also in shard chains.

When a validator wants to opt-out of the system and withdraw all of the stake earned, the beacon chain will make sure it will be possible after waiting around 97 days. After that time, all of the stake plus rewards minus penalties can be withdrawn into a shard chain at Phase 2. It’s not possible to withdraw back to an Ethereum 1.0, so be careful when opting in as a validator! Another thing to remember is the launch date of the Shard chains, somewhere in 2022, and Phase 2 is in 2022/2023. These dates can change as already there were pushbacks for Phase 0 launch.

You can think of Beacon Chain management like this: Validators in Proof of Stake consensus are musicians that need to be orchestrated; Beacon Chain is like a conductor that coordinates all the musicians so the whole band can play beautiful music.

Decentralised randomness, committees, and block proposers

Besides managing the validator’s state and stake, the Beacon chain is also responsible for selecting proposers and attesters randomly from a pool of active validators.  All randomly selected attesters are grouped to form a committee. This committee than is responsible for validation of incoming block proposals. Their work is critical to the security of the PoS blockchain as they vote on which block forms the true history of the chain. Beacon blocks are such blocks as they also contain crosslinks to different shards but about that will be below.

Such votes from committees are known as “attestations” as each committee member attests for the block they are voting and they can be at least 128 validators per committee.

Ethereum 2.0 blocks are produced regularly every 12 seconds. Every 12 seconds has its Slot in the Beacon chain, and every 32 Slots form something known as Epoch, which is every 6,4 minutes.

A slot is a chance for a block to be added to the Beacon Chain and shards. Every 12 seconds, one beacon block and up to 64 shard blocks are added to the system. Not every Slot will have a full block. Slot may contain an empty block.

Finalization

In every blockchain system, there is a finalization part of the block added to the system. In other words, after what time can a block be recognized as forever etched in the history of a Blockchain, and nothing can revert that operation. In Ethereum 2.0, Epochs form this kind of a checkpoint, where something can be thought of as a finalized.

Proposers are selected by  RANDAO+VDF  with a weighting on the validator’s balance. It can happen that the validator will be a block proposer and a committee member simultaneously, but the probability of that is low. It’s worth remembering that the validator can “propose” a new block OR “attest” proposed blocks.

Rewards and penalties

An essential aspect of the Proof of Stake system, as described previously, is the notion of rewards and penalties. These two things are at the core of crypto-economic security, and Beacon Chain’s role is to administrate it.

Validators receive rewards when they propose and attest blocks when there is their turn to play their part. But when they decide to skip their turn or submit an invalid, malicious block, they are penalized by having some of their 32 Ether deposit reduced (slashed) and even being potentially banned from the system. Still, for this to happen, their stake needs to fall below 16 Ether. Also, there is a small penalty if the validator node is disconnected from the network to motivate people to keep their nodes up as long as possible.

Implementation of the Beacon chain and its deployment marked the start of Phase 0 and the start of Proof of Stake. Initially, the Ethereum foundation wants 16,384 validators to be active at the beginning of Phase 0, and more validators would be added later. This number is not random. They want 512 validators to be assigned per Slot and split into four committees, and each Epoch has 32 slots. 32 * 512 = 16,384 validators.

As mentioned in the beginning, the beacon chain can be thought of as a conductor and validators as musicians, and next phase can be thought of as an instruments. But we will cover sharding in the following article.


Thanks for reading, and if you like my writing, you can subscribe to my blog to receive the daily newsletter as I'm currently in the middle of 100 days of blogging challenge. Subscription box below 👇

If the newsletter is not your thing, check out my Twitter @adrianhetman, where I post and share exciting news from the Blockchain world and security.

See you tomorrow!