Blockchain-based smart contract processing methods, devices, equipment, and media

By constructing a unified smart contract template, identifying the current executable node and performing authentication, the problem of low efficiency in smart contract processing is solved, and efficient operation and flexible management of smart contracts are achieved.

CN115390950BActive Publication Date: 2026-11-10SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211049080.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2026-11-10
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

In existing technologies, blockchain-based smart contract processing methods suffer from low smart contract execution efficiency and low reuse and combination efficiency.

Method used

By constructing a unified smart contract template, the system responds to call requests, determines the currently executable node, authenticates the caller, and writes the execution result to the blockchain, thereby enabling the instantiation and flexible management of smart contracts.

Benefits of technology

It improves the operational efficiency, reuse and composition efficiency of smart contracts, and enhances the flexibility and reliability of smart contract processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115390950B_ABST
    Figure CN115390950B_ABST
Patent Text Reader

Abstract

This invention discloses a blockchain-based smart contract processing method, apparatus, device, and medium. The method includes: responding to a call request for a process function in a target smart contract instance, determining the current executable node to be called from candidate executable nodes in the process function; associating the current executable node with the current executable function; obtaining the target smart contract instance by pre-instantiating a target smart contract template; determining the information of the currently operable personnel associated with the current executable function; authenticating the initiator of the call request based on the information of the currently operable personnel; if authentication is successful, calling the current executable function to obtain the current execution result, and writing the current execution result into the blockchain. This solution improves the operational efficiency of smart contracts and enhances their reuse and composition efficiency by processing smart contracts using a constructed target smart contract template.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain technology, and in particular to a method, apparatus, device, and medium for processing smart contracts based on blockchain. Background Technology

[0002] Blockchain technology, also known as distributed ledger technology, is a distributed database system involving multiple nodes and entities. In the absence of a third party, smart contracts can reliably maintain blockchain ledger data.

[0003] In existing technologies, blockchain-based smart contract processing methods do not have a unified smart contract template, resulting in low operating efficiency and low reuse and combination efficiency of smart contracts. Summary of the Invention

[0004] This invention provides a blockchain-based smart contract processing method, apparatus, device, and medium to improve the operational efficiency of smart contracts, as well as their reuse and combination efficiency, by constructing a unified smart contract template.

[0005] According to one aspect of the present invention, a blockchain-based smart contract processing method is provided, comprising:

[0006] In response to a call request for a process function in the target smart contract instance, the current executable node to be called is determined from the candidate executable nodes in the process function; the current executable node is associated with the current executable function; the target smart contract instance is obtained by pre-instantiating the target smart contract template;

[0007] Determine the information of the currently operable personnel associated with the currently executable function;

[0008] Based on the currently available personnel information, authenticate the party initiating the call request;

[0009] If authentication is successful, the currently executable function is called to obtain the current execution result, and the current execution result is written into the blockchain.

[0010] According to another aspect of the present invention, a blockchain-based smart contract processing apparatus is provided, comprising:

[0011] The executable node determination module is used to respond to a call request for a process function in the target smart contract instance, and determine the current executable node to be called from the candidate executable nodes in the process function; the current executable node is associated with the current executable function; the target smart contract instance is obtained by pre-instantiating the target smart contract template;

[0012] The personnel information determination module is used to determine the currently operable personnel information associated with the currently executable function;

[0013] The authentication module is used to authenticate the initiator of the call request based on the information of the currently available personnel.

[0014] The execution result determination module is used to call the currently executable function to obtain the current execution result if the authentication is successful, and then write the current execution result into the blockchain.

[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0016] At least one processor; and

[0017] A memory that is communicatively connected to at least one processor; wherein,

[0018] The memory stores a computer program that can be executed by at least one processor, such that the at least one processor can execute any of the blockchain-based smart contract processing methods provided in the embodiments of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute any of the blockchain-based smart contract processing methods provided in the embodiments of the present invention.

