System Architecture Overview
Obsqra.fi is a multi-layered system combining frontend, smart contracts, and off-chain services. This page explains how each component interacts and where cryptographic guarantees are enforced.
High-Level Architecture
The system is organized into four distinct layers, each with specific responsibilities and trust assumptions:
Complete Transaction Flow
Here's how a deposit transaction flows through the entire system:
Cryptographic Guarantees
The system provides several cryptographic guarantees that are enforced at different layers:
Deposit Unlinkability
Where: Groth16Verifier contract
Zero-knowledge proofs mathematically guarantee that withdrawals cannot be linked to deposits. Even if an adversary has infinite computing power, they cannot break the unlinkability without breaking the discrete log assumption on BN254.
AI Commitment Immutability
Where: AIRecommendationCommitment contract
The keccak256 hash of AI recommendations is stored on-chain before execution. The hash includes allocations, reasoning, and timestamp. After execution, anyone can verify the AI didn't alter its decision post-facto.
Policy Enforcement
Where: DAOConstraintManager contract
DAO policies are enforced by Solidity require() statements. The AI service cannot bypass constraints—transactions revert if policies are violated. Governance is cryptographically guaranteed by the EVM.
Data Flow and State Management
On-Chain State
Off-Chain State
Security and Trust Model
Trustless Components
- +Smart contracts (verified on-chain)
- +ZK proof verification (mathematical)
- +DAO policy enforcement (EVM guarantees)
- +AI commitments (cryptographic hashes)
Trust-Minimized Components
- ~AI service (commits before execution)
- ~Data APIs (cross-verified from multiple sources)
- ~RPC provider (standard Ethereum client)
Key Interaction Patterns
User ↔ Smart Contracts
Direct interaction via wallet. No intermediaries. Users generate commitments client-side and submit directly to PoolController.
AI Service ↔ Smart Contracts
AI commits recommendations before calling updateAllocationWeights(). The contract verifies the commitment matches the execution. Policy constraints are checked on-chain.
Smart Contracts ↔ DeFi Protocols
StrategyRouter calls protocol adapters which interact with Aave, Lido, and Compound. Currently mocked for testnet; on mainnet these would be real protocol interactions.
Performance Characteristics
Gas Cost Breakdown
On L2 rollups (Arbitrum, Base, Optimism), these costs translate to $0.01-0.10 per operation at typical gas prices.