Ethereum 2.0

in ethereum •  4 years ago 

Content

Do you still remember the joy when you first sighed the blockchain world with "it is so"?

Do you want to have such a thorough understanding of the Beacon Chain?

The beacon chain is the core of the entire Eth2 system; however, the content of the beacon chain is mostly just playing technical vocabulary, which is trivial and not deep enough.

Here, we will provide a thorough interpretation of the elements and mechanisms of the beacon chain. We will also provide examples and place key details appropriately so that you can do more with less.

We assume that you already have a solid understanding of the Ethereum blockchain or the Bitcoin blockchain and are also familiar with Proof of Stake.

Let's take a look at the panorama of shards, staking validators, attestations, committees, checkpoints, and finality.

Fragmentation: lofty ideals
To understand the beacon chain, it helps to understand the concept of sharding. The main challenge currently facing the blockchain (including Ethereum) in improving scalability is that every node must verify and execute all transactions.

From the perspective of computer science, there are two main ways to expand throughput:

A. Vertical expansion: The main idea is to strengthen the node and make the node more and more powerful.

B. Horizontal expansion: The effect is to add more nodes.

In order to be decentralized, the blockchain system can only scale horizontally. One of the goals of Ethereum 2.0 (also called Eth2 or Serenity) is to allow ordinary consumer hardware to run nodes. The original meaning of the term sharding is to partition the database horizontally (horizontally partitioning).

Basically, a shard chain will be processed by a part of nodes (that is, a subset of the nodes in the entire network). The virtual miners in the system, validators, will be assigned to different shards and only process and verify transactions on their own shard chain.

In this system, the node group that processes a certain shard by block is constantly replaced.

To shard a blockchain system, the main challenge is the security of sharding. Because verifiers are scattered on various shards, it is less difficult for a malicious verifier to compromise a single shard.

Therefore, the key to the sharding solution is to randomly shuffle the validators, so that each shard block is processed by a committee composed of a group of (pseudo) randomly selected validators, so that a controlled stake is less than all The probability of success of an attacker with 1/3 of the validator's equity is 0 (mathematically improbable).

Fraud proof, custody proof, and data availability check are also important security components, but they need to be specifically written to explain clearly.

Eth2's current plan is to enable 64 shards. Although the fragmentation and the beacon chain are conceptually independent of each other, we are still going to talk about some key elements of the entire system.

The concept of fragmentation reflects the functions and needs of the beacon chain; through the concept of fragmentation, we can understand why these extra parts need to be added to the traditional blockchain system. This brand-new field also welcomes readers with insights to propose innovations.

Ethereum 2.0 stages
Ethereum 2.0 will be deployed in three phases:

Phase 0: Beacon chain

Phase 1: Fragmentation

Phase 2: Implementation

It can be compared to the three parts of the human body:

Phase 0: Heart

Phase 1: Limbs

Phase 2: Brain

It can also be compared to a majestic orchestra:

Phase 0: Conductor

Phase 1: musical instruments

Phase 2: Musicians

Each stage will be integrated into the system and will take on different roles. Compared with other stages, the functions introduced by Phase 1 will be more calm, and Phase 2 will be more about execution.

Slot and Epoch
The beacon chain is the heartbeat of Ethereum 2.0, the main theme of the harmony and consensus of the entire system.

A slot (slodt) is 12 seconds, and an epoch is composed of 32 slots, so it is 6.4 minutes.

-32 time slots of period 0. The genesis block is generated at time 0-

(The parameter data used in this article are all from the beacon chain technical specification v0.10.1)

The time slot is used to mark the opportunity of generating beacon chain blocks and fragmented blocks: on the beacon chain and each fragment, each time slot has an opportunity to generate a new block. You can imagine that the beacon chain and each shard chain are carefully designed and closely synchronized. Ideally, every 12 seconds, 1 beacon chain block and 64 shard blocks distributed on different shard chains will be generated. Verifiers do need to synchronize in time.

Therefore, the time slot is like the block time, except that the time slot may also have empty blocks. The genesis block of the beacon chain and the shard chain are generated in time slot 0; however, each shard chain will start running after the completion of the time slot 0 of the beacon chain, and each has its own time slot 0 (generating creation The starting point of the world block).

Verifier, witness message, and beacon chain
The PoW blockchain is maintained by miners, while the proof-of-stake system of Ethereum 2.0 relies on "virtual miners"-verifiers. The verifier is the active participant in the consensus process of the Ethereum 2.0 protocol. The economic incentives for TAs will be discussed in the “Reward and Punishment Measures for Beacon Chain Verifiers” below.

The proposer of a block refers to a validator who is randomly selected to generate the block.

Most of the time, validators only act as witnesses, just voting on beacon chain blocks and shard chain blocks. These votes will be recorded on the beacon chain, and the latest block of the beacon chain and the latest block of the shard chain will be determined accordingly.

-At the 28th time slot of a certain period, there is no corresponding block proposal (the validator assigned as the proposer did not propose the block for some reason)-

In a period of time, a validator will be pseudo-randomly assigned to a slot and a slice. The verifier will participate in the consensus process of the assigned shard to vote for the latest block of the shard. The verifier will also link the latest block to the beacon chain block in a time slot.

The so-called attestation is a vote initiated by a verifier whose weight is determined by the verifier's balance. The witness message will be appended to the block by the verifier and spread along with the block.

Verifiers will also supervise each other, and can report other verifiers that have made conflicting votes or propose multiple blocks of misbehavior. If the report is true, they can be rewarded.

