Smart contracts are central to blockchain ecosystems, yet their development remains technically demanding, error-prone, and tied to platform-specific programming languages. This paper introduces SCEditor-Web, a web-based modeling environment that combines model-driven engineering (MDE) with generative artificial intelligence (Gen-AI) to simplify contract design and code generation. Developers specify the structural and behavioral aspects of smart contracts through a domain-specific visual language grounded in a formal metamodel. The resulting contract model is exported as structured JSON and transformed into executable, platform-specific code using large language models (LLMs) guided by a tailored prompt engineering process. A prototype implementation was evaluated on Solidity contracts as a proof of concept, using representative use cases. Experiments with state-of-the-art LLMs assessed the generated contracts for compilability, semantic alignment with the contract model, and overall code quality. Results indicate that the visual-to-code workflow reduces manual effort, mitigates common programming errors, and supports developers with varying levels of expertise. The contributions include an abstract smart contract metamodel, a structured prompt generation pipeline, and a web-based platform that bridges high-level modeling with practical multi-language code synthesis. Together, these elements advance the integration of MDE and LLMs, demonstrating a step toward more accessible and reliable smart contract engineering.
Ye Li, Mengliang Li, Dehai Zhao, Jiamou Sun · 5 authors
Solidity, the dominant smart contract language for Ethereum, has rapidly evolved with frequent version updates to enhance security, functionality, and developer experience. However, these continual changes introduce significant challenges, particularly in compilation errors, code migration, and maintenance. Therefore, we conduct an empirical study to investigate the challenges in the Solidity version evolution and reveal that 81.68 % of examined contracts encounter errors when compiled across different versions, with 86.92 % of compilation errors. To mitigate these challenges, we conducted a systematic evaluation of large language models (LLMs) for resolving Solidity compilation errors during version migrations. Our empirical analysis across both open-source (LLaMA3, DeepSeek) and closedsource (GPT-4o, GPT-3.5-turbo) LLMs reveals that although these models exhibit error repair capabilities, their effectiveness diminishes significantly for semantic-level issues and shows strong dependency on prompt engineering strategies. This underscores the critical need for domain-specific adaptation in developing reliable LLM-based repair systems for smart contracts. Building upon these insights, we introduce SMCFIXER, a novel framework that systematically integrates expert knowledge retrieval with LLM-based repair mechanisms for Solidity compilation error resolution. The architecture comprises three core phases: (1) context-aware code slicing that extracts relevant error information; (2) expert knowledge retrieval from official documentation; and (3) iterative patch generation for Solidity migration. Experimental validation across Solidity version migrations demonstrates our approach's statistically significant 24.24% improvement over baseline GPT-4o on real-world datasets, achieving near-perfect 96.97% accuracy.
Do Tran Anh Duc, Lê Thái Hùng, Hoang-Phuong Chu-Nguyen, Van-Hau Pham · 5 authors
The increasing deployment of smart contracts has drawn significant attention to the urgent need for robust and scalable vulnerability detection techniques to mitigate substantial financial risks associated with their immutable nature on blockchain platforms. This paper introduces structured reasoning prompts using agent-role chaining for vulnerability detection that utilizes model capacity to enhance smart contract security through zero-shot and structured prompt engineering without fine-tuning. By carefully defining agent roles and embedding explicit reasoning steps within structured prompts for large language models (LLMs), the proposed method exploits the inherent reasoning capabilities of LLMs to identify security flaws in smart contracts without extensive model retraining. Experimental results demonstrate the effectiveness of the system in achieving competitive performance compared to existing vulnerability detection techniques, highlighting the potential of prompt engineering as an efficient and adaptable strategy for enhancing smart contract security.
Nguyen Dang Quynh Nhu, Quan Li, Thai Hung Van, Doan Minh Trung · 5 authors
The burgeoning adoption of economically incentivized smart contracts faces persistent security vulnerabilities, resulting in significant financial losses due to their immutability post-deployment. This paper presents a novel framework integrating fine-tuned large language models (LLMs) with Retrieval-Augmented Generation (RAG) to enhance the precision and explainability of smart contract vulnerability detection. By fine-tuning an open-source LLM and employing RAG, our model dynamically incorporates domain-specific external knowledge during inference, significantly improving threat identification. On two public benchmarks, SolidiFI-Benchmark and Smart Bugs Curated, our fine-tuned Qwen2.5-Coder-14B model (QC-14B-FT) outperforms zero-shot LLMs (GPT-3.5 with and without RAG) in terms of F1-score. Specifically, QC-14B-FT achieves an F1-score of 0.64 on SolidiFI, surpassing GPT-3.5-RAG by 9% and GPT-3.5 by 10%. On Smart Bugs Curated, QC-14B-FT achieves an F1-score of 0.73, outperforming GPT-3.5-RAG by 14% and GPT-3.5 by 19%. These results demonstrate the effectiveness of combining RAG with fine-tuning to provide accurate and clear smart contract security assessments.
Widespread reuse of open-source code in smart contract development boosts programming efficiency but significantly amplifies bug propagation across contracts, while dedicated methods for detecting similar smart contract functions remain very limited. Conventional abstract-syntax-tree (AST) based methods for smart contract similarity detection face challenges in handling intricate tree structures, which impedes detailed semantic comparison of code. Recent deep-learning based approaches tend to overlook code syntax and detection interpretability, resulting in suboptimal performance. To fill this research gap, we introduce SmartDetector, a novel approach for computing similarity between smart contract functions, explainable at the fine-grained statement level. Technically, SmartDetector decomposes the AST of a smart contract function into a series of smaller statement trees, each reflecting a structural element of the source code. Then, SmartDetector uses a classifier to compute the similarity score of two functions by comparing each pair of their statement trees. To address the infinite hyperparameter space of the classifier, we mathematically derive a cosine-wise diffusion process to efficiently search optimal hyperparameters. Extensive experiments conducted on three large real-world datasets demonstrate that SmartDetector outperforms current state-of-the-art methods by an average improvement of 14.01% in F1-score, achieving an overall average F1-score of 95.88%.
Smart contracts play a pivotal role in blockchain ecosystems, and fuzzing remains a critical approach to securing them. However, existing smart contract fuzzers often optimize either seed generation or mutation scheduling in isolation and rely on narrow, fragmented feedback signals, leaving multi-transaction reasoning and stagnation recovery under-explored. In this work, we propose aLarge Language Models(LLMs)-based Multi-feedback Smart Contract Fuzzing framework (LLAMA). Key components of the proposed LLAMA include: (i) a hierarchical prompting strategy that guides LLMs to generate structurally valid, context-aware multi-transaction initial seeds, together with a lightweight pre-fuzzing phase that validates and prioritizes high-potential LLM-generated candidates; (ii) a multi-feedback-guided evolutionary optimization module that jointly optimizes seed selection and mutation scheduling by a group of constraints for driving an LLM-bootstrapped bandit scheduler. (iii) an LLM-guided hybrid fuzzing module that integrates evolutionary fuzzing with a dual-channel recovery mechanism, which concurrently employs asynchronous coverage-stagnation- based LLM reseeding and selective symbolic execution to resolve complex path constraints. Our extensive experiments demonstrate that LLAMA outperforms state-of-the-art fuzzers in both coverage and vulnerability detection. Specifically, it achieves 92% instruction coverage on small contracts and 81% on large contracts, while detecting 132 out of 148 known vulnerabilities across diverse categories. Ablation studies further evidence that the proposed multi-feedback and hybrid recovery strategies have strong impact on LLAMA’s performance. The results explain LLAMA’s effectiveness, adaptability, and practicality in complex smart contract scenarios.
Haowei Liu, Yanxiang Tong, Shunhui Ji, Pengcheng Zhang
While smart contracts, as automatic processing programs for decentralized applications deployed on the blockchain, have gained widespread attention, their vulnerabilities have also led to significant economic losses. To address this security issue, researchers have proposed various approaches for locating vulnerabilities in smart contracts. However, most of them are designed to identify vulnerable smart contracts within a blockchain-based application. Only a few approaches adopt deep learning techniques to locate the exact line containing the reentrancy vulnerability based on Ethereum smart contracts’ source code. In this paper, we focus on the bytecode of Ethereum smart contracts and propose DeepLocator, a deep learning-based two-phase locator designed to pinpoint code-line-level reentrancy vulnerabilities. In the detection phase, DeepLocator constructs an attributed control flow graph extracted from the smart contract’s opcodes, and applies graph neural networks (GNNs) to determine whether a contract contains reentrancy vulnerabilities. In the localization phase, DeepLocator employs a model explainer of GNNs to rank the opcodes of each vulnerable smart contract according to their impact on the detection phase’s results, and then maps them back to the source code with the output of ranked suspicious statements. Empirical experiments conducted on widely used datasets of reentrancy vulnerabilities validate the efficacy of our locator. DeepLocator outperforms baseline traditional and learning-based detection approaches by 28.7% and 3.5%, respectively. Moreover, it pinpoints 20.0%, 61.1%, and 74.5% vulnerabilities within the top 1, 5, and 10 ranked suspicious statements, respectively.
B. Rohith, N.R. Sathis Kumar, P. Animma Srinivasine, Balram Babu · 5 authors
Modern online finance operations create difficult obstacles for detecting fraudulent activity. While deep learning (DL) models effectively identify fraudulent activities, their "black-box" nature raises concerns about trust and interpretability. The research design recommends an XDL-Blockchain solution for fraud detection that enhances transparency and accuracy alongside enhanced security capabilities. SHAP and Grad-CAM methods supply interpretation features that enhance stakeholder confidence and blockchain technologies deliver permanent decentralized identity proofing systems which minimize fraudulent activity. Experimental assessments using genuine financial data show that the proposed model delivers superior outcomes compared to conventional detection systems regarding precision and network security. The framework unites artificial intelligence with blockchain technology to provide banks with a dependable system that delivers reliable detection of contemporary financial fraud.
Thirunavukkarasu Jayakumar, J P Jeffrin, R. Surender, Naresh Kumar Thapa · 6 authors
The project addresses a significant challenge in the real estate sector by developing a secure and transparent decentralized marketplace for property transactions. Inspired by platforms such as OpenSea, the primary aim of this project is to combat fraud and enhance transparency in land registration processes. To achieve this, the project leverages cutting-edge technologies including Ethereum blockchain, Solidity smart contracts, and decentralized storage solutions like InterPlanetary File System (IPFS) and Pinata. The core innovation of this project lies in its use of Ethereum's blockchain technology to facilitate property transactions. Ethereum's smart contracts are employed to automate and enforce transaction rules, ensuring that all property transfers are conducted with utmost security and transparency. These smart contracts handle various aspects of the transaction process, from listing properties to processing bids and executing ownership transfers, all while maintaining an immutable record of each transaction on the blockchain. The platform is built with a user-friendly web interface using HyperText Markup Language (HTML), Cascading Style Sheets (CSS), and JavaScript, designed to offer a responsive and interactive experience for users. This web application integrates seamlessly with the blockchain to provide Real-Time updates and ensure smooth interactions between buyers, sellers, and the system. The decentralized nature of the platform is further reinforced by utilizing InterPlanetary File System (IPFS) for storing property records and transaction data. IPFS ensures that this data is not only secure but also resistant to tampering and data loss, providing a reliable means of maintaining property records. A significant advantage of this system is its ability to mitigate common issues associated with traditional real estate transactions, such as fraudulent activities and inaccurate ownership records. By providing an immutable and transparent record of transactions, the platform instills greater trust in the property market. The use of decentralized storage and smart contracts also reduces reliance on intermediaries, streamlining the transaction process and lowering associated costs. The project's implementation involves rigorous development and testing phases to ensure that the system meets performance and security standards. The platform's prototype has been successfully demonstrated to achieve high responsiveness and accuracy in managing property transactions.
As blockchain technology becomes prevalent, smart contracts have shown significant utility in finance and supply chain management. However, vulnerabilities in smart contracts pose serious threats to blockchain security, leading to substantial economic losses. Therefore, developing effective vulnerability detection solutions is urgent. To address this issue, we propose a method for detecting vulnerabilities in smart contracts using graph neural networks (GNNs) that can identify eight common vulnerabilities. Our method is fully automated, applicable to all Ethereum smart contracts, and does not require expert-defined rules or manually defined features. We extract the Control Flow Graph and Abstract Syntax Graph from the smart contract code, which are then processed by a GNN to generate feature vectors for classification. Experiments on a real Ethereum dataset demonstrate that our method significantly outperforms existing state-of-the-art approaches. For individual detection tasks, the combined source code and bytecode method achieves an average accuracy of 95.78%, with a peak of 99.13%, and an average F1 score of 93.80%. Compared to competitors, our method shows an average improvement of 51.92% in accuracy and 47.21% in F1 score. The bytecode-only method achieves an average accuracy of 94.68% and an F1 score of 92.36%. For multi-class tasks, both methods achieve high accuracies of 91.26% and 87.34%, with F1 scores of 97.42% and 96.43%, respectively.
Existing static detection methods often fail to cap-ture dynamic interactions in smart contracts, resulting in low detection accuracy. Noise from irrelevant data can also affect the precision of vulnerability detection. This paper introduces a new method for detecting malicious smart contracts-GLM-ABLSTM-A, which integrates a General Language Model (GLM) with an Attention-based Long Short-Term Memory (ABLSTM) network. The method aims to address the limitations of static detection techniques, such as low accuracy and limited practicality, focusing on the interactivity and collaboration of smart contract systems. It compiles malicious contract code into Java and labels it, then preprocesses the code with GLM to ex-tract relevant textual information, reducing noise in the detection process. Finally, the extracted feature vectors are fed into the ABLSTM-A classifier. This technique introduces a feature extraction framework based on GLM, combined with the ABLSTM-A classifier, which enhances both the accuracy and efficiency of malicious contract detection and improves the in-teractivity and adaptability of the detection system.
Mohan Harish Maturi, Elyson De La Cruz, Santosh Reddy Addula, Akhila Reddy Yadulla · 8 authors
Smart contracts, integral to decentralized applications, are unfortunately plagued by security vulnerabilities. Re-entrancy attacks pose a particularly insidious threat, allowing attackers to exploit subtle interactions within the contract’s code. While traditional detection methods exist, they often struggle with false positives and a lack of transparency, hindering the ability of developers to understand and fix the problems. This research introduces a novel framework that combines the power of Explainable AI (XAI) with a deep learning approach to address these shortcomings. Neural networks utilize the proposed BiLSTMs model to design a framework that detects re-entrancy patterns because they excel at analyzing complex dependencies across the length of smart contract code. The decision to explain models is enhanced through XAI techniques, which improve the entire process. The explanations reveal which code sections from the codebase contribute to vulnerability classification. Combining two detection methods intends to improve re-entrancy vulnerability detection performance while providing rapid remedy recommendations.
This thesis focuses on the detection and analysis of sandwich attacks in the Ethereum ecosystem, with an emphasis on transactions executed through decentralized exchanges (DEXs) such as Uniswap [1]. Sandwich attacks are a malicious strategy in which an attacker inserts transactions before and after a victim’s transaction, exploiting price fluctuations for personal gain [2]. The goal of the project is to develop a detection mechanism based on real on-chain data. To achieve this, the Python programming language was utilized, and the approach was based on transaction data exported from Etherscan. The tool processes transactions via .csv files, performing filtering and chronological sorting. It then applies a sliding window algorithm to detect suspicious patterns such as BUY–BUY–SELL and SELL–SELL–BUY, which are associated with sandwich attacks. The tool identifies cases where the same address interacts with the same liquidity pool before and after a victim’s transaction, suggesting potential price manipulation. Identified attackers are logged in a structured JSON file along with the relevant transactions and timestamps. This approach ensures both flexibility and accuracy, while avoiding the technical limitations of live API usage. During testing, numerous sandwich attacks were detected, primarily in tokens with high transaction volume and activity. The SELL–SELL–BUY pattern was observed more frequently than BUY–BUY–SELL, with most attacks occurring within 0–2 seconds between steps. Furthermore, several repeated attacker addresses were identified, indicating the presence of bots executing systematic strategies. Through this analysis, the system detects patterns indicative of sandwich attacks and records the attackers in a JSON file. While it does not implement an automated reporting mechanism, the generated data can potentially support the submission of formal complaints to regulatory entities or be used for further research aimed at strengthening security in the DeFi ecosystem [3].
Smart contracts, which automatically execute transactions based on predefined conditions, play a crucial role in asset and money exchanges. Due to their involvement in significant financial transactions, these contracts are attractive targets for hackers, leading to substantial financial losses through exploitable vulnerabilities. While various program analysis methods such as Oyente, Mythril, and Securify have been proposed to address these security concerns, they rely on rule-based patterns that are time-consuming to develop and offer limited coverage. Deep learning methods present an alternative by automatically learning code features to detect vulnerabilities. However, existing approaches face critical challenges, including feature limitations and lack of interpretability. To address these gaps, we propose the interpretable smart contract vulnerability detector, a Graph Isomorphism Network (GIN)-based vulnerability prediction model for smart contracts, enhanced with code subgraph explanations. Our approach identifies and incorporates 43 domain-specific features, augmenting GIN with domain knowledge attention mechanisms to improve vulnerability prediction. In addition, we develop an interpreter called SubgraphV, which provides explanations for vulnerability predictions through interpreted subgraphs. Our model demonstrates superior performance over traditional tools, achieving F1 score improvements from 0.254 to 0.489 on a dataset of 103 smart contract function vulnerabilities. SubgraphV outperforms existing explainability methods like GNNexplainer, PGExplainer, and SubgraphX in pinpointing vulnerabilities, accurately reflecting vulnerability patterns, and enhancing the understanding of vulnerabilities.
The emergence of the Metaverse as a decentralized digital ecosystem has transformed traditional contract enforcement by introducing smart contracts, self-executing agreements embedded in blockchain systems. This study conducts a comparative legal analysis of the regulatory frameworks governing smart contracts within Metaverse operations in Nigeria and Uganda. Employing a doctrinal legal method, the research critically examines primary legal sources such as statutory laws and case law, alongside scholarly literature, to assess legal recognition, enforceability, and institutional preparedness. The study reveals a significant regulatory gap in Nigeria, where the absence of a comprehensive legal framework creates uncertainty in the enforceability of smart contracts, despite growing blockchain policy initiatives. In contrast, Uganda has established more definitive legal provisions, particularly through its Electronic Transactions and Signature Acts, which explicitly validate digital contracts. The novelty of this study lies in its regional comparative focus on emerging economies and its analysis of how traditional contract principles interact with decentralized digital platforms. The urgency of this inquiry is underscored by the rapid digitalization of commerce, which necessitates timely legal adaptation to prevent regulatory obsolescence and safeguard stakeholders. This research contributes to the discourse on digital governance by proposing a legal reform agenda for Nigeria, advocating for the adoption of a smart contract-enabling framework modeled after Uganda’s approach. Ultimately, it calls for regional and international harmonization to ensure legal certainty, consumer protection, and dispute resolution within Metaverse-driven economies.
Jishnu Patlola, Rishitha Manyam, Himakar Chappidi, K Suvarchala
This paper investigates the application of CodeBERT, a pre-trained transformer model, to improve the detection of vulnerabilities in smart contracts.Smart contracts, while central to blockchain technology, are susceptible to security flaws that can result in significant financial and operational risks.By fine-tuning CodeBERT on labeled datasets specifically curated for smart contracts, our approach enhances the precision and efficiency of identifying various security issues.This method not only offers a robust solution to the existing challenges in blockchain security but also contributes to the broader efforts to secure decentralized systems and ensure the reliability of blockchain applications
As blockchain technology continues to evolve, the need for accessible solutions for developing smart contracts has grown, especially for non-technical users. This paper addresses practitioners' challenges in generating Solidity smart contracts from natural language requirements within the AstraKode Blockchain no-code platform (AKB). Our goal is to lower the barrier of entry into smart contract development, making it more accessible to users with limited technical expertise. We propose three methods, i.e., Naive Generation, Augmented Generation, and Enhanced Generation, each utilizing large language models to streamline the code generation process. These methods cater to different user needs, from rapid prototyping to handling complex business scenarios, improving accessibility and usability within AKB. We demonstrate their practical relevance, potential, and limitations in addressing real-world challenges in smart contract development through empirical evaluations and practitioner feedback. Thanks to collaboration with academia and effective knowledge transfer, these methods provide innovative solutions to the challenges of smart contract generation. Furthermore, they have been integrated into AKB to enhance user services, ultimately promoting the development and deployment of secure and efficient smart contracts in the industry.
Artificial Intelligence in Law
Advanced Research in Systems and Signal Processing
Smart contracts, closely intertwined with cryptocurrency transactions, have sparked widespread concerns about considerable financial losses of security issues. To counteract this, a variety of tools have been developed to identify vulnerability in smart contract. However, they fail to overcome two challenges at the same time when faced with smart contract bytecode: (i) strong interference caused by enormous non-relevant instructions; (ii) missing semantics of bytecode due to incomplete data and control flow dependencies. In this paper, we propose a multi-teacher based bytecode vulnerability detection method, namely Multi-Teacher Vulnerability Hunter (MTVHunter), which delivers effective denoising and missing semantic to bytecode under multi-teacher guidance. Specifically, we first propose an instruction denoising teacher to eliminate noise interference by abstract vulnerability pattern and further reflect in contract embeddings. Secondly, we design a novel semantic complementary teacher with neuron distillation, which effectively extracts necessary semantic from source code to replenish the bytecode. Particularly, the proposed neuron distillation accelerate this semantic filling by turning the knowledge transition into a regression task. We conduct experiments on 229,178 real-world smart contracts that concerns four types of common vulnerabilities. Extensive experiments show MTVHunter achieves significantly performance gains over state-of-the-art approaches.
Blockchain (BC) technology and Artificial Intelligence (AI) are promising areas with potential for powerful, secure, and decentralized applications in various sectors. Also, LLMs, are essential advanced machine learning frameworks, which are now used in various applications, including customer service, chatbots, code generation, and language translation. In terms of software development, LLMs are being investigated as a potential way to create smart contracts, focusing on their ability to emulate human programming techniques. For that purpose, this study reviews the capabilities and limitations of Large Language Models (LLMs) like GPT-3.5, PaLM2, and Code Llama in detecting vulnerabilities in Solidity smart contract code.
Semantic code search technology allows searching for existing code snippets through natural language, which can greatly improve programming efficiency. Smart contracts, programs that run on the blockchain, have a code reuse rate of more than 79%, which means developers have a great demand for semantic code search tools. However, the existing code search models still have a semantic gap between code and query and perform poorly on specialized queries of smart contracts. In this paper, we propose a Multi-Modal Smart contract Code Search (MM-SCS) model. Specifically, we construct a Contract Elements Dependency Graph (CEDG) for MM-SCS as an additional modality to capture the data flow and control flow information of the code. To make the model more focused on the key contextual information, we use a multi-head attention network to generate embeddings for code features. In addition, we use a fine-tuned pretrained model to ensure the model's effectiveness when the training data is small. We compared MM-SCS with four state-of-the-art models on a dataset with 470K (code, docstring) pairs collected from Github and Etherscan. Experimental results show that MM-SCS achieves an MRR (Mean Reciprocal Rank) of 0.572, outperforming four state-of-the-art models UNIF, DeepCS, CARLCS-CNN, and TAB-CS by 34.2%, 59.3%, 36.8%, and 14.1%, respectively. Additionally, the search speed of MM-SCS is second only to UNIF, reaching 0.34s/query.
This study investigates the transformative impact of digitization on legal systems in developing countries, emphasizing the integration of emerging technologies such as blockchain and smart contracts. By exploring case studies from India, Kenya, Brazil, Rwanda, South Africa, the Philippines, and Ghana, the research highlights how digital adoption enhances legal infrastructure, expands access to justice, and drives regulatory evolution. A mixed-method approach, combining qualitative interviews and quantitative analysis of legal reforms, reveals that digitization significantly reduces case backlogs, improves transparency, and accelerates judicial processes. However, persistent challenges, including inadequate digital infrastructure, disparities in digital literacy, and cybersecurity vulnerabilities, underscore the need for coordinated interventions. The study identifies blockchain as a critical tool for ensuring the integrity and security of legal records, providing tamper-proof documentation, and fostering trust in legal processes. Similarly, smart contracts streamline legal transactions by automating and enforcing agreements, reducing costs, and enhancing efficiency. These technologies are essential for modernizing judicial frameworks and addressing governance gaps, particularly in regions grappling with corruption and bureaucratic inefficiencies. Ultimately, the findings underscore the importance of phased implementation strategies, investments in digital literacy, and inclusive policy frameworks to maximize the benefits of legal digitization. By integrating blockchain and smart contracts, developing countries can build resilient, transparent, and accessible legal systems that respond to the dynamic needs of their societies.