SolGen: Secure Smart Contract Code Generation Using Large Language Models Via Masked Prompting

Owing to the swift advancement of technology and the unfamiliarity of the execution environment, the development of Solidity smart contracts from scratch often results in significant vulnerabilities.In contrast, automated code generation enhances productivity, minimizes development time, and enables developers to focus on high-level tasks and fundamental logic.In consideration of these two viewpoints, this paper examines the utilization of large language models (LLMs) for the automatic generation of Solidity smart contracts based on specified criteria, while simultaneously ensuring the elimination of vulnerabilities through a novel masking strategy.To achieve this, we propose SolGen, a framework for generating secure Solidity smart contract code using LLMs.We assess the performance of existing LLMs (i.e.ChatGPT and Meta AI) for secure Solidity code generation.Our research indicates that ChatGPT outperforms Meta AI in performance, yielding a greater percentage of syntactically accurate and secure code.Additionally, we examine the impact of temperature adjustment on the security of generated contracts using an open-source LLM, Llama3.Our findings suggest that a temperature setting of 0.7 is optimal for the generation of Solidity code, considerably exceeding the performance of both lower and higher settings (0.1 and 1.2), especially with regard to the compilability of the code.

Authors

Institutions

Publication Details

Published
2025-02-20
DOI
https://doi.org/10.1145/3717383.3717394
Citations
1
Primary Topic
Blockchain Technology Applications and Security
Type
article
Field-Weighted Citation Impact
3.25

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

SolGen: Secure Smart Contract Code Generation Using Large Language Models Via Masked Prompting

Sorbajit Goswami, Raju Halder, Soumyadip Bandyopadhyay, Md Tauseef Alam et al.
1 citations
Blockchain Technology Applications and Security
3.25
article

SolGen: Secure Smart Contract Code Generation Using Large Language Models Via Masked Prompting

Sorbajit Goswami, Raju Halder, Soumyadip Bandyopadhyay, Md Tauseef Alam, Khushi Singh, Abyayananda Maiti
article en
1 citations

Abstract

Owing to the swift advancement of technology and the unfamiliarity of the execution environment, the development of Solidity smart contracts from scratch often results in significant vulnerabilities.In contrast, automated code generation enhances productivity, minimizes development time, and enables developers to focus on high-level tasks and fundamental logic.In consideration of these two viewpoints, this paper examines the utilization of large language models (LLMs) for the automatic generation of Solidity smart contracts based on specified criteria, while simultaneously ensuring the elimination of vulnerabilities through a novel masking strategy.To achieve this, we propose SolGen, a framework for generating secure Solidity smart contract code using LLMs.We assess the performance of existing LLMs (i.e.ChatGPT and Meta AI) for secure Solidity code generation.Our research indicates that ChatGPT outperforms Meta AI in performance, yielding a greater percentage of syntactically accurate and secure code.Additionally, we examine the impact of temperature adjustment on the security of generated contracts using an open-source LLM, Llama3.Our findings suggest that a temperature setting of 0.7 is optimal for the generation of Solidity code, considerably exceeding the performance of both lower and higher settings (0.1 and 1.2), especially with regard to the compilability of the code.

Indian Institute of Technology Patna (IN)
Science and Engineering Research Board
Openalex Percentile: Top 10%
Blockchain Technology Applications and Security
3.25
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.