Beacon chain, PoS, sharding… You must first understand these terms to get in touch with Ethereum 2.0

Beacon chain, PoS, sharding… You must first understand these terms to get in touch with Ethereum 2.0

Loading

These common terms can help you understand Ethereum 2.0 more comprehensively.

Original title: “Ethereum 2.0 Termbase”
Finishing: ETH Chinese Network

Attestation certification

Proof is a vote initiated by the verifier, which is aggregated by the verifier’s signature to prove the validity of the block, and the vote is weighted by the verifier’s balance.

Attester

The verifier on the beacon chain can act as a block proposer and prover, and the prover initiates a vote on the block.

Beacon Chain

Realized in phase 0 of Ethereum 2.0, the Proof of Stake (PoS) consensus mechanism will be introduced. It is also considered the “coordination layer” of Eth2.

Function:

  • Assign responsibilities to validators
  • Finalize the checkpoint
  • Perform random number generation on the protocol layer
  • Strengthen the beacon chain
  • Vote on the chain head as the basis for fork selection
  • Connect and vote for the transition/data of the shard chain

Block proposer

The verifier randomly selected by the beacon chain through the RANDAO mechanism makes a proposal for the next block. There is only one block proposer in each slot.

Casper FFG

Casper FFG is a block finalization system based on the PoS consensus mechanism, which stipulates the rules for block finalization and checks the determined blocks. Casper FFG integrates PoS algorithm technology and Byzantine fault-tolerant consensus principle. It is decoupled from the chain growth process and can be used as an independent overlay to provide services for finalizing blocks for any effective blockchain protocol. Compared with the PoW consensus mechanism, FFG can bring higher security to the blockchain and prevent the block from being tampered with.

Casper FFG vote means that the verifier initiates a vote for the checkpoint of the most recent epoch, the “target checkpoint” and the previous checkpoint, the “source checkpoint”, which proves that the vote is broadcast by the verifier to the p2p network, and finally by the block producer Packed into blocks.

Committees

The committee in each slot in the beacon chain and shards consists of at least 128 verifiers. According to the pseudo-random process RANDAO, the verifiers are randomly assigned to the committee and vote on the block to determine its validity.

Checkpoint

Checkpoint refers to the block located in the first slot of each epoch. If no block is generated in this slot, the nearest block is the checkpoint. Each epoch will have a checkpoint block; a block may be a checkpoint for multiple epochs at the same time.

Chain head

The chain head refers to a block at the end of the beacon chain or shard chain. Each block in the slot must initiate an LMD GHOST vote to verify the beacon chain head.

Current Balance & Effective Balance Current Balance & Effective Balance

The existing balance refers to the total amount of ETH currently held by the validator, and the effective balance refers to the amount of ETH calculated based on the existing balance. The effective balance defines the range of the amount of ETH bounties or confiscations obtained by the verifier. The effective balance is up to 32 ETH.

If the verifier wants to expand the number of effective balances, the existing balance that needs to be held is “effective balance + 1.25 ETH”. In other words, if the validator originally holds a valid balance of 20 ETH and wants to increase it to 21 ETH, the validator’s existing balance must be increased to 21.25 ETH. As shown in the third example below, if the existing balance is reduced by 0.25 ETH and falls below the threshold, the effective balance will be adjusted accordingly.

The following example illustrates how to calculate the effective balance:

  • If the existing balance is 32 ETH — the effective balance is 32 ETH;
  • If the existing balance is reduced from 22 ETH to 21.76 ETH — the effective balance will be 22 ETH;
  • If the existing balance is reduced from 22 ETH to 21.749 ETH — the effective balance will be 21 ETH;
  • If the existing balance increases to 19.25 ETH, and the original effective balance is 18 ETH, then the effective balance will increase to 19 ETH;
  • If the existing balance increases to 22.25 ETH, and the original effective balance is 21 ETH, then the effective balance will increase to 22 ETH.

Deposit Contract

A smart contract deployed on the Ethereum PoW chain. To become a PoS validator of Eth2, you need to first send a transaction to the deposit contract, including a certain amount of ETH as a pledge deposit. The deposit contract records the pledge history and locks all pledge deposits on the PoW chain, which can then be transferred to the Eth2 beacon chain. Please note that in the early stage of Eth2, the deposit contract only supports one-way transfer, and the pledge deposit cannot be transferred from Eth2 back to the PoW chain.

