Skip to main content

FairMM: A Fast and Frontrunning-Resistant Crypto Market-Maker

  • Conference paper
  • First Online:
Book cover Cyber Security, Cryptology, and Machine Learning (CSCML 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13301))

Abstract

Frontrunning is a major problem in DeFi applications, such as blockchain-based exchanges. Albeit, existing solutions are not practical and/or they make external trust assumptions. In this work we propose a market-maker-based crypto-token exchange, which is both more efficient than existing solutions and offers provable resistance to frontrunning attack. Our approach combines in a clever way a game theoretic analysis of market-makers with new cryptography and blockchain tools to defend against all three ways by which an exchange might front-run, i.e., (1) reorder trade requests, (2) adaptively drop trade requests, and (3) adaptively insert (its own) trade requests. Concretely, we propose novel light-weight cryptographic tools and smart-contract-enforced incentives to eliminate reordering attacks and ensure that dropping requests have to be oblivious (uninformed) of the actual trade. We then prove that with these attacks eliminated, a so-called monopolistic market-maker has no longer incentives to add or drop trades. We have implemented and benchmarked our exchange and provide concrete evidence of its advantages over existing solutions.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Market capitalization of approx. $2 trillion during all of 2021.

  2. 2.

    Publishing can be done cheaply e.g. by only posting the hash on the blockchain and providing hash-preimages on demand.

  3. 3.

    https://etherscan.io/address/0x7a250d5630b4cf539739df2c5dacb4c659f2488d#analytics.

References

  1. Glosten, L.R., Milgrom, P.R.: Bid, ask and transaction prices in a specialist market with heterogeneously informed traders. J. Financ. Econ. 14(1), 71–100 (1985)

    Article  Google Scholar 

  2. Yao, A.C.-C.: How to generate and exchange secrets (extended abstract). In: 27th FOCS. IEEE Computer Society Press, pp. 162–167, October 1986

    Google Scholar 

  3. Goldreich, O., Micali, S., Wigderson, A.: How to play any mental game or a completeness theorem for protocols with honest majority. In: Aho, A. (ed.) 19th ACM STOC, pp. 218–229. ACM Press, May 1987

    Google Scholar 

  4. Glosten, L.R.: Insider trading, liquidity, and the role of the monopolist specialist. J. Bus. 62(2), 211–235 (1989)

    Article  Google Scholar 

  5. Asokan, N., Shoup, V., Waidner, M.: Optimistic fair exchange of digital signatures. In: Nyberg, K. (ed.) EUROCRYPT 1998. LNCS, vol. 1403, pp. 591–606. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0054156

    Chapter  Google Scholar 

  6. Cachin, C., Camenisch, J.: Optimistic fair secure computation. In: Bellare, M. (ed.) CRYPTO 2000. LNCS, vol. 1880, pp. 93–111. Springer, Heidelberg (2000). https://doi.org/10.1007/3-540-44598-6_6

    Chapter  Google Scholar 

  7. Canetti, R.: Universally composable security: a new paradigm for cryptographic protocols. In: 42nd FOCS, pp. 136–145. IEEE Computer Society Press, October 2001

    Google Scholar 

  8. Wolfers, J., Zitzewitz, E.: Prediction markets. J. Econ. Perspect. 18(2), 107–126 (2004)

    Article  Google Scholar 

  9. Das, S.: A learning market-maker in the Glosten-Milgrom model. Quant. Fin. 5(2), 169–180 (2005)

    Article  MathSciNet  Google Scholar 

  10. Pennock, D., Sami, R.: Computational aspects of prediction markets. In: Algorithmic Game Theory. Cambridge University Press (2007)

    Google Scholar 

  11. Das, S., Magdon-Ismail, M.: Adapting to a market shock: optimal sequential market-making. In: Proceedings of the Advances in Neural Information Processing Systems (NIPS), pp. 361–368 (2008)

    Google Scholar 

  12. Küpçü, A., Lysyanskaya, A.: Usable optimistic fair exchange. In: Pieprzyk, J. (ed.) CT-RSA 2010. LNCS, vol. 5985, pp. 252–267. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-11925-5_18

    Chapter  Google Scholar 

  13. Bentov, I., Kumaresan, R.: How to use bitcoin to design fair protocols. In: Garay, J.A., Gennaro, R. (eds.) CRYPTO 2014, Part II. LNCS, vol. 8617, pp. 421–439. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-662-44381-1_24

    Chapter  Google Scholar 

  14. Jutla, C.S.: Upending stock market structure using secure multi-party computation. Cryptology ePrint Archive, Report 2015/550 (2015). https://eprint.iacr.org/2015/550

  15. Banasik, W., Dziembowski, S., Malinowski, D.: Efficient zero-knowledge contingent payments in cryptocurrencies without scripts. In: Askoxylakis, I., Ioannidis, S., Katsikas, S., Meadows, C. (eds.) ESORICS 2016, Part II. LNCS, vol. 9879, pp. 261–280. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-45741-3_14

    Chapter  Google Scholar 

  16. Kiayias, A., Zhou, H.-S., Zikas, V.: Fair and robust multi-party computation using a global transaction ledger. In: Fischlin, M., Coron, J.-S. (eds.) EUROCRYPT 2016, Part II. LNCS, vol. 9666, pp. 705–734. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49896-5_25

    Chapter  Google Scholar 

  17. Campanelli, M., et al.: Zero-knowledge contingent payments revisited: attacks and payments for services. In: Thuraisingham, B.M., et al. (eds.) ACM CCS 2017. ACM Press, pp. 229–243 (2017)

    Google Scholar 

  18. Warren, W., Bandeali, A.: Ox: an open protocol for decentralized exchange on the Ethereum blockchain (2017)

    Google Scholar 

  19. AirSwap: AirSwap (2018)

    Google Scholar 

  20. Ether Delta: EtherDelta (2018)

    Google Scholar 

  21. IDEX: IDEX (2018)

    Google Scholar 

  22. Kyber: Kyber (2018)

    Google Scholar 

  23. Uniswap: Uniswap Exchange Protocol (2018)

    Google Scholar 

  24. Bitcoin Wiki: Zero Knowledge Contingent Payment (2018)

    Google Scholar 

  25. Bentov, I., et al.: Tesseract: real-time cryptocurrency exchange using trusted hardware. In: Cavallaro, L., et al. (eds.) ACM CCS 2019, pp. 1521–1538. ACM Press, November 2019

    Google Scholar 

  26. Fuchsbauer, G.: WI is not enough: zero-knowledge contingent (service) payments revisited. Cryptology ePrint Archive, Report 2019/964 (2019). https://eprint.iacr.org/2019/964

  27. Khalil, R., Gervais, A., Felley, G.: TEX - a securely scalable trustless exchange. Cryptology ePrint Archive, Report 2019/265 (2019). https://eprint.iacr.org/2019/265

  28. Curve: Curve (2020)

    Google Scholar 

  29. Daian, P., et al.: Flash Boys 2.0: frontrunning in decentralized exchanges, miner extractable value, and consensus instability. In: 2020 IEEE Symposium on Security and Privacy, pp. 910–927. IEEE Computer Society Press, May 2020

    Google Scholar 

  30. Sobol, A.: Frontrunning on automated decentralized exchange in proof of stake environment. Cryptology ePrint Archive, Report 2020/1206 (2020). https://eprint.iacr.org/2020/1206

  31. Almashaqbeh, G., et al.: Gage MPC: bypassing residual function leakage for non-interactive MPC. Cryptology ePrint Archive, Report 2021/256 (2021). https://eprint.iacr.org/2021/256

  32. Bartoletti, M., Chiang, J.H., Lluch-Lafuente, A.: Maximizing extractable value from automated market makers. In: CoRR abs/2106.01870 (2021)

    Google Scholar 

  33. Baum, C., David, B., Frederiksen, T.: P2DEX: privacy-preserving decentralized cryptocurrency exchange. Cryptology ePrint Archive, Report 2021/283 (2021). https://eprint.iacr.org/2021/283

  34. Breidenbach, L., et al.: Chainlink 2.0: next steps in the evolution of decentralized oracle networks (2021)

    Google Scholar 

  35. Ciampi, M., et al.: FairMM: a fast and frontrunning-resistant crypto market-maker. Cryptology ePrint Archive, Report 2021/609 (2021). https://ia.cr/2021/609

  36. Flashbots: Flashbots (2021)

    Google Scholar 

  37. Gnosis: Introducing Gnosis Protocol V2 and Balancer-Gnosis-Protocol (2021)

    Google Scholar 

  38. Stathakopoulou, C., et al.: Adding fairness to order: preventing front-running attacks in BFT protocols using TEEs. In: 40th International Symposium on Reliable Distributed Systems, SRDS 2021, Chicago, IL, USA, 20–23 September 2021, pp. 34–45. IEEE (2021)

    Google Scholar 

  39. Zhou, L., Qin, K., Gervais, A.: A2MM: mitigating frontrunning, transaction reordering and consensus instability in decentralized exchanges. In: CoRR abs/2106.07371 (2021)

    Google Scholar 

  40. Zhou, L., et al.: High-frequency trading on decentralized on-chain exchanges. In: 2021 IEEE Symposium on Security and Privacy (SP), pp. 428–445 (2021)

    Google Scholar 

  41. Bancor: Bancor Network

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Muhammad Ishaq .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Ciampi, M., Ishaq, M., Magdon-Ismail, M., Ostrovsky, R., Zikas, V. (2022). FairMM: A Fast and Frontrunning-Resistant Crypto Market-Maker. In: Dolev, S., Katz, J., Meisels, A. (eds) Cyber Security, Cryptology, and Machine Learning. CSCML 2022. Lecture Notes in Computer Science, vol 13301. Springer, Cham. https://doi.org/10.1007/978-3-031-07689-3_31

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-07689-3_31

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-07688-6

  • Online ISBN: 978-3-031-07689-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics