Skip to content

Technical Design

This page provides a comprehensive view of IOST 3.0's Layer 2 technical architecture. We'll examine the technical foundations, implementation details, and innovative approaches that power the platform's high-performance scaling solution.

Architecture Overview

IOST 3.0's Layer 2 architecture employs a modular, multi-layered approach that combines several state-of-the-art scaling technologies while introducing novel optimizations for specialized use cases.

Architecture

Key Technical Components

At its core, IOST 3.0's Layer 2 architecture consists of these integrated technical components:

  1. Optimistic Rollup Engine: The primary scaling mechanism for general transactions

  2. Domain-Specific Execution Environments: Specialized processing for different application domains

  3. State Management System: Efficient handling of the Layer 2 state and synchronization

  4. Cross-Domain Bridge: Interoperability between different specialized execution domains

  5. Security Infrastructure: Multi-layered security mechanisms protecting the entire system

Optimistic Rollup Implementation

IOST 3.0 implements an advanced optimistic rollup system that maximizes throughput while maintaining strong security guarantees through the BNB Chain anchor.

Transaction Flow

The lifecycle of a transaction in IOST 3.0's Layer 2 follows these steps:

Transaction

  1. Submission: Users submit transactions to the Layer 2 network through RPC endpoints

  2. Sequencing: Transactions are ordered by sequencers in the network

  3. Execution: Transactions are processed in the appropriate domain-specific environment

  4. Batching: Executed transactions are grouped into batch commitments

  5. Commitment: Transaction batches are committed to the Layer 2 state

  6. Finalization: State commitments are periodically anchored to BNB Chain

python
async def submit_layer2_transaction(tx):
    # Sign the transaction with user's private key
    signed_tx = await wallet.sign_transaction(tx)
    
    # Submit to Layer 2 sequencer and wait for confirmation
    tx_response = await l2_provider.send_transaction(signed_tx)
    tx_receipt = await tx_response.wait()
    
    print(f"Transaction confirmed on L2: {tx_receipt.transaction_hash}")
    
    # Check L1 finalization status
    finalization_status = await bridge.check_finalization_status(
        tx_receipt.transaction_hash
    )
    
    return {"tx_receipt": tx_receipt, "finalization_status": finalization_status}

Fraud Proof System

IOST 3.0 implements a sophisticated fraud proof system with several key innovations:

  1. Interactive Fraud Proofs: Disputed transactions can be challenged through an interactive verification process
  2. Optimized Verification Windows: Context-aware challenge periods based on transaction value and complexity
  3. Validator Incentive Mechanism: Economic incentives for validators to identify invalid state transitions

State Management Architecture

Efficient state management is crucial for Layer 2 performance. IOST 3.0 employs a multi-tiered approach to state:

State

State Tree Structure

IOST 3.0 uses a hybrid state structure combining Merkle Patricia Trees with specialized data structures for different domains:

  1. Global State Merkle Tree: The overarching state representation for the entire Layer 2

  2. Domain-Specific State Trees: Specialized structures for Payment, RWA, and DID domains

  3. Smart Contract Storage: EVM-compatible storage for general-purpose smart contracts

solidity
// Example of a domain-specific state access in a contract
contract PaymentProcessor {
    // Access to the specialized payment state structure
    function processPayment(
        address sender, 
        address receiver, 
        uint256 amount
    ) external {
        // Access the domain-specific PayPIN registry
        PayPINRegistry registry = PayPINRegistry(REGISTRY_ADDRESS);
        
        // Resolve user-friendly identifiers to addresses if needed
        address resolvedReceiver = registry.resolvePayPIN(receiver);
        
        // Execute the payment with specialized domain logic
        DomainStateConnector.executeStateUpdate(
            PAYMENT_DOMAIN_ID,
            abi.encode(sender, resolvedReceiver, amount)
        );
        
        emit PaymentProcessed(sender, resolvedReceiver, amount);
    }
}

State Synchronization

IOST 3.0 implements an efficient state synchronization mechanism between Layer 2 and BNB Chain:

  1. Incremental State Updates: Only state differences are submitted to Layer 1, minimizing gas costs
  2. Compression Algorithms: Advanced data compression for on-chain state commitments
  3. Batched Commitment Strategy: Intelligent batching based on transaction volume and security requirements

Domain-Specific Execution Environments

IOST 3.0's unique approach includes specialized execution environments for different application domains:

Payment Domain

The Payment Domain is optimized for high-throughput financial transactions with features including:

  1. Transaction Compression: Specialized encoding reducing the footprint of payment operations

  2. Parallel Payment Processing: Non-conflicting payments processed simultaneously

  3. Payment-Specific Virtual Machine: Streamlined execution for common payment operations

RWA Domain

The RWA Domain handles real-world asset tokenization with tailored features:

  1. Asset Lifecycle Management: Specialized state transitions for the complete asset lifecycle

  2. Compliance Rule Engine: Built-in logic for regulatory requirements across jurisdictions

  3. Principal-Interest Separation Logic: Automatic handling of financial asset flows

DID Domain

The DID Domain focuses on identity management and verification:

  1. Privacy-Preserving Computation: Zero-knowledge proofs for credential verification

  2. Selective Disclosure Mechanism: Granular control of personal information sharing

  3. Biometric Verification Integration: Hardware-secured identity verification processes

Cross-Domain Integration

The power of IOST 3.0's architecture comes from how these domains interact. The system implements:

  1. Universal State Access Protocol: Standardized APIs for cross-domain state reading

  2. Cross-Domain Transaction Framework: Atomic operations spanning multiple domains

  3. Domain Service Registry: Discovery mechanism for domain-specific capabilities

Smart Contract Execution

IOST 3.0 supports multiple programming paradigms for smart contract development:

EVM Compatibility

Full support for Ethereum Virtual Machine contracts with extensions:

  1. Solidity/Vyper Support: Standard EVM languages with IOST-specific extensions

  2. Extended Precompiles: Additional precompiled contracts for domain-specific operations

  3. Gas Optimizations: Reduced gas costs for common operations

solidity
// Example of a contract using IOST-specific extensions
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@iost/extensions/PaymentInterface.sol";
import "@iost/extensions/DIDVerifier.sol";

contract EnhancedMarketplace {
    // Use IOST's payment extension
    PaymentInterface private paymentInterface;
    // Use IOST's DID verification extension
    DIDVerifier private didVerifier;
    
    constructor(address _paymentInterface, address _didVerifier) {
        paymentInterface = PaymentInterface(_paymentInterface);
        didVerifier = DIDVerifier(_didVerifier);
    }
    
    function purchaseItem(
        string calldata payPinId,
        string calldata itemId,
        bytes calldata identityProof
    ) external {
        // Verify identity using DID domain
        require(didVerifier.verifyIdentity(msg.sender, identityProof));
        
        // Process payment using PayPIN
        paymentInterface.processPayPinPayment(
            payPinId,
            getSellerPayPinId(itemId),
            getItemPrice(itemId)
        );
        
        completeItemTransfer(msg.sender, itemId);
    }
    
    // Helper functions (implementation details omitted)
    function getItemPrice(string calldata) internal view returns (uint256) {}
    function getSellerPayPinId(string calldata) internal view returns (string memory) {}
    function completeItemTransfer(address, string calldata) internal {}
}

Domain-Specific Languages

IOST 3.0 introduces specialized programming languages for domain experts:

  1. Payment Script: Simplified syntax for payment flows and conditions

  2. Asset Definition Language: Declarative language for RWA tokenization

  3. Credential Policy Language: Specialized syntax for DID credential rules

Layer 1-Layer 2 Bridge Implementation

The bridge between BNB Chain and IOST Layer 2 is a critical component with sophisticated design:

Bridge

Bridge Architecture

  1. Multi-Signature Validator Pool: Decentralized set of bridge validators

  2. State Commitment Contract: On-chain verification of Layer 2 state roots

  3. Challenge Contract: Infrastructure for fraud proof submission and resolution

  4. Deposit/Withdrawal System: Asset transfer mechanism between layers

Security Features

The bridge implements several key security mechanisms:

  1. Time-Locked Withdrawals: Configurable delay period for large withdrawals

  2. Risk-Based Security Model: Adaptive security measures based on transaction risk profiles

  3. Economic Security Layer: Token staking and slashing for validator misbehavior

solidity
// Simplified example of the Layer 1 bridge contract on BNB Chain
pragma solidity ^0.8.0;

contract IOSTBridge {
    mapping(uint256 => bytes32) public stateRoots;
    mapping(address => bool) public validators;
    mapping(address => uint256) public pendingWithdrawals;
    mapping(bytes32 => bool) public processedWithdrawals;
    
    uint256 public latestBlockNumber;
    uint256 public withdrawalDelay;
    
    event StateRootSubmitted(uint256 blockNumber, bytes32 stateRoot);
    event WithdrawalInitiated(address recipient, uint256 amount, bytes32 withdrawalId);
    
    function submitStateRoot(
        uint256 blockNumber,
        bytes32 stateRoot,
        bytes[] calldata signatures
    ) external {
        require(blockNumber > latestBlockNumber && verifySignatures(stateRoot, signatures));
        stateRoots[blockNumber] = stateRoot;
        emit StateRootSubmitted(blockNumber, stateRoot);
    }
    
    function initiateWithdrawal(
        address recipient,
        uint256 amount,
        bytes32 withdrawalId,
        bytes calldata merkleProof,
        uint256 blockNumber
    ) external {
        require(!processedWithdrawals[withdrawalId]);
        require(verifyWithdrawalProof(
            withdrawalId, recipient, amount, merkleProof, stateRoots[blockNumber]
        ));
        
        processedWithdrawals[withdrawalId] = true;
        pendingWithdrawals[recipient] = amount;
        
        emit WithdrawalInitiated(recipient, amount, withdrawalId);
    }
    
    // Helper functions (implementation details omitted)
    function verifySignatures(bytes32, bytes[] calldata) internal view returns (bool) {}
    function verifyWithdrawalProof(bytes32, address, uint256, bytes calldata, bytes32) 
        internal pure returns (bool) {}
}

Data Availability Solution

IOST 3.0 implements a hybrid data availability approach:

  1. On-Chain Data Attestation: Compressed transaction data fingerprints stored on BNB Chain

  2. Distributed Data Storage: Complete transaction data stored across network participants

  3. Data Availability Sampling: Probabilistic verification of data availability

  4. Data Availability Committees: Specialized nodes ensuring critical data persistence

Performance Optimizations

IOST 3.0's Layer 2 includes numerous performance enhancements:

  1. Parallel Transaction Execution: Non-conflicting transactions processed simultaneously

  2. SNARK-Based State Transitions: Zero-knowledge proofs for efficient verification

  3. Adaptive Batch Processing: Dynamic adjustment of batch sizes based on network conditions

  4. Hot/Cold State Segregation: Optimized storage for frequently vs. rarely accessed state

Network Topology

IOST 3.0's Layer 2 network consists of several node types:

Network

  1. Validators: Process transactions and propose state updates

  2. Sequencers: Order incoming transactions into batches

  3. Data Availability Nodes: Ensure transaction data remains available

  4. Bridge Relayers: Facilitate communication between Layer 1 and Layer 2

  5. Domain-Specific Processors: Specialized nodes for payment, RWA, or DID operations

Released under the MIT License.