BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

Popular Science: Introduction to ETH 1.x and Stateless Nodes

以太坊爱好者
特邀专栏作者
This article is about 7356 words, reading the full article takes about 11 minutes
How can the changes related to the eth 1.x upgrade improve the current plight of Ethereum.
AI Summary
Expand
How can the changes related to the eth 1.x upgrade improve the current plight of Ethereum.

Editor's Note: This article comes fromEthereum enthusiasts (ID: ethfans)Editor's Note: This article comes from

Ethereum enthusiasts (ID: ethfans)

, Author: Lai Jack Lai Yanting, reprinted by Odaily with authorization.

This article will analyze various problems existing in eth 1.0, and introduce how the eth 1.x upgrade-related changes proposed by the Ethereum Foundation can improve the current plight of Ethereum.

What is eth 1.x

The research on Ethereum 2.0 has been going on for a long time, so far (2020/06) it still takes 2–3 years to fully launch, and eth 2.0 will be deployed as a combination of Beacon Chain (Beacon Chain) and multiple shard chains ( Shard Chains), while eth 1.0 needs to be modified and upgraded to become one of the shard chains in eth 2.0. This means that the current Ethereum 1.0 blockchain needs to be changed, and it will continue to operate and develop in the next 5-10 years. And eth 1.x is the name of the upgraded version of Ethereum 1.0.

first level title

The disadvantages and problems of Ethereum 1.0

Before starting to introduce Ethereum 1.x, you must first recognize the current (2020/06) problems in Ethereum, so that you can fully understand the background of eth 1.x and the pain points it aims to solve.

secondary title

Since 2020/05, the rising Gas Price has caused developers and high-frequency users to complain. The reason behind this is not only the increase in the number of Ethereum users, but also the increase in the proportion of smart contract interactions that consume a lot of Gas (simple transfer of ETH proportion is diluted), making the Ethereum network continue to be congested.

- etherscan.io -

Faced with such a situation, the miner community voted on 2020/6/19 UTC to increase the Gas Limit of each block from 10,000,000 to 12,000,000.

image description

Some people may think that since the 12,000,000 Gas Limit is still congested, why not increase it? The reason is that the increase of the Gas Limit will lead to a longer processing time of each block, which in turn will increase the number of Uncle Blocks, making the consensus mechanism of the network unhealthy, and miners must spend a lot of extra calculations for processing.

In addition, since it is easier for independent nodes and small mining pools to mine Uncle Blocks, the lower expectation of rewards for generating blocks in the long run will cause some nodes to make ends meet and leave the network. This will make the Ethereum network more centralized and more centralized to large mining pools, endangering the long-term health and security of the network.

secondary title

Problem (B): State Explosion

As more and more smart contracts are deployed, as well as a large number of contract interactions, the size of the "state" that the Ethereum network needs to store is growing in a "proportional series". The growth of the state is reflected in the storage space of the node.

Although this process is like boiling a frog in warm water, it will lead to huge security problems in the Ethereum network after a few years. However, in order to avoid going to that point, the research and development of Ethereum 2.0 began a few years ago.

- Roadmap of Ethereum tweeted by Vitalik on 2020/3/19 -

The Future of Ethereum

image description

  • eth 1.x other

  • first level title

  • The Future of Ethereum

  • eth 2 phase 2 and beyond

On March 19, 2020, Vitalik shared his roadmap for the development of Ethereum in the next 5 to 10 years on Twitter, which mainly consists of the following four parts:

  • eth 2 phase 1

  • eth 1.x statelessness

  • eth 2 phase 0 prep (core path, focus on eth 1 ➔ eth 2 merge, remove PoW)

Specification and implementation of eth1 ➔ eth2 merge

eth 1.x statelessness

Among them, "eth 1.x statelessness" can be said to be the most crucial condition for the merger of eth1➔eth2. This article will focus on "statelessness" as the main axis to make related introductions.

first level title

Since the essence of the Ethereum blockchain is a decentralized large-scale "state machine" maintained by miners, it changes states as the number of blocks increases and keeps moving forward. The complete "state" of Ethereum contains the current state of all individual accounts and balances, as well as the overall memory of all smart contracts deployed and running in the EVM.

The Ethereum network has only one "state" at each block height that has obtained the consensus of all nodes in the entire network. This "state" will change in each new block and be connected to the blockchain along with the block.

image description

- Image source: https://blog.ethereum.org/ -

secondary title

It takes more time for the node to read the state, and the transaction processing speed becomes slower

It takes longer to construct a new state tree and slows down block verification

summary

When the miners finish processing the transaction, they must construct a Trie structure state tree composed of new states, which involves a large number of hash value calculations. After calculating the Root Hash, a new Block Header can be constructed and a new block can be packaged.

