Paper 2023/892

Suboptimality in DeFi

Aviv Yaish, Hebrew University of Jerusalem
Maya Dotan, Hebrew University of Jerusalem
Kaihua Qin, Imperial College London
Aviv Zohar, Hebrew University of Jerusalem
Arthur Gervais, University College London

The Decentralized Finance (DeFi) ecosystem has proven to be immensely popular in facilitating financial operations such as lending and exchanging assets, with Ethereum-based platforms holding a combined amount of more than 30 billion USD. The public availability of these platforms' code together with real-time data on all user interactions and platform liquidity has given rise to sophisticated automatic tools that recognize profit opportunities on behalf of users and seize them. In this work, we formalize three core DeFi primitives which together are responsible for a daily volume of over 100 million USD in Ethereum-based platforms alone: (1) lending and borrowing funds, (2) liquidation of insolvent loans, and (3) using flash-swaps to close arbitrage opportunities between cryptocurrency exchanges. The profit which can be made from each primitive is then cast as an optimization problem that can be readily solved. We use our formalization to analyze several case studies for each primitive, showing that popular platforms and tools which promise to automatically optimize profits for users, actually fall short. In specific instances, the profits can be increased by more than 100%, with highest amount of ``missed'' revenue by a single suboptimal action equal to 428.14 ETH, or roughly 517K USD. Finally, we show that many missed opportunities to make a profit do not go unnoticed by other users. Indeed, suboptimal transactions are sometimes immediately followed by ``trailing'' back-running transactions which extract additional profits using similar actions. By analyzing a subset of such events, we uncover that some users who frequently create such trailing transactions are heavily tied to specific miners, meaning that all of their transactions appear only in blocks mined by one miner in particular. As some of the backrun non-optimal transactions are private, we hypothesize that the users who create them are, in fact, miners (or users collaborating with miners) who use inside information known only to them to make a profit, thus gaining an unfair advantage.

Available format(s)
Publication info
CryptocurrencyBlockchainDeFiMiner Extractable Value
Contact author(s)
aviv yaish @ mail huji ac il
mayadotan @ mail huji ac il
kaihua qin @ imperial ac uk
avivz @ cs huji ac il
arthur @ gervais cc
2023-06-12: approved
2023-06-09: received
See all versions
Short URL
Creative Commons Attribution


      author = {Aviv Yaish and Maya Dotan and Kaihua Qin and Aviv Zohar and Arthur Gervais},
      title = {Suboptimality in DeFi},
      howpublished = {Cryptology ePrint Archive, Paper 2023/892},
      year = {2023},
      note = {\url{}},
      url = {}
Note: In order to protect the privacy of readers, does not use cookies or embedded third party content.