WO2021239074A1 - Smart contract code generation method, program, and device - Google Patents

Smart contract code generation method, program, and device Download PDF

Info

Publication number
WO2021239074A1
WO2021239074A1 PCT/CN2021/096522 CN2021096522W WO2021239074A1 WO 2021239074 A1 WO2021239074 A1 WO 2021239074A1 CN 2021096522 W CN2021096522 W CN 2021096522W WO 2021239074 A1 WO2021239074 A1 WO 2021239074A1
Authority
WO
WIPO (PCT)
Prior art keywords
data table
business
data
field
template
Prior art date
Application number
PCT/CN2021/096522
Other languages
French (fr)
Chinese (zh)
Inventor
杨文龙
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2021239074A1 publication Critical patent/WO2021239074A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design

Definitions

  • the embodiments of this specification relate to the field of information technology, and in particular to a method, program, and device for generating smart contract code.
  • business parties In the field of blockchain technology, business parties usually deploy smart contracts in the blockchain network to achieve business. Generally speaking, business parties usually develop smart contract codes based on the actual situation of their business, which often means a lot of work.
  • a method for generating smart contract code which is applied to an automated contract program.
  • the method includes: providing a set of data table templates to a business party; wherein, the set of data table templates includes the first A data table template.
  • the first data table template includes a feature name field, a feature type field, and a feature description field, and is used to configure a storage method for the business data submitted to the blockchain by the business party; receiving the business direction At least one set of entry parameters entered in the first data table template; wherein, each set of entry parameters entered in the first data table template includes a one-to-one correspondence with each field of the first data table template Value; According to preset template parsing rules, the data table template set after the entry parameters are entered is parsed into smart contract code, which is provided to the business party.
  • an automated contract program including: a template providing module, which provides a data table template set to a business party; wherein the data table template set includes a first data table template, and the first data table template A data table template includes a feature name field, a feature type field, and a feature description field, which are used to configure the storage method of the business data submitted to the blockchain by the business party; the first parameter receiving module receives the business direction At least one set of entry parameters entered in the first data table template; wherein each set of entry parameters entered in the first data table template includes field values corresponding to each field of the first data table template on a one-to-one basis;
  • the template analysis module parses the set of data table templates after the entry parameters are input into smart contract codes according to preset template analysis rules, and provides them to the business party.
  • the technical solutions provided in the embodiments of this specification develop an automated contract program for the business party to use.
  • the automated contract program can provide the business party with a data table template so that the business party can configure the business data storage method according to its own needs, and then ,
  • the automated contract program can automatically generate smart contract code according to the business side’s configuration.
  • a data table template can be developed for this general demand , So that different business parties can use the data table template to configure the storage mode of business data, instead of writing this part of the smart contract code, saving workload and improving efficiency.
  • any one of the embodiments of the present specification does not need to achieve all the above-mentioned effects.
  • FIG. 1 is a schematic flowchart of a method for generating smart contract code provided by an embodiment of this specification
  • Figure 2 is a schematic diagram of the software structure of an automated contract program provided by an embodiment of this specification
  • Fig. 3 is a schematic structural diagram of a device for configuring the method of the embodiment of this specification.
  • the main application scenario of the blockchain is data storage, and the data stored in the blockchain cannot be tampered with. Therefore, at present, almost all business parties will store at least part of their business data in the blockchain when they conduct business with the help of the blockchain.
  • the program automatically parses the data table template configured by the business party into a smart contract code and returns it to the business party, so the business party does not need to develop this part of the code.
  • Fig. 1 is a schematic flow chart of a method for generating smart contract codes provided by an embodiment of this specification, which includes the following steps: S100: Provide a set of data table templates to a business party.
  • the subject of execution of this plan is the automated contract program, and the business party can install the automated contract program on its own computer equipment (such as computers, mobile phones, and tablets) for use.
  • its own computer equipment such as computers, mobile phones, and tablets
  • the automated contract program has a built-in data table template collection (including at least one data table template).
  • the automated contract program can provide a visual interface to the business party, display the data table template collection to the business party, and prompt the business party to Fill in the data sheet template.
  • the business party can select one of the data table templates to fill in, or select all the data table templates to fill in.
  • the data table template set includes at least a first data table template.
  • the first data table template includes a feature name field, a feature type field, and a feature description field, and is used to configure the The storage method of the business data of the blockchain.
  • the first data table template may also include more other fields.
  • S102 Receive at least one set of entry parameters input by the business direction in the first data table template.
  • Table 1 exemplarily gives a first data table template:
  • Table 2 exemplarily shows another first data table template:
  • the business party can select a blank entry in the first data table template for input, and each blank entry is used to configure the storage of the characteristics of a certain dimension of the business data.
  • Table 1 For Table 1, a number of blank entries have been reserved for the business side to input. For Table 2, the business side can manually add blank entries before inputting.
  • the "input” mentioned in this article refers to the way the business party fills in the first data sheet template, which can be to enter the field value, or the voice input field value, or in the drop-down menu corresponding to each blank cell Select the field value.
  • each set of entry parameters input to the first data table template includes a field value corresponding to each field of the first data table template, which is used to characterize the dimension of the business data submitted by the business party.
  • Feature name, feature type, and feature description is used to characterize the dimension of the business data submitted by the business party.
  • the first data table template can be configured as follows:
  • table refers to the entire order data, which can be regarded as the table identifier of Table 3, which is the order data of the artwork, so the feature type is the artwork (Art).
  • Art id refers to the identification of the artwork in the order data
  • art size refers to the size of the artwork
  • art type refers to the type of artwork (such as painting, sculpture)
  • art owner refers to the owner of the artwork.
  • the automated contract program can complete the configuration of the first data table according to the preset template parsing rules
  • the template is parsed into smart contract code and provided to the business party.
  • the transaction calls the smart contract code, and based on the smart contract code, the business data is defined by the user through the first data table template Storage method for storage.
  • an automated contract program is developed for the business side to use.
  • the automated contract program can provide the business side with a data sheet template, so that the business side can configure the business data storage method according to their own needs, and then automate
  • the contract program can automatically generate smart contract code according to the configuration of the business party.
  • a data table template can be developed for this general demand , So that different business parties can use the data table template to configure the storage mode of business data, instead of writing this part of the smart contract code, saving workload and improving efficiency.
  • the first data table template may also include a function field for configuring at least one of the preset function sets for the business data submitted to the blockchain. For example, see Table 4:
  • the preset function set is preset in the automated contract program and provides several preset functions.
  • the business party can select one or more preset functions when configuring the first data table template, and then the contract code generated by the automated contract program is also included The code corresponding to the preset function selected by the business party will also be included.
  • the preset function set may include at least one of the following functions: an authority control function, which is used to control access authority to business data; a log function, which is used to generate an operation log for business data; a traceability function, which uses Each business transaction containing business data submitted to the blockchain by the retrospective business party; the data display function is used to output and display business data in a specified display scheme; the trigger effective function is used to set the storage mode configured by the business party The effective time for storing business data.
  • an authority control function which is used to control access authority to business data
  • a log function which is used to generate an operation log for business data
  • a traceability function which uses Each business transaction containing business data submitted to the blockchain by the retrospective business party
  • the data display function is used to output and display business data in a specified display scheme
  • the trigger effective function is used to set the storage mode configured by the business party The effective time for storing business data.
  • the preset functions are generally configured with the overall business data as the granularity. Therefore, as shown in Table 3, usually only the first entry contains the field values of the preset functions, for example, see Table 5:
  • the data table template set may also include a second data table template, and the second data table template includes a feature name field and an operation method field, which are used to configure the The operation mode of the business data of the blockchain.
  • At least one set of entry parameters entered by the business direction in the second data table template can be received; wherein, adding to the second data table template
  • Each set of input parameters includes field values corresponding to each field of the second data table template one-to-one.
  • the field value corresponding to the operation method field includes at least one of the following:
  • the field value used to characterize the data insertion operation (such as insert);
  • Field values used to characterize data query operations (such as query);
  • the field value used to characterize the data deletion operation (such as delete).
  • the business party can submit a transaction encapsulated with business data to the blockchain network in order to call the smart contract code to store the business data in a "pre-defined storage method by the business party through the first data table template"
  • the business party can also initiate an operation transaction to the blockchain network in order to call the smart contract code to insert, modify, query, delete and other operations on the stored business data (business Party through the pre-defined operation mode of the second data table template).
  • Table 6 exemplarily shows a second data table template:
  • the second data table template may also be as shown in Table 7:
  • Associated table fields Feature name field Operation method field To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To To
  • the associated table field may record the table identifier of the first data table template that has been configured.
  • the configured second data table template may be:
  • Associated table fields Feature name field Operation method field table art id, artsize insert To art owner update To art id query To art id Delete
  • An optional implementation manner is to generate a database schema description corresponding to the set of data table templates after input item parameters, and determine the smart contract code based on the schema description.
  • the automated contract program can analyze the structured data (that is, the data in the data table) according to the schema description, generate the code for calling the structured data interface, and then generate the code for calling the method of the interface.
  • the operation methods configured by the business party can be used to call these interfaces to obtain data and perform operations.
  • the automated contract program can also generate a test framework based on the set of data table templates after the entry parameters are entered and provided to the business party for testing the smart contract code. In this way, the business party There is no need to develop a test framework by yourself.
  • FIG. 2 is a schematic diagram of the software structure of an automated contract program provided by an embodiment of this specification, including: a template providing module 201, which provides a data table template set to the business party; wherein the data table template set includes a first data table template, The first data table template includes a feature name field, a feature type field, and a feature description field, which are used to configure the storage method of the business data submitted to the blockchain by the business party; the first parameter receiving module 202 receives the The business direction at least one set of entry parameters entered in the first data table template; wherein, each set of entry parameters entered in the first data table template includes a one-to-one correspondence with each field of the first data table template.
  • the field value of the template analysis module 203 according to the preset template analysis rules, parse the data table template set after the entry parameters are input into smart contract code, and provide it to the business party.
  • the first data table template further includes a function field for configuring at least one of the preset function sets for the business data submitted to the blockchain.
  • the preset function set includes the following functions: permission control function, used to control access permissions for business data; log function, used to generate operation logs for business data; traceability function, used to trace the business party submitted to the blockchain Each business transaction that contains business data; data display function, used to display business data output and display in a specified display plan; trigger effective function, used to set the effective time for storing business data in the storage mode configured by the business party .
  • the set of data table templates further includes a second data table template, the second data table template includes a feature name field and an operating device field, and is used to configure an operation mode for the business data submitted to the blockchain by the business party;
  • the device further includes: a second parameter receiving module 204, which receives the input from the business direction in the second data table template before the template analysis module parses the data table template after the entry parameters are entered into smart contract code At least one set of entry parameters; wherein, each set of entry parameters input to the second data table template includes field values corresponding to each field of the second data table template one-to-one.
  • the template analysis module 203 generates a database schema description corresponding to the set of data table templates after the entry parameters are input, and determines the smart contract code based on the schema description.
  • the automated contract program further includes: a framework generation module 205, which generates a test framework based on the set of data table templates after inputting item parameters and provides it to the business party for testing the smart contract code.
  • the embodiments of this specification also provide a computer device, which includes at least a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the method shown in FIG. 1 when the program is executed. .
  • FIG. 3 shows a more specific hardware structure diagram of a computing device provided by an embodiment of this specification.
  • the device may include a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050.
  • the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040 realize the communication connection between each other in the device through the bus 1050.
  • the processor 1010 may be implemented by a general CPU (Central Processing Unit, central processing unit), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits for execution related Program to realize the technical solutions provided in the embodiments of this specification.
  • a general CPU Central Processing Unit, central processing unit
  • a microprocessor an application specific integrated circuit (Application Specific Integrated Circuit, ASIC)
  • ASIC Application Specific Integrated Circuit
  • the memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory, random access memory), static storage device, dynamic storage device, etc.
  • the memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, related program codes are stored in the memory 1020 and called and executed by the processor 1010.
  • the input/output interface 1030 is used to connect an input/output module to realize information input and output.
  • the input/output/module can be configured in the device as a component (not shown in the figure), or can be connected to the device to provide corresponding functions.
  • the input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and an output device may include a display, a speaker, a vibrator, an indicator light, and the like.
  • the communication interface 1040 is used to connect a communication module (not shown in the figure) to realize the communication interaction between the device and other devices.
  • the communication module can realize communication through wired means (such as USB, network cable, etc.), or through wireless means (such as mobile network, WIFI, Bluetooth, etc.).
  • the bus 1050 includes a path for transmitting information between various components of the device (for example, the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040).
  • the above device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include the necessary equipment for normal operation. Other components.
  • the above-mentioned device may also include only the components necessary to implement the solutions of the embodiments of the present specification, and not necessarily include all the components shown in the figures.
  • the embodiment of the present specification also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method shown in FIG. 1 is implemented.
  • Computer-readable media includes permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology.
  • the information can be computer-readable instructions, data structures, program modules, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • a typical implementation device is a computer.
  • the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
  • the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments.
  • the description is relatively simple, and the relevant parts can be referred to the part of the description of the method embodiment.
  • the device embodiments described above are merely illustrative, and the modules described as separate components may or may not be physically separated.
  • the functions of the modules can be combined in the same way when implementing the solutions of the embodiments of this specification. Or multiple software and/or hardware implementations. It is also possible to select some or all of the modules according to actual needs to achieve the objectives of the solutions of the embodiments. Those of ordinary skill in the art can understand and implement without creative work.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

