Clockwork Finance: Automated Analysis of Economic Security in Smart Contracts
Kushal Babel, Philip Daian, Mahimna Kelkar, Ari Juels
Abstract
We introduce the Clockwork Finance Framework (CFF), a general purpose, formal verification framework for mechanized reasoning about the economic security properties of composed decentralized-finance (DeFi) smart contracts.CFF features three key properties. It is contract complete, meaning that it can model any smart contract platform and all its contracts—Turing complete or otherwise. It does so with asymptotically constant model overhead. It is also attack-exhaustive by construction, meaning that it can automatically and mechanically extract all possible economic attacks on users’ cryptocurrency across modeled contracts.Thanks to these properties, CFF can support multiple goals: economic security analysis of contracts by developers, analysis of DeFi trading risks by users, fees UX, and optimization of arbitrage opportunities by bots or miners. Because CFF offers composability, it can support these goals with reasoning over any desired set of potentially interacting smart contract models.We instantiate CFF as an executable model for Ethereum contracts that incorporates a state-of-the-art deductive verifier. Building on previous work, we introduce extractable value (EV), a new formal notion of economic security in composed DeFi contracts that is both a basis for CFF and of general interest.We construct modular, human-readable, composable CFF models of four popular, deployed DeFi protocols in Ethereum: Uniswap, Uniswap V2, Sushiswap, and MakerDAO, representing a combined 24 billion USD in value as of March 2022. We use these models along with some other common models such as flash loans, airdrops and voting to show experimentally that CFF is practical and can drive useful, data-based EV-based insights from real world transaction activity. Without any explicitly programmed attack strategies, CFF uncovers on average an expected $56 million of EV per month in the recent past.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
14 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Demystifying DeFi MEV Activities in Flashbots Bundle cites High-Frequency Trading on Decentralized On-Chain Exchanges
- Demystifying DeFi MEV Activities in Flashbots Bundle cites Quantifying Blockchain Extractable Value: How dark is the forest?
- Lanturn: Measuring Economic Security of Smart Contracts Through Adaptive Learning cites High-Frequency Trading on Decentralized On-Chain Exchanges
- Lanturn: Measuring Economic Security of Smart Contracts Through Adaptive Learning cites Quantifying Blockchain Extractable Value: How dark is the forest?
- Stealing Trust: Unraveling Blind Message Attacks in Web3 Authentication cites Lanturn: Measuring Economic Security of Smart Contracts Through Adaptive Learning
- Quantifying Blockchain Extractable Value: How dark is the forest? cites High-Frequency Trading on Decentralized On-Chain Exchanges
Cited by top-tier papers14
- Demystifying DeFi MEV Activities in Flashbots BundleZihao Li, Jianfeng Li, Zheyuan He, Xiapu Luo et al.CCS 2023 · 29 citations
- Lanturn: Measuring Economic Security of Smart Contracts Through Adaptive LearningKushal Babel, Mojan Javaheripi, Yan Ji, Mahimna Kelkar et al.CCS 2023 · 18 citations
- Formal Model-Driven Analysis of Resilience of GossipSub to Attacks from Misbehaving PeersAnkit Kumar, Max von Hippel, Panagiotis Manolios, Cristina Nita-RotaruS&P 2024 · 8 citations
- Stealing Trust: Unraveling Blind Message Attacks in Web3 AuthenticationKailun Yan, Xiaokuan Zhang, Wenrui DiaoCCS 2024 · 5 citations
- Breaking Omertà: On Threshold Cryptography, Smart Collusion, and WhistleblowingMahimna Kelkar, Aadityan Ganesh, Aditi Partap, Joseph Bonneau et al.CCS 2025 · 1 citation
Builds on7
- Hawk: The Blockchain Model of Cryptography and Privacy-Preserving Smart ContractsAhmed E. Kosba, Andrew Miller, Elaine Shi, Zikai Wen et al.S&P 2016 · 2,201 citations
- QSYM : A Practical Concolic Execution Engine Tailored for Hybrid FuzzingInsu Yun, Sangho Lee, Meng Xu, Yeongjin Jang et al.USENIX Security 2018 · 537 citations
- teEther: Gnawing at Ethereum to Automatically Exploit Smart ContractsJohannes Krupp, Christian RossowUSENIX Security 2018 · 345 citations
- Quantifying Blockchain Extractable Value: How dark is the forest?Kaihua Qin, Liyi Zhou, Arthur GervaisS&P 2022 · 336 citations
- High-Frequency Trading on Decentralized On-Chain ExchangesLiyi Zhou, Kaihua Qin, Christof Ferreira Torres, Duc Viet Le et al.S&P 2021 · 243 citations
Related papers
- Verifying Economic Security of Smart Contracts via Unintended ReturnYi Rong, Xupeng Li, Ronghui GuOOPSLA 2026
- On the Just-In-Time Discovery of Profit-Generating Transactions in DeFi ProtocolsLiyi Zhou, Kaihua Qin, Antoine Cully, Benjamin Livshits et al.S&P 2021 · 148 citations
- Automated Inference on Financial Security of Ethereum Smart ContractsWansen Wang, Wenchao Huang, Zhaoyi Meng, Yan Xiong et al.USENIX Security 2023
- Smart Contract Fuzzing Towards Profitable VulnerabilitiesZiqiao Kong, Cen Zhang, Maoyi Xie, Ming Hu et al.FSE 2025 · 1 citation
- Automated Attack Synthesis for Constant Product Market MakersSujin Han, Jinseo Kim, Sung-Ju Lee, Insu YunISSTA 2025
