Home  >  Article  >  After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

PHPz
PHPzforward
2024-04-18 17:40:01415browse

Preface

EIP-4844, as the largest upgrade of Ethereum after The Merge, has attracted enough attention from the entire network. The Blob temporary storage space introduced in this upgrade is equivalent to adding a side-mounted carriage to the Ethereum train, providing cheaper data availability space without affecting the original operating status of the train.

Layer 2 networks such as Optimism, StarkNet, and Arbitrum have all supported EIP-4844 in a short period of time and achieved significant fee reductions. The following is a transaction in which the LXDAO treasury pays wages to contributors on Optimism. , the gas fee before and after actually differed by 100 times.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

But while we were pleasantly surprised, we discovered that StarkNet, as a representative of ZK Rollup, has also achieved an amazing fee reduction effect. In the past, Gas consumption has always exceeded 1$. level, also dropped to 0.01$.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

If you want to know more detailed technical principles, you are welcome to enter MyFirstLayer2 to learn.

Note: MyFirstLayer2 is a Web3 education project supported by the Ethereum Foundation and initiated by LXDAO. It aims to help newcomers through various attractive teaching methods, such as text, pictures, animations and interactions. Understand the development history and basic concepts of Layer 2.

Why is StarkNet’s fee reduction surprising?

OP Rollup and ZK Rollup have different requirements for a layer of storage space

Because OP Rollup and ZK Rollup have DA costs (Data Availability: data availability, including data storage and distribution services, In order to allow third parties to obtain the data they wish to obtain), the degree of reliance varies.

OP Rollup will package and compress all details of recent transactions, including user signatures and other information, and upload them all to the first-tier network. It does not require too many verification tasks on the first-tier network, and almost all costs are in the storage space of the first-tier network.

ZK Rollup, in contrast, has a higher compression rate for data. For example, it can abandon user signature data and rely on zero-knowledge proof to ensure that transactions are legal; and it does not need to package all transaction details, only the changes in status are packaged and uploaded.

For example, on the second-layer network, 100 users have traded on the USDC / USDT trading pair. Each time the transaction user and the USDC and USDC balances in the Swap contract will change. For OP Rollup, it is 100 transactions and 400 balance changes of 200 accounts; for ZK Rollup, there is not much difference involving changes in user balances, but for the Swap contract, its USDC and USDT balances A total of 200 changes can be compressed into 2 changes in the final balance, greatly reducing the data volume.

ZK Rollup verifies the extra Gas consumed by ZK Proof

After understanding the difference between the two, your first impression may be that the Gas fee of ZK Rollup will generally be lower, but after actual operation Students should all know that the cost of L2 of ZK Rollup such as StarkNet and ZkSync is often significantly higher than that of OP Rollup. In particular, StarkNet's STARK technology route is larger than the ZK Proof of other SNARK routes. Transfers in each L2 Cost is often at the bottom of the rankings.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

The reason why ZK Rollup did not beat OP Rollup to the ground as soon as it went online is very simple, because although it has a higher compression rate for transaction data, it saves money. This reduces the cost of transmitting data to one layer, but it requires verifying the legitimacy of the zero-knowledge proof on the first-layer network, which increases the cost of calculation.

Blob can only reduce the cost of the storage part, but does not help the calculation part. Therefore, ZK Rollup can gain even less benefits from EIP-4844, so we can see that StarkNet ranks from the bottom It's hard not to be surprised when the "underachievers" progress to the same level as the first and second place students in the class.

Exploration of StarkNet Fees

It has to be said that the mechanism of ZK Rollup is far more complicated than that of OP Rollup. For example, in the cost of packaging data to the main network before and after the upgrade through the Optimism: Batcher contract, any Everyone can completely understand why its transaction fees dropped by two orders of magnitude.

Click on the blue text to learn more:

The last old Batch before upgrading.

The first new Batch after the upgrade (including the Blob fee, a total of 0.0011 ETH):

The cost of 6 Blobs (a total of 0.00078 ETH)

But while exploring the StarkNet Gas fee In the process, the author experienced considerable difficulties and even encountered multiple plot reversals. The process of exploration itself is also very enlightening. Let us relive it with the article.

The disappearing L1DA

Because we have the experience of exploring the secrets of Optimism’s fee reduction, we naturally thought that we only need to find the contract where StarkNet submitted data to the main network. This important contract must be It was once on the Gas consumption list of Etherscan, and it should not be difficult to find. Scroll, which has not been adapted to Blob, is still among the best and hangs at the top.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

When we search for StarkNet keywords, we will find 3 related contracts: Operator, Core Contract, and Memory Page Fact Registry, but the third one seems to be related to storage space. The contract was discontinued nearly two years ago.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

So we can only see that the Operator is constantly interacting with the Core Contract and constantly updating the latest status.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

