Analyzing Activities on Decentralized Exchanges

alethio
ConsenSys Media
Published in
11 min readJun 19, 2018

Decentralized exchanges will usher in a new way of seamlessly, instantly, and securely trading crypto-assets. The proliferation of these exchanges suggests that important differences and nuances might exist between platforms. Alethio, a data engine allowing the extraction of rich data from the Ethereum blockchain, was leveraged to take a deep dive into some of the most prominent decentralized exchanges.

Today, most cryptocurrency trading is still performed through centralized exchanges such as Coinbase and Binance. These exchanges store their customers’ KYC data, facilitate their tradings, and fully control their funds. Several high profile attacks on traditional exchanges have been reported in previous years [2], exhibiting a need for exchanges that operate in a more trustless and secure way. These new exchanges are known as Decentralized Exchanges (DEXes) and put the control of funds and trading back in the hand of their users. Because there is no central entity controlling a DEX, however, it is a challenge for operators and users to comply with certain regulations such as KYC.

The various DEXes that have emerged in recent months share similar mechanisms, protocols, and data models, but differ in dynamics and business logic. These differences stem from either trading protocol principles on-chain vs. off-chain artifacts, or the order matching system. Although we designed the analysis and visualization in this article to not be affected by these differences, is still interesting to highlight some of the most recurrent DEXes in the literature.

0x and EtherDelta: Order Books & Relayers

According to [1], 0x is basically “EtherDelta with better coding and additional capabilities”. 0x is a protocol to facilitate decentralized token trading by the broadcast of Order Messages, which contain information as references for the taker and maker, the amount desired to trade, and the tokens involved in the trading [3].

Similar to 0x, EtherDelta contains its own smart contract with the logic for trading and fund management. As Figure 1 shows, the trading logic happens both off- and on-chain. Both maker and taker decide and match their trades based on an order book hosted on off-chain servers and then the actual trade is executed through a smart contract on the blockchain.

Figure 1 — Trading logic in 0x/EtherDelta — Maker and Taker agrees on trading off chain and execute it on-chain.

The order messages are maintained in order books. The books are stored across off-chain servers known as “relayers,” e.g. The Ocean. These relayers implement the front-end and off-chain logic for token trading and charge involved parties trading fees.

Airswap Protocol: Trading Through Peer-to-Peer Protocol

Different than 0x and EtherDelta, Airswap uses p2p capability to perform the trading instead of keeping the information in ordering books. Additionally, with Airswap, takers and makers post their “intent to trade” without specifying their desired exchange rate. When a token-pair match is located, the negotiation is pushed to the parties and performed by the p2p protocol. If no agreement is made between the parties, they are able to query an “oracle protocol” for the fair price suggestion [6]. Airswap locks up an amount of AST tokens on a specific amount of time for each “intend to trade” and returns it back to the token holder once the trade is concluded or time is expired.

Bancor: In-Wallet Trading

Bancor uses an in-wallet exchange Bancor Wallet. Instead of matching takers and makers as other exchanges and protocols do, Bancor in-wallet conversions are made against smart contracts, establishing transparent and efficient pricing for users and eliminating exchange fees [7, 8]. Bancor Wallet also allows users to purchase tokens with debit and credit cards.

Kyber Network: Ecosystem of Reserves

Similar to the 0x protocol and EtherDelta, Kyber Network markets itself as a decentralized solution solving the main problems with centralized exchanges. On the other hand, Kyber Network performs all its actions on the blockchain as opposed to an on/off-chain combination [9]. The trading dynamic takes place and is based on a set of different roles: users send and receive tokens, reserve entities bring liquidity to the network, reserve contributors provide funds to the reserve entities, reserve managers maintain and calculate the exchange rates, and Kyber Network operators who add and remove reserve entities to/from the network and control the listed tokens.

Based on this wide range of DEXes ecosystems, this article focuses on exploring graph visualizations of token exchanges performed in various DEXes. Based on our heuristics from on-chain information, this article also spots how the price and volume available of tokens might change between some DEXes.

Dataset & Exploratory Statistics

All the findings in this article come from information harvested from the Ethereum blockchain; we don’t have any previous information of decisions occuring off-chain. Based on the information derived from processes that parsed the log events for IDEX, EtherDelta, Bancor, 0x, OasisDex, Kyber Network, and Airswap Protocol, we defined a “trading record” as the event that contains relevant pieces of information for a token trade. Specific definitions for our analysis below:

taker: the one who fills the order
maker: the one who creates the trade order
maker token: maker’s ERC20 token contract address
taker token: taker’s ERC20 token contract address
maker amount: amount of maker token that maker offers to taker
taker amount: amount of taker token that taker offers to maker
block number and time: block number and associated timestamp of the block where the trading was recorded in.

