In-depth Interpretation of Optimism: Basic Architecture, Gas Mechanism and Challenges | CatcherVC Research

CatcherVC
2022-04-06 21:18:58
Collection
While creating a vision through idealized narratives, how Optimism will move towards decentralization and fulfill the concept of "fraud proof" mechanisms and multi-Squencer rotation remains to be tested by time.

Author: SA, CatcherVC

Key Points of This Article

  • Due to considerations of security and decentralization, the gas limit and block time of the ETH blockchain cannot be significantly altered;
  • The essence of Layer2 scaling is to create a chain with higher TPS and link its information to Ethereum;
  • The market value potential of Optimism is enormous, with a TPS limit of up to 1600, but the actual utilization rate of its throughput is less than one-thousandth, indicating great future development potential;
  • Due to the lack of open peer nodes, after the local sequencer of Optimism produces a block, it may take up to 1 hour to verify its correctness, resulting in excessive delays;
  • Currently, both Optimism and Arbitrum are operated by official block-producing nodes, which poses serious centralization issues, relying more on the "credit" of the project parties rather than "programmatic justice" itself;
  • After Optimism's upgrade for EVM equivalence, its "fraud proof" mechanism is unusable, and the official statement claims that this issue will be resolved in the future.
  • True decentralization and security are more valuable than high efficiency. If users cannot participate in network maintenance in a timely manner, the so-called Layer2 will be no different from traditional financial platforms.

Introduction

As the ETH merge officially progresses, Layer2 and Rollup are gradually becoming prominent topics in the blockchain industry. At its core, the purpose of Layer2 is to increase the number of transactions processed per second (TPS) and reduce gas fees. The former is the most critical aspect of Layer2 scaling, while the latter is key to enhancing the user experience of Layer2 interactions.

According to its definition, TPS = number of transactions processed in a period / time taken. In the blockchain field, if we ignore situations like forks or block reorganizations, TPS can be roughly viewed as the average number of transactions per block ÷ block time. For a typical public chain, improving TPS involves issues of block expansion and block time, while the actual value of TPS also relates to the gas mechanism adopted by the public chain, whether it be ETH, BSC, or Polygon.

However, increasing the gas capacity of blocks or shortening block times can compromise security. At its core, Ethereum's scaling faces the "impossible triangle" problem of how to improve efficiency while ensuring security and decentralization, which remains a theoretical discussion without resolution.

In this context, Layer2 solutions represented by Optimism and Arbitrum have rapidly risen to prominence under the banners of high efficiency and low gas fees. While attracting various capital with clever narratives and gaining a large user base with ultra-low gas fees, the inherent centralization issues have become increasingly apparent, drawing more attention and scrutiny.

This article will reveal the dilemmas faced by Layer1 scaling under the premise of ensuring decentralization, as well as significant issues present in typical efficient Layer2 projects.

Ethereum's Gas Mechanism

One of the key factors determining Ethereum's efficiency is its gas mechanism. In the Ethereum system, gas is a measure that reflects the complexity of different operations. Just as a car consumes gasoline while driving, transactions on Ethereum incur gas consumption. A simple ETH token transfer consumes 21,000 gas. Other types of operations, such as standard ERC-20 token transfers or more complex contract interactions, can incur tens of thousands or even hundreds of thousands of gas.

Each Ethereum block has a gas limit, which restricts the total amount of gas that can be consumed by all transaction instructions within a block, similar to how a refrigerator cannot hold more items once it is full. Before the implementation of EIP-1559 last year, the gas limit for a single block was around 15 million, which could roughly accommodate 714 ETH token transfers. If we plug the average block time of 13 seconds into the TPS calculation, the theoretical TPS limit for Ethereum before EIP-1559 was 55.

image

