YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Smart Contract Vulnerability Detection with GraphCodeBERT

Python PyTorch HuggingFace Status

Overview

This project leverages Deep Learning and Natural Language Processing (NLP) to detect vulnerabilities and scam patterns in Solidity Smart Contracts. By fine-tuning the pre-trained GraphCodeBERT model, the system classifies contracts as either "Safe" or "Scam" with high accuracy.

The model weights are hosted on Hugging Face Hub to handle large file sizes efficiently, while the source code resides here on GitHub.

View Model on Hugging Face

Key Features

  • Model Architecture: Fine-tuned microsoft/graphcodebert-base (State-of-the-art for code understanding).
  • Transfer Learning: Adapted a general-purpose code model specifically for Solidity vulnerability detection.
  • Optimization: Utilized AdamW optimizer with Linear Scheduler for stable and effective convergence.
  • Performance: Achieved ~93% Accuracy on the validation set.

Dataset

The model was trained on a dataset containing Solidity smart contracts labeled as:

  • 0 (Normal): Safe contracts.
  • 1 (Scam/Vulnerable): Contracts containing malicious patterns (e.g., Honeypots, Ponzi schemes).

Dataset preprocessing involved tokenization, truncation (512 tokens), and dynamic padding.

Installation

1. Clone the Repository

git clone [https://github.com/Trust-in-depth/Smartcontrats.git](https://github.com/Trust-in-depth/Smartcontrats.git)
cd smartcontrats
Downloads last month
7
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support