Owner: CrownThrive, LLC Date: 2025-08-08 Classification: Internal — API Design, Endpoints, and Integration Standards
1. Purpose
This document defines the REST and gRPC API design for the CHLOM License Exchange (LEX), ensuring interoperability between on-chain smart contracts, off-chain compliance services, marketplaces, and DAO governance systems. It provides endpoint definitions, request/response schemas, authentication mechanisms, and developer integration guidelines.
2. API Gateway Overview
- Protocol Support: HTTPS (REST), HTTP/2 (gRPC), WebSockets for event streams.
- Gateway Location:
- API Versioning:
- Load Balancing: NGINX with Envoy proxy for routing and rate limiting.
3. Core API Modules
- License Management API — Issue, renew, revoke, transfer, and query licenses.
- Compliance API — Fetch compliance scores, run real-time checks, and verify ZKPs.
- Marketplace API — List, search, and settle license trades.
- Governance API — Submit proposals, vote, and query DAO state.
- Treasury API — Query balances, transaction history, and staking rewards.
4. REST Endpoints (Sample)
POST /v1/licenses/issue
POST /v1/licenses/renew/{licenseId}
POST /v1/licenses/revoke/{licenseId}
GET /v1/licenses/{licenseId}
POST /v1/compliance/score
POST /v1/compliance/verify-zkp
GET /v1/marketplace/listings
POST /v1/marketplace/create
POST /v1/governance/proposals
POST /v1/governance/vote
GET /v1/treasury/balance
5. gRPC Service Definitions
service LicenseService {
rpc IssueLicense (IssueLicenseRequest) returns (LicenseResponse);
rpc RenewLicense (RenewLicenseRequest) returns (LicenseResponse);
rpc RevokeLicense (RevokeLicenseRequest) returns (LicenseResponse);
rpc GetLicense (GetLicenseRequest) returns (LicenseResponse);
}
service ComplianceService {
rpc GetComplianceScore (ComplianceScoreRequest) returns (ComplianceScoreResponse);
rpc VerifyZKP (ZKPVerifyRequest) returns (ZKPVerifyResponse);
}
6. Authentication & Authorization
- OAuth 2.0 Client Credentials for trusted apps.
- mTLS for issuer-to-API secure connections.
- JWT Claims for fine-grained permissions.
- Rate Limits: Default 1000 req/min per API key, adjustable by DAO governance.
7. Event Streaming
- WebSockets/SSE for license lifecycle events.
- Event Types:
8. Error Handling
- Standardized error codes:
- JSON error structure:
{
"error_code": "LEX-ERR-1001",
"message": "License not found",
"details": {}
}
9. Developer Guidelines
- SDKs: Available in Rust, Python, JavaScript.
- Testing Sandbox:
- Monitoring: API metrics exposed via
This API design ensures seamless integration between CHLOM's on-chain and off-chain components, enabling rapid development and secure, scalable access to all LEX services.