In one of our previous blog posts we have described the inner workings of GDAX, EtherDelta, 0x and Radex. By popular demand we present an architecture review of some other popular DEXs on Ethereum blockchain.
IDEX is one of the most used dApps on Ethereum blockchain. While they are certainly very successful in their own right, they do employ some dirty marketing tactics by calling themselves a decentralized exchange. They should be calling themselves a non-custodial exchange instead. Let me explain what I mean by that. To do so, we will need to understand how IDEX works under the hood.
Building good software is all about making the right tradeoffs. IDEX, to their credit, unlike many other projects describe the tradeoffs that they made and are upfront about what attributes they have optimized for. They explicitly state that the primary objective was to develop an exchange with the best UX.
The only decentralized aspect of their exchange is the deposit/withdrawal of funds. That is what I mean by non-custodial exchange. Unlike GDAX, IDEX does not store your money in their wallets. This means that hacking IDEX and stealing customer funds is impossible - one needs to hack every individual trader separately. Thus, at least in theory IDEX has better security than centralized exchanges.
However, trading on IDEX is completely centralized as every order goes through their service before being recorded on the blockchain. This provides a somewhat better user experience, indeed, but not much better than that of modern decentralized or hybrid counterparts. On the other hand this choice invites all the problems of dealing with a centralized trading engine: vulnerable to DDOS attacks, delisting tokens due to regulatory fears, and potentially censoring individual accounts (i.e. ban certain addresses from trading on their exchange).
Furthermore, because IDEX chose a very weird point on the decentralization spectrum, their operational costs are much higher than those of centralized exchanges, since every trade needs to be recorded on the blockchain, while they simultaneously have worse customer experience than Coinbase or Binance.
Ultimately, IDEX is an interesting experiment in dApp design, and I have no doubt that their architecture will inspire some other future dApps in other industries. In my personal opinion, long term their architecture is a bad fit for a crypto exchange and the current version of IDEX has no future as a product. Within 5 year timeline they will have to either rewrite the whole exchange and adopt a new architecture or perish.
Kyber is a decentralized interface to centralized exchanges. From a trader's point of view Kyber doesn't work like a trading platform, like Bitfinex or Binance. Instead, Kyber works more like a decentralized Shapeshift or Changelly. Conceptually, it works in a very simple way: trader that wants to exchange token A for token B receives a quote, if they like the price they send token A to kyber's smart contract and receive token B.
What I have just described is just the tip of the iceberg. It is much more interesting to find out what happens under the hood. Where does liquidity come from?
The liquidity comes from the so-called Reserve managers, which are simply funds operated by whales that buy cheap on centralized exchanges like Bitfinex or Binance, and sell for more to Kyber Network's customers. This allows Kyber to bootstrap its own liquidity from nothing. Once Kyber's volume becomes large enough their Reserve Managers will be able to employ more sophisticated pricing strategies and offer better prices.
Theoretically, Kyber says that multiple organizations can operate a Reserve Manager. In practice though, because of the trust required in the interface between Kyber's smart contract and the Reserve Manager's, the only RM currently in operation is Kyber's own. They are able to operate it using the funds that they have raised during their ICO.
As an exchange platform, Kyber may be convenient for a trader that wishes to use a DEX, but it lacks the incentive structure of a free market that forces the prices to move to competitive levels. The prices on Kyber are completely at their mercy and may not represent real market prices. I recommend checking other trading platforms for a quote first before trading on Kyber. If Kyber's price satisfies you it is a pretty convenient platform to do business with.
I do not recommend using Kyber as your only exchange, but rather as a supplement. For example, here at Saturn Network, we plan to use Kyber as one part of the solution to provide liquidity on Radex, via the use of Atomic Arbitrage trading bots.
Just like Kyber, Bancor isn't a professional trading platform with an orderbook of its own. It works in a very similar way for the end user - receive a quote, send token A to Bancor smart contract, receive token B in the same transaction.
Unlike Kyber, Bancor has a very different mechanism for providing liquidity. Instead of directly relying on centralized reserve managers, Bancor utilizes smart contract logic in order to create programmatic, decentralized reserve.
Bancor achieves instant liquidity, as they call it, by creating specialized smart contracts, called smart tokens, for every token pair that holds a reserve of each token. The smart contract sets the exchange rate based on how many tokens it has in its reserves.
For example, one can create a smart token for ZRX/SATURN exchange, with initial price set to 1 ZRX = 1 SATURN. This smart contract holds a balance of both tokens and sets the price based on reserve availability, with the goal of incentivizing restoration of initial balance. Depending on how people trade, the price will go up or down.
Bancor uses a similar, but slightly more simple, mechanism compared to Saturn Protocol's design in order to supply liquidity for the traders. Arbitrage trading bots monitor Bancor smart contracts and buy/sell whenever Bancor price differs significantly from other exchanges.
However, unlike Saturn Protocol, Bancor cannot guarantee the price of purchase because it changes with each transaction. Since within one block transactions are arbitrarily ordered, there have been frontrunning attacks, executed by both miners and other traders. Essentially, it allows other people who can act quick enough to drain money from your wallet if you do not set the cap on your price (the suggested fix to the protocol). Since the cap is public information anyway, it is pretty much a guarantee that someone will force the price to drop to your suggested cap levels, and these "adversarial traders" will squeeze out $5-$10 dollars out of you on your every trade. This price unpredictability is the unfortunate price to pay for algorithmic price discovery promised by Bancor.
Today, Bancor seems to has shifted its focus away from their ETH exchange towards EOS blockchain. They run the Liquid EOS block producer, and contributed implementation of Bancor formula for EOS RAM reserving system.