Original title: "Viewpoint: Understanding Ethereum and its future from the perspective of "state""
Original source: Ethereum enthusiasts (ID: ethfans)
Since its creation in 2015, the Ethereum blockchain has experienced five winters and summers. Five years have not only turned the Ethereum protocol 1 as a concept into reality, made this protocol more mature and more specific, but also exposed the characteristics and trade-offs of such a set of designs. These trade-offs, as a design challenge, have naturally attracted and continue to attract countless talents to try to improve the usability of Ethereum; among them, the one that brings together the most effort and imagination is to improve "scalability". series of plans.
The point of this article is that, just as the Ethereum paradigm faces design trade-offs, so do all these scalability schemes; Whether it is worth it or not requires us to return to Ethereum itself, to the real problems and real needs of Ethereum nodes and Ethereum users. The "state" perspective, as a perspective for understanding Ethereum itself, can just help us clarify the design of these programs and reveal our gains and losses.
This article will start by explaining the meaning of "state", revealing the ultimate spear and Achilles' heel of Ethereum, and then discussing various improvement directions. "Rich state" is the source of the "combinability" of Ethereum smart contracts, but it is also the biggest weakness of the Ethereum network. From this, we can see which solutions that are often mentioned by people will affect "combinability", and which "scalability" has more obvious meaning.
So, what is it that makes Ethereum a breakthrough innovation?
Contract B can call contract A and change the state of contract A according to the code disclosed by contract A; contract C that calls contract B can also indirectly call contract A and change contract A state...Thus, although a state is stored in the A contract, its control logic can be so overlapping and continuously accumulated; if the state is understood as an asset, this is equivalent to allowing the right to use the asset (use conditions) to be Constantly get stricter and more complex control; this means that, theoretically speaking, a state update logic can be infinitely close to financial contracts in real life (because all financial contracts can be superimposed and combined through simple logic ). This attribute that allows the accumulation of arbitrary layers of control is the most critical, but how to program this control is secondary.
Now we can summon Ethereum's strongest spear: "Composability" (currency LEGO)!
The computing method on the chain allows us to have a variety of contracts; the global state allows these contracts to access each other's state; the rich state allows the contract's The combinations can be infinitely varied. So we can not only have the stable currency DAI, but also have a lending market, a lottery application, an application that automatically donates the proceeds of the lottery, and an application that automatically rebalances the savings ratio between different lending markets... ...
The state transition process of Ethereum can be abstracted as: the state transition function takes the old state and transaction list as input, and outputs new state. This means that Ethereum's full-verification nodes must maintain the latest state of the Ethereum blockchain locally, so that they can execute state functions and use the results to verify the validity of a block (and also agree with other Ethereum nodes. consensus).
The contradiction lies in: for the contract and the developer, the state of the contract is stored on the node of the Ethereum as part of the global state of the Ethereum, and the contract The status update of the Ethereum node is calculated by the Ethereum node (and the user who initiates the calculation request pays for it). This "serverless" architecture is very comfortable; however, these states will be permanently stored in Ethereum's fully verified In the node, although you need to pay for each update, it is unavoidable that the state data saved locally by the node will continue to accumulate and expand.
In short, the global state, on-chain computing and rich state, not only make the contracts on Ethereum composable, but also make the network of Ethereum trapped in the centralized Dangerous; just like the Lord of the Rings in the novel "Lord of the Rings", it can not only summon powerful forces, but also swallow the user himself. I worry that Ethereum will bear this burden for a long time.
Next, we use the "state" perspective to understand the design and trade-offs of various scalability solutions.
In a word: If we can't make the network reach a consensus on more transactions per unit time, then improve the connotation of a single transaction.
If you regard the Layer-2 scheme as a design pattern of the contract, you will see more clearly - The Layer-2 scheme chooses not to use the global state . Another contract cannot know in real time what state is inside a Layer-2 contract (how much money does user A\B\C have), because these states are not on the chain, and therefore, a Layer-2 contract is Cannot be combined with other contracts.
But another more interesting question is, if the front-end technology required by the sharding architecture It can be realized, how meaningful this structure can be.
In the sharding architecture conceived by the research team of the Ethereum Foundation, the state of the entire system is divided into several parts, and each part is updated in parallel That is to say, one shard cannot know the internal state of another shard in real time. When contract A' in shard A tries to call contract B' on shard B, it cannot be assumed that the processor owns the state of shard B, and therefore, the processing result must wait for shard B to complete the state update before returning . As a result, cross-shard transactions must endure the most unbearable cost in transaction processing: delay. The point is that this delay cannot be abstracted with a monetary cost. Because shard B does not know that a transaction that needs to call itself has occurred on shard A, so it can only wait for a trusted communication layer to broadcast this transaction for itself.
The higher the value that can be created per unit time, the more unbearable the delay; The application will never schedule the processing power on other shards through cross-shard transactions, because it is meaningless and cannot meet the delay requirements of DeFi applications. Similarly, this also means that the processing power of a single shard of the shards aggregated by this DeFi application is the upper limit of its processing power (no difference from a single blockchain). Building houses and building roads in deep mountains and old forests cannot solve the problem of living space for people in metropolises.
(Some people think that these "idle" shard throughput can be used by more niche applications. I think that Layer-2 solutions can achieve the same Effect, and less changes to the underlying layer, more secure.)
However, to be honest, statelessness currently faces many, many design challenges. Specifically:
(1) Statelessness requires a proof (witness) of the accessed state attached to the block/transaction, and the scale of this part of data may be very large Large, the current block data size of Ethereum is about 20-40 KB, but the size of the witness data may be at the MB level (depending on the size of the accessed state volume);
(2) Only maintenance Witness can only be assembled by nodes with all the states, so who will provide the state for ordinary users? (Actually, this can be regarded as a change in the operating assumption of Ethereum: all full nodes can participate in mining; but not after statelessness is realized);
(3) How Pricing the gas consumption of transactions? Especially because of the timeliness of the witness, it is not possible to determine how much computation it takes to assemble the witness based on the opcode.
Because of these difficulties, Ethereum's full nodes may have to run in this mode of maintaining all states for a long time. However, statelessness is definitely the most exciting direction for current improvements to the Ethereum protocol. Because it directly faces the core problem of Ethereum, and tries to solve this problem from the bottom up. In addition, research on the use of state data in the Ethereum protocol has also nourished other research directions, such as synchronization methods 8.
I am biased to believe that the future of Ethereum is some scheme inspired by statelessness, if not statelessness.
There are two ways to solve the problem of stolen funds. One is to ensure that every state transition is valid, that is, every time the state root of the contract is to be updated, the Ethereum implements a verification program for the integrity of the calculation. Only after the verification is passed, the contract is allowed to update the state root. This is the idea of zk-rollup; With a deposit, if the submitted status root is invalid, the person who reports the status root can get the original submitter's deposit, which is optimistic-rollup. But the latter idea has a prerequisite: the whistleblower must have a way to obtain the state before the state transition, otherwise there is no way to generate a false proof of the transition.
There is only one way to solve the problem of locked funds: weaken the concept of "operator" as much as possible, so that anyone can submit a transaction to Ethereum to update the The state of the Layer-2 contract. But this goes back to the question: if the submitter does not have the state of the contract, how can he prove the validity of his state access and let the contract release it?
Finally, the Rollup solution solves this problem by "publishing matching transaction data at every state transition". Therefore, although the Rollup contract does not disclose the state on the chain, anyone—including users of the rollup contract—can reconstruct the internal state of a rollup contract based on these public transaction packages. This means that, if properly designed, the funds in the rollup contract can be as safe as the state-saved contracts on the Ethereum blockchain (that is, the contracts we commonly use now)!
Taking zk-rollup as an example, the on-chain verification program ensures that a rollup contract cannot update a wrong state root, just like without your permission, Maker DAO cannot confiscate your DAI; at the same time, assuming it also discloses the construction method of computational integrity, you can directly initiate a state transition to the contract on the chain at any time to withdraw your own money. This is exactly like a normal, stateful contract: there is no way to roll back the state of the rollup contract without a 51% attack, and there is nothing to stop you from getting your money back without a constant 51% attack.
Optimistic-rollup relies on some cryptoeconomic assumptions, so it is slightly weaker: in addition to 51% attacking the rollback state, the attacker can 51% of the time censorship attack to inject the wrong state root into the contract; or you can bet that everyone who has calculated the latest state of the contract will not observe the error (the probability is extremely small). But Optimistic-rollup can also provide strong custody-free, and you can get your money back at any time.
In other words, if the user is willing to deposit money into a stateful contract (such as compound, maker dao, uniswap), then There is no reason not to want to deposit into a rollup contract (if you have to add a qualifier, it is a zk-rollup contract). With zk-rollup, the layer-2 solution can already provide users with the greatest degree of financial security that contracts on the Ethereum blockchain can provide. Obviously, only by doing this will it be possible to achieve mass adoption.
All Layer-2 schemes can be regarded as a compromise towards statelessness: Layer-2 scheme itself is a stateless state (for other contracts, the internal state of the Layer-2 contract is inaccessible), no matter how complicated the internal state is, it will not increase the burden on the Ethereum node; at the same time, update the Layer-2 contract (the state root) At this time, the role of Ethereum is more of verification, that is, verifying that the update of the state root is valid, rather than calculating the state root by itself. However, in the rollup era, the Layer-2 solution proved that it can be as safe as a stateful contract, and its promise can be realized.
In summary, in this article, I explain where Ethereum's "composability" comes from, and whether various hotly debated scalability schemes sacrifice this Combination, what did you get in exchange? Readers may notice that when I reason and evaluate, I put a lot of emphasis on "what we have achieved/get" and "what people's behavior shows they need". Yes, it is from this perspective that I explain the charm of the rollup scheme (in fact, this may be one of the core motivations for me to write this article). In my opinion, such a thinking tendency can make the starting point of our thinking more reliable, avoid guessing the needs of users, and avoid investing in building castles in the air.
In the flow of history, I have seen people choose certain things among the optional things, which makes me have to think that these things are important and there is no reason to have confidence in technologies that neither increase what people choose, nor sacrifice what people actually choose.
Original link
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia