Initia: Interwoven Stack and Modular Blockchain

Advanced10/13/2024, 7:52:49 PM
This article introduces the Interwoven stack of Initia, which aims to support a modular blockchain ecosystem, particularly enhancing scalability and sovereignty through Optimistic Rollups. Initia provides an L1 platform that collaborates with multiple Minitias, these application-specific rollups can independently manage execution environments, control transaction ordering, and optimize gas fees. Through the OPHost and OPChild modules, as well as OPinit Bots, seamless interaction between L1 and L2 is achieved, ensuring security, flexibility, and efficient asset transfer.
https://gimg.gateimg.com/learn/596560e83cf3c0c39d5e58cecfeb5c376d701a45.jpg

The crypto ecosystem has had to adapt to the new reality — Initia was born into it.

As an industry, we’ve had to accept the fact that a single state machine can’t scale to match the ambitions of crypto. Scaling throughput while keeping the costs low for users and operators, all while rooting for an acceptable level of decentralization, is a battle that’s almost impossible to win with a monolithic approach.

The reality is, the success of purely monolithic chains has become a contrarian opinion. Enter the modular vs. monolithic debate, which took center stage earlier this year. But here’s the kicker: there’s no debate at all. The future isn’t one or the other — it’s a blend of both. A fast, programmable L1, paired with a suite of app-specific rollups that scale execution hand-in-hand with the L1.

The merits of the blended (or as we like to call it, Interwoven) approach becomes apparent when you look at Solana. In the past six months, teams have begun building their own custom “network extensions” that settle on Solana. But wait — wasn’t Solana supposed to handle scale on its own? Isn’t that their entire branding?

You see, rollups are about more than just scaling execution. They’re also about sovereignty — giving builders full control over their execution environment. More TPS, lower gas fees (or maybe none at all), control over tx ordering & processing, and ownership over the entire economic stack of their business to name a few.

At this point, it’s clear: rollups are inevitable, and they’re here to stay.

Initia’s existence is built around this thesis. It’s purpose-built to host a thriving ecosystem of interwoven rollups 🪢, known as Minitias.

The Future is Interwoven

Initia is designed to be the home for thousands of Minitias working together in unison to provide diverse, powerful, and unique applications through a cohesive experience that’s interwoven by design.

So far, two kinds of ecosystems have existed. Ones specifically built for the world of interconnected chains (Cosmos), and the second are the ones who took the bet on rollups post-facto (Ethereum, and now Solano). Each one with their approach has found some degree of success but not without their fallings, which are invaluable learnings to take when building the new model of an L1.

Initia bridges these extremes, it’s an L1 designed to support a network of interconnected L2s that ensure Minitia builders have everything they need to succeed. It’s been built from day one to avoid the messy middle by having opinionated designs and asking the simple question — what do L2s actually want from a hub?

On Initia, rollups simply belong. There’s complete economic alignment between the L1 and L2s through @initiafdn/introducing-vip-5fe1a0177055">Initia VIP, the product suite is damn crisp, and the tech is purpose-built to ensure Minitias have oracles, bridges, liquidity, interoperability, native stables, etc. right out of the gate. The Interwoven Stack makes it super simple for teams to deploy a Minitia with whatever VM they choose — be it EVM, MoveVM, or CosmWasm.

Now, what’s the most important component that enables the rollups on Initia? The Interwoven Stack — an optimistic rollup framework built from scratch for the Cosmos SDK.

Ready to see the magic under the hood? Let’s dive into the framework.

The Interwoven Stack

The Optimistic Rollup framework on Initia is made up of three components that…you guessed it, are pretty interwoven 😛

OPHost, OPChild, and OPinit Bots beautifully come together like three pieces of the puzzle to form a collective that powers each and every Minita.

OPHost and OPChild are Cosmos SDK modules that form the core of the Stack, they’re the parts that live on the chain. Since the OPinit Stack is implemented at the chain level rather than the smart contract level of a specific VM, it allowed us to build support for multiple VMs and give Minitia builders the freedom of choice.

