A simplified development method and a simplified development apparatus for a smart contract chain code

By converting natural language into code and generating project packages, the high difficulty of developing and maintaining smart contract chaincode is solved, enabling low-cost and easy-to-use smart contract chaincode management.

CN115454409BActive Publication Date: 2026-04-14SGSG SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SGSG SCI & TECH CO LTD
Filing Date
2022-08-25
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In existing technologies, the development and maintenance of smart contract chaincode require users to have blockchain knowledge and be proficient in the corresponding development language, resulting in high difficulty of use, management, and cost.

Method used

By acquiring natural language input from users, the system converts it into target code using a pre-defined data-code mapping model, and generates source code files and project packages through a packaging model. These are then deployed on a blockchain platform, supporting the invocation and maintenance of natural language, including security vulnerability detection and visual monitoring.

Benefits of technology

It reduces the difficulty of using and managing smart contract chaincode, reduces users' dependence on blockchain platform development languages, and lowers usage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115454409B_ABST
    Figure CN115454409B_ABST
Patent Text Reader

Abstract

The application discloses a simplified development method and device of a smart contract chain code, and is used for reducing the use difficulty, operation and management difficulty and use cost of the smart contract chain code. The method comprises the following steps: obtaining target natural language input by a user according to uplink business data, the target natural language is used for defining target data of a target smart contract contained in a target chain code and defining a target operation mode of the target data, and the target chain code at least contains one target smart contract; mapping the target natural language into target code by calling a preset data-code mapping model; packaging the target code by calling a packaging model to generate a target source code file of the target chain code; packaging the target source code file into a target chain code project package according to a preset project model, the target chain code project package comprising the target source code file and a target configuration file; and deploying the target chain code project package on a blockchain platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a simplified development method and apparatus for smart contract chaincode. Background Technology

[0002] Blockchain is a distributed ledger system based on computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. Smart contracts in blockchain technology are software programs that run on the blockchain platform. The chaincode of a smart contract defines the operations and data format of all blocks.

[0003] With the development of blockchain technology, blockchain platforms offer rich interactive interfaces for development languages ​​such as JAVA, GO, and Node.js. However, in existing technologies, even with rich interfaces, smart contract chaincode still requires users to have blockchain knowledge and be proficient in the corresponding development languages ​​supported by the blockchain platform in order to use or maintain the smart contract chaincode.

[0004] Existing technologies pose a high barrier to the application and maintenance of smart contract chaincode, greatly increasing the difficulty of using, operating and managing, and the cost of using smart contract chaincode. Summary of the Invention

[0005] This application provides a simplified development method and apparatus for smart contract chaincode, which reduces the difficulty of using, managing, and using smart contract chaincode.

[0006] The first aspect of this application provides a simplified development method for smart contract chaincode, including:

[0007] Obtain the target natural language input by the user based on the on-chain business data. The target natural language is used to define the target data of the target smart contract contained in the target chaincode, and to define the target operation mode on the target data. The target chaincode contains at least one target smart contract.

[0008] The target natural language is mapped into target code by invoking a preset data-code mapping model;

[0009] The target code is packaged by calling the packaging model, generating the target source code file of the target chaincode;

[0010] The target source code file is packaged into a target chaincode project package according to a preset project model. The target chaincode project package includes the target source code file and the target configuration file.

[0011] The target chaincode project package is deployed on a blockchain platform so that the blockchain platform can call, maintain, or upgrade the target chaincode through the target chaincode project package.

[0012] Optionally, after packaging the target source code files into a target chaincode project package according to a preset project model, the simplified development method further includes:

[0013] The code rules are used to determine whether the target chaincode project package has security vulnerabilities.

[0014] If a security vulnerability is found, an anomaly report is generated and sent to the administrator.

[0015] Deploying the target chaincode project package on the blockchain platform includes:

[0016] If no security vulnerabilities exist, the target chaincode project package will be deployed on the blockchain platform.

[0017] Optionally, determining whether the target chaincode project package has security vulnerabilities through code rules includes:

[0018] The code rules are used to verify whether the target source code file compiles successfully, whether the target data is complete, and whether there are any issues with the pre-deployment of the target chaincode project package.

[0019] If the target source code compiles successfully, the target data is complete, and the pre-deployment has no problems, then it is determined that the target chaincode project package has no security vulnerabilities.

[0020] If the target source code fails to compile, the target data is incomplete, or the pre-deployment has problems, then the target chaincode project package is determined to have a security vulnerability.

[0021] Optionally, after deploying the target chaincode project package on the blockchain platform, the simplified development method further includes:

[0022] Monitor the deployment and installation status of the target chaincode project package and provide a visual interface to display the deployment and installation status, so that users can determine whether the deployment and installation status is normal through the visual interface.

[0023] Optionally, before deploying the target chaincode project package on the blockchain platform, the simplified development method further includes:

[0024] Determine whether a chaincode project package identical to the target chaincode project package exists on the blockchain platform;

[0025] If it exists, update the storage time of the target chaincode project package;

[0026] Deploying the target chaincode project package on the blockchain platform includes:

[0027] If it does not exist, the target chaincode project package will be deployed on the blockchain platform.

[0028] Optionally, deploying the target chaincode project package on a blockchain platform includes:

[0029] Install the target chaincode project package on each target node on the target channel that needs to run the target chaincode project package;

[0030] Instantiate the target chaincode to generate the Docker image and Docker container for the target channel.

[0031] Optionally, after generating the target source code file of the target smart contract chaincode by packaging the target code using the packaging model, the simplified development method further includes:

[0032] The target hash value of the target source code file is calculated using a hash function.

[0033] The target hash value is uploaded to the blockchain platform so that the target source code file is secure and controllable on the blockchain platform.

[0034] Optionally, the step of mapping the target natural language into target code by invoking a preset data-code mapping model includes:

[0035] The target natural language is converted into a first target field and a second target field, wherein the first target field corresponds to the target data in the target natural language, and the second target field corresponds to the target operation method in the target natural language;

[0036] Generate a first code based on the first target field and the second target field;

[0037] Determine whether the first code is a target code language supported by the blockchain platform;

[0038] If not, the first code is converted into the target code language supported by the blockchain platform through a preset rule engine to generate the target code;

[0039] If so, determine that the first code is the target code.

[0040] A second aspect of this application provides a simplified development apparatus for smart contract chaincode, comprising:

[0041] The acquisition unit is used to acquire the target natural language input by the user based on the on-chain business data. The target natural language is used to define the target data of the target smart contract contained in the target chaincode and to define the target operation mode on the target data. The target chaincode contains at least one target smart contract.

[0042] The mapping unit is used to map the target natural language into target code by calling a preset data-code mapping model;

[0043] The first packaging unit is used to package the target code by calling the packaging model and generate the target source code file of the target chaincode;

[0044] The second packaging unit is used to package the target source code file into a target chaincode project package according to a preset project model. The target chaincode project package includes the target source code file and the target configuration file.

[0045] The deployment unit is used to deploy the target chaincode project package on a blockchain platform, so that the blockchain platform can call, maintain or upgrade the target chaincode through the target chaincode project package.

[0046] Optionally, the simplified development apparatus further includes:

[0047] The first judgment unit is used to determine whether the target chaincode project package has security vulnerabilities based on code rules;

[0048] The sending unit is used to generate an anomaly feedback if a security vulnerability exists, and send the anomaly feedback to the administrator;

[0049] The deployment unit is specifically used for:

[0050] If no security vulnerabilities exist, the target chaincode project package will be deployed on the blockchain platform.

[0051] Optionally, the first judgment unit is specifically used to: verify whether the compilation of the target source code file is successful, verify whether the target data is complete, and verify whether there are any problems with the pre-deployment of the target chaincode project package through code rules;

[0052] If the target source code compiles successfully, the target data is complete, and the pre-deployment has no problems, then it is determined that the target chaincode project package has no security vulnerabilities.

[0053] If the target source code fails to compile, the target data is incomplete, or the pre-deployment has problems, then the target chaincode project package is determined to have a security vulnerability.

[0054] Optionally, the simplified development apparatus further includes:

[0055] The monitoring unit is used to monitor the deployment and installation status of the target chaincode project package and provide a visual interface to display the deployment and installation status, so that users can determine whether the deployment and installation status is normal through the visual interface.

[0056] Optionally, the simplified development apparatus further includes:

[0057] The second judgment unit is used to determine whether there is a chaincode project package on the blockchain platform that is the same as the target chaincode project package;

[0058] An update unit is used to update the storage time of the target chaincode project package if it exists.

[0059] The deployment unit is specifically used to: if the target chaincode project package does not exist, deploy it on the blockchain platform.

[0060] Optionally, the deployment unit is specifically used for:

