Ethereum Consensus Layer: Validating Visualized

You may have heard of Ethereum’s transition from Proof of Work to Proof of Stake, and the increased scalability that it allows for while drastically reducing the energy used per transaction.

For those of you looking to earn rewards while holding onto your ETH, staking may be a good route to go, especially if you’d like to help secure the network.

So what do the block creation, validation, and reward/penalty system look like in practice? This is an overview of what the attestation process looks like within Ethereum’s Consensus Layer upgrade.

Key Takeaways

  • With Ethereum’s version of Proof of Stake, validators propose new blocks and reach consensus on a block through voting. A vote is called an “attestation”.
  • Validators require 32 ETH to serve as collateral for the actions of the validator.
  • Validators receive rewards or penalties based on whether or not the validator is acting in the network’s best interest or not. The size of the reward/penalty is dependent in part on your “Effective Balance”.
  • Those rewards and penalties affect your validator’s balance and the size of the reward/penalty is calculated in part by your “Effective Balance”.
  • If you do not have 32 ETH, you can stake your Ether in a “pool” to get a cut of the rewards without the higher cost to run an individual validator.

What is Ethereum Consensus Layer?

Formerly referred to as Serenity and Eth2, Ethereum Consensus Layer represents the migration from Ethereum’s current Proof of Work (PoW) consensus mechanism to Proof of Stake. Proof of Stake is significantly more energy-efficient than Proof of Work and allows for a lower price point of entry than what it takes to mine in PoW. Proof of Stake also allows for sharding, which is how Ethereum plans to scale its network in addition to supporting Layer 2 solutions.

What is a validator?

A validator is a program run by a person or organization in a blockchain network that helps propose and verify blocks added to the blockchain. This works through staking an asset (in this case, ETH) and running a validation client or software. With Ethereum Consensus Layer, this consensus process is coordinated through a separate system called the Beacon Chain.

From ethos.dev
From ethos.dev

What is the Beacon Chain?

The Beacon Chain is the first part of Ethereum’s migration from Proof of Work to Proof of Stake. It is a separate system from Ethereum’s Mainnet and has the task of registering, then coordinating all validators.

During “The Merge”, the current Proof of Work-based Ethereum Mainnet was combined into the Beacon Chain. This will signal the end of Ethereum’s use of PoW as a consensus mechanism. Once sharding is introduced to Ethereum, the Beacon Chain will be the central hub of communication between all shard chains and layer-2s.

image

How does a validator get created?

All potential validators are required to have:

  • 32 ETH - Deposited Into the Beacon Chain’s Deposit Contract
    • It is possible to pool your ETH with others and 32 ETH is out of your price range.
  • A Validator Client - The Software That Interacts With the Beacon Chain
    • The client technically connects to, or operates as, a “Beacon Node.”
    • You also have the option to stake your ETH with a custodial staking service so that you don't need to maintain the software required to be a validator.

Why do I need to deposit any ETH at all?

The 32 ETH deposit is your collateral for your validator’s performance. If your validator is online, operating at the correct speed, and acting in the best interest of the Ethereum network, then your personal balance will go up. If your validator is offline or acting maliciously, your validator may miss out on rewards, get penalized, and may be booted from the network.

The Validation Process

image

For the sake of this article, let’s represent your validator with the above circle:

  • Top: This is your Effective Balance.
    • More on how an Effective Balance is different from a validator’s current balance later.
  • Bottom Left: The Validator’s Technical Aspects.
    • Y - “Yes”, the validator is online, running at the appropriate speed, and the validation client (software) is up to date.
    • N - “No”, one or more of the technical elements isn’t up to speed, or the validator is fully offline.
  • Bottom Right: The Validator’s Actions.
    • H - “Honest”, the validator is acting in a beneficial way towards the network, meaning that it’s not voting (or attesting) for bad blocks, is proposing blocks that other validators agree on, calling out (whistleblowing) validators who are acting maliciously towards the network, etc.
    • D - “Dishonest”, the validator is missing attesting assignments, attesting for blocks that don’t get finalized, or committing a slashable offense (more on that below).

Slots & Epochs: How the Chain Gets Built

image

Now that we have our validator and it has been successfully connected to the Beacon Chain, we then get to start participating in the block creation and voting (attestation) process. Before we dive into the process, we first need to understand the time-based building “blocks” (get it?) of the process:

  • Slots - Periods of 12 seconds where a block gets proposed by a validator that has been randomly selected by the Beacon Chain.
  • Epochs - Groups of 32 Slots (or approx. 6.4 min). These epochs mark when the Beacon Chain distributes rewards/penalties to the validators.

Block Proposal

image

At the start of an epoch, the Beacon Chain will randomly select a validator to propose a block for the first slot in that epoch. That validator, called the block “proposer”, has 12 seconds to propose a new block of the latest transactions. This process continues for each slot until 32 slots have passed.

Fun Fact: Ethereum will not suddenly crash if there isn’t a block proposed for a slot. The only significant consequence of a missing block is that the validator who was supposed to propose the block doesn’t get the higher block proposal reward.

Voting For Great Blocks: Attestations & Committees

image

Committees

Validators are divided into random committees to vote (or attest) on proposed blocks during the epoch before their assignment. There is a minimum of 128 validators per committee and it would require a coordinated effort to tamper with so many distributed validators.

This is what causes the one in one trillion chance of a bad actor from taking over the system.

Weighted Balance

A block is successfully added when the total of the effective balances within the committee is more than 2/3s of the sum of the effective balances across the committee voting on that block. In practice, the vote skews towards validators who have performed beneficially towards the network have higher effective balances because of the rewards that they’ve received.

Breaking The Chain

image

Distribution: Rewards and Penalties

At the end of the epoch, rewards and penalties are calculated and distributed based on the validator actions of the prior epochs. Remember that “effective balance” mentioned earlier? Let’s dive into what that is:

  • An Effective Balance is a whole number between 16 and 32 that the Beacon Chain use to quickly calculate rewards. It's also used as an indicator for the validator's performance over time. The higher the effective balance, the more beneficial the validator has been towards the network and vice versa.
    • Balance vs Effective Balance: It’s important to note that this is separate from your validator’s balance. Your effective balance could be 32 ETH, but your personal balance could be 43.8 ETH due to the rewards that your validator has accumulated over time.
    • Deactivation: Why is 16 the lowest number for an effective balance? If a validator’s effective balance goes below 16 ETH, the beacon chain will remove that validator.

Inclusion Distance

Validators are rewarded for getting their attestation for the slots that they are assigned as soon as possible. In practice, the validator will receive the largest attestation reward possible if that’ validator’s attestation is recorded in the same 12-second slot that they were assigned.

Beyond that point, the amount of the reward reduces drastically, and if an attestation is attempted after the end of an epoch, the validator will not be rewarded for that attestation. The distance between the slot that a validator was assigned to submit an attestation for, and when it was actually recorded on-chain is called “inclusion distance”.

Factors in Calculating

Rewards and penalties for each epoch are calculated by a number of factors, including:

  • The validator’s action (attestations, block proposing, calling out bad validators or “whistleblowing”, etc)
  • Inclusion distance (if the action was an attestation)
  • The total number of active validators
  • The number of validators impacted by the actions your validator took (particularly important if an action your validator took
  • The validator’s effective balance

Rewards and Penalties in Action

What happens when the validators aren’t technically up to spec,

  • If your validator is offline for an extended period of time, has voted for blocks that carry bad information/were ultimately voted down, etc and the validator’s effective balance has reached 16 ETH, then the Beacon Chain will remove your validator from the network.
  • Slashing: The Beacon Chain’s act of reducing an effective balance to the cut-off of 16 ETH or lower, and removing your validator is referred to as “Slashing”.
image

Did you notice something off about the balances compared to the effective balances above? Rather than simply rounding up or down, an effective balance is only changed when the balance of a validator .25 ETH above or below the next whole next whole number.

For example, let’s imagine a validator with an effective balance of 23 and a balance of 23.37. In order for the effective balance of that validator to reach 24, the balance of the validator has to reach 24.25 ETH. It’s highly recommended that you check out Understanding Validator Effective Balances to see how this works in practice.

What if 32 ETH Isn’t In Your (Current) Price Range?

Solo validating does have a higher cost to start, but the good news is that there are “pools” available to combine your Ether with others. This way, you won’t need to have 32 ETH and yet still get a cut of the rewards while you continue hodling. Definitely check out the Pooled Staking overview on Ethereum.org to learn more.

Next Steps

While this is intentionally a higher-level overview, the importance of the Consensus Layer and its role in making the transition from Proof of Work to Proof of Stake cannot be understated. In order to have a decentralized network, the necessary computing power provided by each contributor has to be incentivized to reward positive contributions. If it wasn’t, the sustainability and security of Ethereum would be highly questionable.

Bad actors would have plenty of reasons to manipulate the information added to Ethereum’s blockchain, and those who were charitably investing their time and money to help secure the network would have few reasons to continue running one for the long term. The migration to Proof of Stake allows for this incentive structure to include more participants, while drastically reducing the energy usage per transaction.

Further Reading/Sources

Disclaimer: Nothing in this post/on this site should be considered investment or financial advice. I am not a financial advisor. While this was created in a good-faith effort to provide useful information/a different perspective, if there is anything incorrect, feel free to DM me and I’d be happy to adjust any content as needed. Please always do your own research (DYOR). WAGMI.