However, in reality, many transactions involve high gas-consuming contract interactions, which significantly occupy the gas capacity of blocks, lowering the average actual TPS of Ethereum to around 20, resulting in severe congestion and pushing a large number of potential transaction demands off-chain. Since the transaction fee for a single transaction = Gas Used × Gas Price, and Gas Used is determined by the system and can be viewed as a constant, users initiating transactions must pay a higher Gas Price than others to be prioritized by the system. Ultimately, the supply-demand gap created by the system's characteristics leads to high transaction fees, causing many to complain.

image

In essence, ETH is fundamentally an auction platform for transaction permissions, where Gas Price represents the bids of bidders, and the allocation of transaction permissions is achieved through a bidding mechanism between supply and demand. This design aligns with the principles of a free market in blockchain but sows the seeds of internal competition.

Throughout Ethereum's history, whenever hot events like "CryptoKitties" or "5.19" stimulate transaction demand, a fierce gas war phenomenon emerges on the ETH chain, where the higher the Gas Price paid, the sooner the transaction is included in the block. This intense price competition drives Gas Prices up, leaving users unable to afford high fees locked out, making Ethereum a veritable "noble chain," sparking countless disputes and leading many to view EIP-1559 as a "savior."

However, in reality, the much-anticipated EIP-1559, which made significant adjustments to the gas mechanism of blocks last year, primarily served to make the fluctuations of Gas Price more controllable and reduce ETH's inflation rate and selling pressure, rather than directly lowering Gas Price or abolishing the gas bidding mechanism.

Although this proposal raised the gas limit of ETH blocks to 30 million, as long as the actual gas consumption of new blocks exceeds 15 million, the Gas Price in the next block will gradually increase under system adjustments. This process can last for multiple blocks until the Gas Price becomes extremely high, blocking the vast majority of users and drastically reducing the number of transactions that can be accommodated in new blocks, causing gas consumption to fall back to 15 million.

image

(It can be seen that Gas Price rose continuously for 4 blocks.)

Observing statistical data, it can be found that within the six months before and after the implementation of EIP-1559, Ethereum's daily gas consumption only increased by less than 10%. Considering that the block time remained stable at 13 to 13.5 seconds during these six months, Ethereum produced about 6,500 to 6,650 blocks daily, with each block's gas capacity consistently around 15 million, showing no significant change.

image

(The axis line in the chart represents the day after the London hard fork.)

Since EIP-1559 did not fundamentally change the gas content of blocks, Ethereum's TPS was not improved, and transaction fees remained high, leaving a large number of potential users still outside the Ethereum system.

According to relevant data, there are currently nearly 200 million independent ETH addresses, processing only over 1 million transactions daily; in contrast, BSC (BNB Chain), with lower gas fees, processes over 5 million transactions daily, yet has fewer than 150 million independent addresses. Roughly estimated, the ETH network meets at most about 15% of transaction demand.

Block Time

From another perspective, since TPS = number of transactions per block ÷ block time, block time is also a key factor affecting TPS. Additionally, several stages within the block time can map to different components of Ethereum's business logic, which is the key point of Layer2 scaling ideas.

It is important to emphasize that Ethereum is a system composed of numerous server nodes, and its business logic includes execution, consensus, and multi-party storage. Among them,

  • Execution refers to processing transaction events and other instructions to obtain results;
  • Consensus means that all nodes recognize the execution results;
  • Multi-party storage indicates that multiple nodes store the same content, which can be read by external parties.

In some materials, consensus is also referred to as settlement, and multi-party storage is called data availability; these terms are essentially interchangeable.

A complete block time consists of the following steps:

  • First, mining pool nodes select a winner through Proof of Work, who will complete the execution of transactions and create a new block;
  • Proof of Work requires brute-force enumeration of random numbers, consuming a large amount of computing power, and these tasks are completed by mining machines within the pool, taking a considerable amount of time;
  • The winning mining pool node will select a batch of transactions waiting to be included in the block based on the Gas Price and execute them to obtain results, then include the transaction information and results in the new block;
  • After that, the new block will be propagated to all Ethereum nodes, and its content will be checked. Specifically, the nodes checking the block will read its content, re-execute the transactions inside, and verify whether the data submitted by the mining pool is correct. This achieves consensus;
  • Finally, if the new block passes the check, the nodes will include the new block, completing multi-party storage.