[0020] The blockchain-based smart contract processing solution provided in this invention, in response to a call request for a process function in a target smart contract instance, determines the current executable node to be called from candidate executable nodes in the process function; the current executable node is associated with the current executable function; the target smart contract instance is obtained by pre-instantiating a target smart contract template; the information of the currently operable personnel associated with the current executable function is determined; based on the information of the currently operable personnel, the initiator of the call request is authenticated; if authentication is successful, the current executable function is called to obtain the current execution result, and the current execution result is written to the blockchain. This solution, by determining the current executable function through the process function in the target smart contract instance and using the information of the currently operable personnel associated with the current executable function to authenticate the caller of the smart contract, can improve the flexibility and reliability of smart contract processing, thereby improving the operating efficiency of smart contracts. Furthermore, by instantiating the target smart contract template to obtain the target smart contract instance, the efficiency of smart contract reuse and composition is greatly improved.

[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

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

[0023] Figure 1 This is a flowchart of a blockchain-based smart contract processing method provided in Embodiment 1 of the present invention;

[0024] Figure 2A This is a flowchart of a blockchain-based smart contract processing method provided in Embodiment 2 of the present invention;

[0025] Figure 2B This is a schematic diagram of the structure of a target smart contract template provided in Embodiment 2 of the present invention;

[0026] Figure 2C This is a schematic diagram of the structure of an executable unit provided in Embodiment 2 of the present invention;

[0027] Figure 3 This is a schematic diagram of the structure of a blockchain-based smart contract processing device provided in Embodiment 3 of the present invention;

[0028] Figure 4 This is a schematic diagram of the structure of an electronic device that implements a blockchain-based smart contract processing method, as provided in Embodiment 4 of the present invention. Detailed Implementation

[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0031] Furthermore, it should be noted that the collection, storage, use, processing, transmission, provision, and disclosure of call requests and other related processes in the technical solution of this invention comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0032] Blockchain technology, also known as distributed ledger technology, is a decentralized, collectively maintained distributed ledger solution. Essentially, it's a distributed database system involving multiple nodes and entities. Blockchain is not a single technology but rather the result of integrating multiple technologies, such as P2P networks (Peer-to-peer networking), encryption, and consensus algorithms. Maintaining a reliable and tamper-proof ledger record using blockchain technology reduces trust risks and effectively lowers the maintenance costs associated with collaboration among numerous parties. Therefore, blockchain systems possess characteristics such as anonymity, immutability, and traceability.

[0033] Smart contracts are publicly available business logic shared by all parties involved in a blockchain. They ensure the reliable maintenance of the blockchain ledger data without the need for a third party. In current consortium blockchain applications, smart contract code logic is typically designed and developed based on business logic rules. Common contract logic is encapsulated into a reusable code library that can be used across multiple business smart contracts.

[0034] In consortium blockchain applications, multiple operators complete relevant business processes based on business rule parameters. Each operator interacts with smart contracts on the blockchain through transaction requests, and the smart contracts can generate events to notify the off-chain systems of relevant operators for processing.

[0035] Example 1

[0036] Figure 1This is a flowchart of a blockchain-based smart contract processing method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case of blockchain-based smart contract processing. The method can be executed by a blockchain-based smart contract processing device, which can be implemented in hardware and / or software and integrated into an electronic device that carries blockchain-based smart contract processing functions.

[0037] See Figure 1 The blockchain-based smart contract processing method shown includes:

[0038] S110. In response to a call request for a process function in the target smart contract instance, determine the current executable node to be called from the candidate executable nodes in the process function; the current executable node is associated with the current executable function; the target smart contract instance is obtained by pre-instantiating the target smart contract template.

