GasChecker: Scalable Analysis for Discovering Gas-Inefficient Smart Contracts

被引:66
作者
Chen, Ting [1 ]
Feng, Youzheng [2 ]
Li, Zihao [2 ]
Zhou, Hao [3 ]
Luo, Xiaopu
Li, Xiaoqi [3 ]
Xiao, Xiuzhuo [1 ]
Chen, Jiachi [3 ]
Zhang, Xiaosong [1 ]
机构
[1] Univ Elect Sci & Technol China, Sch Comp Sci Engn, Chengdu 611731, Sichuan, Peoples R China
[2] Univ Elect Sci & Technol China, Inst Big Data Secur, Big Data Res Ctr, Chengdu 611731, Sichuan, Peoples R China
[3] Hong Kong Polytech Univ, Dept Comp, Kowloon, Hong Kong, Peoples R China
基金
国家重点研发计划; 中国国家自然科学基金;
关键词
Contracts; Task analysis; Programming; Load management; Tools; Load modeling; Smart contract; scalable analysis; gas-inefficient pattern; symbolic execution; parallelization; MapReduce;
D O I
10.1109/TETC.2020.2979019
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Ethereum, the largest blockchain for running smart contracts, charges the people who send transactions to deploy or invoke smart contracts for thwarting resource abuse. The amount of transaction fee depends on the size of that contract and the operations executed by that contract. Consequently, smart contracts with inefficient code will waste money. In this article, we propose and develop the first tool, named GasChecker, for automatically identifying gas-inefficient code in smart contracts, and conduct the first empirical study on the prevalence of gas-inefficient code in the deployed smart contracts. More precisely, we first summarize ten gas-inefficient programming patterns and propose a new approach based on symbolic execution (SE) to detect them in the bytecode of smart contracts. To make our approach scalable to analyze millions of smart contracts, we parallelize SE by tailoring it to the MapReduce programming model, and propose a new feedback-based load balancing strategy to effectively utilize cloud resources. Extensive experiments show that GasChecker scales well with the increase of workers. The empirical study demonstrates that lots of real smart contracts contain various inefficient code. Manual investigation demonstrates that only 2.5 percent of discovered gas-inefficient instances are false positives.
引用
收藏
页码:1433 / 1448
页数:16
相关论文
共 34 条
[1]  
Albert E., 2020, P TACAS
[2]   Running on Fumes Preventing Out-of-Gas Vulnerabilities in Ethereum Smart Contracts Using Static Resource Analysis [J].
Albert, Elvira ;
Gordillo, Pablo ;
Rubio, Albert ;
Sergey, Ilya .
VERIFICATION AND EVALUATION OF COMPUTER AND COMMUNICATION SYSTEMS, VECOS 2019, 2019, 11847 :63-78
[3]  
[Anonymous], 2017, ETHEREUM HOMESTEAD D
[4]  
[Anonymous], 2017, Blockchain
[5]  
[Anonymous], 2010, 2 USENIX WORKSHOP HO
[6]  
[Anonymous], 2010, ISSTA, DOI 10.1145/1831708.1831732
[7]  
[Anonymous], 2017, P INT C INT ADV SYST
[8]  
Bucur S, 2011, EUROSYS 11: PROCEEDINGS OF THE EUROSYS 2011 CONFERENCE, P183
[9]  
Chen TH, 2019, IEEE INT FUZZY SYST, DOI [10.1109/FUZZ-IEEE.2019.8858916, 10.1109/ICIPRM.2019.8819142]
[10]   An Adaptive Gas Cost Mechanism for Ethereum to Defend Against Under-Priced DoS Attacks [J].
Chen, Ting ;
Li, Xiaoqi ;
Wang, Ying ;
Chen, Jiachi ;
Li, Zihao ;
Luo, Xiapu ;
Au, Man Ho ;
Zhang, Xiaosong .
INFORMATION SECURITY PRACTICE AND EXPERIENCE, ISPEC 2017, 2017, 10701 :3-24