[0061] Install the target chaincode project package on each target node on the target channel that needs to run the target chaincode project package;

[0062] Instantiate the target chaincode to generate the Docker image and Docker container for the target channel.

[0063] Optionally, the simplified development apparatus further includes:

[0064] A budget unit is used to budget the target hash value of the target source code file using a hash function.

[0065] An upload unit is used to upload the target hash value to the blockchain platform so that the target source code file is secure and controllable on the blockchain platform.

[0066] Optionally, the mapping unit is specifically used for:

[0067] The target natural language is converted into a first target field and a second target field, wherein the first target field corresponds to the target data in the target natural language, and the second target field corresponds to the target operation method in the target natural language;

[0068] Generate a first code based on the first target field and the second target field;

[0069] Determine whether the first code is a target code language supported by the blockchain platform;

[0070] If not, the first code is converted into the target code language supported by the blockchain platform through a preset rule engine to generate the target code;

[0071] If so, determine that the first code is the target code.

[0072] A third aspect of this application provides a simplified development apparatus for smart contract chaincode, the simplified development apparatus comprising:

[0073] Processor, memory, input / output units, and bus;

[0074] The processor is connected to the memory, the input / output unit, and the bus;

[0075] The memory stores a program, which the processor calls to execute a simplified development method for smart contract chaincode, which is an option of the first aspect and any one of the first aspects.

[0076] The fourth aspect of this application provides a computer-readable storage medium storing a program that, when executed on a computer, performs a simplified development method for smart contract chaincode of the first aspect and any one of the first aspects.

[0077] As can be seen from the above technical solution, this application has the following advantages: In this application, the user only needs to input the target natural language based on the on-chain business data. The terminal maps the target natural language into target code by calling a preset data-code mapping model, packages the target code by calling a packaging model, generates the source code file of the target code, and packages the target source code file into a target chaincode project package according to a preset project model. The target chaincode project package is then deployed on the blockchain platform, enabling the blockchain platform to call, maintain, or upgrade the target chaincode through the target chaincode project package. Through this method, users can call and maintain the target chaincode using natural language. Users do not need to be proficient in the corresponding development language supported by the blockchain platform to use or maintain smart contract chaincode, greatly reducing the difficulty of using, managing, and using smart contract chaincode. Attached Figure Description

[0078] To more clearly illustrate the technical solutions in this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0079] Figure 1 A schematic flowchart of an embodiment of a simplified development method for smart contract chaincode provided in this application;

[0080] Figure 2 A schematic flowchart of another embodiment of a simplified development method for smart contract chaincode provided in this application;

[0081] Figure 3 A schematic diagram of an embodiment of a simplified development device for smart contract chaincode provided in this application;

[0082] Figure 4 A schematic diagram of another embodiment of a simplified development device for smart contract chaincode provided in this application;

[0083] Figure 5 A schematic diagram of an embodiment of a simplified development device for smart contract chaincode provided in this application. Detailed Implementation

[0084] This application provides a simplified development method and apparatus for smart contract chaincode, which reduces the difficulty of using, managing, and using smart contract chaincode.

[0085] It should be noted that the simplified development method for smart contract chaincode provided in this application can be applied to terminals as well as servers. For example, the terminal can be a smartphone, computer, tablet, smart TV, smartwatch, portable computer terminal, or a desktop computer, etc. For ease of explanation, this application uses the terminal as the execution subject for illustration.

[0086] Please see Figure 1 , Figure 1 An embodiment of a simplified development method for smart contract chaincode provided in this application includes:

[0087] 101. The terminal obtains the target natural language input by the user based on the on-chain business data. The target natural language is used to define the target data of the target smart contract contained in the target chaincode and to define the target operation method on the target data. The target chaincode contains at least one target smart contract.

[0088] In this embodiment, on-chain business data refers to business data that needs to be reflected in the target smart contract. For example, if the target smart contract is a vehicle transaction smart contract, it must contain business data such as vehicle brand, vehicle model, vehicle identification number, vehicle color, and vehicle price. The user needs to input the target natural language corresponding to the vehicle brand, model, identification number, color, and price. The user also needs to define / select the target operation method for the target data through the target natural language. This target operation method can include data operations such as adding, deleting, querying, modifying, and storing. A single target chaincode can contain multiple target smart contracts; for example, a single target chaincode can contain both a vehicle transaction smart contract and a vehicle insurance smart contract. A smart contract is an executable program that defines logic. A smart contract can only be defined in one chaincode, but multiple smart contracts can be defined in the same chaincode. Once the chaincode is deployed, all smart contracts on that chaincode can be called by applications.