Thus, a new block will be copied over 2,000 times and stored in Ethereum nodes across the network. More specifically, all mining pool nodes and all full nodes will store a copy. Through this form, Ethereum nodes achieve a near "consistency."

image

(Classification of Ethereum node numbers and physical locations)

In summary, a complete block time for Ethereum includes Proof of Work + Execution + Consensus + Multi-party Storage in four stages. Among them, the Proof of Work and Consensus stages take the longest time. Since there are more than 2,000 mining pools and full nodes in Ethereum, achieving consensus among these nodes generates a significant amount of communication time; while Proof of Work serves as a flexible time-filling tool, designed to keep the block time stable at around 15 seconds (currently, the block time is about 13 seconds).

Why is the block time fixed at 13 seconds? This is derived from considerations of security and decentralization, leading to a more optimal solution. Due to the large number of Ethereum nodes and their physical dispersion, if blocks are produced too quickly, it increases the information gap between nodes, undermining consensus; for example, if the Ethereum block time is reduced to 0.1 seconds, and there is a 1-second delay in transmitting information to different nodes in the US and Europe, there would be a 10-block information gap between nodes in the US and Europe, which contradicts the design philosophy of blockchain.

image

(Distribution of Ethereum node physical locations)

If block expansion is forcibly implemented, it will also exacerbate the information gap between different nodes. For instance, if the gas capacity of ETH blocks is increased tenfold, the number of transactions per block will also increase tenfold, leading to a tenfold increase in the potential information gap between different nodes.

According to relevant information, until Ethereum completes its transition to POS, its block time will remain stable at 13 seconds, and after transitioning to POS, the block time will only shorten by 1 second, stabilizing at 12 seconds. Thus, the POS transition may only increase Ethereum's TPS by a maximum of 10%, which is negligible.

Currently, under the premise of ensuring security and decentralization, the gas capacity of ETH blocks and block time have basically reached their theoretical limits, leaving little room for optimization.

OP Rollup Scaling Solution

As mentioned earlier, due to comprehensive considerations, the block capacity and block time of Ethereum cannot undergo significant changes, and its TPS has remained below 20, with little improvement over the past two years.

In response, scaling solutions outside of ETH have taken different paths. Public chains like BSC and Polygon have modified block parameters independently of ETH. Taking BSC as an example, its current block gas capacity limit is 80 million, which is 2.7 times that of ETH; at the same time, BSC has reduced the number of nodes participating in consensus to just over 20, only 1% of ETH, significantly compressing the time required for nodes to reach consensus, with block time reduced to 3 seconds. While this raises the TPS limit to over 10 times that of Ethereum, it completely disconnects from the "tempered steel" security of the ETH network, and its level of decentralization is also far lower than that of ETH.

image

(Average gas limit of BSC blocks)

Layer2 solutions represented by Rollup adhere to a different philosophy. Although they are essentially public chains outside of Ethereum, they still rely heavily on Ethereum's security. For example, OP Rollup (Optimistic Rollup) compresses and stores the Layer2 blockchain copy on the Ethereum mainnet, while:

  • The local block time of Layer2 retains only the execution phase of transactions;
  • Proof of Work is eliminated;
  • The multi-party storage function is transferred to the Ethereum network;
  • The consensus process is completed by Layer2's validator nodes but is not included in the local block time of Layer2.

Principle of Optimism

Taking Optimism, the most typical example of the OP Rollup scheme, its four most important modules are Sequencer, Verifier, CTC (Transaction Chain), and SCC (State Chain). Among them, Sequencer and Verifier are hardware entities of Layer2 nodes, and together they form the node network of Layer2; CTC and SCC are contracts deployed on Ethereum, and these four modules constitute the core architecture of Optimism.

