> For the complete documentation index, see [llms.txt](https://docs.nerox.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nerox.ai/nerox-overview/architecture.md).

# Architecture

NeroX routes trading requests through a distributed access layer to a cluster of specialized services that handle wallet security, market execution, and settlement on-chain. Trade queries are processed by elastic, stateless workers that interact directly with decentralized liquidity pools and token platforms, ensuring high throughput and transparent execution.

***

### Data Acquisition Layer

Trading data flows through a multi-layered request system designed for low latency and integrity:

Regional Gateways: User requests (REST, WebSocket, gRPC) are received by regional gateways positioned for jurisdictional compliance. These gateways handle authentication, anti-abuse checks, protocol translation, and request validation. They support multiple wallet connection methods (MPC-based, hardware, browser extensions) and buffer requests during downstream congestion.

High-availability routing: An intelligent routing layer distributes orders to healthy matching engines using real-time node health monitoring. Failover ensures that if a primary engine is unavailable, requests are rerouted automatically or queued in a backlog for execution when services recover.

Streaming Pipeline: Order data and price feeds are processed in real time, validated, and normalized. Risk checks, position limits, and compliance rules are applied at this stage.

Transaction Logging: All order requests and signatures are durably recorded in a distributed database-like log before execution. This guarantees auditability, zero data loss, and ensures trade replayability if failures occur.

***

### Storage architecture

NeroX maintains a hybrid on-chain/off-chain storage system for performance and transparency:

On-chain storage: Trades, settlements, and critical user balances are anchored to smart contracts for verifiability.

Off-chain storage: Market depth, historical trades, and analytics data are stored in a high-performance columnar database optimized for financial time-series.

Compression pipeline:

* Transaction execution: Sending on-chain transactions in near real time (3-5x reduction).
* Block compression: Transaction/Block compressed in data warehouse for queries (10x reduction).
* Archival tiers: Older data automatically migrated to cheaper storage tiers with lifecycle management.

***

### Execution architecture

NeroX executes trades with an elastic, microservices-based execution layer:

Order Compilation: User trades are parsed, validated, and transformed into execution plans. The system applies gas optimization, slippage controls, and best-execution routing across DEXs, or internal liquidity pools.

Serverless Matching Workers: Trades are executed by ephemeral workers that spin up on demand. Workers interact directly with blockchain nodes, signing transactions via MPC without exposing private keys.

Parallel Execution: Orders are distributed across multiple matching engines for high throughput. Each engine processes its subset of pools independently, enabling scale-out performance.

Result aggregation: Execution results (fills, reverts, confirmations) are streamed back to clients via WebSocket and persisted in off-chain databases.

Intelligent Caching: Market data snapshots and aggregated data views are cached in object storage and memory grids, reducing latency for repeated queries.

***

### Security & Key Management

A Multi-Party Computation (MPC) system secures private keys:

* Keys are split into shares and distributed across independent servers/devices.
* No single party holds the full key, preventing theft.
* Threshold signing allows collaborative execution without reconstructing the key.
* Policies align with organizational governance and compliance.

This ensures resilient custody while enabling a seamless user experience.

***

### Governance & Risk Layer

* Risk Engine: Performs real-time execution, leverage, and balance checks before trades execute.
* Compliance Engine: Enforces data security policies, regional restrictions, and reporting.
* Orchestration Layer: Coordinates distributed workers, monitors system health, and triggers automatic failover.

***

### Architecture Benefits

* Security first: MPC key management removes single points of failure while ensuring user-friendly custody.
* Cost efficiency: Hybrid storage, elastic compute, and caching reduce infrastructure and gas costs.
* Operational simplicity: Automatic failover, distributed routing, and background maintenance minimize manual operations.
* Elastic scale: Ingestion, execution, and storage scale independently to handle spikes in trading volume.
* Transparency & trust: On-chain settlement, audit logs, and compliance checks ensure verifiable and fair execution.
* Performance: Low-latency routing, parallel execution, and caching enable sub-second trade confirmations.

NeroX’s architecture allows tens of thousands of executions per second while ensuring secure custody, transparent execution, and business-grade compliance for Web3 trading.

<br>
