Publication Type
Journal Article
Version
acceptedVersion
Publication Date
1-2022
Abstract
The selfdestruct function is provided by Ethereum smart contracts to destroy a contract on the blockchain system. However, it is a double-edged sword for developers. On the one hand, using the selfdestruct function enables developers to remove smart contracts (SCs) from Ethereum and transfers Ethers when emergency situations happen, e.g., being attacked. On the other hand, this function can increase the complexity for the development and open an attack vector for attackers. To better understand the reasons why SC developers include or exclude the selfdestruct function in their contracts, we conducted an online survey to collect feedback from them and summarize the key reasons. Their feedback shows that 66.67% of the developers will deploy an updated contract to the Ethereum after destructing the old contract. According to this information, we propose a method to find the self-destructed contracts (also called predecessor contracts) and their updated version (successor contracts) by computing the code similarity. By analyzing the difference between the predecessor contracts and their successor contracts, we found five reasons that led to the death of the contracts; two of them (i.e., Unmatched ERC20 Token and Limits of Permission) might affect the life span of contracts. We developed a tool named LIFESCOPE to detect these problems. LifeScope reports 0 false positives or negatives in detecting UNMATCHED ERC20 Token. In terms of Limits of Permission, LIFESCOPE achieves 77.89% of F-measure and 0.8673 of AUC in average. According to the feedback of developers who exclude selfdestruct functions, we propose suggestions to help developers use selfdestruct functions in Ethereum smart contracts better.
Keywords
Smart contract, Ethereum, selfdestruct function, empirical study
Discipline
Databases and Information Systems | Numerical Analysis and Scientific Computing
Research Areas
Software and Cyber-Physical Systems
Publication
ACM Transactions on Software Engineering and Methodology
Volume
31
Issue
2
First Page
1
Last Page
37
ISSN
1049-331X
Identifier
10.1145/3488245
Publisher
Association for Computing Machinery (ACM)
Citation
CHEN, Jiachi; XIA, Xin; LO, David; and GRUNDY, John C..
Why do smart contracts self-destruct? Investigating the selfdestruct function on Ethereum. (2022). ACM Transactions on Software Engineering and Methodology. 31, (2), 1-37.
Available at: https://ink.library.smu.edu.sg/sis_research/7669
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-No Derivative Works 4.0 International License.
Additional URL
https://doi.org/10.1145/3488245
Included in
Databases and Information Systems Commons, Numerical Analysis and Scientific Computing Commons