[0039] In this embodiment, at least one smart contract template (SCT) can be pre-built, each with different business logic. The target smart contract template refers to a template selected from at least one that can solve the current practical needs. A smart contract template can include executable units. To manage executable units and smart contract templates, a public smart contract registry is implemented and deployed on the blockchain. When a new smart contract is deployed, the templated smart contract template and the executable units contained within it are registered with the registry. For any given smart contract template, it can reference all executable units registered in the registry; that is, the smart contract template can reference executable units registered within itself, as well as executable units registered with other smart contract templates. By splitting and combining these templates, it is easier to form general-purpose smart contract templates for cross-institutional business, thus improving the scalability of smart contract templates.

[0040] For ease of explanation, the following explanation will use the target smart contract template as an example.

[0041] In this embodiment, the target smart contract template may include operator permission information, parameter templates, and function information. The function information may include process functions. A process function (Smart Contract Process Function, SCPF) is a chain structure formed by connecting at least one candidate executable node. The process function connects the candidate executable functions associated with at least one candidate executable node. The candidate executable functions that can be called during the execution of the process function can be set or adjusted by technical personnel according to business scenario information; this embodiment of the invention does not impose any limitations on this. It should be noted that the target smart contract template includes at least one process function.

[0042] In this context, a target smart contract instance (SCI) can be understood as a smart contract instance that instantiates a target smart contract template. Specifically, the instantiation process of a target smart contract template can be as follows: parameters are filled in according to the parameter template of the target smart contract template, the initialization function in the function information is executed, and during the execution of the initialization function, the instantiation parameters of the target smart contract template can be read to obtain the target smart contract instance.

[0043] Specifically, the target smart contract instance contains at least one process function. A process function is selected based on the call request. This process function may include at least two candidate executable nodes to determine the execution order of the process. Candidate executable nodes can be associated with candidate executable functions, and candidate executable functions are also associated with candidate operable personnel information, used to authenticate the caller of the candidate executable function. Any candidate executable function can be a contract executable function or a unit executable function.

[0044] For example, when the process function flows to any candidate executable node, that candidate executable node is determined as the current executable node, the candidate executable function associated with the current executable node becomes the current executable function, and the candidate operable personnel information associated with the current executable function becomes the current operable personnel information. The current executable function associated with the current executable node is called to implement the business logic.

[0045] S120. Determine the information of the currently operable personnel associated with the currently executable function.

[0046] S130. Based on the currently available personnel information, authenticate the party initiating the call request.

[0047] Specifically, authentication is successful if the information of the initiator of the call request matches the information of the currently operable personnel; authentication fails if the information of the initiator of the call request does not match the information of the currently operable personnel.

[0048] S140. If authentication is successful, the current executable function is called to obtain the current execution result, and the current execution result is written into the blockchain.

[0049] Specifically, if authentication is successful, the current executable function is invoked to obtain the current execution result, which is then written into the blockchain. If authentication fails, it indicates that the initiator of the call request is not the currently authorized user and has no right to invoke the current executable function, so the call request is rejected.

[0050] The blockchain-based smart contract processing solution provided in this invention, in response to a call request for a process function in a target smart contract instance, determines the current executable node to be called from candidate executable nodes in the process function; the current executable node is associated with the current executable function; the target smart contract instance is obtained by pre-instantiating a target smart contract template; the information of the currently operable personnel associated with the current executable function is determined; based on the information of the currently operable personnel, the initiator of the call request is authenticated; if authentication is successful, the current executable function is called to obtain the current execution result, and the current execution result is written to the blockchain. This solution, by determining the current executable function through the process function in the target smart contract instance and using the information of the currently operable personnel associated with the current executable function to authenticate the caller of the smart contract, can improve the flexibility and reliability of smart contract processing, thereby improving the operating efficiency of smart contracts. Furthermore, by instantiating the target smart contract template to obtain the target smart contract instance, the efficiency of smart contract reuse and composition is greatly improved.

[0051] In one optional implementation, after calling the currently executable function to obtain the current execution result and writing the current execution result into the blockchain, the method further includes: if the current executable node is the last executable node in the process function, retrieving the execution results of each executable node in the process function from the blockchain; and determining the call result of the process function based on the execution results of each executable node. Here, the last executable node refers to the last currently executable node in the process function. The call result refers to the result corresponding to the call request.

