IEEE Access (Jan 2024)
An Annotation Assisted Smart Contracts Generation Method
Abstract
Smart contracts are rapidly applied in many fields, with their varied types and increasing complexity. A sharp increase in the method development demands seems to be certain. However, this type of development has its unique programming language and security requirements, making it difficult for regular software personnel to adapt quickly. It is important to realize that the development efficiency is application-specific and that getting this application issue solved is critical for its further development. To this end, we propose a new, automatic, and intelligent contract-generation method, based on code annotation. First of all, combined with the semantic annotation information of smart contract code association, a clustering analysis model is built to realize fast and accurate clustering with functions similar to smart contracts. Then, based on the Char-RNN network, a multi-level and automatic generation method of intelligent contract knowledge base is built to realize the automatic generation at different levels, such as the contract layer, function layer, and interface layer. Finally, by using text matching technology and by calculating the semantic similarity of the user text demands as well as the smart contract knowledge base annotation, the relevant contract code is automatically extracted for users to choose, with the aims of improving the method efficiency and to meet the needs of different users. To test the effectiveness of the method, with the aid of bilingual quality assessment BLEU and Mythril, VaaS, and other code security tools for evaluation are used and results are compared with the existing method. The generated code BLEU average score was increased by 27% and the average accuracy was increased by 11.5%. Therefore, the smart contract generated by our method is relatively accurate and reliable.
Keywords