[0089] 102. The terminal maps the target natural language into target code by calling a preset data-code mapping model;

[0090] In this embodiment, after the terminal obtains the target natural language input by the user based on the on-chain business data, the terminal calls the SDK interface of the preset data-code mapping model to map the target natural language into target code. For example, if the on-chain business data corresponding to the target natural language input by the user through the terminal is: vehicle brand, vehicle model, and vehicle identification number, and the target operation method corresponding to the target natural language input by the user is: only add chain data, then the terminal calls the SDK interface of the preset data-code mapping model to map the on-chain business data and target operation corresponding to the target natural language into target code. The specific mapping method will be described in detail in the next embodiment and will not be repeated here.

[0091] 103. The terminal packages the target code by calling the packaging model, generating the target source code file of the target chaincode;

[0092] In this embodiment, the terminal packages the target code by calling the SDK interface of the packaging model, generating the target source code file of the target chaincode. The packaging model is used to compile and package the target code, thereby packaging the target code into a target source code file that can deploy complete target chaincode.

[0093] 104. The terminal packages the target source code files into a target chaincode project package according to the preset project model. The target chaincode project package includes the target source code files and the target configuration file.

[0094] In this embodiment, the target chaincode project package includes target source code files and target configuration files. The target source code files are used to deploy the complete target chaincode, and the target configuration files are used to configure the deployment environment variables of the target chaincode.

[0095] 105. The terminal deploys the target chaincode project package on the blockchain platform so that the blockchain platform can call, maintain or upgrade the target chaincode through the target chaincode project package.

[0096] In this embodiment, the user deploys the target chaincode project package on the blockchain platform through the terminal, so that other users can call, maintain or upgrade the target chaincode through the blockchain platform.

[0097] In this embodiment, the user only needs to input the target natural language through on-chain business data. The terminal maps the target natural language into target code by calling a preset data-code mapping model, packages the target code by calling a packaging model, generates the source code file of the target code, and packages the target source code file into a target chaincode project package according to a preset project model. The target chaincode project package is then deployed on the blockchain platform, enabling the blockchain platform to call, maintain, or upgrade the target chaincode through the target chaincode project package. Through this method, users can call and maintain the target chaincode using natural language. Users do not need to be proficient in the corresponding development language supported by the blockchain platform to use or maintain smart contract chaincode, greatly reducing the difficulty of using, managing, and the cost of smart contract chaincode.

[0098] Please see Figure 2 , Figure 2 An embodiment of a simplified development method for smart contract chaincode provided in this application includes:

[0099] 201. The terminal obtains the target natural language input by the user based on the on-chain business data. The target natural language is used to define the target data of the target smart contract contained in the target chaincode and to define the target operation method on the target data. The target chaincode contains at least one target smart contract.

[0100] Step 201 in this embodiment is the same as described above. Figure 1 Step 101 in the embodiment is similar, and will not be described in detail here.

[0101] 202. The terminal maps the target natural language into the target code by calling a preset data-code mapping model;

[0102] In this embodiment, the terminal maps target natural language to target code by calling the data-code mapping model, including: the terminal calling the SDK interface of the data-code mapping model to convert the target natural language into a first target field and a second target field, where the first target field corresponds to target data in the target natural language and the second target field corresponds to target operation mode in the target natural language; the terminal calling the SDK interface of the data-code mapping model to generate first code based on the first target field and the second target field; the terminal determining whether the first code is a target code language supported by the blockchain platform; if the first code is not a target code language supported by the blockchain platform, the terminal converts the first code into a target code language supported by the blockchain platform through a preset rule engine to generate target code; if the first code is a target code language supported by the blockchain platform, the terminal determines the first code as target code.

