Methods and apparatus for generating smart contracts

By generating industry contract templates and configuring user interfaces for enterprises, the problem of enterprises lacking smart contract development capabilities is solved, and the contract parameter configuration and standardized development process are simplified, thereby improving the efficiency of contract development and review.

CN113849167BActive Publication Date: 2026-03-10THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-19
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Enterprises lack the ability to develop smart contracts, which limits the promotion and use of smart contracts. Furthermore, the existing templates have complex parameter settings and limited functionality, increasing the difficulty of review.

Method used

A method and apparatus for generating smart contracts are provided. By generating industry contract templates for different industries and configuring user interfaces for them, users can configure parameters through the interface to generate parameterized contracts.

Benefits of technology

It enables all enterprises to develop smart contracts, simplifies contract parameter configuration, standardizes the contract development process, reduces the difficulty of review, and improves development and review efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113849167B_ABST
    Figure CN113849167B_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for generating smart contracts, relating to the field of computer technology. One specific embodiment of the method includes: receiving a smart contract generation request from a user, the request including an industry identifier; obtaining a corresponding industry contract template from a contract library based on the industry identifier, the industry contract template including a contract template user interface; sending the industry contract template to the user for displaying the industry contract template and receiving configuration parameters input by the user through the contract template user interface; obtaining the configuration parameters sent by the user through the contract template user interface, and generating a parameterized contract based on the configuration parameters and the industry contract template, the parameterized contract including a parameterized contract user interface. This embodiment enables all enterprises to develop smart contracts, and allows for simple, fast, and convenient contract parameter configuration, with a standardized contract development process that facilitates review.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and in particular, to a method and device for generating a smart contract. BACKGROUND

[0002] At present, more and more enterprises need to use smart contracts, but some enterprises do not have the ability to develop smart contracts, thereby affecting the promotion and use of smart contracts. On the other hand, the functions of smart contracts in the same industry are basically the same, and if each enterprise develops by itself, it will cause waste of development resources and auditing resources, and the processing logic of different enterprises is not standardized, which increases the difficulty of auditing the smart contract. In addition, the existing smart contract template parameter setting is too complex and single, and cannot form a contract UI, contract declaration, contract source code and legal documents in a systematic way. Therefore, how to simply, quickly and systematically develop and audit the smart contract is a technical problem to be solved at present. SUMMARY

[0003] Therefore, the embodiments of the present application provide a method and device for generating a smart contract, which can enable all enterprises to develop smart contracts, and can simply, quickly and conveniently configure contract parameters, and the contract development process is standardized, which is beneficial to auditing.

[0004] To achieve the above object, according to an aspect of an embodiment of the present application, a method for generating a smart contract is provided.

[0005] A method for generating a smart contract, comprising:

[0006] receiving a smart contract generation request sent by a user, the request comprising an industry identifier;

[0007] obtaining a corresponding industry contract template from a contract library according to the industry identifier, the industry contract template comprising a contract template user interface;

[0008] sending the industry contract template to the user to display the industry contract template through the contract template user interface and receive configuration parameters input by the user;

[0009] obtaining the configuration parameters sent by the user through the contract template user interface, and generating a parameterized contract according to the configuration parameters and the industry contract template, the parameterized contract comprising a parameterized contract user interface.

[0010] Optionally, the industry contract template is generated by an operating agency according to industry research results, and a basic common business contract processing logic is established for the industry, and the processing logic is parameterized to generate;

[0011] The industry contract template is submitted to a contract library for review after being generated.

[0012] Optionally, the industry contract template further includes a contract legal document template, a contract template source code, and a contract declaration template.

[0013] The parameterized contract further includes a parameterized contract legal document, a parameterized contract source code, and a parameterized contract declaration.

[0014] Optionally, generating the parameterized contract according to the configuration parameters and the industry contract template includes:

[0015] According to the configuration parameters, parameterizing customizable content in the contract legal document template to generate a parameterized contract legal document;

