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 selfdestruct function enables developers to remove smart contracts (SC) 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.
翻译:自毁功能由 Etheyum 智能合同提供, 用于销毁块链系统中的合同。 但是, 这是开发商的双刃剑。 一方面, 使用自毁功能使开发商能够从 Eceenum 中删除智能合同( SC), 并在紧急情况发生时将Ethers 转移, 例如被攻击。 另一方面, 这个功能可以增加开发的复杂度, 为攻击者打开攻击矢量。 为了更好地了解SC 开发商在合同中包含或排除自毁功能的原因, 我们进行了一次在线调查, 以收集它们的反馈并总结关键原因。 他们的反馈表明, 在销毁旧合同后, 66.67%的开发商将向 Etheeum 部署更新的合同。 根据这些信息, 我们提出一种方法, 通过计算代码相似性来寻找自毁合同( 也称为前期合同) 及其更新版本( 后继者合同) 。 通过分析先前合同与其后续合同的区别, 我们发现导致合同死亡的五个原因; 其中两个原因( 例如, 智能 ERC 20 的自毁功能会显示 Ermalal- develope la) 的 Eliferal Serview Serview Adal 。