The Gnosis Dutch Exchange #5
When introducing the Gnosis Dutch Exchange, we’ve shown that the current implementation of order book based centralized and decentralized exchanges face some major shortcomings: The high risk of loss of funds, difficulties for less liquid markets, and practices like front-running.
We’ve demonstrated that the mechanism of the Gnosis Dutch Exchange remedies these drawbacks: it allows for a fair price finding mechanism that encourages participants to reveal their true willingness to pay and eliminates front-running, a major problem that both order book based centralized and decentralized exchanges are facing. Front-running is the advantage of someone being able to act on information that is available to them first (e.g. miners who can decide in which order they are putting transactions into a block, and in which block they’re putting the transactions into).
In the first state of the DutchX, when sellers deposit their sellTokens, they potentially have more than 6 hours to do so. This reduces the emphasis on which block their sellOrder is mined. Bidders, being active in the second state when the auction is running, have a similar advantage: The price function decreases so slowly that the price will not significantly change over the course of a number of blocks. The price for all sellers and the price for all bidders will be the same — making it irrelevant at which point their transaction is mined. The exchange itself also cannot act on information ahead of time: the smart contract code of the DutchX matches automatically and on-chain.
Hence, with batched orders entering the block at the time the auction clears with the same price for all bidders and sellers, neither miners nor the exchange itself, or other participants will be able to game the system.
The traditional order book model of a centralized exchange, which is a continuous auction model executing orders one-by-one, seems inadequate to be implemented on the blockchain — it even amplifies the front-running problem. There is no continuous time on the blockchain, there is only block time! On the one hand, this leaves more time to front-run, but on the other hand, it also allows for more parties to front-run due to already publicly available information (before the transaction is executed).
The DutchX implements an entirely different design which is more suitable to the technological environment of the blockchain, and results in a number of additional benefits compared to other decentralized exchanges.
Price Volatility and Fairness
In the Gnosis DutchX, you may consider sell orders as slowly executed, safe market orders and bids as limit orders. As the smart contract batches sell orders and executes these at once, there is only one market clearing price. This means that it is safe to include market orders of any size without quick price movements (“slippage”), i.e. triggering order book spikes as known from traditional order books.
Many decentralized exchanges do not match orders automatically, resulting in overlapping orders in the order book and thus creating arbitrage opportunities. This often is facilitated by the time lag when cancelling orders. Again, due to the automatic on-chain matching with one clearing price, this cannot happen on the DutchX. On the DutchX, essentially, there is no spread between bids and asks!
There is a lot to say about gas costs. To keep it short: Gas costs on the DutchX are very similar to other decentralized exchanges currently live.
However, three aspects make the Gnosis DutchX attractive from a gas point of view:
- There is no cancellation of orders, as all orders are executed. Hence, users will not incur transaction costs based on having to cancel a standing order.
- The participant can choose a low gas price: sellers (and in many cases bidders, too) are not in a rush to execute their trade given the slow execution time.
- Participants of the DutchX face no risk of incurring gas costs due to traders trying to fulfill the same order. Usually, the “slower” order will have to be cancelled but the participant still incurs gas costs while not having their order executed.
Usability of other Smart Contracts
One particularly unique aspect of the DutchX is the usability by other smart contracts. Concretely, smart contracts may also have the need to convert a specific type of token into another. Most other decentralized exchanges require to either sign an order off-chain or receive a signed order off-chain and then submit it to the blockchain. A smart contract can do neither. Even with a decentralized exchange based on an on-chain order book, the smart contract would need to implement a strategy on how to place the order. This might be challenging on-chain.
On the DutchX, everything is done on-chain: from placing orders to their execution. In addition to that, participation does not require any special strategy.
While order book based exchanges, both centralized and decentralized, work quite well for liquid markets, they aren’t an optimal model for illiquid markets. Within an order book based exchange, an order will only be fulfilled if a bid price matches an ask price or vice versa. Hence, traders may end up not being able to make a trade since their highest bid might still be lower than the lowest ask.
With illiquid markets, order book based exchanges result in large spreads and high slippage (quick price movements), on top of the regular volatility that already comes with cryptocurrencies.
Due to the aforementioned batching of sell orders in the DutchX, prices are less volatile and the exchange may be more suitable for less liquid markets. However, even the DutchX mechanism isn’t well equipped for very little liquidity — a reason why we introduced thresholds.
Matching a Market Order with Multiple Limit Orders
Some decentralized exchanges have difficulties matching one market order with multiple limit orders. The mechanism of the DutchX is designed in a way that the batching of sell orders (and bids) with the execution of one single clearing price circumvents this problem altogether.
As described in detail in our last blog post, fees paid in the participating Token on the DutchX remain in the DutchX! Fees remain and are redistributed within the exchange’s ecosystem, and do not go to Gnosis or any other specified party. Frequent and high-volume traders will become the main beneficiaries of the exchange: They are able to a) reduce their fees, and b) even benefit from being credited part of the total fees thanks to a redistribution model, effectively gaining ownership of the exchange.
Beyond the Exchange of Tokens
Finally, the DutchX may even add value beyond the mere exchange of tokens: The DutchX may function as a reliable, on-chain price feed: As mentioned, the mechanism should lead to a fair market price for tokens. Price stability increases due to batching orders and executing them with a single market clearing price. The DutchX could thus be used by other smart contracts as a price oracle.
Outlining its advantages in detail, the mechanism design and sound benefits of the DutchX of course come at the expense of speedy trading: high frequency traders will surely not be one of the DutchX’s user groups. On this note, stay tuned for our next blog post where you’ll learn more about the different user groups and how they each have their unique advantages in the Gnosis DutchX!
Thanks to Christiane Ernst and Martin Köppelmann.
<div class="infobox"><span class="appendinfo">This article was originally published on: <a href="https://blog.gnosis.pm/" target="_blank">The Gnosis Blog</a> on </span></div>