Architecture Overview
Technical architecture of the Coalesce Finance platform.
Components
On-Chain (Solana)
| Component | Description |
|---|
| Coalesce Finance Program | Core protocol logic in Rust |
ProtocolConfig | Global protocol configuration |
Market | Per-market state |
LenderPosition | Per-lender, per-market balance |
BorrowerWhitelist | Borrower approval and capacity state |
Off-Chain
| Component | Description |
|---|
| Indexer | Reads program activity and updates PostgreSQL |
| Database | Indexed protocol state for querying |
| API | REST interface over indexed data |
| SDKs | Client libraries for transaction building and decoding |
| Web/Mobile Apps | User-facing interfaces |
Data Flow
Write Path (Transactions)
- Client builds an instruction.
- Wallet signs the transaction.
- Solana executes program logic and updates accounts.
- Indexer ingests updates and writes to PostgreSQL.
Read Path (Queries)
- Client calls API endpoints.
- API reads indexed data from PostgreSQL.
- API returns normalized JSON responses.
For critical operations, on-chain account reads remain the source of truth.
Consistency Model
- On-chain state is authoritative.
- API/database state is eventually consistent with chain state.
- Short indexing lag is expected.
Quick Reference
| Metric | Value |
|---|
| Total Instructions | 17 |
| Account Types | 4 |
| Error Codes | 43 |
| WAD Precision | 10^18 |
Instruction Groups
| Range | Category |
|---|
| 0-2 | Admin/Setup |
| 3-7 | Core Lending |
| 8-11 | Settlement |
| 12-16 | Access Control |
Further Details
- Instructions — On-chain instruction reference
- API Reference — API routes and behavior
- Error Codes — Program error catalog
- Protocol Calculations — Interest, settlement, and fee math