Interwoven Stack:Optimistic rollup模块

avatar
ODAILY
10-09
This article is machine translated
Show original

The crypto ecosystem has had to adapt to a new reality - Initia was born in this context.

As an industry, we have had to accept the fact that a single state machine cannot scale to match the ambitions of crypto. Increasing throughput while maintaining low costs for users and operators, while maintaining an acceptable level of decentralization, is a battle that is almost impossible to win with a single method.

The reality is that the success of pure monolithic chains has become a counterpoint. Earlier this year, the debate between modularity and monolithic chains became a focal point. But most importantly: there was no debate. The future is not one or the other, but a fusion of the two. A fast, programmable L1, coupled with a set of application-specific rollups, which can scale execution together with the L1.

For example, the Solana network, the advantages of a hybrid (or what we like to call "Interwoven") approach become evident. Over the past six months, the team has begun building their own custom "network extensions" and successfully deploying them on Solana. But wait, isn't Solana supposed to handle scaling itself? Isn't that their whole brand?

You see, rollups are not just about scaling execution, they are about sovereignty - allowing builders to have full control over their execution environment. Higher TPS, lower Gas fees (or zero Gas), control over tx ordering and processing, and ownership of the entire economic stack of their business, and so on.

It is clear that rollups are inevitable and will be here to stay.

Initia's existence is built around this thesis. Its purpose is to host a thriving Interwoven rollup ecosystem, dubbed Minitia.

The Future Belongs to Interwoven

Initia provides a diverse, powerful and unique set of applications through the design of the Interwoven cohesion experience.

So far, there have been two ecosystems. One tailored specifically for the interoperable blockchain world (Cosmos), and the other already existing, betting on rollups (Ethereum, now Solana). Each approach has achieved a certain degree of success, but not without failures, which are valuable lessons to draw from when building new L1 models.

Initia connects these two ecosystems, it is an L1 designed to support interconnected L2 networks, ensuring that Minitia builders have everything they need to succeed. Initially, Initia sticks to its guns and raises questions to avoid the messy middle ground - what exactly do L2s want to get from a hub?

On Initia, rollups are a given. Through Initia VIP, there is complete economic coordination between L1 and L2, a clear product suite, and technology specifically designed to ensure that Minitia has oracles, bridges, liquidity, interoperability, and native stability from the start. The Interwoven Stack allows teams to easily deploy Minitia using any VM they choose (whether EVM, MoveVM or CosmWasm).

Now, what are the key components for realizing rollups on Initia? The Interwoven Stack - an Optimistic rollup framework built from the ground up for the Cosmos SDK. Let's dive into this framework.

The Interwoven Stack

The Optimistic rollup framework on Initia consists of three components: OPHost, OPChild and OPinit Bots; the three puzzle pieces come together to form a whole, providing support for Minitia.

OPHost and OPChild are Cosmos SDK modules that form the core of the Stack, residing on-chain. Since the OPinit Stack is implemented at the chain level rather than at the specific VM smart contract level, it allows builders to build support for multiple VMs and gives Minitia builders the freedom to choose.

On Initia, rollups are first-class citizens directly embedded within the chain, allowing us to flexibly fine-tune the implementation and provide a better experience.

The OPHost module resides on Initia (L1). It is responsible for providing infrastructure services for all Minitias on Initia, its main tasks include:

Managing the Optimistic Bridge (between L1 and L2) and its assets;

Overseeing the finalization of Minitia output proposals;

Handling challenger and proposer dispute cases.

On the other hand, OPChild resides on each Minitia, like the heartbeat of each rollup, OPChild is responsible for:

Managing the rollup operators;

Executing messages received from L1;

Updating oracle price information;

Token withdrawals to L1.

OPHost and OPChild together form the Optimistic Bridge for each Minitia. An OPHost on Initia serves as the L1 endpoint for multiple OPChild modules on different Minitias.

It's important to note that for rollups, the native bridge's role is not just message transmission, it also serves as the settlement layer for the rollup on L1. The two different consensus systems are unaware of each other's state machines, but the rollup's bridge acts as the authoritative source for the rollup on L1 by submitting state roots or similar outputs that can be verified against the rollup's state to ensure correctness. This is why L1 is often referred to as the settlement layer.

Now you might be wondering, "What connects the OPHost and OPChild?" Relayers? No, it's the OPinit Bots, as an extension of the above, if the two different consensus systems do not have an off-chain process as a physical link between their independent state machines, they cannot communicate locally.

OPinit Bots are the off-chain processes that handle key operations between Initia and Minitias. There are two different bots: Executors and Challengers. In short, these two bots are jointly responsible for:

Executing token transfers;

Submitting output proposals to the Initia L1;

Submitting batches of transactions to Celestia to achieve data availability (DA);

Forwarding oracle price feedback updates to Minitias.

In the rest of this article, we will dive deeper into how specific functionality is implemented within the Interwoven Stack, which should give you a clearer understanding of how all the pieces work together.

Token Bridging on the Optimistic Bridge

One of the most important aspects of a rollup is that it inherits the security of the L1 it depends on.

The native bridge between L1 and rollup is usually the safest way to transfer assets between the two. This is because using the native bridge does not introduce any additional trust assumptions, you only need to trust the two chains involved.

Before we dive into how cross-bridging is done, let's address an issue that cannot be ignored.

Why not IBC?

So, since all the chains on the Interwoven Stack are built using the Cosmos SDK, why can't the native bridge use the IBC protocol?

Because IBC transfers are essentially instant, which goes against our trust assumptions. One day, a malicious Minitia operator could wake up and decide to maliciously insert a transaction, transferring the INIT balance on L2 and withdrawing all the INIT on Minitia back to L1. We don't want this to happen, as this mistake would be catastrophic.

However, withdrawing to Initia through the Optimistic Bridge has a 7-day delay, during which time, if the withdrawal is detected to be malicious, a challenger can raise a dispute and cancel the withdrawal.

On Initia, we still want to ensure a seamless user experience (asset transfer) between Minitia and Initia L1. To achieve fast withdrawals from L2 to L1, we have built a secure custom solution called Minitswap, more details can be found here: (Minitswap - Withdrawals from L2 to L1 in seconds, not days)

Token Deposits (L1 to L2)

Depositing tokens from Initia to Minitia is almost instant. The deposit works as follows:

1. The user submits a deposit transaction on Initia, which will lock their tokens on L1 and trigger a deposit event from the OPHost module;

2. The Executor OPinit Bot constantly monitors for new events on Initia, when it sees an initial_token_deposit event:

2.a - The Executor constructs the corresponding FinalizeTokenDeposit message and submits it to Minitia.

3. Upon receiving the message, Minitia will mint the corresponding tokens on L2 and send them to the user.

Efficient and without compromising security!

Token Withdrawals (L2 to L1)

Withdrawing tokens is a bit more complex, while deposits from L1 to L2 are simple, the assumption that "Minitia can always trust L1" does not apply in the other direction.

The reason is as follows: Initia is protected by a group of decentralized validators with economic interests, but Minitia is usually operated by a single or a small group of operators who have no economic interests. So when Minitia initiates a withdrawal to L1, it needs to prove that it is not a malicious act.

The withdrawal process is as follows:

The user submits a withdrawal transaction on Minitia, causing the OPChild module to destroy their tokens and initiate an initial_token_withdrawal event;

The executor monitors all blocks on L2, it receives the event and stores the withdrawal request, but does not immediately forward it, the Bot will wait for the submission checkpoint.

Once the submission checkpoint is reached, the executor:

3.a—Obtains all withdrawal requests within the interval;

3.b—Generates a sorted Merkle tree of the withdrawals;

3.c—Creates an L2 output using the Merkle root of this tree;

3.d—Submits the output to the OPHost on L1;

Then the withdrawal will enter the withdrawal period, and if any suspicious activity is detected, the challenger OPinit Bot can raise an objection and cancel the withdrawal.

If the withdrawal period passes without any challenge, the user can call finalize_withdrawal on Initia to unlock their tokens.

5.a—This function accepts the withdrawal request and its proof;

5.b—Verifies the submitted proof;

5.c—If everything is in order, it will send the tokens to the user.

To ensure security, withdrawals take some time. However, to provide a better user experience for Interwoven's users, Initia has also built Minitswap - by leveraging IBC and the OPinit Bridge, it allows for instant withdrawals and provides a considerable degree of security guarantees.

Although we now know how the withdrawal process works, the challenge mechanism is still a black box, so let's dive deeper into it.

What happens if Minitia cheats?

As we learned in the previous section, Minitia may lie and cheat, and the withdrawal period exists to prevent fraudulent behavior from stealing tokens on the OPinit Bridge.

But who is responsible for preventing fraudulent withdrawals? This is the job of the challenger OPinit Bot.

1.The challenger monitors in real-time the L2 outputs being submitted to L1;

2.On each submission, it fetches the output from Initia and independently calculates the output based on Minitia's state;

