Architecture Overview#

Technical architecture of the Coalesce Finance platform.

Components#

On-Chain (Solana)#

ComponentDescription
Coalesce Finance ProgramCore protocol logic in Rust
ProtocolConfigGlobal protocol configuration
MarketPer-market state
LenderPositionPer-lender, per-market balance
BorrowerWhitelistBorrower approval and capacity state

Off-Chain#

ComponentDescription
IndexerReads program activity and updates PostgreSQL
DatabaseIndexed protocol state for querying
APIREST interface over indexed data
SDKsClient libraries for transaction building and decoding
Web/Mobile AppsUser-facing interfaces

Data Flow#

Write Path (Transactions)#

  1. Client builds an instruction.
  2. Wallet signs the transaction.
  3. Solana executes program logic and updates accounts.
  4. Indexer ingests updates and writes to PostgreSQL.

Read Path (Queries)#

  1. Client calls API endpoints.
  2. API reads indexed data from PostgreSQL.
  3. 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#

MetricValue
Total Instructions17
Account Types4
Error Codes43
WAD Precision10^18

Instruction Groups#

RangeCategory
0-2Admin/Setup
3-7Core Lending
8-11Settlement
12-16Access Control

Further Details#