STAB3L
12px

Technical Architecture

Detailed overview of the STAB3L platform's technical architecture

Technical Architecture

This document provides a comprehensive overview of the STAB3L platform's technical architecture, including its components, interactions, and design principles.

{% hint style="info" %} This documentation is intended for developers and technical users who want to understand the inner workings of the STAB3L platform. {% endhint %}

{% hint style="warning" %} Important: CU tokens are NOT tradable assets. They are temporary tokens that are burned immediately when exchanged for sSTB. This burning mechanism is crucial for maintaining the peg and ensuring that each sSTB is backed by real compute resources. {% endhint %}

Architecture Overview

STAB3L employs a modular, layered architecture designed for security, scalability, and interoperability:

STAB3L Architecture Overview

Key Components

  1. Smart Contracts: Core blockchain logic for compute resource verification, sSTB minting, marketplace, and governance
  2. Verification System: ZKP and TEE-based verification of compute resources
  3. Cross-Chain Bridge: Secure transfer of sSTB tokens between supported blockchains
  4. API Layer: RESTful and GraphQL APIs for platform interaction
  5. Frontend Applications: Web and mobile interfaces for users and providers

Data Layer

The data layer manages the storage and persistence of platform data:

On-Chain Storage

  • Primary Chain: Arbitrum for main contract deployment and data storage
  • Secondary Chains: Ethereum (for critical data), Solana, and other supported chains
  • Storage Optimization: Minimized on-chain storage using event logs and IPFS for large datasets

Off-Chain Storage

  • IPFS: Decentralized storage for benchmark results, verification proofs, and metadata
  • TheGraph: Indexing of on-chain events for efficient querying
  • Provider Database: Secure storage of provider-specific data

Smart Contract Architecture

The smart contract architecture follows a modular design pattern, with clear separation of concerns to enhance security, maintainability, and upgradability:

├── Core
│   ├── ComputeUnitVerifier.sol  # Verification of compute resources
│   ├── sSTBToken.sol            # ERC-20 implementation for sSTB tokens
│   ├── MintingAgent.sol         # Handles minting of sSTB tokens
│   └── Redemption.sol           # Manages redemption of sSTB tokens
├── Staking
│   ├── ProviderStaking.sol      # Manages provider staking (min 7 days)
│   ├── RewardsDistributor.sol   # Distributes rSTB rewards
│   └── CollateralManager.sol    # Manages collateral (min 120%)
├── Marketplace
│   ├── SpotMarket.sol           # Spot trading of sSTB tokens
│   ├── FuturesMarket.sol        # Futures contracts for sSTB tokens
│   └── OptionsMarket.sol        # Options contracts for sSTB tokens
├── Bridge
│   ├── CrossChainBridge.sol     # Cross-chain sSTB token transfer
│   └── MessageVerifier.sol      # Verification of cross-chain messages
├── Governance
│   ├── rSTBToken.sol            # rSTB token implementation
│   ├── Voting.sol               # Governance voting mechanism
│   └── Timelock.sol             # Timelock for governance actions
└── Utils
    ├── AccessControl.sol        # Role-based access control
    ├── Pausable.sol             # Circuit breaker functionality
    └── Oracle.sol               # Price feed and external data

{% hint style="info" %} All smart contracts are audited by leading security firms and follow the OpenZeppelin security best practices. For more details on security measures, see the Security documentation. {% endhint %}

Contract Interactions

The following diagram illustrates the key interactions between smart contracts:

graph TD A[User] -->|Buys sSTB Token| B[SpotMarket] B -->|Transfers Token| C[sSTBToken] D[Provider] -->|Verifies Resources| E[VerificationSystem] E -->|Approves Minting| F[MintingAgent] F -->|Mints sSTB| C F -->|Burns CU Tokens| G[CUToken] F -->|Stakes sSTB| H[ProviderStaking] H -->|Distributes Rewards| I[RewardsDistributor] I -->|Sends rSTB| J[rSTBToken] A -->|Redeems sSTB| K[Redemption] K -->|Burns sSTB| C K -->|Notifies| D A -->|Bridges sSTB| L[CrossChainBridge] L -->|Locks/Burns| C