A smart contract code generation method, a program, and a device. A data table template can be provided to a service provider, such that the service provider configures a service data storage scheme according to their own needs, and smart contract code is automatically generated according to the configuration of the service provider.

Description

一种智能合约代码的生成方法、程序及设备Method, program and equipment for generating smart contract code 技术领域Technical field
本说明书实施例涉及信息技术领域,尤其涉及一种智能合约代码的生成方法、程序及设备。The embodiments of this specification relate to the field of information technology, and in particular to a method, program, and device for generating smart contract code.
背景技术Background technique
在区块链技术领域,业务方通常会在区块链网络中部署智能合约来实现业务。一般而言,业务方通常会基于自己业务的实际情况来开发智能合约代码,这往往意味着不小的工作量。In the field of blockchain technology, business parties usually deploy smart contracts in the blockchain network to achieve business. Generally speaking, business parties usually develop smart contract codes based on the actual situation of their business, which often means a lot of work.
此外,开发智能合约代码要求一定的技术门槛,技术水平较低的业务方开发智能合约代码的效率较低。In addition, the development of smart contract codes requires a certain technical threshold, and business parties with lower technical levels are less efficient in developing smart contract codes.
发明内容Summary of the invention
为了解决现有的智能合约代码的开发方法存在的工作量大且效率低的问题,本说明书实施例提供一种智能合约代码的生成方法、程序及设备,方案如下:In order to solve the problems of large workload and low efficiency in the existing smart contract code development methods, the embodiments of this specification provide a smart contract code generation method, program, and equipment. The solutions are as follows:
根据本说明书实施例的第1方面,提供一种智能合约代码生成的方法,应用于自动化合约程序,所述方法包括:向业务方提供数据表模板集合;其中,所述数据表模板集合包括第一数据表模板,所述第一数据表模板包括特征名称字段、特征类型字段与特征描述字段,用于配置针对所述业务方提交给区块链的业务数据的存储方式;接收所述业务方向所述第一数据表模板中输入的至少一组条目参数;其中,向所述第一数据表模板中输入的每组条目参数包括与所述第一数据表模板的各字段一一对应的字段值;根据预置的模板解析规则,将输入条目参数后的所述数据表模板集合解析成智能合约代码,提供给所述业务方。According to the first aspect of the embodiments of the present specification, there is provided a method for generating smart contract code, which is applied to an automated contract program. The method includes: providing a set of data table templates to a business party; wherein, the set of data table templates includes the first A data table template. The first data table template includes a feature name field, a feature type field, and a feature description field, and is used to configure a storage method for the business data submitted to the blockchain by the business party; receiving the business direction At least one set of entry parameters entered in the first data table template; wherein, each set of entry parameters entered in the first data table template includes a one-to-one correspondence with each field of the first data table template Value; According to preset template parsing rules, the data table template set after the entry parameters are entered is parsed into smart contract code, which is provided to the business party.
根据本说明书实施例的第2方面,提供一种自动化合约程序,包括:模板提供模块,向业务方提供数据表模板集合;其中,所述数据表模板集合包括第一数据表模板,所述第一数据表模板包括特征名称字段、特征类型字段与特征描述字段,用于配置针对所述业务方提交给区块链的业务数据的存储方式;第一参数接收模块,接收所述业务方向所述第一数据表模板中输入的至少一组条目参数;其中,向所述第一数据表模板中输入的每组条目参数包括与所述第一数据表模板的各字段一一对应的字段值;模板解析模块,根据预置的模板解析规则,将输入条目参数后的所述数据表模板集合解析成智能合约代码,提供给所述业务方。According to the second aspect of the embodiments of the present specification, an automated contract program is provided, including: a template providing module, which provides a data table template set to a business party; wherein the data table template set includes a first data table template, and the first data table template A data table template includes a feature name field, a feature type field, and a feature description field, which are used to configure the storage method of the business data submitted to the blockchain by the business party; the first parameter receiving module receives the business direction At least one set of entry parameters entered in the first data table template; wherein each set of entry parameters entered in the first data table template includes field values corresponding to each field of the first data table template on a one-to-one basis; The template analysis module parses the set of data table templates after the entry parameters are input into smart contract codes according to preset template analysis rules, and provides them to the business party.
本说明书实施例所提供的技术方案,开发一款自动化合约程序提供给业务方使用,自动化合约程序可以向业务方提供数据表模板,以便业务方根据自己的需求对业务数据存储方式进行配置,然后,自动化合约程序可以根据业务方的配置自动生成智能合约代码。通过本说明书实施例,由于不同的业务方往往都存在区块链存储业务数据的需求,而存储业务数据的需求往往可以用数据表来进行配置,因此,可以针对这种通用需求开发数据表模板,让不同的业务方可以使用数据表模板来进行业务数据的存储方式的配置,而不用再编写这部分智能合约代码,节省了工作量,提升了效率。The technical solutions provided in the embodiments of this specification develop an automated contract program for the business party to use. The automated contract program can provide the business party with a data table template so that the business party can configure the business data storage method according to its own needs, and then , The automated contract program can automatically generate smart contract code according to the business side’s configuration. Through the embodiments of this specification, because different business parties often have requirements for storing business data on the blockchain, and the requirements for storing business data can often be configured with data tables, a data table template can be developed for this general demand , So that different business parties can use the data table template to configure the storage mode of business data, instead of writing this part of the smart contract code, saving workload and improving efficiency.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本说明书实施例。It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the embodiments of this specification.
此外,本说明书实施例中的任一实施例并不需要达到上述的全部效果。In addition, any one of the embodiments of the present specification does not need to achieve all the above-mentioned effects.
附图说明Description of the drawings
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of this specification or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some of the embodiments described in the embodiments of this specification. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
图1是本说明书实施例提供的一种智能合约代码生成的方法的流程示意图;FIG. 1 is a schematic flowchart of a method for generating smart contract code provided by an embodiment of this specification;
图2是本说明书实施例提供的一种自动化合约程序的软件结构示意图;Figure 2 is a schematic diagram of the software structure of an automated contract program provided by an embodiment of this specification;
图3是用于配置本说明书实施例方法的一种设备的结构示意图。Fig. 3 is a schematic structural diagram of a device for configuring the method of the embodiment of this specification.
具体实施方式Detailed ways
众所周知,区块链的主要应用场景是数据存证,存证到区块链中的数据具有不可篡改性。因此,目前几乎所有的业务方在借助区块链开展业务时,都会将至少部分业务数据存储到区块链中。As we all know, the main application scenario of the blockchain is data storage, and the data stored in the blockchain cannot be tampered with. Therefore, at present, almost all business parties will store at least part of their business data in the blockchain when they conduct business with the help of the blockchain.
也就是说,对几乎所有的业务方而言,虽然实际业务千差万别,但是都存在存储业务数据这一通用需求,然而,每个业务方在开发智能合约代码时,都需要自己开发有关业务数据存储方式的代码。In other words, for almost all business parties, although the actual business is very different, there is a general requirement for storing business data. However, each business party needs to develop its own business data storage when developing smart contract code. Way of code.
在本说明书的一个或多个实施例中,一方面考虑到可以将业务数据存储这种通用需求提 炼出来,另一方面考虑到数据存储方式的配置可以通过结构化的数据表来体现,因此,开发一种自动化合约程序(或称自动化合约工具)提供给不同的业务方使用,自动化合约程序内置有数据表模板,业务方可以填写数据表模板,完成对于业务数据存储方式的配置,然后自动化合约程序根据预置的模板解析规则,自动将业务方配置完毕的数据表模板解析成智能合约代码返回给业务方,业务方也就不需要再开发这部分代码了。In one or more embodiments of this specification, on the one hand, it is considered that the general requirement of business data storage can be refined, and on the other hand, it is considered that the configuration of the data storage mode can be reflected in a structured data table. Therefore, Develop an automated contract program (or automated contract tool) for use by different business parties. The automated contract program has a built-in data sheet template. The business party can fill in the data sheet template, complete the configuration of the business data storage method, and then automate the contract According to the preset template parsing rules, the program automatically parses the data table template configured by the business party into a smart contract code and returns it to the business party, so the business party does not need to develop this part of the code.
以下结合附图,详细说明本说明书各实施例提供的技术方案。The technical solutions provided by the embodiments of this specification will be described in detail below with reference to the accompanying drawings.
图1是本说明书实施例提供的一种智能合约代码生成的方法的流程示意图,包括以下步骤:S100:向业务方提供数据表模板集合。Fig. 1 is a schematic flow chart of a method for generating smart contract codes provided by an embodiment of this specification, which includes the following steps: S100: Provide a set of data table templates to a business party.
本方案的执行主体是自动化合约程序,业务方可以将自动化合约程序安装在自己的计算机设备(如电脑、手机、平板电脑)上进行使用。The subject of execution of this plan is the automated contract program, and the business party can install the automated contract program on its own computer equipment (such as computers, mobile phones, and tablets) for use.
自动化合约程序中内置有数据表模板集合(包括至少一个数据表模板),自动化合约程序可以向业务方提供可视化界面,将数据表模板集合展示给业务方,提示业务方对数据表模板集合中的数据表模板进行填写。The automated contract program has a built-in data table template collection (including at least one data table template). The automated contract program can provide a visual interface to the business party, display the data table template collection to the business party, and prompt the business party to Fill in the data sheet template.
当数据表模板集合中包括不止一个数据表模板时,业务方可以选择其中一个数据表模板进行填写,也可以选择全部的数据表模板进行填写。When the data table template collection includes more than one data table template, the business party can select one of the data table templates to fill in, or select all the data table templates to fill in.
在本说明书实施例中,数据表模板集合中至少包括第一数据表模板,所述第一数据表模板包括特征名称字段、特征类型字段与特征描述字段,用于配置针对所述业务方提交给区块链的业务数据的存储方式。In the embodiment of this specification, the data table template set includes at least a first data table template. The first data table template includes a feature name field, a feature type field, and a feature description field, and is used to configure the The storage method of the business data of the blockchain.
当然,后文将会进一步提及,所述第一数据表模板还可以包括更多的其他字段。Of course, as will be further mentioned later, the first data table template may also include more other fields.
S102:接收所述业务方向所述第一数据表模板中输入的至少一组条目参数。S102: Receive at least one set of entry parameters input by the business direction in the first data table template.
表1示例性地给出了一种第一数据表模板:Table 1 exemplarily gives a first data table template:
特征名称字段Feature name field 特征类型字段Feature Type Field 特征描述字段Feature description field
 To  To  To
 To  To  To
 To  To  To
表1Table 1
表2示例性地给出了另一种第一数据表模板:Table 2 exemplarily shows another first data table template:
特征名称字段Feature name field 特征类型字段Feature Type Field 特征描述字段Feature description field
表2Table 2
业务方可以选择第一数据表模板中的一个空白条目进行输入,每个空白条目用于配置对业务数据的某一个维度的特征进行存储。The business party can select a blank entry in the first data table template for input, and each blank entry is used to configure the storage of the characteristics of a certain dimension of the business data.
对于表1,已经预留了若干空白条目供业务方输入,对于表2,业务方可以手动增加空白条目后再进行输入。For Table 1, a number of blank entries have been reserved for the business side to input. For Table 2, the business side can manually add blank entries before inputting.
本文所述的“输入”,是指业务方填写第一数据表模板的方式,其具体可以是键入字段值,也可以是语音输入字段值,还可以是在每个空白单元格对应的下拉菜单中选择字段值。The "input" mentioned in this article refers to the way the business party fills in the first data sheet template, which can be to enter the field value, or the voice input field value, or in the drop-down menu corresponding to each blank cell Select the field value.
总之,向所述第一数据表模板中输入的每组条目参数包括与所述第一数据表模板的各字段一一对应的字段值,用于表征业务方提交的业务数据的该维度下的特征名称、特征类型以及特征描述。In short, each set of entry parameters input to the first data table template includes a field value corresponding to each field of the first data table template, which is used to characterize the dimension of the business data submitted by the business party. Feature name, feature type, and feature description.
举例来说,假设业务方是专门售卖艺术品的电商平台,其想要将业务中产生的每一个订单数据提交给区块链进行存储。为此,电商平台在使用自动化合约程序进行配置时,可以按照如下方式配置第一数据表模板:For example, suppose the business party is an e-commerce platform that specializes in selling artworks, and it wants to submit each order data generated in the business to the blockchain for storage. For this reason, when the e-commerce platform uses the automated contract program for configuration, the first data table template can be configured as follows:
特征名称字段Feature name field 特征类型字段Feature Type Field 特征描述字段Feature description field
tabletable ArtArt 艺术品类Artwork
art idart id StringString 艺术品标识Artwork logo
art sizeart size StringString 艺术品尺寸Artwork size
art typeart type StringString 艺术品种类Type of artwork
art ownerart owner StringString 艺术品拥有者Art owner
表3table 3
其中,table指代订单数据整体,可以视为表3的表标识,其是艺术品的订单数据,因此特征类型是艺术品(Art)。art id是指订单数据中的艺术品的标识,art size是指艺术品的尺寸,art type是指艺术品具体所属的种类(如绘画、雕塑),art owner是指艺术品的拥有者。Among them, table refers to the entire order data, which can be regarded as the table identifier of Table 3, which is the order data of the artwork, so the feature type is the artwork (Art). Art id refers to the identification of the artwork in the order data, art size refers to the size of the artwork, art type refers to the type of artwork (such as painting, sculpture), and art owner refers to the owner of the artwork.
S104:根据预置的模板解析规则,将输入条目参数后的所述数据表模板集合解析成智能合约代码,提供给所述业务方。S104: According to the preset template parsing rules, the data table template set after the entry parameters are inputted is parsed into smart contract codes and provided to the business party.
当数据表模板集合中只包括第一数据表模板时,业务方完成对第一数据表模板的配置之后,自动化合约程序就可以根据预置的模板解析规则,将完成配置之后的第一数据表模板解析成智能合约代码,提供给业务方。在实际应用中,当业务方向区块链网络提交封装有业务数据的交易时,该交易调用该智能合约代码,并基于该智能合约代码,将该业务数据以用户通过第一数据表模板定义的存储方式进行存储。When only the first data table template is included in the data table template set, after the business side completes the configuration of the first data table template, the automated contract program can complete the configuration of the first data table according to the preset template parsing rules The template is parsed into smart contract code and provided to the business party. In practical applications, when a business submits a transaction encapsulated with business data to the blockchain network, the transaction calls the smart contract code, and based on the smart contract code, the business data is defined by the user through the first data table template Storage method for storage.
通过图1所示的方法,开发一款自动化合约程序提供给业务方使用,自动化合约程序可以向业务方提供数据表模板,以便业务方根据自己的需求对业务数据存储方式进行配置,然后,自动化合约程序可以根据业务方的配置自动生成智能合约代码。通过本说明书实施例,由于不同的业务方往往都存在区块链存储业务数据的需求,而存储业务数据的需求往往可以用数据表来进行配置,因此,可以针对这种通用需求开发数据表模板,让不同的业务方可以使用数据表模板来进行业务数据的存储方式的配置,而不用再编写这部分智能合约代码,节省了工作量,提升了效率。Through the method shown in Figure 1, an automated contract program is developed for the business side to use. The automated contract program can provide the business side with a data sheet template, so that the business side can configure the business data storage method according to their own needs, and then automate The contract program can automatically generate smart contract code according to the configuration of the business party. Through the embodiments of this specification, because different business parties often have requirements for storing business data on the blockchain, and the requirements for storing business data can often be configured with data tables, a data table template can be developed for this general demand , So that different business parties can use the data table template to configure the storage mode of business data, instead of writing this part of the smart contract code, saving workload and improving efficiency.
此外,在本说明书实施例中,第一数据表模板中还可以包括功能字段,用于配置针对提交给区块链的业务数据的预设功能集合中的至少一种。例如,可以参见表4所示:In addition, in the embodiment of this specification, the first data table template may also include a function field for configuring at least one of the preset function sets for the business data submitted to the blockchain. For example, see Table 4:
特征名称字段Feature name field 特征类型字段Feature Type Field 特征描述字段Feature description field 功能字段Function field
 To  To  To  To
 To  To  To  To
 To  To  To  To