[0052] Specifically, for the execution result of any executable node, this result is intermediate data during the execution of the process function. The execution result is bound to the process number and written to the blockchain. After the process function completes its execution, the call result of the process function is determined based on each execution result. Here, the process number refers to the number of the called process function. It should be noted that only the process function has the permission to query the execution results written to the blockchain.

[0053] Understandably, when the current executable node is the tail executable node in the process function, the execution results of each executable node in the process function are obtained from the blockchain to avoid omissions and ensure the comprehensiveness of the execution results obtained from the blockchain. At the same time, the call result of the process function is determined based on the execution results of each executable node, which improves the accuracy of the call result.

[0054] In one optional implementation, determining the current executable node to be called from the candidate executable nodes in the flow function includes: determining the current executable node to be called from the candidate executable nodes in the flow function based on the previous execution result of the previous executable node in the flow function. Optionally, the current executable node to be called is the next candidate executable node adjacent to the previous executable node; or optionally, the current executable node to be called is the previous candidate executable node adjacent to the previous executable node; or optionally, there are a preset number of candidate executable nodes above or below the previous executable node between the current executable node to be called and the previous executable node. It should be noted that the size of the preset number is determined based on the previous execution result.

[0055] Specifically, the process involves determining a flow function based on the call request and inputting the initial data from the call request into the flow function. From the candidate executable nodes in the flow function, the current executable node to be called is determined. The initial data is then processed by the current executable function associated with the current executable node to obtain the first execution result of the current executable node. Based on the first execution result, a new current executable node to be called is determined. The first execution result is then processed by the current executable function associated with the newly determined current executable node to obtain the second execution result, and so on. It should be noted that the first execution result and the second execution result are different.

[0056] Understandably, by determining the current executable node to be called from the candidate executable nodes in the process function based on the previous execution result of the previous executable node in the process function, the current executable node to be called is accurately located, avoiding the situation where the determined current executable node to be called is inaccurate and the determination efficiency is low, thus improving the accuracy and efficiency of determining the current executable node to be called.

[0057] Example 2

[0058] Figure 2AThis is a flowchart of a blockchain-based smart contract processing method provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment further refines the operation of "determining the information of the currently operable personnel associated with the currently executable function" to: "If the currently executable function is a contract executable function in the target smart contract template, the contract operable personnel information in the target smart contract template is used as the information of the currently operable personnel associated with the currently executable function; if the currently executable function is a unit executable function in any executable unit, the unit executable personnel information in that executable unit is used as the information of the currently operable personnel associated with the currently executable function." It should be noted that for parts not detailed in the embodiments of the present invention, please refer to the relevant descriptions in the foregoing embodiments.

[0059] See Figure 2A The blockchain-based smart contract processing method shown includes:

[0060] S210. In response to a call request for a process function in the target smart contract instance, determine the current executable node to be called from the candidate executable nodes in the process function; the current executable node is associated with the current executable function; the target smart contract instance is obtained by pre-instantiating the target smart contract template.

[0061] S220. If the current executable function is a contract executable function in the target smart contract template, the contract operable personnel information in the target smart contract template shall be used as the current operable personnel information associated with the current executable function.

[0062] In one alternative implementation, see Figure 2B As shown in the structural diagram of the target smart contract template, the target smart contract template can include executable units, information on contract operators, contract parameter templates, contract initialization functions, contract executable functions, process functions, and contract event information. It should be noted that the target smart contract template can contain one or at least two executable units.

[0063] The Smart Contract Executable Unit (SCEU) is the smallest executable and configurable unit in the target smart contract template, used to provide more fine-grained sub-business logic. See also... Figure 2C The diagram shows the structure of an executable unit. An executable unit may include unit executor information, unit parameter templates, unit initialization functions, unit executable functions, and unit event information.