Double proposal

A block proposer proposes more than one block in his allocated slot.

Double vote

A validator initiates two FFG votes for the same target checkpoint (target) and different source checkpoints (source). Double voting can be seen as a double-spend attack in the PoS version.

Beacon chain, PoS, sharding...you must first understand these terms when contacting Ethereum 2.0Example of double voting and surround voting, pictured by Justin Drake

Epochs period

Each epoch consists of 32 slots (time slots), each slot is 12 seconds, and one epoch is 6.4 minutes.

EBB time boundary block

Epoch boundary block (EBB, epoch boundary block) is a term used in some literature and can be understood as a synonym for “checkpoint”.

Fork choice rule

The fork selection rule in Eth2 is LMD GHOST (Latest Message Driven GHOST, GHOST driven by the latest message). In this agreement, the fork with the highest number of votes will be selected as the chain head. Compared with the longest chain rule, the advantage of GHOST is that it can reduce the attack efficiency when the network delay is high, while minimizing the depth of chain reorganization. Even if an attacker can efficiently continue to generate blocks on his forked chain and try to make the chain the longest chain, the protocol will choose another forked chain with a higher number of votes.

Finalization

Finality means that two conflicting blocks (checkpoints) cannot be finalized at the same time. It can also be called economic finality. In Eth2, once two conflicting checkpoints are finalized, at least one-third of the active validators in the system will be punished. If two consecutive epochs are proven (or two consecutive epochs that skip an epoch), the first epoch is considered final.

Justification proof

Proof refers to the behavior of the verifier to vote on the checkpoint and determine the beacon chain head. If 2/3 of the verifiers (ie, an absolute majority) reach a consensus on two epochs, such as a source checkpoint (source) and a target checkpoint (target), then both checkpoints are proven. If two consecutive epochs are proven (or two consecutive epochs that skip an epoch), the first epoch is considered final.

LMD GHOST

LMD GHOST is the fork selection rule in Eth2. GHOST (Greediest Heaviest Observed SubTree) is actually an earlier protocol, widely used in PoW and other blockchains. The protocol only follows the “heaviest” subtree, the longest chain. In the Bitcoin context, the heaviest branch is the chain with the highest hash power and is considered the longest chain (canonical chain). LMD (Last Message Driven) plays the role of “message” through “Last Message Driven”. The message is an attestation. The difference is that the fork that gets the most votes will be regarded as the canonical chain.

Proof of Stake (PoS)

Proof of Stake (PoS) is a consensus algorithm for public blockchains, which depends on the economic rights of the verifier in the network. In a public blockchain based on Proof of Work (PoW), participants who solve cryptographic puzzles are rewarded to verify transactions and create new blocks (ie, mining). In a PoS-based chain, a group of verifiers take turns to propose and vote for the next block, and the weight of each verifier’s vote depends on its deposit (ie, equity). The significant advantages of PoS include improved security, reduced centralization risks, and energy savings.

On Ethereum 2.0, activating a validator requires staking 32 ETH in the network.

Phase 0 Phase 0

Phase 0 is the first phase of Ethereum 2.0, that is, the start of the beacon chain (the beacon chain was created on December 1, 2020 Beijing time). Phase 0 realizes the transition from PoW to PoS consensus mechanism by managing and coordinating validators. This stage will not provide functions such as sharding chain or execution, that is, participants cannot conduct transactions or call smart contracts in the Eth2 network at this stage.

* Phase 1 Phase 1

Phase 1 is the second network upgrade of Ethereum 2.0 after Phase 0. The main goal is to start the shard chain and write data to the shard chain. Sharding is the key to improving the scalability of Ethereum, because it allows parallel processing of transactions and greatly improves throughput. The latest solution is to deploy 64 data shards in phase 1 (maybe more in the future).

Phase 1.5 Phase 1.5

Phase 1.5 refers to the merger period of the Ethereum 1.0 and 2.0 blockchains. In Phase 1.5, the Ethereum 1.0 chain will be merged into the Eth2 beacon chain with execution functions. At that time, all the functions of the 1.0 chain (including the use of ETH) will be implemented on the 2.0 chain without breaking data consistency.

