Abstract:
Smart contracts on Ethereum can be used to encode business logic and have been applied to many different areas, such as token exchanges and games. Unlike general programs...Show MoreMetadata
Abstract:
Smart contracts on Ethereum can be used to encode business logic and have been applied to many different areas, such as token exchanges and games. Unlike general programs, the computations of contracts on Ethereum are restricted by the gas limit. If a transaction runs out of the gas limit before an execution finishes, the Ethereum virtual machine throws an out-of-gas exception, and the entire transaction fails, which reverts to the state before the transaction started, although the transaction fee is still deducted. It is therefore, essential to conduct a gas estimation before sending a transaction. Existing studies have mostly failed in estimating the gas for a loop function because the number of iterations of the loops cannot be statically determined. However, we found that a quarter of all contracts have loop functions, and the gas cost for the loops is higher than for the other functions. Therefore, it is necessary to apply a gas estimation for the loop functions. In this study, we propose a gas estimation approach based on the transaction trace to dynamically estimate the gas for the loop functions. Our belief is that we can learn the relationship between the historical transaction traces and their gas costs to estimate the gas for new transactions. We considered three different abstractions of the original transaction trace and fed them to different machine learning models. The results show that our approach is effective in gas estimation and that a random forest can achieve the most accurate estimation.
Published in: IEEE Open Journal of the Computer Society ( Volume: 1)
Funding Agency:

National Institute of Informatics, Chiyoda-ku, Japan
The Graduate University for Advanced Studies(SOKENDAI), Shonan Village, Hayama, Kanagawa, Japan
Chunmiao Li received the bachelor's degree from Northwest University in 2015 and the master's degree from Shanghai Jiao Tong University in 2018. She is currently the Ph.D. student with the Graduate University for Advanced Studies (SOKENDAI), Japan. Her current research interests include blockchain, smart contract security, and program analysis.
Chunmiao Li received the bachelor's degree from Northwest University in 2015 and the master's degree from Shanghai Jiao Tong University in 2018. She is currently the Ph.D. student with the Graduate University for Advanced Studies (SOKENDAI), Japan. Her current research interests include blockchain, smart contract security, and program analysis.View more

National Institute of Informatics, Chiyoda-ku, Japan
Shijie Nie received the Ph.D. degree from the Graduate University for Advanced Studies (SOKENDAI), Japan. He is currently a Project Researcher with the National Institute of Informatics (NII), Japan. His current research interests include computational photography and deep learning.
Shijie Nie received the Ph.D. degree from the Graduate University for Advanced Studies (SOKENDAI), Japan. He is currently a Project Researcher with the National Institute of Informatics (NII), Japan. His current research interests include computational photography and deep learning.View more

Department of Social Informatics, Kyoto University, Kyoto, Japan
Yang Cao received the Ph.D. degree from the Kyoto University in 2017. He is an Assistant Professor with Yoshikawa & Ma Lab, Department of Social Informatics, Kyoto University. His research interests include data privacy and security.
Yang Cao received the Ph.D. degree from the Kyoto University in 2017. He is an Assistant Professor with Yoshikawa & Ma Lab, Department of Social Informatics, Kyoto University. His research interests include data privacy and security.View more

Department of Computing, The Open University, Milton Keynes, U.K.
Yijun Yu received the B.Sc., M.Sc., and Ph.D. degrees from the Department of Computer Science at Fudan University in 1992, 1995, 1998, respectively. He is a Senior Lecturer with the Department of Computing and Communications in The Open University. His research interests include the areas of requirements engineering, maintenance and evolution, security and privacy. He is a member of the IEEE Computer Society and the Briti...Show More
Yijun Yu received the B.Sc., M.Sc., and Ph.D. degrees from the Department of Computer Science at Fudan University in 1992, 1995, 1998, respectively. He is a Senior Lecturer with the Department of Computing and Communications in The Open University. His research interests include the areas of requirements engineering, maintenance and evolution, security and privacy. He is a member of the IEEE Computer Society and the Briti...View more

