Analysis of Source Code Duplication in Ethreum Smart Contracts
Authors:
- 1 March 2021
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 701-707
Abstract
The practice of writing smart contracts for the Ethereum blockchain is quite recent and still in development. A blockchain developer should expect constant changes in the security software field, as new bugs and security risks are discovered, and new good practices are developed. Following the security practices accepted in the blockchain community is not enough to ensure the writing of secure smart contracts. The paper aims to study the practice of code cloning among the smart contracts by analyzing two corpora. The first corpus, the "Smart-Corpus", includes smart contracts already deployed in the Ethereum blockchain. The second corpus, the "Open-Zeppelin's Solidity Library", is supervised by a community of developers who constantly take care to increase the security and efficiency of the smart contracts included in the corpus. From the comparative analysis of the corpora, we observe that the smart contracts developers frequently duplicate the code by cloning already existing smart contracts which are not part of the "OpenZeppelin corpus". In particular, we found that 79.1% of smart contracts contain duplicated code and only 18.4% of smart contracts reuse the code by implementing a smart corpus belonging to the OpenZeppelin repository. The paper discusses the advantages and the disadvantages of code duplication in the Ethereum blockchain ecosystem, and suggests to refer to the smart contracts of the OpenZeppelin's Solidity Library. The Ethereum blockchain community can indeed benefit from using the tested code presented in OpenZeppelin's Solidity Library to increase its security.Keywords
This publication has 27 references indexed in Scilit:
- Managing IoT devices using blockchain platform2017
- The Spack package manager2015
- Evaluating clone detection tools with BigCloneBench2015
- Refactoring and its Relationship with Fan-in and Fan-out: An Empirical Study2012
- An empirical study on the maintenance of source code clonesEmpirical Software Engineering, 2009
- DECKARD: Scalable and Accurate Tree-Based Detection of Code Clones29th International Conference on Software Engineering (ICSE'07), 2007
- Java quality assurance by detecting code smells2003
- On finding duplication and near-duplication in large software systems2002
- Advanced clone-analysis to support object-oriented system refactoring2002
- CCFinder: a multilinguistic token-based code clone detection system for large scale source codeIEEE Transactions on Software Engineering, 2002