On Initia, rollups are first-class citizens built directly into the chain. This has blessed us with flexibility to fine-tune the implementations and provide a superior experience.

The OPHost module lives on Initia (the L1). It’s responsible for serving as the homebase for all the Minitias that settle on Initia. OPHost’s key tasks include:

  • Managing the optimistic bridge (between the L1 and an L2) and the assets that go through it.
  • Overseeing the finalization of output proposals from the Minitias.
  • Acting as the courtroom for the challenger and the proposer to argue their case.

OPChild, on the other hand, lives on every Minitia. It’s like the heart beat of each rollup, it’s responsible for:

  • Managing rollup operators.
  • Executing messages received from the L1.
  • Updating the oracle price feeds.
  • Managing token withdrawals to the L1.

The OPHost & OPChild together form the Optimistic Bridge for each Minitia. One OPHost on Initia acts as the endpoint of the L1 for multiple OPChild modules across many Minitias.

It’s important to note for rollups, the native bridge does more than message transfers, it serves as the HQ of the rollup on the L1. You see, two different consensus systems are unaware of each other’s state machines, but a rollup’s bridge acts as the source of truth of the rollup on the L1 by submitting state roots or a similar output that can be verified against the rollup’s state to ensure correctness. This is why an L1 is often called the settlement layer.

But, now you may think — “What connects the OPHost and OPChild? Relayers?” Nah, that’s what OPinit Bots do! As an extension of the above, two different consensus systems can’t natively talk to each other without an off-chain process aiding them by acting as the physical link between their isolated state machines.

OPinit Bots are off-chain processes that handle critical actions between Initia and Minitias. There are two different bots — Executor and Challenger. In a nutshell, the two Bots together are responsible for:

  • Executing token transfers.
  • Submitting output proposals to the Initia L1.
  • Submitting the transaction batch to Celestia for data availability (DA).
  • Relaying oracle price feed updates to the Minitias.

In the rest of the article, we’ll dive into how specific features are implemented in The Interwoven Stack and that should give y’all a clearer picture of how all the pieces work together!

Token Transfers on the Optimistic Bridge

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

You know what else is neat? The native bridge between an L1 and a rollup is usually the most secure way to transfer assets between the two. That’s because using the native bridge doesn’t introduce any extra trust assumptions — you’re only trusting the two chains involved.

Before we dive into how the transfers work, let’s address the elephant in the room.

Why not IBC?

Considering the fact that all the chains on The Interwoven Stack are built using the Cosmos SDK — why can’t the native bridge just be an IBC channel?

Well, that’s because IBC transfers are instantaneous in nature and that doesn’t work with the trust assumptions of our protocol. One fine day, a malicious Minitia operator could wake up and decide to maliciously insert transactions that shift the balances of INIT on the L2 and withdraw all INIT on their Minitia back to the L1. We don’t want that, an oopsie like that one would be catastrophic.

Whereas, withdrawals to Initia through the Optimistic Bridge have a 7-day delay during which the Challenger can challenge and cancel the withdrawal in case it’s detected to be malicious.

On Initia we still want to ensure there’s a seamless UX moving assets between Mintia’s and the Initia L1. To enable rapid transfers from L2s we built a secure and custom solution called Minitswap, you can learn more about it here: @initiafdn/minitswap-l2-to-l1-withdrawals-in-seconds-not-days-e6de645879b3">Minitswap — L2 to L1 Withdrawals in Seconds, Not Days.

Token Deposits (L1 → L2)

Depositing tokens from Initia to a Minitia is almost instant. Here’s how it works:

  1. The user submits a deposit transaction on Initia, which locks their tokens on the L1 and triggers a deposit event from the OPHost module.
  2. The Executor OPinit Bot constantly listens to new events on Initia and when it sees a initiate_token_deposit event: \
    2.a — The Executor constructs a corresponding FinalizeTokenDeposit message and submits it to the Minitia.
  3. On receiving the message, Minitia mints the corresponding tokens on the L2 and sends them to the user.