[0016] According to the configuration parameters, parameterizing the contract template user interface using a template technology to generate a parameterized contract user interface;

[0017] According to the configuration parameters, adding code for solidifying the configuration parameters in the contract template source code, and adding logic code and parameter passing code for calling the industry contract template to generate a parameterized contract source code;

[0018] According to the configuration parameters, parameterizing customizable content in the contract declaration template to generate a parameterized contract declaration.

[0019] Optionally, the parameterized contract source code includes three files, namely, a contract itself, a contract input parameter, and a contract output parameter.

[0020] Optionally, the method further includes: packaging the generated parameterized contract and sending the packaged parameterized contract to the contract library; and directly deploying the parameterized contract.

[0021] Optionally, before packaging the generated parameterized contract, the method further includes: generating a fixed configuration file using a templating technology.

[0022] According to another aspect of an embodiment of the present application, a device for generating a smart contract is provided.

[0023] A device for generating a smart contract includes:

[0024] A request receiving module is configured to receive a smart contract generation request sent by a user, the request including an industry identifier;

[0025] A template obtaining module is configured to obtain a corresponding industry contract template from a contract library according to the industry identifier, the industry contract template including a contract template user interface;

[0026] a template display module configured to send the industry contract template to the user to display the industry contract template through the contract template user interface and receive configuration parameters input by the user;

[0027] a contract parameterization module configured to obtain the configuration parameters input by the user through the contract template user interface, and generate a parameterized contract according to the configuration parameters and the industry contract template, the parameterized contract comprising a parameterized contract user interface.

[0028] According to a further aspect of the embodiments of the present application, an electronic device for generating a smart contract is provided.

[0029] An electronic device for generating a smart contract, comprising: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating a smart contract provided by the embodiments of the present application.

[0030] According to a further aspect of the embodiments of the present application, a computer readable medium is provided.

[0031] A computer readable medium having a computer program stored thereon, when the program is executed by a processor, the method for generating a smart contract provided by the embodiments of the present application is implemented.

[0032] The above-mentioned embodiment has the following advantages or beneficial effects: by receiving a smart contract generation request sent by a user, the request comprising an industry identifier; obtaining a corresponding industry contract template from a contract library according to the industry identifier, the industry contract template comprising a contract template user interface; sending the industry contract template to the user to display the industry contract template through the contract template user interface and receive configuration parameters input by the user; obtaining the configuration parameters input by the user through the contract template user interface, and generating a parameterized contract according to the configuration parameters and the industry contract template, the parameterized contract comprising a parameterized contract user interface, the technical scheme, by generating an industry contract template for different industries and configuring a user interface for the industry contract template, the user can configure parameters for the industry contract template through the user interface, and then generate a parameterized contract, so that all enterprises can develop a smart contract, and the contract parameter configuration can be simple, fast, convenient and systematic, and the contract development process is standardized, which is beneficial for auditing. Based on the templating technology, the customizable content in the industry contract template is parameterized according to the configuration parameters of the user to generate a parameterized contract, only simple parameter configuration is required to generate a smart contract, and the contract UI, contract declaration, contract source code and legal documents are configured at one time, which simplifies the generation process of the contract, and the development process of the contract is embodied in the form of a template, which is more standardized, and efficient development and auditing of the contract are realized.

[0033] Further effects of the above-described non-conventional optional mode will be explained in the following in connection with the detailed description. BRIEF DESCRIPTION OF DRAWINGS

[0034] The accompanying drawings are included to provide a further understanding of the application, and are incorporated in and constitute a part of this specification. Among the drawings:

[0035] Figure 1 is a schematic diagram of the main steps of a method for generating a smart contract according to an embodiment of the application;

[0036] Figure 2 is a schematic diagram of the implementation principle of smart contract templating according to an embodiment of the application;

[0037] Figure 3 is a schematic diagram of the generation process of a parameterized contract according to an embodiment of the application;

[0038] Figure 4 is a schematic diagram of the main modules of a device for generating a smart contract according to an embodiment of the application;

[0039] Figure 5 is an exemplary system architecture diagram to which embodiments of the application can be applied;

[0040] Figure 6 is a schematic diagram of the structure of a computer system of a terminal device or server suitable for implementing embodiments of the application. DETAILED DESCRIPTION

[0041] Exemplary embodiments of the present application are described herein below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in the understanding thereof, and should be considered in connection with the following detailed description, and should be considered as merely exemplary. Thus, those skilled in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the application. Also, for the sake of brevity and clarity, descriptions of well-known functions and constructions are omitted herein.

[0042] In order to solve the technical problems existing in the prior art, the present application provides a method and device for generating a smart contract, by generating an industry contract template for different industries, and configuring a user interface for the industry contract template, so that the user can configure parameters for the industry contract template through the user interface, and then generate a parameterized contract, so that all enterprises can develop a smart contract, and the contract parameter configuration can be simple, fast and convenient, and the contract development process is standardized, which is beneficial for auditing.

[0043] Figure 1 is a schematic diagram of the main steps of a method for generating a smart contract according to an embodiment of the application. As Figure 1As shown, the method for generating a smart contract according to the embodiments of the present application mainly includes the following steps S101 to S104.

[0044] Step S101: receiving a smart contract generation request sent by a user, the request including an industry identifier;

[0045] Step S102: obtaining a corresponding industry contract template from a contract library according to the industry identifier, the industry contract template including a contract template user interface;

[0046] Step S103: sending the industry contract template to the user to display the industry contract template through the contract template user interface and receive configuration parameters input by the user;

[0047] Step S104: obtaining the configuration parameters sent by the user through the contract template user interface, and generating a parameterized contract according to the configuration parameters and the industry contract template, the parameterized contract including a parameterized contract user interface.

[0048] In the embodiments of the present application, the industry contract template is generated by an operating agency according to industry research results, and has basic common business contract processing logic for an industry, and is parameterized and generated; and the industry contract template is submitted to a contract library for auditing after being generated. An operating agency or an enterprise with development capability establishes basic common business contract processing logic for an industry according to industry research results, and parameterizes the processing logic, and after determining the parameters, the determined contract logic can be executed, and such a contract is called an industry contract template. The industry contract needs to be submitted to a contract library for manual auditing to ensure that the contract code completely corresponds to the actual business terms and meets the contract requirement specifications. After the auditing, a parameterized contract based on the industry template contract can be configured on a contract configuration platform to meet the requirements of a type of industry for similar functions of a smart contract.

[0049] Users configure contracts parametrically through the contract configuration platform. This platform caters to the personalized contract requirements of merchants or enterprises by parameterizing these requirements based on contract templates, generating parameterized contracts. When contract execution requires loading a new contract, the parameterized contract is invoked first, and then the corresponding contract template from the contract repository is called through the parameterized contract. The contract configuration platform provides convenience for developers, enabling contract development through a user-friendly interface, reducing the learning curve for contract development. Its functions include at least six basic features: contract template download, parameterized contract generation, contract UI (User Interface) generation, parameterized contract declaration generation, legal document generation, and packaging and uploading to the contract repository. For merchants with IT operational capabilities, the contract configuration platform can provide development kits, facilitating their own smart contract development. For merchants without IT operational capabilities, they can choose to customize smart contracts required for their business through a contract configuration platform maintained by an operating organization.

