Skip to main content

How Similar Are Smart Contracts on the Ethereum?

  • Conference paper
  • First Online:
Blockchain and Trustworthy Systems (BlockSys 2020)

Part of the book series: Communications in Computer and Information Science ((CCIS,volume 1267))

Included in the following conference series:

Abstract

Ethereum is a programmable platform that allows everyone to deploy and access the smart contracts on it. Such flexibility can lead everyone to browse or reuse the source code of the existing smart contracts on the Ethereum. In this paper, to characterize the code clone practice of the smart contract, we present a large-scale study on the smart contracts coming from the Ethereum. We firstly collect more than 700,000 open-source smart contracts, and then we employ a highly effective approach (i.e., Locality-Sensitive Hashing, LSH) to cluster the similar smart contracts. At last, we conduct a qualitative analysis to characterize the clone practice of the smart contract, and further analyze the reason why smart contracts are similar. Our analysis revealed that over 96% of the smart contracts can found similar contracts, which indicates that the smart contracts on the Ethereum are highly homogeneous.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    http://solidity.readthedocs.io/en/develop.

  2. 2.

    https://etherscan.io.

  3. 3.

    A standard interface for tokens. https://eips.ethereum.org/EIPS/eip-20.

  4. 4.

    https://coinmarketcap.com/currencies/huobi-token/.

  5. 5.

    https://coinmarketcap.com/currencies/ftx-token/.

  6. 6.

    https://coinmarketcap.com/currencies/usd-coin/.

