Blockchain -- Optimization (layer2)

Zeke Luo 2022-04-04 01:47:39 阅读数:260

blockchain optimization layer2 layer

brief introduction

Optimism, Formerly known as Plasma Group, yes Optimistic Rollup The development team behind the extension technology .Rollup It's a smart contract on Ethereum , Used to connect Ethereum main chain and L2.Rollup Receive transaction data from Ethereum main chain , Send it to the L2, And then to receive L2 The result of the calculation . It should be noted that ,Rollup There are two variants :Optimistic Rollup and ZK-Rollups.Optimism Use only Optimistic Rollups.

stay Optimism On , Send to L2 The transactions received are executed accurately by Sequencer receive .Sequencer You'll be rewarded for doing the deal right , But if they act maliciously by cutting mortgage money , You will be punished .

If anyone doubts Sequencer There is fraud , They may remind the arbitrators on Ethereum's main network of the contract . This can prove Sequencer Using optimistic virtual machines (OVM) The validity of the generated results ,OVM Is for L2 The system is built with Ethereum virtual machine (EVM) Compatible execution environment . If it happens Sequencer The result of is invalid ,Optimistic Rollup Will perform fraud proof , also Sequencer The money will be forfeited . Some of the confiscated funds will be awarded to informers . The informer is calling “ Challenge period ” Challenges in the new era Sequencer Result . It usually lasts about a week , This leads to the removal of assets from Optimism The transfer back to Ethereum was delayed by a week .

Although the withdrawal delay is Optimism There is a problem , But the savings are gas The cost is very considerable . This is because Rollups It can improve efficiency through a series of compression techniques , These techniques replace data with computation as much as possible . This leads to space savings on the chain 100 times .

Block production

Optimism The production of the block is mainly carried out by “ Sequencer ” Single party management , It helps the network by providing the following services :

  • Provide instant transaction confirmation and status update .
  • Build and execute L2 block .
  • towards L1 Submit user transactions .

The sorter has no memory pool , The transaction will be accepted or rejected immediately in the order of receipt . Send their transactions to the sequencer , The sequencer checks whether the transaction is valid ( That is, pay enough fees ), The transaction is then applied to its local state as a pending block . These blocks to be processed will be submitted to Ethereum in large quantities on a regular basis for final determination . This batch process significantly reduces the overall transaction cost by dispersing fixed costs into all transactions within a given batch . The sequencer also applies some basic compression techniques , To minimize the amount of data released to Ethereum .

Because the sequencer is given the right to L2 Priority write access to the chain , So the sequencer can provide a strong guarantee , Once it decides on a new pending block , It will ultimately determine what state . let me put it another way , Know exactly what the impact of the transaction is . result ,L2 Status can be updated very quickly and reliably . The benefits of doing so include fast 、 Instant user experience , And near real-time Uniswap Price update .

perhaps , Users can skip the sequencer completely and submit them directly through Ethereum transactions CanonicalTransactionChain Transactions . This is usually more expensive , Because the fixed cost of submitting this transaction is completely paid by the user , And will not be allocated to many different transactions . however , The advantage of this alternative submission method is that it can resist the review of sequencer . Even if the sequencer is actively vetting users , Users can always continue to use Optimism And recover any funds through this mechanism .

From Ethereum to optimism

To send a message from Ethereum to Optimism, The user only needs to trigger... On Ethereum CanonicalTransactionChain contract , stay Optimism Create a new block on the block . For other contexts , See above about ** Part of block production .** The block created by the user can include transactions that appear to originate from the address of the generated block

from Optimism Turn to Ethereum

Optimism The contract on can't be like the Ethereum contract can be in Optimism Generate transactions on Ethereum as easily as generate transactions on Ethereum . therefore , Take data from Optimism The process of sending back to Ethereum is more complicated . We must be able to make a demonstrable statement about the optimism of the contract on Ethereum , Instead of automatically generating authenticated transactions .

Making demonstrable statements about optimism requires ** Cryptography promises  ( Open a new window ) In an optimistic state The form of the root of  ( Open a new window ). Optimism The status of is updated after each block , Therefore, this commitment will also change after each block . Promise to publish regularly ( About once or twice an hour ) To the smart contract on Ethereum , be called  StateCommitmentChain ( https://etherscan.io/address/0xBe5dAb4A2e9cd0F27300dB4aB94BeE3A233AEB19)**.

Users can use these commitments to generate **Merkle Tree proof  ( Open a new window ) About optimism . These proofs can be verified by smart contracts on Ethereum .Optimism Maintain a convenient cross chain communication contract , L1CrossDomainMessenger  (https://etherscan.io/address/0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1)**, It can verify these certificates on behalf of other contracts .

These proofs can be used for Optimism Make verifiable statements about the data in any contract storage at a specific block height . You can then use this basic function to make Optimism The contract on can send messages to the contract on Ethereum . L2ToL1MessagePasser  (https://optimistic.etherscan.io/address/0x4200000000000000000000000000000000000000)**Optimism Contracts on can use contracts ( Pre deploy to Optimism The Internet ) Store messages in Optimism state . then , Users can prove to the contract on Ethereum Optimism The given contract on actually means that the hash of the message has been stored in L2ToL1MessagePasser Contract to send certain given messages .

Proof of failure

stay Optimistic Rollup in , Status commitments will be released to Ethereum without any direct proof of the effectiveness of these commitments . contrary , These commitments are considered pending for some time ( be called “ Challenge window ”). If the proposed state promises to... During the challenge window ( The current setting is 7 God ) Not challenged , Then consider it as the final commitment . Once a commitment is considered final , Smart contracts on Ethereum can safely accept proof of optimism based on this commitment .

When national commitments are questioned , Can pass “ Proof of fault ”( Formerly known as “ Proof of fraud ”) Make it invalid  ( Open a new window )) The process . If that commitment is successfully challenged , From the Delete in ,StateCommitmentChain Eventually replaced by another proposed commitment . The important thing is to pay attention , The challenge of success will not roll back Optimism In itself , Only published commitments about the chain state will be rolled back . The order and optimism of transactions will not change due to the challenge of failure proof .

L1 and L2 Differences in use process :

  • L1-L2 Deposit Probably 5 minute
  • L2-L1 withdraw need 7 God (7 The time of day indicates , You can see from Optimism Turn to Ethereum
  • L2-L2 tranfer Second level
版权声明:本文为[Zeke Luo]所创,转载请带上原文链接,感谢。 https://netfreeman.com/2022/04/202204040141584442.html