Voice of the Industry

Disrupting financial markets - Decentralised Exchanges

Wednesday 4 August 2021 12:28 CET | Editor: Mirela Ciobanu | Voice of the industry

Igor Struchkov, Firmshift explains what are the earliest and the most widely used class of DeFi protocols - decentralised exchanges

In our previous article we discussed decentralised finance (DeFi) - a new and disruptive trend in financial services based on disintermediation, blockchain technology, and smart contracts. Now let us dive into one of the most important parts of DeFi - decentralised exchanges.

Decentralised digital asset exchanges (or DEXes) constitute the earliest and the most widely used class of DeFi protocols. DEXes allow to swap digital currencies (usually in the form of tokens) with all the operations recorded on a blockchain. Uniswap is the most well-known DEX launched on Ethereum blockchain. By now there are lots of other decentralised exchanges working on different blockchains, though Ethereum is still a leading platform for them.

Unlike centralised crypto exchanges, DEXes do not take custody of their users’ funds to perform transactions. Instead, the operations are controlled by smart contracts and often are performed within one transaction. This is a major advantage of decentralised exchanges over centralised ones - for many of them there is no even theoretical chance for a third party to tamper with the operation and somehow misuse the funds. And taking into account a good deal of unpleasant stories with centralised crypto exchanges being hacked or appearing to be scam in the past - it is no surprise that DEXes are becoming more and more popular.

To understand how DEXes work, we must first distinguish between two types of decentralised exchanges:

  • An order book DEX works almost similar to a traditional exchange. It maintains an order book - a list of buy and sell orders from traders sorted by price so that the best orders are placed on top. When a matching buy / sell order pair is found, a deal is performed. The difference of a decentralised exchange is that deals and the order book itself should be recorded on a blockchain and controlled by a smart contract. But in practice the limitations of blockchain throughput and transaction costs require that order book DEXes do part of calculations off-chain. To stay decentralised they use special mathematical algorithms - zero-knowledge proofs that allow smart contracts to verify off-chain calculations before recording deals on a blockchain. Examples of order book DEXes are: Loopring, DiversiFi.

  • In a liquidity pool DEX there is no need to wait for any orders to close a deal. Instead, any swap can be performed by a single trader using a liquidity pool. A liquidity pool is a sufficiently large reserve of tokens (usually, a pair of tokens, but there are exceptions) that allow you to just place tokens you want to sell in the pool and take a corresponding amount of tokens you want to buy from the pool. The procedure is simple and usually can be done within one blockchain transaction by a smart contract. This is an advantage over order book DEXes and this is why liquidity pool DEXes are mostly popular. On the other hand, liquidity pool DEXes require that investors - called liquidity providers - supply enough liquidity for them to operate.

A central component of a liquidity pool DEX is an automatic market maker (AMM) - a special algorithm codified in a smart contract that calculates the exchange price for every swap. The simplest algorithm is constant product AMM or k = xy. It calculates the exchange price so that after each swap the product of asset amounts in a pool (x and y) stays constant (see Exhibit 1).

Exhibit 1. Constant product AMM and price slippage        Source: Liquifi / Medium.com

The constant product AMM is used in the majority of liquidity pool DEXes. The most important examples are: Uniswap and SushiSwap on Ethereum blockchain, PancakeSwap on Binance Smart Chain. There are also DEXes that use different AMMs. For example, Balancer is based on the constant mean AMM - here liquidity pools can contain more than two assets and each asset has its own weight when calculating the constant function; Curve Finance is based on the combined AMM that has constant product and constant sum components, which is particularly efficient for stablecoins.

A common problem for AMM-based DEXes is price slippage (see Exhibit 1 again). When a swap operation is performed, the price always shifts along the constant function curve. If an operation amount is large or a pool is small, the slippage (or price impact as it is often called) may become very significant, making the operation unprofitable. Several solutions have been proposed to the price slippage problem recently. Uniswap version 3 introduced ‘concentrated liquidity’ that allows liquidity providers to specify price ranges for their liquidity. Though it decreases the slippage, it also makes life a bit harder for liquidity providers - as they need to watch market prices to stay in the game. Liquifi is a new DEX that aims at solving the price slippage problem. It introduced ‘time-locked swaps’ that pass gradually during some time period and allow counter-deals to come in parallel and reduce the slippage. In Liquifi version 2 (which is planned to launch soon) a completely new approach is announced that will allow investing in single tokens, not pairs. This approach is expected to significantly increase capital usage efficiency and reduce the price slippage.

As we can see, decentralised digital asset exchanges have a strong potential to disrupt financial markets in the near future. People choose DEXes because they allow exchanging assets easily, without creating any accounts and trusting funds to third parties. And to asset holders DEXes give new opportunities to receive high interest rates on their investments with relatively low risks. There are, of course, some problems still like the above-mentioned price slippage, low scalability, and high transaction costs in Ethereum and other blockchains. Indeterminate legal status of DeFi services in many countries can also cause risks. But as the adoption of decentralised exchanges grows, new and effective solutions will come, making DEXes one of important parts of the future financial system.

About Igor Struchkov

Igor Struchkov is a Software Development Manager and Researcher at Firmshift B.V. He has about 20 years of experience in software development, project management, enterprise and blockchain software architecture, mathematical modeling. You may contact him by email at i.struchkov@firmshift.com.



About Firmshift

Firmshift B.V. is an innovative global software engineering company headquartered in Amsterdam, the Netherlands. It has a globally distributed team of highly skilled professionals capable of implementing world class projects in various areas including financial systems, 3D modeling, artificial intelligence and blockchain. Among our featured clients are Boston Consulting Group, Wolters Kluwer, Societe Generale.

Free Headlines in your E-mail

Every day we send out a free e-mail with the most important headlines of the last 24 hours.

Subscribe now

Keywords: DeFi, Token, blockchain, Ethereum, smart contracts, financial services
Countries: World