Decentralized exchanges, also known as DEXs, have risen significantly in popularity since the start of 2020, with both their user bases and volumes growing at an accelerating pace. The sector is currently being driven by so-called “automated market makers,” or AMMs.
In a nutshell, these exchanges do away with the traditional order book and custom price orders. Instead, an asset’s price is determined by a mathematical formula that depends on the relative share of the assets in liquidity pools. When a user transacts, this changes the balance of assets in the pools and results in the price moving slightly higher or lower. This mechanism lets AMMs follow the price movements of the market.
Bancor was the first live implementation of an AMM, though many others such as Uniswap, Balancer, Mooniswap and Curve later built similar systems. Yield farming and the subsequent decentralized finance boom has helped propel daily volumes to more than $400 million.
Matthew Finestone, head of business development at layer-two decentralized exchange Loopring, told Cointelegraph that AMMs “have product market fit,” a term applied to startups that are finding traction. But the current iteration of DEXs has a variety of issues that could severely limit the size of that market.
On-chain performance and target market
Ethereum-based DEXs are currently some of the largest gas guzzlers on the blockchain, contributing to gas prices rising to more than 250 gwei, while in quiet periods they can be as low as 2 gwei.
The skyrocketing gas prices suggest that the current volume levels are close to the maximum of what existing DEXs can achieve without completely barring average users. The growth of AMMs was already a direct result of the relative slowness of Ethereum, as Finestone said: “[AMMs] found ways to effectively ’solve’ the fact that market makers cannot be placing quick, precision orders on Ethereum.”
But while some of these issues could be solved with better on-chain scaling, Paolo Ardoino chief technology officer at crypto exchange Bitfinex, told Cointelegraph that on-chain settlement could never compete with centralized matching engines:
“The current solution for decentralized exchanges, even if Ethereum grows and becomes Ethereum 2.0 and the transaction speed becomes, let’s say 10,000 transactions per second, will still be many orders of magnitude slower than one single centralized exchange.”
Explaining why, Ardoino added that the issue with on-chain settlement “is just the speed of light.” When nodes across the globe have to agree on a single block, no networking improvement can beat the performance given by, for example, co-locating trading infrastructure in the exchange’s data centers. These performance limitations could be a serious hindrance to professional traders, especially high-frequency trading companies.
Dan Matuszewski, co-founder of trading firm CMS Holdings, recounted his experience of using DEXs on Twitter: “First off the experience sucks, in no way will you convince me it doesn’t suck, I won’t have it.” Elaborating on the point, he said that DEXs are expensive and the terms of a transaction are not clear until after it settles. “I could be paying 5% bid offer [spread] and have little idea,” he added, though he noted that in the current environment, it’s “not that big a deal.” The relatively slow speed of execution, on the other hand, was not a major issue for him.
Nevertheless, Matuszewski told Cointelegraph that DEXs are not currently suitable for professional traders. “It’s for small ticket hobby traders to punt around on,” he said.
A further issue is front-running. Due to the completely transparent nature of the blockchain, a class of front-running bots exists to place favorable trades in the window between the submission of a transaction and its inclusion in a block. While they are generally used for arbitrage, this approach may also be used to take advantage of upcoming market moves.
A November 2019 study published in Cryptoeconomic Systems analyzed the effectiveness of Uniswap as a price oracle. While the conclusion was largely positive, the researchers relied on the presence of arbitrage agents who would be motivated by profit to bring its price in-line with the rest of the market. Mikhail Melnik, a developer at DEX aggregator 1inch, told Cointelegraph: “Current AMMs will definitely be ineffective without arbitrageurs, because arbitrage is being used as a price discovery mechanism.”
Thus, the most popular DEXs today cannot be useful without the presence of markets based on order books, which currently are largely centralized. Furthermore, the arbitrage mechanism results in the issue of impermanent loss, which siphons a significant portion of the profits away from liquidity providers.
Some of the issues in AMM exchanges can be resolved without fundamental alterations. Solutions to fix impermanent loss are currently deployed by Bancor V2 and Mooniswap, the DEX developed by 1inch. Both attempt to limit arbitrageurs’ profits, with the former using price oracles and the latter a virtual balance that smoothens price changes over a five-minute period. According to 1inch, its solution has the added benefit of making front-running essentially impossible.
In terms of performance, Uniswap’s founder, Hayden Adams, sees the launch of smart-contract-enabled Optimistic Rollups on the Ethereum network as a way to improve throughput. The layer-two solution would create a generalized environment where Solidity smart contracts are executed outside of the blockchain. Uniswap could then be deployed in this environment with minimal changes to the code.
However, some have noted that Optimistic Rollups could worsen the front-running issue by only letting the operators see the transactions in advance. This would fundamentally defeat the goal of minimizing the need to trust operators, which is the core prerogative of generalized layer-two solutions.
There are currently few solutions to address the usability issues outlined by Matuszewski, though it’s possible that higher liquidity and specialized tools could help make these exchanges less expensive and more deterministic. Nevertheless, the lack of true price discovery is likely to remain. Melnik offered a potential solution:
“It is possible that some AMM designs that use oracles for these [price discovery] purposes will appear, but in my opinion, using oracles […] significantly worsens the problems with front-running.”
However, this would not remove the reliance on traditional exchange mechanisms.
Noncustody as the next iteration
According to Ardoino, “The solution is always in hybrids.” In his view, the future of decentralized exchanges will feature full on-chain custody and clearing — the act of updating the accounts of two parties following a trade. But the settlement, or the actual order matching, will not be done on-chain, he added:
“You can have open-source matching engines that are not on-chain but are running on a thousand different nodes and they have their own small books, and aggregated they can represent a bigger book.”
Such an approach would maintain on-chain custody and keep off-chain — yet peer-to-peer — matching engines, solving the performance issues without losing out on the decentralization. “This is the type of resiliency where we need to be headed rather than trying to create everything on a single blockchain,” Ardoino concluded. Though the matching engines are not peer-to-peer, such solutions are already being deployed by platforms such as Loopring and DeversiFi.
Loopring relies on zkRollups, a layer-two technology where the computational workload is offloaded to an operator that has to submit zero-knowledge proofs that state its changes are valid. In Loopring’s specific solution, the data is submitted to the mainnet in compressed batches. Finestone claimed that this makes it “a centralized exchange that simply cannot do anything evil or mishandle user funds.”
Related: Yield Farming Fuels Buzz Around DeFi, but Fundamentals Are Lagging
However, this puts some limitations on the performance of the exchange, as according to Finestone, Loopring can process 2,100 trades per second. While that is much higher than on-chain DEXs, it is still well below the performance of a fully centralized exchange. DeversiFi has higher performance at 9,000 transactions, but it stores the data off-chain in a “Data Availability Committee.” Both exchanges are noncustodial, though in DeversiFi’s case, users would need to rely on the committee instead of blockchain data to retrieve their funds.
Anton Bukov, chief technology officer of 1inch, pointed to similar solutions such as zkSync to combat latency and lack of performance. All layer-two systems are still largely in their infancy, and it’s likely that throughput could be improved in the future. The matching engine is not a bottleneck in this case, as Finestone revealed that Loopring uses conventional cloud computing providers such as Amazon Web Services and Google Cloud Platform. Some proposed DEXs such as Serum and Vega are still implementing on-chain matching, but they use higher-performance blockchains.
Can decentralized exchanges become the standard?
Given the fundamental price discovery limitation of AMMs, they cannot become the primary trading venues for cryptocurrencies. On-chain settlement is currently a major bottleneck, but even massive scaling improvements are unlikely to be enough for all traders.
Noncustodial but centrally operated exchanges fix many of the issues with existing DEXs, but for now, they appear to fall short of the performance levels required to replace their centralized counterparts. They also could, theoretically, front-run their users, which is similar to centralized venues in that regard, as Finestone noted. Compared with Optimistic Rollups, however, the operators are usually the exchanges themselves, which incentivizes them to not engage in foul play.
Finestone also believes that centralized exchanges will always remain useful, “mainly [for] those that desire ’legacy-style’ convenience of asset ownership, as well as wherever fiat is heavily interacted with.” In his view, an end state for DEXs would have them process two-thirds of the overall volume. Therefore, it’s possible that different types of centralized exchanges and decentralized exchanges could fill their own separate niches as the sector evolves further.