SmartEmbed: A Tool for Clone and Bug Detection in Smart Contracts through Structural Code Embedding

Zhipeng Gao, Vinoj Jayasundara, Lingxiao Jiang, Xin Xia, David Lo +1 more
8/22/2019
cs.SE

Official code: beyondacm/SmartEmbed (109 stars, JavaScript, last commit 2023-05-13).

Abstract

Ethereum has become a widely used platform to enable secure, Blockchain-based financial and business transactions. However, a major concern in Ethereum is the security of its smart contracts.

Show full abstract

Many identified bugs and vulnerabilities in smart contracts not only present challenges to maintenance of blockchain, but also lead to serious financial loses. There is a significant need to better assist developers in checking smart contracts and ensuring their reliability.In this paper, we propose a web service tool, named SmartEmbed, which can help Solidity developers to find repetitive contract code and clone-related bugs in smart contracts. Our tool is based on code embeddings and similarity checking techniques. By comparing the similarities among the code embedding vectors for existing solidity code in the Ethereum blockchain and known bugs, we are able to efficiently identify code clones and clone-related bugs for any solidity code given by users, which can help to improve the users' confidence in the reliability of their code. In addition to the uses by individual developers, SmartEmbed can also be applied to studies of smart contracts in a large scale. When applied to more than 22K solidity contracts collected from the Ethereum blockchain, we found that the clone ratio of solidity code is close to 90\%, much higher than traditional software, and 194 clone-related bugs can be identified efficiently and accurately based on our small bug database with a precision of 96\%. SmartEmbed can be accessed at \url{http://www.smartembed.net}. A demo video of SmartEmbed is at \url{https://youtu.be/o9ylyOpYFq8}

View on arXivView PDF

Code Implementations(1)

A Tool for clone detection and bug detection in smart contracts

10934JavaScript, JavaMay 16, 20193 years ago
bug-detectionclonescode-clonescode-embeddingethereum+1 more

Similar Papers

Cite this paper

@article{gao2019smartembed,
  title  = {SmartEmbed: A Tool for Clone and Bug Detection in Smart Contracts through Structural Code Embedding},
  author = {Zhipeng Gao and Vinoj Jayasundara and Lingxiao Jiang and Xin Xia and David Lo and John Grundy},
  year   = {2019},
  eprint = {1908.08615},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1908.08615}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1908.08615.svg)](https://codeofpaper.com/paper/1908.08615)

Discussion