Pretty straightforward eh? Gets the job done without compromising on security!

Token Withdrawal (L2 → L1)

Withdrawals are where things get a little trickier. While depositing from L1 to L2 is simple, the assumption that Minitias can always trust the L1 doesn’t work the other way around.

Here’s why: Initia is secured by a decentralized set of validators with economic stake, but Minitias are often run by a single or a tiny set of operators, that too without economic stake. So, when a Minitia initiates a withdrawal to the L1, it needs to prove it’s not acting maliciously.

Here’s how a withdrawal works:

  1. The user submits a withdrawal transaction on the Minitia, which leads to the OPChild module burning their tokens and emitting the initiate_token_withdrawal event.
  2. Again, the Executor is listening to all the blocks on the L2. It picks up on the event and stores the withdrawal request but doesn’t relay it immediately, the Bot waits for a submission checkpoint.
  3. Once the submission checkpoint is reached, the Executor:
    3.a — Fetches all the withdrawal requests in the interval.
    3.b — Generates a sorted merkle tree of the withdrawals.
    3.c — Creates an L2 output with the merkle root of the tree.
    3.d — Submits the output to the OPHost on the L1.
  4. The withdrawal then enters a withdrawal period, where the Challenger OPinit Bot can challenge and cancel the withdrawal if anything suspicious is detected.
  5. If the withdrawal period passes without any challenges, the user can call finalize_withdrawal on Initia to unlock their tokens.
    5.a — This function takes in the withdrawal request and the proof for it.
    5.b — Verifies the submitted proof.
    5.c — And if all goes well, send the tokens to the user!

Withdrawals take a little while but hey, that’s the trade-off for ensuring security! But, to provide a superior user experience for the Interwoven users, Initia has also built @initiafdn/minitswap-l2-to-l1-withdrawals-in-seconds-not-days-e6de645879b3">Minitswap — which allows for instant withdrawals with pretty decent security guarantees by leveraging IBC and the OPinit Bridge.

Now you know how withdrawals work, but the challenge mechanism is still a blackbox — let’s dive into that next!

What happens when a Minitia lies? 🤥

So, we’ve learned in the previous section that a Minitia can potentially lie. That’s why the withdrawal period exists — to prevent fraudulent behavior from stealing tokens on the OPinit Bridge.

But who’s responsible for stopping a fraudulent withdrawal? That’s the job of the Challenger OPinit Bot.

  1. The Challenger constantly monitors the L2 outputs being submitted to the L1.
  2. On every submission, it fetches the output from Initia and independently calculates the output based on the Minitia’s state.
  3. If the submitted output on Initia and the Challenger’s calculated output don’t match, the Challenger deletes the output proposal by sending the DeleteOutput message. Only the Challenger is allowed to call this function.

State-Sync Rollbacks using Celestia ✨

Aye, but when you delete an invalid proposal doesn’t that mean the rollup’s current state is now invalid? Yes, and that’s why we have a well-designed rollback mechanism.

On a successful challenge, the Minitia node can sync the state from data previously posted to Celestia as all the transaction batches of a rollup are posted to Celestia for DA, which comes in handy in case there’s the need for a rollback.

To ensure the integrity of Minitia’s state and make sure the Executor is not acting maliciously, the two Bots — Executor and Challenger — are designed to be separate entities.

But hold up, doesn’t this give the Challenger way too much power? What if the Challenger acts maliciously and starts deleting valid outputs? Yes.

To prevent this, Initia has a checks-and-balances system handled through the L1 governance.

Both the Challenger and the Proposer (the one submitting the output) can be replaced through a governance proposal if they act maliciously. 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 the L2 node themselves to verify who’s right and who’s wrong. This system ensures that no single entity can censor transactions or disrupt the flow of withdrawals.

