Initia 백서

Initia

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 38쪽 중 24쪽

nitia.xyz/home/core-concepts/initia-and-rollups/high-level-architecture Initia's architecture is composed of three main components: * **Initia L1**: Initia L1 is the base layer and central liquidity hub for all Interwoven Rollups. * **Interwoven Rollups**: An ecosystem of blockchain rollups built atop Initia L1. * **Interwoven Stack**: Initia's framework for easily and painlessly building rollups and applications. <Frame type="glass"> <img /> </Frame> ## Components ### Initia L1 Initia L1 is a Layer 1 blockchain designed to serve as the coordination layer and central hub for all Initia rollups. This layer provides essential services to rollups, including: * Network Security * Governance * Liquidity Solutions * Bridging and Interoperability ### Interwoven Rollups Interwoven Rollups are an ecosystem of Layer 2 blockchains built atop Initia L1, offering a scalable, customizable, and secure infrastructure for any application. Developers have the flexibility to deploy and customize their own rollup, tailoring various aspects such as: * Smart Contract Virtual Machine * Gas Tokens * Other Customizable Features ### The Interwoven Stack The [Interwoven Stack](/home/core-concepts/interwoven-stack) is Initia's framework for building rollups and applications. It offers a seamless, integrated experience for developers. The Interwoven Stack aims to simplify the process of building and operating blockchain applications by providing native, out-of-the-box solutions for common tasks. All the tools and features that appchain developers typically need are built directly into the core Interwoven Stack, making them accessible from day one. By reducing choice overload, Initia minimizes fragmentation and allows teams to concentrate on creating the best applications. # Initia L1 Source: https://docs.initia.xyz/home/core-concepts/initia-and-rollups/initia-l1 ## Overview Initia L1 is a custom-built Layer 1 blockchain that serves as the central coordination layer for all Interwoven Rollups. The L1 is built on the [Cosmos SDK](https://docs.cosmos.network) and is responsible for: 1. **Security**: Rollups leverage Initia L1's security for various purposes including token bridging, state commitments, and fraud proofs. 2. **Liquidity**: The [InitiaDEX](/home/core-concepts/initiadex) on L1 acts as a central liquidity hub for the ecosystem, providing a seamless experience for token liquidity, cross-rollup bridging, and swaps. 3. **Interoperability**: L1 functions as a central hub and router for rollups, enabling seamless communication and state transitions both between rollups and with the broader blockchain ecosystem. 4. **Incentives**: L1 powers various incentive schemes including the [Vested Interest Program (VIP)](/home/core-concepts/vip/introduction) and the [Enshrined Liquidity](/home/core-concepts/enshrined-liquidity/introduction). # Introduction Source: https://docs.initia.xyz/home/core-concepts/initia-and-rollups/rollups/introduction Interwoven Rollups are Layer 2 rollups built using Initia's [Interwoven Stack](/home/core-concepts/interwoven-stack/introduction). These rollups are scalable, highly interoperable, and fully customizable. * **Virtual Machines**: Rollup teams can choose among EVM, Move, or Wasm as the virtual machine for their rollup to best suit their application and needs. * **Gas Tokens & Fees**: Each rollup can choose its own gas token and fee structure. This can include INIT, stablecoins, their native token, or even multiple tokens. * **Transaction Ordering**: If needed, rollups can also implement their own transaction ordering mechanism. # EVM Compatibility Source: https://docs.initia.xyz/home/core-concepts/initia-and-rollups/rollups/vms/minievm/evm-compatibility-and-changes ## Compatibility The MiniEVM framework is compatible with all standard EVM developer workflows, tooling, and libraries that developers are already familiar with. This includes popular tools like [Foundry](https://github.com/foundry-rs/foundry), [Hardhat](https://hardhat.org/), and [Remix IDE](https://remix.ethereum.org/). However, there are minor differences in the way the MiniEVM operates that may require some adjustments to your existing development workflows. ## Changes ### General **EIP-1559 Transactions** MiniEVM currently does not support EIP-1559 transactions. This means that when using tools like Foundry to deploy or interact with contracts, or to generally send transactions, you will need to use the legacy transaction type. ### Cosmos SDK Integrations #### Token Representation By default, any new Cosmos coins created on the chain, whether they are fee denomination tokens, tokens minted via IBC, or other tokens created at genesis will also have an ERC20 representation on the MiniEVM. This allows developers and users to interact with these tokens using both the Cosmos Coin interface and messages, as well as the EVM ERC20 interface. #### Fee Tokens While the Cosmos SDK and rollup design supports multiple fee denominations on a single network, the MiniEVM's EVM module uses a single fee token denomination for all transactions. This denomination must be one of those set on the Cosmos side. Once set, the EVM fee denomination effectively becomes the equivalent of native tokens (e.g. ETH) on other EVM networks. This denomination will then be used for transaction fees sent via the EVM's JSON-RPC, as well as for any funds attached to EVM transactions via `msg.value`. However, as mentioned above, unlike other EVM networks, the MiniEVM's native token is also represented by an ERC20 interface. This means that for any transaction or logic, you can also interact with it using the ERC20 interface. ## Tool Compatibility ### Foundry **EIP-1559 Transactions** When using Foundry to deploy or interact with contracts, or to send transactions in general, you will need to use the legacy transaction type. This can be done by using the `--legacy` flag. **Precompiles and Foundry Scripts** Foundry's forge script feature always simulates all script transactions on a local standard EVM (without precompiles), and there is currently [no way to skip this simulation](https://github.com/foundry-rs/foundry/issues/5776). Consequently, any contract deployment or transaction that relies on MiniEVM precompiles will fail. # MiniEVM Introduction Source: https://docs.initia.xyz/home/core-concepts/initia-and-rollups/rollups/vms/minievm/introduction ## Overview MiniEVM is a variant of Initia's rollup framework with Ethereum Virtual Machine ([EVM](https://ethereum.org/en/developers/docs/evm/)) integration. With MiniEVM, developers can deploy and interact with Solidity and other EVM-based smart contracts just as they would on other EVM networks. All the tools such as wallets, explorers, and developer tools that you are familiar with also work out of the box with MiniEVM. In addition to EVM compatibility, MiniEVM provides a number of unique features, including: * **Cosmos Integration** * **Single Token Standard** * **IBC Compatibility** ## Cosmos Integration MiniEVM interacts with the Cosmos blockchain through a set of custom precompiles. This integration allows the EVM to: * **Read the underlying Cosmos chain state**: Access and read the state of the Cosmos blockchain directly from the EVM. * **Send Cosmos transactions**: Initiate and send transactions on the Cosmos blockchain. ### Notable Features * **Query native Connect price data**: Retrieve price data from the native Connect oracle. * **Query all tokens held by an account**: Obtain a comprehensive list of tokens held by a specific account. ## Single Token Standard MiniEVM revolves around a single token standard by implementing a custom Bank Interface that provides an ERC20 interface for all tokens on the chain. This includes: * **Native tokens**: Tokens that are native to the Cosmos blockchain. * **Fee-denom tokens**: Tokens used for transaction fees. * **Tokens bridged via IBC**: Tokens transferred through the Inter-Blockchain Communication (IBC) protocol. * **ERC20 tokens created on the rollup**: Standard ERC20 tokens created within the rollup framework. ### Benefits * **Unified balance querying**: Ability to query all tokens held by an account in a single query. * **Simplified token handling**: No need to handle different token standards in smart contracts, making development more straightforward. *** For more detailed information, please refer to the specific sections of this documentation. # MiniMove Introduction Source: https://docs.initia.xyz/home/core-concepts/initia-and-rollups/rollups/vms/minimove/introduction ## Overview MiniMove is a [MoveVM](https://move-language.github.io/move)-based variant of Initia's rollup framework, designed to support the deployment of and interaction with MoveVM smart contracts. Specifically, the MoveVM is based on the [Aptos variant](https://aptos.dev/en/build/smart-contracts) of the MoveVM. It includes additions and changes to improve performance and enable compatibility with the rollup's underlying Cosmos SDK stack and the wider Initia ecosystem. # MiniWasm Introduction Source: https://docs.initia.xyz/home/core-concepts/initia-and-rollups/rollups/vms/miniwasm/introduction ## Overview MiniWasm is a variant of Initia's rollup framework with [CosmWasm](https://cosmwasm.com/) integration, enabling developers to deploy and interact with CosmWasm smart contracts. # InitiaDEX Source: https://docs.initia.xyz/home/core-concepts/initiadex The InitiaDEX is a decentralized exchange (DEX) built on the Initia L1. It serves as a Balancer-style weighted pool for diverse asset pairs and a StableSwap pool for assets with closely correlated prices. This design ensures an optimal trading experience across various asset types. The DEX aims to be the central liquidity hub for all Interwoven Rollups, facilitating daily trading and more complex cross-rollup interactions and swaps. The InitiaDEX is essential for promoting the growth, stability, and alignment of the entire Initia ecosystem. To support these goals, the DEX features [Enshrined Liquidity](/home/core-concepts/enshrined-liquidity/introduction). This allows you to use certain governance-whitelisted liquidity pairs as staking assets for the Initia L1. # Introduction Source: https://docs.initia.xyz/home/core-concepts/interwoven-stack/introduction ## Overview The **Interwoven Stack** is Initia's comprehensive, all-in-one solution designed to empower developers and teams in building and deploying rollups with unmatched ease and efficiency. Historically, building a rollup requires developers to research, select, and piece together numerous components and services. These include: * Choosing the right scaling solution while considering VM compatibility for each option. * Sourcing or building wallets, explorers, bridges, and other essential tools. * Integrating various services such as oracles, bridges, fiat on-ramps, and more. All of these tasks divert time and resources from developers, preventing them from focusing on building their applications. The Interwoven Stack aims to address these challenges by focusing on the following key areas: 1. **Comprehensive Product Suite:** The Stack provides developers and teams with everything needed to launch and operate a rollup, including bridges, wallets, explorers, and a multi-VM compatible [rollup framework](/home/core-concepts/interwoven-stack/opinit-framework). 2. **Seamless Interoperability:** The tools built into the Stack facilitate easy communication for the rollup, whether it's between rollups, with Initia L1, or with other blockchain ecosystems. 3. **Enhanced Security:** Robust security measures are integrated into the Stack, providing a solid foundation for building secure and trustworthy applications. With this approach, developers can focus solely on building, improving, and shipping their applications. The Interwoven Stack handles the heavy lifting of selecting the right tools and components for a performant and secure rollup. # Challenger Source: https://docs.initia.xyz/home/core-concepts/interwoven-stack/opinit-framework/components/challenger The Challenger is a process distinct from the Executor, responsible for monitoring the Executor's output proposals and challenging any invalid submissions. This ensures the integrity of the rollup's state and prevents malicious actions by the Executor. The primary responsibilities of the Challenger include: 1. **Verifying Deposits**: * Ensure that the `MsgInitiateTokenDeposit` event is relayed correctly to the `MsgFinalizeTokenDeposit` event. * Check if `MsgInitiateTokenDeposit` was relayed within the required time frame. 2. **Verifying Oracle Updates**: * Confirm that Oracle data is correctly relayed to `MsgUpdateOracle`. * Ensure that Oracle updates are processed on time. 3. **Validating Outputs**: * Check that the `OutputRoot` submitted with `MsgProposeOutput` is accurate. * Ensure that the next `MsgProposeOutput` is submitted within the expected time frame. ## Detailed Architecture The Challenger architecture is designed to ensure that interactions between Initia (L1) and rollup (L2) are correctly validated, securing internal processes within the Initia ecosystem. Each part of the architecture is tailored to handle specific challenges while maintaining the security and reliability of the Initia-rollup interactions. ### Deposit Challenges Deposits from L1 to L2 must follow a strict verification process to ensure that tokens are correctly transferred between chains. The Challenger plays a critical role in this by confirming that `MsgInitiateTokenDeposit` is not only correctly triggered but also completed within a specific timeframe by matching it to `MsgFinalizeTokenDeposit`. This prevents potential discrepancies or fraud, ensuring that deposits are secure. When a `MsgInitiateTokenDeposit` event is detected on the L1 chain, it is recorded as a **Deposit** challenge. The system checks if it matches the `MsgFinalizeTokenDeposit` event for the same sequence. ```go theme={null} // Deposit is the challenge event for deposit data type Deposit struct { EventType string `json:"event_type"` Sequence uint64 `json:"sequence"` L1BlockHeight uint64 `json:"l1_block_height"` From string `json:"from"` To string `json:"to"` L1Denom string `json:"l1_denom"` Amount string `json:"amount"` Time time.Time `json:"time"` Timeout bool `json:"timeout"` } ``` ### Output Challenges **Outputs**, which represent state changes in the L2 chain, must be correctly submitted to maintain the synchronization between L1 and L2. The Challenger ensures that the OutputRoot of the submitted `MsgProposeOutput` matches the system’s expectations and that future proposals are made within the designated timeframe. This process prevents any incorrect or malicious outputs from being finalized, ensuring the integrity of the system. When a `MsgProposeOutput` event is detected on the L1 chain, it triggers an **Output** challenge. The system replays up to the L2 block number and verifies whether the `OutputRoot` matches the one submitted. ```go theme={null} // Output is the challenge event for output data type Output struct { EventType string `json:"event_type"` L2BlockNumber uint64 `json:"l2_block_number"` OutputIndex uint64 `json:"output_index"` OutputRoot []byte `json:"output_root"` Time time.Time `json:"time"` Timeout bool `json:"timeout"` } ``` ### Oracle Challenges Oracles serve as external data providers for the blockchain, and any failure in updating their data can lead to inaccuracies within the system. The Challenger ensures that oracle updates happen in a timely manner and are properly relayed from L1 to L2 through `MsgUpdateOracle`, safeguarding the accuracy of external data within the Initia ecosystem. If the `oracle_enable` setting is turned on in bridge config, the 0th transaction's bytes are saved as an **Oracle** challenge event. This data is verified against the `MsgUpdateOracle` for the same L1 height. ```go theme={null} // Oracle is the challenge event for oracle data type Oracle struct { EventType string `json:"event_type"` L1Height uint64 `json:"l1_height"` Data []byte `json:"data"` Time time.Time `json:"time"` Timeout bool `json:"timeout"` } ``` ### Rollback Challenges (TBA) If a challenge is created and the event is not finalized within the timeout period, it is possible to rollback before the challenge is finalized. This feature will be announced in a future release. # Executor Source: https://docs.initia.xyz/home/core-concepts/interwoven-stack/opinit-framework/components/executor The OPinit Bot Executor is a critical component in maintaining the communication and operational integrity between the Initia L1 and rollup blockchains. It handles and automates key tasks related to the OPinit Bridge, which facilitates cross-chain interactions and ensures that both blockchains remain synchronized and secure. The primary responsibilities of the Executor include: 1. **Executing Token Transfers:** Executing token transfers between Initia L1 and a rollup 2. **Submitting Output Proposals:** Submitting output proposals to the Initia L1 3. **Transaction Batch DA Submission:** Submitting rollup transaction batches to the DA layer 4. **Relaying Oracle Update (Optional):** Relaying oracle price feed updates to the rollup ## Detailed Architecture ### Transfer Token from L1 to L2 (Deposit) The token deposit process begins when a user submits a deposit transaction on the Initia L1 chain. Once the transaction is confirmed, the Bridge Executor retrieves the latest block data (including the deposit) from the L1 node. It then submits a message to the rollup node to finalize the deposit. After the L2 node confirms the finalized deposit, it mints the corresponding opINIT tokens on the specified rollup. ```mermaid theme={null} sequenceDiagram participant User participant IL1 as Initia L1 participant OPH as OPhost Module participant OPB as OPinit Bot participant OPC as OPchild Module participant R as Rollup User->>IL1: Initiate token deposit IL1->>OPH: Process deposit OPH->>OPB: Emit deposit event OPB->>OPB: Process deposit event OPB->>OPC: Relay deposit transaction OPC->>R: Finalize deposit R->>R: Mint tokens to user on L2 ``` ### Transfer Token from L2 to L1 (Withdrawal) The token withdrawal process begins when a user submits a withdrawal transaction on the rollup. Once the transaction is confirmed, the Bridge Executor retrieves the latest block data (including the withdrawal) from the L2 node. It then submits a message to the Initia L1 node to finalize the withdrawal. After the L1 node confirms the finalized withdrawal, it burns the corresponding opINIT tokens on the specified rollup. The withdrawal then enters a withdrawal period during which the transaction can be challenged and potentially canceled. If no challenge is submitted by the end of this period, the user can claim the withdrawal on Initia L1. ```mermaid theme={null} sequenceDiagram participant User participant R as Rollup participant OPC as OPchild Module participant OPB as OPinit Bot participant OPH as OPhost Module participant IL1 as Initia L1 User->>R: Initiate token withdrawal R->>OPC: Process withdrawal request OPC->>OPC: Lock tokens and emit event OPC->>OPB: Notify of withdrawal event OPB->>OPB: Update Merkle tree OPB->>OPH: Submit updated L2 output root OPH->>IL1: Store L2 output root Note over OPB,IL1: Wait for finalization period User->>OPB: Request withdrawal proof OPB->>OPB: Generate Merkle proof OPB->>User: Provide withdrawal proof User->>IL1: Submit proof & finalize withdrawal IL1->>OPH: Verify proof OPH->>IL1: Approve token release IL1->>User: Transfer withdrawn tokens ``` The withdrawal period is designed to allow for a challenge period during which any malicious activity can be detected and addressed. If a challenge is submitt
프로젝트로 돌아가기