Font Size: a A A

Research On Smart Contract Code Generation Method And Application Based On Code Feature Extension Graph

Posted on:2024-03-07Degree:MasterType:Thesis
Country:ChinaCandidate:Y R DuFull Text:PDF
GTID:2568307058953309Subject:Master of Electronic Information (Professional Degree)
Abstract/Summary:PDF Full Text Request
Nowadays,the proportion of the digital economy in China’s gross domestic product is constantly increasing.China has vigorously supported high-tech related to the digital economy in policies.As a high-tech in the digital economy,blockchain smart contract technology has been widely applied in various daily life fields such as financial transaction services,Io T supply chain traceability,medical big data storage,and so on.With the gradual development of smart contract technology,the demand for the development of smart contracts has also grown rapidly.However,due to the need for developers to have a deep understanding of business logic in the development of smart contracts,technical personnel usually have a low level of understanding of business content.At the same time,the development of smart contracts is still in its early stages,with the fast iteration of syntax versions,and once it’s packed up on the chain,smart contracts cannot be modified,This makes it difficult for business personnel or junior technical personnel to get started.How to improve the development efficiency of smart contracts and reduce the threshold for smart contract development and writing has become an urgent problem that needs to be solved.This article analyzes the current situation of smart contract code generation,studies the difference between source code and ordinary sequential text based on the existing generation methods,combines the relevant technology of code generation in machine translation,and uses other advanced programming language code rapid development methods for reference to solve the above problems of high threshold and low efficiency of smart contract development.The main work of this article is as follows:(1)Build a code feature extension diagram.Source code is different from sequence text and belongs to unstructured data.First,the source code is converted into an abstract syntax tree.Then,data flow and control flow information is added according to the code context and chronological order to generate an abstract code representation diagram.Then,according to ERC-20 interface definition rules,node attribute weights are supplemented to extract the code semantic extension diagram from the source code.(2)Introduce Att+Graph2Seq and integrate the attention mechanism to generate a highly available core function code block for smart contracts.Based on the existing code generation model based on sequence and abstract syntax tree traversal,the Graph2 Seq code generative model based on the attention mechanism is proposed.Based on the correlation between the cost of smart contract packaging and code length,as well as the fast iteration and multi-version characteristics of Solidity programming language,a dataset of different time-effective code versions is used,and automatic and manual evaluation methods are combined to comprehensively evaluate the quality of the generated key function code blocks.(3)Design and implement an online generation system for smart contracts.The system features a display of smart contract generation information,the input of core function code blocks required for smart contract generation,and the ability to perform background verification of user-generated code in real-time,prompt for syntax and logic errors,and assist users in generating smart contract codes.
Keywords/Search Tags:smart contract, code generation, code feature extension diagram, Graph2Seq, ERC-20 standard
PDF Full Text Request
Related items