Abstract
Smart contract has been utilized to realize cryptocurrencies and crowdfunding initiatives. Due to its characteristics of immutable once deployed, the security issues have been widely studied and paid much attention. In practise, reusing pieces of smart contract code from reputable sources has taken risks. Thus, in this paper, we study the code cloning in Ethereum with pre-training techniques. Specifically, we analyze the similarity of two smart contract codes by comparing the similarity of the word vectors. We use the cosine similarity comparison method to analyze and compare a collection of 3814 smart contracts containing timestamp vulnerabilities, then perform code quality analysis on these contracts to study the relationships between code reuse and vulnerabilities. Finally, we analyze the characteristics of these existential code cloning contracts. The results show that the performance of our experimental method is 1%–4% better than the current best detection method.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Bitcoin official website. https://bitcoin.org/en/
Ethereum official website. https://www.ethereum.org/
Wikipedia of ethereum. https://en.wikipedia.org/wiki/Ethereum/
Solidity. https://en.wikipedia.org/wiki/Solidity/
Official fomo3d website. https://exitscam.me/
Davey, N., Barson, P., Field, S., Frank, R., Tansley, D.: The development of a software clone detector. IJAST, 1(3/4) (1995)
Bailey, J., Burd, E.: Evaluating clone detection tools for use during preventative maintenance. In: SCAM 2002 (2002)
Rieger, M.: Effective clone Detection Without Language Barriers. PhD thesis (2005)
Walenstein, A., Lakhotia, A.: The software similarity problem in malware analysis. In: Dagstuhl Seminar Proceedings (2007)
Baker, B.: On finding duplication and near-duplication in large software systems. In: WCRE 1995
Brixtel, R., Fontaine, M., Lesner, B., Bazin, C., Robbes, R.: Language-independent clone detection applied to plagiarism detection. In: SCAM 2010 (2010)
Jiang, L., Su, Z., Chiu, E.: Context-based detection of clone-related bugs. In: ESEC/FSE 2007
Lo, D., Jiang, L., Budi, A.: Active refinement of clone anomaly reports. In: ICSE 2012 (2012)
Wang, X., Dang, Y., Zhang, L., Zhang, D., Lan, E., Mei, H.: Can i clone this piece of code here? In: ASE 2012 (2012)
Dang, Y., Zhang, D., Ge, S., Chu, C., Qiu, Y., Xie, T.: Xiao: tuning code clones at hands of engineers inpractice. In: ACSAC 2012
Milea, N., Jiang, L., Khoo, S.: Scalable detection of missed cross-function refactorings. In: ISSTA 2014 (2014)
Milea, N., Jiang, L., Khoo, S.: Vector abstraction and concretization for scalable detection of refactorings. In: FSE 2014 (2014)
Roy, C., Cordy, J.: A survey on software clone detection research. Queen’s University, Technical report (2007)
Johnson, J.H.: Identifying redundancy in source code using fingerprints. In: CASCON 1993 (1993)
Johnson, J.H.: Visualizing textual redundancy in legacy source. In: CASCON 1994 (1994)
Baker, B.: A program for identifying duplicated code. In: Computer Science and Statistics (1992)
Baker, B." Parameterized pattern matching: algorithms and applications. JCSS, 52(1) (1996)
Tai, K.S., Socher, R., Manning, C.D.: Improved semantic rep-resentations from tree-structured long short-term memory networks
Zhang, P., Xiao, F., Luo, X.: A framework and dataset for bugs in ethereum smart contracts. In: 2020 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp. 139–150. IEEE (2020)
Mikolov, T., Sutskever, I., Chen, K., Corrado, G.S., Dean, J.: Distributed representations of words and phrases and their compositionality. In: Proceedings of 26th International Conference Neural Information Processing System, pp. 3111–3119 (2013)
Zhou, W., Zhou, Y., Jiang, X., Ning, P.: Detecting repackaged smartphone applications in third-party android marketplaces. In: Proceedings of the second ACM Conference on Data and Application Security and Privacy, pp. 317–326. ACM (2012)
Chen, T., et al.: Understanding ethereum via graph analysis. In: IEEE INFOCOM 2018-IEEE Conference on Computer Communications, pp. 1484–1492. IEEE (2018)
Acknowledgments
This work is partially supported by the National Key Research and Development Project of China (No. 2020YFB1711900).
Author information
Authors and Affiliations
Corresponding authors
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2024 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this paper
Cite this paper
Zhang, C. et al. (2024). Smart Contract Code Clone Detection Based on Pre-training Techniques. In: Chen, J., Wen, B., Chen, T. (eds) Blockchain and Trustworthy Systems. BlockSys 2023. Communications in Computer and Information Science, vol 1897. Springer, Singapore. https://doi.org/10.1007/978-981-99-8104-5_4
Download citation
DOI: https://doi.org/10.1007/978-981-99-8104-5_4
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-99-8103-8
Online ISBN: 978-981-99-8104-5
eBook Packages: Computer ScienceComputer Science (R0)