[0050] Figure 2 This is a schematic diagram illustrating the implementation principle of smart contract templates according to an embodiment of the present invention. Figure 2 As shown, businesses / merchants or individual users can configure contracts through the contract configuration platform. Operating organizations or enterprise contract developers with smart contract development capabilities can develop industry contract templates and submit them to the contract repository for manual review before the contract configuration platform can use them. The contract configuration platform, based on the parameters configured by the business / merchant or individual user, calls the industry contract template to generate a parameterized contract, and then automatically deploys the parameterized contract to the contract repository, which is used for storing and managing smart contracts. Additionally, enterprise contract developers with development capabilities can also develop customized contracts according to the needs of their clients and submit these customized contracts to the contract repository for manual review. Only after manual review and approval can they be deployed to the contract repository and put into market operation.

[0051] When generating industry contract templates, prescribed coding standards must be used to ensure the uniformity of the generated smart contracts and facilitate automated deployment. For example, it can be stipulated that the smart contract itself is a Java project, using UTF-8 character encoding, contract naming must adhere to Java CamelCase, and the smart contract is stored as a JAR file, etc. The contract template (in this embodiment, the contract template refers to the industry contract template) is essentially also a smart contract; therefore, the industry contract template typically includes not only the contract template user interface but also: contract legal document templates, contract template source code, and contract declaration templates. That is, the generated contract template must contain the following directories:

[0052] (1) The legal document template corresponding to the contract (e.g., a document in doc format), some parameters of which can be modified and set;

[0053] (2) Contract template source code (e.g., a source code file in src format). The contract template source code should include three Java class files: contract request parameters, contract response parameters, and the contract itself.

[0054] (3) Contract Template User Interface (UI): The H5 interface of the contract template UI. The contract UI operates on the contract presentation layer, providing a direct representation of the contract content. Contract UI development needs to include the ability to interact with smart contract entry points such as the contract user's app and the operating organization's app, and must be compatible with the app's framework structure. The contract template UI directory also contains the logo of the business organization to which the contract belongs; the logo file name is "logo". The contract template UI consists of the following two parts:

[0055] (a) Template Contract UI: Used to configure templates. When customers customize based on the template contract, it provides a graphical configuration service. Some parts of this contract are modifiable.

[0056] (b) Template UI: The template UI corresponds to the template contract UI and is used in the contract configuration platform. The contract configuration platform uses template technologies such as Freemaker to generate a customer-customized contract UI based on the customer's configuration of the template contract UI;

[0057] (4) Contract Declaration Template (e.g., a file in .def format). The contract declaration is presented as a JSON file, representing the textual content of the contract. Based on the client's configuration of the template contract UI, a client-customized contract declaration file is generated. The client's customized parameters correspond one-to-one in the template contract UI, the template UI file, and the contract declaration template file.

[0058] A contract configured on a contract configuration platform based on parameters provided by an industry contract template is called a parameterized contract; it is a configuration instance of the industry contract template. Accordingly, a parameterized contract also includes parameterized contract legal documents, parameterized contract source code, a parameterized contract user interface, and a parameterized contract declaration. In embodiments of this invention, generating a parameterized contract based on configuration parameters and an industry contract template may specifically include the following aspects:

[0059] Based on the configuration parameters, parameterized contract legal documents are generated by parameterizing the customizable content in the contract legal document template.

[0060] Based on the configuration parameters, a parameterized contract user interface is generated by using template technology to parameterize the contract template user interface.

[0061] Based on the configuration parameters, the configuration parameters are added to the contract template source code in the form of code, and logic code for calling the industry contract template is added to generate parameterized contract source code; wherein, the parameterized contract source code includes three files: the contract itself, the contract input parameters, and the contract output parameters;

[0062] Based on the configuration parameters, parameterized contract declarations are generated by parameterizing the customizable content in the contract declaration template.

[0063] Parameterized contracts are generated by the contract configuration platform based on user configurations. Once uploaded to the contract repository, these contracts no longer require manual review and are directly ready for deployment. This type of contract is suitable for merchants without development capabilities. These merchants only need to configure simple parameters on the contract configuration platform, such as discount levels and contract validity periods, to generate the corresponding parameterized contracts for direct deployment and use without manual review.

[0064] Parameterized contracts are smart contracts generated using a contract configuration platform. Based on a contract template, users customize the contract through a UI, storing and solidifying the user-defined parameters in the form of a parameterized contract. When a user uses a customized contract, they must first invoke the parameterized contract, which then invokes the contract template to complete the contract call and execution of the contract logic.

[0065] In an embodiment of the invention, the contract configuration platform is developed by the operating organization. This platform allows users to configure the parameters required for specific contract execution by selecting a contract template. The generated parameterized contract includes: a contract declaration, contract execution source code, contract documents, and an H5 page for the contract. The generated parameterized contract is then packaged into a compressed contract file and uploaded to the contract library for contract management. The contract library can then automatically deploy these parameterized contracts from the contract configuration platform without manual review. This is because industry contract templates have already been approved, so parameterized contracts do not need to be reviewed again, thus saving review procedures and resources. According to one embodiment of the invention, before packaging the generated parameterized contract, a fixed configuration file, pom.xml, needs to be generated using template technology.

[0066] Industry contract templates are developed by the operating organization, defining specific business processing logic for a particular industry and specifying upper and lower limits for parameter configuration. After development, these template contracts must be submitted to the contract library for manual review. Once approved, they can be deployed in operation. To meet merchants' personalized contract requirements, parameterized contracts are generated based on the industry contract templates. When the contract loader loads a contract, it first calls the parameterized contract, which then calls the corresponding industry contract template from the contract library. The parameterized contract depends on the industry contract template, and through parameter control, it controls the execution of the industry contract template's specific operational logic.

[0067] The generation process of the parameterized contract of the present invention will be described below with reference to the accompanying drawings. Figure 3 This is a schematic diagram illustrating the generation process of a parameterized contract according to an embodiment of the present invention. Figure 3 As shown, the generation process of parameterized contracts is mainly as follows:

[0068] (1) Download and extract the contract.

[0069] When a user initiates a smart contract generation request, it first checks the local library for the source code cache of the corresponding industry contract template. If there is no cache, it needs to request the contract library to complete the download and decompression of the industry contract template source code zip package.

[0070] (2) Generate parameterized contract source code

[0071] Based on user-configured parameters, these parameters are stored in the parameterized contract source code. During the parameterized contract generation process, template technologies such as FreeMarker can be used to solidify the parameters into the parameterized contract in the form of code. The generation process produces three Java class files: the contract itself, the contract input parameters, and the contract output parameters. The generation logic of the parameterized contract consists of two parts: first, adding user-defined parameters to the contract template source code in Java code to solidify the parameters; second, adding logic and parameter passing code to call industry contract templates in the contract template source code to pass the parameters to the industry contract template, thus generating the parameterized contract source code.

[0072] (3) Generate parameterized contract declaration

[0073] Based on user-configured parameters, a parameterized contract declaration file is generated using template technology;

[0074] (4) Generate the parameterized contract user interface (UI)

[0075] First, the industry contract template is read to determine if it contains a contract template user interface (UI). If so, the user-configured parameters are used as the data source to read the contract template user interface (UI) file provided in the industry contract template, and template technology is used to generate a parameterized contract user interface (UI).

[0076] (5) Generate parameterized contract legal documents

[0077] Using user-configured parameters as the data source, the customizable content in the legal documents provided in the template contract is solidified to generate parameterized contract legal documents;

[0078] (6) Generate the parameterized contract configuration file (pom.xml file)

[0079] The contract itself is an executable Maven project. When the contract library builds the contract source code into a JAR file, a pom file (configuration file) is essential. The generation process of a parameterized contract pom file can use template technologies such as Freemarker to generate a fixed pom file.

[0080] (7) Upload the contract package

[0081] Once the four files corresponding to the parameterized contract—legal documents, contract source code, contract user interface (UI), and contract declaration—are generated, package these four parts into a zip file and upload it to the contract repository. This completes the generation of the parameterized contract.