Key Contract Interactions Explained

  1. Verification and Minting Flow:

    • Provider submits compute resources for verification through ComputeUnitVerifier.sol
    • Verification is performed using ZKP or TEE (see Verification System for details)
    • Upon successful verification, MintingAgent.sol mints temporary CU tokens
    • CU tokens are immediately exchanged 1:1 for sSTB tokens and burned
    • The mathematical model for this exchange follows: $CU_{tokens} \rightarrow sSTB_{tokens}$ with a 1:1 ratio
  2. Staking and Rewards Flow:

    • Provider stakes sSTB tokens through ProviderStaking.sol for a minimum of 7 days
    • Provider's collateral (minimum 120% of CU value) is locked in CollateralManager.sol
    • RewardsDistributor.sol calculates and distributes rSTB rewards based on: $R = S \times T \times M$ where $R$ is the reward amount, $S$ is the staked amount, $T$ is the time staked, and $M$ is the reward multiplier
  3. Redemption Flow:

    • User redeems sSTB tokens through Redemption.sol
    • sSTB tokens are burned, reducing the total supply
    • Provider is notified to deliver the compute resources
    • Upon confirmation, a portion of the provider's collateral is released
  4. Cross-Chain Bridge Flow:

    • User initiates a bridge transaction through CrossChainBridge.sol
    • sSTB tokens are locked or burned on the source chain
    • MessageVerifier.sol verifies the cross-chain message
    • sSTB tokens are minted on the destination chain

For a more detailed explanation of the mathematical models underlying these interactions, see the System Architecture & Mathematical Model section of the whitepaper.

Peg Stability Mechanism

The stability of the sSTB token is maintained through a combination of arbitrage, derivatives, and governance mechanisms, as defined by the peg stabilization equation:

$$ P_{sSTB} = P_{CU} + \Delta_{arbitrage} + \Delta_{derivatives} + \Delta_{governance} $$

Where:

  • $P_{CU}$ is the market price of 1 CU in USD (nominally $0.06, ±30% volatility)
  • $P_{sSTB}$ is the target price of sSTB, fixed at $0.06 (1 CU)
  • $\Delta_{arbitrage} = k \cdot (P_{sSTB} - P_{CU})$, with $k$ (arbitrage efficiency) dynamically adjustable via governance
  • $\Delta_{derivatives} = m \cdot (P_{sSTB,futures} - P_{sSTB,spot})$, with $m$ (derivative market efficiency) adjustable
  • $\Delta_{governance} = g \cdot (R_{actual} - R_{target})$, with $g$ (governance response factor) adjustable

This mechanism is implemented across multiple contracts:

  • SpotMarket.sol, FuturesMarket.sol, and OptionsMarket.sol facilitate arbitrage and derivatives
  • Governance.sol enables parameter adjustments through voting
  • Oracle.sol provides price feeds for the calculation

{% hint style="info" %} For a complete derivation of this equation and simulation results, see the System Architecture & Mathematical Model section of the whitepaper. {% endhint %}

Verification System

The verification system ensures the authenticity of compute resources:

Verification Process

  1. Provider Registration: Provider registers and selects verification method
  2. Staking Period Selection: Provider chooses staking period (minimum 7 days)
  3. Collateral Deposit: Provider deposits collateral (minimum 120% of CU value)
  4. Benchmark Execution: Provider runs standardized benchmarks
  5. Proof Generation: ZKP or TEE generates cryptographic proof
  6. On-chain Verification: Smart contracts verify the proof
  7. CU Value Assignment: Standardized CU value assigned (1 CU = 10^15 FLOPs, $0.06)
  8. CU Token Minting: Temporary CU tokens minted
  9. Immediate Exchange: CU tokens immediately exchanged for sSTB
  10. CU Token Burning: CU tokens burned upon exchange
  11. sSTB Staking: sSTB automatically staked for chosen period
  12. rSTB Rewards: Provider earns rSTB rewards throughout staking period

{% hint style="info" %} The definition and value of 1 CU will be reviewed and potentially adjusted quarterly by the DAO through governance voting to ensure the CU standard remains relevant as compute technology evolves. {% endhint %}

Cross-Chain Bridge Architecture

The cross-chain bridge enables interoperability between blockchains:

Bridge Components

├── Contracts
│   ├── SourceChainAdapter.sol  # Adapter for source chain
│   ├── TargetChainAdapter.sol  # Adapter for target chain
│   └── MessageVerifier.sol     # Verifies cross-chain messages
├── Relayers
│   ├── RelayerManager.js       # Manages relayer network
│   ├── MessageProcessor.js     # Processes cross-chain messages
│   └── ConsensusEngine.js      # Ensures relayer consensus
└── Monitoring
    ├── BridgeMonitor.js        # Monitors bridge activity
    ├── AlertSystem.js          # Generates alerts
    └── HealthChecker.js        # Checks bridge health

