Technologies of DeFi markets — Part 1: Decentralized Exchanges

Lumos Student Data Consulting
11 min readAug 27, 2021

Disclaimer: The article can also be read on our Lumos blog, where it was published initially.

Photo by fabio on Unsplash

The following text is taken from a paper that our alumnus Nikolas Haimerl had written during his Master studies at TU Vienna. Due to the length of the paper, we will publish the key parts of it in a two-part series. This first part provides the necessary background information and focuses on decentralized exchanges. The second part takes on the topic of stable coins and closes out the paper.

Background

Digitization and Decentralization

In our financial systems, intermediates often exist, between parties to expand transaction possibilities and instantiate trust. Also, the transaction costs for the participating parties can be reduced through these specialized intermediaries. Since these intermediaries have been highly successful in their offerings and businesses, they have gained extensive control over the financial system itself. Monopolies and the corresponding loss in welfare from an economical perspective are a continuing issue amongst these intermediaries [5].

A very profound case of monopolization and industry domination are the financial institutions. While they have always played a not insignificant part in our society and economy, the impact of the financial sector on the overall economic growth has increased dramatically over the last century and so has its power over the economy, businesses and society [11].

Nevertheless, these institutions have enabled transactions and established access to markets for a vast number of people, all while maintaining relatively low transaction costs which without those institutions would have made a substantial number of those transactions economically infeasible. Therefore, any other systems which would seek to offer similar functionality would have to find ways to connect market participants fast and at low cost whilst establishing trust for the participants in the system. Digitization has already largely changed the landscape of financial institutions and with the development of financial technologies (FinTech), it tackles the various issues with current financial institutions, the issue of monopolies and centralization being two of them [5].

The introduction of blockchain technology and especially the functionality of smart contracts has led to the development of peer-to-peer based, decentralized platforms which can also be used to offer a decentralized approach to traditional financial transactions. It is the distributed trust which has led to many business people, developers and early adopters recognize the vast possibilities of creating an open financial system that could be run with little or no involvement from traditional financial institutions. Consequently, recent developments have led to ever-decreasing transaction costs of the users, getting more people involved who would not be as open to new technologies as early adopters, empowering open access, encouraging permissionless innovation, and creating new business opportunities. In spite of the fact that this development is still at its early stages, it exhibits the potential of blockchain innovation in producing a modern set of trade models that are centred around decentralization and disintermediation. In case this development proceeds to pick up energy, it will continue to disrupt existing businesses, offer an alternative to centralized control and power, and make unused openings for entrepreneurship and innovation [5].

Use cases of decentralized finance

General applications in the domain of decentralized finance mimic existing finan­cial services or transaction-based businesses such as insurances, exchanges, fiats, financing etc and offer a decentralized alternative to these established businesses. The idea is usually to transform a heavily centralized service into a decentral­ized one. Consequently, there is a wide range of use cases for decentralized finance. For the sake of this paper, a selection of two very important applications will be made and further discusses decentralized exchanges and stable coins.

Decentralized Exchanges

A fundamental entity in any financial system with multiple financial services as well as the currencies or commodities with which compensation is made, is an exchange that offers the opportunity to trade one against another. In the case of decentralized exchanges, the ledgers recording the parties’ offerings and bids are decentralized through different approaches defined by their respective protocols. Like in many other blockchain use cases, trustless trust is a major benefit of this technology. Furthermore, potentially lower transaction fees and access to less liquid cryptocurrencies are amongst the benefits of those exchanges. On the other hand, since decentralized exchanges are seldomly bound by the regulations of one government, deanonymization policies such as “know your customer” can be circumvented with these exchanges and can therefore offer higher privacy than centralized exchanges which further attracts users who do not see their needs met in the traditional financial market [8].

In general decentralized exchanges have experienced considerable growth in 2019 and 2020 as shown in Figure 1. This growth especially in 2020 can be at­tributed to the Decentralized Finance (DeFi) boom which accounted for 1178% when compared to last years transaction volume [9].

A great number of new smart contract-based decentralized finance applications have launched in 2020 or gained considerable adoption. Different use cases of DeFi were introduced which meant a drastic increase in different tokens which would run these ser­vices. Decentralized exchanges found themselves to have to offer a more diverse portfolio of tokens and also to handle a larger number of transactions. For this paper, the major developments in listing and trading characteristics of decentralized exchanges are examined to explore how decentralized exchanges have tried to manage different technologies, trust protocols and fluctuations in demand. Also, the differentiation to centralized exchanges (CEX) is highlighted as they explain the popularity and benefits of decentralized exchanges (DEX).

Architecture and Protocols

A DEX protocol generally describes a software program, hosted on or integrated into one or more distributed ledgers (e.g., Ethereum), that enables peer-to-peer transactions that are automatically settled on the distributed ledger. A DEX application builds on top of a decentralized exchange protocol and adds an on-chain or off-chain order book database and a graphic user interface (GUI) and/or APIs so that the information is easily accessible. Decentralized exchanges may show different strategies on how they implement the functionality of the exchange. This also means that the degree of decentralization may vary between exchanges.

In the case of decentralized exchanges, they often are essentially a website with its backend connected to one or more distributed ledgers depending on which coins and tokens are offered on the exchange. Through the front-end users are enabled to make trades and exchange assets on a peer-to-peer basis which are automatically settled on the distributed ledger. How transactions are settled can vary from exchange to exchange but often on-chain or off-chain order books are used which store the counterparty offerings and match them against each other. With technologies such as UniSwap or Thorchain so-called liquidity pools have been used to further decentralize the assets used on exchanges. Decentralized exchanges making use of these decentralized liquidity pools can offer a higher degree of decentralization compared to those making use of order books [8].

Platform & Technical Compatibility

Most DEXs offer the possibility to trade tokens from the same distributed ledger platform with the reasoning that transactions within one block-chain are less prone to stability, latency and tech­nological issues. The biggest player here is Ethereum with over 90% of market share, followed by Stellar [2]. Some DEXs have started to use atomic swaps to en­able users to atomically trade cryptocurrencies that exist on different blockchain networks. However, atomic swaps still require the coins to be of similar technical standards. A challenge that remains to be solved are the high latencies with cross-chain swaps which hinders vertical integration of cryptocurrencies based on different blockchain technologies on one DEX [8].

Counter Party Discovery Mechanism

For any exchange, there must be some market mechanism in place to find buyers and sellers willing to exchange assets for a stipulated price. Traditionally with CEXs, market and limit orders are the most popular order types. The submitted orders would be collected in an order book and then counterparties are automatically matched based on the order specifications. This of course means centralization and for DEXs this is a key functionality that largely determines the degree of decentralization. DEXs that have order books may host them in distributed ledgers (on-chain) or have them taken care of by third counterparties (off-chain). For some DEXs, there exist no order books as they use reserves to take care of orders. These are created by on-chain smart contracts that come with a settlement process.

The main trade-offs of choosing on-chain order books are that they are bound by the performance, cost and security characteristics that the underlying blockchain comes with. As speed and scalability have been major challenges for blockchain transactions, activities such as high-frequency trading will not be eas­ily replaced by on-chain protocols. Also if one puts an order for a token and the price of that token drops significantly in the time between blockchain updates of the order book the order may go through with significant losses due to laten­cities of the underlying blockchain network not being able to accurately represent the current market valuation of an asset subject to a trade. The most popular on-chain order book DEX is Stellar. In the Stellar network submitted orders are publicly available on-chain and the order book is frequently broadcasted to all validators nodes [8].

Due to these severe limitations, some DEXs use off-chain order books which are centralized entities that help discover matching parties. Also, transaction fees that are inherent to on-chain transactions can be circumvented this way. This of course comes at the cost of trust and order book inaccuracies are typical for CEXs. An example of a DEX with off-chain order books is Ox where so-called Relayers host, manage and publish these order books. Relayers buy orders from potential sellers and put them in their order books where they are aggre­gated. Buyers can then query these order books to find a suitable order and buy from the Relayers. Order books are shared between Relayers which increases liquidity and stabilizes the market price [8].

Another option that DEXs turn to are liquidity pools. A liquidity pool is a smart contract that holds at least two crypto assets in a reserve and allows anyone to deposit tokens of one type on the smart contract and thereby withdrawing tokens of the other type. The simplest model that is used in this scenario is described by a constant k and the product of the reserves x * y of two coins which leads to the simple model:

xy = k

When a trade is being made, the equation changes to:

(x + .dx ) * (y + .dy ) = k

which results in the shift depicted in Figure 2.

As the reserve of one coin approaches zero the price for it stipulated by the smart contract price mechanism will approach infinity and the reserve can therefore not be depleted. Arbitrageurs exploiting the price difference between the market price of the two coins and the price stipulated by the smart contract in the reserve keep the price at market level. A popular implementation of a liquidity reserve is the KyberNetwork [12].

Some DEXs use smart contract aggregation where they scrape prices over multiple liquidity pools and then offer the best option out of those to the buyer or seller. This strategy works as long as the number of pools selected is not too narrow otherwise, it could lead to monopolistic price-setting [12].

Finally, some DEXs turn to peer-to-peer protocols where participants can query the network for counterparties who would like to trade a given pair of crypto assets and then negotiate the exchange rate bilaterally. The querying and connection of the two parties is usually automated while the final negotiation is still done on a peer to peer basis.

DEX comparison

In Table 1 one can see the differences of the three major DEX technologies used which are on or off-chain order books and liquidity reserves. In general, it comes down to preferences in decentralization, speed, trust and liquidity [12].

Off-chain DEX can be faster and more cost-efficient than its on-chain alterna­tives since they are less limited by the speed, cost and security of the blockchain they operate on. However, centralization is more relevant and therefore a higher degree of trust is needed. Also since off-chain DEX have this aspect of central­ization they are more prone to be targeted by regulators. The main advantage of liquidity pools over order books is the very low friction of trading and their high degree of autonomy. However, this means putting more trust into the implementation of the underlying smart contract. Also, they favour larger liquidity pools as they are less likely to run out of certain coins given an extreme market condition [12].

Conclusion

In this first part about the DeFi market, decentralized exchanges were analyzed. The DeFi market has seen great levels of adoption in 2020 with decentralized ex­changes offering a platform to trade various tokens that are inherent to most DeFi applications. Scalability, latency, liquidity, technology integration and decentralization have been at the centre of its recent developments. While still in the early stages decentralized exchanges offer liquidity in a diverse token ecosystem providing users access to decentralized finance applications that have been largely occupied by centralized oligopolies so far.

References

1. Staticoin & riskcoin (Jan 2017), http:/ /staticoin.com/

2. AminCad: Market share of ethereum-based tokens grows to 913 (May 2018), https://medium. com/@amincad /market-share-of-ethereum-based-tokens-grows­to-91-fdefadfd9f6e

3. Aspris, A., Foley, S., Svec, J., Wang, L.: Decentralized exchanges: The ‘wild west’ of cryptocurrency. SSRN Electronic Journal (October 2020). https:/ /doi.org/10.2139/ssrn.3717330

4. Baur , D.G., Hoang, L.T.: A crypto safe haven against bitcoin. Finance ResearchLetters p. 101431 (2020). https:/ /doi.org/10.1016/j.frl.2020.101431

5. Chen, Y., Bellavitis , C.: Blockchain disruption and decentralized finance: The rise of decentralized business models. Journal of Business Venturing Insights 13 (2020). https:// doi.org/10.1016/j.jbvi.2019.e00151

6. Hoang, L.T., Baur, D.G.: How stable are stablecoins? SSRN Electronic Journal (2020). https://doi.org/10.2139/ssrn.3519225

7. Jeger , C., Rodrigues , B., Scheid, E., Stiller, B.: Analysis of stable­ coins during the global covid-19 pandemic. 2020 Second International Conference on Blockchain Computing and Applications (BCCA) (2020). https://doi.org/10.1 109/bcca50787.2020.9274450

8. Lindsay X. Lin, L.C.a.I., Development, S.: Deconstructing decentralized ex­ changes. Stanford Journal of Blockchain Law Policy (1 2019) , https:/ /stanford­ jblp. pubpub.org/pub/ deconstructing-dex

9. McNally, C.: Defi boom drives 1,2003 increase in dapp volume in 2020: Re­ port (Dec 2020), https:// cointelegraph.com/ news/ defi-boom-drives-1200-increase­ in-dapp-volume-in-2020- report

10. Moin, A., Sekniqi, K., Sirer, E.G.: Sok: A classification framework for stablecoin designs. Financial Cryptography and Data Security Lecture Notes in Computer Science p. 174–197 (2020). https:// doi.org/10.1007 /978–3–030–51280–4_11

11. Prochniak , M., Wasiak , K.: The impact of the financial system on economic growth in the context of the global crisis: empirical evidence for the eu and oecd countries. Empirica 44(2), 295–337 (2016). https://doi.org/10.1007 /s10663–016–9323–9

12. Schar, F.: Decentralized finance: On blockchain- and smart contract-based financial markets. SSRN Electronic Journal (2020). https:/ /doi.org/10.2139/ssrn.3571335

13. Sogur: The evolution of money (Nov 2020) , http://www.saga.org/

14. Wei, W.C.: The impact of tether grants on bitcoin. SSRN Electronic Journal (2018). https://doi.org/10.2139/ssrn.3175876

--

--

Lumos Student Data Consulting

Lumos is a student-led Enterprise with a sole focus on Data Science related services based in Vienna. | Feel free to contact us: https://lumos-consulting.at/