EconPapers    
Economics at your fingertips  
 

Smart contract anomaly detection: The Contrastive Learning Paradigm

Oumaima Fadi, Adil Bahaj, Karim Zkik, Abdellatif El Ghazi, Mounir Ghogho and Mohammed Boulmalf
Additional contact information
Oumaima Fadi: UIR - International University of Rabat, Rabat, Morocco
Adil Bahaj: UIR - International University of Rabat, Rabat, Morocco
Karim Zkik: ESC [Rennes] - ESC Rennes School of Business
Abdellatif El Ghazi: UIR - International University of Rabat, Rabat, Morocco
Mounir Ghogho: University of Leeds
Mohammed Boulmalf: UIR - International University of Rabat, Rabat, Morocco

Post-Print from HAL

Abstract: Smart contracts are digital agreements automating the execution of transactions in a decentralized manner. Although they offer many advantages, smart contracts are prone to multiple security vulnerabilities that might cause severe financial losses. Traditional anomaly detection methods, including Machine Learning and Deep Learning, struggle to capture the complexity of smart contract features. Recent advancements have utilized graph neural networks (GNNs) by transforming smart contracts into graphs. However, these approaches face robustness challenges due to small data sizes and model overparameterization. To address these issues, this paper proposes ACAD (Adaptive Contrastive Learning for Smart Contract Attack Detection), a novel framework employing a two-phase training process for smart contract classification. After converting smart contract codes to representative graphs, the task-agnostic features are learned using graph contrastive learning with adaptive augmentations. Next, these features are utilized for smart contract vulnerability classification in a downstream task. Unlike previous works, which rely on a single-phase GNN-based approach, ACAD leverages contrastive learning to improve robustness and generalization. This approach effectively overcomes data scarcity while capturing richer and more distinctive representations. Extensive experiments demonstrate that ACAD outperforms baseline models, achieving 95.7% accuracy and 92.44% precision in reentrancy attack detection, which represents an improvement of 5.78% in accuracy and 6.19% in precision compared to the best-performing baseline model.

Keywords: Smart contracts; Anomaly detection; Contrastive learning; Adaptive augmentation; Blockchain (search for similar items in EconPapers)
Date: 2025-04
References: Add references at CitEc
Citations:

Published in Computer Networks, 2025, 260, pp.111121. ⟨10.1016/j.comnet.2025.111121⟩

There are no downloads for this item, see the EconPapers FAQ for hints about obtaining it.

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:hal:journl:hal-04979285

DOI: 10.1016/j.comnet.2025.111121

Access Statistics for this paper

More papers in Post-Print from HAL
Bibliographic data for series maintained by CCSD ().

 
Page updated 2025-03-22
Handle: RePEc:hal:journl:hal-04979285