[0103] In this embodiment, for example: if the on-chain data corresponding to the target natural language input by the user through the terminal is: vehicle brand, vehicle model and vehicle identification number, and the target operation method corresponding to the target language input by the user is: only add chain data, then the terminal calls the SDK interface of the data-code mapping model to map the on-chain business data corresponding to the target natural language to the first target field: Car(brand(10), type(9), serialNo(8)); and maps the target operation method corresponding to the target natural language to the second target field: add(Car); if the target smart contract is a vehicle transaction smart contract, in the vehicle transaction smart contract, if it is necessary to sell the seller's car to the buyer, it needs to be completed through the vehicle transaction smart contract. The terminal calls the SDK interface of the data-code mapping model to generate the first code: Car according to the first target field, the second target field and the vehicle transaction smart contract. contract; query(Car); get(Car); return(Car); transfer(Car, buyer, seller); get(Car); Car.owner = buyer; put(Car); return(Car); update(Car, properties); get(Car); Car.colour = properties.colour; put(Car); return(Car); The terminal determines whether the first code is a target code language supported by the blockchain platform; Optionally, the blockchain platform can be: Hyperledger Fabric, and the target code languages ​​supported by the blockchain platform can include: java / GO / Node.js, etc.; If the first code is a target code language supported by the blockchain platform, for example: Car.java; then the terminal determines that the first code is the target code.

[0104] 203. The terminal packages the target code by calling the packaging model, generating the target source code file of the target chaincode;

[0105] Step 203 in this embodiment is the same as described above. Figure 1 Step 103 in the embodiment is similar, and will not be described in detail here.

[0106] 204. The terminal calculates the target hash value of the target source code file using a hash function;

[0107] In this embodiment, a hash function extracts a finite-length digital fingerprint from the target source code file as a representative of the target source code file; this digital fingerprint is called the target hash value. That is, the digital digest of the target source code file is calculated using the hash function. The result produced by the hash function is usually smaller than the original data, thus achieving data compression of the target source code file; furthermore, the calculation process of the hash function is irreversible, making it impossible to deduce the target source code file from the target hash value, thereby improving the security of the target source code file. Optionally, the hash function in this embodiment can be MD4, MD5, or a SHA series.

[0108] 205. The terminal uploads the target hash value to the blockchain platform to ensure that the target source code file is secure and controllable on the blockchain platform;

[0109] In this embodiment, the terminal uploads the target hash value to the blockchain platform, enabling the blockchain platform to determine whether the target smart contract on the target chaincode has been tampered with based on the target hash value, thereby ensuring the security and controllability of the target source code file. Verifying the target hash value can guarantee that the target smart contract has not been tampered with. For example, if a target smart contract has N pages, when a user signs the target smart contract, a digital stamp is affixed to each page. If each digital stamp is generated by using a hash algorithm with the content of the previous page and the current page, i.e., the digital stamps of N pages = HASH(N-1 digital stamps + N page content), if the content of the first page is tampered with, then the hash value of the current page will no longer match the digital stamp of the current page. Therefore, the change in the target hash value can be used to determine whether the information of the target smart contract has been tampered with, and it can also be used to locate which page of the target smart contract was tampered with.

[0110] 206. The terminal packages the target source code files into a target chaincode project package according to the preset project model. The target chaincode project package includes the target source code files and the target configuration file.

[0111] Step 206 in this embodiment is the same as described above. Figure 1 Step 104 in the embodiment is similar and will not be described in detail here.

[0112] 207. The terminal determines whether the target chaincode project package has security vulnerabilities through code rules;

[0113] In this embodiment, the terminal determines whether the target chaincode project package has a security vulnerability by using code rules, including: verifying whether the target source code file compiles successfully, verifying whether the target data is complete, and verifying whether there are problems with the pre-deployment of the target chaincode project package; if the target source code compiles successfully, the target data is complete, and there are no problems with the pre-deployment of the target chaincode project package, then the terminal determines that the target chaincode project package does not have a security vulnerability, and the terminal executes step 209; if the target source code fails to compile, the target data is incomplete, or there are problems with the pre-deployment of the target chaincode project package, then the terminal determines that the target chaincode project package has a security vulnerability; the terminal executes step 208.

[0114] 208. If the target chaincode project package has a security vulnerability, the terminal will generate an exception feedback and send the exception feedback to the administrator.

[0115] In this embodiment, if the target chaincode project package has a security vulnerability, the terminal generates an exception feedback and sends the exception feedback to the administrator. The exception feedback contains information corresponding to the security vulnerability, so that the administrator can fix the target chaincode project package according to the security vulnerability.

[0116] 209. If the target chaincode project package does not have any security vulnerabilities, the terminal determines whether there is a chaincode project package identical to the target chaincode project package on the blockchain platform.

[0117] In this embodiment, if the target chaincode project package does not have any security vulnerabilities, the terminal determines whether there is a chaincode project package on the blockchain platform that is the same as the target chaincode project package. If there is a chaincode project package on the blockchain platform that is the same as the target chaincode project package, the terminal executes step 210; if there is no chaincode project package on the blockchain platform that is the same as the target chaincode project package, the terminal executes step 211.