表4Table 4
预设功能集合是自动化合约程序中预置的,提供了若干预设功能,业务方可以在配置第一数据表模板时选择一个或多个预设功能,然后自动化合约程序生成的合约代码中也会一并包括业务方选择的预设功能对应的代码。The preset function set is preset in the automated contract program and provides several preset functions. The business party can select one or more preset functions when configuring the first data table template, and then the contract code generated by the automated contract program is also included The code corresponding to the preset function selected by the business party will also be included.
举例来说,预设功能集合中可以包括以下功能中的至少一种:权限控制功能,用于控制针对业务数据的访问权限;日志功能,用于生成针对业务数据的操作日志;溯源功能,用于追溯业务方提交给区块链的每个包含业务数据的业务交易;数据展示功能,用于以指定展示方案将业务数据输出展示;触发生效功能,用于设定以业务方配置的存储方式对业务数据进行存储的的生效时间。For example, the preset function set may include at least one of the following functions: an authority control function, which is used to control access authority to business data; a log function, which is used to generate an operation log for business data; a traceability function, which uses Each business transaction containing business data submitted to the blockchain by the retrospective business party; the data display function is used to output and display business data in a specified display scheme; the trigger effective function is used to set the storage mode configured by the business party The effective time for storing business data.
需要说明的是,预设功能一般是以业务数据整体为粒度进行配置,因此,对于表3所示, 通常只有第一个条目包含预设功能的字段值,例如参见表5:It should be noted that the preset functions are generally configured with the overall business data as the granularity. Therefore, as shown in Table 3, usually only the first entry contains the field values of the preset functions, for example, see Table 5:
特征名称字段Feature name field 特征类型字段Feature Type Field 特征描述字段Feature description field 功能字段Function field
tabletable ArtArt 艺术品类Artwork 权限控制、日志Access control, log
art idart id StringString 艺术品标识Artwork logo  To
art sizeart size StringString 艺术品尺寸Artwork size  To
art typeart type StringString 艺术品种类Type of artwork  To
art ownerart owner StringString 艺术评拥有者Art critic  To
表5table 5
另外,在本说明书实施例中,所述数据表模板集合还可以包括第二数据表模板,所述第二数据表模板包括特征名称字段与操作方法字段,用于配置针对所述业务方提交给区块链的业务数据的操作方式。In addition, in the embodiment of this specification, the data table template set may also include a second data table template, and the second data table template includes a feature name field and an operation method field, which are used to configure the The operation mode of the business data of the blockchain.
在将输入条目参数后的数据表模板解析成智能合约代码之前,可以接收所述业务方向所述第二数据表模板中输入的至少一组条目参数;其中,向所述第二数据表模板中输入的每组条目参数包括与所述第二数据表模板的各字段一一对应的字段值。Before parsing the data table template after the entry parameters into the smart contract code, at least one set of entry parameters entered by the business direction in the second data table template can be received; wherein, adding to the second data table template Each set of input parameters includes field values corresponding to each field of the second data table template one-to-one.
其中,所述操作方法字段对应的字段值包括以下至少一种:Wherein, the field value corresponding to the operation method field includes at least one of the following:
用于表征数据插入操作的字段值(如insert);The field value used to characterize the data insertion operation (such as insert);
用于表征数据修改操作的字段值(如update);The field value used to characterize data modification operations (such as update);
用于表征数据查询操作的字段值(如query);Field values used to characterize data query operations (such as query);
用于表征数据删除操作的字段值(如delete)。The field value used to characterize the data deletion operation (such as delete).
在实际应用中,一方面,业务方可以向区块链网络提交封装有业务数据的交易,以便调用智能合约代码,将该业务数据以“业务方通过第一数据表模板预先定义的存储方式”进行存储,另一方面,在业务数据被存储后,业务方还可以向区块链网络发起操作交易,以便调用智能合约代码对存储后的业务数据进行插入、修改、查询、删除等操作(业务方通过第二数据表模板预先定义的操作方式)。In practical applications, on the one hand, the business party can submit a transaction encapsulated with business data to the blockchain network in order to call the smart contract code to store the business data in a "pre-defined storage method by the business party through the first data table template" On the other hand, after the business data is stored, the business party can also initiate an operation transaction to the blockchain network in order to call the smart contract code to insert, modify, query, delete and other operations on the stored business data (business Party through the pre-defined operation mode of the second data table template).
表6示例性地给出了一种第二数据表模板:Table 6 exemplarily shows a second data table template:
特征名称字段Feature name field 操作方法字段Operation method field
 To  To
 To  To
 To  To