The Bells & Whistles 💫

It wouldn’t be a product of Initia’s work if we just settled with what’s the norm without going the extra step.

Initia has made it damn simple to build your own rollup. Now, many of you would know that there’s a lot more that goes into building a rollup than just hosting it. There’s a lot of periphery infrastructure you as a builder need to put together. Like indexers, oracles, bridges, etc.

Guess what? The Interwoven Stack comes pre-packaged with everything you need. 🔥

Skip Connect — The Enshrined Oracle

With Skip, Initia is able to provide fast and up-to-date asset price data to Initia and every Minitia built on The Interwoven Stack.

Connect is an enshrined oracle sidecar service run by the Initia validators to push price updates on-chain. The implementation leverages two new features introduced in Cosmos SDK version 0.50: ABCI++ and Vote Extensions which let the validators themselves submit arbitrary data which is then stored on-chain to eliminate the possibility of price updates being censored by a malicious party by filling up the blocks with spam.

Once the price update is on-chain, developers can query it either through the CLI, the API, or the smart contract level.

But that’s not it. Connect’s prices are relayed to each Minitia on The Interwoven Stack ensuring they have easy access to fresh prices out of the box on Day 1.

This way, the Minitia is not burdened with running the necessary infrastructure and they also don’t need to find a third-party oracle provider, strike a deal with them, and spend resources on the integration. It’s all handled for them!

Cross-Chain Contract Calls

To be truly interwoven, there has to be secure and efficient ways of communicating across chains on Initia. There are several ways to do so at the developer’s disposal and one of them is through bridge hooks on the Optimistic Bridge. Bridge Hooks are similar to IBC Hooks in functionality, which are used to allow token transfers to initiate contract calls. OPinit Bridge Hooks are used to initiate contract calls accompanied with transfer of assets bridged through the OPinit Bridge.

The Bridge Hooks on the OPHost update the bridge’s metadata and the Hooks on the OPChild allow arbitrary execution of transactions on FinalizeTokenDeposit.

We’ve built it in a way where it supports multiple VMs, so be it EVM, MoveVM, or CosmWasm, the Bridge Hooks can execute arbitrary transactions based on the data field in the message.

For example, This is the data format for EVM chains

Enshrined Indexers

Minitias also come with a built-in indexer that automatically indexes and stores all the relevant data on the chain. The data is then exposed through a REST API that can be used to query historical data.

Tokens by account, NFT info, txs by account, you name it. It’s all built in already.

Indexing is one of the biggest pain points when it comes to building apps on-chain and this definitely does quite a lot of heavy lifting! Running your own indexer can be both costly and cumbersome. With the enshrined indexer, developers can show token balances, NFTs, transaction history, and much more, without having to run their own indexer or getting a 3rd party indexer to support.

This Enshrined Indexer also enables out-of-the-box support for Initia Scan — Initia’s blockexplorer for the L1 and each L2.

Conclusion

Well, it’s been a blast diving into The Interwoven Stack. It’s a beautifully designed piece of technology that powers Initia’s Interwoven vision. By building The Interwoven Stack as Cosmos SDK modules, Initia has re-purposed the SDK into a stack for building optimistic rollups, while still retaining all the benefits of the Cosmos SDK — which is pretty kick-ass.

There’s so much more to The Interwoven Stack that we haven’t explored today, I highly encourage you to look at the codebase, and the bots codebase to understand it in more depth.

When all is said and done, one truth remains, Initia is where rollups truly belong. From the ground up, Initia has been built for Minitias to thrive. The Interwoven Ecosystem has already sparked innovation with Minitias like Blackwing, Contro, MilkyWay, Inertia — all of them are novel app-specific rollups that are going to be live and available to use from day one! All of them, enabled by The Interwoven Stack.

Thank you to Manan, Zon, and Sawit for contributing to this article.

Disclaimer:

  1. This article is reprinted from [medium], All copyrights belong to the original author [Initia]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.

