论文标题
为什么智能合同自我毁灭?调查以太坊上的自我毁灭功能
Why Do Smart Contracts Self-Destruct? Investigating the Selfdestruct Function on Ethereum
论文作者
论文摘要
以太坊智能合约提供了自我限制功能,以销毁区块链系统上的合同。但是,这是开发人员的双刃剑。一方面,使用自源功能使开发人员能够从以太坊删除智能合约(SC),并在紧急情况发生时转移以太币,例如受到攻击。另一方面,此功能可以增加开发的复杂性,并为攻击者打开攻击向量。为了更好地理解SC开发人员在合同中包括或排除SelfDertuct功能的原因,我们进行了在线调查,以收集他们的反馈并总结关键原因。他们的反馈表明,在破坏旧合同后,有66.67%的开发商将向以太坊部署更新的合同。根据此信息,我们提出了一种通过计算代码相似性来查找自毁合同(也称为前身合约)及其更新版本(继任合同)的方法。通过分析前任合同与其继任合同之间的差异,我们发现了导致合同死亡的五个原因;其中两个(即无与伦比的ERC20令牌和许可限制)可能会影响合同的寿命。我们开发了一种名为LifeScope的工具来检测这些问题。 LifeScope在检测无与伦比的ERC20令牌时报告了0个假阳性或负面因素。就许可限制而言,LifEscope可以平均达到77.89%的F量级和0.8673的AUC。根据排除自我毁灭功能的开发人员的反馈,我们提出建议,以帮助开发人员更好地使用以太坊智能合约中的自我毁灭功能。
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.