[0064] The unit executable personnel information is used to limit the permissions of the operator of the unit executable function, determining whether the operator has the necessary execution permissions. For example, the unit executable personnel information may include the operator's identity, such as an individual or a company. The unit parameter template is used to configure the unit executable function and the unit initialization function. Specifically, the unit parameter template supports input parameters and / or selection parameters. Input parameters refer to parameter types that require input values, such as an account. Input parameter values ​​may include at least one of string, integer, floating-point number, and Boolean types. Selection parameters refer to selecting at least one parameter type from multiple options given in the executable unit, such as an account type. It should be noted that the parameters in the unit parameter template can be set or adjusted by technical personnel according to actual needs, and this embodiment of the invention does not impose any limitations on this.

[0065] The unit initialization function is used to initialize the executable unit. The unit executable function refers to the function executed by the executable unit, which determines the functionality of the executable unit. Unit event information refers to the event information that the executable unit can generate. Optionally, unit event information may include at least one of the following: event name, event-related data template definition, and event function description. It should be noted that the number of unit event information items in an executable unit is at least one. By setting the structure of the executable unit, the reuse and combination efficiency of the target smart contract template is improved. Simultaneously, the setting of the executable unit constrains and standardizes the construction of the target smart contract template, improving the construction efficiency of the target smart contract template.

[0066] The contract operator information is used to identify the executable permissions of the parties operating the contract's executable functions and process functions. The contract parameter template is a parameter template obtained by expanding the parameters in the target smart contract template based on the unit parameter template. The contract parameter template is used to configure the contract initialization function and the contract executable function. It should be noted that the contract parameter template can be set or adjusted by technical personnel according to actual needs, and this embodiment of the invention does not impose any limitations on this. The contract initialization function is used to initialize the parts of the target smart contract template other than the executable units. The contract executable function is used to determine the functions in the target smart contract template other than the executable units. Contract event information refers to event information obtained by expanding the event information in the target smart contract template based on the unit event information. It should be noted that the number of contract event information is at least one.

[0067] In this embodiment of the invention, for Figure 2BThe instantiation process of the target smart contract template shown can be as follows: Parameters are filled in according to the parameter template of the target smart contract template; the contract initialization function and the unit initialization function are executed; during the execution of the contract initialization function and the unit initialization function, the instantiation parameters of the target smart contract template can be read to obtain the target smart contract instance. The parameter template includes the contract parameter template and the unit parameter templates in the executable units. For example, the order of executing the initialization functions can be: executing the corresponding unit initialization functions sequentially according to the order of the executable units in the list in the target smart contract template, and then executing the contract initialization function.

[0068] This invention does not impose any limitations on the configuration methods of contract operable personnel information, unit executable personnel information, contract executable functions, and unit executable functions. In an optional implementation, the contract operable personnel information, unit executable personnel information, contract executable functions, and unit executable functions can be configured based on preset information configuration rules.

[0069] In another optional implementation, the information of contract operable personnel can be configured based on business scenario information, and the information of unit executable personnel in the executable unit can also be configured. Based on the contract parameter template in the target smart contract template, the contract executable functions can be configured according to business scenario information; based on the unit parameter template in the executable unit, the unit executable functions can be configured according to business scenario information. It is understood that by introducing business scenario information, the configured contract operable personnel information, unit executable personnel information, contract executable functions, and unit executable functions can be adapted to the actual application scenario, avoiding invalid configuration information and wasting resources, improving the applicability of configuration information, meeting differentiated scenario requirements, promoting the integration of smart contract processing with business scenarios, and improving the functionality and standardization of the target smart contract template configuration.

[0070] Specifically, the contract executable function is also associated with contract operable personnel information. When the current executable function is a contract executable function, the contract operable personnel information associated with the contract executable function is used as the current operable personnel information.

[0071] S230. If the current executable function is a unit executable function in any executable unit, the unit executable personnel information in that executable unit shall be used as the current operable personnel information associated with the current executable function.