Initia: Interwoven Stack and Modular Blockchain

Advanced10/13/2024, 7:52:49 PM
This article introduces the Interwoven stack of Initia, which aims to support a modular blockchain ecosystem, particularly enhancing scalability and sovereignty through Optimistic Rollups. Initia provides an L1 platform that collaborates with multiple Minitias, these application-specific rollups can independently manage execution environments, control transaction ordering, and optimize gas fees. Through the OPHost and OPChild modules, as well as OPinit Bots, seamless interaction between L1 and L2 is achieved, ensuring security, flexibility, and efficient asset transfer.

The crypto ecosystem has had to adapt to the new reality — Initia was born into it.

As an industry, we’ve had to accept the fact that a single state machine can’t scale to match the ambitions of crypto. Scaling throughput while keeping the costs low for users and operators, all while rooting for an acceptable level of decentralization, is a battle that’s almost impossible to win with a monolithic approach.

The reality is, the success of purely monolithic chains has become a contrarian opinion. Enter the modular vs. monolithic debate, which took center stage earlier this year. But here’s the kicker: there’s no debate at all. The future isn’t one or the other — it’s a blend of both. A fast, programmable L1, paired with a suite of app-specific rollups that scale execution hand-in-hand with the L1.

The merits of the blended (or as we like to call it, Interwoven) approach becomes apparent when you look at Solana. In the past six months, teams have begun building their own custom “network extensions” that settle on Solana. But wait — wasn’t Solana supposed to handle scale on its own? Isn’t that their entire branding?

You see, rollups are about more than just scaling execution. They’re also about sovereignty — giving builders full control over their execution environment. More TPS, lower gas fees (or maybe none at all), control over tx ordering & processing, and ownership over the entire economic stack of their business to name a few.

At this point, it’s clear: rollups are inevitable, and they’re here to stay.

Initia’s existence is built around this thesis. It’s purpose-built to host a thriving ecosystem of interwoven rollups 🪢, known as Minitias.

The Future is Interwoven

Initia is designed to be the home for thousands of Minitias working together in unison to provide diverse, powerful, and unique applications through a cohesive experience that’s interwoven by design.

So far, two kinds of ecosystems have existed. Ones specifically built for the world of interconnected chains (Cosmos), and the second are the ones who took the bet on rollups post-facto (Ethereum, and now Solano). Each one with their approach has found some degree of success but not without their fallings, which are invaluable learnings to take when building the new model of an L1.

Initia bridges these extremes, it’s an L1 designed to support a network of interconnected L2s that ensure Minitia builders have everything they need to succeed. It’s been built from day one to avoid the messy middle by having opinionated designs and asking the simple question — what do L2s actually want from a hub?

On Initia, rollups simply belong. There’s complete economic alignment between the L1 and L2s through @initiafdn/introducing-vip-5fe1a0177055">Initia VIP, the product suite is damn crisp, and the tech is purpose-built to ensure Minitias have oracles, bridges, liquidity, interoperability, native stables, etc. right out of the gate. The Interwoven Stack makes it super simple for teams to deploy a Minitia with whatever VM they choose — be it EVM, MoveVM, or CosmWasm.

Now, what’s the most important component that enables the rollups on Initia? The Interwoven Stack — an optimistic rollup framework built from scratch for the Cosmos SDK.

Ready to see the magic under the hood? Let’s dive into the framework.

The Interwoven Stack

The Optimistic Rollup framework on Initia is made up of three components that…you guessed it, are pretty interwoven 😛

OPHost, OPChild, and OPinit Bots beautifully come together like three pieces of the puzzle to form a collective that powers each and every Minita.

OPHost and OPChild are Cosmos SDK modules that form the core of the Stack, they’re the parts that live on the chain. Since the OPinit Stack is implemented at the chain level rather than the smart contract level of a specific VM, it allowed us to build support for multiple VMs and give Minitia builders the freedom of choice.

