GethReplayer: a smart contract testing method based on transaction replay

IF 4.6 Q2 MATERIALS SCIENCE, BIOMATERIALS
Xiaohong Shi, Ziyan Wang, Runlu Zhong, Liangliang Ma, Xiangping Chen, Peng Yang
{"title":"GethReplayer: a smart contract testing method based on transaction replay","authors":"Xiaohong Shi, Ziyan Wang, Runlu Zhong, Liangliang Ma, Xiangping Chen, Peng Yang","doi":"10.1108/ijwis-08-2023-0138","DOIUrl":null,"url":null,"abstract":"\nPurpose\nSmart contracts are written in high-level programming languages, compiled into Ethereum Virtual Machine (EVM) bytecode, deployed onto blockchain systems and called with the corresponding address by transactions. The deployed smart contracts are immutable, even if there are bugs or vulnerabilities. Therefore, it is critical to verify smart contracts before deployment. This paper aims to help developers effectively and efficiently locate potential defects in smart contracts.\n\n\nDesign/methodology/approach\nGethReplayer, a smart contract testing method based on transaction replay, is proposed. It constructs a parallel transaction execution environment with two virtual machines to compare the execution results. It uses the real existing transaction data on Ethereum and the source code of the tested smart contacts as inputs, conditionally substitutes the bytecode of the tested smart contract input into the testing EVM, and then monitors the environmental information to check the correctness of the contract.\n\n\nFindings\nExperiments verified that the proposed method is effective in smart contract testing. Virtual environmental information has a significant effect on the success of transaction replay, which is the basis for the performance of the method. The efficiency of error locating was approximately 14 times faster with the proposed method than without. In addition, the proposed method supports gas consumption analysis.\n\n\nOriginality/value\nThis paper addresses the difficulty that developers encounter in testing smart contracts before deployment and focuses on helping develop smart contracts with as few defects as possible. GethReplayer is expected to be an alternative solution for smart contract testing and provide inspiration for further research.\n","PeriodicalId":2,"journal":{"name":"ACS Applied Bio Materials","volume":"14 5","pages":""},"PeriodicalIF":4.6000,"publicationDate":"2024-04-05","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"ACS Applied Bio Materials","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1108/ijwis-08-2023-0138","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"MATERIALS SCIENCE, BIOMATERIALS","Score":null,"Total":0}
引用次数: 0

Abstract

Purpose Smart contracts are written in high-level programming languages, compiled into Ethereum Virtual Machine (EVM) bytecode, deployed onto blockchain systems and called with the corresponding address by transactions. The deployed smart contracts are immutable, even if there are bugs or vulnerabilities. Therefore, it is critical to verify smart contracts before deployment. This paper aims to help developers effectively and efficiently locate potential defects in smart contracts. Design/methodology/approach GethReplayer, a smart contract testing method based on transaction replay, is proposed. It constructs a parallel transaction execution environment with two virtual machines to compare the execution results. It uses the real existing transaction data on Ethereum and the source code of the tested smart contacts as inputs, conditionally substitutes the bytecode of the tested smart contract input into the testing EVM, and then monitors the environmental information to check the correctness of the contract. Findings Experiments verified that the proposed method is effective in smart contract testing. Virtual environmental information has a significant effect on the success of transaction replay, which is the basis for the performance of the method. The efficiency of error locating was approximately 14 times faster with the proposed method than without. In addition, the proposed method supports gas consumption analysis. Originality/value This paper addresses the difficulty that developers encounter in testing smart contracts before deployment and focuses on helping develop smart contracts with as few defects as possible. GethReplayer is expected to be an alternative solution for smart contract testing and provide inspiration for further research.
GethReplayer:基于交易重放的智能合约测试方法
目的智能合约是用高级编程语言编写的,编译成以太坊虚拟机(EVM)字节码,部署到区块链系统上,并通过交易调用相应的地址。即使存在错误或漏洞,部署的智能合约也是不可变的。因此,在部署前验证智能合约至关重要。本文旨在帮助开发人员有效、高效地定位智能合约中的潜在缺陷。设计/方法/途径本文提出了一种基于交易重放的智能合约测试方法--GethReplayer。它利用两台虚拟机构建了一个并行的事务执行环境,以比较执行结果。实验验证了该方法在智能合约测试中的有效性。虚拟环境信息对交易重放的成功率有显著影响,这是该方法性能的基础。使用所提出的方法,错误定位的效率是不使用该方法的约 14 倍。此外,所提出的方法还支持气体消耗分析。 原创性/价值 本文解决了开发人员在部署前测试智能合约时遇到的困难,重点是帮助开发尽可能少缺陷的智能合约。GethReplayer有望成为智能合约测试的另一种解决方案,并为进一步的研究提供灵感。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
ACS Applied Bio Materials
ACS Applied Bio Materials Chemistry-Chemistry (all)
CiteScore
9.40
自引率
2.10%
发文量
464
期刊介绍: ACS Applied Bio Materials is an interdisciplinary journal publishing original research covering all aspects of biomaterials and biointerfaces including and beyond the traditional biosensing, biomedical and therapeutic applications. The journal is devoted to reports of new and original experimental and theoretical research of an applied nature that integrates knowledge in the areas of materials, engineering, physics, bioscience, and chemistry into important bio applications. The journal is specifically interested in work that addresses the relationship between structure and function and assesses the stability and degradation of materials under relevant environmental and biological conditions.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信