[0072] Specifically, unit executable functions are associated with unit executable personnel information. When the current executable function is a unit executable function, the unit executable personnel information associated with that unit executable function is used as the current operable personnel information.

[0073] S240. Based on the currently available personnel information, authenticate the party initiating the call request.

[0074] S250. If authentication is successful, the current executable function is called to obtain the current execution result, and the current execution result is written into the blockchain.

[0075] In this embodiment, after calling the currently executable function through the process function to obtain the current execution result, the current execution result of the current executable node is fed back onto the blockchain. This feedback mechanism achieves transparency for each execution node, allowing operators of each node to understand the execution progress of the process function. The feedback information includes at least one of the following: the current executable result, the execution status, and the next executable node. The execution status refers to the state of the current executable node, which includes both successful and failed execution.

[0076] In this embodiment, for any executable node's execution status, if the execution status is successful, the execution result of that node and the corresponding process number are written into the blockchain, and the next executable node is determined. If the execution status is failed, the execution process of the process function ends, and the erroneous execution result and the corresponding process number are written into the blockchain. Optionally, erroneous execution results stored in the blockchain can be retained, and the process function can query each execution result in the blockchain to analyze anomalies. Alternatively, since erroneous execution results stored in the blockchain cannot generate call results, the execution results stored in the blockchain during the execution of the process function can be deleted to reduce resource waste.

[0077] In one optional implementation, after calling the current executable function to obtain the current execution result, the method further includes: generating the contract event if the current executable function is a contract executable function in the target smart contract template and the current execution result satisfies the publication conditions of any contract event in the target smart contract template; and generating the unit event if the current executable function is a unit executable function in any executable unit and the current execution result satisfies the publication conditions of any unit event in the executable unit.

[0078] Here, contract events refer to event information associated with contract executable functions, and unit events refer to event information associated with unit executable functions. Specifically, during the construction of the target smart contract template and executable units, the contract events associated with contract executable functions and the unit events associated with unit executable functions are set. For any contract executable function, when the execution result is obtained after calling the contract executable function, the conditions for publishing a contract event are met, and a contract event corresponding to the contract executable function is generated based on the execution result. Similarly, for any unit executable function, when the execution result is obtained after calling the unit executable function, the conditions for publishing a unit event are met, and a unit event corresponding to the unit executable function is generated based on the execution result.

[0079] Specifically, contract executable functions can generate contract events during execution, and unit executable functions can generate unit events during execution. For example, to ensure consistency across execution nodes within a process function, after the process function completes execution, the execution results and process number can be notified to the operators of each execution node via process status events. These process status events provide progress updates to the operators of each execution node.

[0080] It is understandable that generating contract events or unit events can provide operational prompts to external systems, facilitating subsequent processing of smart contracts.

[0081] In this embodiment of the invention, when the current executable function is a contract executable function in the target smart contract template, the contract operable personnel information in the target smart contract template is used as the current operable personnel information associated with the current executable function; when the current executable function is a unit executable function in any executable unit, the unit executable personnel information in that executable unit is used as the current operable personnel information associated with the current executable function. This expands the scope of current operable personnel information, increasing its richness and broadening the application range of the target smart contract template, thus improving its versatility.

[0082] Example 3

[0083] Figure 3 This is a schematic diagram of the structure of a blockchain-based smart contract processing device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: an executable node determination module 310, a personnel information determination module 320, an authentication module 330, and an execution result determination module 340. Among them,

[0084] The executable node determination module 310 is used to determine the current executable node to be called from the candidate executable nodes in the process function in response to the call request of the process function in the target smart contract instance; the current executable node is associated with the current executable function; the target smart contract instance is obtained by instantiating the target smart contract template in advance;

[0085] The personnel information determination module 320 is used to determine the currently operable personnel information associated with the currently executable function;

[0086] The authentication module 330 is used to authenticate the initiator of the call request based on the information of the currently operable personnel.

[0087] The execution result determination module 340 is used to call the currently executable function to obtain the current execution result if the authentication is successful, and write the current execution result into the blockchain.

