potentialpaper

Automated Smart Contract Code Generation Based on Graph RAG and LLM

Xiaoqi Li, Yingjie Mao, Wenkai Li, Zongwei Li

ICLR 2026 submission

Edit this page

Or clone it with git

The page gets its repository with its first edit, so start in the web editor.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

Abstract. Smart contract code generation is pivotal for improving development efficiency and mitigating vulnerabilities. Although prior studies have leveraged large language models (LLMs) for this task, their quality still lags behind fine-tuned models such as CodeT5+ and CodeBERT. Existing attempts that combine LLMs with data-flow analysis often fail to adequately capture the hierarchical and control-flow structures of code, resulting in incomplete logic and degraded security. To address these limitations, we present GraphRAG-SCG, a retrieval-augmented generation framework that integrates graph representations with LLMs. GraphRAG-SCG constructs a dual-layer “semantic-control” graph index, dynamically injecting function-call graphs (FCGs), data-dependency graphs (DDGs), and business-constraint facts into an enriched prompt. Through lightweight graph traversal and embedding-based retrieval, the most semantically relevant subgraphs are identified and explicitly presented to the LLM, ensuring both structural consistency and contextual dependency during generation. Extensive experiments on a dataset of 40,000 real-world smart-contract requirement–code pairs demonstrate that GraphRAG-SCG significantly outperforms state-of-the-art baselines, achieving improvements of 13.1%, 5.8%, and 2.4% in RAGAS-Code, CodeBERTScore, and CodeBLEU, respectively, thus offering a new SOTA solution for automated smart-contract development.

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

add · history

No versions are recorded yet: its preprint, the venues it went to and what they decided, the camera-ready. Missing a version?

We don't know of a submission of this paper to a venue with open reviews. Missing a submission?

Loading the discussion…