Lune

FSE2023Top-tier venue

DeepInfer: Deep Type Inference from Smart Contract Bytecode

Kunsong Zhao, Zihao Li, Jianfeng Li, He Ye, Xiapu Luo, Ting Chen

Abstract

Smart contracts play an increasingly important role in Ethereum platform. It provides various functions implementing numerous services, whose bytecode runs on Ethereum Virtual Machine. To use services by invoking corresponding functions, the callers need to know the function signatures. Moreover, such signatures provide crucial information for many downstream applications, e.g., identifying smart contracts, fuzzing, detecting vulnerabilities, etc. However, it is challenging to infer function signatures from the bytecode due to a lack of type information. Existing work solving this problem depended heavily on limited databases or hard-coded heuristic patterns. However, these approaches are hard to be adapted to semantic differences in distinct languages and various compiler versions when developing smart contracts. In this paper, we propose a novel framework DeepInfer that first leverages deep learning techniques to automatically infer function signatures and returns. The novelties of DeepInfer are: 1) DeepInfer lifts the bytecode into the Intermediate Representation (IR) to preserve code semantics; 2) DeepInfer extracts the type-related knowledge (e.g., critical data flows, constant values, and control flow graphs) from the IR to recover function signatures and returns. We conduct experiments on Solidity and Vyper smart contracts and the results show that DeepInfer performs faster and more accurate than existing tools, while being immune to changes in different languages and various compiler versions.

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.

12 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Nurgle: Exacerbating Resource Consumption in Blockchain State Storage via MPT Manipulation cites Demystifying DeFi MEV Activities in Flashbots Bundle
  • COBRA: Interaction-Aware Bytecode-Level Vulnerability Detector for Smart Contracts cites Learning to Fuzz from Symbolic Execution with Application to Smart Contracts
  • Are We There Yet? Unraveling the State-of-the-Art Smart Contract Fuzzers cites Demystifying DeFi MEV Activities in Flashbots Bundle
  • Are We There Yet? Unraveling the State-of-the-Art Smart Contract Fuzzers cites Learning to Fuzz from Symbolic Execution with Application to Smart Contracts
  • Towards Automatic Discovery of Denial of Service Weaknesses in Blockchain Resource Models cites Nurgle: Exacerbating Resource Consumption in Blockchain State Storage via MPT Manipulation
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers12

  1. Demystifying DeFi MEV Activities in Flashbots BundleZihao Li, Jianfeng Li, Zheyuan He, Xiapu Luo et al.CCS 2023 · 29 citations
  2. Are We There Yet? Unraveling the State-of-the-Art Smart Contract FuzzersShuohan Wu, Zihao Li, Luyi Yan, Weimin Chen et al.ICSE 2024 · 24 citations
  3. Nurgle: Exacerbating Resource Consumption in Blockchain State Storage via MPT ManipulationZheyuan He, Zihao Li, Ao Qiao, Xiapu Luo et al.S&P 2024 · 21 citations
  4. COBRA: Interaction-Aware Bytecode-Level Vulnerability Detector for Smart ContractsWenkai Li, Xiaoqi Li, Zongwei Li, Yuqing ZhangASE 2024 · 4 citations
  5. Towards Automatic Discovery of Denial of Service Weaknesses in Blockchain Resource ModelsFeng Luo, Huangkun Lin, Zihao Li, Xiapu Luo et al.CCS 2024 · 4 citations

Builds on19

  1. Unsupervised Translation of Programming LanguagesBaptiste Rozière, Marie-Anne Lachaux, Lowik Chanussot, Guillaume LampleNeurIPS 2020 · 606 citations
  2. Learning to Fuzz from Symbolic Execution with Application to Smart ContractsJingxuan He, Mislav Balunovic, Nodar Ambroladze, Petar Tsankov et al.CCS 2019 · 288 citations
  3. Retrieval-based neural source code summarizationJian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun et al.ICSE 2020 · 242 citations
  4. Neural Nets Can Learn Function Type Signatures From BinariesZheng Leong Chua, Shiqi Shen, Prateek Saxena, Zhenkai LiangUSENIX Security 2017 · 175 citations
  5. MAVEN: A Massive General Domain Event Detection DatasetXiaozhi Wang, Ziqi Wang, Xu Han, Wangyi Jiang et al.EMNLP 2020 · 143 citations

Related papers

  1. BugSweeper: Function-Level Detection of Smart Contract Vulnerabilities Using Graph Neural NetworksUisang Lee, Changhoon Chung, Junmo Lee, Soo-Mook MoonAAAI 2026
  2. Smart Learning to Find Dumb ContractsTamer Abdelaziz, Aquinas HoborUSENIX Security 2023
  3. Recasting Type Hints from WebAssembly ContractsKunsong Zhao, Zihao Li, Weimin Chen, Xiapu Luo et al.FSE 2025 · 2 citations
  4. Reentrancy Vulnerability Detection and Localization: A Deep Learning Based Two-phase ApproachZhuo Zhang, Yan Lei, Meng Yan, Yue Yu et al.ASE 2022 · 56 citations
  5. Smarter Contracts: Detecting Vulnerabilities in Smart Contracts with Deep Transfer LearningChristoph Sendner, Huili Chen, Hossein Fereidooni, Lukas Petzi et al.NDSS 2023
Dusk over the sea between two cliffs drawn in fine vertical lines