System Architecture
NOCY Protocol consists of multiple interconnected services that work together to provide a comprehensive DeFi experience on Midnight.
High-Level Overview
Service Components
Get NOCY API
The token purchase service handles:
| Component | Purpose |
|---|---|
| Order Service | Creates and manages purchase orders |
| Payment Monitor | Watches for incoming ADA payments |
| Token Distributor | Sends NOCY tokens to buyers |
| Price Oracle | Provides current token pricing |
Base URL: https://api.get.nocy.io
Explorer API
The blockchain explorer service provides:
| Component | Purpose |
|---|---|
| REST API | Query blocks, transactions, contracts |
| SSE Streams | Real-time data subscriptions |
| Search Service | Unified search across all entities |
| Cache Layer | High-performance data caching |
Base URL: https://api.explorer.nocy.io
Midnight Integration
NOCY services integrate with Midnight through:
Data Flow
Token Purchase Flow
- User requests current price from Get NOCY API
- User creates an order with desired NOCY amount
- User sends ADA to the payment address
- Payment monitor detects the transaction
- Token distributor sends NOCY to user's address
- Order status updated to COMPLETED
Explorer Data Flow
- Midnight node produces new blocks
- Indexer processes and indexes block data
- Explorer API caches frequently accessed data
- Clients query via REST or subscribe via SSE
Security Architecture
API Security
- Rate Limiting - Prevents abuse and ensures fair usage
- Input Validation - All inputs sanitized and validated
- CORS - Configured for authorized origins
Privacy Features
- Viewing Keys - Session-based access to private data
- Selective Disclosure - Users control what's visible
- Zero-Knowledge Proofs - Privacy without sacrificing verification
Deployment Architecture
Next Steps
- Quickstart Guide - Start building
- API Overview - API documentation