References

  1. Nakamoto, S.: Bitcoin: a peer-to-peer electronic cash system. Cryptography Mailing list, March 2009. https://metzdowd.com

  2. Huang, Y., Kong, Q., Jia, N., Chen, X., Zheng, Z.: Recommending differentiated code to support smart contract update. In: 2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC), pp. 260–270, May 2019

    Google Scholar 

  3. Dinh, T.T.A., Liu, R., Zhang, M., Chen, G., Ooi, B.C., Wang, J.: Untangling blockchain: a data processing view of blockchain systems. IEEE Trans. Knowl. Data Eng. 30(7), 1366–1385 (2018)

    Article  Google Scholar 

  4. Zheng, P., Zheng, Z., Luo, X., Chen, X., Liu, X.: A detailed and real-time performance monitoring framework for blockchain systems. In: International Conference on Software Engineering Software Engineering in Practice - ICSE-SEIP 2018, pp. 134–143, May 2018

    Google Scholar 

  5. Norta, A.: Creation of smart-contracting collaborations for decentralized autonomous organizations. In: Matulevičius, R., Dumas, M. (eds.) BIR 2015. LNBIP, vol. 229, pp. 3–17. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21915-8_1

    Chapter  Google Scholar 

  6. Kiffer, L., Levin, D., Mislove, A.: Analyzing ethereum’s contract topology. In: Proceedings of the Internet Measurement Conference 2018, pp. 494–499 (2018)

    Google Scholar 

  7. He, N., Wu, L., Wang, H., Guo, Y., Jiang, X.: Characterizing code clones in the ethereum smart contract ecosystem. arXiv preprint arXiv:1905.00272 (2019)

  8. Liu, H., Yang, Z., Jiang, Y., Zhao, W., Sun, J.: Enabling clone detection for ethereum via smart contract birthmarks. In: 2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC), pp. 105–115. IEEE (2019)

    Google Scholar 

  9. Christidis, K., Devetsikiotis, M.: Blockchains and smart contracts for the internet of things. IEEE Access 4, 2292–2303 (2016)

    Article  Google Scholar 

  10. Juels, A., Kosba, A., Shi, E.: The ring of gyges: investigating the future of criminal smart contracts. In: Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, CCS 2016. ACM, New York, pp. 283–295 (2016). http://doi.acm.org/10.1145/2976749.2978362

  11. Nick, S.: The idea of smart contracts (1997). http://www.fon.hum.uva.nl/rob/Courses/InformationInSpeech/CDROM/Literature/LOTwinterschool2006/szabo.best.vwh.net/idea.html. Accessed 2008

  12. Chen, T., et al.: Understanding ethereum via graph analysis. In: IEEE INFOCOM 2018 - IEEE Conference on Computer Communications, pp. 1484–1492, April 2018

    Google Scholar 

  13. Gao, Z., Jiang, L., Xia, X., Lo, D., Grundy, J.: Checking smart contracts with structural code embedding. IEEE Trans. Softw. Eng. (2020)

    Google Scholar 

  14. Porru, S., Pinna, A., Marchesi, M., Tonelli, R.: Blockchain-oriented software engineering: challenges and new directions. In: 2017 IEEE/ACM 39th International Conference on Software Engineering Companion (ICSE-C), pp. 169–171, May 2017

    Google Scholar 

  15. Somin, S., Gordon, G., Altshuler, Y.: Network analysis of ERC20 tokens trading on ethereum blockchain. In: Morales, A.J., Gershenson, C., Braha, D., Minai, A.A., Bar-Yam, Y. (eds.) ICCS 2018. SPC, pp. 439–450. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-96661-8_45

    Chapter  Google Scholar 

  16. Gionis, A., Indyk, P., Motwani, R., et al.: Similarity search in high dimensions via hashing. Vldb 99(6), 518–529 (1999)

    Google Scholar 

  17. Swan, M.: Blockchain: Blueprint for a New Economy, 1st edn. O’Reilly Media Inc., Newton (2015)

    Google Scholar 

  18. Wang, B., Chen, S., Yao, L., Liu, B., Xu, X., Zhu, L.: A simulation approach for studying behavior and quality of blockchain networks. In: Chen, S., Wang, H., Zhang, L.-J. (eds.) ICBC 2018. LNCS, vol. 10974, pp. 18–31. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-94478-4_2

    Chapter  Google Scholar 

  19. Parizi, R.M., Amritraj, Dehghantanha, A.: Smart contract programming languages on blockchains: an empirical evaluation of usability and security. In: Chen, S., Wang, H., Zhang, L.J. (eds.) ICBC 2018. LNCS, vol. 10974, pp. 75–91. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-94478-4_6

    Chapter  Google Scholar 

  20. Huang, Y., Chen, X., Zou, Q., Luo, X.: A probabilistic neural network-based approach for related software changes detection. In: 2014 21st Asia-Pacific Software Engineering Conference, vol. 1, pp. 279–286, December 2014

    Google Scholar 

  21. Kosba, A., Miller, A., Shi, E., Wen, Z., Papamanthou, C.: Hawk: the blockchain model of cryptography and privacy-preserving smart contracts. In: 2016 IEEE Symposium on Security and Privacy (SP), pp. 839–858, May 2016

    Google Scholar 

  22. Bartoletti, M., Carta, S., Cimoli, T., Saia, R.: Dissecting Ponzi schemes on Ethereum: identification, analysis, and impact. ArXiv e-prints, March 2017

    Google Scholar 

  23. Huang, Y., Jia, N., Shu, J., Hu, X., Chen, X., Zhou, Q.: Does your code need comment? Softw.: Pract. Exp. 50(3), 227–245 (2020). https://onlinelibrary.wiley.com/doi/abs/10.1002/spe.2772

    Google Scholar 

  24. Huang, Y., Zheng, Q., Chen, X., Xiong, Y., Liu, Z., Luo, X.: Mining version control system for automatically generating commit comment. In: 2017 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), pp. 414–423, November 2017

    Google Scholar 

  25. Huang, Y., Chen, X., Liu, Z., Luo, X., Zheng, Z.: Using discriminative feature in software entities for relevance identification of code changes. J. Softw.: Evol. Process 29(7), e1859 (2017). e1859 smr.1859. https://onlinelibrary.wiley.com/doi/abs/10.1002/smr.1859

    Google Scholar 

  26. Huang, Y., Jia, N., Chen, X., Hong, K., Zheng, Z.: 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, ser. ESEC/FSE 2018, pp. 770–774. ACM, New York (2018). http://doi.acm.org/10.1145/3236024.3264841

  27. Huang, Y., Hu, X., Jia, N., Chen, X., Xiong, Y., Zheng, Z.: Learning code context information to predict comment locations. IEEE Trans. Reliab. 1–18 (2019)

    Google Scholar 

  28. Jiang, H., Xiao, Y., Wang, W.: English explaining a bag of words with hierarchical conceptual labels. World Wide Web (2020). Bag-of-words models; Concept graph; De-noising algorithm; Explicit semantics; High-accuracy;Knowledge base; NAtural language processing; Rose tree. http://dx.doi.org/10.1007/s11280-019-00752-3

  29. Gao, Z., Jayasundara, V., Jiang, L., Xia, X., Lo, D., Grundy, J.: SmartEmbed: a tool for clone and bug detection in smart contracts through structural code embedding. In: 2019 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp. 394–397. IEEE (2019)

    Google Scholar 

  30. Liu, H., Yang, Z., Liu, C., Jiang, Y., Zhao, W., Sun, J.: EClone: detect semantic clones in ethereum via symbolic transaction sketch. In: Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pp. 900–903 (2018)

    Google Scholar 

Download references

Acknowledgments

This research is supported by the National Natural Science Foundation of China (61902105), the Characteristic Innovation Project of Guangdong Province Office of Education (2019GKTSCX129).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Haiping Huang .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Jia, N., Kong, Q., Huang, H. (2020). How Similar Are Smart Contracts on the Ethereum?. In: Zheng, Z., Dai, HN., Fu, X., Chen, B. (eds) Blockchain and Trustworthy Systems. BlockSys 2020. Communications in Computer and Information Science, vol 1267. Springer, Singapore. https://doi.org/10.1007/978-981-15-9213-3_32

Download citation

  • DOI: https://doi.org/10.1007/978-981-15-9213-3_32

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-15-9212-6

  • Online ISBN: 978-981-15-9213-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics