skip to content

fintech infrastructure

Perpetuals exchange and order book for Clove.Trade

Clove.Trade is a hybrid decentralized exchange for perpetuals and spot trading on the Sonic blockchain, pairing a centralized-exchange-quality experience with on-chain settlement and custody where money moves.

The Clove.Trade exchange interface.
client
Clove.Trade, a hybrid perpetuals and spot exchange on the Sonic blockchain
industry
Digital asset trading infrastructure
what we built
Exchange backend engineering
Matching engine
Smart-contract settlement
Trading frontend
Agent access design
outcomes
Off-chain CLOB matching engine with nine backend services over NATS JetStream
Solidity settlement contracts built with Foundry, backed by Redis hot state and PostgreSQL history
Market, limit, TP/SL, TWAP and SCALE order types with cross and isolated margin
p99 under 2.2ms order placement and about 750 orders per second in local prototype benchmarks

Clove.Trade partnered with Inscape Labs to build a hybrid decentralized exchange for perpetuals and spot trading on the Sonic blockchain.

Clove.Trade sets out to deliver a centralized-exchange-quality experience with on-chain settlement and custody where money moves. Traders should feel the speed of a centralized venue, while settlement and custody stay verifiable on chain.

That combination is hard to build. It needs an order book fast enough for active traders and a settlement layer trustworthy enough for on-chain money movement. Clove.Trade came to Inscape Labs to design and engineer both halves as one system.

The solution

Inscape Labs built an off-chain central limit order book (CLOB) matching engine for speed, paired with on-chain settlement for trust.

The backend is a set of nine microservices communicating over NATS JetStream, with Redis holding hot state and PostgreSQL holding history. Solidity settlement contracts, built with Foundry, handle the on-chain leg where custody and settlement happen.

The services cover the full exchange lifecycle:

  • API gateway exposing REST and WebSocket interfaces
  • Matching engine running the central limit order book
  • State manager using Merkle trees
  • Settlement service bridging to the on-chain contracts
  • Risk and liquidation engines for margin safety
  • Oracle, funding and market data services

Traders get market, limit, TP/SL, TWAP and SCALE order types, cross and isolated margin, multi-asset collateral, and vaults for custody and managed liquidity strategies. A governed MCP agent-access layer is designed in as a product pillar, not a later add-on, so agents can interact with the exchange through permissioned interfaces. The trading frontend is built in Next.js.

The results

The prototype demonstrates the hybrid thesis in working software. In local benchmarks, order placement runs at p99 under 2.2ms and roughly 750 orders per second, with settlement moving on chain.

The build ships with the engineering to back it: 108 test files, a Go SDK, a market-maker bot and load testing. The nine-service backend, the Solidity settlement contracts and the Next.js frontend give Clove.Trade a foundation that covers matching, settlement, risk and agent access in one codebase.

Inscape Labs continues to partner with Clove.Trade as the exchange moves from prototype toward production.

start here

Tell us what should exist.

Bring the process that is too important to leave manual and too specific for generic SaaS. We will map where AI belongs, where it does not, and what software should exist around it.