On Initia, rollups are first-class citizens built directly into the chain. This has blessed us with flexibility to fine-tune the implementations and provide a superior experience.

The OPHost module lives on Initia (the L1). It’s responsible for serving as the homebase for all the Minitias that settle on Initia. OPHost’s key tasks include:

  • Managing the optimistic bridge (between the L1 and an L2) and the assets that go through it.
  • Overseeing the finalization of output proposals from the Minitias.
  • Acting as the courtroom for the challenger and the proposer to argue their case.

OPChild, on the other hand, lives on every Minitia. It’s like the heart beat of each rollup, it’s responsible for:

  • Managing rollup operators.
  • Executing messages received from the L1.
  • Updating the oracle price feeds.
  • Managing token withdrawals to the L1.

The OPHost & OPChild together form the Optimistic Bridge for each Minitia. One OPHost on Initia acts as the endpoint of the L1 for multiple OPChild modules across many Minitias.

It’s important to note for rollups, the native bridge does more than message transfers, it serves as the HQ of the rollup on the L1. You see, two different consensus systems are unaware of each other’s state machines, but a rollup’s bridge acts as the source of truth of the rollup on the L1 by submitting state roots or a similar output that can be verified against the rollup’s state to ensure correctness. This is why an L1 is often called the settlement layer.

But, now you may think — “What connects the OPHost and OPChild? Relayers?” Nah, that’s what OPinit Bots do! As an extension of the above, two different consensus systems can’t natively talk to each other without an off-chain process aiding them by acting as the physical link between their isolated state machines.

OPinit Bots are off-chain processes that handle critical actions between Initia and Minitias. There are two different bots — Executor and Challenger. In a nutshell, the two Bots together are responsible for:

  • Executing token transfers.
  • Submitting output proposals to the Initia L1.
  • Submitting the transaction batch to Celestia for data availability (DA).
  • Relaying oracle price feed updates to the Minitias.

In the rest of the article, we’ll dive into how specific features are implemented in The Interwoven Stack and that should give y’all a clearer picture of how all the pieces work together!

Token Transfers on the Optimistic Bridge

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

You know what else is neat? The native bridge between an L1 and a rollup is usually the most secure way to transfer assets between the two. That’s because using the native bridge doesn’t introduce any extra trust assumptions — you’re only trusting the two chains involved.

Before we dive into how the transfers work, let’s address the elephant in the room.

Why not IBC?

Considering the fact that all the chains on The Interwoven Stack are built using the Cosmos SDK — why can’t the native bridge just be an IBC channel?

Well, that’s because IBC transfers are instantaneous in nature and that doesn’t work with the trust assumptions of our protocol. One fine day, a malicious Minitia operator could wake up and decide to maliciously insert transactions that shift the balances of INIT on the L2 and withdraw all INIT on their Minitia back to the L1. We don’t want that, an oopsie like that one would be catastrophic.

Whereas, withdrawals to Initia through the Optimistic Bridge have a 7-day delay during which the Challenger can challenge and cancel the withdrawal in case it’s detected to be malicious.

On Initia we still want to ensure there’s a seamless UX moving assets between Mintia’s and the Initia L1. To enable rapid transfers from L2s we built a secure and custom solution called Minitswap, you can learn more about it here: @initiafdn/minitswap-l2-to-l1-withdrawals-in-seconds-not-days-e6de645879b3">Minitswap — L2 to L1 Withdrawals in Seconds, Not Days.

Token Deposits (L1 → L2)

Depositing tokens from Initia to a Minitia is almost instant. Here’s how it works:

  1. The user submits a deposit transaction on Initia, which locks their tokens on the L1 and triggers a deposit event from the OPHost module.
  2. The Executor OPinit Bot constantly listens to new events on Initia and when it sees a initiate_token_deposit event: \
    2.a — The Executor constructs a corresponding FinalizeTokenDeposit message and submits it to the Minitia.
  3. On receiving the message, Minitia mints the corresponding tokens on the L2 and sends them to the user.

