Extended Logo

Extended Architecture

8 min

What's Extended's architecture?

Extended operates as a hybrid Central Limit Order Book (CLOB) exchange. While order processing, matching, position risk assessment, and transaction sequencing are handled off-chain, trade settlement occurs on-chain through the StarkEx Layer 2 engine.

schema of architecture

StarkEx, built by Starkware, is a battle-tested scalability solution that brings lightning-fast transaction processing to the forefront, guaranteeing an unparalleled trading experience. This is achieved while preserving complete trustlessness and transparency through three key mechanisms embedded into StarkEx:

  • On-chain validations of the trading logic ensure that fraudulent or incorrect transactions, including liquidations, contrary to the on-chain trading logic are never permitted.
  • The mark prices, which determine the liquidability of positions, are obtained from multiple independent oracle providers to prevent potential price manipulation and ensure fair and accurate asset valuation within our ecosystem. Extended utilizes 5 Stork nodes to define the median mark price.
  • Publication of zero-knowledge (ZK) proofs on the Ethereum Layer 1 blockchain validates Layer 2 transactions, ensuring both their integrity and security.

For deeper insights, explore Starkware's comprehensive documentation.

Why CLOB? 

In simple terms, while the Central Limit Order Book (CLOB) stands out as the most efficient model, offering liquidity, capital efficiency, and an exceptional trading experience across all market conditions and assets, all alternative designs for a perpetuals exchange discussed below come with fundamental drawbacks.

Pool-based model

In the pool-based model, exemplified by platforms like GMX, liquidity providers (LPs) contribute assets to a liquidity pool, which serves as a counterparty to traders. When a trader on such an exchange takes a long position on a given asset, all LPs automatically take on a short position corresponding to their stake. Consequently, if a trader makes a profit, LPs experience losses proportionate to their stake, and vice versa. 

If the mechanics of the liquidity pool fail to appropriately value the liquidity offered to traders, it can result in a scenario where profitable trading depletes the pool's assets, leading to negative APR for liquidity providers and less liquid trading conditions.This, in turn, results in fewer traders choosing the exchange, further decreasing APR and prompting unstaking from liquidity providers. This cycle then repeats, perpetuating the liquidity challenge.

Virtual AMM (vAMM)

The vAMM model operates similarly to regular AMMs, using the constant product formula x*y=k. However, instead of trading actual assets, users trade a virtual exposure to assets with leverage. In this model, users trade against a vAMM pool. When a user opens a position, the price in the virtual AMM pool changes according to the formula x*y=k.

Unlike CLOB models where short and long open interest always balance out, in the vAMM model, the difference between short and long open interest determines the deviation from the pool opening price. In bullish market conditions, where the market price of the asset is expected to increase, the pool price can only rise if more users take long positions and keep them open. The farther the asset price moves from the pool opening price, the more long open interest is needed to sustain it there.

In the vAMM model, the funding payment aligns the pool price with the mark price. The higher the required open interest, the higher the payment needs to be to attract more capital. Given the imbalance between short and long open interest (long-short skew), the insurance fund steps in to pay the funding.

The fundamental issue with this model was highlighted in the example of Perpetual Protocol v1 during the market downturn of spring 2022. The protocol faced a drain on the insurance fund due to a long-short skew and abnormally large funding payments, ultimately leading the team to move away from this model.

Dynamic AMM (vAMM)

Dynamic AMM, an extension of the vAMM model, operates on pools with concentrated liquidity, such as Uniswap V3. While this model effectively addresses the vAMM's concerns regarding long-short skew and insurance fund drainage, it brings about new challenges. These challenges include impermanent loss, heightened complexity, and elevated costs associated with providing liquidity. Particularly in highly volatile or one-sided market conditions, these challenges become more pronounced. As a result, market liquidity is limited, resulting in a suboptimal trading experience.

Why Hybrid?

The decision to adopt a hybrid model for Extended is a strategic design choice aiming to overcome the limitations of both fully centralized and decentralized on-chain order book models:

  • Challenges with Centralized Exchanges: Traditional centralized exchanges pose risks due to custodial control over user funds, lack of real-time transparency, and susceptibility to trading manipulation. The principle of 'not your keys - not your coins' emphasizes the vulnerability of funds held on centralized platforms.
  • Challenges with On-chain Order Books: On-chain order books face issues like the risk of front-running and inherent latency from blockchain transaction validation by multiple parties. Fully decentralized exchanges struggle to match the performance of centralized exchanges, which is crucial for liquidity and price stability.

Extended's hybrid model leverages the strengths of both centralized and decentralized components:

  • On-chain Settlement with Validations and Oracle Prices: Extended settles each trade on the blockchain and on-chain validations of trading logic ensure the prevention of fraudulent or incorrect transactions. Additionally, mark prices sourced from multiple independent oracle providers mitigate the risk of price manipulation.
  • Off-chain Trading Infrastructure: Off-chain order matching and risk engines, combined with a unique settlement architecture, deliver remarkable performance in terms of throughput, end-to-end latency, and order settlement. This performance is comparable to centralized exchanges and superior to other hybrid exchanges or decentralized exchanges (DEXs).

Extended's hybrid model strikes a balance by offering the security and transparency of decentralization without compromising on speed and efficiency.

Why StarkEx? 

As mentioned above, Extended is powered by the StarkEx Layer 2 engine, chosen for two key reasons:

  • Zero-Knowledge (ZK) Rollup: We place our trust in ZK rollups for Layer 2 scaling solutions. Unlike optimistic rollups, ZK rollups offer superior technology by achieving finality without relying on optimistic assumptions. This implies instant withdrawals from ZK rollups (unlike the fraud window with optimistic chains) and eliminates the risk of ZK rollup reorgs - all transactions settled on ZK rollups are final.This makes ZK rollups more scalable, secure, and reliable in the long run. StarkEx, in alignment with our beliefs, utilizes ZK rollups to validate Layer 2 transactions.
  • Battle-Tested Solution: StarkEx currently stands as the most battle-tested solution in the market. For our MVP, it serves as a perfect ready-to-go solution, enabling us to achieve the desired performance while ensuring transparency and safety without the risk of failure and execution risks.

What can Extended offer today? 

Thanks to the following features, Extended offers end-to-end performance comparable to centralized exchanges and superior to other hybrid exchanges or decentralized exchanges:

  • Optimized Hybrid Model: Extended seamlessly integrates centralized and decentralized components with unique settlement architecture, ensuring instant finality.
  • Enhanced Off-Chain Order Matching and Liquidation Algorithms: Extended employs parallelized execution and highly efficient messaging protocols for off-chain order matching and liquidation processes. 

As a result, Extended aims to have latency on-par with the centralized exchanges.

latency comparison

What’s Extended long-term vision?

Built with a long-term vision, Extended ensures seamless migrations within weeks, thanks to the agile facilitation of the Sequencer, managing all exchange operations and efficiently transmitting them to the chain. Our future roadmap includes transitioning from StarkEx to our proprietary zero-knowledge dappchain, finely tuned to meet the evolving demands of our expanding product. This custom-designed dappchain is a cornerstone of our strategic approach, emphasizing adaptability and precision in catering to dynamic requirements.

Share article

© 2024 Extended. All rights reserved