Futures
Access hundreds of perpetual contracts
TradFi
Gold
One platform for global traditional assets
Options
Hot
Trade European-style vanilla options
Unified Account
Maximize your capital efficiency
Demo Trading
Introduction to Futures Trading
Learn the basics of futures trading
Futures Events
Join events to earn rewards
Demo Trading
Use virtual funds to practice risk-free trading
Launch
CandyDrop
Collect candies to earn airdrops
Launchpool
Quick staking, earn potential new tokens
HODLer Airdrop
Hold GT and get massive airdrops for free
Pre-IPOs
Unlock full access to global stock IPOs
Alpha Points
Trade on-chain assets and earn airdrops
Futures Points
Earn futures points and claim airdrop rewards
Former Arbitrum Technical Ambassador Explains Arbitrum's Component Structure (Part II)
Author: Benben Luo, former Arbitrum technical ambassador, geek web3 contributor
In the previous article, “Former Arbitrum Technical Ambassadors Explain the Component Structure of Arbitrum (Part I)”, we introduced the role of sequencers, validators, SequencerInbox contracts, Rollup Blocks, and non-interactive fraud proofs in the Arbitrum core components, and in today’s article, we will focus on the components of the Arbitrum core components related to cross-chain interaction messaging and censorship-resistant transaction entrances.
Body: In a previous article, we mentioned that the Sequencer Inbox contract specifically receives the batch of transaction packets published by the sequencer on Layer 1. At the same time, we point out that Sequencer Inbox is also known as Fast Box, as opposed to Slow Box Delayed Inbox (Inbox for short). **Below, we will take a closer look at components related to cross-chain interaction messaging, such as Delayed Inbox.
Principles of Cross-Chain Interaction and Bridge
Cross-Chain interaction transactions can be divided into L1 to L2 (deposit) and L2 to L1 (withdrawal). Note that the deposits and withdrawals mentioned here are not necessarily related to asset cross-chain interaction, and can be messages that do not directly attach assets. So these two words only mean two directions of cross-chain interaction related behavior.
Cross-Chain Interaction transaction is more complicated than pure L2 transactions, Cross-Chain Interaction transactions have information swapped in two different systems, L1 and L2.
In addition, what we usually call cross-chain interaction behavior is cross-chain interaction on two unrelated networks with a Cross-Chain Interaction bridge in witness mode, and the security of this Cross-chain Interaction depends on the operator of the Cross-Chain Interaction Bridge, and the theft of Cross-Chain Interaction bridges based on the witness model has occurred frequently in history.
The Cross-Chain Interaction behavior between the Rollup and the ETHMainnet is fundamentally different from the above Cross-Chain Interaction, because the state of Layer 2 is determined by the data recorded on Layer 1, as long as you use the official Rollup Cross-Chain Interaction bridge, it is absolutely safe in terms of operation structure. **
This also highlights the essence of Rollup, it is just from the user’s point of view, like an independent chain, but in fact, the so-called ** “Layer2” is just a quick display window of Rollup open to users, and its real chain structure is still burned on Layer 1. Therefore, we can think of L2 as half a chain, or “a chain created on Layer 1”.
Retryable ticket Retryables
It should be noted that cross-chain interaction is asynchronous and non-atomic, it is impossible to know the result after completing a transaction confirmation like on a chain, and there is no guarantee that something will happen on the other side at a certain point in time. Therefore, Cross-Chain Interaction may fail due to some soft problems, but as long as the right means are used, such as Retryable Ticket, hard problems such as stuck funds will not occur.
**Retryable tickets are the basic tools used when depositing through the official Arbitrum bridge, **ETH and ERC20 deposits are used. Its life cycle is divided into three steps:
**1. Submit the ticket on L1. **Use the createRetryableTicket() method in the Delayed Inbox contract to create a deposit ticket and submit it.
**2. Automatic redemption on L2. **In most cases, the sequencer can automatically redeem the bill for the user, without the need for subsequent manual operation.
**3. L2. **In some marginal cases, such as a sudden spike in gas prices on L2 and insufficient gas prepaid on the note, it will not be automatically redeemed. In this case, it needs to be done manually by the user.
Note that if the automatic redemption fails, you will need to manually redeem the note within 7 days, otherwise either the bill will be deleted (the funds will be permanently lost), or you will need to pay a fee to renew the lease for the preservation of the bill.
In addition, although there is a certain symmetrical similarity between the withdrawal process of the Arbitrum official bridge and the deposit behavior, there is no concept of Retryables, which can be understood from the Rollup protocol itself on the one hand, and some differences on the other hand:
There is no automatic redemption in the withdrawal process, because there is no timer or automation in the EVM, and automatic redemption can be realized on L2, which is achieved with the help of the sequencer, so users on L1 need to manually interact with the Outbox contract to retrieve assets with Claim. There is no problem of overdue bills for withdrawals, as long as the challenge period has passed, it can be claimed at any time.
ERC-20 asset cross-chain interaction gateway
We’re not going to answer all of these questions, because it’s too complicated to expand. These questions are only used to illustrate the complexity of ERC20 cross-chain interaction.
At present, many scaling solutions use allowlist + manual inventory solutions to avoid various complex problems and boundary situations.
Arbitrum uses the Gateway system to solve most of the pain points of ERC20 cross-chain interaction, with the following features:
Let’s take the relatively simple WETH Cross-Chain Interaction as an example to illustrate the necessity of a custom gateway.
WETH is an ERC20 equivalent of ETH. As Ether is the main coin, many complex functions in dApps are not possible, so an ERC20 equivalent is required. Transfer some ETH into the WETH contract, they will be locked in the contract and the same amount of WETH will be generated.
In the same way, it is also possible to burn WETH and take out ETH. **Obviously, the amount of WETH in circulation and the amount of ETH Lock-up Position will always be 1:1. **
If we now cross-chain interaction WETH directly onto L2, we will find some strange problems:
Obviously, this violates the design principles of WETH. **Then when WETH is cross-chain interaction, whether it is a deposit or a withdrawal, it needs to be unwrapped into ETH first, and then crossed to the opposite side, and then wrapped into WETH. This is where the WETH Gateway comes in.
Other Tokens with more complex logic do the same, requiring more complex and well-designed gateways to work properly in a cross-chain interaction environment. Arbitrum’s custom gateway inherits the cross-chain interaction logic of ordinary gateways and allows developers to customize the cross-chain interaction behavior related to the token logic, which can meet most needs.
Delayed Inbox
The counterpart to the SequencerInbox is the Delayed Inbox (Delayed Inbox). Because the fast box is dedicated to receiving the batch of L2 transactions published by the sequencer, all transactions that have not been preprocessed by the sequencer in the L2 network should not appear in the fast box contract.
**The first function of the slow box is to handle the top-up behavior from L1 to L2. **The user makes a deposit through the Slow Box, and the sequencer listens to it and then reflects it on L2, and finally the deposit record will be included in the L2 transaction sequence by the sequencer and submitted to the Sequencer Inbox.
In this example, it is not appropriate for the user to submit the deposit transaction directly to the Sequencer Inbox, because the transaction submitted to the Sequencer Inbox will interfere with the normal transaction ordering of Layer 2, and then affect the work of the sequencer.
The second function of the slow box is to resist censorship. **Transactions submitted directly by users to the Slowbox contract will be collected by the sequencer within 10 minutes. But if the sequencer maliciously ignores your request, the slowbox also has a forced inclusion function:
If the transaction is submitted to the Delayed Inbox, after 24 hours, the transaction in the Slowbox has not been included in the transaction sequence by the sequencer, The user can manually trigger the force inclusion function on Layer 1, and the transaction requests ignored by the sequencer are forcibly grouped into the Fastbox Sequencer Inbox, and then they will be monitored by all Arbitrum One Nodes and will be forcibly included in the Layer 2 transaction sequence.
As we mentioned earlier, the data in the fastbox is the historical data entity of L2. Therefore, in the case of malicious censorship, ** can finally include transaction instructions in the L2 ledger through the slow box, which covers scenarios such as forced withdrawals to escape from Layer 2. **
It can be seen from this that for any direction and level of transactions, the sequencer will not be able to permanently review you in the end.
Several core functions of Slowbox Inbox:
However, it should be noted that the force Inclusion function is actually located in the Slowbox contract, just to make it easier to understand, we will put it here in the Slowbox and explain it together.
Outbox
Outbox is only related to withdrawals, which can be understood as a record and management system for withdrawal behavior:**
Below we will take ETH as an example to fully explain the deposit and withdrawal process. The difference between ERC20 and ERC20 is that it just goes through the Gateway, so I won’t repeat it.
ETH deposit
The user calls the depositETH() function of the Slowbox.
The function will continue to call bridge.enqueueDelayedMessage(), record the message in the bridge contract, and send ETH to the bridge contract. **All ETH deposit funds are kept in the bridge contract, which is equivalent to a deposit Address. **
The sequencer listens to the deposit message in the slow box and reflects the deposit operation to the L2 database, so that users can see the assets they have deposited in the L2 network.
The sequencer will include the deposit record into the batch and submit it to the Express contract on L1.
ETH withdrawals
The user calls the withdrawEth() function of the ArbSys contract on L2 to burn the corresponding amount of ETH on L2.
The sequencer sends the withdrawal request to Quickbox.
**3.The Validator Node creates a new Rollup Block based on the transaction sequence in the Fastbox, which will contain the above withdrawal transactions. **
After the Rollup Block has passed the challenge period and is confirmed, the user can call the Outbox.ute Transaction() function on L1 to prove that the parameters are given by the aforementioned ArbSys contract.
After the Outbox contract confirms that it is correct, the corresponding amount of ETH in the unlocked bridge is sent to the user.
Fast payouts
Withdrawals using the Optimistic Rollup official bridge will result in a waiting period for the challenge period. We can circumvent this problem with private third-party Cross-Chain Interaction bridges:
Forced payouts
force Inclusion() is used to counter sequencer censorship and can be used for any L2 local, L1-to-L2, and L2-to-L1 transactions. The malicious censorship of the sequencer has seriously affected the trading experience, and in most cases we will choose to withdraw and leave L2, so the following is an example of forced withdrawal to introduce the use of forceInclusion.
Recall that in the ETH withdrawal step, only steps 1 and 2 involve sequencer review, so only these two steps need to be changed:
The end user can withdraw in the Outbox, and the rest of the steps are the same as normal withdrawals.
In addition, arbitrum-tutorials also have detailed tutorials on how to use the Arb SDK to guide users on how to use forceInclusion() to conduct L2 local transactions and L2 to L1 transactions.