{"id":25050492,"url":"https://github.com/beyondacm/SmartEmbed","last_synced_at":"2025-10-21T06:31:50.587Z","repository":{"id":44844893,"uuid":"186933264","full_name":"beyondacm/SmartEmbed","owner":"beyondacm","description":"A Tool for clone detection and bug detection in smart contracts","archived":false,"fork":false,"pushed_at":"2023-05-13T08:24:57.000Z","size":2783,"stargazers_count":87,"open_issues_count":4,"forks_count":31,"subscribers_count":8,"default_branch":"master","last_synced_at":"2023-10-20T18:13:11.849Z","etag":null,"topics":["bug-detection","clones","code-clones","code-embedding","ethereum","smart-contracts"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beyondacm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-05-16T02:08:26.000Z","updated_at":"2023-10-18T07:28:16.000Z","dependencies_parsed_at":"2023-10-20T18:23:23.014Z","dependency_job_id":null,"html_url":"https://github.com/beyondacm/SmartEmbed","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondacm%2FSmartEmbed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondacm%2FSmartEmbed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondacm%2FSmartEmbed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondacm%2FSmartEmbed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beyondacm","download_url":"https://codeload.github.com/beyondacm/SmartEmbed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237446277,"owners_count":19311291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bug-detection","clones","code-clones","code-embedding","ethereum","smart-contracts"],"created_at":"2025-02-06T09:03:42.850Z","updated_at":"2025-10-21T06:31:50.575Z","avatar_url":"https://github.com/beyondacm.png","language":"JavaScript","readme":"# SmartEmbed Web Tool\n\nSmartEmbed is a web service tool for clone detection \u0026 bug detection for smart contracts. **We have newly added the [interface of using smartembed](#smartembed-interface-usage\n) for estimating similarities between different smart contracts, please feel free to have a try! :) Any questions and feedback are very welcome.** \n\nOur full research paper: Checking smart contracts with structural code embeddings has been published on TSE (IEEE Transactions on Software Engineering), we describe the details for clone detection and bug detection in smart contracrs using SmartEmbed, for more details please refer to our research paper:   \nhttps://ieeexplore.ieee.org/document/8979435  \nhttps://arxiv.org/abs/2001.07125\n\nSmartEmbed has been published as a tool demo by on [ICSME-2019](https://icsme2019.github.io/), for details of the implementation please refer to our paper:  \nhttps://arxiv.org/abs/1908.08615\n\nOur work: When Deep Learning Meets Smart Contracts has been accepted by ASE-2020 Student Research Competition track, for more details please refer to our paper:  \nhttp://arxiv.org/abs/2008.04093  \n\n\nWe have published our tool through the following url:   \n[http://www.smartembed.tools/](http://www.smartembed.tools/)   \n\n\nThere is a tutorial video introducing how to use SmartEmbed on Youtube:  \nhttps://youtu.be/o9ylyOpYFq8\n\nSource data can be downloaded from:  \nhttps://drive.google.com/file/d/13iTTpt7gFd9wEW35C2fX4pVT7cVlHgxi/view?usp=sharing\n\nPlease cite our work if you found our work is helpful:  \n*Checking smart contracts with structural code embeddings:*  \n\u003e @article{gao2020checking,    \n  title={Checking Smart Contracts with Structural Code Embedding},  \n  author={Gao, Zhipeng and Jiang, Lingxiao and Xia, Xin and Lo, David and Grundy, John},  \n  journal={IEEE Transactions on Software Engineering},\n  year={2020},  \n  publisher={IEEE}  \n}  \n\n\n*Smartembed: A tool for clone and bug detection in smart contracts through structural code embedding:*  \n\u003e @inproceedings{gao2019smartembed,  \n  title={Smartembed: A tool for clone and bug detection in smart contracts through structural code embedding},  \n  author={Gao, Zhipeng and Jayasundara, Vinoj and Jiang, Lingxiao and Xia, Xin and Lo, David and Grundy, John},  \n  booktitle={2019 IEEE International Conference on Software Maintenance and Evolution (ICSME)},  \n  pages={394--397},  \n  year={2019},  \n  organization={IEEE}  \n}\n\n\n*When Deep Learning Meets Smart Contracts*\n\u003e @article{gao2020deep,  \n  title={When Deep Learning Meets Smart Contracts},  \n  author={Gao, Zhipeng},   \n  journal={arXiv preprint arXiv:2008.04093},  \n  year={2020}    \n}\n\n\n\n## Introduction\n\nThis folder contains the code for the SmartEmbed web tool. There are a few important subfolders and files as follows.\n\n- **templates** - contains the frontend html files\n- **static** - contains the *css* files and *js* scripts\n- **app[dot]py** - main flask file, see below for usage.\n- **similarity[dot]py** and **smart_embed[dot]py** - Contains the backend codes for clone detection. \n- **bug[dot]py** and **smart_bug[dot]py** - Contains the backend codes for bug detection. \n\n## Pretraied Models\n\nWe have released the pre-trained model as described in the paper. You can use the following command to download our pretrained model:\n\n```shell\npip install gdown\ngdown https://drive.google.com/uc?id=1-LKJTZakqd8ntKzqVNtQZUgdZnFoYtpK\nunzip Contract_Embedding.zip\ncp -r Embedding/ SmartEmbed/contract_level/\n```  \n\n\n```shell\npip install gdown  \ngdown https://drive.google.com/uc?id=1lbaQVtZbNuEEjHIWVnwLqGvILxNWwtZW  \nunzip Contract_Model.zip  \nmv Model SmartEmbed/contract_level/\n```\n\n```shell\npip install gdown  \ngdown https://drive.google.com/uc?id=18GiDgSwoRjPC25d2Vp15oi_xH2NivyXH  \nunzip Statement_Model.zip \nmv Model SmartEmbed/statement_level/  \n```\n\n\n## SmartEmbed Web Tool Setup and Usage\n\n1. Install requirements.txt with ```pip install -r requirements.txt```.\n2. Clone this project to your local ```git clone https://github.com/beyondacm/SmartEmbed.git```.\n3. Please download the pretrained model with the aforementioned shell scripts. \n4. Change directory to ```cd SmartEmbed/todo/```, and Run the command ```python app.py``` . This will initialize the web tool at ```localhost:9000```, as illustrated below.\n![image](https://drive.google.com/uc?export=view\u0026id=1k87ZXIMvkGcToYUjAh1Mn0CyBkzmQoC4)\n5. Paste the smart contract on to the text area and hit *Submit*.\n6. Clone detection results will be displayed as follows.\n![image](https://drive.google.com/uc?export=view\u0026id=1iNfJdYrjdByUJqB5DRsCg-IaaYmsL5gK)\n7. Bug detection results will be displayed as follows.\n![image](https://drive.google.com/uc?export=view\u0026id=1Mg9UOT99lql1XGBI_XQiVDrugbxbNmxn)\n\n\n## SmartEmbed Interface Usage\nYou can easily use smartembed tool to estimate the similarity between two smart contracts, the following code snippet gives an example: \n\n```python\nfrom smartembed import SmartEmbed\n\nse = SmartEmbed()\n# read contract1 from file\ncontract1 = open('./todo/test.sol', 'r').read() \n# get vector representation for contract1\nvector1 = se.get_vector(contract1)\n# read contract2 from file\ncontract2 = open('./todo/KOTH.sol', 'r').read()\n# get vector representation for contract2\nvector2 = se.get_vector(contract2)\n# estimate similarity between contract1 and contract2 \nsimilarity = se.get_similarity(vector1, vector2)\nprint(\"similarity between c1 and c2:\", similarity)\n```\n\n## Contact\nzhipeng.gao@zju.edu.cn  \nvinojmh@smu.edu.sg  \nDiscussions, suggestions and questions are welcome!\n\n\n​\t\n​\t\n​\t\n\n","funding_links":[],"categories":["Static Analysis"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondacm%2FSmartEmbed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyondacm%2FSmartEmbed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondacm%2FSmartEmbed/lists"}