What Sets Equilibrium’s DEX Apart From The Rest?

Aug 11 · 8 min read

Decentralized exchanges (DEXes) emerged to fill the need for separating the custody of user funds from actual trading and settlement. Earlier solutions to this problem took that separation quite literally, creating fully on-chain models where orders interacted directly with each other. This approach allows for maximum decentralization, but it comes at the expense of the transaction throughput of the underlying blockchain, as well as the cost of performing all of the order management (placing, modifying, and canceling), as network fees need to be paid.

Naturally, this further evolution introduced a new class of DEXes where the order book was taken off-chain. In these systems, orders are broadcasted off-chain and a smart contract does the matching on-chain. This approach led to fewer transactions on-chain, but still introduced issues like front-running, transaction failures, and expensive order modification and cancellation — these actions must be validated on-chain.

Another drawback was the inability to support complex order types, like stop loss. Don’t you want your exchange to support stop loss orders?

Separating matching from settlement

Something else had to be done, so projects like IDEX emerged — they separated order matching (trade execution) from actual fund settlement. For example, trades happen off-chain in real-time, but they settle on-chain at the speed of the underlying blockchain network.

A key aspect of this design is that users deposit their funds in a smart contract, which acts as escrow and ensures that users have sufficient funds at the time of the off-chain execution as well as the on-chain settlement. This setup has its own drawbacks, primarily that each trade is settled on the blockchain one by one, so it’s not scalable in terms of transaction costs and storing data on-chain.

Layer 2 scalability

The newest thing in the DEX world these days is a layer 2 scalability solution that handles order management and trade settlement. If we look at a layer 2 system on a high level, that system compresses off-chain data (in our case, order matching data) into a unique set of bytes (called Merkle roots). These Merkle roots of the off-chain state are then stored and verified on-chain.

This approach has several advantages compared to fully on-chain solutions, like reduced transaction fees, faster settlement times, reduced minimum trade sizes (as a consequence of lower fees), improved user experience comparable to centralized exchanges, faster price oracles, and higher leverage as a result.

Here is a table that generally summarizes different approaches to building DEXes as we’ve described above.

Equilibrium’s DEX and its advantages

Our DEX has a number of strong advantages that stem from its robust technology:

  • Polkadot’s “blockchain of blockchains” approach allows for interconnecting different blockchain networks and their underlying assets, expanding the DEX asset universe to many different blockchains and parachains.
  • Substrate’s design and scalability let Equilibrium build a decentralized exchange that matches the performance of its centralized counterparts.
  • Equilibrium’s risk engine, oracle, and assets module allow for making tradable derivative contracts on real world financial instruments (like perpetual swaps).
  • Our lending platform will serve as a robust source of liquidity for margin trading and DEX will be highly leveraging its capabilities.

How we solve drawbacks of the fully on-chain approach

We will build our fully on-chain exchange first since we want to make the exchange margin engine an integral part of our borrowing and lending protocol. We considered the drawbacks of the fully on-chain approach described above, and here’s how we will tackle them:

  • Placing or modifying an order requires paying transaction fees. Equilibrium has an ability to “weigh” the transaction fees of each public method inside the blockchain, so we will minimize order management fees or even set them to zero. With zero fees, however, we want to restrict users from spamming a blockchain with orders or flashing. One solution is to introduce rate limits that depend on staked EQ amounts.
  • Settlement is slow: In Equilibrium, each block is 6 seconds long. This is a fair amount of time to still be comfortable from a UI perspective, as trades will settle once per block. Yet we do have a capacity to further reduce the block length by optimizing transaction lengths and working more efficiently with on-chain storage.
  • Not scalable: This is a concern that comes with a growth of transaction volume on our exchange, as scalability is limited by our blockchain’s capacity, Equilibrium currently can handle 1,000 transactions per block on average. There are ways to overcome the scalability issue by using the previously mentioned layer 2 solution on top of the substrate off-chain worker technology, where we move order matching and trade settlement off-chain and make balance updates in batches on-chain.

Margining at the Equilibrium’s DEX

To further address margining, how it works, and how relates to collateralization, just remember these facts:

  • Trading on margin involves borrowing something you don’t own or entering into a derivative contract. You might borrow a stablecoin to buy Bitcoin or borrow Bitcoin to sell it short. You might also agree to pay the margin difference between the entry price and the current market price of a contract’s underlying asset, every settlement period.
  • Your margin is affected by your total collateral, total debt, and your active orders sitting in the order book. Specifically,