[0082] Figure 4 This is a schematic diagram of the main modules of an apparatus for generating smart contracts according to an embodiment of the present invention. Figure 4 As shown, the device 400 for generating smart contracts in this embodiment of the invention mainly includes a request receiving module 401, a template acquisition module 402, a template display module 403, and a contract parameterization module 404.

[0083] The request receiving module 401 is used to receive a smart contract generation request sent by a user, the request including an industry identifier;

[0084] The template acquisition module 402 is used to acquire the corresponding industry contract template from the contract library according to the industry identifier, wherein the industry contract template includes a contract template user interface;

[0085] The template display module 403 is used to send the industry contract template to the user so as to display the industry contract template and receive configuration parameters input by the user through the contract template user interface.

[0086] The contract parameterization module 404 is used to obtain configuration parameters sent by the user through the contract template user interface, and generate a parameterized contract based on the configuration parameters and the industry contract template. The parameterized contract includes a parameterized contract user interface.

[0087] According to one embodiment of the present invention, the industry contract template is generated by the operating organization based on industry research results, establishing basic common business contract processing logic for the industry, and parameterizing the processing logic;

[0088] After the industry contract template is generated, it is submitted to the contract library for review.

[0089] According to another embodiment of the present invention, the industry contract template further includes: a contract legal document template, contract template source code, and a contract declaration template;

[0090] The parameterized contract also includes: parameterized contract legal documents, parameterized contract source code, and parameterized contract declaration.

[0091] According to yet another embodiment of the present invention, the contract parameterization module 404 can also be used for:

[0092] Based on the configuration parameters, parameterized contract legal documents are generated by parameterizing the customizable content in the contract legal document template.

[0093] Based on the configuration parameters, a parameterized contract user interface is generated by using template technology to parameterize the contract template user interface.

[0094] Based on the configuration parameters, add code to the contract template source code to solidify the configuration parameters, and add logic code for calling the industry contract template and parameter passing code to generate parameterized contract source code.

[0095] Based on the configuration parameters, parameterized contract declarations are generated by parameterizing the customizable content in the contract declaration template.

[0096] According to another embodiment of the present invention, the parameterized contract source code includes three files: the contract itself, the contract input parameters, and the contract output parameters.

[0097] According to another embodiment of the present invention, the apparatus 400 for generating smart contracts may further include a contract packaging and deployment module (not shown in the figure), used for:

[0098] The generated parameterized contract is packaged and sent to the contract library;

[0099] And, the parameterized contract can be deployed directly.

[0100] According to another embodiment of the present invention, the contract packaging and deployment module (not shown in the figure) can also be used to generate a fixed configuration file using template technology before packaging the generated parameterized contract.

[0101] According to the technical solution of this invention, a smart contract generation request is received from a user, the request including an industry identifier; a corresponding industry contract template is obtained from a contract library based on the industry identifier, the industry contract template including a contract template user interface; the industry contract template is sent to the user to display the industry contract template and receive configuration parameters input by the user through the contract template user interface; the configuration parameters sent by the user through the contract template user interface are obtained, and a parameterized contract is generated based on the configuration parameters and the industry contract template, the parameterized contract including a parameterized contract user interface. This technical solution generates industry contract templates for different industries and configures user interfaces for the industry contract templates, allowing users to configure parameters of the industry contract templates through the user interface, thereby generating parameterized contracts. This enables all enterprises to develop smart contracts, and allows for simple, fast, and convenient configuration of contract parameters. Furthermore, the contract development process is standardized and facilitates review. Based on template technology, the customizable content in the industry contract template is parameterized according to the user's configuration parameters to generate parameterized contracts. Only simple parameter configuration is required to generate smart contracts. Contract UI, contract declaration, contract source code and legal documents are configured at once, simplifying the contract generation process. Moreover, the contract development process is presented in the form of templates, which is more standardized and enables efficient contract development and review.

