Skip to content

Architecture

Openfish is deployed as a set of Rust services, static frontends, background bots, PostgreSQL databases, and an nginx edge. The current meme branch uses off-chain ledger trading and a BSC platform meme Bridge.

ServicePortResponsibilityDatabase
Gamma Server3001Market catalogue, events, metadata, comments, search.openfish_gamma
CLOB Server3002Orders, matching engine, ledger balances, trades, WebSockets, questions, bonds, auctions.openfish_clob
Data Server3003Positions, trade history, leaderboards, analytics.openfish_clob shared read model
Bridge Server3004BSC platform meme deposits and withdrawals.openfish_bridge
Admin Server3005Internal admin dashboard API.openfish_admin
Docs Web3006 / nginx upstreamStatic documentation site.none
Bot WorkerinternalMarket sync, market making, trading bot, translation jobs.service databases
DomainUpstream
openfish.mePublic web app
api.openfish.meCLOB Server
gamma.openfish.meGamma Server
data.openfish.meData Server
bridge.openfish.meBridge Server
luna.openfish.meAdmin web + Admin Server
docs.openfish.meDocs Web

Current trading is an off-chain ledger flow:

Client
-> CLOB API
-> auth and order validation
-> in-memory matching engine
-> trades persisted to PostgreSQL
-> ledger balances and positions updated
-> WebSocket / data APIs publish updates

The matching engine rebuilds live books from the database on startup. Fills are persisted immediately, and ledger changes are the source of truth for the meme/off-chain deployment.

The Bridge connects BSC wallet balances with Openfish ledger balances:

BSC wallet
-> platform meme deposit
-> Bridge monitor
-> Openfish ledger credit
-> trading
-> withdrawal request
-> Openfish ledger debit
-> BSC platform meme transfer

Supported bridge behavior:

  • Chain: BSC, chain ID 56.
  • Asset: configured platform meme ERC-20.
  • Deposits: user-specific BSC-compatible deposit addresses.
  • Withdrawals: platform meme sent to BSC destination addresses.

Unsupported bridge behavior:

  • USDC / USDC.e.
  • Solana or Bitcoin deposits.
  • Arbitrary meme tokens.
  • 1inch/CCTP routing.
  • Automatic conversion or quote-based swaps.

The deployment includes script/bot processes for operational automation:

WorkerRole
Market Data SyncImports upstream/live market data into local databases.
Market Maker BotProvides generic market-making liquidity.
Crypto Market MakerMarket-making for generated crypto markets.
Stock Market MakerMarket-making for generated stock markets.
Agent Trading BotSimulated or autonomous agent trading.
Translation WorkerTranslates live market content into supported locales.

The admin dashboard exposes operational controls and logs for these workers.

The CLOB server is a Rust/Axum application organized around:

LayerPurpose
Auth routesL1 credential derivation and L2 HMAC authentication.
Order routesSubmit, batch, cancel, and query orders.
Book/price routesOrder books, prices, spreads, midpoint, tick size.
Trade routesTrade history and last trade prices.
Balance routesLedger balance and allowance-style checks.
Question routesMarket creation, templates, auctions, bonds, resolution flows.
WebSocket routesMarket and user event streams.

Public integrations should use the documented CLOB, Gamma, Data, and Bridge APIs.

Key CLOB tables include:

TableDescription
accountsUser addresses and account state.
api_keysL2 API credentials.
clob_marketsMarket configuration and outcome identifiers.
ordersLive, matched, cancelled, and expired orders.
tradesFilled trades and fee data.
market_tokensMarket outcome identifiers used by the order book.
balances / ledger tablesPlatform meme and outcome position balances.

Gamma, Bridge, and Admin keep their own databases so operational concerns stay isolated.

On the meme server, the working path is:

/home/ubuntu/Openfish

The deploy directory is:

/home/ubuntu/Openfish/openfish-deploy-meme

Services are managed through the deployment wrapper:

Terminal window
./dc ps
./dc up -d --build --no-deps docs-web
./dc up -d --build --no-deps admin-server
Secret / walletPurpose
MASTER_SEED_ENCEncrypted master seed used to derive system wallets.
Platform / fee receiver walletReceives protocol/platform fees where configured.
Gas funder walletFunds Bridge withdrawals and BSC gas.
API keysAuthenticate users, builders, bots, and background workers.

System wallets should be derived from the master seed where possible so private keys remain recoverable through the documented derivation path.

The public openfish.me deployment does not support arbitrary collateral assets. Bridge deposits and withdrawals are limited to the configured BSC platform meme token.