Message Flow

sequenceDiagram User->>SourceChain: Initiate Bridge Transfer SourceChain->>SourceChain: Lock/Burn sSTB Tokens SourceChain->>SourceChain: Emit BridgeEvent Relayers->>SourceChain: Monitor for BridgeEvents Relayers->>Relayers: Reach Consensus Relayers->>TargetChain: Submit Proof TargetChain->>TargetChain: Verify Proof TargetChain->>TargetChain: Mint/Release sSTB Tokens TargetChain->>User: Complete Transfer

API Layer

The API layer provides programmatic access to the platform:

API Architecture

├── REST API
│   ├── Controllers
│   │   ├── ComputeController.js   # Compute resource endpoints
│   │   ├── MarketController.js    # Marketplace endpoints
│   │   └── ProviderController.js  # Provider endpoints
│   ├── Services
│   │   ├── BlockchainService.js   # Blockchain interaction
│   │   ├── VerificationService.js # Verification logic
│   │   └── UserService.js         # User management
│   └── Middleware
│       ├── Authentication.js      # API authentication
│       ├── RateLimiter.js         # Rate limiting
│       └── ErrorHandler.js        # Error handling
├── GraphQL API
│   ├── Schema
│   │   ├── ComputeSchema.graphql  # Compute resource schema
│   │   ├── MarketSchema.graphql   # Marketplace schema
│   │   └── ProviderSchema.graphql # Provider schema
│   ├── Resolvers
│   │   ├── ComputeResolvers.js    # Compute resource resolvers
│   │   ├── MarketResolvers.js     # Marketplace resolvers
│   │   └── ProviderResolvers.js   # Provider resolvers
│   └── Directives
│       ├── AuthDirective.js       # Authentication directive
│       └── CacheDirective.js      # Caching directive
└── WebSockets
    ├── MarketUpdates.js           # Real-time market updates
    ├── ProviderEvents.js          # Provider event notifications
    └── UserNotifications.js       # User notifications

API Gateway

The API Gateway manages API traffic and provides:

  1. Authentication: JWT-based authentication
  2. Rate Limiting: Tiered rate limits
  3. Caching: Response caching for improved performance
  4. Load Balancing: Distribution of API requests
  5. Analytics: API usage metrics and analytics

Frontend Architecture

The frontend applications provide user interfaces for the platform:

Web Application

├── Components
│   ├── Dashboard
│   │   ├── Overview.tsx        # Dashboard overview
│   │   ├── Analytics.tsx       # User analytics
│   │   └── Activity.tsx        # Recent activity
│   ├── Marketplace
│   │   ├── SpotMarket.tsx      # Spot market interface
│   │   ├── FuturesMarket.tsx   # Futures market interface
│   │   └── OptionsMarket.tsx   # Options market interface
│   └── Provider
│       ├── Registration.tsx    # Provider registration
│       ├── Resources.tsx       # Resource management
│       └── Verification.tsx    # Verification interface
├── Services
│   ├── ApiService.ts           # API interaction
│   ├── WalletService.ts        # Wallet integration
│   └── NotificationService.ts  # User notifications
└── State
    ├── UserStore.ts            # User state management
    ├── MarketStore.ts          # Market state management
    └── ProviderStore.ts        # Provider state management

Mobile Application

├── Screens
│   ├── Dashboard
│   │   ├── DashboardScreen.tsx # Dashboard screen
│   │   ├── PortfolioScreen.tsx # Portfolio screen
│   │   └── ActivityScreen.tsx  # Activity screen
│   ├── Market
│   │   ├── MarketScreen.tsx    # Market overview
│   │   ├── OrderScreen.tsx     # Order placement
│   │   └── HistoryScreen.tsx   # Order history
│   └── Account
│       ├── ProfileScreen.tsx   # User profile
│       ├── SettingsScreen.tsx  # App settings
│       └── SecurityScreen.tsx  # Security settings
├── Navigation
│   ├── AppNavigator.tsx        # Main navigation
│   ├── MarketNavigator.tsx     # Market navigation
│   └── AccountNavigator.tsx    # Account navigation
└── Services
    ├── ApiService.ts           # API interaction
    ├── WalletService.ts        # Wallet integration
    └── BiometricService.ts     # Biometric authentication

