SmartInv: Multimodal Learning for Smart Contract Invariant Inference
Sally Junsong Wang, Kexin Pei, Junfeng Yang
Abstract
Smart contracts are software programs that enable diverse business activities on the blockchain. Recent research has identified new classes of "machine un-auditable" bugs that arise from source code not meeting underlying transaction contexts. Existing detection methods require human understanding of underlying transaction logic and manual reasoning across different sources of context (i.e., modalities), such as code and natural language specifying the expected transaction behavior.To automate the detection of "machine un-auditable" bugs, we present SmartInv, an accurate and fast smart contract invariant inference framework. Our key insight is that the expected behavior of smart contracts, as specified by invariants, relies on understanding and reasoning across multimodal information, such as source code and natural language. We propose a new finetuning and prompting strategy to foundation models, Tier of Thought (ToT), to reason across multiple modalities of smart contracts and to generate invariants. SmartInv then localizes potential vulnerabilities by checking the violation of those generated invariants.We evaluate SmartInv on real-world smart contract bugs that resulted in financial losses over the past 2.5 years (from January 1, 2021 to May 31, 2023). Extensive evaluation shows that SmartInv can generate useful invariants to effectively localize "machine un-auditable" bugs, from which SmartInv uncovers 119 zero-day bugs. We sampled eight bugs and reported them to the respective developers. Six vulnerabilities were quickly fixed by the developers, five of which are confirmed as "high severity."
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 47e8653f-55ef-472b-8304-19318ec4db13Cited by top-tier papers7
- SCALM: Detecting Bad Practices in Smart Contracts Through LLMsZongwei Li, Xiaoqi Li, Wenkai Li, Xin WangAAAI 2025 · 40 citations
- Combining Fine-Tuning and LLM-Based Agents for Intuitive Smart Contract Auditing with JustificationsWei Ma, Daoyuan Wu, Yuqiang Sun, Tianwen Wang et al.ICSE 2025 · 28 citations
- PromFuzz: Leveraging LLM-Driven and Bug-Oriented Composite Analysis for Detecting Functional Bugs in Smart ContractsXingshuang Lin, Qinge Xie, Binbin Zhao, Yuan Tian et al.ASE 2025 · 5 citations
- Following Devils' Footprint: Towards Real-time Detection of Price Manipulation AttacksBosi Zhang, Ningyu He, Xiaohui Hu, Kai Ma et al.USENIX Security 2025
- One Signature, Multiple Payments: Demystifying and Detecting Signature Replay Vulnerabilities in Smart ContractsZexu Wang, Jiachi Chen, Zewei Lin, Wenqing Chen et al.ICSE 2026
Builds on22
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo et al.NeurIPS 2022 · 8,168 citations
- Making Smart Contracts SmarterLoi Luu, Duc-Hiep Chu, Hrishi Olickel, Prateek Saxena et al.CCS 2016 · 2,306 citations
- Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context LearningHaokun Liu, Derek Tam, Mohammed Muqeeth, Jay Mohta et al.NeurIPS 2022 · 1,483 citations
- ZEUS: Analyzing Safety of Smart ContractsSukrit Kalra, Seep Goel, Mohan Dhawan, Subodh SharmaNDSS 2018 · 595 citations
Related papers
- Towards Finding Accounting Errors in Smart ContractsBrian ZhangICSE 2024 · 8 citations
- SmarTest: Effectively Hunting Vulnerable Transaction Sequences in Smart Contracts through Language Model-Guided Symbolic ExecutionSunbeom So, Seongjoon Hong, Hakjoo OhUSENIX Security 2021 · 118 citations
- Demystifying Exploitable Bugs in Smart ContractsZhuo Zhang, Brian Zhang, Wen Xu, Zhiqiang LinICSE 2023 · 80 citations
- Thought Is All You Need: Smart Contract Vulnerability Detection with Thought-Augmented Large Language ModelChaoyuan Peng, Muhui Jiang, Yajin Zhou, Lei WuFSE 2026
- Detecting Bugs with Substantial Monetary Consequences by LLM and Rule-based ReasoningBrian Zhang, Zhuo ZhangNeurIPS 2024 · 12 citations
