Official implementation of SmartTrans: Advanced Similarity Analysis for Detecting Vulnerabilities in Ethereum Smart Contracts. The Model and Dataset are released at NextCloud
- Linux OS (Tested on Ubuntu 24.04.2 LTS)
- Python 3.8+
- PyTorch 1.10+ with CUDA 10.2+
- NVIDIA Drivers (Tested with 550.135)
- Gigahorse-toolchain (for bytecode CFG analysis)
- Create and activate conda environment:
conda create -n smarttrans python=3.8 -y
conda activate smarttrans
- Install dependencies:
pip install tqdm pandas transformers faiss-gpu accelerate datasets wandb
- Clone repository:
git clone https://github.com/vul337/SmartTrans.git && cd SmartTrans
- Download and extract models and datasets: Please download and extract the models from NextCloud
tar -xzvf *.tar.gz
mkdir index/
mv searching_index.index index/
mv searching_ebds_list.pkl index/
- Preprocess bytecode using Gigahorse-toolchain (set
TEMP_PATH
in1.Analyze_gigahorse.py
to point to Gigahorse's.temp
directory)
python3 1.Analyze_gigahorse.py
- Run preprocessing and inference:
python3 2.Preprocess.py
python3 3.SaveEmbedding.py
- Retrieve similar functions:
python3 4.Retrieve.py
train.sh
finetune.sh
The exact conda environment configuration is provided in smarttrans_env.yaml
.
If this work is helpful for your research, please consider citing the following BibTeX entry.
@article{chen2025smarttrans,
title={SmartTrans: Advanced Similarity Analysis for Detecting Vulnerabilities in Ethereum Smart Contracts},
author={Chen, Longfei and Wang, Hao and Zhou, Yuchen and Wong, Taiyu and Wang, Jialai and Zhang, Chao},
journal={IEEE Transactions on Dependable and Secure Computing},
year={2025},
publisher={IEEE}
}