[0088] The blockchain-based smart contract processing solution provided in this invention responds to a call request for a process function in a target smart contract instance by using an executable node determination module to determine the current executable node to be called from candidate executable nodes in the process function; the current executable node is associated with the current executable function; the target smart contract instance is obtained by pre-instantiating a target smart contract template; a personnel information determination module determines the currently operable personnel information associated with the current executable function; an authentication module authenticates the initiator of the call request based on the currently operable personnel information; and an execution result determination module, if authentication is successful, calls the current executable function to obtain the current execution result and writes the current execution result into the blockchain. This solution, by determining the current executable function through the process function in the target smart contract instance and using the currently operable personnel information associated with the current executable function to authenticate the caller of the smart contract, improves the flexibility and reliability of smart contract processing, thereby increasing the operating efficiency of smart contracts. Furthermore, obtaining the target smart contract instance by instantiating the target smart contract template greatly improves the efficiency of smart contract reuse and composition.

[0089] Optionally, in a blockchain-based smart contract processing device, the target smart contract template includes an executable unit, information on the contract's operable personnel, and executable functions; the executable unit includes information on the unit's executable personnel and executable functions.

[0090] The personnel information determination module includes:

[0091] The first personnel information determination unit is used to, when the current executable function is a contract executable function in the target smart contract template, use the contract operable personnel information in the target smart contract template as the current operable personnel information associated with the current executable function;

[0092] The second personnel information determination unit is used to, when the current executable function is a unit executable function in any executable unit, use the unit executable personnel information in the executable unit as the currently operable personnel information associated with the current executable function.

[0093] Optionally, the device may also include:

[0094] The contract event generation module is used to generate a contract event after calling the current executable function to obtain the current execution result, provided that the current executable function is a contract executable function in the target smart contract template and the current execution result meets the publication conditions of any contract event in the target smart contract template.

[0095] The unit event generation module is used to generate a unit event after calling the current executable function to obtain the current execution result, provided that the current executable function is a unit executable function in any executable unit, and the current execution result meets the publication conditions of any unit event in that executable unit.

[0096] Optionally, the device may also include:

[0097] Based on the business scenario information, configure the information of the personnel who can operate the contract, and configure the information of the personnel who can execute the unit in the executable unit;

[0098] Based on the contract parameter template in the target smart contract template, configure the contract's executable functions according to the business scenario information;

[0099] Based on the unit parameter template in the executable unit, the unit executable function is configured according to the business scenario information.

[0100] Optionally, the executable node determination module 310 includes:

[0101] Based on the previous execution result of the previous executable node in the flow function, determine the current executable node to be called from the candidate executable nodes in the flow function.

[0102] Optionally, after the execution result determination module 340, the following also includes:

[0103] The execution result acquisition module is used to obtain the execution results of each executable node in the process function from the blockchain when the current executable node is the tail executable node in the process function;

[0104] The call result determination module is used to determine the call result of the process function based on the execution result of each executable node.

[0105] The blockchain-based smart contract processing device provided in this embodiment of the invention can execute the blockchain-based smart contract processing method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing each blockchain-based smart contract processing method.

[0106] Example 4

[0107] Figure 4 This is a schematic diagram of the structure of an electronic device 10 implementing a blockchain-based smart contract processing method, according to Embodiment 4 of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptops, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0108] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0109] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0110] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing unit (CPU), graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as blockchain-based smart contract processing methods.

[0111] In some embodiments, the blockchain-based smart contract processing method can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the blockchain-based smart contract processing method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to execute the blockchain-based smart contract processing method by any other suitable means (e.g., by means of firmware).

