System Architecture
A deep dive into Pelago's technical architecture and component interactions.
High-Level Architecture
Component Overview
API Gateway Layer
The entry point for all Pelago interactions:
| Component | Technology | Purpose |
|---|---|---|
| Load Balancer | nginx/Cloudflare | Traffic distribution, DDoS protection |
| API Server | Go/Node.js | Request handling, validation |
| Rate Limiter | Redis | Request throttling |
| Auth Service | JWT/API Keys | Authentication & authorization |
Core Services
Payment Service
Manages the complete payment lifecycle:
- Payment creation and validation
- Amount conversion (fiat ↔ crypto)
- Network selection and routing
- Status tracking and updates
Settlement Service
Handles fund distribution:
- Batch aggregation
- Fee calculation
- Liquidity pool interaction
- Merchant wallet transfers
Identity Service
Manages PID (Payment ID) system:
- W3C DID resolution
- Verifiable credential validation
- KYC/KYA verification
- Credit score queries
Blockchain Layer
Smart Contract Functions
| Contract | Function | Description |
|---|---|---|
| Payment | createPayment() | Initialize payment request |
| Payment | executePayment() | Process customer payment |
| Payment | refundPayment() | Handle refund requests |
| Liquidity | addLiquidity() | LP deposits funds |
| Liquidity | settleBatch() | Aggregate settlements |
| Identity | registerPID() | Create new Payment ID |
| Identity | verifyCredential() | Validate verifiable credentials |
Data Flow
Payment Creation Flow
Payment Execution Flow
Security Architecture
Scalability
Horizontal Scaling
- API servers: Auto-scaling pods (Kubernetes)
- Database: Read replicas + connection pooling
- Cache: Redis cluster with sharding
- Queue: Distributed message processing
Performance Targets
| Metric | Target | Description |
|---|---|---|
| API Latency | < 100ms | 95th percentile |
| Throughput | 10,000 TPS | Peak capacity |
| Availability | 99.99% | Uptime SLA |
| Recovery | < 1 min | Failover time |