The trouble with automated market makers
Automated market makers are a true public good in crypto, enabling genuinely decentralized trading 24/7 and supporting the wider DeFi ecosystems. But they’re not without a host of problems, writes digital economist and academic Christos A. Makridis.
The decentralized finance (DeFi) market 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.
While the recent crypto washout in the wake of the collapse of Terra’s LUNA and UST has caused the market value of DeFi to fall almost all the way back down to $60 billion, 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.
The trouble with AMMs.
The rise of DeFi has been thanks largely to the presence of liquidity made possible through automated market makers (AMM). Whereas centralized exchanges function as a custodian of their customers’ funds and function as a matchmaker for demand and supply, decentralized exchanges (DEX) do not have a custodian.
Instead, peer-to-peer trading, as it was initially designed, is facilitated through a traditional AMM mechanism that says the product of any two assets must always equal some constant. In other words, 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.
Liquid gold
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,” relative to their centralized exchange counterparts, such as Binance and Coinbase.
Here, liquidity is measured using market depth, which 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.
Uniswap research.
Since the inception of Uniswap, other AMM designs have emerged, 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.
To attract greater liquidity and avoid high slippage rates, 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 the requirement of staking tokens in exchange for governance rights has also created much good.
“Curve wars are representative of the fact that governance has some value… being able to govern how a protocol distributes its incentives even within its own protocol is very powerful: If you force people to commit to make a decision about something in governance, you can create powerful feedback loops,” Kain Warwick, founder of Synthetix, tells Magazine. Warwick has been called affectionately the “father of modern agriculture” for his role in popularizing yield farming.
“Giving away ownership of a protocol in the early part of its lifecycle to the people who provide feedback and test it is incredibly powerful… It is a tool you just don’t have in the traditional startup world. We are witnessing a renaissance of decentralized finance strategies.”
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. In an academic paper, Andreas Park, professor of finance at the University of Toronto, said:
“The intrinsic transparency of blockchain operations create a challenge: an attacker can ‘sandwich’ any trade by submitting a transaction that gets processed before the original one and that the attacker reverses after.”
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,” 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.”
I’m working on a long post on the history of frontrunning Synthetix. Even as I wrap it up the community is debating what is likely to happen once exchanges are enabled on OΞ. One of the things I love most about Synthetix is our commitment to progress even under low information.
— kain.eth (✨