And if we turn to the front and back of the adaptation blob, we find that the Operator's Update State transaction has indeed been upgraded, but it is just a hash pointing to another packet. Even the later updateStateKzgDA consumes more Gas, which cannot explain the reason for StarkNet's fee reduction at all.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

##This later update is just a KZG polynomial commitment, used to prove that in Blob The data corresponds to the data packet of its corresponding Batch, and it is just a "State Root". This state root corresponds to the "small ledger" that records all the states of all contracts on the second-tier network. This small ledger theoretically also exists on the first-tier network.

Then the question is, why is there only one root left? Where did that thick little ledger go?

Analysis after the first failure

Although the first exploration was not successful, we can still get some inferences and conjectures. Friends who have watched MyFirstLayer2 must know that the core issue discussed by Rollup is the DA issue (data availability), and the solutions they adopt are to upload key data to the main network to solve the data availability problem, so that everyone can easily access it required data.

  1. OP Rollup is actually a simple and crude way to compress and package each transaction and upload it to the first-layer network. Then others can obtain the second-layer small data by decompressing and replaying each transaction. A complete view of the ledger to verify whether transactions were executed correctly.

  2. ZK Rollup does not need to upload all transaction details, only the State Diff (the state change part of each batch) can be uploaded, and zero-knowledge proof is used to ensure that all transactions have been Layer 2 is implemented correctly. Others can restore the full picture of the second-layer small ledger by replaying the results of multiple state changes.

And we know that the data in the Blob is just a string of binary text to the first layer. The first layer only protects the accuracy of the data in the Blob without verifying its legality. Smart contracts cannot read and verify the contents of the Blob. Therefore, if ZK Proof is still verified by one layer, then the ZK Proof itself cannot be placed in the Blob. Therefore, StarkNet can have a certain fee reduction effect by putting each The batch of State diff is placed in the Blob.

So our next task is obviously to figure out, where does StarkNet put the State diff? Where was it placed in the past? Is it placed in the Blob now?

In addition, the fact that only one state root can be found also makes people wonder whether StarkNet quietly uploaded state change data to the mainnet a long time ago and changed it to its own DAC (Data Availability Committee). ) is responsible. If this is really the case, then StarkNet’s previous high charges are completely unreasonable and can only be explained as...

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

Related links:

https://layer2.myfirst.io/zh#2.4-rollup

SHARP System

Fortunately, after discussing with @0xYandhii, a new dawn has ushered in. Before the launch of the general mainnet, StarkNet’s first product was actually StarkEX, including the decentralized derivatives exchange DYDX It is also a product of that period. After the mainnet went online, the original product was not abandoned, but instead shared a verification system with the mainnet.

That is, SHARP: Shared Proving and Verifying System, and then we found related contracts such as SHARP Blockchain Writer and Starkware: SHARP Verifier.

Open the block browser to query related transactions, you can find that SHARP Blockchain Writer has performed the following 4 types of operations:

  1. Verify Merkle: Verify Merkle tree

  2. Verify FRI: Fast Reed-Solomon Interactive Oracle Proof of Proximity, used to ensure that submitted data or calculation results follow specific rules or constraints without revealing the content of the data itself.

  3. Register Continuous Memory Page: Uploaded more than a hundred times in one cycle, registering a continuous memory space, which is suspected to be the part that writes data to the first-tier network.

  4. Verify Proof And Register: Once a cycle, it can be as fast as ten minutes or as slow as one or two hours. It should be enough to accumulate enough transactions for a batch of verification.

It is not difficult to see that steps 1, 2, and 4 are steps related to zero-knowledge proof, and the third step of registering memory space is obviously a step to write data to a layer of network , is the most likely place to store State diff.

It is reasonable to speculate that the costs of those three verification steps have not changed significantly before and after the Blob upgrade, and the cost of the third step should be able to explain the two orders of magnitude cost reduction effect before and after StarkNet.

So the author continued to browse the block browser, and took one verification cycle from each of the three periods of the penultimate old version before EIP-4844, the penultimate version, and the latest version after upgrade, and counted 4 How much gas does the step consume?

The results are as follows, which makes people scratch their heads.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

The memory cost has dropped by half, but judging from its proportion of the cost in the entire round of ZK Proof verification process, this level of DA decline does not explain any problems.

The exploration has almost reached its end at this point. The author feels like a physicist sitting in front of the large particle collider in the Trisolaran world, and every brain cell is screaming: This doesn't make sense! I even went to the StarkNet community to post a post asking, but perhaps because the question was too complicated, no one in the English community responded.

SHARP System GasUsed Exploration

At this point, we have the last little trick left. In the previously downloaded transaction data csv, there is only ETH consumed by Gas fee, and there is no information such as Gaslimit, so Gas cannot be excluded. The impact of unit price fluctuations on statistics. So the author wrote a script to count the GasUsed (the used part of the Gaslimit) actually consumed by each transaction involved.

Finally, the light appears! It can be seen that before the upgrade, the transactions for registering memory space were actually sent in groups of 2. One gas cost was a minimum of 50,000, while the other one was generally around 300,000 gas.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

#After the upgrade, almost all registered memory transactions have become low-consumption transactions of 50,000.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

The strange conclusion last time was probably because we took too few samples. It happened to be that during the verification cycle after the upgrade, we caught up with a large segment of the mainnet Gas surge. During this period, hundreds of Register Continuous Memory Page transactions that lasted for a long time cost higher Gas, which skewed the statistical results.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

According to this idea, we reorganized the GasUsed data of 3 moments, which is much more reasonable this time. At this point, it can be confirmed that the size of the Memory Page has indeed been significantly reduced after the upgrade. This should be the place where the State Diff state change data is stored. After the upgrade, this part of the data was transferred to the Blob.

And then we found the technical diagram of StarkNet on l2beat.com, and we can find that the State diff is indeed stored in the Memory Page as we expected.

After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple

In the end, based on our calculation based on the number of GasUsed (a broad estimate based on the current randomly selected small sample size), the actual cost of L1DA for StarkNet has about 4-10 times of reduction, which is slightly less than an order of magnitude. . This is also consistent with theoretical deduction: in the EIP-4844 upgrade, ZK Rollup does not gain as much benefit as OP Rollup.

Summary

After the above exploration, we finally clarified the reasons and extent of StarNet’s fee reduction, and the conclusion is still a bit thought-provoking.

The cost of L1DA has dropped significantly, but it cannot explain the drop of two orders of magnitude

It is clear that StarNet used to write the data of each batch of status changes into a layer of network, but now it will This part of the data is placed in the Blob, so the cost reduction effect can be slightly less than an order of magnitude when registering the memory space.

But StarkNet has gone from being the last or second to last, to a level with the top OP roll-ups. In terms of relative progress, it even beats all OP rollups. So obviously it is impossible.

Then the only reasonable explanation is that the "Heart-Hearted" price was indeed too high before. Before the issuance of STRK tokens, all development and community incentives of StarkNet require funds. In addition to burning investors' money, setting a higher L2 L1 Gas price difference may be one of their ways to maintain development, which caused the previous StarNet Embarrassing gas bill situation.

Now that the STRK token issuance has brought them enough liquidity and ecological incentives, it is time to return Gas to a reasonable level. Taking advantage of this wave of Blob upgrades, the The sandbags were removed together, and the fee reduction effect really surprised many people.

ZK’s OP

OP Rollup actually sacrifices a little bit of security after upgrading and transferring the data originally stored in Calldata on the Ethereum main network to the temporary storage area.

Previously, the data in the Calldata space was permanently stored, which meant that anyone could obtain enough data from the Ethereum main network to restore all current states on OP L2.

But after the upgrade, the Blob data will expire. If no entity in the entire network saves the past Blob data, the historical transaction records of OP L2 may be lost. Although the latest Layer 2 network state can still be protected - because the Blob's storage period exceeds the OP's 7-14 day challenge period, so before each Blob is about to expire, its corresponding Layer 2 state is still credible. , these latest ten days of transaction records maintain the security of OP L2 on a rolling basis.

ZK Rollup If you want to enjoy the benefits of Blob, you also need to transfer important second-layer status data from the permanent Calldata space to the Blob space. This means that after a period of time, we can no longer rely on the data provided by the first-tier network to replay the status of the second-tier network as before.

Perhaps this will become a new normal. In the future, all second-tier networks will rely on Blobs to maintain the latest state of security, and each L2 also needs to find its own way to solve the availability of historical transaction data. In this way, A better balance between safety and efficiency.

Integration trend of OP and ZK

In the past, the first generation of OP Rollup was the first to go online, but the first generation of ZK Rollup did not bring more competitive gas fees after it went online. With the subsequent modularization trend brought about by the emergence of OP Stack and Polygon SDK, OP Stack even plans to introduce ZK technology in the future to reduce the challenge period.

This undoubtedly points to the fact that the two technical routes of OP and ZK are not life-and-death competition. They will learn from each other and have a tendency to merge. However, this time it is the "noble" ZK that is turning to the "simple and crude". "The OP learned once.

It is hard to imagine that the technology of the second-layer network has evolved to such an extent in just two or three years. Perhaps this is the charm of the blockchain world.

Reference:

[1] FeedTheFed. Data availability with EIP4844[EB/OL]. (2024-02-11)[2024-04 -16]. https://community.starknet.io/t/data-availability-with-eip4844/113065.

[2] L2BEAT research team. Starknet[EB/OL ]. [2024-04-16]. https://l2beat.com/scaling/projects/starknet?selectedChart=activity#contracts.

The above is the detailed content of After EIP-4844, StarkNet charges reduced by 100 times? But I found that things are not that simple. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:panewslab.com. If there is any infringement, please contact admin@php.cn delete