Information Systems Architecture Research Division, National Institute of Informatics, Chiyoda-ku, Japan
Zhenjiang Hu (Fellow, IEEE) received the B.S. and M.S. degrees from Department of Computer Science and Engineering of Shanghai Jiaotong University in 1988 and 1991 respectively, and Ph.D. degree from Department of Information Engineering of University of Tokyo in 1996. He is a Professor and the Chair with the Department of Computer Science and Technology, Peking University. He is Fellow of JFES (Japan Federation of Engine...Show More
Zhenjiang Hu (Fellow, IEEE) received the B.S. and M.S. degrees from Department of Computer Science and Engineering of Shanghai Jiaotong University in 1988 and 1991 respectively, and Ph.D. degree from Department of Information Engineering of University of Tokyo in 1996. He is a Professor and the Chair with the Department of Computer Science and Technology, Peking University. He is Fellow of JFES (Japan Federation of Engine...View more

National Institute of Informatics, Chiyoda-ku, Japan
The Graduate University for Advanced Studies(SOKENDAI), Shonan Village, Hayama, Kanagawa, Japan
Chunmiao Li received the bachelor's degree from Northwest University in 2015 and the master's degree from Shanghai Jiao Tong University in 2018. She is currently the Ph.D. student with the Graduate University for Advanced Studies (SOKENDAI), Japan. Her current research interests include blockchain, smart contract security, and program analysis.
Chunmiao Li received the bachelor's degree from Northwest University in 2015 and the master's degree from Shanghai Jiao Tong University in 2018. She is currently the Ph.D. student with the Graduate University for Advanced Studies (SOKENDAI), Japan. Her current research interests include blockchain, smart contract security, and program analysis.View more

National Institute of Informatics, Chiyoda-ku, Japan
Shijie Nie received the Ph.D. degree from the Graduate University for Advanced Studies (SOKENDAI), Japan. He is currently a Project Researcher with the National Institute of Informatics (NII), Japan. His current research interests include computational photography and deep learning.
Shijie Nie received the Ph.D. degree from the Graduate University for Advanced Studies (SOKENDAI), Japan. He is currently a Project Researcher with the National Institute of Informatics (NII), Japan. His current research interests include computational photography and deep learning.View more

Department of Social Informatics, Kyoto University, Kyoto, Japan
Yang Cao received the Ph.D. degree from the Kyoto University in 2017. He is an Assistant Professor with Yoshikawa & Ma Lab, Department of Social Informatics, Kyoto University. His research interests include data privacy and security.
Yang Cao received the Ph.D. degree from the Kyoto University in 2017. He is an Assistant Professor with Yoshikawa & Ma Lab, Department of Social Informatics, Kyoto University. His research interests include data privacy and security.View more

Department of Computing, The Open University, Milton Keynes, U.K.
Yijun Yu received the B.Sc., M.Sc., and Ph.D. degrees from the Department of Computer Science at Fudan University in 1992, 1995, 1998, respectively. He is a Senior Lecturer with the Department of Computing and Communications in The Open University. His research interests include the areas of requirements engineering, maintenance and evolution, security and privacy. He is a member of the IEEE Computer Society and the British Computer Society.
Yijun Yu received the B.Sc., M.Sc., and Ph.D. degrees from the Department of Computer Science at Fudan University in 1992, 1995, 1998, respectively. He is a Senior Lecturer with the Department of Computing and Communications in The Open University. His research interests include the areas of requirements engineering, maintenance and evolution, security and privacy. He is a member of the IEEE Computer Society and the British Computer Society.View more

Information Systems Architecture Research Division, National Institute of Informatics, Chiyoda-ku, Japan
Zhenjiang Hu (Fellow, IEEE) received the B.S. and M.S. degrees from Department of Computer Science and Engineering of Shanghai Jiaotong University in 1988 and 1991 respectively, and Ph.D. degree from Department of Information Engineering of University of Tokyo in 1996. He is a Professor and the Chair with the Department of Computer Science and Technology, Peking University. He is Fellow of JFES (Japan Federation of Engineering Society, 2016), ACM Distinguished Scientist (2016), Member of Europen Academy of Science (2019). His research interest include programming languages and software engineering in general, and functional programming, bidirectional transformation, and software adaptation in particular.
Zhenjiang Hu (Fellow, IEEE) received the B.S. and M.S. degrees from Department of Computer Science and Engineering of Shanghai Jiaotong University in 1988 and 1991 respectively, and Ph.D. degree from Department of Information Engineering of University of Tokyo in 1996. He is a Professor and the Chair with the Department of Computer Science and Technology, Peking University. He is Fellow of JFES (Japan Federation of Engineering Society, 2016), ACM Distinguished Scientist (2016), Member of Europen Academy of Science (2019). His research interest include programming languages and software engineering in general, and functional programming, bidirectional transformation, and software adaptation in particular.View more