image

The Sequencer is a centralized mining pool node responsible for producing blocks locally in Layer2. Optimism has eliminated the Proof of Work process, with the sole Sequencer acting as the miner, and it does not immediately allow other nodes to perform consensus verification, saving a significant amount of time. Currently, the Sequencer can finalize a block immediately after executing transactions, with local block time taking as little as 1 second, fundamentally increasing TPS.

However, the Sequencer exhibits strong centralization characteristics, effectively creating a sidechain independent of Ethereum. Without the consensus and multi-party storage processes, it inevitably lacks security guarantees. To address this issue, Optimism stated in its early documentation that the Sequencer must stake a certain amount of assets, and:

  • Every few minutes, the Sequencer node will store a compressed version of the local block on the ETH mainnet; this content includes a summary of transaction data and the state root after the transaction occurs. This process is called Rollup;
  • The summary of transaction data is stored in the CTC (Transaction Chain) contract on ETH, while the corresponding state root is stored in the SCC (State Chain) contract. This generates two transaction events; during this process, the Ethereum system is only responsible for multi-party storage of the content and does not verify its correctness;
  • The Layer2 Verifier will automatically read the content stored by the Sequencer on Ethereum and review it, similar to the consensus process in Ethereum.
  • Currently, both Optimism and Arbitrum are operated by official Sequencer nodes, which poses serious centralization issues.

image

CTC and SCC are contracts deployed on Ethereum by the Optimism team, structured in batches to record summaries of Layer2 transaction data and the root hash of the Layer2 state tree after each transaction is executed. From an external perspective, CTC and SCC resemble two bill lists.

(Note: The state tree is a database that records information about on-chain addresses. By obtaining the state tree root and the summary of transaction data, one can reconstruct the local block content of Layer2. Generally, the state root stored in the SCC contract is more important; once the state root is obtained, it can be calculated with the transaction data to determine whether the Sequencer has unilaterally altered the user address balance.)

image

The Layer2 Verifier will automatically read the records in the CTC and SCC contracts, attempting to reconstruct the local block content of the Sequencer and verify it.

  • If the Verifier discovers issues with the data submitted by the Sequencer, it can initiate a challenge and submit what it believes to be the correct version. If the challenge is successful, it can rewrite the erroneous data in the CTC and SCC and receive a certain amount of token rewards;
  • If the Sequencer is successfully challenged and found to have acted dishonestly, it will face certain penalties, and a portion of its staked assets will be deducted; if the staked balance falls below a designated threshold, the Sequencer will be forcibly removed and lose its block production qualifications;
  • This is the "fraud proof" mechanism, which allows the Verifier to disclose fraudulent behavior by the Sequencer.
  • The consensus reached between the Verifier and Sequencer has serious latency issues. A transaction is immediately executed by the Sequencer after submission, but the Verifier may obtain the state root and perform final verification of the results only after 1 hour.
  • Optimism underwent an EVM equivalence upgrade in November 2021, eliminating the old OVM virtual machine for its Sequencer and Verifier clients, rendering the "fraud proof" program based on the old OVM inoperable, while the new "fraud proof" program has yet to be released.

According to previous technical documents, Optimism set the challenge window time to 7 days; if no Verifier initiates a challenge within 7 days, the content published by the Sequencer is finalized and cannot be rewritten.

In essence, Optimism is a cross-domain interaction system composed of hardware and software entities on Layer1 and Layer2, with its unique business logic constructing a mapped version of Layer2 blocks on Ethereum. Due to the need for cross-domain information transmission, the Sequencer and Verifier of Optimism must run a modified version of the Ethereum client Geth: L2geth, which allows the Sequencer to achieve interaction across Layer2 and Layer1.

Optimism's Gas Mechanism and Details

Regarding gas fees, due to the data storage step in Optimism's business process, the gas fee for each transaction = Layer1 part + Layer2 part, and other OP Rollup solutions like Arbitrum and Metis follow a similar pattern.

Among them, the Layer2 part mainly involves the fees for the Sequencer node executing transactions. Since the TPS limit of the Sequencer is extremely high, and the current number of users on Optimism is relatively low, its local Gas Price is very low. The calculation formula is: L2 Gas Fee = L2 Gas Used × L2 Gas Price.

image

  • According to OP's official disclosure, the Layer2 part of a transaction accounts for only 0.4%, with the remaining 99.6% of gas expenses coming from the Layer1 part. ^[1]^
  • This can be simplified into the equation: 0.4% × execution cost + 99.6% × storage cost.

It is evident that the execution cost of transactions has been significantly reduced.

Therefore, the more complex the execution steps of a transaction (such as options), the more cost savings can be achieved on Optimism. For example, an options operation that costs $100 on Ethereum may only cost around $1.50 on Optimism, just 1/60; a standard transfer on Ethereum may cost $3, while on Optimism it might only cost $0.30, or 1/10.

The gas fee for the Layer1 part is calculated as coefficient × (fixed cost + storage cost). Here, fixed costs arise from the processes of packaging data and cross-domain transmission, storage costs are the gas incurred from storing data on ETH, and the coefficient is set by the Optimism team, primarily to reserve some funds to prevent the gas price on the ETH mainnet from surging, which would hinder the smooth storage of data on-chain.

image

(Explanation of the fee structure by Optimism officials)

To gain a deeper understanding, one can observe the specific steps of Rollup (packaging) and storage:

  • Before storing a batch of transaction data on Ethereum, the Sequencer will compress the content and then combine this batch of transactions into a Batch, which is transmitted to ETH network nodes.
  • Each Batch can contain hundreds of transaction data, similar to a block. The release cycle of a Batch is dynamically adjusted by the Sequencer, currently around 3 to 10 minutes.

Thus, the process of packaging and transmitting the Batch inevitably incurs workload, consuming certain computational resources, and the fixed costs can cover this part of the expense. Currently, the fixed gas cost for each transaction on Optimism is 2,100. Optimism officials state that as the user base expands in the future and the number of transactions per Batch increases, the fixed costs will be further reduced.

When storing the Batch on Layer1, the Sequencer will input the Batch information into the CTC contract in the form of textual data (Calldata); generally, textual data is used solely for storage and not for execution. Compared to ordinary contract calls, this step saves a significant amount of gas.

image

(The data submitted by the Sequencer to the CTC is a series of hexadecimal characters.)

Typically, every few minutes, the Sequencer will transmit a transaction Batch to the CTC, creating a chain list composed of transaction Batches on Ethereum. Afterward, the Sequencer will also store the corresponding state root Batch of the transaction Batch in the SCC (State Chain) contract, a process similar to what was mentioned above.

image

(State root Batch submitted by Optimism)

This entire process consumes gas, and the specific amount of gas consumed depends on the volume of content stored. Different transaction types will generate varying amounts of data, leading to different storage costs.

What is the theoretical TPS limit of Optimism?

To explore the theoretical TPS limit of Optimism, we should envision a critical state:

  • The local block production speed of the Sequencer is far higher than that of the Ethereum mainnet, leading to a persistent information gap △ between Layer2 native content and Layer1 replica content. As the number of Layer2 users increases, the actual TPS surges, and the information gap △ between Layer2 and Layer1 can be expanded;
  • As Optimism approaches its theoretical TPS limit, the information gap △ between Layer2 and Layer1 can become substantial. Therefore, Optimism must quickly submit data to the Ethereum mainnet at all costs to synchronize the data;
  • Ultimately, the instructions initiated by the Sequencer occupy all the gas of Ethereum blocks, meaning that all available resources on Ethereum are utilized by Optimism, with each Ethereum block containing only the data submitted by the Sequencer;
  • Based on the gas limit of 30 million for each Ethereum block after EIP-1559, if the transactions executed locally by Optimism and submitted to Ethereum are all the simplest transfer operations, then the TPS limit of Optimism would be approximately 1600^【2】^.

