Interpretation of Optimism's operating mechanism

in CryptoDog5 years ago

image.png

Since the Optimism team announced that its mainnet will be launched earlier, I think it is necessary for everyone to understand what the Ethereum Layer2 solution Optimism is, how it works, and what it will bring to Ethereum.

The reason why everyone looks forward to it is that L2 solutions such as Optimism help: increase the throughput of Ethereum (transaction processing per second); shorten the waiting time for transaction packaging (the time required to confirm an exchange); And greatly reduce gas costs. And the expansion is done without sacrificing the security of the Ethereum mainnet.

This is the biggest difference between a real Layer2 solution and a "pure side chain" solution (such as @0xPolygon or @xdaichain). The side chain solution has its own consensus mechanism and security, and cannot benefit from the security of Ethereum Layer 1, while the Layer 2 solution can maintain the security of the Ethereum network.

image.png

For example, if we use Optimism: When a user submits a transaction on the Ethereum main network (or Layer 1), the transaction data will be stored on L1, but the processing of smart contract calculations will be on the sub-chain (ie Layer 2) Proceed, and finally the calculation result is sent back to Layer1.

Since the calculation process is the longest and most costly part of a transaction, processing calculations in Layer 2 greatly reduces the calculation requirements of Layer 1, thereby increasing network throughput and reducing transaction fees. L1 only receives transaction data, sends it to L2, and then receives the calculation result of L2

Optimism is a more "universal" solution. Any Solidity smart contract on L1 (that is, any L1 app) can run on Optimism's Layer2, and there is no need to build additional functions.

The figure below shows how Optimistic Rollup works. The two big boxes are the Optimistic Rollup contract and the Optimistic Virtual Machine (OVM). Rollup is an L1 smart contract, responsible for receiving transaction data, then sending the data to L2 and receiving the calculation results. But the interesting part happened in L2.

image.png

On L2, the transaction will be submitted to a "Sequencer" sequencer (it can be said to be a miner on L2). It will then respond immediately, generating a signed receipt to ensure the execution and ordering of the transaction. However, what if the sequencer does evil, does not execute the transaction correctly, or preempts the transaction?

In this case, the user can submit the signed receipt to the referee contract on L1. If it proves that the sequencer has not fulfilled its obligations correctly, then ta will be fined (ie lose its pledged funds). So L2 can be said to be a small PoS system.

But when there is a dispute, the referee contract on L1 should be able to perform calculations as on L2 and obtain exactly the same calculation results. This needs to be applied to OVM.

OVM can be said to be an L2 adapter on L1, ensuring that the L1 Ethereum Virtual Machine (EVM) is just like processing L2 calculations in L2. The purpose of this is to enable any calculation on L2 to be verified on L1 (if necessary). This is very important.

The origin of "Optimistic" optimism is that we assume that all calculations performed on L2 are correct until someone raises a dispute. If there is a dispute, the referee on L1 will rerun the calculation on the Ethereum network and check the result.

In order to motivate users to act as a "watchtower" and verify the results of calculations, Optimism is set up like this: Anyone who finds dishonest behavior and raises objections to it can get part of the reward from the fines of the malicious sequencer (Sequencer). Even if the user himself does not verify all of his transactions, other users will help verify.

The best part is that once enough Ethereum apps are running on Optimism's second-tier network, most users will spend most of their time on L2 without going back to L1 (unless there is a dispute that needs to be resolved, or The user has withdrawal requirements).

Seeing this, readers may feel that this will invalidate Ethereum L1. However, in fact, this will further expand the Ethereum ecosystem. Ethereum will be able to support new and higher throughput applications, which is impossible to achieve based on the current network capacity.

Another great point of Optimism is that it has an "account abstraction" function. In other words, each account is a "contract" account that can be modified, so various transaction conditions can be implemented, such as multi-signature or other gas payment methods.

What is the current application situation of Optimism? First, Synthetix is ​​now running Optimism on its private mainnet. Once the implementation is completed, Synthetix plans to completely transfer its pledge and mining functions to L2, but retain the transaction function on both L1 and L2

@Uniswap used Optimistic Rollups to run a gamified proof of concept (Unipig) on ​​October 19th, and once Optimism goes live on the mainnet, Uniswap will be their first batch of users. @chainlink also announced that it will cooperate with Optimism, and @coinbase wallet adds local support for Optimism testnet...

@compoundfinance is also expected to support Optimism (not determined yet), and @RariCapital will also integrate Optimism on their platform. Many projects will join in the future, which will have a significant impact on the speed of the Ethereum network and transaction fees.

What this means to us: Synthetix's test shows that after using Optimism, the gas fee can be reduced by up to 143 times, and the transaction confirmation time can be as low as 200 milliseconds; while the Unipig test shows that the gas fee can be reduced by up to 100 times and the transaction confirmation time 169 milliseconds.

image.png

Optimistic Rollups are also very suitable for the Ethereum 2.0 ecosystem. Because Ethereum 2.0 will first launch a data expansion plan, and then a computing expansion plan. In the initial stage, Rollup will first ensure scalability in computing and coexist with Ethereum 2.0.