SCPatcher: Automated Smart Contract Code Repair via Retrieval-Augmented Generation and Knowledge Graph
arXiv:2604.00687v1 Announce Type: new Abstract: Smart contract vulnerabilities can cause substantial financial losses due to the immutability of code after deployment. While existing tools detect vulnerabilities, they cannot effectively repair them. In this paper, we propose SCPatcher, a framework that combines retrieval-augmented generation with a knowledge graph for automated smart contract repair. We construct a knowledge graph from 5,000 verified Ethereum contracts, extracting function-level relationships to build a semantic network. This graph serves as an external knowledge base that enhances Large Language Model reasoning and enables precise vulnerability patching. We introduce a two-stage repair strategy, initial knowledge-guided repair followed by Chain-of-Thought reasoning for co
View PDF HTML (experimental)
Abstract:Smart contract vulnerabilities can cause substantial financial losses due to the immutability of code after deployment. While existing tools detect vulnerabilities, they cannot effectively repair them. In this paper, we propose SCPatcher, a framework that combines retrieval-augmented generation with a knowledge graph for automated smart contract repair. We construct a knowledge graph from 5,000 verified Ethereum contracts, extracting function-level relationships to build a semantic network. This graph serves as an external knowledge base that enhances Large Language Model reasoning and enables precise vulnerability patching. We introduce a two-stage repair strategy, initial knowledge-guided repair followed by Chain-of-Thought reasoning for complex vulnerabilities. Evaluated on a diverse set of vulnerable contracts, SCPatcher achieves 81.5% overall repair rate and 91.0% compilation pass rate, substantially outperforming existing methods.
Comments: 6 pages, 3 figures
Subjects:
Software Engineering (cs.SE)
Cite as: arXiv:2604.00687 [cs.SE]
(or arXiv:2604.00687v1 [cs.SE] for this version)
https://doi.org/10.48550/arXiv.2604.00687
arXiv-issued DOI via DataCite (pending registration)
Submission history
From: Shipeng Ye [view email] [v1] Wed, 1 Apr 2026 09:44:45 UTC (303 KB)
Sign in to highlight and annotate this article

Conversation starters
Daily AI Digest
Get the top 5 AI stories delivered to your inbox every morning.
More about
modellanguage modelannounce
Latent Reasoning Sprint #3: Activation Difference Steering and Logit Lens
In my previous post I found evidence consistent with the scratchpad paper's compute/store alternation hypothesis — even steps showing higher intermediate answer detection and odd steps showing higher entropy along with results matching “Can we interpret latent reasoning using current mechanistic interpretability tools?”. This post investigates activation steering applied to latent reasoning and examines the resulting performance changes. Quick Summary: Tuned Logit lens sometimes does not find the final answer to a prompt and instead finds a close approximation Tuned Logit lens does not seem to have a consistent location layer or latent where the final answer is positioned. Tuned logit lens variants like ones only trained on latent 3 still only have therefore on odd vectors. Activation stee

How to Publish a Paid API for AI Agents Using MCP and AgenticTrade
How to Publish a Paid API for AI Agents Using MCP and AgenticTrade Most API monetization guides assume your consumers are humans who browse a marketplace, read your docs, and manually configure auth. That assumption is becoming outdated. AI agents do not browse. They query a service registry at runtime, read machine-structured MCP tool descriptors, execute calls autonomously, and handle payment without a human in the loop. The infrastructure for that workflow is what AgenticTrade is building. This article walks through the practical steps to register your API on AgenticTrade — an MCP-native marketplace where AI agents can discover, authenticate, and pay for your API per call in USDC. What MCP Actually Does Here MCP (Model Context Protocol) is a protocol for exposing tools and data sources
Knowledge Map
Connected Articles — Knowledge Graph
This article is connected to other articles through shared AI topics and tags.
More in Models

Latent Reasoning Sprint #3: Activation Difference Steering and Logit Lens
In my previous post I found evidence consistent with the scratchpad paper's compute/store alternation hypothesis — even steps showing higher intermediate answer detection and odd steps showing higher entropy along with results matching “Can we interpret latent reasoning using current mechanistic interpretability tools?”. This post investigates activation steering applied to latent reasoning and examines the resulting performance changes. Quick Summary: Tuned Logit lens sometimes does not find the final answer to a prompt and instead finds a close approximation Tuned Logit lens does not seem to have a consistent location layer or latent where the final answer is positioned. Tuned logit lens variants like ones only trained on latent 3 still only have therefore on odd vectors. Activation stee

Competition or ‘co-opetition’: how is convergence shaping AI race between China and US?
There was a surprise guest speaker at Nvidia’s widely watched GPU Technology Conference (GTC) in San Jose, California, last month: Yang Zhilin, the founder of Beijing-based Moonshot AI, the developer behind the Kimi family of foundational artificial intelligence models. Amid heated rhetoric about US-China AI competition, which some have likened to an “arms race”, the participation of a Chinese AI start-up’s CEO at the flagship event of American chipmaking giant Nvidia might have struck some as...



Discussion
Sign in to join the discussion
No comments yet — be the first to share your thoughts!