All tokens considered in the data are ERC20 tokens and the conclusions come from information from block 5748398 (June 7th 2018) to block 5764889 (June 10th 2018), a total of almost 3 days of trading from the 7 DEXes aforementioned.

Based on Figure 2, IDEX and EtherDelta are responsible for more than 80% of all trades (41,914 for IDEX and 6,173 for EtherDelta). On Figure 3, IDEX and EtherDelta contain more than 95% of the traders (12,991 for IDEX and 3,377 for EtherDelta). According to the histogram on Figure 4, IDEX and EtherDelta are the 2 major DEXes with respect to diversity of token-pairs traded (621 unique pairs traded for EtherDelta and 441 unique pairs traded for IDEX).

Figure 2 — Pie Chart of amount of tradings filled across the DEXes
Figure 3 — Pie Chart of amount of unique traders across the DEXes
Figure 4 — Histogram of amount of unique tokens pair traded across the DEXes

Based on the rankings, IDEX and EtherDelta seem to be the most popular DEXes in terms of trading activity and variety of tokens traded*.

Network Graph Visualization

For graph visualizations, we treat each node as a token contract and each edge as a DEX where the trade of the node (token) pair happened. The size of the node represents the total volume traded (normalized by the total traded volume of ETH), while the width of the edges represents the count of trade of the token pair on this DEX**.

Figure 5 — Network Overview of the main DEX platform and token trades

Based on visual aspects of Figure 5, we can say ETH — in the center — is the crypto-asset involved in most of the trades, meaning currently the majority of token transfers still occur between small tokens and ETH (or use ETH as a bridge). In addition, IDEX is the DEX with the most traffic, demonstrated by its related edges dominating the graph color in size and width.

The green subcenter in the bottom of Figure 5 is zoomed in on Figure 6. WETH token is spotted in the center. WETH (wrapped-ETH) is a token built on 0x, enabling people to trade between ERC20 tokens and ETH on DEXes.[10]

Figure 6 — Zoomed in on WETH token node.

At the bottom right on Figure 5, there is a pair of tokens standing alone from the cluster. We checked out the event log associated with the trading on the transaction^^ to learn that in fact that was a trade between NOT & MBGNtokens on 0x protocol.

Based on the findings shows in figure 5, we can roughly classify tokens into 3 roles in the ecosystem:

  1. Center Node: ETH is now still the center node, to which almost all the tokens are being traded, serving as the hub.
  2. Leaf Node: those who have only interaction with center nodes. People mainly sell them directly from or to the center node (i.e. ETH for now.)
  3. Bridge Node: the nodes who bridge center nodes and lead nodes, serving as a temporary intermediate token used by specific DEX platform. Usually it’s created by the DEX and only used by them when token trade order are being filled.

DEX Subgraphs Visualization

This section includes graph visualizations for each DEX, as pictured on Figure 7. Based on each following subgraph, we can see different token trading patterns on different DEXes. For example, IDEX and EtherDelta only include direct transfers between tokens and ETH. Airswap, OasisDex, and 0x — on the other hand — also have WETH connecting other tokens, demonstrating a bridge structure. Kyber also shows the same radiating circle as IDEX and EtherDelta, but the center node in it is the Kyber token, which serves also as a bridge to ETH.

To conclude, we can also roughly classify the DEX platforms into 2 groups based off the network graph views:

  1. Direct ETH Switch: like IDEX and etherdelta, if maker or taker want to complete the order in one transfer, they can only exchange token with ETH. If one wants to trade a token pair directly, he will need more than one “hop” to complete it.
  2. Using Intermediate Token: like the other DEXes mentioned above, they use the DEX issued token (or WETH, DAI) as an intermediate token to bridge ETH.

The figures below show subgraphs from each DEX

Airswap Protocol
0x protocol
EtherDelta
IDEX
OasisDex
Kyber

Trading Rate

The first aspect considered in this section is the comparison of trading rates for identical token pairs between different DEXes. To quantify this analysis, we stay conservative and consider the median of the trade rate for the same token pair in each DEX. Figure 8 shows the boxplots for the three most popular token pairs traded either on EtherDelta, IDEX, Airswap Protocol, or OasisDex.

Figure 8: boxplot for the trading price of 3 different pair of tokens traded either on IDEX, EtherDelta, Airswap Protocol, or OasisDex.

We see that for these three most popular pairs of token trades, users have paid different rates to sell and acquire tokens. Anyone who wants to exchange tokens should consider this kind of information from different DEXes to determine the most intelligent DEX on which to trade. Figure 5, for example, demonstrates that during the studied block period from which this data comes, the cheapest trade rate of DAI/WETH was 582.85 in Airswap Protocol and the most expensive rate was 606.0 on IDEX.