Pretty straightforward eh? Gets the job done without compromising on security!

Token Withdrawal (L2 → L1)

Withdrawals are where things get a little trickier. While depositing from L1 to L2 is simple, the assumption that Minitias can always trust the L1 doesn’t work the other way around.

Here’s why: Initia is secured by a decentralized set of validators with economic stake, but Minitias are often run by a single or a tiny set of operators, that too without economic stake. So, when a Minitia initiates a withdrawal to the L1, it needs to prove it’s not acting maliciously.

Here’s how a withdrawal works:

  1. The user submits a withdrawal transaction on the Minitia, which leads to the OPChild module burning their tokens and emitting the initiate_token_withdrawal event.
  2. Again, the Executor is listening to all the blocks on the L2. It picks up on the event and stores the withdrawal request but doesn’t relay it immediately, the Bot waits for a submission checkpoint.
  3. Once the submission checkpoint is reached, the Executor:
    3.a — Fetches all the withdrawal requests in the interval.
    3.b — Generates a sorted merkle tree of the withdrawals.
    3.c — Creates an L2 output with the merkle root of the tree.
    3.d — Submits the output to the OPHost on the L1.
  4. The withdrawal then enters a withdrawal period, where the Challenger OPinit Bot can challenge and cancel the withdrawal if anything suspicious is detected.
  5. If the withdrawal period passes without any challenges, the user can call finalize_withdrawal on Initia to unlock their tokens.
    5.a — This function takes in the withdrawal request and the proof for it.
    5.b — Verifies the submitted proof.
    5.c — And if all goes well, send the tokens to the user!

Withdrawals take a little while but hey, that’s the trade-off for ensuring security! But, to provide a superior user experience for the Interwoven users, Initia has also built @initiafdn/minitswap-l2-to-l1-withdrawals-in-seconds-not-days-e6de645879b3">Minitswap — which allows for instant withdrawals with pretty decent security guarantees by leveraging IBC and the OPinit Bridge.

Now you know how withdrawals work, but the challenge mechanism is still a blackbox — let’s dive into that next!

What happens when a Minitia lies? 🤥

So, we’ve learned in the previous section that a Minitia can potentially lie. That’s why the withdrawal period exists — to prevent fraudulent behavior from stealing tokens on the OPinit Bridge.

But who’s responsible for stopping a fraudulent withdrawal? That’s the job of the Challenger OPinit Bot.

  1. The Challenger constantly monitors the L2 outputs being submitted to the L1.
  2. On every submission, it fetches the output from Initia and independently calculates the output based on the Minitia’s state.
  3. If the submitted output on Initia and the Challenger’s calculated output don’t match, the Challenger deletes the output proposal by sending the DeleteOutput message. Only the Challenger is allowed to call this function.

State-Sync Rollbacks using Celestia ✨

Aye, but when you delete an invalid proposal doesn’t that mean the rollup’s current state is now invalid? Yes, and that’s why we have a well-designed rollback mechanism.

On a successful challenge, the Minitia node can sync the state from data previously posted to Celestia as all the transaction batches of a rollup are posted to Celestia for DA, which comes in handy in case there’s the need for a rollback.

To ensure the integrity of Minitia’s state and make sure the Executor is not acting maliciously, the two Bots — Executor and Challenger — are designed to be separate entities.

But hold up, doesn’t this give the Challenger way too much power? What if the Challenger acts maliciously and starts deleting valid outputs? Yes.

To prevent this, Initia has a checks-and-balances system handled through the L1 governance.

Both the Challenger and the Proposer (the one submitting the output) can be replaced through a governance proposal if they act maliciously. 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 the L2 node themselves to verify who’s right and who’s wrong. This system ensures that no single entity can censor transactions or disrupt the flow of withdrawals.

The Bells & Whistles 💫