Phase 2 Phase 2

Phase 2 is the third phase of Ethereum 2.0. In the previous roadmap, the plan for Phase 2 is to integrate the functionality of the entire 2.0 system and introduce virtual machines based on eWASM to provide an execution environment for shards to build scalable applications based on Eth2 and fully introduce the 1.0 chain 2.0, the proof-of-work mechanism is finally abandoned. In the latest “Executable Beacon Chain + Data Fragmentation + Layer 2” roadmap, phase 2 is temporarily shelved, but the possibility of a built-in virtual machine is still retained.

Sharding

The concept of sharding originally refers to the horizontal division of databases, which divides large databases into smaller, faster, and more manageable parts. In order to ensure decentralization, the blockchain needs to adopt a similar horizontal expansion method. Each sharding chain has a subset of nodes to work on the chain. Virtual miners and validators are assigned to different shards, and only process and verify transactions on their own shard chain. Eth2’s short-term plan is to enable 64 shards, and it is expected that the cross-linking of the shards and the beacon chain will be realized in phase 1.

Shuffling mechanism

The main purpose of validator “shuffling” is to ensure the security of fragments. Since validators are scattered in different shards, some nodes may maliciously control a certain shard. The validators are shuffling, so that each shard block has a committee, and the validators are randomly selected. After mathematical calculations, if the attacker controls less than one-third of the total number of validators, it is difficult to attack a certain segment.

Slots

A 12-second period in which a randomly selected validator will propose a block. In each slot, a block may be added to the beacon chain and shard, but there may be no block in the slot. In each epoch, validators are randomly assigned to a slot and shard to form a committee. Except for a block proposer, other committee members are responsible for attesting the block. Each committee has a minimum of 128 verifiers.

Surround vote

The FFG vote initiated by a validator surrounds the previous FFG vote, or is surrounded by the previous FFG vote.

For example, suppose a validator initiates an FFG vote for the source checkpoint at slot 32 and the target checkpoint at slot 128 in epoch 5:

  • In epoch 6, the FFG vote initiated for the source checkpoint at slot 64 and the target checkpoint at slot 96 is surrounded by its vote in epoch 5.
  • In epoch 6, the FFG vote initiated for the source checkpoint at slot 0 and the target checkpoint at slot 160 surrounds its FFG vote in epoch 5.

Slashing

Punishment of verifiers means that if the verifier is proved to have violated, its (part of) pledge deposit will be destroyed. In Eth2 stage 0 period, validators will be punished mainly for three malicious behaviors: double voting, surround voting, and double proposal. The confiscated verifiers will be stopped to continue participating in the agreement and will be forced to withdraw.

The destroyed pledge deposit will be proportional to the number of verifiers confiscated at the same time, so as to avoid the verifier from being excessively punished due to unintentional actions. Because the attack requires a large number of verifiers to participate, the more verifiers that are confiscated, the greater the possibility of being attacked and the stronger the punishment. The minimum penalty amount is 1 ETH, and the maximum penalty amount is the verifier’s entire balance.

Validator

Verifiers can be regarded as “virtual miners” in the Proof of Stake (PoS) consensus mechanism. Users activate and manage verifiers by staking ETH. For every 32 ETH pledged, one verifier will be activated.

The verifier works through the verifier client, and the client operates with the help of beacon (chain) nodes. Each beacon node has the function of tracking and reading the beacon chain. And each verification client can perform the function of the beacon node or call the beacon node. A client allows one or more verifiers to perform verification functions.

Verifier life cycle:

1. Pledge: 32 ETH has been deposited into the ETH1 deposit contract, this status will be retained for about 7 hours. This can ensure security in the event of an attack on the ETH1 chain.

2. Wait for activation on Eth2

  • Before there are 327680 valid validators in the network, each epoch can activate 4 validators (900 per day). After this, 5 validators can be activated per epoch. And for every additional 64,000 active validators, the number of validators that can be activated per epoch +1
  • The number of activations is proportional to the number of active validators, and the upper limit is the set of valid validators divided by 64,000

Active validator (Proof of Participation & Proposal of Block):

In any of the following situations, the verifier stops working

  • Balance is less than 16 ETH (eviction)
  • Voluntary withdrawal
  • Confiscated