Volume Traded

We assume that if in the recent past, the higher the volume traded of a specific token pair, the more likely the trade will be effective for that pair. To a certain extent, this means user’s trading might be concluded faster.

Figures 9–11 illustrate the histograms for the volumes of certain token pairs traded. From Figure 6 we can conclude almost 8.5 x 10ˆ27 HOT tokens traded from ETH on IDEX. IDEX contained the largest volume traded of HOT tokens from ETH and should be considered an option for those trading these tokens. Anyone trading DAI tokens to WETH should consider OasisDex to fill a trade. On the other hand, if you desire to trade ETH for ZIL, the information below shows it would be smartest to execute the trade on IDEX.

Figure 9 — Histogram of volume of HOT tokens traded from ETH
Figure 10 — Histogram of volume of WETH tokens traded from DAI
Figure 11 — Histogram of volume of ZIL tokens traded from ETH

Last words

This article shed lights on some of the most prominent DEXes and revealed future problems that might arise from decentralized trading: where is the best place to trade considering aspects of trading like price, available volume, and token pair?. The data for this analysis was pulled from the Ethereum blockchain using the data engine Alethio. The novel block explorer and network health monitor allows for the analysis of rich data previously unavailable to users of the Ethereum blockchain. Stay tuned for more case studies showcasing the power of Alethio and the strength of the Ethereum network!

This article is meant to highlight the nuances of token pairs and trading between different DEXes and the power of the Alethio platform to provide insight into the Ethereum network. In no way should this article be taken as advice for trading or investing in tokens or crypto-assets. The trading and investment actions taken by an individual, group, or company based on findings from Alethio are entirely his/her/their own.

References

[1] Understanding Decentralized Exchanges https://hackernoon.com/understanding-decentralized-exchanges-51b70ed3fe67, accessed on June 12th 2018

[2] How to steal $500 Million in Cryptocurrency http://fortune.com/2018/01/31/coincheck-hack-how/, accessed on June 12th 2018

[3] 0x: An open protocol for decentralized exchange on the Ethereum blockchain, Will Warren, Amir Bandeali, https://github.com/0xProject/whitepaper/blob/master/0x_white_paper.pdf

[4] Aiswap vs 0x Protocol https://www.reddit.com/r/AirSwap/comments/7wtwqy/airswap_vs_0x_protocol/, accessed on June 12th 2018

[5] 0x project vs AirSwap.io https://medium.com/@stamfordhwang/0x-project-vs-airswap-io-bee324025a0a, accessed on June 12th 2018

[6] Swap: A Peer-to-Peer Protocol for Trading Ethereum Token, Michael Oved, Don Mosites https://swap.tech/whitepaper

[7] Bancor takes on Crypto exchanges with wallet that converts accross tokens https://techcrunch.com/2018/04/03/bancor-takes-on-crypto-exchanges-with-wallet-that-converts-across-tokens/, accessed on June 12th 2018

[8] Bancor Protocol: Token Launch Report https://www.smithandcrown.com/sale/bancor-protocol/, accessed on June 12th 2018

[9] What is Kyber Network? https://coincentral.com/kyber-network-beginner-guide, accessed on June 12th 2018

[10] WTF IS W-ETH? https://weth.io/, accessed on June 12th 2018

Notes

* Bancor trading records just contains trades between ETH and BNT(Bancor Token) and as Bancor is a in-wallet trading with the current data we just have the information of the buyers(takers) and in this case was either the smart contracts of BancorQuickConverter or BancorNetwork.

** Because the scale of these volume differs dramatically, we scaled the value to adjust the plot. Since the exchange of token is bi-directional, we aggregate the pair of taker and maker in the raw data to not differentiate the role in the order. If a token pair are traded in multiple DEX, there will be multiple edges between them, marked with respective colors. The sources for symbol and logo for the nodes/tokens are from https://github.com/TrustWallet/tokens/tree/master/images and https://raw.githubusercontent.com/MyEtherWallet/ethereum-lists/master/tokens/tokens-eth.json

Some of the tokens’ logos and symbols are not covered in these two library, therefore there are some nodes without label or represented as a circle as default.

^^ https://etherscan.io/tx/0x1fb250dc3349a6f44ea3efb96db33e83d33a54dacb889454c0061efb1d3cb658#eventlog

Disclaimer: The views expressed by the author above do not necessarily represent the views of Consensys AG. ConsenSys is a decentralized community with ConsenSys Media being a platform for members to freely express their diverse ideas and perspectives. To learn more about ConsenSys and Ethereum, please visit our website.

--

--