Infrastructure

The STAB3L platform is deployed on a robust, scalable infrastructure:

Cloud Infrastructure

  • Kubernetes Clusters: Container orchestration for API and services
  • Load Balancers: Traffic distribution and failover
  • CDN: Content delivery for static assets
  • Databases: Replicated databases for high availability

Blockchain Nodes

  • Dedicated Nodes: High-performance nodes for main chains
  • Node Redundancy: Multiple nodes per chain for reliability
  • RPC Endpoints: Optimized RPC endpoints for different services

Monitoring and Observability

  • Metrics Collection: Comprehensive metrics for all components
  • Logging: Centralized logging with structured data
  • Alerting: Automated alerts for system issues
  • Dashboards: Real-time monitoring dashboards

Security Architecture

Security is integrated into every layer of the STAB3L architecture:

Smart Contract Security

  • Formal Verification: Mathematical verification of contract correctness
  • Access Control: Role-based access control for contract functions
  • Circuit Breakers: Automatic pause mechanisms for emergencies

API Security

  • Authentication: JWT-based authentication with key rotation
  • Authorization: Fine-grained permission system
  • Input Validation: Comprehensive validation of all inputs
  • Rate Limiting: Protection against abuse and DoS attacks

Infrastructure Security

  • Network Segmentation: Isolation of critical components
  • Encryption: End-to-end encryption for sensitive data
  • Firewalls: Advanced firewall rules and WAF protection
  • DDoS Protection: Mitigation of distributed denial-of-service attacks

Development Workflow

The STAB3L development process follows industry best practices:

Version Control

  • Git Flow: Feature branches, develop, and main branches
  • Code Reviews: Mandatory peer reviews for all changes
  • CI/CD: Automated testing and deployment pipelines

Testing

  • Unit Tests: Tests for individual components
  • Integration Tests: Tests for component interactions
  • End-to-End Tests: Tests for complete user flows
  • Security Tests: Specialized tests for security aspects

Deployment

  • Staging Environment: Pre-production testing environment
  • Canary Deployments: Gradual rollout of changes
  • Rollback Capability: Quick rollback of problematic deployments

Performance Considerations

The STAB3L platform is optimized for performance:

Smart Contract Optimization

  • Gas Efficiency: Optimized for minimal gas usage (<200k gas per transaction)
  • Batching: Transaction batching for efficiency
  • Storage Optimization: Minimized on-chain storage

API Optimization

  • Caching: Strategic caching of responses
  • Connection Pooling: Efficient database connections
  • Query Optimization: Optimized database queries

Frontend Optimization

  • Code Splitting: Loading only necessary code
  • Lazy Loading: Deferred loading of components
  • Asset Optimization: Compressed and optimized assets

Scalability Strategy

STAB3L is designed to scale with increasing demand:

Horizontal Scaling

  • Stateless Services: Services designed for horizontal scaling
  • Auto-scaling: Automatic scaling based on load
  • Distributed Processing: Workload distribution across nodes

Vertical Scaling

  • Resource Optimization: Efficient use of resources
  • Performance Tuning: Continuous performance improvements
  • Hardware Upgrades: Strategic hardware upgrades

Layer 2 Solutions

  • Arbitrum: Primary layer 2 solution for scalability
  • State Channels: Off-chain processing for specific operations
  • Sidechains: Purpose-specific sidechains for specialized functions

Disaster Recovery

STAB3L has comprehensive disaster recovery capabilities:

Backup Strategy

  • Regular Backups: Scheduled backups of all critical data
  • Off-site Storage: Geographically distributed backup storage
  • Encrypted Backups: Encryption of sensitive backup data

Recovery Procedures

  • Recovery Testing: Regular testing of recovery procedures
  • Automated Recovery: Automated recovery for common scenarios
  • Manual Procedures: Documented procedures for complex scenarios

Business Continuity

  • Redundant Systems: Multiple redundant systems
  • Failover Mechanisms: Automatic failover to backup systems
  • Incident Response: Documented incident response procedures

Conclusion

The STAB3L technical architecture is designed to provide a secure, scalable, and efficient platform for compute unit standardization, verification, and trading. By employing a modular, layered approach with a focus on security and performance, STAB3L delivers a robust foundation for the future of compute resource tokenization.

For more detailed information on specific components, please refer to the respective technical documentation: