The Blessing and Curse of Automated Market Makers

Automated market makers (AMMs) have fueled decentralized finance, but they also have several challenges. Here’s how they’re getting solved.

Photo by Roman Melnychuk on Unsplash

There’s no doubt about it. Decentralized finance (DeFi) has surged since 2021, growing from just over $20 billion to nearly $160 billion as of March 2022, compared with a rise in the total cryptocurrency market from $433 billion to $2.5 trillion over the same period.

We’re in a crypto winter now. But that’s unlikely to last forever.

There is still optimism in the crypto community and the market value will largely return for major crypto assets in the months and years ahead.

Automated market makers (AMMs) have driven the rise of DeFi. Whereas centralized exchanges behave as a custodian of their customers’ funds and function as a matchmaker for demand and supply, decentralized exchanges (DEX) do not have a custodian.

Peer-to-peer trading is facilitated through a traditional AMM mechanism that says the product of any two assets must always equal some constant. If Bitcoin and Ether holders put $100 worth in a pool, then the product of the two assets always has to equal $100. If, however, a holder buys more Bitcoin, then the price of Bitcoin rises, and the other side provides more Bitcoin so that the equation balances. The hope is that the pool has many liquidity providers so that there is never a situation where the price of an asset rises so fast that there is insufficient liquidity to facilitate a trade at a reasonable price.

Market Makers and Liquidity

There’s no doubt about it: AMMs have played an integral role in creating liquidity in the overall market. The latest research by Gordon Liao, head of research at Uniswap Labs, and Dan Robinson, head of research at Paradigm, shows that “Uniswap v3 has around 2X greater market depth on average for spot ETH-dollar pairs,” compared with centralized counterparts.

Liquidity — sometimes measured as market depth — refers to how much one asset can be traded for another asset at a given price level. One reason for greater market depth is that AMMs can unlock a more diverse set of passive capital and institutional investors who have different risk profiles.

Other AMM designs have emerged since Uniswap, recognizing that the product of two tokens, X and Y, always equaling a constant, K, is not always the most efficient trading strategy — i.e., x*y = K — as Haseeb Qureshi, managing partner at Dragonfly Capital, pointed out in 2020.

When a buyer purchases large quantities of X, they can experience slippage, which is when buying a token drives the price up before the order finishes executing it (or selling it drives the price down). Slippage can be costly, especially during times of high trading.

But here’s a catch.

DEXs have begun to offer extreme incentives for people to stake tokens in exchange for governance rights (and often a slice of protocol revenue), leading to the “curve wars,” which is a label for the ongoing race to offer better terms of trade. The race to offer better conditions may have some unintended consequences on creating mercenary capital, but there are also some benefits: the requirement of staking tokens in exchange for governance rights has also created much good.

Front-running

Although there are many comparative advantages that DEXs hold over centralized exchanges, most notably greater security and opportunities for community building among token holders, AMMs are imperfect.

One of the major limitations to AMMs is the phenomenon of “front running,” which happens when another user places a similar trade as a prospective buyer, but sells it immediately after. Because the transactions are public, and the buyer has to wait until they can get added to the blockchain, others can view them and potentially place bids.

Front runners are not trying to execute the trade; rather, they are simply identifying transactions and bidding on them to drive up the price so that they can sell back and earn a profit.

By “sandwiching” the original bid from a buyer with a new bid, the speculator has the effect of extracting value from the transaction. In practice, miners are often the catalysts behind front running, leading to the term “miner extractable value” (MEV), referring to the rents that a third party can extract from the original transaction. These sandwich attacks have largely been automated and implemented by bots, accounting for the bulk of MEV.

Unfortunately, these attacks are driven by an incentive problem inherent in second-generation blockchains. “Validators may not have sufficiently strong incentives to monitor private pools because this reduces their MEV, so the execution risk for users who join these private pools goes up,” remarked Agostino Capponi, an associate professor of industrial engineering and operations research at Columbia University, explains to Magazine.

Capponi, together with co-authors, elaborate on this in a recent working paper that points out how private pools do not solve this front-running risk or reduce transaction fees — other solutions are required.

Capponi continues, “Frontrunning attacks not only lead to financial losses for traders of the DeFi ecosystem, but also congest the network and decrease the aggregate value of blockchain stakeholders.”

Front running can also affect liquidity provision. Price oracles — or mechanisms for providing information on prices — play an essential role in ensuring adequate liquidity exists in the market.

If the latest prices are not reflected “on-chain,” then users could front run the price with trades and earn a profit. Suppose that the latest price of ETH is not reflected on an exchange, which has it lower. Then, a user could buy ETH at its true price but sell it for potentially more, thereby earning a profit.

Challenging Business Models

AMMs were a revolutionary quantitative mechanism for enabling peer-to-peer trading because they instantaneously settle transactions after they are confirmed and included on the blockchain, and they allow any user to contribute liquidity and any buyer to trade tokens.

However, AMMs have largely relied on expectations of future growth to drive their valuations; the revenue from transaction fees is not only small but also fundamentally linked to the liquidity providers — not the exchange. That is, while Uniswap could take the fees as revenue, the way the smart contracts are written is such that the revenue goes directly to the liquidity providers.

Given that APRs from trade fees might be low, especially in newer AMMs, DEXs rely on offering their governance token for incentives, requiring a high price valuation to onboard and retain liquidity providers. These providers are often “mercenary capital” — going wherever the short-run return is higher.

The reality of the Uniswap business model is not an indictment; it creates incredible value, as evident by recent estimates of its daily trading volume of around $131 million. Rather, that it does not produce revenue is a function of its business model and actually makes Uniswap more of a public good for people in the DeFi community than anything else.

Just because AMMs have been integral to DeFi doesn’t mean there aren’t issues with the financial sustainability…

“[AMMs] offer an integral service but don’t adequately capture the value they provide through their token… the current models simply do not provide a transition from pre-revenue speculation to postmoney sustainability,” according to Eric Waisanen and Ethan Wood, co-founders of Hydro Finance, in their April white paper.

Front-running is a problem in large part because pending transactions are generally visible, so a bot can detect it, pay a higher gas fee, and thus, the miner processes the transaction first and impacts market pricing.

One way to avoid this is by hiding the transactions. The use of zero-knowledge proofs and other privacy-preserving solutions is becoming increasingly popular because it is thought to minimize front running and MEV attacks by obfuscating the size and time of transactions that are submitted and verified.

Hydro Finance is a relatively new project being built on the Secret Network, a privacy-preserving blockchain with “smart contracts that contain encrypted inputs, outputs, and state…. an encrypted mempool,” according to the Network. They’re working to solve these problems with AMMs.

How?

Hydro is trying to decouple itself from the permanent reliance on external liquidity providers by growing its own treasury of Protocol Owned Liquidity, and it also codifies buy-pressure through the inflation of the assets that it supports. Instead of giving all of the trading fees to the liquidity providers, the DAO controls the revenue, and the liquidity providers receive the DRO token.

“AMM’s, in their current form, are impractical but necessary services upon which the growth of DeFi is reliant. It is imperative that we evolve them past their inceptive shortcomings for the ethos of freedom and decentralization in finance to mature,” co-founder Waisanen says.

New business models may be required to sustain the community going forward. The curve wars that were observed in 2021 are unsustainable in the long run because there is not enough demand for different tokens.

Ultimately, the value of a token comes down to the value of the community, which requires a core team to lead and direct traffic. Time will tell how current challenges to the problems plaguing AMMs fare, but one lesson is clear: The DeFi community will need to apply best practices from business to make sustainable and scalable organizations succeed.

This article was written by Christos A. Makridis, the Chief Technology Officer and Head of Research at Living Opera. He is also a research affiliate at Stanford University’s Digital Economy Lab and Columbia Business School’s Chazen Institute, and holds dual doctorates in economics and management science & engineering from Stanford University. Follow us at @living_opera!


The Blessing and Curse of Automated Market Makers was originally published in DataDrivenInvestor on Medium, where people are continuing the conversation by highlighting and responding to this story.