[0102] Figure 5 An exemplary system architecture 500 is shown, which can be applied to the method or apparatus for generating smart contracts according to embodiments of the present invention.

[0103] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, and 503, a network 504, and a server 505. Network 504 serves as the medium for providing communication links between terminal devices 501, 502, and 503 and server 505. Network 504 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0104] Users can use terminal devices 501, 502, and 503 to interact with server 505 via network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0105] Terminal devices 501, 502, and 503 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0106] Server 505 can be a server providing various services, such as a backend management server supporting smart contract generation requests sent by users using terminal devices 501, 502, and 503 (for example only). The backend management server can process the received smart contract generation requests and other data by retrieving the corresponding industry contract template from the contract library based on the industry identifier; the industry contract template includes a contract template user interface; sending the industry contract template to the user for display and receiving configuration parameters input by the user through the contract template user interface; obtaining the configuration parameters sent by the user through the contract template user interface; generating a parameterized contract based on the configuration parameters and the industry contract template; and feeding back the processing result (e.g., the generated parameterized contract – for example only) to the terminal device.

[0107] It should be noted that the method for generating smart contracts provided in this embodiment of the invention is generally executed by server 505, and correspondingly, the device for generating smart contracts is generally located in server 505.

[0108] It should be understood that Figure 5 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0109] The following is for reference. Figure 6 It shows a schematic diagram of the structure of a computer system 600 suitable for implementing terminal devices or servers of the present invention. Figure 6 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0110] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 602 or programs loaded from storage section 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the system 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0111] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0112] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by central processing unit (CPU) 601, it performs the functions defined above in the system of this invention.

[0113] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0114] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0115] The units or modules described in the embodiments of the present invention can be implemented in software or hardware. The described units or modules can also be housed in a processor; for example, a processor can be described as including a request receiving module, a template acquisition module, a template display module, and a contract parameterization module. The names of these units or modules do not necessarily limit the specific unit or module itself; for example, a request receiving module can also be described as "a module for receiving smart contract generation requests sent by users."

[0116] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: receiving a smart contract generation request from a user, the request including an industry identifier; obtaining a corresponding industry contract template from a contract library based on the industry identifier, the industry contract template including a contract template user interface; sending the industry contract template to the user for displaying the industry contract template and receiving configuration parameters input by the user through the contract template user interface; obtaining the configuration parameters sent by the user through the contract template user interface, and generating a parameterized contract based on the configuration parameters and the industry contract template, the parameterized contract including a parameterized contract user interface.

[0117] According to the technical solution of this invention, a smart contract generation request is received from a user, the request including an industry identifier; a corresponding industry contract template is obtained from a contract library based on the industry identifier, the industry contract template including a contract template user interface; the industry contract template is sent to the user to display the industry contract template and receive configuration parameters input by the user through the contract template user interface; the configuration parameters sent by the user through the contract template user interface are obtained, and a parameterized contract is generated based on the configuration parameters and the industry contract template, the parameterized contract including a parameterized contract user interface. This technical solution generates industry contract templates for different industries and configures user interfaces for the industry contract templates, allowing users to configure parameters of the industry contract templates through the user interface, thereby generating parameterized contracts. This enables all enterprises to develop smart contracts, and allows for simple, fast, and convenient configuration of contract parameters. Furthermore, the contract development process is standardized and facilitates review. Based on template technology, the customizable content in the industry contract template is parameterized according to the user's configuration parameters to generate parameterized contracts. Only simple parameter configuration is required to generate smart contracts. Contract UI, contract declaration, contract source code and legal documents are configured at once, simplifying the contract generation process. Moreover, the contract development process is presented in the form of templates, which is more standardized and enables efficient contract development and review.