3.If the output submitted on Initia does not match the output calculated by the challenger, the challenger will delete the output proposal by sending a DeleteOutput instruction, only the challenger and the allowed callers can invoke this function.

Using Celestia for Rollback State Synchronization

When you delete an invalid proposal, it means the current state of the rollup is now invalid, which is why we have a Rollback mechanism.

After a successful challenge, Minitia nodes can synchronize the state based on the data previously published to Celestia, as all transaction batches of the rollup have been published to Celestia for Data Availability, making Rollback very convenient.

To ensure the integrity of Minitia's state and ensure the executor is not acting maliciously, the two Bots (executor and challenger) are designed as independent entities.

To address the concern of the challenger having too much power, including malicious actions such as deleting valid outputs, Initia handles the system of checks and balances through L1 governance.

If the challenger and the proposer (the one submitting the output) act maliciously, they can be replaced through governance proposals. For the challenger, malicious behavior means deleting valid outputs. For the proposer, it means submitting invalid outputs.

When a proposal is created, Initia's L1 validators vote on it by running an L2 node to verify who is right and who is wrong. This system ensures that no single entity can censor transactions or disrupt the withdrawal process.

More Reasonable Designs

If we were to be satisfied with the status quo and not take additional measures, this would not be the achievement that Initia's journey should have.

Initia makes it very easy to build your own rollup. Now, in addition to hosting, there are many other things to do when establishing a rollup. As a creator, you also need to build a lot of infrastructure, such as indexers, oracles, bridges, etc. The Interwoven Stack has done all of this.

Skip Connect—The Sacred Oracle

Through Skip, Initia is able to provide fast and instant asset price data for Initia and every Minitia built on the Interwoven Stack.

Connect is an oracle sidecar service run by Initia validators to push price updates on-chain. This execution process leverages two new features introduced in Cosmos SDK version 0.50: ABCI++ and Vote Extensions, which allow validators to submit arbitrary data themselves and then store it on-chain, eliminating the possibility of price updates being censored by malicious parties flooding the blocks with spam.

Once the price updates are on-chain, developers can query them through the CLI, API, or smart contract level.

But that's not all. The prices from Connect are propagated to every Minitia on the Interwoven Stack, ensuring they have easy access to the latest prices from day one.

This way, Minitias don't have to bear the burden of running the necessary infrastructure, nor do they have to find third-party oracle providers, negotiate with them, and invest resources in integration, it's all handled for them.

Cross-Chain Contract Calls

To truly realize the Interwoven Stack, Initia must have a secure and efficient cross-chain communication mechanism. There are several ways to achieve this, one of which is through Bridge hooks on the Optimistic Bridge. Bridge hooks are functionally similar to IBC Hooks, used to allow token transfers to trigger contract calls. The OPinit Bridge Hooks are used to trigger contract calls while transferring assets through the OPinit bridge.

The Hooks on the OPHost update the bridge metadata, and the Hooks on the OPChild allow arbitrary transactions to be executed on FinalizeTokenDeposit.

We've built it in a way that supports multiple virtual machines, so whether it's EVM, MoveVM, or CosmWasm, the Bridge Hooks can execute arbitrary transactions based on the data fields in the message.

For example: Data format for an EVM chain

The Sacred Indexer

Minitia also comes with a built-in indexer that automatically indexes and stores all relevant on-chain data. It then exposes the data through a REST API that can be used to query historical data.

Categorized by account, token, Non-Fungible Token information, transaction information, and more, all of this is built-in.

Indexing is one of the biggest pain points when building on-chain applications, and it's really a lot of hard work to run your own indexer, which is both expensive and cumbersome. With the Enshaled indexer, developers can display token balances, Non-Fungible Tokens, transaction histories, and more without having to run their own indexer or rely on third-party indexers.

The Enshrined indexer also supports Initia Scan (the block explorer provided by Initia for L1 and each L2).

Conclusion

The Interwoven Stack is a meticulously designed technology that supports the Initia Interwoven vision. By building the Interwoven Stack as Cosmos SDK modules, Initia has repurposed the SDK to build the stack for Optimistic rollup, while still retaining all the advantages of the Cosmos SDK.

There is much more to explore about The Interwoven Stack, and I recommend looking at the codebase, as well as the Bot codebase, to gain a deeper understanding.

In summary, the fact is that Initia is the true home of Rollup. From the beginning, Initia was built for the development of Minitia. Its ecosystem has already sparked innovative applications like Blackwing, control, MilkyWay, Inertia - these are application-specific rollups, and they will be available from the first day Initia goes live, all of this made possible by the Interwoven Stack.

Source
Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
Like
Add to Favorites
Comments