*account margin equals your assets (collateral) less your liabilities (debt) less any margin you’ve used up for active orders.
  • When the current account margin falls below maintenance margin, you have 24 hours to top your account back up to the initial margin level, or you can cancel orders to free up some of the order margin. If you fail to do so, the system will first try to cancel your orders. If there still isn’t enough margin, it will liquidate your account.

Let’s consider some concrete examples of buying and selling on margin.

Buy example:

Let's say a user initially brought $5,000 of margin to buy some Bitcoin and his portfolio looks like this:

Current margin: 5,000 USD
Current margin %: 100%
Collateralization: N/A (as the user doesn’t have any debt)

If the user buys 1 BTC at 30,000.00 USD, ignoring all the fees, then his portfolio now looks like this:

Current margin: 30,000 USD — 25,000 USD = 5000 USD
Current margin %: 5,000 USD / 30,000 USD = 16.67%
Collateralization: 30,000 USD / 25,000 USD = 120%

Sell example:

Now let’s consider another user who brought $5,000 USD worth of margin but now wants to sell 1 BTC for $30,000. After the sell, his portfolio looks like this:

Current margin: 35,000 USD — 30,000 USD = 5000 USD
Current margin %: 5,000 USD / 35,000 USD = 14.28%
Collateralization: 35,000 USD / 30,000 USD = 116.67%

When users short-sell crypto assets, they borrow them from the bailsman pool. The short interest in a particular asset is limited by the asset liquidity inside the bailsman pool times the coefficient. This is 40% by default. In simple terms, if the entire bailsman pool holds 10 BTC, users may collectively short up to 4 BTC inside Equilibrium DEX. The bailsman pool effectively acts as a lender and an insurance fund that absorbs liquidations of undercollateralized traders (borrowers).


There are several levels of margin inside Equilibrium that affect its liquidation mechanics. The current margin percentage of a trader’s portfolio is compared to each of the margin levels below in order to determine further actions:


Equilibrium’s DEX is a traditional order-book based exchange which supports double price auctions. Users and market makers provide liquidity in this setup by supplying limit buy and limit sell orders around their indifference price. To attract initial liquidity and make the DEX more efficient, Equilibrium will provide the following incentives both for traders and market makers as part of our liquidity mining program.

Market making: users can receive rebates in EQ tokens for generating trading volume on the DEX. Equilibrium will introduce tiers based on the relative volume — the maker volume as a percentage of the total exchange volume.

Active trading payouts: users can receive monthly payments in EQ tokens for being the most active traders and market makers. It could hypothetically be a quantity in EQ tokens proportional to the maker volume, paid periodically. There may also be an extra reward for the largest maker in the market by volume, for those markets that trade over some minimum volume each month.

We’ll announce the actual details on rebate figures and volume tiers by the time we release our DEX at the end of Q3 2021, but you now have an excellent overview of what we’re working on, even including some of the technical nitty-gritty. We’re passionate about using our know-how to unlock the full potential of the DeFi market, and Equilibrium’s decentralized exchange will represent a major demonstration of fintech abilities being unleashed. We’re excited to see what it becomes in time, and we’re grateful to have a community following us into the future.

Want to join Equilibrium’s DEX closed beta? Fill out the form below and get early access to the DEX!

Stay tuned for what’s next, we’ll be communicating every step of the way.

You can learn more about Equilibrium by checking other articles of our series:

  1. The Fundamentals Of Equilibrium
  2. Advantages of Equilibrium
  3. How Equilibrium’s Stablecoin Works
  4. Key Functionality of The EQ Token
  5. Bailouts: The New Normal For Managing Debt In DeFi
  6. Equilibrium’s Risk Model
  7. Equilibrium’s DEX
  8. Liquidity Farming
  9. Governance


Cross-chain Money Market


The first interoperable money market on Polkadot comprised of a lending platform and a professional-grade cross-chain DEX.


Written by

The 1st interoperable money market on Polkadot comprised of a lending platform and a professional-grade cross-chain DEX.


The first interoperable money market on Polkadot comprised of a lending platform and a professional-grade cross-chain DEX.