[0118] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method of generating a smart contract, the method comprising: The method comprises the following steps: receiving a smart contract generation request sent by a user, wherein the request comprises an industry identifier; obtaining a corresponding industry contract template from a contract library according to the industry identifier, wherein the industry contract template comprises a contract template user interface, a contract legal document template, a contract template source code and a contract declaration template; sending the industry contract template to the user to display the industry contract template through the contract template user interface and receive configuration parameters input by the user; obtaining the configuration parameters sent by the user through the contract template user interface, and generating a parameterized contract according to the configuration parameters and the industry contract template, wherein the parameterized contract comprises a parameterized contract user interface, a parameterized contract legal document, a parameterized contract source code and a parameterized contract declaration; generating the parameterized contract according to the configuration parameters and the industry contract template comprises: parameterizing the customizable content in the contract legal document template according to the configuration parameters to generate the parameterized contract legal document; parameterizing the contract template user interface according to the configuration parameters by using a template technology to generate the parameterized contract user interface; adding the configuration parameters in the form of code to the contract template source code according to the configuration parameters, and adding a logic code for calling the industry contract template to generate the parameterized contract source code; and parameterizing the customizable content in the contract declaration template according to the configuration parameters to generate the parameterized contract declaration; packing the generated parameterized contract and sending it to the contract library; and when a contract loader loads a contract, the parameterized contract is called first, the corresponding industry contract template of the contract library is called through the parameterized contract, the parameterized contract depends on the industry contract template, and the industry contract template is controlled by the parameterized contract to execute specific running logic in a parameter control manner.

2. The method of claim 1, wherein, The industry contract template is generated by an operating institution according to an industry research result, and a business contract processing logic with basic commonality is established for an industry, and the processing logic is parameterized to generate the industry contract template; After the industry contract template is generated, it is submitted to the contract library for auditing.

3. The method of claim 1, wherein, The parameterized contract source code comprises three files, i.e., a contract itself, contract input parameters and contract output parameters.

4. The method of claim 1, wherein, Before the generated parameterized contract is packed, the following step is further included: generating a fixed configuration file by using a templating technology.

5. An apparatus for generating a smart contract, the apparatus comprising: The method comprises the following steps: a request receiving module is configured to receive a smart contract generation request sent by a user, wherein the request comprises an industry identifier; a template obtaining module is configured to obtain a corresponding industry contract template from a contract library according to the industry identifier, wherein the industry contract template comprises a contract template user interface, a contract legal document template, a contract template source code and a contract declaration template; a template display module is configured to send the industry contract template to the user to display the industry contract template through the contract template user interface and receive configuration parameters input by the user; The contract parameterization module is configured to obtain configuration parameters sent by a user through the contract template user interface, and generate a parameterized contract according to the configuration parameters and the industry contract template, wherein the parameterized contract comprises a parameterized contract user interface, a parameterized contract legal document, a parameterized contract source code and a parameterized contract declaration. The contract parameterization module is further configured to: parameterize customizable content in the contract legal document template according to the configuration parameters to generate a parameterized contract legal document; parameterize the contract template user interface according to the configuration parameters by using a template technology to generate a parameterized contract user interface; add code for solidifying the configuration parameters in the contract template source code according to the configuration parameters, and add logic code and parameter passing code for calling the industry contract template to generate a parameterized contract source code; and parameterize customizable content in the contract declaration template according to the configuration parameters to generate a parameterized contract declaration. The contract packaging and deployment module is configured to: package the generated parameterized contract and send the parameterized contract to a contract library; and when a contract loader loads a contract, first call the parameterized contract, call the industry contract template corresponding to the contract library through the parameterized contract, and parameterize the contract according to the industry contract template, so that the parameterized contract controls the industry contract template to execute specific operation logic in a parameter control manner. 6.An electronic device that generates a smart contract, comprising: Comprise: One or more processors; Storage means for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1-4.

7. A computer readable medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the method of any one of claims 1-4.

Citation Information

Patent Citations

  • Data processing method and device for generating smart contract

    CN112015399A