Comment on page
Hybrid Orderbook AMM Design
Examining Vertex's unique technical stack.
Vertex’s exchange model fuses a fully on-chain trading venue and risk engine at the protocol level with an off-chain sequencer layered on top to form a hybrid orderbook-AMM DEX. The on-chain trading and risk engine contains Vertex’s core products, including spot, perpetuals, and money market – controlled by the Vertex protocol smart contracts on the Arbitrum layer.
The sequencer functions as a high-performance orderbook for matching inbound orders fed into the protocol layer with extremely low latency. Vertex’s on-chain clearinghouse operates as the hub combining perpetual and spot markets, collateral, and risk calculations into a single integrated system.
Converging an AMM and orderbook forms the basis of a unified trading stack with vertically integrated DeFi primitives as its core products on-chain.
Each component of Vertex’s trading stack coalesces into a powerful on-chain trading platform. Limitations of siloed DEX models popular among incumbent DeFi protocols are minimized while their strengths amplify one another within a single exchange venue.
The resulting hybrid orderbook-AMM DEX maximizes advantages across performance, flexible liquidity expression, and a diverse product suite. Rendering an accurate display of the specific design considerations and subsequent benefits of the Vertex DEX requires dividing the hybrid orderbook-AMM model into three core pillars:
- A fully on-chain trading venue (constant product AMM) – protocol level.
- A fully on-chain risk engine – protocol level.
- An off-chain sequencer for order matching.
Individually, each pillar reflects a core element of any DeFi exchange venue.
Conceptual overview of the Vertex technology stack.
Threaded together with an EVM-compatible clearinghouse (i.e., on-chain risk engine), the core pillars produce a default cross-margined DEX on Arbitrum where users don’t have to sacrifice the control of self-custody for the performance and vibrant product features of CEXs.
Vertex’s integrated AMM utilizes a xy=k algorithm at the outset and will eventually implement leveraged LPs, further enhancing liquidity alongside the vAMM for perpetuals.
The integrated AMM is located on-chain – housed within the protocol layer. The on-chain AMM functions as the default state of the protocol controlled at the smart contract level, known as “Slo-Mo Mode.”
The pooled liquidity of the AMM sits alongside the bids and asks on the Vertex orderbook, effectively another market maker contributing to liquidity via smart contracts rather than API.
The AMM liquidity is combined with liquidity from automated traders via the sequencer, and users trade against this unified source of liquidity.
Conceptual graphic displaying how pairwise LPs populate the orderbook.
Trades are always executed at the best available price, meaning a trade could fill against limit orders and LP positions concurrently as the sequencer automatically sources the best liquidity available.
Example scenario of pairwise LPs populating the orderbook to fill a trade at the best available price.
As a result, Vertex maintains several unique liquidity advantages, including:
- There will always be some liquidity to clear trades.
- Markets can be seeded with more passive liquidity but also have more flexibility with limit orders – this benefits both illiquid and liquid assets.
- Traders can always trade directly on-chain without using the sequencer if they wish.
The existence of the on-chain AMM also empowers users with two of the core value propositions of AMMs. Namely:
- The ability to passive LP asset pools and earn trading fees.
- Long-tail DeFi asset support for less liquid tokens.
AMM transactions on Vertex also come with lower gas fees than Ethereum L1 – a product of the AMM functioning at the Arbitrum protocol layer.
As Vertex expands multi-chain in V2, the AMM can list native spot assets of other EVM-compatible chains integrated with Vertex – broadening the scope of asset trading more closely, echoing the CEX experience popular with many retail traders.
The Vertex AMM is supplemented by the sequencer orderbook off-chain, which provides a low-latency alternative central-limit orderbook (CLOB) for traders looking to place limit orders, access faster trading, and execute automated trading strategies. Since the pairwise LPs from the AMM populate the orderbook, the liquidity of trading pairs is mutually enriched.
The Vertex sequencer is a central-limit orderbook (CLOB) located off-chain as an independent node, which will eventually be decentralized via Vertex governance.
The orderbook is Vertex’s primary edge in the context of a performant trading engine. Liquidity is augmented as positions from pairwise LP markets populate the orderbook. An HFT-friendly API enables traders to plug into the orderbook, execute automated trading strategies, and trade against the combination of the orderbook and AMM’s liquidity at lightning-fast speeds.
The on-chain latency of distributed node consensus does not constrain performance. Instead, it’s competitive with CEX-grade trading engine speed – achieving average order-matching execution speeds between 10 - 30 milliseconds (ms).
In the case of maintenance, downtime, or other unforeseen circumstances, the AMM layer on-chain functions as the backstop of the protocol, enabling users to trade solely against the AMM without needing the orderbook.
This functions as an essential pathway for users, where transactions always settle on-chain no matter the state of the sequencer.
For example, if the sequencer goes down, instead of CEX-like order book performance and liquidity, you’d get a Uniswap-style experience but with cross-margined accounts for spot, perps, an integrated money market, and lower fees on Arbitrum.
Initially, the sequencer will operate as an independent node run by the Vertex team, with a TPS of 15K and latency time of 10 - 30 ms.
The Vertex sequencer maintains various properties that are important to define.
- Sequencer order book operates similarly to a centralized exchange: Traders can place orders with the sequencer’s order book on a scale similar to centralized exchanges, receiving order feedback with comparable latency to centralized exchanges based on accurate optimistic states – analogous to Arbitrum as an ETH L2.
- Limit on validator's ability to modify trades: Validators on the underlying chain (Arbitrum’s L2 for ETH) cannot reorder or front-run transactions. Traders on Vertex are safe from validator MEV on the underlying blockchain.
- The sequencer has no custody over user assets: Asset custody is controlled at the smart contract level on the underlying chain Arbitrum (Slo-Mo Mode). The sequencer cannot censor transactions either; users can force their transactions to be included on Arbitrum. Vertex’s default state is always the on-chain AMM – not the sequencer.
- The sequencer also has no ability to stop trading or withdrawals: Users can still trade (on the AMM) and withdraw by going directly to Arbitrum.
- Users do not need to trust the sequencer to report accurate optimistic states: Users can wait for confirmations directly on the underlying chain – Arbitrum.
- MEV Protection: Vertex's sequencer operates on millisecond timescales (<20ms for a response), rendering MEV extraction less valuable. A general trade-off exists between latency & MEV ability.
Arbitrum, as an L2 on Ethereum, also minimizes MEV since it periodically submits batches of transactions to Ethereum L1. As a result, in both contexts where Vertex is either functioning with an off-chain sequencer or in its default on-chain state, MEV is minimized, mitigating one of the key shortcomings of on-chain DEXs.
Risk checks for matching orders are conducted on the sequencer level instead of on the Arbitrum chain to minimize transaction costs for users.
Note that only the sequencer is able to match orders, and all other actions, such as withdrawing collateral, liquidating an account, or swapping against the AMM, require risk checks to happen on-chain.
Orders still require explicit signatures from both parties to be executed on-chain.
At the moment, this is a necessary trade-off for the initial stages of Vertex. In the future, as the Vertex sequencer becomes decentralized, this will no longer be necessary.
During Slo-Mo Mode, users can still swap assets, open and close perp positions, and interact with the rest of the Vertex protocol, just with increased latency and tighter liquidity analogous to trading on Uniswap with more slippage and wider spreads susceptible to larger market-moving orders.
- The sequencer orders transactions but cannot forge them and does not have custody of user assets. Users can automatically fall back to the decentralized smart contracts on Arbitrum. Funds are never at risk.
- Vertex’s performance is on par with centralized exchanges.