summary

In general, the continuously increasing "state" and "node size" will lead to a substantial increase in the start-up cost of new full nodes: the increase in the demand for "storage space" and "synchronization time" may further increase the number of full nodes in the network. reduction.

In addition, the overall performance degradation of the Ethereum network is inevitable. With the increase in the time-consuming state tree query and calculation and more and more contract transactions in Ethereum, the TPS may further decline, causing the network to become more congested and usher in a higher Gas Price competition.

Proposal of eth 1.x


Since the continuous growth of state has a significant impact on the health of the Ethereum network, one of the solutions is to "eliminate the need for state on the Ethereum network". Take a closer look at the future roadmap of Ethereum released by Vitalik on 2020/3/19 to see a series of solutions:


text

image description

The 1.x Files: The Updated Stateless Tech Tree (April 2, 2020)

The 1.x Files: A Primer for the Witness Specification (May 4, 2020)

The 1.x Files: EIP 1559 and the Ethereum Improvement Horizon (June 16, 2020)(Up to date)

-2020/4/2 updated eth 1.x technology tree-

first level title

The purpose of eth 1.x

secondary title

(A) Extend the life of eth 1.0

Maintaining the security, stability, and resilience of the eth 1.0 blockchain as blocks continue to grow, allowing people to choose to download only part of the state and run nodes on less expensive hardware.

secondary title

(B) Interfacing with eth 2.0

Since shards in eth 2.0 will be stateless, "stateless" will be a prerequisite for participating in eth 2.0 block verification. If eth 1.0 is to be compatible with eth 2.0, it must support stateless operation in order to transition smoothly and interface with eth 2.0.

In order to achieve these two goals, we can see "Stateless Ethereum" at the end of the skill tree on the far right. However, the term "stateless" Ethereum may be somewhat imprecise, because the entire Ethereum network exists based on state.

Specifically, it is to find a way for some nodes in the Ethereum network to make "keeping a copy of the entire Ethereum state" an option, not a requirement. Therefore, it is necessary for the current Ethereum network to support lightweight nodes that do not preserve the complete state of the entire network: "stateless nodes" participate in the verification of new blocks in the network.

(1) Block witness mechanism

(3) Convert data structure to binary system (Binary)

(1) Block witness mechanism

How Stateless Nodes Participate in Validation

To put it simply, the method is: "Full State Node" that has the state information of the entire network will generate "Block Witness" when packaging a new block, so that "stateless nodes" that do not save the state of the entire network The new block can be verified by the information provided by the block witness.

What is "Block Witness"

As mentioned earlier, the data structure of Ethereum is a Merkle-Patricia Trie composed of about 500 million state values. However, only about 0.1% of the state values ​​(about 500,000) will change with the height of the block, such as: the ETH balance of the personal account, and the number of Tokens held by each address recorded under the contract. 99.9% of the state values, such as the code of the smart contract, the parameters of the Uniswap fee of 0.3%, and other information will not be changed once the smart contract is deployed.

Since a new block (currently 12 million Gas Limit) can only hold up to 571 transactions, the state value changes involved are very limited. Then a stateless node that does not store all the state values ​​can actually calculate the Merkle Root for verification as long as it requests the relevant state values ​​involved in the transaction and the unrelated hash values ​​from the node with complete state.

texthttps://blog.ethereum.org/-

As shown in the figure below, assuming that the 14 diamonds at the bottom represent all the state values ​​in the Ethereum network, and there is only one transaction in the new block to change the green state value, then the stateless node actually only needs one green original The status value, the purple Hash value and other 6 Hash value information that have not changed can calculate the new Root Hash (Merkle Root) through 4 Hash value calculations, without having all 14 status values ​​for 9 Hash value calculation.

image description

-Image Source:

In order to allow stateless nodes to participate in the verification, the latest research direction is that "block witness" may become part of the "block header Block Header", and broadcast to the entire network nodes along with the newly mined blocks. It allows stateless nodes to verify blocks without initiating additional "block witness requests".

In this way, stateless nodes can participate in the verification of new blocks in the Ethereum network.

first level title

(2) EVM changes

The change and operation of the state value are all carried out in the EVM. Similarly, the block witness must also be generated through the operation of the EVM of the full node. The change goal of EVM is closely related to cost and incentive mechanism, mainly including the estimation of gas consumption and how to reduce the impact on inter-node broadcast delay.

Block witness Gas calculation (Witness Gas Accounting)

Since the block witness must be generated by the full node to spend additional computing resources, there will be a corresponding Gas cost, and this cost is currently more feasible to be borne by the initiator of the transaction. As for how to allow the transaction initiator to accurately estimate the additional Gas when sending the transaction to set an accurate Gas Limit, it is still under study and has not yet been definitively finalized.