表6Table 6
由于业务方一般是针对数据表模板集合进行输入的,而数据表模板集合中的第一数据表模板与第二数据表模板皆配置完毕后,当然具有关联关系。此外,为了在形式上体现出第一数据表模板与第二数据表模板之间的关联性,第二数据表模板也可以如表7所示:Since the business party generally inputs for the data table template set, and the first data table template and the second data table template in the data table template set are configured, of course there is an association relationship. In addition, in order to formally reflect the association between the first data table template and the second data table template, the second data table template may also be as shown in Table 7:
关联表字段Associated table fields 特征名称字段Feature name field 操作方法字段Operation method field
 To  To  To
 To  To  To
 To  To  To
表7Table 7
其中,关联表字段中可以记录配置完毕的第一数据表模板的表标识。Among them, the associated table field may record the table identifier of the first data table template that has been configured.
如此,对应于表3所示的配置完成的第一数据表模板,配置完成的第二数据表模板可是:In this way, corresponding to the configured first data table template shown in Table 3, the configured second data table template may be:
特征名称字段Feature name field 操作方法字段Operation method field
art id、artsizeart id, artsize insertinsert
art ownerart owner updateupdate
art idart id queryquery
art idart id DeleteDelete
表8Table 8
或者:or:
关联表字段Associated table fields 特征名称字段Feature name field 操作方法字段Operation method field
tabletable art id、artsizeart id, artsize insertinsert
 To art ownerart owner updateupdate
 To art idart id queryquery
 To art idart id DeleteDelete