[0112] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0113] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0114] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0116] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0117] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0118] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0119] 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 be made according to 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 blockchain-based smart contract processing method, characterized in that, include: In response to a call request for a process function in a target smart contract instance, the current executable node to be called is determined from the candidate executable nodes in the process function; the current executable node is associated with the current executable function. The target smart contract instance is obtained by pre-instantiating the target smart contract template; Determine the currently operable personnel information associated with the currently executable function; Based on the currently available personnel information, the initiator of the call request is authenticated; If authentication is successful, the currently executable function is invoked to obtain the current execution result, and the current execution result is written into the blockchain; The target smart contract template includes an executable unit, information on the contract's operable personnel, and executable functions; the executable unit includes information on the unit's executable personnel and executable functions. The determination of the currently operable personnel information associated with the currently executable function includes: If the currently executable function is a contract executable function in the target smart contract template, the contract operable personnel information in the target smart contract template is used as the current operable personnel information associated with the currently executable function; wherein, the contract operable personnel information is used to identify the executable permissions of the contract executable function and the process function. When the currently executable function is a unit executable function in any executable unit, the unit executable personnel information in that executable unit is used as the currently operable personnel information associated with the currently executable function; wherein, the unit executable personnel information is used to limit the permissions of the operator of the unit executable function and determine whether the operator has the permission to execute.

2. The method according to claim 1, characterized in that, After obtaining the current execution result by calling the currently executable function, the method further includes: If the currently executable function is a contract executable function in the target smart contract template, and the current execution result satisfies the publication conditions of any contract event in the target smart contract template, then the contract event is generated. If the current executable function is a unit executable function in any executable unit, and the current execution result satisfies the publication conditions of any unit event in that executable unit, then the unit event is generated.

3. The method according to claim 1, characterized in that, Also includes: Based on the business scenario information, configure the information of the personnel who can operate the contract, and configure the information of the personnel who can execute the unit in the executable unit; Based on the contract parameter template in the target smart contract template, the executable functions of the contract are configured according to the business scenario information; Based on the unit parameter template in the executable unit, the executable function of the unit is configured according to the business scenario information.

4. The method according to any one of claims 1-3, characterized in that, The current executable node to be called is determined from the candidate executable nodes in the flow function, including: Based on the previous execution result of the previous executable node in the flow function, determine the current executable node to be called from the candidate executable nodes in the flow function.

5. The method according to any one of claims 1-3, characterized in that, After calling the currently executable function to obtain the current execution result and writing the current execution result into the blockchain, the method further includes: If the current executable node is the tail executable node in the process function, the execution results of each executable node in the process function are obtained from the blockchain; Based on the execution results of each executable node, the call result of the process function is determined.

6. A blockchain-based smart contract processing device, characterized in that, include: An executable node determination module is used to determine the current executable node to be called from the candidate executable nodes in the process function in response to a call request for a process function in the target smart contract instance; the current executable node is associated with the current executable function; The target smart contract instance is obtained by pre-instantiating the target smart contract template; The personnel information determination module is used to determine the currently operable personnel information associated with the currently executable function; The authentication module is used to authenticate the initiator of the call request based on the currently operable personnel information; The execution result determination module is used to call the currently executable function to obtain the current execution result if the authentication is successful, and write the current execution result into the blockchain; The target smart contract template includes an executable unit, information on the contract's operable personnel, and executable functions; the executable unit includes information on the unit's executable personnel and executable functions. The personnel information determination module includes: The first personnel information determination unit is used to, when the current executable function is a contract executable function in the target smart contract template, use the contract operable personnel information in the target smart contract template as the current operable personnel information associated with the current executable function; wherein, the contract operable personnel information is used to identify the executable permissions of the contract executable function and the process function's operator; The second personnel information determination unit is used to, when the current executable function is a unit executable function in any executable unit, use the unit executable personnel information in the executable unit as the current operable personnel information associated with the current executable function; wherein, the unit executable personnel information is used to limit the permissions of the operator of the unit executable function and determine whether the operator has the permission to execute.

7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the blockchain-based smart contract processing method according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the blockchain-based smart contract processing method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Authority management method and device for block chain system, equipment and medium

    CN110096857A

  • Chain code function processing method, device and equipment

    CN110163572A