ChinaMessi-Q/GraphDeeSmartContract
Smart contract vulnerability detection using graph neural network (DR-GCN).
Featured achievements
The project's latest awards
#1 Repository of the month
#1 Repository of the month
#1 Repository of the month
GraphDeeSmartContract

This repo is a python implementation of smart contract vulnerability detection using graph neural networks (DR-GCN).
Requirements
Required Packages
- python 3+ (python 3.7 used in our project)
- PyTorch 1.0.0
- numpy 1.18.2
- sklearn 0.20.2
Run the following script to install the required packages.
pip install --upgrade pip
pip install torch==1.0.0
pip install numpy==1.18.2
pip install scikit-learn==0.20.2
Citation
Please use this citation in your paper if you refer to our paper or code.
@inproceedings{zhuang2020smart,
title={Smart Contract Vulnerability Detection using Graph Neural Network.},
author={Zhuang, Yuan and Liu, Zhenguang and Qian, Peng and Liu, Qi and Wang, Xiang and He, Qinming},
booktitle={IJCAI},
pages={3283--3290},
year={2020}
}
Running project
- To run program, please use this command: python3 SMVulDetector.py.
- In addition, you can set specific hyper-parameters, and all the hyper-parameters can be found in
parser.py.
Examples:
python3 SMVulDetector.py --dataset training_data/REENTRANCY_CORENODES_1671
python3 SMVulDetector.py --dataset training_data/REENTRANCY_CORENODES_1671 --model gcn_modify --n_hidden 192 --lr 0.001 -f 64,64,64 --dropout 0.1 --vector_dim 100 --epochs 50 --lr_decay_steps 10,20
Using script:
Repeating 10 times for different seeds with train.sh.
for i in $(seq 1 10);
do seed=$(( ( RANDOM % 10000 ) + 1 ));
python3 SMVulDetector.py --model gcn_modify --seed $seed | tee logs/smartcheck_"$i".log;
done
Then, you can find the training results in the logs/.
Dataset
For original dataset, please turn to the dataset repo.
The normalized train data can be found in
training_data/REENTRANCY_CORENODES_1671, REENTRANCY_FULLNODES_1671
Note that the instruction of constructing the dataset can be found in the GraphLearning, and the XXX_node_attributes can be obtained using our designed tools.
Reference
- A fraction of the code reuses the code of graph_unet.
- Thomas N. Kipf, Max Welling, Semi-Supervised Classification with Graph Convolutional Networks, ICLR 2017.
Similar Projects
Discover other similar projects and AI models.
The official PyTorch implementation of "Pathfinder Discovery Networks for Neural Message Passing" (WebConf '21)
This is a PyTorch implementation of the GeniePath model in <GeniePath: Graph Neural Networks with Adaptive Receptive Paths> (https://arxiv.org/abs/1802.00910)
all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...
Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, every edge explained, no vector store.
Qwen3.8-27B !Note This repository contains model weights and configuration files for the post-trained model in the Hugging Face Transformers format. These artifacts are compatible with Hugging Face Transformers, vLLM, SGLang, TokenSpeed, etc. !Tip F...
Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
A collection of important graph embedding, classification and representation learning papers with implementations.