Automating Comment Generation for Smart Contract from Bytecode
ACM Transactions on Software Engineering and Methodology · 31.03.2025 · 34 (3) · 1-31
DOI: 10.1145/3699597 ↗Kurz gefasst
Fachartikel in der Zeitschrift ACM Transactions on Software Engineering and Methodology, online erschienen am 23.02.2025. Verfasst von Jianhang Xiang und 5 weiteren Autor:innen. Die Arbeit wurde bisher 15-mal zitiert (Crossref) und nennt 71 Literaturangaben. Gefördert von: National Key Research and Development Program of China, National Science Foundation of China, Fundamental Research Funds for the Central Universities.
Abstract (Originalsprache)
Recently, smart contracts have played a vital role in automatic financial and business transactions. To help end users without programming background to better understand the logic of smart contracts, previous studies have proposed models for automatically translating smart contract source code into their corresponding code summaries. However, in practice, only 13% of smart contracts deployed on the Ethereum blockchain are associated with source code. The practical usage of these existing tools is significantly restricted. Considering that bytecode is always necessary when deploying smart contracts, in this article, we first introduce the task of automatically generating smart contract code summaries from bytecode. We propose a novel approach, named Smart Contract Bytecode Translator ( SmartBT ) for automatically translating smart contract bytecode into fine-grained natural language description directly. Two key challenges are posed for this task: structural code logic hidden in bytecode and the huge semantic gap between bytecode and natural language descriptions. To address the first challenge, we transform bytecode into Control-Flow Graph (CFG) to learn code structural and logic details. Regarding the second challenge, we introduce an information retrieval component to fetch similar comments for filling the semantic gap. Then, the structural input and semantic input are used to build an attentional sequence-to-sequence neural network model. The copy mechanism is employed to copy rare words directly from similar comments, and the coverage mechanism is employed to eliminate repetitive outputs. The automatic evaluation results show that SmartBT outperforms a set of baselines by a large margin, and the human evaluation results show the effectiveness and potential of SmartBT in producing meaningful and accurate comments for smart contract code from bytecode directly.
Förderung
- National Key Research and Development Program of China
- National Science Foundation of China
- Fundamental Research Funds for the Central Universities
- Shanghai Sailing Program
- Starry Night Science Fund of Zhejiang University Shanghai Institute for Advanced Study
- Ningbo Natural Science Foundation
Zitieren
APA
Xiang, J., Gao, Z., Bao, L., Hu, X., Chen, J., & Xia, X. (2025). Automating Comment Generation for Smart Contract from Bytecode. ACM Transactions on Software Engineering and Methodology, 34(3), 1-31. https://doi.org/10.1145/3699597
Vancouver
Xiang J, Gao Z, Bao L, Hu X, Chen J, Xia X. Automating Comment Generation for Smart Contract from Bytecode. ACM Transactions on Software Engineering and Methodology. 2025;34(3):1-31. doi:10.1145/3699597
BibTeX
@article{Xiang2025,
author = {Xiang, Jianhang and Gao, Zhipeng and Bao, Lingfeng and Hu, Xing and Chen, Jiayuan and Xia, Xin},
title = {Automating Comment Generation for Smart Contract from Bytecode},
journal = {ACM Transactions on Software Engineering and Methodology},
year = {2025},
volume = {34},
number = {3},
pages = {1--31},
doi = {10.1145/3699597}
}
EUVIMED