ResearchTrend.AI
  • Papers
  • Communities
  • Events
  • Blog
  • Pricing
Papers
Communities
Social Events
Terms and Conditions
Pricing
Parameter LabParameter LabTwitterGitHubLinkedInBlueskyYoutube

© 2025 ResearchTrend.AI, All rights reserved.

  1. Home
  2. Papers
  3. 2505.08542
16
0

Guiding LLM-based Smart Contract Generation with Finite State Machine

13 May 2025
Hao Luo
Yuhao Lin
Xiao Yan
Xintong Hu
Y. Wang
Qiming Zeng
Hao Wang
Jiawei Jiang
ArXivPDFHTML
Abstract

Smart contract is a kind of self-executing code based on blockchain technology with a wide range of application scenarios, but the traditional generation method relies on manual coding and expert auditing, which has a high threshold and low efficiency. Although Large Language Models (LLMs) show great potential in programming tasks, they still face challenges in smart contract generation w.r.t. effectiveness and security. To solve these problems, we propose FSM-SCG, a smart contract generation framework based on finite state machine (FSM) and LLMs, which significantly improves the quality of the generated code by abstracting user requirements to generate FSM, guiding LLMs to generate smart contracts, and iteratively optimizing the code with the feedback of compilation and security checks. The experimental results show that FSM-SCG significantly improves the quality of smart contract generation. Compared to the best baseline, FSM-SCG improves the compilation success rate of generated smart contract code by at most 48%, and reduces the average vulnerability risk score by approximately 68%.

View on arXiv
@article{luo2025_2505.08542,
  title={ Guiding LLM-based Smart Contract Generation with Finite State Machine },
  author={ Hao Luo and Yuhao Lin and Xiao Yan and Xintong Hu and Yuxiang Wang and Qiming Zeng and Hao Wang and Jiawei Jiang },
  journal={arXiv preprint arXiv:2505.08542},
  year={ 2025 }
}
Comments on this paper