It wouldn’t be a product of Initia’s work if we just settled with what’s the norm without going the extra step.

Initia has made it damn simple to build your own rollup. Now, many of you would know that there’s a lot more that goes into building a rollup than just hosting it. There’s a lot of periphery infrastructure you as a builder need to put together. Like indexers, oracles, bridges, etc.

Guess what? The Interwoven Stack comes pre-packaged with everything you need. 🔥

Skip Connect — The Enshrined Oracle

With Skip, Initia is able to provide fast and up-to-date asset price data to Initia and every Minitia built on The Interwoven Stack.

Connect is an enshrined oracle sidecar service run by the Initia validators to push price updates on-chain. The implementation leverages two new features introduced in Cosmos SDK version 0.50: ABCI++ and Vote Extensions which let the validators themselves submit arbitrary data which is then stored on-chain to eliminate the possibility of price updates being censored by a malicious party by filling up the blocks with spam.

Once the price update is on-chain, developers can query it either through the CLI, the API, or the smart contract level.

But that’s not it. Connect’s prices are relayed to each Minitia on The Interwoven Stack ensuring they have easy access to fresh prices out of the box on Day 1.

This way, the Minitia is not burdened with running the necessary infrastructure and they also don’t need to find a third-party oracle provider, strike a deal with them, and spend resources on the integration. It’s all handled for them!

Cross-Chain Contract Calls

To be truly interwoven, there has to be secure and efficient ways of communicating across chains on Initia. There are several ways to do so at the developer’s disposal and one of them is through bridge hooks on the Optimistic Bridge. Bridge Hooks are similar to IBC Hooks in functionality, which are used to allow token transfers to initiate contract calls. OPinit Bridge Hooks are used to initiate contract calls accompanied with transfer of assets bridged through the OPinit Bridge.

The Bridge Hooks on the OPHost update the bridge’s metadata and the Hooks on the OPChild allow arbitrary execution of transactions on FinalizeTokenDeposit.

We’ve built it in a way where it supports multiple VMs, so be it EVM, MoveVM, or CosmWasm, the Bridge Hooks can execute arbitrary transactions based on the data field in the message.

For example, This is the data format for EVM chains

Enshrined Indexers

Minitias also come with a built-in indexer that automatically indexes and stores all the relevant data on the chain. The data is then exposed through a REST API that can be used to query historical data.

Tokens by account, NFT info, txs by account, you name it. It’s all built in already.

Indexing is one of the biggest pain points when it comes to building apps on-chain and this definitely does quite a lot of heavy lifting! Running your own indexer can be both costly and cumbersome. With the enshrined indexer, developers can show token balances, NFTs, transaction history, and much more, without having to run their own indexer or getting a 3rd party indexer to support.

This Enshrined Indexer also enables out-of-the-box support for Initia Scan — Initia’s blockexplorer for the L1 and each L2.

Conclusion

Well, it’s been a blast diving into The Interwoven Stack. It’s a beautifully designed piece of technology that powers Initia’s Interwoven vision. By building The Interwoven Stack as Cosmos SDK modules, Initia has re-purposed the SDK into a stack for building optimistic rollups, while still retaining all the benefits of the Cosmos SDK — which is pretty kick-ass.

There’s so much more to The Interwoven Stack that we haven’t explored today, I highly encourage you to look at the codebase, and the bots codebase to understand it in more depth.

When all is said and done, one truth remains, Initia is where rollups truly belong. From the ground up, Initia has been built for Minitias to thrive. The Interwoven Ecosystem has already sparked innovation with Minitias like Blackwing, Contro, MilkyWay, Inertia — all of them are novel app-specific rollups that are going to be live and available to use from day one! All of them, enabled by The Interwoven Stack.

Thank you to Manan, Zon, and Sawit for contributing to this article.

Disclaimer:

  1. This article is reprinted from [medium], All copyrights belong to the original author [Initia]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
Start Now
Sign up and get a
$100
Voucher!