The main content of the beacon chain is a registry of verifier addresses, the status of each verifier, witness messages, and information linked to shards. The verifier needs to be activated through the beacon chain before participating, and can also change its state, as described in the "Beacon Chain Verifier Activation and Life Cycle" section below.

Verifiers participating in the pledge: term meaning
In the proof-of-work blockchain, the way for users to become miners is to control the hardware to participate in consensus. In Ethereum 2.0, users can obtain validator qualifications by staking ETH and participate in the network by controlling validators. Therefore, the verifier is virtual and is actively activated by the pledger.

Associating stakers with stakes, verifiers and balances is easier to understand. The maximum balance of each validator is 32 ETH, although the pledger can pledge all of his ETH. For every 32 ETH deposited, one verifier can be obtained.

The operation of the verifier depends on the verifier client, which uses the beacon chain node to perform normal functions. The beacon chain node has the function of following the operation of the beacon chain and reading the information of the beacon chain. The verifier client can either run the function of the beacon chain node itself, or connect to other people's beacon chain nodes.

Crosslink: Let the fragments take root on the beacon chain
The so-called cross-linking refers to data that is placed in a beacon chain block and points to a certain shard block. The beacon chain is to track the shard chain (the latest block) through cross-linking. Because there are 64 shards, each beacon chain can contain up to 64 crosslinks. There may be only one cross-link in a beacon chain block, if there is no validator to propose a block for the other 63 shards in this time slot. The cross-linking function is planned to be introduced in Eth2 Phase 1, so that each shard chain can be rooted on the beacon chain, and the beacon chain can act as the shard chain bifurcation selection, shard chain determinism, and cross-shard communication basis.

All shard chains track the beacon chain throughout.

About the Committee
The committee is a group of verifiers. For security reasons, each time slot, on the beacon chain and each fragment chain, there will be a committee composed of at least 128 verifiers. An attacker has a chance of less than one in a trillion and can control 2/3 of the verifiers in a committee.

The name of the beacon chain is derived from its function of publicly providing random numbers (ie "random beacons"). The beacon chain will reach a consensus on a pseudo-random process called "RANDAO".

-At each time slot, the pseudo-random process RANDAO will select proposers for all time slots and shuffle the validators to different committees-

The verifier is selected by RANDAO based on the verifier's balance. A validator may be both a proposer and a committee member in a time slot, but this is not unusual. The probability of this happening is 1/32, so we estimate that we will see it once every time period. The above diagram depicts the situation when the number of validators is less than 8,192, otherwise there will be at least two committees in a time slot.

This article focuses on the Beacon Chain Committee: the verifier serving the beacon chain. A beacon chain committee will be randomly assigned to a shard to generate cross-links on a beacon chain blockchain. Moreover, committee members are not constant for a long time, and the committees responsible for generating cross-links are replaced block by block.

The committee that only generates blocks for the shard chain is left to be explained later. The shard chain verifier may generate many beacon chain blocks without interacting with the beacon chain. However, if a shard wants to communicate with other shards, it needs the beacon chain committee to cross-link the shard blocks to On a beacon chain block.

-The protocol assumes that validators always vote for the block they think is the top of the blockchain-

The above picture synthesizes the situation generated in three time slots. In time slot 1, a validator proposed a block, and the block was witnessed by two validators; one of the validators in committee A went offline. In time slot 2, someone proposed a block, but a verifier in committee B did not see it, so the witness message indicates that TA believes that the top of the beacon chain (the latest block) is still generated in time slot 1. Block. Note that this verifier is not the same as the offline verifier in time slot 1. Voting on the top block of the beacon chain is called "LMD GHOST voting". In time slot 3, all validators in committee C run the LMD GHOST fork selection rule and independently vote for the same block as the top of the beacon chain.

A validator can only participate in one committee in a period. Generally speaking, there will be more than 8192 verifiers in the system, so there will be more than one committee per time slot. The committees are all the same size, with at least 128 verifiers. When there are fewer than 4096 verifiers in the system, the security will decrease because the size of the committee will be less than 128 verifiers.

Committee: the key
In each period, the verifiers are evenly allocated to the time slot, and then further allocated to the same size committees. All verifiers must send out a witness message in their time slot to indicate the top of the beacon chain. Each committee will try to cross-link to a specific segment in its own time slot. The shuffling algorithm will increase or decrease the number of committees to ensure that each committee has at least 128 validators.

For example, suppose there are 16,384 validators. Of these, 512 verifiers are assigned pseudo-randomly to slot 1, the other 512 are assigned to slot 2, and so on. The 512 validators in slot 1 are further divided into 4 committees. All 512 validators must initiate an LMD GHOST vote at slot 1; 128 validators from one committee try to cross-link to shard 33; 128 validators from the other committee try to cross-link to allocation 55; the other two One committee tried to cross-link to Shard 22 and Shard 11.

In time slot 2, this process will be repeated again. The 512 verifiers are equally divided into 4 committees. Suppose they are assigned to the shards 41, 20, 17, and 15. All 512 validators must vote for the top of the beacon chain in slot 2; these committees will also try to propose cross-links for segments 41, 20, 17, and 15.

This process will also be repeated one by one in the remaining time slots of the period. Each verifier will have a time slot where TA can speak, present a witness message, and generate cross-links. By the end of the time period, all 16,384 validators had enjoyed the opportunity to initiate voting and cross-linking.

However, in the above process, the verifier's vote is based on the time slot, not on the time slot. It's a bit like voting for local governments instead of holding a national election. All validators have never voted for the same thing. The following section will discuss checkpoints and certainty, and explain the voting that each verifier needs to initiate in the time slot where it is located. In other words, in their own time slot, they also vote for the time slot checkpoint.

image.png

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!