表9Table 9
此外,在本说明书实施例中,根据预置的模板解析规则,将输入条目参数后的数据表模板集合解析成智能合约代码的实施方式有多种。可选的一种实施方式为,生成输入条目参数后的数据表模板集合对应的数据库模式schema描述,并基于所述schema描述确定智能合约代码。In addition, in the embodiment of this specification, there are multiple implementation manners for parsing the set of data table templates after the entry parameters are input into smart contract codes according to preset template parsing rules. An optional implementation manner is to generate a database schema description corresponding to the set of data table templates after input item parameters, and determine the smart contract code based on the schema description.
例如,对于某个电商平台的业务数据(订单)而言,其可以被业务方通过第一数据表模板配置为以下表结构:For example, for business data (orders) of a certain e-commerce platform, it can be configured by the business party through the first data table template into the following table structure:
{{
orderId:string;//订单idorderId:string;//Order id
time:string;//生成时间time:string;//Generation time
operatorId:string;//操作者idoperatorId:string;//operator id
key:orderId;//表主键key:orderId;//table primary key
}}
上述表结构对应的schema描述为:The schema description corresponding to the above table structure is:
namespace ContractTableManager;namespace ContractTableManager;
table TableManager{table TableManager{
Orders:[Order];Orders:[Order];
}}
table Order{table Order{
OrderId:string;OrderId:string;
time:string;time:string;
operatorId:string;operatorId:string;
}}
root_type TableManager;root_type TableManager;
自动化合约程序可以根据schema描述来实现对结构化数据(即数据表中的数据)的解析,生成用于调用结构化数据的接口的代码,接着,再生成用于调用接口的方法的代码,在生成的合约代码中,可以实现业务方配置的操作方法调用这些接口来获取数据,进行操作。The automated contract program can analyze the structured data (that is, the data in the data table) according to the schema description, generate the code for calling the structured data interface, and then generate the code for calling the method of the interface. In the generated contract code, the operation methods configured by the business party can be used to call these interfaces to obtain data and perform operations.
另外,在本说明书实施例中,自动化合约程序还可以基于输入条目参数后的数据表模板集合,生成测试框架提供给所述业务方,用于对所述智能合约代码进行测试,如此,业务方不必自行开发测试框架。In addition, in the embodiment of this specification, the automated contract program can also generate a test framework based on the set of data table templates after the entry parameters are entered and provided to the business party for testing the smart contract code. In this way, the business party There is no need to develop a test framework by yourself.
图2是本说明书实施例提供的一种自动化合约程序的软件结构示意图,包括:模板提供模块201,向业务方提供数据表模板集合;其中,所述数据表模板集合包括第一数据表模板,所述第一数据表模板包括特征名称字段、特征类型字段与特征描述字段,用于配置针对所述业务方提交给区块链的业务数据的存储方式;第一参数接收模块202,接收所述业务方向所述第一数据表模板中输入的至少一组条目参数;其中,向所述第一数据表模板中输入的每组条目参数包括与所述第一数据表模板的各字段一一对应的字段值;模板解析模块203,根据预置的模板解析规则,将输入条目参数后的所述数据表模板集合解析成智能合约代码,提供给所述业务方。2 is a schematic diagram of the software structure of an automated contract program provided by an embodiment of this specification, including: a template providing module 201, which provides a data table template set to the business party; wherein the data table template set includes a first data table template, The first data table template includes a feature name field, a feature type field, and a feature description field, which are used to configure the storage method of the business data submitted to the blockchain by the business party; the first parameter receiving module 202 receives the The business direction at least one set of entry parameters entered in the first data table template; wherein, each set of entry parameters entered in the first data table template includes a one-to-one correspondence with each field of the first data table template The field value of the template analysis module 203, according to the preset template analysis rules, parse the data table template set after the entry parameters are input into smart contract code, and provide it to the business party.
所述第一数据表模板还包括功能字段,用于配置针对提交给区块链的业务数据的预设功能集合中的至少一种。The first data table template further includes a function field for configuring at least one of the preset function sets for the business data submitted to the blockchain.
所述预设功能集合包括以下功能:权限控制功能,用于控制针对业务数据的访问权限;日志功能,用于生成针对业务数据的操作日志;溯源功能,用于追溯业务方提交给区块链的每个包含业务数据的业务交易;数据展示功能,用于以指定展示方案将业务数据输出展示;触发生效功能,用于设定以业务方配置的存储方式对业务数据进行存储的的生效时间。The preset function set includes the following functions: permission control function, used to control access permissions for business data; log function, used to generate operation logs for business data; traceability function, used to trace the business party submitted to the blockchain Each business transaction that contains business data; data display function, used to display business data output and display in a specified display plan; trigger effective function, used to set the effective time for storing business data in the storage mode configured by the business party .
所述数据表模板集合还包括第二数据表模板,所述第二数据表模板包括特征名称字段与操作装置字段,用于配置针对所述业务方提交给区块链的业务数据的操作方式;所述装置还包括:第二参数接收模块204,在所述模板解析模块将输入条目参数后的数据表模板解析成智能合约代码之前,接收所述业务方向所述第二数据表模板中输入的至少一组条目参数;其中,向所述第二数据表模板中输入的每组条目参数包括与所述第二数据表模板的各字段一一对应的字段值。The set of data table templates further includes a second data table template, the second data table template includes a feature name field and an operating device field, and is used to configure an operation mode for the business data submitted to the blockchain by the business party; The device further includes: a second parameter receiving module 204, which receives the input from the business direction in the second data table template before the template analysis module parses the data table template after the entry parameters are entered into smart contract code At least one set of entry parameters; wherein, each set of entry parameters input to the second data table template includes field values corresponding to each field of the second data table template one-to-one.
所述操作装置字段对应的字段值包括以下至少一种:The field value corresponding to the operating device field includes at least one of the following:
用于表征数据插入操作的字段值;The field value used to characterize the data insertion operation;
用于表征数据修改操作的字段值;The field value used to characterize the data modification operation;
用于表征数据查询操作的字段值;The field value used to characterize the data query operation;
用于表征数据删除操作的字段值。The field value used to characterize the data deletion operation.
所述模板解析模块203,生成输入条目参数后的数据表模板集合对应的数据库模式schema描述,并基于所述schema描述确定智能合约代码。The template analysis module 203 generates a database schema description corresponding to the set of data table templates after the entry parameters are input, and determines the smart contract code based on the schema description.
自动化合约程序还包括:框架生成模块205,基于输入条目参数后的数据表模板集合,生成测试框架提供给所述业务方,用于对所述智能合约代码进行测试。The automated contract program further includes: a framework generation module 205, which generates a test framework based on the set of data table templates after inputting item parameters and provides it to the business party for testing the smart contract code.
本说明书实施例还提供一种计算机设备,其至少包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,处理器执行所述程序时实现图1所示的方法。The embodiments of this specification also provide a computer device, which includes at least a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the method shown in FIG. 1 when the program is executed. .
图3示出了本说明书实施例所提供的一种更为具体的计算设备硬件结构示意图,该设备可以包括:处理器1010、存储器1020、输入/输出接口1030、通信接口1040和总线1050。其中处理器1010、存储器1020、输入/输出接口1030和通信接口1040通过总线1050实现彼此之间在设备内部的通信连接。FIG. 3 shows a more specific hardware structure diagram of a computing device provided by an embodiment of this specification. The device may include a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040 realize the communication connection between each other in the device through the bus 1050.
处理器1010可以采用通用的CPU(Central Processing Unit,中央处理器)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本说明书实施例所提供的技术方案。The processor 1010 may be implemented by a general CPU (Central Processing Unit, central processing unit), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits for execution related Program to realize the technical solutions provided in the embodiments of this specification.
存储器1020可以采用ROM(Read Only Memory,只读存储器)、RAM(Random Access Memory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器1020可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器1020中,并由处理器1010来调用执行。The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory, random access memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, related program codes are stored in the memory 1020 and called and executed by the processor 1010.
输入/输出接口1030用于连接输入/输出模块,以实现信息输入及输出。输入输出/模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包括显示器、扬声器、振动器、指示灯等。The input/output interface 1030 is used to connect an input/output module to realize information input and output. The input/output/module can be configured in the device as a component (not shown in the figure), or can be connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and an output device may include a display, a speaker, a vibrator, an indicator light, and the like.
通信接口1040用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。The communication interface 1040 is used to connect a communication module (not shown in the figure) to realize the communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.), or through wireless means (such as mobile network, WIFI, Bluetooth, etc.).
总线1050包括一通路,在设备的各个组件(例如处理器1010、存储器1020、输入/输出 接口1030和通信接口1040)之间传输信息。The bus 1050 includes a path for transmitting information between various components of the device (for example, the processor 1010, the memory 1020, the input/output interface 1030, and the communication interface 1040).
需要说明的是,尽管上述设备仅示出了处理器1010、存储器1020、输入/输出接口1030、通信接口1040以及总线1050,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本说明书实施例方案所必需的组件,而不必包含图中所示的全部组件。It should be noted that although the above device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include the necessary equipment for normal operation. Other components. In addition, those skilled in the art can understand that the above-mentioned device may also include only the components necessary to implement the solutions of the embodiments of the present specification, and not necessarily include all the components shown in the figures.
本说明书实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现图1所示的方法。The embodiment of the present specification also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method shown in FIG. 1 is implemented.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本说明书实施例可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本说明书实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务设备,或者网络设备等)执行本说明书实施例各个实施例或者实施例的某些部分所述的方法。From the description of the foregoing implementation manners, it can be known that those skilled in the art can clearly understand that the embodiments of this specification can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solutions of the embodiments of this specification can be embodied in the form of software products, which can be stored in storage media, such as ROM/RAM, Magnetic disks, optical disks, etc., include several instructions to enable a computer device (which may be a personal computer, a service device, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments of this specification.
上述实施例阐明的系统、方法、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。The systems, methods, modules, or units illustrated in the above embodiments may be specifically implemented by computer chips or entities, or implemented by products with certain functions. A typical implementation device is a computer. The specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而 言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,在实施本说明书实施例方案时可以把各模块的功能在同一个或多个软件和/或硬件中实现。也可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, as for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the part of the description of the method embodiment. The device embodiments described above are merely illustrative, and the modules described as separate components may or may not be physically separated. The functions of the modules can be combined in the same way when implementing the solutions of the embodiments of this specification. Or multiple software and/or hardware implementations. It is also possible to select some or all of the modules according to actual needs to achieve the objectives of the solutions of the embodiments. Those of ordinary skill in the art can understand and implement without creative work.
以上所述仅是本说明书实施例的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本说明书实施例原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本说明书实施例的保护范围。The above are only specific implementations of the embodiments of this specification. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the embodiments of this specification, several improvements and modifications can be made. These Improvements and retouching should also be regarded as the protection scope of the embodiments of this specification.

Claims (15)

  1. 一种智能合约代码的生成方法,应用于自动化合约程序,所述方法包括:A method for generating smart contract code, which is applied to an automated contract program, and the method includes:
    向业务方提供数据表模板集合;其中,所述数据表模板集合包括第一数据表模板,所述第一数据表模板包括特征名称字段、特征类型字段与特征描述字段,用于配置针对所述业务方提交给区块链的业务数据的存储方式;Provide a set of data table templates to the business side; wherein, the set of data table templates includes a first data table template, and the first data table template includes a feature name field, a feature type field, and a feature description field, which are used to configure the The storage method of the business data submitted by the business party to the blockchain;
    接收所述业务方向所述第一数据表模板中输入的至少一组条目参数;其中,向所述第一数据表模板中输入的每组条目参数包括与所述第一数据表模板的各字段一一对应的字段值;At least one set of entry parameters input into the first data table template is received by the business direction; wherein, each set of entry parameters input into the first data table template includes the same field as each field of the first data table template. One-to-one corresponding field value;
    根据预置的模板解析规则,将输入条目参数后的所述数据表模板集合解析成智能合约代码,提供给所述业务方。According to the preset template parsing rules, the data table template set after the entry parameters are entered is parsed into smart contract codes and provided to the business party.
  2. 如权利要求1所述的方法,所述第一数据表模板还包括功能字段,用于配置针对提交给区块链的业务数据的预设功能集合中的至少一种。The method according to claim 1, wherein the first data table template further includes a function field for configuring at least one of a set of preset functions for the business data submitted to the blockchain.
  3. 如权利要求2所述的方法,所述预设功能集合包括以下功能:The method according to claim 2, wherein the preset function set includes the following functions:
    权限控制功能,用于控制针对业务数据的访问权限;Permission control function, used to control access permissions for business data;
    日志功能,用于生成针对业务数据的操作日志;Log function, used to generate operation logs for business data;
    溯源功能,用于追溯业务方提交给区块链的每个包含业务数据的业务交易;Traceability function, used to trace each business transaction containing business data submitted by the business party to the blockchain;
    数据展示功能,用于以指定展示方案将业务数据输出展示;Data display function, used to output and display business data in a designated display scheme;
    触发生效功能,用于设定以业务方配置的存储方式对业务数据进行存储的的生效时间。The trigger effective function is used to set the effective time for storing the business data in the storage mode configured by the business party.
  4. 如权利要求1所述的方法,所述数据表模板集合还包括第二数据表模板,所述第二数据表模板包括特征名称字段与操作方法字段,用于配置针对所述业务方提交给区块链的业务数据的操作方式;The method according to claim 1, wherein the set of data table templates further includes a second data table template, and the second data table template includes a feature name field and an operation method field, and is used to configure the data table template to be submitted to the district for the business party. The operation mode of the business data of the block chain;
    在将输入条目参数后的数据表模板解析成智能合约代码之前,所述方法还包括:Before parsing the data table template after the entry parameters into the smart contract code, the method further includes:
    接收所述业务方向所述第二数据表模板中输入的至少一组条目参数;其中,向所述第二数据表模板中输入的每组条目参数包括与所述第二数据表模板的各字段一一对应的字段值。At least one set of entry parameters input into the second data table template from the business direction is received; wherein, each set of entry parameters input into the second data table template includes the same field as each field of the second data table template. One-to-one corresponding field value.
  5. 如权利要求4所述的方法,所述操作方法字段对应的字段值包括以下至少一种:The method according to claim 4, the field value corresponding to the operation method field includes at least one of the following:
    用于表征数据插入操作的字段值;The field value used to characterize the data insertion operation;
    用于表征数据修改操作的字段值;The field value used to characterize the data modification operation;
    用于表征数据查询操作的字段值;The field value used to characterize the data query operation;
    用于表征数据删除操作的字段值。The field value used to characterize the data deletion operation.
  6. 如权利要求1所述的方法,根据预置的模板解析规则,将输入条目参数后的数据表模板集合解析成智能合约代码,具体包括:The method according to claim 1, parsing the data table template set after the entry parameters are input into smart contract codes according to preset template parsing rules, which specifically includes:
    生成输入条目参数后的数据表模板集合对应的数据库模式schema描述,并基于所述schema描述确定智能合约代码。The database schema description corresponding to the data table template set after the input item parameters is generated, and the smart contract code is determined based on the schema description.
  7. 如权利要求1所述的方法,还包括:The method of claim 1, further comprising:
    基于输入条目参数后的数据表模板集合,生成测试框架提供给所述业务方,用于对所述智能合约代码进行测试。Based on the data table template set after the entry parameters are entered, a test framework is generated and provided to the business party for testing the smart contract code.
  8. 一种自动化合约代码的生成装置,包括:An automatic contract code generation device, including:
    模板提供模块,向业务方提供数据表模板集合;其中,所述数据表模板集合包括第一数据表模板,所述第一数据表模板包括特征名称字段、特征类型字段与特征描述字段,用于配置针对所述业务方提交给区块链的业务数据的存储方式;The template providing module provides a set of data table templates to the business party; wherein, the set of data table templates includes a first data table template, and the first data table template includes a feature name field, a feature type field, and a feature description field for Configure a storage method for the business data submitted to the blockchain by the business party;
    第一参数接收模块,接收所述业务方向所述第一数据表模板中输入的至少一组条目参数;其中,向所述第一数据表模板中输入的每组条目参数包括与所述第一数据表模板的各字段一一对应的字段值;The first parameter receiving module receives at least one set of entry parameters entered into the first data table template by the business direction; wherein, each set of entry parameters entered into the first data table template includes the same as the first set of entry parameters. Each field of the data table template has a one-to-one corresponding field value;
    模板解析模块,根据预置的模板解析规则,将输入条目参数后的所述数据表模板集合解析成智能合约代码,提供给所述业务方。The template parsing module parses the set of data table templates after the entry parameters are input into smart contract codes according to preset template parsing rules, and provides them to the business party.
  9. 如权利要求8所述的装置,所述第一数据表模板还包括功能字段,用于配置针对提交给区块链的业务数据的预设功能集合中的至少一种。8. The device of claim 8, wherein the first data table template further comprises a function field for configuring at least one of a set of preset functions for the business data submitted to the blockchain.
  10. 如权利要求9所述的装置,所述预设功能集合包括以下功能:The device of claim 9, wherein the preset function set includes the following functions:
    权限控制功能,用于控制针对业务数据的访问权限;Permission control function, used to control access permissions for business data;
    日志功能,用于生成针对业务数据的操作日志;Log function, used to generate operation logs for business data;
    溯源功能,用于追溯业务方提交给区块链的每个包含业务数据的业务交易;Traceability function, used to trace each business transaction containing business data submitted by the business party to the blockchain;
    数据展示功能,用于以指定展示方案将业务数据输出展示;Data display function, used to output and display business data in a designated display scheme;
    触发生效功能,用于设定以业务方配置的存储方式对业务数据进行存储的的生效时间。The trigger effective function is used to set the effective time for storing the business data in the storage mode configured by the business party.
  11. 如权利要求8所述的装置,所述数据表模板集合还包括第二数据表模板,所述第二数据表模板包括特征名称字段与操作装置字段,用于配置针对所述业务方提交给区块链的业务数据的操作方式;8. The device according to claim 8, wherein the set of data table templates further includes a second data table template, and the second data table template includes a feature name field and an operating device field, and is used to configure the data table template to be submitted to the district for the business party. The operation mode of the business data of the block chain;
    所述装置还包括:The device also includes:
    第二参数接收模块,在所述模板解析模块将输入条目参数后的数据表模板解析成智能合约代码之前,接收所述业务方向所述第二数据表模板中输入的至少一组条目参数; 其中,向所述第二数据表模板中输入的每组条目参数包括与所述第二数据表模板的各字段一一对应的字段值。The second parameter receiving module, before the template analysis module parses the data table template after the entry parameters are input into smart contract code, receives at least one set of entry parameters entered in the second data table template by the business direction; wherein , Each set of entry parameters input to the second data table template includes field values corresponding to each field of the second data table template one-to-one.
  12. 如权利要求11所述的装置,所述操作装置字段对应的字段值包括以下至少一种:The device according to claim 11, the field value corresponding to the operating device field includes at least one of the following:
    用于表征数据插入操作的字段值;The field value used to characterize the data insertion operation;
    用于表征数据修改操作的字段值;The field value used to characterize the data modification operation;
    用于表征数据查询操作的字段值;The field value used to characterize the data query operation;
    用于表征数据删除操作的字段值。The field value used to characterize the data deletion operation.
  13. 如权利要求8所述的装置,所述模板解析模块,生成输入条目参数后的数据表模板集合对应的数据库模式schema描述,并基于所述schema描述确定智能合约代码。8. The device according to claim 8, wherein the template analysis module generates a database schema description corresponding to the data table template set after the entry parameters are input, and determines the smart contract code based on the schema description.
  14. 如权利要求8所述的装置,还包括:The device of claim 8, further comprising:
    框架生成模块,基于输入条目参数后的数据表模板集合,生成测试框架提供给所述业务方,用于对所述智能合约代码进行测试。The framework generation module generates a test framework based on the set of data table templates after the entry parameters are input and is provided to the business party for testing the smart contract code.
  15. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如权利要求1-7任一项所述的方法。A computer device, comprising a memory, a processor, and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program as described in any one of claims 1-7 method.
PCT/CN2021/096522 2020-05-28 2021-05-27 Smart contract code generation method, program, and device WO2021239074A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010471059.4 2020-05-28
CN202010471059.4A CN111506579B (en) 2020-05-28 2020-05-28 Method, program and equipment for generating intelligent contract code

Publications (1)

Publication Number Publication Date
WO2021239074A1 true WO2021239074A1 (en) 2021-12-02

Family

ID=71864424

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/096522 WO2021239074A1 (en) 2020-05-28 2021-05-27 Smart contract code generation method, program, and device

Country Status (2)

Country Link
CN (1) CN111506579B (en)
WO (1) WO2021239074A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111506579B (en) * 2020-05-28 2022-09-20 支付宝(杭州)信息技术有限公司 Method, program and equipment for generating intelligent contract code
CN112148280B (en) * 2020-09-21 2022-04-01 中国电子科技网络信息安全有限公司 Block chain-based data evidence storage service templated development method
CN113179294B (en) * 2021-03-15 2023-02-07 华东师范大学 Schema unified access method based on intelligent contract
CN114239039A (en) * 2021-09-30 2022-03-25 西南电子技术研究所(中国电子科技集团公司第十研究所) Method for dynamically adapting data structure on user-defined block chain

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190034402A1 (en) * 2017-07-28 2019-01-31 International Business Machines Corporation Cognitive mediator for generating blockchain smart contracts
CN109542421A (en) * 2018-11-12 2019-03-29 夸克链科技(深圳)有限公司 A kind of modular tile chain intelligence contract
CN110097364A (en) * 2019-04-30 2019-08-06 翟红鹰 Block chain intelligence contract modularization generation method, system, terminal and storage medium
CN110348882A (en) * 2019-06-19 2019-10-18 阿里巴巴集团控股有限公司 Integration method, system, device and equipment based on intelligent contract
CN111506579A (en) * 2020-05-28 2020-08-07 支付宝(杭州)信息技术有限公司 Method, program and equipment for generating intelligent contract code

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190005469A1 (en) * 2015-07-14 2019-01-03 Fmr Llc Collateral Management With Blockchain and Smart Contracts Apparatuses, Methods and Systems
CN106681739B (en) * 2017-01-11 2020-06-19 杭州云象网络技术有限公司 Automatic intelligent contract generation method
CN106874440B (en) * 2017-02-07 2019-11-12 杭州秘猿科技有限公司 A kind of block chain state storage method based on SQL database
CN110990879B (en) * 2019-11-08 2022-03-18 中国电子科技网络信息安全有限公司 Data evidence storing method based on block chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190034402A1 (en) * 2017-07-28 2019-01-31 International Business Machines Corporation Cognitive mediator for generating blockchain smart contracts
CN109542421A (en) * 2018-11-12 2019-03-29 夸克链科技(深圳)有限公司 A kind of modular tile chain intelligence contract
CN110097364A (en) * 2019-04-30 2019-08-06 翟红鹰 Block chain intelligence contract modularization generation method, system, terminal and storage medium
CN110348882A (en) * 2019-06-19 2019-10-18 阿里巴巴集团控股有限公司 Integration method, system, device and equipment based on intelligent contract
CN111506579A (en) * 2020-05-28 2020-08-07 支付宝(杭州)信息技术有限公司 Method, program and equipment for generating intelligent contract code

Also Published As

Publication number Publication date
CN111506579B (en) 2022-09-20
CN111506579A (en) 2020-08-07

Similar Documents

Publication Publication Date Title
WO2021239074A1 (en) Smart contract code generation method, program, and device
US11847167B2 (en) System and method for generation of chat bot system with integration elements augmenting natural language processing and native business rules
US9665841B2 (en) Cross-platform application framework
WO2021184725A1 (en) User interface test method and apparatus, storage medium, and computer device
CN109145025B (en) Multi-data-source integrated data query method and device and service server
JP4812337B2 (en) Method and apparatus for generating a form using a form type
TW201828220A (en) Service processing method and apparatus
US7584416B2 (en) Logical representation of a user interface form
US20140114822A1 (en) Method and system for creating tax configuration templates
US9563679B2 (en) Adaptive warehouse data validation tool
CN111125496B (en) Price query method, device and system
US20130238549A1 (en) Using Dimension Substitutions in OLAP Cubes
US20160054982A1 (en) Application programming interface (api) engine
CN102946415B (en) A kind of implementation method of mobile terminal this locality application and device
CN107562459B (en) Management system, interface generating/displaying/operating method, medium, and terminal
CN115993966B (en) Application development system and method
US20110179397A1 (en) Systems and methods for metamodel transformation
US10901984B2 (en) Enhanced batch updates on records and related records system and method
CN112561690A (en) Method, system, equipment and storage medium for testing credit card staging service interface
CN107423224A (en) Method of testing and device
CN113485746B (en) Method and device for generating application program interface document
CN115407981A (en) Front-end data mock method and system based on middleware adaptation
US20170161359A1 (en) Pattern-driven data generator
CN112764763A (en) Code conversion method, system, equipment and computer readable storage medium
CN111242635A (en) After-sale data maintenance method and system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21812548

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21812548

Country of ref document: EP

Kind code of ref document: A1