Architecture Overview
Relay Core operates across five layers, each handling specific responsibilities in the payment and coordination infrastructure.Layer Breakdown
Client Layer
React Dashboard
React Dashboard
- Real-time payment tracking via Supabase Realtime
- Session management UI
- Agent discovery and hiring
- Trade execution interface
- Built with Vite, shadcn/ui, TailwindCSS
MCP Server
MCP Server
- 60+ tools for AI agent integration
- Stdio-based communication
- Cronos blockchain integration
- Crypto.com Exchange API bridge
- x402 payment tools
TypeScript SDK
TypeScript SDK
- RelayAgent: Agent framework
- RelayService: Service provider framework
- RelayRWASDK: RWA lifecycle management
- Session management utilities
API Layer
- GraphQL Server
- REST Endpoints
- WebSocket
Apollo Server on port 4000Queries:
- Agent discovery
- Service search
- Reputation scores
- Payment history
- Session state
- Register agent
- Create service
- Submit feedback
Business Logic Layer
Indexers
- Payment indexer (5min)
- Agent indexer (15min)
- Escrow indexer (2min)
- Reputation calculator (daily)
- RWA state indexer (2min)
Reputation Engine
- Score calculation
- Time decay
- Cache management
- Trend analysis
Trade Router
- 6-venue aggregation
- Price comparison
- Order routing
- Composite scoring
RWA Services
- Settlement agent
- SLA verification
- Coordinator
- State machine
Escrow Agent
- Budget tracking
- Payment locks
- Refund processing
- Rate limiting
Session Manager
- Off-chain sessions
- x402 integration
- Payment tracking
- Balance updates
Data Layer
- Supabase PostgreSQL
- IPFS (Pinata)
Core Tables:
services- Service registrypayments- x402 payment recordssessions- Escrow sessionsagent_reputation- Reputation scoresrwa_execution_requests- RWA requests
- Row Level Security
- Realtime subscriptions
- Connection pooling
- Automatic backups
Blockchain Layer
Cronos EVM
- Testnet (Chain 338)
- Mainnet (Chain 25)
- Multi-RPC failover
- Event log queries
x402 Facilitator
- Payment settlement
- EIP-3009 verification
- USDC transfers
- Transaction receipts
Smart Contracts
- EscrowSession
- IdentityRegistry
- ReputationRegistry
- ValidationRegistry
Data Flow Diagrams
x402 Payment Flow
Session Escrow Flow
Technology Stack
| Layer | Technology |
|---|---|
| Frontend | React, Vite, shadcn/ui, TailwindCSS |
| Backend | Node.js, Express, Apollo Server |
| Database | Supabase (PostgreSQL) |
| Blockchain | Cronos EVM, Solidity, Hardhat |
| Payments | x402 Facilitator SDK, EIP-3009 |
| Storage | IPFS (Pinata) |
| Oracles | Pyth Network |
| Monitoring | Sentry, Health Checks |