[0118] 210. If a chaincode project package identical to the target chaincode project package exists on the blockchain platform, the terminal updates the storage time of the target chaincode project package.

[0119] In this embodiment, if a chaincode project package identical to the target chaincode project package exists on the blockchain platform, the terminal updates the storage time of the target chaincode project package; if a chaincode project package identical to the target chaincode project package already exists on the blockchain platform, the terminal only updates the storage time of the target chaincode project package, but does not store the target chaincode project package in the blockchain platform. This method avoids storing identical target chaincode project packages in the blockchain platform, thereby preventing data redundancy during collaborative development.

[0120] 211. If there is no chaincode project package identical to the target chaincode project package on the blockchain platform, the terminal will deploy the target chaincode project package on the blockchain platform.

[0121] In this embodiment, if no chaincode project package identical to the target chaincode project package exists on the blockchain platform, the terminal deploys the target chaincode project package on the blockchain platform using the target source code file and the target configuration file. Specifically, the terminal installs the target chaincode project package on each target node on the target channel that needs to run the target chaincode project package; the terminal instantiates the target chaincode, generating a Docker image and a Docker container for the target channel. The target chaincode is the implementation of the target smart contract in the Fabric blockchain network. The target chaincode is deployed on Fabric network nodes, runs in Docker containers, and interacts with the corresponding nodes via the gRPC protocol to manipulate the target data in the target smart contract.

[0122] 212. The terminal monitors the deployment and installation status of the target chaincode project package and provides a visual interface to display the deployment and installation status, so that users can determine whether the deployment and installation status of the target chaincode project package is normal through the visual interface.

[0123] In this embodiment, the terminal monitors the deployment and installation status of the target chaincode project package and provides a visual interface to display the deployment and installation status of the target chaincode project package. This allows users to determine whether the deployment and installation status of the target chaincode project package is normal through the visual interface, thereby enabling users to conveniently observe problems in the deployment and installation process of the target chaincode project package and resolve problems in a timely manner.

[0124] Please see Figure 3 , Figure 3 An embodiment of a simplified development apparatus for smart contract chaincode provided in this application includes:

[0125] The acquisition unit 301 is used to acquire the target natural language input by the user based on the on-chain business data. The target natural language is used to define the target data of the target smart contract contained in the target chaincode and to define the target operation method on the target data. The target chaincode contains at least one target smart contract.

[0126] Mapping unit 302 is used to map target natural language into target code by calling a preset data-code mapping model;

[0127] The first packaging unit 303 is used to package the target code by calling the packaging model and generate the target source code file of the target chain code;

[0128] The second packaging unit 304 is used to package the target source code file into a target chaincode project package according to a preset project model. The target chaincode project package includes the target source code file and the target configuration file.

[0129] Deployment unit 305 is used to deploy the target chaincode project package on the blockchain platform, so that the blockchain platform can call, maintain or upgrade the target chaincode through the target chaincode project package.

[0130] With the simplified development device for smart contract chaincode of this application, users only need to input target natural language based on on-chain business data. The mapping unit 302 maps the target natural language into target code by calling a preset data-code mapping model. The first packaging unit 303 packages the target code by calling a packaging model, generating the source code file of the target code. The second packaging unit 304 packages the target source code file into a target chaincode project package according to a preset project model. The deployment unit 305 deploys the target chaincode project package on the blockchain platform, enabling the blockchain platform to call, maintain, or upgrade the target chaincode through the target chaincode project package. With the simplified development device of this application, users can call and maintain the target chaincode through natural language. Users do not need to be proficient in the corresponding development language supported by the blockchain platform to use or maintain smart contract chaincode, which greatly reduces the difficulty of using, operating and managing, and the cost of using smart contract chaincode.

[0131] The following provides a detailed description of a simplified development device for smart contract chaincode provided in this application. Please refer to [link / reference]. Figure 4 , Figure 4 Another embodiment of a simplified development apparatus for smart contract chaincode provided in this application, the simplified development apparatus comprising:

[0132] The acquisition unit 401 is used to acquire the target natural language input by the user based on the on-chain business data. The target natural language is used to define the target data of the target smart contract contained in the target chaincode and to define the target operation method on the target data. The target chaincode contains at least one target smart contract.

[0133] Mapping unit 402 is used to map target natural language into target code by calling a preset data-code mapping model;

[0134] The first packaging unit 403 is used to package the target code by calling the packaging model and generate the target source code file of the target chain code;

[0135] The second packaging unit 404 is used to package the target source code file into a target chaincode project package according to the preset project model. The target chaincode project package includes the target source code file and the target configuration file.

[0136] Deployment unit 405 is used to deploy the target chaincode project package on the blockchain platform, so that the blockchain platform can call, maintain or upgrade the target chaincode through the target chaincode project package.

[0137] Optionally, the simplified development apparatus also includes:

[0138] The first judgment unit 406 is used to determine whether the target chaincode project package has security vulnerabilities based on code rules;

[0139] The sending unit 407 is used to generate an anomaly feedback if a security vulnerability exists, and send the anomaly feedback to the administrator;

[0140] Deployment unit 405 is specifically used for:

[0141] If no security vulnerabilities are found, the target chaincode project package will be deployed on the blockchain platform.

[0142] Optionally, the first judgment unit 406 is specifically used to: verify whether the target source code file has been compiled successfully, verify whether the target data is complete, and verify whether there are any problems with the pre-deployment of the target chaincode project package;

[0143] If the target source code compiles successfully, the target data is complete, and there are no issues with the pre-deployment, then it is determined that the target chaincode project package does not have any security vulnerabilities.

[0144] If the target source code fails to compile, the target data is incomplete, or there are problems with the pre-deployment, then the target chaincode project package is found to have a security vulnerability.

[0145] Optionally, the simplified development apparatus also includes:

[0146] The monitoring unit 408 is used to monitor the deployment and installation status of the target chaincode project package and provides a visual interface to display the deployment and installation status, so that users can determine whether the deployment and installation status is normal through the visual interface.

[0147] Optionally, the simplified development apparatus also includes:

[0148] The second judgment unit 409 is used to determine whether there is a chaincode project package on the blockchain platform that is the same as the target chaincode project package;

[0149] Update unit 410 is used to update the storage time of the target chaincode project package if it exists;

[0150] Deployment unit 405 is specifically used to: if the target chaincode project package does not exist, deploy it on the blockchain platform.

[0151] Optionally, deployment unit 405 is specifically used for:

[0152] Install the target chaincode package on each target node in the target channel that needs to run the target chaincode package;

[0153] Instantiate the target chaincode to generate the Docker image and Docker container for the target channel.

[0154] Optionally, the simplified development apparatus also includes:

[0155] Budget unit 411 is used to budget the target hash value of the target source code file using a hash function;

[0156] Upload unit 412 is used to upload the target hash value to the blockchain platform so that the target source code file is secure and controllable on the blockchain platform.

[0157] Optionally, the mapping unit 402 is specifically used for:

[0158] The target natural language is transformed into a first target field and a second target field. The first target field corresponds to the target data in the target natural language, and the second target field corresponds to the target operation method in the target natural language.

[0159] Generate the first code based on the first target field and the second target field;

[0160] Determine whether the first code is in a target code language supported by the blockchain platform;

[0161] If not, the first code will be converted into the target code language supported by the blockchain platform through a preset rule engine to generate the target code;

[0162] If so, identify the first code as the target code.

[0163] In this embodiment, the functions of each unit are the same as described above. Figure 2 The steps in the method embodiments shown correspond to those in the examples, and will not be repeated here.

[0164] This application also provides a simplified development apparatus for smart contract chaincode; please refer to [link / reference]. Figure 5 , Figure 5 An embodiment of a simplified development apparatus for smart contract chaincode provided in this application includes:

[0165] Processor 501, memory 502, input / output unit 503, bus 504;

[0166] The processor 501 is connected to the memory 502, the input / output unit 503, and the bus 504;

[0167] The memory 502 stores a program, and the processor 501 calls the program to execute any of the simplified development methods of smart contract chaincode described above.

[0168] This application also relates to a computer-readable storage medium on which a program is stored, which, when run on a computer, causes the computer to execute any of the simplified development methods of smart contract chaincode described above.

