Defect Prediction for Solidity Smart Contracts Based on Software Measurement

被引:0
|
作者
Yang H.-W. [1 ]
Cui Z.-Q. [1 ,4 ]
Chen X. [2 ]
Jia M.-H. [3 ]
Zheng L.-W. [1 ]
Liu J.-B. [1 ]
机构
[1] School of Computer, Beijing Information Science and Technology University, Beijing
[2] School of Computer Science and Technology, Nantong University, Nantong
[3] School of Information, Central University of Finance and Economics, Beijing
[4] Beijing Key Laboratory of Internet Culture and Digital Dissemination Research (Beijing Information Science and Technology University), Beijing
来源
Ruan Jian Xue Bao/Journal of Software | 2022年 / 33卷 / 05期
基金
中国国家自然科学基金;
关键词
Defect number prediction; Defect tendency prediction; Smart contract; Software defect prediction; Solidity;
D O I
10.13328/j.cnki.jos.006550
中图分类号
学科分类号
摘要
With the rise of blockchain technology, more and more researchers and companies pay attention to the security of smart contracts. Currently, there are some studies on smart contract defect detection and testing techniques. Software defect prediction technology is an effective supplement to the defect detection techniques, which can optimize the allocation of testing resources and improve the efficiency of software testing. However, there is no research on software defect prediction for the smart contract. To address this problem, this study proposes a defect prediction method for Solidity smart contracts. First, it designs a metrics suite (smart contract-Solidity, SC-Sol) which considers the variables, functions, structures, and features of Solidity smart contracts, and SC-Sol is combined with the traditional metrics suite (code complexity and features of object-oriented program, COOP), which consider the object-oriented features, into COOP-SC-Sol metrics suite. Then, it extracts relevant metric meta-information from the Solidity code and performs defect detection to obtain the defects information to construct a Solidity smart contracts defect data set. On this basis, seven regression models and six classification models are applied to predict the defects of Solidity smart contracts to verify the performance differences of different metrics suites and different models for predicting the number and tendency of defects. Experimental results show that compared with the COOP, COOP-SC-Sol can improve the performance of the defect prediction model by 8% in terms of the F1-score. In addition, the problem of class imbalance in smart contract defect prediction is further studied. The result shows that the random under-sampling method can improve the performance of the defect prediction model by 9% in F1-score. In predicting the tendency of specific types of defects, the performance of the model is affected by the imbalance of data sets. Better performance is achieved in predicting the types of defects which the percentage of defect modules is greater than 10%. © Copyright 2022, Institute of Software, the Chinese Academy of Sciences. All rights reserved.
引用
收藏
页码:1587 / 1611
页数:24
相关论文
共 57 条
  • [1] Yuan Y, Wang FY., Blockchain: The state of the art and future trends, Acta Automatica Sinica, 42, 4, pp. 481-494, (2016)
  • [2] Shao QF, Jin CQ, Zhang Z, Qian WN, Zhou AY., Blockchain: Architecture and research progress, Chinese Journal of Computers, 41, 5, pp. 969-988, (2018)
  • [3] Szabo N., Formalizing and securing relationships on public networks, First Monday, 2, 9, pp. 1-21, (1997)
  • [4] Ouyang LW, Wang S, Yuan Y, Ni XC, Wang FY., Smart contracts: Architecture and research progresses, Acta Automatica Sinica, 45, 3, pp. 445-457, (2019)
  • [5] He HW, Yan A, Chen ZH., Survey of smart contract technology and application based on blockchain, Journal of Computer Research and Development, 55, 11, pp. 2452-2466, (2018)
  • [6] Wang S, Ni XC, Yuan Y, Wang FY, Wang X, Ouyang LW., A preliminary research of prediction markets based on blockchain powered smart contracts, Proc. of the 2018 IEEE Int'l Conf. on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom) and IEEE Cyber, Physical and Social Computing (CPSCom) and IEEE Smart Data (SmartData), pp. 1287-1293, (2018)
  • [7] Maicher L, de la Rosa JL, Gibovic D, Torres-Padrosa V., On intellectual property in online open innovation for SME by means of blockchain and smart contracts, Proc. of the World Open Innovation Conf. 2016, (2016)
  • [8] Azaria A, Ekblaw A, Vieira A, Lippman A., MedRec: Using blockchain for medical data access and permission management, Proc. of the 2nd Int'l Conf. on Open and Big Data (OBD), pp. 25-30, (2016)
  • [9] Dorri A, Kanhere SS, Jurdak R., Towards an optimized blockchain for IoT, Proc. of the 2nd IEEE/ACM Int'l Conf. on Internet-of-Things Design and Implementation (IoTDI), pp. 173-178, (2017)
  • [10] Luu L, Chu DH, Olickel H, Saxena P, Hobor A., Making smart contracts smarter, Proc. of the 2016 ACM SIGSAC Conf. on Computer and Communications Security, pp. 254-269, (2016)