In addition, considering that a status value may be changed by more than one transaction in the same block, resulting in double payment of Gas, this part may become an additional reward fee for miners.

secondary title

Smart contract code block (Code Merkleization)

At this time, there will be another problem. Only a small fragment of the smart contract's profuse code may be associated with the transaction operation, so the concept of "program code block" was proposed.

"Code block" is a way to split the Bytecode of the smart contract. The code related to the transaction in the smart contract is disassembled and provided as part of the block witness. The state node is used for operation verification.

The purpose is to avoid calling unnecessary codes, avoiding the increase of computing time and the delay of communication between nodes due to the generation of huge blockchain witnesses.

(3) Convert data structure to binary system (Binary)

According to the experiment (Binary Tries Experiment) conducted by Ethereum researcher Igor Mandrigen, if the Ethereum data structure is changed from the current hexadecimal (Hex) to binary (Binary), the block witness size of each block will be It can be reduced from 800~3,400 kB to 300~1,400 kB, which will greatly reduce the delay time of block witness propagation in the network, so that the block witness mechanism can run more ideally.

However, the specific implementation method and transition strategy of converting from Hex to Binary are still not completely conclusive. Interested friends can continue to pay attention to the relevant news released by the Ethereum Foundation.

Stateless Ethereum Stateless Ethereum

So far, by introducing the "block witness mechanism", making necessary changes to "EVM", and converting the data structure to "binary system", the general appearance of eth 1.x has been outlined.

The 1.x network supporting stateless nodes will have the following key impacts on the Ethereum 1.0 blockchain network:

i. Be more friendly to newly joined nodes

With the expansion of the state of the whole network and the increase of the block height, the synchronization time for starting a new node will become longer and longer (as of 2020/06, starting a new full node needs to be synchronized for at least one week), which is extremely long The reason is that the synchronization of the full node must start from the genesis block to verify and synchronize each block, and the verification block must have the entire network state of the block height, so in each block Synchronization status is currently a huge bottleneck for synchronization nodes.

The arrival of the era of stateless nodes will greatly improve the painful process of synchronizing blocks. In the future, only "block headers" and "block witnesses" can be used to complete block verification. The improvement of the synchronization node experience will allow more Multiple people are willing and able to afford the cost (time and hardware resources) of running a node.

ii. Light nodes become self-reliant

In the current Ethereum network, light nodes do not have the ability to independently verify new blocks and verify transactions, because light nodes do not save the merkle proof information required to verify transactions, so they must send p2p requests to adjacent full nodes to request, but light nodes Now there are fewer and fewer Buddha Heart full nodes willing to provide support.

The stateless mechanism will help light nodes to rely on the part of the state maintained by themselves (information such as the balance of their own accounts and contracts), and independently verify with block headers and block witnesses, without asking others.

iii. Node network security improvement

Since the security of the blockchain network depends on the total number of nodes that can participate in the verification of new blocks, the cost of attacking the network will increase with the increase of the total number of nodes, which can effectively reduce the risk of the system being defeated.

With the reduction of the start-up cost of new nodes and a large number of light nodes investing in the verification of new blocks, the overall security of the network will be greatly improved.

The last point is also the core point. As mentioned earlier, eth 2.0 will be composed of the core beacon chain and multiple shard chains, and the state of the entire network will be stored separately by multiple shards. Since each shard has a different state, and does not save the state information of other shards. So for each shard, the other shards are like "stateless nodes".

in conclusion

In order to be able to effectively verify and synchronize between multiple shard chains, it is necessary to rely on a "stateless verification mechanism". Therefore, if the current eth 1.0 can successfully become one of the shard chains of eth 2.0 in the future, upgrading to the stateless eth 1.x is a crucial step.

first level title

in conclusion

Through the above introduction, I believe readers should have a clearer understanding of the changes required to upgrade from the current eth 1.0 to eth 1.x, and the future after the changes are completed.

After the eth 1.x upgrade is completed, people will be able to run their own stateless nodes (light nodes) with cheap hardware, and more light nodes that can participate in verification can further maintain the security of the entire network.

Only eth 1.x with a stateless verification mechanism can smoothly interface with the beacon chain of eth 2.0 and other shard chains, officially allowing the Ethereum network to enter the lightweight eth 2.0 built with a stateless verification mechanism and sharding technology future.

  • above, if any

  • You are very welcome to leave a comment below. I hope my article can help more friends like me who want to learn blockchain technology and knowledge. If you feel that you have gained something after reading it, you also hope that you can

thank you all!

give me 50 clapshttps://medium.com/


开发者
ETH
Welcome to Join Odaily Official Community