Architecture
DobProtocol is composed of four user-facing products, a shared backend infrastructure layer, and smart contracts deployed across multiple blockchains. This page describes how the components connect and interact.
System Overview
+===========================================================================+
| USER LAYER |
| |
| +-------------+ +-------------+ +-----------+ +----------+ |
| | DobValidator| |Token Studio | | DobDex | | DobLink | |
| | (Verify) | |(Tokenize & | | (Trade) | | (Embed) | |
| | | | Distribute) | | | | | |
| +------+------+ +------+------+ +-----+-----+ +----+-----+ |
| | | | | |
+=========|================|===============|==============|=================+
| | | |
+=========|================|===============|==============|=================+
| v v v v API LAYER |
| +------+------+ +-----+------+ +-----+-----+ +----+-----+ |
| | Validator | | Main | | Dex API | | Widget | |
| | Backend | | Backend | | | | Backend | |
| | (Express) | | (Express) | | (Express) | | (Express)| |
| +------+------+ +-----+------+ +-----+-----+ +----+-----+ |
| | | | | |
| +--------+-------+-------+-------+--------------+ |
| | | |
| +------v------+ +----v---------+ |
| | PostgreSQL | | Backoffice | |
| | (Cloud SQL) | | (Admin, Sync | |
| | | | Scheduler) | |
| +------+------+ +----+---------+ |
| | | |
+==========================================================================+
| |
+==========|===============|===========================================+
| v v BLOCKCHAIN LAYER |
| |
| +-------------------+ +----------------------------------+ |
| | Stellar Soroban | | EVM Chains | |
| | | | | |
| | - Pool Contracts | | - Ethereum Mainnet | |
| | (V1 push, | | - Base (L2) | |
| | V2 pull) | | - Polygon | |
| | - Marketplace | | - Arbitrum (L2) | |
| | - SAC Tokens | | - Validator Contracts | |
| +-------------------+ | - Dex Hook Contracts | |
| +----------------------------------+ |
+======================================================================+
Core Pipeline
The four products form a sequential pipeline for real-world asset tokenization:
1. VERIFY 2. TOKENIZE 3. DISTRIBUTE 4. TRADE
+-----------+ +-------------+ +--------------+ +-----------+
| | | | | | | |
| Dob | --> | Token | --> | Distribution | --> | DobDex / |
| Validator | | Studio | | Engine | | Market |
| | | | | | | |
+-----------+ +-------------+ +--------------+ +-----------+
TRUFA AI Pools & Push (V1) / Zero-slippage
Scoring Shares Pull (V2) + Marketplace
Each stage produces on-chain artifacts that the next stage consumes:
| Stage | Input | Output |
|---|---|---|
| Verify | Device submission + metadata | On-chain verification certificate |
| Tokenize | Certificate + pool configuration | Smart contract with share ledger |
| Distribute | Revenue deposit | Distribution round (claimable by shareholders) |
| Trade | Share ownership | Marketplace listing or DobDex exit |
Backend Architecture
Main Backend (Token Studio)
The primary backend serving Token Studio, the marketplace, and shared services.
| Component | Technology | Purpose |
|---|---|---|
| Web Framework | Express 4.17 | HTTP API server |
| ORM | Sequelize 6.16 | PostgreSQL query layer |
| Database | PostgreSQL (Cloud SQL) | Persistent storage |
| WebSocket | Socket.IO 4.5 | Real-time updates |
| Authentication | JWT (jsonwebtoken 8.5) | User sessions |
| Blockchain (Stellar) | @stellar/stellar-sdk 14.3 | Soroban contract interaction |
| Blockchain (EVM) | ethers.js 6.14 | EVM chain interaction |
Port: 3000
Backoffice Services
Auxiliary services that support the main platform.
| Service | Port | Purpose |
|---|---|---|
| Admin Server | 3001 | Admin panel API -- pool management, user management, network config |
| Admin Panel | 4100 | Angular 15 admin UI |
| Deposit Scheduler | -- | Background job for processing scheduled deposits |
| Notification Server | -- | Push notifications and email alerts |
| Stellar Sync Script | -- | Polls Stellar blockchain for events, syncs to database |
Frontend Architecture
| Application | Framework | Port | URL |
|---|---|---|---|
| Token Studio | Angular 15 | 4200 | home.dobprotocol.com |
| Admin Panel | Angular 15 | 4100 | Internal only |
Key frontend dependencies:
- Angular Material 15.2 -- UI component library
- NgBootstrap 14.2 -- Bootstrap integration
- @ngrx/store 15.4 -- State management
- ngx-translate 13.0 -- Internationalization
- SweetAlert2 11.4 -- Modal dialogs
Database Schema
PostgreSQL hosted on Google Cloud SQL. The schema centers around pools and their relationships.
+------------------+ +------------------+ +---------------------+
| pools | | pool_users | | eventRecords |
|------------------| |------------------| |---------------------|
| address (PK) |<------| pool_id (FK) | | pool_id (FK) |
| pool_data (JSON) | | user_address | | event_type |
| chain_id | | shares | | data (JSON) |
| deleted | | role | | date |
| created_at | +------------------+ +---------------------+
+--------+---------+
|
| +---------------------------+ +------------------------------+
| | pool_distribution_dates | | eventTransfers |
+------>|---------------------------| |------------------------------|
| | pool_id (FK) | | pool_id (FK) |
| | dist_date | | token_address |
| | amount | | amount |
| +---------------------------+ | from_address |
| +------------------------------+
|
| +------------------+ +------------------------------+
+------>| dob_buy_sales |------>| dob_buy_sale_transactions |
|------------------| |------------------------------|
| sale_address (PK)| | sale_address (FK) |
| token_address | | token_address |
| owner_address | | buyer_address |
| price_per_share | | shares_amount |
| is_active | | total_price |
+------------------+ +------------------------------+
Key Tables
| Table | Primary Key | Purpose |
|---|---|---|
pools | address | Main pool entity -- stores all pool configuration |
pool_users | Composite | Controls which users see which pools in their dashboard |
eventRecords | Auto ID | Pool events (init, distribute, withdraw, share transfers) + native token transfers |
eventTransfers | Auto ID | External token deposits (ERC20/SAC) to pools |
pool_distribution_dates | Auto ID | Distribution schedule records |
dob_buy_sales | sale_address | Active marketplace share listings |
dob_buy_sale_transactions | Auto ID | Completed marketplace purchases |
networks | id | Blockchain network configuration (RPC URLs, WASM hashes, contract addresses) |
Pool Data (Compressed JSON)
Pool metadata is stored as compressed JSON in pool_data. Key mappings:
| Key | Full Name | Example Values |
|---|---|---|
na | name | "Solar Farm Alpha" |
tk | ticker | "SFA" |
mp | max_participants | 100 |
acc | access | pr (private), pb (public) |
wacc | way_to_access | rtj (request), p (buy), qr, stk (staking) |
dt | distribution_type | tr (trusted), bt (business), dam |
eapr | estimated_apr | 12.5 |
ttd | token_to_distribute | Token address |
Blockchain Layer
Stellar Soroban
Primary chain for pool smart contracts.
| Component | Details |
|---|---|
| SDK | @stellar/stellar-sdk 14.3.0 (Soroban) + stellar-sdk 11.3.0 (Horizon) |
| Contract V1 | Push-based distribution -- admin loops all shareholders |
| Contract V2 | Pull-based lazy claims -- scalable to 10,000+ shareholders |
| Testnet RPC | https://soroban-testnet.stellar.org |
| Mainnet RPC | https://soroban.stellar.org |
EVM Chains
Used for DobValidator contracts, DobDex hooks, and cross-chain operations.
| Component | Details |
|---|---|
| SDK | ethers.js 6.14 (primary), web3.js 1.7 (legacy) |
| Chains | Ethereum, Base, Polygon, Arbitrum |
| Contracts | Validator registry, Dex liquidity hooks |
Infrastructure
| Service | Provider | Purpose |
|---|---|---|
| Database | Google Cloud SQL (PostgreSQL) | Primary data store |
| Hosting | Google Compute Engine | Application servers |
| Storage | Google Cloud Storage | File uploads, images |
| Auth | Google Auth Library + JWT | OAuth and session management |
| Nodemailer | Transactional emails | |
| Logging | Winston | Structured logging |
| AI | Anthropic Claude + OpenAI | TRUFA scoring, assistance |
Event Sync Architecture
Blockchain events are synced to the database through dedicated sync scripts.
Stellar Blockchain
|
| (poll every N seconds)
v
+------------------+
| Sync Script |
| (sync-stellar- |
| events.js) |
+--------+---------+
|
| Parse events, update DB
v
+------------------+
| PostgreSQL |
| - eventRecords |
| - eventTransfers |
| - pool_users |
+------------------+
|
| Query via Sequelize
v
+------------------+
| Express API |
| (Main Backend) |
+------------------+
The sync script:
- Polls the Stellar blockchain for new events on tracked pools
- Parses event data (handling i128 decimal format)
- Inserts records into
eventRecords(pool events, native transfers) andeventTransfers(external token deposits) - Updates
pool_usersshare balances based on on-chain events - Runs on a cron schedule in production (~15-20 minute sync delay)