← Index
Source: docs/issues/issue-89-improve-trading-ux-implement-async-off-chain-matching-non-bl.md (auto-generated by scripts/generate-docs-html.mjs — edit the .md, not this file)

Improve Trading UX: Implement Async Off-chain Matching (Non-blocking)

Issue #89 | State: OPEN | Created: 2026-01-26T06:46:07Z

Labels: enhancement

Assignees: linked0

Updated: 2026-01-26T07:38:39Z | Closed: N/A


Context Currently, the trading flow is synchronous and blocking.

  1. User signs order.
  2. API submits transaction to Blockchain.
  3. API waits for block confirmation (tx.wait()).
  4. API responds to Frontend.

This causes a 2-3 second delay for every trade, creating a sluggish user experience compared to CEXs or Polymarket.

Proposed Solution Implement an Asynchronous Matching Engine pattern:

  1. Instant ACK: API receives the Signed Order, validates validity (balance/signature), saves to DB as PENDING, and immediately responds 200 OK.
  2. Background Processing: A queue/worker picks up the PENDING order and executes the CTFExchange.matchOrders transaction.
  3. Websocket Notification: Once the blockchain confirms the tx, the server pushes a ORDER_CONFIRMED event via WebSocket to update the UI status from 'Pending' to 'Confirmed'.

Tasks

Definition of Done