[0169] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0170] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0171] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0172] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0173] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A simplified development method for smart contract chaincode, characterized in that, The simplified development method includes: Obtain the target natural language input by the user based on the on-chain business data. The target natural language is used to define the target data of the target smart contract contained in the target chaincode, and to define the target operation mode on the target data. The target chaincode contains at least one target smart contract. The target natural language is converted into a first target field and a second target field, wherein the first target field corresponds to the target data in the target natural language, and the second target field corresponds to the target operation method in the target natural language; Generate a first code based on the first target field and the second target field; Determine whether the first code is a target code language supported by the blockchain platform; If not, the first code is converted into the target code language supported by the blockchain platform through a preset rule engine to generate the target code; If so, determine that the first code is the target code; The target code is packaged by calling the packaging model, generating the target source code file of the target chaincode; The target source code files are packaged into a target chaincode project package according to a preset project model. The code rules are used to determine whether the target chaincode project package has any security vulnerabilities. If a security vulnerability exists, an exception feedback is generated and sent to the administrator. If no security vulnerability exists, the target chaincode project package is deployed on the blockchain platform. The target chaincode project package includes the target source code files and the target configuration file. The target chaincode project package is deployed on a blockchain platform so that the blockchain platform can call, maintain, or upgrade the target chaincode through the target chaincode project package.

2. The simplified development method according to claim 1, characterized in that, The step of determining whether the target chaincode project package has security vulnerabilities through code rules includes: The code rules are used to verify whether the target source code file compiles successfully, whether the target data is complete, and whether there are any issues with the pre-deployment of the target chaincode project package. If the target source code compiles successfully, the target data is complete, and the pre-deployment has no problems, then it is determined that the target chaincode project package has no security vulnerabilities. If the target source code fails to compile, the target data is incomplete, or the pre-deployment has problems, then the target chaincode project package is determined to have a security vulnerability.

3. The simplified development method according to claim 1, characterized in that, After deploying the target chaincode project package on the blockchain platform, the simplified development method further includes: Monitor the deployment and installation status of the target chaincode project package and provide a visual interface to display the deployment and installation status, so that users can determine whether the deployment and installation status is normal through the visual interface.

4. The simplified development method according to claim 1, characterized in that, Prior to deploying the target chaincode project package on the blockchain platform, the simplified development method further includes: Determine whether a chaincode project package identical to the target chaincode project package exists on the blockchain platform; If it exists, update the storage time of the target chaincode project package; Deploying the target chaincode project package on the blockchain platform includes: If it does not exist, the target chaincode project package will be deployed on the blockchain platform.

5. The simplified development method according to claim 4, characterized in that, Deploying the target chaincode project package on a blockchain platform includes: Install the target chaincode project package on each target node on the target channel that needs to run the target chaincode project package; Instantiate the target chaincode to generate the Docker image and Docker container for the target channel.

6. The simplified development method according to any one of claims 1 to 5, characterized in that, After packaging the target code by calling the packaging model to generate the target source code file of the target chaincode, the simplified development method further includes: The target hash value of the target source code file is calculated using a hash function. The target hash value is uploaded to the blockchain platform so that the target source code file is secure and controllable on the blockchain platform.

7. A simplified development apparatus for smart contract chaincode, wherein the simplified development apparatus for smart contract chaincode is used to execute the simplified development method for smart contract chaincode according to claim 1, characterized in that, The device includes: The acquisition unit is used to acquire the target natural language input by the user based on the on-chain business data. The target natural language is used to define the target data of the target smart contract contained in the target chaincode and to define the target operation mode on the target data. The target chaincode contains at least one target smart contract. A mapping unit is configured to convert the target natural language into a first target field and a second target field, wherein the first target field corresponds to the target data in the target natural language and the second target field corresponds to the target operation method in the target natural language; generate first code based on the first target field and the second target field; determine whether the first code is a target code language supported by the blockchain platform; if not, convert the first code into a target code language supported by the blockchain platform through a preset rule engine to generate target code; if yes, determine that the first code is target code. The first packaging unit is used to package the target code by calling the packaging model and generate the target source code file of the target chaincode; The second packaging unit is used to package the target source code file into a target chaincode project package according to a preset project model. The target chaincode project package includes the target source code file and the target configuration file. The deployment unit is used to deploy the target chaincode project package on a blockchain platform, so that the blockchain platform can call, maintain or upgrade the target chaincode through the target chaincode project package.

8. A simplified development device for smart contract chaincode, characterized in that, The simplified development apparatus includes: Processor, memory, input / output units, and bus; The processor is connected to the memory, the input / output unit, and the bus; The memory stores a program, which the processor invokes to perform the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Intelligent contract-oriented code automatic recommendation method and system, computer equipment and storage medium

    CN111309305A

  • Automatic contract deployment method and system

    CN112967011A