D1 Ventures: Brief Analysis of Ethereum Layer 2 Solution and DeFi Expansion Options
Editor's Note: This article comes fromChain News ChainNews (ID: chainnewscom), published with permission.
Editor's Note: This article comes from
Chain News ChainNews (ID: chainnewscom)
Chain News ChainNews (ID: chainnewscom)
, published with permission.
Author: D1 Ventures, a venture capital institution focusing on the native blockchain field, supports the future development of the encrypted economy by providing global market insights, building cross-market liquidity, providing strategic consulting and Meme communication strategies. Key investment projects include NEAR, Polkadot, Ethereum, Handshake, and ecological native scene applications.
The DeFi boom once again highlights the performance problems of Ethereum
Sufficient redundancy is the guarantee of network security under the proof-of-work mechanism. However, since the synchronization speed between nodes is limited by the network communication bandwidth, the state transition that the entire network can reach a consensus within a certain period of time is limited. Transaction initiators and contract operators need to obtain these resources through bidding.
In the formula, the Gas limit of an Ethereum block is 12,500,000, and the average block interval is 13.2 seconds. The following table can be obtained:
It can be seen from the table that the gas cost of complex contract interactions such as depositing ETH to Compound is greater than dozens of Ether transfers, and the transfer fee for a complex transaction can be as high as tens of dollars. When Ethereum receives more and more complex transactions from applications such as DeFi, the number of transactions that can be processed per second will drop rapidly. And this is exactly what is currently happening on Ethereum. The figure below shows the change trend with the number of accounts in major DeFi projects.
The total number of accounts that have interacted with DeFi applications, source: @richardchen39
image description
Block Gas limit and Gas used, source: @alex_kroeger
Although the block gas limit increased by 25% after the miner vote on June 19, the utilization rate of the block remains high. Users passively pay more expensive Gas Price to compete for the tight processing capacity of Layer 1. Gas Price is rising simultaneously driven by the explosive growth of DeFi applications.
image description
Gas Price median weekly line, unit: GWei, source: @alex_kroeger
Although the mechanism of bidding and packaging has increased the income of miners and maintained the stable operation of Ethereum, the increase in costs has significantly restricted the development of DeFi applications and the further growth of users. According to the current Ethereum Gas Price (85GWei), the Gas fee required to exchange 1ETH into LEND in Uniswap V2 is 0.04544ETH, and the payment ratio to liquidity providers is 0.3%. The sum is generally charged by centralized exchanges 24.22 times of the 0.2% handling fee (Although the gas fee traded on DEX is a fixed value, the percentage will drop rapidly when the transaction amount increases, but the liquidity of the AMM exchange will also significantly increase the slippage, Further increase the additional cost of trading on decentralized exchanges).
High transaction fees discourage users, and DeFi application developers and investors are eagerly seeking suitable expansion solutions.
Fraud Proof or Validity Proof?
In short, the idea of Layer2 expansion is to replace many transactions with one proof to save Layer1 resources. Correspondingly, this should be able to prove the validity of the corresponding multiple transactions. Naturally, the way of proof can be divided into two types:
Fraud proofs, presenting evidence that state transitions on-chain were incorrect;
Proof of validity, presenting evidence to prove that the state transition on the chain is correct.
The Layer 2 expansion scheme corresponding to the fraud proof optimistically assumes that off-chain transactions are true and valid until a party presents evidence to prove that there is an error. Most of the expansion schemes that we are familiar with are fraud proof schemes, including State Channel (State Channel), Plasma, Optimistic Rollup, etc. Considered to be authentic and valid, the overhead required to prove that these transactions are authentic and valid is saved.
But in order to prevent malicious transactions from slipping through the net, a system using fraud proofs must allow enough "fault tolerance time" or "challenge time" to receive fraud proofs to prove that some transactions are not really valid and cancel them. During the challenge time, the transaction on Layer2 may still be modified, and the balance of the associated account will still be locked on Layer1 and cannot be withdrawn. At the same time, the effectiveness of this mechanism is based on the "Liveness Assumption" (Liveness Assumption) that victims have the ability to recognize system errors and submit fraud proofs for correction within the "challenge time". In this assumption, silence about error is tantamount to acquiescence to error. Attackers often use various means to prevent stakeholders from submitting fraud proofs within the challenge time to complete the attack. Fraud proof schemes must make a trade-off in the length of the questioning time.
Validity proof schemes, such as ZK Rollup and Validium, are much more stable than fraud proofs. Every time the system performs a state transition on Layer1, it submits a proof sufficient to prove that the transition is true and valid for Layer1 node verification. Proof of validity therefore does not require a challenge time, and there is no additional delay in exiting from Layer2. How to save the cost of production proof is the art of validity proof class expansion scheme.
Data availability (Data Availability) solution
D1 Ventures' focus on data availability began with a discussion of Plasma, a method of scaling by building sidechains anchored to the Ethereum mainchain. Plasma opens one or more side chains outside the Ethereum main chain, and periodically records snapshots of all block headers of the side chains on the main chain (excluding specific transaction information), so as to incorporate the status of the side chains into the main chain. under the security umbrella. However, since the snapshot does not contain specific transaction information, the main chain cannot know the status of the user in Layer 2. When the side chain operator still reserves the right to stop synchronizing information with the main chain or refuse to package certain transactions at will, the user must independently store the side chain. Only by submitting all the data on the chain to the main chain can the absolute security of its own property be protected, and this amount of data is not realistic for the processing capacity of the main chain.Scalable blockchains as data layers, Vitalik Buterin
Rollup improves this problem by anchoring the Layer 2 transaction and the state of the entire side chain to the Ethereum main chain, thereby achieving data availability. This improvement allows users to easily prove to the verification nodes of Layer1 that all their transactions in Layer2 are authentic and valid, so they can exit Layer2 at any time.
To achieve data availability, it is necessary to avoid excessive occupation of Layer1 space. Rollup flexibly and practically compresses the storage space of a single transaction on the chain to 11 bytes (Nonce and Signature do not exist on the chain), 748Gas, which is the common layer of Layer1 1/28 of the transfer, where:
image description
The number of bytes in each field in the Rollup transaction, source:
Reduce the account space to 23*8 (greater than 16.77 million), and convert the 20-byte account address on the Ethereum main chain into a 3-byte leaf node index according to the preset Merkle Tree as the compressed address;
Assuming that the number of transfers of an account will not exceed 20,000, the Nonce is represented by two bytes.
Mainstream Layer2 expansion solution matrix
D1 Ventures divides the current mainstream expansion solutions and representative applications into four quadrants according to the above-mentioned fraud proof/validity proof and on-chain/off-chain data validity.
image description
Expansion Solution Provider (Open Network)
image description
Application (customized network)
zkSync is an Ethereum Layer 2 open network developed by Matter Labs based on ZK Rollup. In addition to realizing the basic indicators of high TPS and low handling fees of ZK Rollup, zkSync has established a more practical and independent network:
Zero-knowledge smart contract framework. zkSync has launched a safe and efficient programming framework and virtual machine-based operating environment Zinc, which is designed for smart contracts based on zero-knowledge proofs. It can quickly compile smart contracts on Layer 1 into programs that zero-knowledge proof algorithms are good at processing. As a bridge to transfer resource-intensive applications such as DeFi on Layer1 to Layer2. But because the zero-knowledge proof itself is too complex, security still requires a lot of trial verification.
source:Optimism blog post
zkSync is currently the most mature ZK Rollup open network. In addition to ordinary transactions, zkSync is working hard to support more complex DeFi applications to run on it. In the future, zkSync will introduce token governance in Layer 2 to better achieve decentralization. Matter Labs also plans to launch zk Porter to shard the network so that smart contracts for applications with different logic types can be better supported on different shards. A mature Layer 2 open network looks increasingly similar to an independent blockchain.
Optimistic Rollup is a combination of fraud proof and Rollup without zero-knowledge proof, which was first developed by Optimism (formerly Plasma Group). OVM (Optimistic Virtual Machine) is an execution environment built on Layer 2 and fully compatible with EVM launched by Optimism. It allows users to perform all operations on the Ethereum main chain in Layer2's Rollup network, including writing Solidity smart contracts and interacting through Web3 APIs. Porting Dapp to OVM requires no additional operations other than deploying contracts. Optimism has partnered with Synthetix to deploy and test the entire Synthetix application on OVM. The following preliminary test data shows that OVM has significantly improved the performance of DeFi applications on the main chain.
image description
Optimistic Rollup does not require zero-knowledge proofs, and can run EVM directly on Layer 2 to easily support various logical smart contracts on Layer 1, and the migration cost of Dapp is small. As a price, it still needs to wait for about a week of questioning time to withdraw from Layer 2, but in specific projects, it is still possible to eliminate the delay of small withdrawals by establishing a fund pool and other inelegant ways to provide convenience for users.
Source: Matter Labs
In the lower left corner of the quadrant, Validium is a combination of off-chain data availability and validity proofs, integrated by Starkware in the decentralized exchange engine product StarkEx. In fact, StarkEx has designed a flexible data storage structure (the solution is called Volition), and users can freely choose the data storage location each time they trade, and due to the support of DAC, the data in StarkEx no matter on-chain or off-chain Data availability support is available, and users are free to exit Layer 2 without permission.
We considered some key indicators of the above-mentioned Layer 2 expansion solutions, and compared them horizontally through the following table:
image description
The three main Layer 2 expansion solutions can fully meet the application's requirements for TPS and transaction fees. Optimistic Rollup is the most compatible with smart contracts. No additional modification is required to port Dapp on OVM, and Synthetix has been deployed on it for testing; ZK Rollup is second, although Zinc has started testing, but the complexity introduced by zero-knowledge proof Risks and development barriers still make it difficult for many developers to try; Validium is still a solution integrated in the StarkEx trading engine, and there is no plan to expand to an open network. ZK Rollup has the best support for transaction-intensive applications, and the fast exit brought by data availability has obvious advantages compared with the weekly exit period of fraud proof schemes.
Composability Constraints and Functional Partitioning
The Layer 2 expansion solution can easily optimize TPS and transaction costs dozens of times, at the cost of loss of composability. The Layer2 network is similar to a large shopping mall in the fiat currency system, and the DeFi project in the Layer2 network is like a store in a shopping mall. Users who need to shop must apply for a card (Layer2 account opening), recharge funds, consume, and finally withdraw the balance. Users cannot use shopping cards in one shopping mall to spend in stores in another shopping mall, and the problem of composability has become an unbreakable barrier between shopping malls.
In some application scenarios, composability is one of the leading factors for decentralized applications to lead over centralized applications. Taking DeFi applications as an example, decentralized exchanges can easily aggregate liquidity and form an aggregation effect, making the liquidity of the entire ecosystem bigger and bigger. Compared with the fierce involution competition of centralized exchanges, it is obvious more efficient.
image description


