Skip to main content
Top
Published in: Empirical Software Engineering 5/2023

01-09-2023

Studying differentiated code to support smart contract update

Authors: Xiangping Chen, Peiyong Liao, Queping Kong, Yuan Huang, Xiaocong Zhou

Published in: Empirical Software Engineering | Issue 5/2023

Log in

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

Smart contracts have received a lot of attention. A smart contract is a program that runs on a blockchain. Some recent studies reveal that most of the smart contracts on the Ethereum blockchain are highly similar. An inexperienced smart contract developer can refer to some existing smart contracts that is similar to their own contracts to help their development by applying the differentiated code from the existing similar contracts. How to identify similar contracts and extract differentiated code to recommend to the developers as guidance is what we aim for in this work. Differentiated code is defined as the source code excluding the repeated part in two similar smart contracts, which usually illustrates how a software feature is implemented or a programming issue is solved. Thus, differentiated code might be used to guide the update of a smart contract. In this paper, we propose a differentiated code recommendation approach, SmartDiffrec, for supporting smart contract update. Specifically, we apply syntax and semantic similarities to discover the similar contracts for a given target contract, and then recommend the differentiated code to the target contract. Moreover, we investigate three research questions to analyze the effectiveness of our approach from the whole to the specific. The results show that the differentiated codes extracted found by our approach can effectively support smart contract update.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Literature
go back to reference Atzei N, Bartoletti M, Cimoli T (2017) A survey of attacks on ethereum smart contracts (sok). In: Maffei M, Ryan M (eds) Principles of Security and Trust. Springer, Berlin Heidelberg, Berlin, Heidelberg, p 164–186 Atzei N, Bartoletti M, Cimoli T (2017) A survey of attacks on ethereum smart contracts (sok). In: Maffei M, Ryan M (eds) Principles of Security and Trust. Springer, Berlin Heidelberg, Berlin, Heidelberg, p 164–186
go back to reference Bartoletti M, Carta S, Cimoli T, Saia R (2017) Dissecting Ponzi schemes on Ethereum: identification, analysis, and impact. ArXiv e-prints arXiv:1703.03779 Bartoletti M, Carta S, Cimoli T, Saia R (2017) Dissecting Ponzi schemes on Ethereum: identification, analysis, and impact. ArXiv e-prints arXiv:​1703.​03779
go back to reference Chen T, Li X, Wang Y, Chen J, Li Z, Luo X, Au MH, Zhang X (2017) An adaptive gas cost mechanism for ethereum to defend against under-priced dos attacks. In: Liu JK, Samarati P (eds) Information Security Practice and Experience. Springer International Publishing, Cham, pp 3–24CrossRef Chen T, Li X, Wang Y, Chen J, Li Z, Luo X, Au MH, Zhang X (2017) An adaptive gas cost mechanism for ethereum to defend against under-priced dos attacks. In: Liu JK, Samarati P (eds) Information Security Practice and Experience. Springer International Publishing, Cham, pp 3–24CrossRef
go back to reference Chen T, Li Z, Zhang Y, Luo X, Wang T, Hu T, Xiao X, Wang D, Huang J, Zhang X (2019a) A large-scale empirical study on control flow identification of smart contracts. In: 2019 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), p 1–11 Chen T, Li Z, Zhang Y, Luo X, Wang T, Hu T, Xiao X, Wang D, Huang J, Zhang X (2019a) A large-scale empirical study on control flow identification of smart contracts. In: 2019 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), p 1–11
go back to reference Chen T, Zhang Y, Li Z, Luo X, Wang T, Cao R, Xiao X, Zhang X (2019b) Tokenscope: Automatically detecting inconsistent behaviors of cryptocurrency tokens in ethereum. In: Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, p 1503–1520 Chen T, Zhang Y, Li Z, Luo X, Wang T, Cao R, Xiao X, Zhang X (2019b) Tokenscope: Automatically detecting inconsistent behaviors of cryptocurrency tokens in ethereum. In: Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, p 1503–1520
go back to reference Chen W, Zheng Z, Cui J, Ngai E, Zheng P, Zhou Y (2018) Detecting ponzi schemes on ethereum: Towards healthier blockchain technology. In: Proceedings of the 2018 World Wide Web Conference, International World Wide Web Conferences Steering Committee, Republic and Canton of Geneva, Switzerland, WWW ’18, p 1409–1418 https://doi.org/10.1145/3178876.3186046 Chen W, Zheng Z, Cui J, Ngai E, Zheng P, Zhou Y (2018) Detecting ponzi schemes on ethereum: Towards healthier blockchain technology. In: Proceedings of the 2018 World Wide Web Conference, International World Wide Web Conferences Steering Committee, Republic and Canton of Geneva, Switzerland, WWW ’18, p 1409–1418 https://​doi.​org/​10.​1145/​3178876.​3186046
go back to reference Gao Z, Jiang L, Xia X, Lo D, Grundy J (2020) Checking smart contracts with structural code embedding. IEEE Transactions on Software Engineering Gao Z, Jiang L, Xia X, Lo D, Grundy J (2020) Checking smart contracts with structural code embedding. IEEE Transactions on Software Engineering
go back to reference Ghaleb A, Pattabiraman K (2020) How effective are smart contract analysis tools? evaluating smart contract static analysis tools using bug injection. In: Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis, Association for Computing Machinery, New York, NY, USA, ISSTA 2020, p 415-427 https://doi.org/10.1145/3395363.3397385 Ghaleb A, Pattabiraman K (2020) How effective are smart contract analysis tools? evaluating smart contract static analysis tools using bug injection. In: Proceedings of the 29th ACM SIGSOFT International Symposium on Software Testing and Analysis, Association for Computing Machinery, New York, NY, USA, ISSTA 2020, p 415-427 https://​doi.​org/​10.​1145/​3395363.​3397385
go back to reference Grossman S, Abraham I, GolanGueta G, Michalevsky Y, Rinetzky N, Sagiv M, Zohar Y (2018) Online detection of effectively callback free objects with applications to smart contracts. CoRR arxiv:1801.04032 Grossman S, Abraham I, GolanGueta G, Michalevsky Y, Rinetzky N, Sagiv M, Zohar Y (2018) Online detection of effectively callback free objects with applications to smart contracts. CoRR arxiv:​1801.​04032
go back to reference Hartigan JA, Wong MA (1979) Algorithm as 136: A k-means clustering algorithm. Journal of the Royal Statistical Society 28(1):100–108MATH Hartigan JA, Wong MA (1979) Algorithm as 136: A k-means clustering algorithm. Journal of the Royal Statistical Society 28(1):100–108MATH
go back to reference He N, Wu L, Wang H, Guo Y, Jiang X (2019) Characterizing code clones in the ethereum smart contract ecosystem. arXiv preprint arXiv:1905.00272 He N, Wu L, Wang H, Guo Y, Jiang X (2019) Characterizing code clones in the ethereum smart contract ecosystem. arXiv preprint arXiv:​1905.​00272
go back to reference Huang Y, Zheng Q, Chen X, Xiong Y, Liu Z, Luo X (2017b) Mining version control system for automatically generating commit comment. In: ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), pp 414–423 https://doi.org/10.1109/ESEM.2017.56 Huang Y, Zheng Q, Chen X, Xiong Y, Liu Z, Luo X (2017b) Mining version control system for automatically generating commit comment. In: ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), pp 414–423 https://​doi.​org/​10.​1109/​ESEM.​2017.​56
go back to reference Huang Y, Jia N, Chen X, Hong K, Zheng Z (2018a) Salient-class location: Help developers understand code change in code review. In: Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ACM, New York, NY, USA, ESEC/FSE, pp 770–774 https://doi.org/10.1145/3236024.3264841 Huang Y, Jia N, Chen X, Hong K, Zheng Z (2018a) Salient-class location: Help developers understand code change in code review. In: Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ACM, New York, NY, USA, ESEC/FSE, pp 770–774 https://​doi.​org/​10.​1145/​3236024.​3264841
go back to reference Huang Y, Jia N, Zhou Q, Chen X, Xiong Y, Luo X (2018b) Guiding developers to make informative commenting decisions in source code. In: Proceedings of the 40th International Conference on Software Engineering: Companion Proceeedings, ACM, New York, NY, USA, ICSE ’18, pp 260–261 https://doi.org/10.1145/3183440.3194960 Huang Y, Jia N, Zhou Q, Chen X, Xiong Y, Luo X (2018b) Guiding developers to make informative commenting decisions in source code. In: Proceedings of the 40th International Conference on Software Engineering: Companion Proceeedings, ACM, New York, NY, USA, ICSE ’18, pp 260–261 https://​doi.​org/​10.​1145/​3183440.​3194960
go back to reference Jiang J, Xiong Y, Zhang H, Gao Q, Chen X (2018) Shaping program repair space with existing patches and similar code. In: Proceedings of the 27th ACM SIGSOFT International Symposium on Software Testing and Analysis, ACM, New York, NY, USA, ISSTA, pp 298–309 https://doi.org/10.1145/3213846.3213871 Jiang J, Xiong Y, Zhang H, Gao Q, Chen X (2018) Shaping program repair space with existing patches and similar code. In: Proceedings of the 27th ACM SIGSOFT International Symposium on Software Testing and Analysis, ACM, New York, NY, USA, ISSTA, pp 298–309 https://​doi.​org/​10.​1145/​3213846.​3213871
go back to reference Juels A, Kosba A, Shi E (2016) The ring of gyges: Investigating the future of criminal smart contracts. In: Proceedings of the ACM SIGSAC Conference on Computer and Communications Security, ACM, New York, NY, USA, CCS ’16, pp 283–295 https://doi.org/10.1145/2976749.2978362 Juels A, Kosba A, Shi E (2016) The ring of gyges: Investigating the future of criminal smart contracts. In: Proceedings of the ACM SIGSAC Conference on Computer and Communications Security, ACM, New York, NY, USA, CCS ’16, pp 283–295 https://​doi.​org/​10.​1145/​2976749.​2978362
go back to reference Kiffer L, Levin D, Mislove A (2018) Analyzing ethereum’s contract topology. In: Proceedings of the Internet Measurement Conference, pp 494–499 Kiffer L, Levin D, Mislove A (2018) Analyzing ethereum’s contract topology. In: Proceedings of the Internet Measurement Conference, pp 494–499
go back to reference Le Q, Mikolov T (2014a) Distributed representations of sentences and documents. In: Proceedings of the 31st International Conference on International Conference on Machine Learning, JMLR.org, ICML’14, vol 32 p II-1188-II-1196 Le Q, Mikolov T (2014a) Distributed representations of sentences and documents. In: Proceedings of the 31st International Conference on International Conference on Machine Learning, JMLR.org, ICML’14, vol 32 p II-1188-II-1196
go back to reference Le Q, Mikolov T (2014b) Distributed representations of sentences and documents. In: Proceedings of the 31st International Conference on International Conference on Machine Learning, JMLR.org, ICML’14, vol 32 p II-1188-II-1196 Le Q, Mikolov T (2014b) Distributed representations of sentences and documents. In: Proceedings of the 31st International Conference on International Conference on Machine Learning, JMLR.org, ICML’14, vol 32 p II-1188-II-1196
go back to reference Liu H, Yang Z, Liu C, Jiang Y, Zhao W, Sun J (2018) Eclone: Detect semantic clones in ethereum via symbolic transaction sketch. In: Proceedings of the 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, p 900–903 Liu H, Yang Z, Liu C, Jiang Y, Zhao W, Sun J (2018) Eclone: Detect semantic clones in ethereum via symbolic transaction sketch. In: Proceedings of the 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, p 900–903
go back to reference Liu H, Yang Z, Jiang Y, Zhao W, Sun J (2019) Enabling clone detection for ethereum via smart contract birthmarks. In: IEEE/ACM 27th International Conference on Program Comprehension (ICPC), IEEE, p 105–115 Liu H, Yang Z, Jiang Y, Zhao W, Sun J (2019) Enabling clone detection for ethereum via smart contract birthmarks. In: IEEE/ACM 27th International Conference on Program Comprehension (ICPC), IEEE, p 105–115
go back to reference Mueller B (2018) Smashing ethereum smart contracts for fun and real profit. In: in 9th Annual HITB Security Conference (HITBSecConf), p 54 Mueller B (2018) Smashing ethereum smart contracts for fun and real profit. In: in 9th Annual HITB Security Conference (HITBSecConf), p 54
go back to reference Norta A (2015) Creation of smart-contracting collaborations for decentralized autonomous organizations. Perspectives in Business Informatics Research. Springer International Publishing, Cham, pp 3–17CrossRef Norta A (2015) Creation of smart-contracting collaborations for decentralized autonomous organizations. Perspectives in Business Informatics Research. Springer International Publishing, Cham, pp 3–17CrossRef
go back to reference Oliva J, Serrano JI, del Castillo MD, Iglesias Á (2011) Symss: A syntax-based measure for short-text semantic similarity. Data & Knowledge Engineering 70(4):390–405CrossRef Oliva J, Serrano JI, del Castillo MD, Iglesias Á (2011) Symss: A syntax-based measure for short-text semantic similarity. Data & Knowledge Engineering 70(4):390–405CrossRef
go back to reference Ostrom E (1995) A grammar of institutions. American Political Science Review 89(3):582–600CrossRef Ostrom E (1995) A grammar of institutions. American Political Science Review 89(3):582–600CrossRef
go back to reference Parizi RM, Amritraj Dehghantanha A (2018) Smart contract programming languages on blockchains: An empirical evaluation of usability and security. Blockchain - ICBC 2018. Springer International Publishing, Cham, pp 75–91CrossRef Parizi RM, Amritraj Dehghantanha A (2018) Smart contract programming languages on blockchains: An empirical evaluation of usability and security. Blockchain - ICBC 2018. Springer International Publishing, Cham, pp 75–91CrossRef
go back to reference Ren M, Ma F, Yin Z, Fu Y, Li H, Chang W, Jiang Y (2021) Making smart contract development more secure and easier. In: Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Association for Computing Machinery, New York, NY, USA, ESEC/FSE 2021, p 1360-1370 https://doi.org/10.1145/3468264.3473929 Ren M, Ma F, Yin Z, Fu Y, Li H, Chang W, Jiang Y (2021) Making smart contract development more secure and easier. In: Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Association for Computing Machinery, New York, NY, USA, ESEC/FSE 2021, p 1360-1370 https://​doi.​org/​10.​1145/​3468264.​3473929
go back to reference Roy CK, Cordy JR (2008a) Nicad: Accurate detection of near-miss intentional clones using flexible pretty-printing and code normalization. In: Proceedings of the 16th IEEE International Conference on Program Comprehension, IEEE Computer Society, USA, ICPC ’08, p 172-181 https://doi.org/10.1109/ICPC.2008.41 Roy CK, Cordy JR (2008a) Nicad: Accurate detection of near-miss intentional clones using flexible pretty-printing and code normalization. In: Proceedings of the 16th IEEE International Conference on Program Comprehension, IEEE Computer Society, USA, ICPC ’08, p 172-181 https://​doi.​org/​10.​1109/​ICPC.​2008.​41
go back to reference Sapirshtein A, Sompolinsky Y, Zohar A (2017) Optimal selfish mining strategies in bitcoin. Christ Church, Barbados, vol 9603 LNCS, p 515–532 Sapirshtein A, Sompolinsky Y, Zohar A (2017) Optimal selfish mining strategies in bitcoin. Christ Church, Barbados, vol 9603 LNCS, p 515–532
go back to reference Swan M (2015) Blockchain: Blueprint for a New Economy, 1st edn. O’Reilly Media, Inc Swan M (2015) Blockchain: Blueprint for a New Economy, 1st edn. O’Reilly Media, Inc
go back to reference Torres CF, Schütte J, State R (2018) Osiris: Hunting for integer bugs in ethereum smart contracts. In: Proceedings of the 34th Annual Computer Security Applications Conference, Association for Computing Machinery, New York, NY, USA, ACSAC ’18, p 664-676 https://doi.org/10.1145/3274694.3274737 Torres CF, Schütte J, State R (2018) Osiris: Hunting for integer bugs in ethereum smart contracts. In: Proceedings of the 34th Annual Computer Security Applications Conference, Association for Computing Machinery, New York, NY, USA, ACSAC ’18, p 664-676 https://​doi.​org/​10.​1145/​3274694.​3274737
go back to reference Wang B, Chen S, Yao L, Liu B, Xu X, Zhu L (2018) A simulation approach for studying behavior and quality of blockchain networks. Blockchain - ICBC 2018. Springer International Publishing, Cham, pp 18–31CrossRef Wang B, Chen S, Yao L, Liu B, Xu X, Zhu L (2018) A simulation approach for studying behavior and quality of blockchain networks. Blockchain - ICBC 2018. Springer International Publishing, Cham, pp 18–31CrossRef
go back to reference Wettel R, Marinescu R (2005) Archeology of code duplication: recovering duplication chains from small duplication fragments. In: Seventh International Symposium on Symbolic and Numeric Algorithms for Scientific Computing (SYNASC’05), p 8 https://doi.org/10.1109/SYNASC.2005.20 Wettel R, Marinescu R (2005) Archeology of code duplication: recovering duplication chains from small duplication fragments. In: Seventh International Symposium on Symbolic and Numeric Algorithms for Scientific Computing (SYNASC’05), p 8 https://​doi.​org/​10.​1109/​SYNASC.​2005.​20
go back to reference Yu L, Tsai W, Li G, Yao Y, Hu C, Deng E (2017) Smart-contract execution with concurrent block building. In: 2017 11th IEEE Symposium on Service-Oriented System Engineering (SOSE), IEEE Computer Society, Los Alamitos, CA, USA, pp 160–167 https://doi.org/10.1109/SOSE.2017.33 Yu L, Tsai W, Li G, Yao Y, Hu C, Deng E (2017) Smart-contract execution with concurrent block building. In: 2017 11th IEEE Symposium on Service-Oriented System Engineering (SOSE), IEEE Computer Society, Los Alamitos, CA, USA, pp 160–167 https://​doi.​org/​10.​1109/​SOSE.​2017.​33
go back to reference Zheng P, Zheng Z, Luo X, Chen X, Liu X (2018) A detailed and real-time performance monitoring framework for blockchain systems. In: International Conference on Software Engineering Software Engineering in Practice - ICSE-SEIP ’18, p 134–143 https://doi.org/10.1145/3183519.3183546 Zheng P, Zheng Z, Luo X, Chen X, Liu X (2018) A detailed and real-time performance monitoring framework for blockchain systems. In: International Conference on Software Engineering Software Engineering in Practice - ICSE-SEIP ’18, p 134–143 https://​doi.​org/​10.​1145/​3183519.​3183546
Metadata
Title
Studying differentiated code to support smart contract update
Authors
Xiangping Chen
Peiyong Liao
Queping Kong
Yuan Huang
Xiaocong Zhou
Publication date
01-09-2023
Publisher
Springer US
Published in
Empirical Software Engineering / Issue 5/2023
Print ISSN: 1382-3256
Electronic ISSN: 1573-7616
DOI
https://doi.org/10.1007/s10664-023-10359-y

Other articles of this Issue 5/2023

Empirical Software Engineering 5/2023 Go to the issue

Premium Partner