Skip to main content

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:

StageInputOutput
VerifyDevice submission + metadataOn-chain verification certificate
TokenizeCertificate + pool configurationSmart contract with share ledger
DistributeRevenue depositDistribution round (claimable by shareholders)
TradeShare ownershipMarketplace listing or DobDex exit

Backend Architecture

Main Backend (Token Studio)

The primary backend serving Token Studio, the marketplace, and shared services.

ComponentTechnologyPurpose
Web FrameworkExpress 4.17HTTP API server
ORMSequelize 6.16PostgreSQL query layer
DatabasePostgreSQL (Cloud SQL)Persistent storage
WebSocketSocket.IO 4.5Real-time updates
AuthenticationJWT (jsonwebtoken 8.5)User sessions
Blockchain (Stellar)@stellar/stellar-sdk 14.3Soroban contract interaction
Blockchain (EVM)ethers.js 6.14EVM chain interaction

Port: 3000

Backoffice Services

Auxiliary services that support the main platform.

ServicePortPurpose
Admin Server3001Admin panel API -- pool management, user management, network config
Admin Panel4100Angular 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

ApplicationFrameworkPortURL
Token StudioAngular 154200home.dobprotocol.com
Admin PanelAngular 154100Internal 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

TablePrimary KeyPurpose
poolsaddressMain pool entity -- stores all pool configuration
pool_usersCompositeControls which users see which pools in their dashboard
eventRecordsAuto IDPool events (init, distribute, withdraw, share transfers) + native token transfers
eventTransfersAuto IDExternal token deposits (ERC20/SAC) to pools
pool_distribution_datesAuto IDDistribution schedule records
dob_buy_salessale_addressActive marketplace share listings
dob_buy_sale_transactionsAuto IDCompleted marketplace purchases
networksidBlockchain network configuration (RPC URLs, WASM hashes, contract addresses)

Pool Data (Compressed JSON)

Pool metadata is stored as compressed JSON in pool_data. Key mappings:

KeyFull NameExample Values
naname"Solar Farm Alpha"
tkticker"SFA"
mpmax_participants100
accaccesspr (private), pb (public)
waccway_to_accessrtj (request), p (buy), qr, stk (staking)
dtdistribution_typetr (trusted), bt (business), dam
eaprestimated_apr12.5
ttdtoken_to_distributeToken address

Blockchain Layer

Stellar Soroban

Primary chain for pool smart contracts.

ComponentDetails
SDK@stellar/stellar-sdk 14.3.0 (Soroban) + stellar-sdk 11.3.0 (Horizon)
Contract V1Push-based distribution -- admin loops all shareholders
Contract V2Pull-based lazy claims -- scalable to 10,000+ shareholders
Testnet RPChttps://soroban-testnet.stellar.org
Mainnet RPChttps://soroban.stellar.org

EVM Chains

Used for DobValidator contracts, DobDex hooks, and cross-chain operations.

ComponentDetails
SDKethers.js 6.14 (primary), web3.js 1.7 (legacy)
ChainsEthereum, Base, Polygon, Arbitrum
ContractsValidator registry, Dex liquidity hooks

Infrastructure

ServiceProviderPurpose
DatabaseGoogle Cloud SQL (PostgreSQL)Primary data store
HostingGoogle Compute EngineApplication servers
StorageGoogle Cloud StorageFile uploads, images
AuthGoogle Auth Library + JWTOAuth and session management
EmailNodemailerTransactional emails
LoggingWinstonStructured logging
AIAnthropic Claude + OpenAITRUFA 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:

  1. Polls the Stellar blockchain for new events on tracked pools
  2. Parses event data (handling i128 decimal format)
  3. Inserts records into eventRecords (pool events, native transfers) and eventTransfers (external token deposits)
  4. Updates pool_users share balances based on on-chain events
  5. Runs on a cron schedule in production (~15-20 minute sync delay)