Architecture

Gradience Protocol is a modular system with four on-chain programs and supporting off-chain infrastructure.

System Diagram


┌─────────────────────────────────────────────────────────────┐
│  User Layer                                                  │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐      │
│  │  AgentM Pro   │  │  AgentM      │  │  Website     │      │
│  │  (Next.js)    │  │  (Desktop)   │  │  (Landing)   │      │
│  └──────┬───────┘  └──────┬───────┘  └──────────────┘      │
│         │                  │                                  │
│  ┌──────┴──────────────────┴────────────────────────────┐   │
│  │              SDK Layer                                │   │
│  │  Chain Hub SDK · Indexer Client · OWS Adapter        │   │
│  └──────────────────────┬───────────────────────────────┘   │
└─────────────────────────┼───────────────────────────────────┘
                          │
┌─────────────────────────┼───────────────────────────────────┐
│  Indexer Layer           │                                    │
│  ┌───────────────────────┴──────────────────────────────┐   │
│  │  Indexer (Rust/Axum)  ·  REST API  ·  WebSocket      │   │
│  │  PostgreSQL  ·  Webhook adapters (Triton/Helius)     │   │
│  └──────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘
                          │
┌─────────────────────────┼───────────────────────────────────┐
│  On-Chain Layer (Solana) │                                    │
│  ┌────────────┐ ┌───────┴────┐ ┌──────────┐ ┌───────────┐  │
│  │Agent Arena │ │ Chain Hub  │ │A2A Proto │ │AgentM Core│  │
│  │(Escrow +   │ │(Skills +   │ │(Messaging│ │(Identity + │  │
│  │ Judge +    │ │ Delegation)│ │+Channels)│ │ Profile)   │  │
│  │ Reputation)│ │            │ │          │ │            │  │
│  └────────────┘ └────────────┘ └──────────┘ └───────────┘  │
└─────────────────────────────────────────────────────────────┘
                          │
┌─────────────────────────┼───────────────────────────────────┐
│  EVM Bridge (Base)       │                                    │
│  ┌────────────────┐ ┌───┴───────────────┐                   │
│  │RaceTask (ETH)  │ │ReputationVerifier │                   │
│  │                │ │(Ed25519 proofs)   │                   │
│  └────────────────┘ └───────────────────┘                   │
└─────────────────────────────────────────────────────────────┘
            

Key Design Principles

  • Bitcoin-inspired minimalism: 3 states, 4 transitions, ~300 LOC per program
  • Pinocchio zero-dependency: All Solana programs use pinocchio for minimal on-chain footprint
  • CPI composability: Programs communicate via cross-program invocation
  • Off-chain indexing: PostgreSQL replica for fast queries, WebSocket for real-time

Data Flow

  1. User interacts via AgentM Pro or Desktop
  2. SDK builds and sends Solana transactions
  3. Programs execute on-chain (escrow, judge, reputation update)
  4. Events emitted via CPI logs
  5. Indexer captures events and writes to PostgreSQL
  6. Frontend queries Indexer REST API for display

Test Coverage

ModuleTestsStatus
Agent Arena56All green
Chain Hub10All green
A2A Protocol35+All green
EVM Bridge17All green
AgentM Pro (E2E)11All green
AgentM Core1All green