โกDEX Architecture & Design
Unpacking the distinct technical architecture of the Blitz DEX and how it functions alongside Vertex Edge's Synchronous Orderbook Liquidity.
Last updated
Unpacking the distinct technical architecture of the Blitz DEX and how it functions alongside Vertex Edge's Synchronous Orderbook Liquidity.
Last updated
Blitzโ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 Blitzโs core products, including spot, perpetuals, and money market โ controlled by the Blitz smart contracts deployed natively on-chain to Blast.
The off-chain sequencer functions as a high-performance orderbook for matching inbound orders fed into the protocol layer with extremely low latency. Blitzโ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 Blitzโ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 Blitz 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 and synchronous orderbook liquidity for cross-chain trading -- Vertex Edge.
Individually, each pillar reflects a core element of any DeFi exchange venue.
Threaded together with an EVM-compatible clearinghouse (i.e., on-chain risk engine), the core pillars produce a default cross-margined DEX on Blitz where users donโt have to sacrifice the control of self-custody for the performance and vibrant product features of CEXs.
Users can also wield the power of unified cross-chain liquidity, where liquidity between chains connected to Vertex Edge becomes additive and synergistic instead of fragmented.
Blitzโs integrated AMM utilizes an x * y = k
algorithm at the outset.
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 Blitz 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 off-chain sequencer, and users trade against this unified source of liquidity.
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. With Vertex Edge, this means the sequencer sources the best liquidity available from the combined, resting liquidity profile of both:
Vertex on Arbitrum
Blitz on Blast
As a result, Blitz 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 Blitz also come with lower gas fees than Ethereum L1 โ a product of the AMM functioning at the Blast L2 protocol layer.
As Vertex Edge expands the scope of cross-chain Vertex instances, the scope of asset trading becomes broader, more closely echoing the CEX experience popular with many retail traders.
The Blitz 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, with plans to decentralize the sequencer on the Vertex product horizon for 2024.
The orderbook is Blitzโs primary advantage 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 blazing-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 5 - 15 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 the Blast L2.
Initially, the sequencer (i.e., Vertex Edge) will operate as an independent node run by the Vertex team, with a TPS of 15K and latency time of 5 - 15 milliseconds.
The off-chain sequencer maintains various properties that are important to define.
Sequencer orderbook 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 Blast as an ETH L2.
Limit on validator's ability to modify trades: Validators on the underlying chain (Blast's L2 for ETH) cannot reorder or front-run transactions. Traders on Blitz 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 Blast (Slo-Mo Mode). The sequencer cannot censor transactions either; users can force their transactions to be included on Blast. Blitzโ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 Blast.
Users do not need to trust the sequencer to report accurate optimistic states: Users can wait for confirmations directly on the underlying chain โ Blast.
MEV Protection: Blitz's sequencer operates on millisecond timescales (<20ms for a response), rendering MEV extraction less valuable. A general trade-off exists between latency & MEV ability.
Risk checks for matching orders are conducted on the sequencer level instead of on the Blast 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.
03/11/2024: To reduce gas / calldata costs for matched orders submitted on-chain, order signatures will only be verified on the sequencer level. To independently query and verify signatures off-chain, you can hit the archive serviceโs signature registry, and ensure that the signatures are valid for each digest. The archiveโs API signature endpoint is below, which will return the unique signature for every order submitted to the chain.
As the off-chain sequencer layer becomes decentralized soon in Vertex V2, along with more cross-chain instance support via Vertex Edge, the sequencer level signature verification will happen across many validators.
At the moment, this is a necessary trade-off for the initial stages of Vertex Edge and Blitz. 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 Blitz DEX, just with increased latency and tighter liquidity analogous to trading on Uniswap with more slippage and wider spreads susceptible to larger market-moving orders.
Key Takeaways:
The off-chain sequencer (Vertex Edge) orders transactions but cannot forge them and does NOT have custody of user assets. Users can automatically fall back to the decentralized smart contracts for Blitz deployed natively on-chain to Blast. Funds are not at risk from the sequencer.
Blitz's blazing-fast performance is on par with centralized exchanges.