Skip to main content

Decentralizing DEX

Traditional DEX architectures typically utilize a combination of on-chain and off-chain components to optimize for speed, cost-effectiveness, and user experience. A common setup includes:

  • Frontend: Often hosted on centralized services like AWS Amplify.
  • Wallet Integration: Wallets may also use centralized services for backend operations.
  • Orderbook and Matching Engine: These crucial components are frequently managed off-chain using centralized databases and compute instances (e.g., AWS EC2 and Lambda).

This architecture exposes DEXs to potential risks such as governmental interference or centralized service failures, making them vulnerable to deplatforming.

DEX Transaction with Off-Chain Components

To exemplify how vulnerable traditional DEX architecture is, let's explore the step-by-step transaction process with off-chain components:

  1. User Interaction: First, the user clicks a button in the DEX interface, typically hosted on a centralized platform like AWS Amplify.
  2. Wallet Connection: This action connects the user's wallet, which is often hosted on a centralized cloud service, to the DEX.
  3. Transaction Request: The wallet's backend sends a transaction request to the blockchain via an RPC provider node. At this step, decentralized options such as Lava Network are available.
  4. Blockchain Interaction: The chosen blockchain (e.g., Ethereum) processes the transaction. An external compute instance, such as AWS EC2, listens for this transaction to be validated.
  5. Writing to the Off-Chain Orderbook: Once the blockchain validates the transaction, the EC2 instance triggers an AWS Lambda function (or equivalent) to record the order in an off-chain orderbook, typically stored in a centralized database like AWS DynamoDB.
  6. Order Matching: After the order is logged in the orderbook, the Lambda function notifies a "leader" compute instance. This instance then delegates the task of matching the order with other existing orders to another EC2 instance.
  7. Execution of Matched Orders: When a match is found, the matching engine submits the matched orders as a new transaction to the blockchain for execution and finalization.
  8. Updating User Balances: After the blockchain executes the orders, the user's wallet interface updates to reflect the new balances from the executed swap.

As described, several of the above steps are dependent on centralized infrastructure, which increases the vulnerability.

The Versatus Solution

Versatus offers a fully decentralized architecture powered by its suite of core cloud services. Each service is designed to replace a centralized counterpart in traditional architectures, ensuring equivalent functionality and performance. The core services provided by Versatus include:

  • Versatus LASR: The Language Agnostic Stateless Rollup, which supports multiple programming languages.
  • Versatus Allegra: A solution for decentralized service integration and management. It handles all aspects of decentralized infrastructure to ensure seamless operation and scalability for your applications. Key features of Allegra include:
    • Service integrations across decentralized platforms.
    • Hosting for decentralized content and applications.
    • Functions-as-a-service framework.
    • Auto-scaling compute solutions.
    • CDN and DNS routing.

The major distinction lies in the shift from centralized to decentralized components across the DEX stack. Instead of relying on centralized frontends like AWS Amplify, DEXs can use Versatus Symphony for hosting, which is decentralized and resistant to censorship. In addition, with Versatus Forte and Allegra, the order-matching process remains off-chain and is powered by decentralized computing resources, eliminating reliance on centralized databases and cloud providers.

The Versatus services allow DEXs to retain their operational efficiency and speed while significantly enhancing their resilience and censorship resistance. As a result, DEX would have the following benefits:

  • Enhanced Security and Resilience: Reduces the risk of service interruptions caused by external controls or failures in centralized infrastructures.
  • Censorship Resistance: By decentralizing every layer of the stack, DEXs become more robust against nation-state actions and regulatory pressures.
  • Scalability and Fault Tolerance: Decentralized auto-scaling and fault-tolerant services ensure that DEX operations can scale efficiently without compromising on security or performance.