image

(Theoretical TPS limits of various Layer2 solutions calculated by the W3.Hitchhiker team)

In summary, the TPS limit of Optimism is at least 16 times that of Ethereum. Considering that the current number of users on Optimism is very low, the actual TPS is even less than 3% of Ethereum's, indicating a potential growth space of up to 500 times.

To summarize the above content and combine it with actual investigations, we conclude:

  • The Sequencer node has created a blockchain with extremely high TPS, which is the source of scaling. While the efficiency is very high, the high centralization means the Sequencer may act maliciously or experience downtime;
  • To enhance security, Optimism requires the Sequencer to stake certain assets and mandates that the Sequencer disclose key information about Layer2 blocks on the ETH mainnet, which the Verifier will automatically read and check for accuracy;
  • Since the transaction data stored on ETH is compressed and Ethereum nodes are not responsible for executing these transactions or verifying the correctness of the data, this significantly saves gas. Currently, executing complex options operations on Optimism can reduce gas fees to as low as 1% of Ethereum's.

image

(An options opening operation on Optimism only cost $1.20; on Ethereum, it costs over $100.)

  • The consensus reached between the Verifier and Sequencer has serious latency issues. A transaction is immediately executed by the Sequencer after submission, but the Verifier may obtain the state root and perform final verification of the results only after 1 hour. Due to the excessive delay, various types of attack scenarios may arise, posing a potential threat to the security of Optimism.

image

(The state root Batch uploaded by Optimism's Sequencer to Layer1 can take up to 1 hour.)

  • The incentives received by the Verifier = token rewards for successful challenges node operating costs. Publishing a "fraud proof" and succeeding in the challenge is an unpredictable event with a low probability, so the incentives for Verifiers are not strong, making it difficult to expand the number of such nodes, and consensus and security remain weaker than Ethereum.

As mentioned earlier, the most effective way to expand the number of Verifiers is to enhance incentives or open a peer node network. For Optimism, which has yet to issue tokens or open peer nodes, it is challenging to incentivize validators like Metis through its own issued tokens. Therefore, current Optimism faces significant challenges in how to expand the scale of verification nodes and enhance the timeliness of verification.

  • It is worth noting that currently, the Sequencer nodes of Optimism and Arbitrum are all provided by the official team, so the effectiveness of the Sequencer penalty mechanism remains controversial; currently, the security of Optimism and Arbitrum relies more on the "credit" of the project parties rather than "programmatic justice" itself;
  • Importantly, Optimism underwent an EVM equivalence upgrade in November 2021, eliminating the old OVM virtual machine for its Sequencer and Verifier clients, rendering the "fraud proof" program based on the old OVM inoperable. The new "fraud proof" program has not yet been put into operation, and the challenge mechanism is currently ineffective.

Conclusion

Despite the current popularity of Optimism, showcasing tremendous development prospects and value potential, as previously mentioned, it still faces the issue of excessive centralization. Gavin Wood once said: "True decentralization and security are more valuable than high efficiency." If users cannot participate in network maintenance in a timely manner, the so-called Layer2 will be no different from traditional financial platforms.

image

(Gavin Wood remarked on Solana's brief downtime last year: True decentralization and security are more valuable than high efficiency. If users cannot run full nodes of the network themselves, such projects will be no different from traditional banks.)

While creating a vision for scaling through idealized narratives, how Optimism, which has already become "too big to fail," will embark on the path of decentralization and fulfill the vision of the "fraud proof" mechanism and multi-Sequencer rotation remains to be seen over time. However, it can be confirmed that in the long run, only true decentralization can withstand the test of history and endure forever.

References

  1. The Road to Sub-dollar Transactions Part 1: Slashing Fees by 30%
  2. Understanding the Four Major Layer2 Solutions and Comparing Transaction Costs
ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
ChainCatcher Building the Web3 world with innovators