Intelligent contract execution method and system, electronic equipment and readable medium
By dividing the centralized system into a smart contract management module, an operation module, and an interconnection module, the problems of unclear management and insufficient security of smart contract systems outside the blockchain architecture are solved, and efficient and secure smart contract operation is achieved.
Patent Information
- Application Number
- CN202411827178.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2026-02-24
AI Technical Summary
Traditional smart contracts in centralized systems outside of blockchain architecture suffer from unclear management responsibilities, limited execution efficiency, and insufficient security, and are particularly prone to disputes in multi-module environments.
The system adopts a non-blockchain distributed architecture, dividing the smart contract system into a smart contract management module, an operation module, and an interconnection module. By clarifying the operating entities of each module, centralized management and distributed operation are achieved, and security and reliability are ensured through dual contract validity checks.
It improves the efficiency of smart contract operation systems, ensures the security and reliability of cross-module transactions, and overcomes the problems of unclear management and insufficient security in blockchain systems.
Smart Images

Figure CN121563522A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to smart contract execution methods, systems, electronic devices, and readable media. Background Technology
[0002] Traditional smart contracts typically run on blockchain-based systems, usually public or consortium blockchains. This decentralized architecture ensures the immutability of smart contracts, but it also leads to unclear management responsibilities and limited operational efficiency. Running smart contracts on a non-blockchain centralized system often prevents parallel execution, further impacting system efficiency. While setting up multiple smart contract execution modules within a non-blockchain centralized system can improve overall efficiency, the execution results of each module are susceptible to tampering, potentially causing disputes and making it difficult to balance efficiency and security. Summary of the Invention
[0003] This disclosure provides a smart contract execution method, system, electronic device, and readable medium, which can realize centralized management and distributed operation of smart contracts, while ensuring the execution efficiency of smart contracts as well as the security and reliability of data.
[0004] To achieve the above technical objectives, the embodiments of this disclosure adopt the following technical solutions:
[0005] In a first aspect, embodiments of this disclosure provide a smart contract execution method, the method comprising:
[0006] The first smart contract execution module performs a first local contract validity check on the first contract instance based on the smart contract call instruction. The smart contract call instruction includes a first contract wallet identifier, which is associated with the first contract instance to be called. If the first local contract validity check passes, the first smart contract execution module loads the first contract instance into the virtual machine for execution and generates a transaction instruction. The first smart contract execution module executes the transaction instruction, and if it determines that the transaction instruction is a cross-module transaction instruction, it sends a cross-module transaction request to the smart contract interoperability module.
[0007] The smart contract interoperability module sends cross-module transaction requests to the smart contract management module;
[0008] The smart contract management module performs a validity check on the central contract and feeds back the results of the validity check to the smart contract interoperability module.
[0009] If the inspection result is passed, the smart contract interoperability module sends a cross-module transaction request to the second smart contract execution module and receives a cross-module transaction response generated by the second smart contract execution module based on the cross-module transaction request;
[0010] The first smart contract execution module responds to the cross-module transaction response forwarded by the smart contract interoperability module by submitting contract data to the smart contract management module through the smart contract interoperability module.
[0011] In some possible implementations, the first contract instance is deployed according to the following steps:
[0012] The first smart contract execution module receives, verifies, and forwards smart contract deployment requests;
[0013] The smart contract management module verifies the contract deployment permission of the first smart contract execution module. If the verification is successful, it registers the contract information of the first contract instance and sends the deployment instruction of the first contract instance.
[0014] The first smart contract execution module deploys the first contract instance according to the deployment instructions.
[0015] In some possible implementations, the smart contract deployment request is generated and sent by the user's wallet, which includes the user's wallet identifier and the instance identifier of the first contract instance. The method further includes:
[0016] The first smart contract execution module authenticates the user based on the user's wallet identifier and returns the deployment result of the first contract instance to the user's wallet.
[0017] In some possible implementations, smart contract call instructions are sent by the user's wallet or automatically generated based on preset conditions.
[0018] In some possible implementations, the method further includes:
[0019] The first smart contract execution module executes the transaction instruction. If the transaction instruction is determined to be an intra-module transaction instruction, the module submits the contract data to the smart contract management module through the smart contract interconnection module.
[0020] In some possible implementations, the cross-module transaction request includes a first contract wallet identifier and a second contract wallet identifier, wherein the second contract wallet identifier is associated with the second contract instance to be invoked;
[0021] The smart contract management module performs a central contract validity check on the first and second contract instances.
[0022] In some possible implementations, the method further includes:
[0023] The second smart contract execution module performs a second local contract validity check on the second contract instance based on the cross-module transaction request. If the second local contract validity check passes, the second contract instance is loaded into the virtual machine for execution to generate a cross-module transaction response.
[0024] Secondly, embodiments of this disclosure provide a smart contract execution system, the system comprising:
[0025] The first smart contract execution module is configured to perform a first local contract validity check on the first contract instance according to the smart contract call instruction, wherein the smart contract call instruction includes a first contract wallet identifier, which is associated with the first contract instance to be called; if the first local contract validity check passes, the first contract instance is loaded into the virtual machine for execution and a transaction instruction is generated; the transaction instruction is executed, and if the transaction instruction is determined to be a cross-module transaction instruction, a cross-module transaction request is sent to the smart contract interoperability module; in response to receiving the cross-module transaction response forwarded by the smart contract interoperability module, the module submits contract data to the smart contract management module through the smart contract interoperability module.
[0026] The smart contract interoperability module is configured to send cross-module transaction requests to the smart contract management module; if the central contract validity check of the smart contract management module passes, the smart contract interoperability module sends cross-module transaction requests to the second smart contract execution module and receives cross-module transaction responses generated by the second smart contract execution module based on the cross-module transaction requests.
[0027] The smart contract management module is configured to perform a central contract validity check and report the check results to the smart contract interoperability module.
[0028] Thirdly, embodiments of this application provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in the first aspect.
[0029] Fourthly, embodiments of this application provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in the first aspect.
[0030] The technical solution of the first aspect provided by the embodiments of this disclosure brings at least the following beneficial effects: A first smart contract execution module performs a first local contract validity check on a first contract instance according to a smart contract call instruction; if the first local contract validity check passes, the first contract instance is loaded into a virtual machine for execution, and a transaction instruction is generated; the transaction instruction is executed, and if it is determined that the transaction instruction is a cross-module transaction instruction, a cross-module transaction request is sent to the smart contract interoperability module; the smart contract interoperability module sends the cross-module transaction request to the smart contract management module; the smart contract management module performs a central contract validity check and feeds back the check result of the central contract validity check to the smart contract interoperability module; if the check result passes, the smart contract interoperability module sends a cross-module transaction request to a second smart contract execution module and receives a cross-module transaction response generated by the second smart contract execution module according to the cross-module transaction request; in response to receiving the cross-module transaction response forwarded by the smart contract interoperability module, the first smart contract execution module submits contract data to the smart contract management module through the smart contract interoperability module. The embodiments disclosed herein employ a non-blockchain distributed architecture to implement a smart contract execution system. By dividing the system into a smart contract management module, a smart contract execution module, and a smart contract interconnection module, the operating entities of each module are clearly defined, thereby clarifying the management responsibilities of the smart contract execution system and overcoming the problems of blockchain systems. By horizontally expanding the smart contract execution module, centralized management and distributed operation of smart contracts are achieved, improving the efficiency of the smart contract execution system. At the same time, through two contract validity checks by the smart contract management module and the smart contract execution module, the mandatory nature of smart contracts is ensured, guaranteeing the security and reliability of cross-module transaction data in non-blockchain environments.
[0031] It should be noted that the technical effects of any of the implementation methods in the second to fourth aspects can be found in the technical effects of the corresponding implementation methods in the first aspect, and will not be repeated here.
[0032] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0033] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments of this disclosure will be briefly described below. Clearly, the drawings described below only relate to some embodiments of this disclosure and are not intended to limit the scope of this disclosure.
[0034] Figure 1 A schematic diagram of a smart contract execution system according to at least one embodiment of the present disclosure is shown;
[0035] Figure 2A flowchart of a smart contract execution method according to at least one embodiment of the present disclosure is shown;
[0036] Figure 3 A schematic diagram of the interaction flow of a smart contract deployment method according to at least one embodiment of the present disclosure is shown;
[0037] Figure 4 A schematic diagram of the interaction flow of a smart contract execution method within a module according to at least one embodiment of the present disclosure is shown;
[0038] Figure 5 A flowchart illustrating the interaction process of a smart contract execution method within a module according to at least one embodiment of the present disclosure is shown.
[0039] Figure 6 A schematic diagram of the interaction flow of a cross-module smart contract execution method according to at least one embodiment of the present disclosure is shown;
[0040] Figure 7 A flowchart illustrating the interactive steps of a smart contract deployment method according to at least one embodiment of the present disclosure is shown.
[0041] Figure 8 A flowchart illustrating the interactive steps of a smart contract execution method according to at least one embodiment of the present disclosure is shown.
[0042] Figure 9 A schematic diagram of an electronic device according to at least one embodiment of the present disclosure is shown;
[0043] Figure 10 A schematic diagram of a computer-readable medium according to at least one embodiment of the present disclosure is shown. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the described embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0045] In the following text, any methods, apparatus, examples, and contents that do not fully correspond to the scope defined by the claims are not derived from the present invention. Such methods, apparatus, examples, and contents, as well as all subsequent descriptions, are for illustrative purposes only, or to highlight specific aspects or features of the claims.
[0046] Note that the examples described below are merely specific examples and are not intended to limit the embodiments of this disclosure to the specific shapes, hardware, connections, operations, values, conditions, data, sequences, etc., shown and described. Those skilled in the art can utilize the concepts of this disclosure to construct further embodiments not mentioned herein by reading this specification.
[0047] The terminology used in this disclosure is that which is currently widely used in the art in consideration of the functionality of this disclosure; however, these terms may vary depending on the intent, precedent, or new technology of those skilled in the art. Furthermore, specific terms may be chosen by the applicant, and in such cases, their detailed meanings will be described in the detailed description of this disclosure. Therefore, the terminology used in this specification should not be construed as simple names, but rather based on the meaning of the terms and the overall description of this disclosure.
[0048] To better understand the embodiments of this disclosure, the relevant terms involved in this disclosure will first be defined and explained.
[0049] A smart contract is a self-executing computer program that automatically executes its terms when preset conditions are met. Smart contracts typically contain a set of predefined rules, according to which the parties involved agree to interact with each other. Deploying a smart contract instance refers to deploying the smart contract code into an execution entity, making it an executable contract entity. The smart contracts in this disclosure embodiment run on a non-blockchain system.
[0050] It should be noted that the technical solutions in this disclosure, including the collection, updating, analysis, processing, use, transmission, and storage of user personal information, all comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken to prevent unauthorized access to user personal information data and to safeguard user personal information security, network security, and national security.
[0051] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0052] Figure 1 A schematic diagram of a smart contract execution system 100 according to at least one embodiment of the present disclosure is shown. The smart contract deployment and execution system of the present disclosure includes a smart contract management module 110 and one or more smart contract execution modules (e.g., Figure 1The first smart contract running module 120 Figure 6 The system comprises a second smart contract execution module 150, a smart contract interconnection module 130, and a user wallet 140. The smart contract management module 110 is responsible for the unified registration and management of smart contracts, providing mandatory validity checks, verifying the execution of smart contract code, and ensuring the enforceability of smart contracts. It could be, for example, a central bank or other centralized smart contract review, management, and supervision organization. The smart contract execution module is an operating institution that builds, manages, and maintains the operating environment according to standards. For example, in a central bank digital currency system, it is the operating institution. The smart contract interconnection module 130 provides transfer control services between the smart contract management module 110 and the smart contract execution module, or between multiple smart contract execution modules, and connects smart contracts. It is a centralized institution and can be a trusted third party or a central bank. The smart contract execution system 100 of this embodiment clarifies the management responsibilities of each module and allows for horizontal expansion of the smart contract execution module, thereby improving system efficiency.
[0053] The smart contract management module 110 is a centralized entity, and there can be one or more smart contract execution modules, thereby achieving centralized management of the smart contract management module 110 and distributed operation of the smart contract execution modules. Taking the first smart contract execution module 120 as an example, it includes a smart contract execution environment 121 and a core system 122. The core system 122 provides underlying digital currency capabilities such as ledger, payment, and wallet management, including modules such as ledger 1221, payment transaction 1222, and wallet management 1223. When calling a smart contract, the smart contract execution environment 121 can load the smart contract into virtual machine a1211, virtual machine b1212, or virtual machine c1213, and interact with the core system 122 through the environment interface to complete the transaction. The smart contract management module 110 includes a contract information registration module 111, which is used to register the smart contracts and contract information deployed on the smart contract execution module, and also includes an execution permission management module 112, which can verify the permissions of the smart contract execution module during the execution of the smart contract. The smart contract interconnection module 130 may include an information transfer module 131, which supports interaction between multiple smart contract running modules in cross-module transactions, as well as between smart contract running modules and smart contract management module 110. Therefore, this embodiment of the disclosure provides cross-module contract transaction capabilities.
[0054] The user wallet 140 includes a smart contract deployment module 141 for initiating a contract deployment request to the smart contract execution module to achieve contract deployment; and further includes a smart contract invocation module 142, which can initiate a smart contract invocation instruction to the smart contract execution module when a smart contract needs to be invoked. It is understood that during the execution of the smart contract in this embodiment, the smart contract invocation instruction can be initiated by the user wallet 140 or automatically generated according to preset conditions for smart contract execution.
[0055] Figure 2 A flowchart of a smart contract execution method 200 based on a smart contract execution system 100 according to at least one embodiment of the present disclosure is shown, specifically including the following steps:
[0056] In step S210, the first smart contract execution module 120 performs a first local contract validity check on the first contract instance according to the smart contract call instruction. The smart contract call instruction includes a first contract wallet identifier, which is associated with the first contract instance to be called. If the first local contract validity check passes, the first contract instance is loaded into the virtual machine for execution and a transaction instruction is generated. The transaction instruction is executed, and if it is determined that the transaction instruction is a cross-module transaction instruction, a cross-module transaction request is sent to the smart contract interoperability module 130.
[0057] Understandably, before invoking the smart contract, there is also a smart contract deployment process, including the first smart contract execution module 120 receiving, verifying and forwarding the smart contract deployment request; the smart contract management module 110 verifying the contract deployment permission of the first smart contract execution module 120, and if the verification is successful, registering the contract information of the first contract instance and sending the deployment instruction of the first contract instance; the first smart contract execution module 120 deploying the first contract instance according to the deployment instruction.
[0058] Optionally, the smart contract deployment request is generated and sent by the user wallet 140, which includes the user wallet 140 identifier and the instance identifier of the first contract instance. The first smart contract execution module 120 performs user authentication based on the user wallet 140 identifier and returns the deployment result of the first contract instance to the user wallet 140. The smart contract call instruction is sent by the user wallet 140 or automatically generated according to preset conditions. The preset conditions are, for example, triggered by a "timed" event or triggered after a "specific event" occurs, such as flight takeoff and landing, train departure and arrival, etc., which can be set as needed, and this disclosure does not limit it.
[0059] The smart contract execution method of this disclosure also applies to intra-module transactions. For example, if it is determined that the transaction instruction is not a cross-module transaction instruction but an intra-module transaction instruction, the first smart contract execution module 120 executes the transaction instruction and directly submits the contract data to the smart contract management module through the smart contract interconnection module to complete the contract execution.
[0060] Optionally, in cross-module transactions, the second contract instance of the second smart contract execution module 150 can also be invoked. In this case, the cross-module transaction request may include the first contract wallet identifier of the first smart contract execution module 120 and the second contract wallet identifier of the second smart contract execution module 150, wherein the second contract wallet identifier is associated with the second contract instance to be invoked. The smart contract management module 110 can simultaneously perform a central contract validity check on both the first and second contract instances. Based on the cross-module transaction request, the second smart contract execution module 150 performs a second local contract validity check on the second contract instance. If the second local contract validity check passes, the second contract instance is loaded into the virtual machine within the second smart contract execution module 150 for execution to generate a cross-module transaction response. The smart contract execution method in the second smart contract execution module 150 is consistent with the smart contract execution method in the first smart contract execution module 120, and will not be detailed here.
[0061] In step S220, the smart contract interconnection module 130 sends a cross-module transaction request to the smart contract management module 110.
[0062] In step S230, the smart contract management module 110 performs a central contract validity check and reports the check result to the smart contract interoperability module 130. It is understood that during smart contract deployment, the smart contract management module 110 registers the contract information of the first contract instance and can perform a central contract validity check on the first contract instance in cross-module transaction requests based on the registered contract information. When the cross-module transaction request also includes a second contract wallet identifier, the central contract validity check can be performed on the second contract instance based on the contract information registered during its deployment. The central contract validity check serves as a second layer of protection in non-blockchain systems, ensuring the mandatory validity of smart contracts and effectively improving the security and reliability of transaction data.
[0063] In step S240, if the check result is passed, the smart contract interoperability module 130 sends a cross-module transaction request to the second smart contract execution module 150 and receives the cross-module transaction response generated by the second smart contract execution module 150 based on the cross-module transaction request.
[0064] In step S250, the first smart contract execution module 120 responds to the cross-module transaction response forwarded by the smart contract interoperability module 130, submits contract data to the smart contract management module through the smart contract interoperability module, and completes contract execution.
[0065] The smart contract operation method of this disclosure includes three core steps: First, the smart contract is deployed to the smart contract operation module through the smart contract management module 110, and the smart contract management module 110 registers the contract information of the smart contract during this process; Second, the smart contract is initiated by the user wallet or automatically triggered by the system, and the smart contract operation module starts running after checking the validity of the triggered smart contract, forming a mandatory first layer of protection; Third, the running smart contract communicates through the smart contract interconnection module 130, and the smart contract interconnection module 130 sends a request to the smart contract management module 110 to check the validity of the communicating smart contracts before forwarding the communication messages, forming a mandatory second layer of protection. Therefore, the embodiments of this disclosure adopt a non-blockchain distributed architecture to implement the smart contract operation system. By dividing the system into a smart contract management module 110, a smart contract operation module, and a smart contract interconnection module 130, the operating entities of each module are clearly defined, thereby clarifying the management responsibilities of the smart contract operation system and overcoming the problems of blockchain systems. By horizontally expanding the smart contract operation module, centralized management and distributed operation of smart contracts are achieved, improving the efficiency of the smart contract operation system. At the same time, through two contract validity checks by the smart contract management module and the smart contract operation module, the mandatory nature of smart contracts is ensured, guaranteeing the security and reliability of cross-module transaction data in non-blockchain situations.
[0066] Figure 3 A schematic diagram of the interaction flow of a smart contract deployment method according to at least one embodiment of the present disclosure is shown; Figure 7 A flowchart illustrating the interactive steps of a smart contract deployment method 700 according to at least one embodiment of the present disclosure is shown. Figure 3 The smart contract management module 110 interacts directly with the first smart contract execution module 120. Figure 7 The smart contract management module 110 and the first smart contract operation module 120 interact indirectly through the smart contract interconnection module 130. Both methods can be used to deploy smart contracts, and this disclosure does not limit them.
[0067] In step S301, the user sends a smart contract deployment request to the first smart contract execution module 120 through the user wallet 140 (step S701), requesting the deployment of a smart contract. This smart contract deployment request includes the contract product ID to be invoked (i.e., determining the contract instance to be deployed based on the contract product ID). Optionally, the smart contract deployment request may also include a user wallet identifier (used to identify the user wallet 140), a contract product version number, an identifier for the first smart contract execution module 120, a smart contract service provider identifier (used to identify the smart contract service provider, which can provide basic payment capabilities and provide services externally by overlaying smart contracts during the smart contract deployment process; for example, in a central bank digital currency system, it can be an operating institution, a peer-to-peer cooperative institution, an acceptance service institution, etc.), and contract product deployment parameters.
[0068] In step S302, the core system 122 of the first smart contract execution module 120 receives the smart contract deployment request, verifies the request (step S702), and completes the authentication of the user wallet 140. If authentication is successful, the smart contract deployment request is forwarded to the information transfer module 131 of the smart contract interconnection module 130, and then sent to the smart contract management module 110 (step S703); optionally, the first smart contract execution module 120 can directly send the smart contract deployment request to the smart contract management module 110. If authentication fails, optionally, a deployment failure result is returned to the user wallet 140 (step S703'). When forwarding the smart contract deployment request, the first smart contract execution module 120 can modify the message format of the original smart contract deployment request as needed.
[0069] It's important to note that during smart contract deployment, after a user initiates a smart contract deployment request through user wallet 140 to deploy a contract instance, the wallet controlled by the contract instance becomes the contract wallet. Specifically, if the contract instance directly controls the user wallet 140 that initiated the deployment request, then user wallet 140 is the contract wallet, and the user wallet identifier is the contract wallet identifier. If the contract instance generates a sub-wallet under user wallet 140, and the contract instance controls this sub-wallet, then this sub-wallet is the contract wallet, and its identifier is the contract wallet identifier. The contract wallet identifier is associated with the contract instance that controls it. To enable invocation and permission verification for this contract instance, the forwarded smart contract deployment request may include the contract wallet ID (i.e., the contract wallet identifier).
[0070] In step S303, the smart contract management module 110 checks the permissions of the first smart contract execution module 120 to determine whether the first contract instance can be deployed (step S704). The permission check can be performed by the smart contract management module 110 maintaining a list of smart contract execution modules and checking whether the first smart contract execution module 120 belongs to that list. If it does, it has the permission to deploy the first contract instance. Alternatively, the smart contract management module 110 can maintain a permission list of smart contract execution modules and smart contracts, searching for deployable smart contracts for the first smart contract execution module 120. If the first contract instance is included, it has the permission to deploy the first contract instance. The smart contract management module 110 can also use other permission management methods to complete the permission check, which are not limited in this disclosure.
[0071] In step S304, after the permission check is passed, the smart contract management module 110 registers the contract information of the first contract instance in the contract information registration module 111 (step S705). The registered contract information may include the instance identifier of the first contract instance, the user wallet identifier, the contract product version number, the identifier of the first smart contract running module 120, the smart contract service provider identifier, the signing time, etc.; if the contract wallet is not the user wallet 140, the contract wallet identifier is also included. The above-mentioned registered contract information is used to perform a central contract validity check during the smart contract call process, and the content of the check matches the registered contract information.
[0072] In step S305, the smart contract management module 110 notifies the first smart contract execution module 120 to deploy the smart contract. Optionally, the smart contract management module 110 directly sends the deployment instruction of the first contract instance to the first smart contract execution module 120; or, the smart contract management module 110 sends the deployment instruction of the first contract instance to the information transfer module 131 of the smart contract interconnection module 130, and then forwards it to the first smart contract execution module 120 through the information transfer module 131 (step S706).
[0073] Step S306, the first smart contract execution module 120 deploys the smart contract (step S707); optionally, the user wallet 140 is further notified of the deployment result (step S708).
[0074] Figure 4 A schematic diagram illustrating the interaction flow of a smart contract execution method within a module according to at least one embodiment of the present disclosure is shown. In this embodiment, the smart contract execution method is triggered by a user to run the smart contract. The specific steps are as follows:
[0075] In step S401, the user initiates a smart contract call instruction through user wallet 140. The call instruction may include a first contract wallet identifier, and the first contract instance to be called is determined based on its association with the first contract instance to be called. Optionally, the instance identifier of the first contract instance may also be included in the smart contract call instruction. If it is a transfer transaction, the call instruction may also include optional information such as the recipient's wallet identifier, the payer's wallet identifier, and the transaction amount. If the counterparty's wallet is also controlled by the contract, it may also include counterparty-related information such as the payer's contract wallet identifier or the recipient's contract wallet identifier to determine the second contract instance to be called. Optionally, the instance identifier of the second contract instance to be called may also be included directly. If relevant parameters need to be configured when calling the contract, the call instruction may also include contract call parameters.
[0076] In step S402, the core system 122 of the first smart contract running module 120 authenticates the user wallet 140, and triggers the first contract instance when the authentication is successful.
[0077] In step S403, the smart contract runtime environment 121 of the first smart contract runtime module 120 performs a first local contract validity check. If the check passes, the first contract instance is loaded into the virtual machine a 1211 for execution, and a transaction instruction is generated. The first local contract validity check is performed based on the information included in the smart contract call instruction, and may include: checking whether the user wallet 140 or the contract wallet has the calling permission for the first contract instance, whether the contract call parameters meet the requirements, whether the status of the first contract instance is valid, and whether the status of the contract product associated with the first contract instance is valid.
[0078] In step S404, the core system 122 of the first smart contract running module 120 executes the transaction instruction, performs payment transactions and wallet management. If it is determined that the transaction instruction is an intra-module transaction instruction, the transaction is completed, and the contract data is submitted to the smart contract management module through the smart contract interconnection module.
[0079] In step S405, the first smart contract execution module 120 notifies the user wallet 140 of the execution result of the first contract instance.
[0080] Figure 5 A flowchart illustrating the interaction process of a smart contract execution method within a module according to at least one embodiment of the present disclosure is shown. In this embodiment, the smart contract is automatically triggered for execution by the system, wherein steps S502-S504 are... Figure 4 The steps S403-S405 are the same, and will not be repeated here.
[0081] In step S501, the first smart contract running module 120 automatically calls the first contract instance to run according to preset conditions; the preset conditions are, for example, "timed" triggering or triggering after a "specific event" occurs, such as flight take-off and landing, train departure and arrival, etc., which can be set as needed, and this disclosure does not limit them.
[0082] Figure 6 A schematic diagram of the interaction flow of a cross-module smart contract execution method according to at least one embodiment of the present disclosure is shown; Figure 8 A flowchart illustrating the interactive steps of a smart contract execution method 800 according to at least one embodiment of the present disclosure is shown.
[0083] In step S709, the user initiates a smart contract call instruction through the user wallet 140; the fields of the call instruction can be referred to in step S401. The core system 122 of the first smart contract running module 120 authenticates the user wallet 140 and triggers the first contract instance when the authentication is successful; alternatively, the first smart contract running module 120 can also automatically call the first contract instance to run according to preset conditions.
[0084] In step S710, the smart contract runtime environment 121 of the first smart contract runtime module 120 performs a first local contract validity check. The first local contract validity check is performed based on the information included in the smart contract call instruction, and may include: checking whether the user wallet 140 or the contract wallet has the calling permission of the first contract instance, whether the contract call parameters meet the requirements, whether the status of the first contract instance is valid, and whether the status of the contract product associated with the first contract instance is valid, etc.
[0085] Step S711: If the check passes, the first contract instance is loaded into the virtual machine a 1211 for execution; if the check fails, optionally, the call result of the call failure is returned to the user wallet 140.
[0086] Step S712: Generate transaction instructions for payment transactions and wallet management.
[0087] In step S713, the core system 122 of the first smart contract running module 120 executes transaction instructions to perform payment transactions and wallet management.
[0088] Step S714: Determine whether the transaction instruction is a cross-module transaction instruction. Specifically, for example, determine whether the counterparty's wallet is a wallet of this smart contract execution module, or whether the called second contract instance is deployed in this smart contract execution module.
[0089] In step S715, if it is determined that the transaction instruction is a cross-module transaction instruction, the first smart contract execution module 120 sends a cross-module transaction request to the smart contract interoperability module 130 (step S601). The cross-module transaction request may include the first contract wallet identifier, the instance identifier of the first contract instance, the recipient wallet identifier, the payer wallet identifier, the transaction amount, and other money transfer transaction instructions. It may also include the second contract wallet identifier, the instance identifier of the second contract instance, the identifier of the second smart contract execution module 150, contract call parameters, etc. The smart contract interoperability module 130 sends a cross-module transaction request to the smart contract management module 110 (step S602).
[0090] In step S716, the smart contract management module 110 performs a central contract validity check based on the registered smart contract information. The check may include: whether the first smart contract execution module 120 has the authority to call the first contract instance; whether the first contract wallet is valid; whether the contract call parameters are compliant; whether the contract execution result is correct; whether the second smart contract execution module 150 involved in the cross-module transaction request is correct; whether the second contract wallet is valid; whether the second smart contract execution module 150 has the authority to call the second contract instance; whether the status of the first and second contract instances is valid; and whether the status of the contract products associated with each contract instance is valid.
[0091] Step S717, the smart contract management module 110 sends the check result of the central contract validity check to the smart contract interconnection module 130 (step S603).
[0092] Step S718: If the smart contract interoperability module 130 determines that the validity check of the central contract has passed, then step S719: the smart contract interoperability module 130 forwards the cross-module transaction request to the second smart contract running module 150 (step S604).
[0093] In step S720, optionally, if the second smart contract execution module 150 needs to call the second contract instance, the second smart contract execution module 150 performs a second local contract validity check on the cross-module transaction request. The content of the second local contract validity check includes the contract's calling permissions and contract calling parameters, whether the status of the second contract instance is valid, and whether the status of the contract product associated with the second contract instance is valid.
[0094] In step S721, if the validity check of the second local contract passes, the second contract instance is loaded into the virtual machine for execution, transaction instructions are generated, and the transaction instructions are further executed to complete the payment transaction and wallet management.
[0095] In step S722, the second smart contract execution module 150 generates a cross-module transaction response.
[0096] Step S723, the second smart contract execution module 150 returns a cross-module transaction response to the smart contract interconnection module 130 (step S605).
[0097] In step S724, the smart contract interoperability module 130 returns the cross-module transaction response to the first smart contract execution module 120 (step S606).
[0098] Step S725: Submit contract data to the smart contract management module 110 through the smart contract interconnection module 130 to complete contract execution.
[0099] The embodiments disclosed herein employ a non-blockchain distributed architecture to implement a smart contract execution system. By dividing the system into a smart contract management module, a smart contract execution module, and a smart contract interconnection module, the operating entities of each module are clearly defined, thereby clarifying the management responsibilities of the smart contract execution system and overcoming the problems of blockchain systems. By horizontally expanding the smart contract execution module, centralized management and distributed operation of smart contracts are achieved, improving the efficiency of the smart contract execution system. At the same time, through two contract validity checks by the smart contract management module and the smart contract execution module, the mandatory nature of smart contracts is ensured, guaranteeing the security and reliability of cross-module transaction data in non-blockchain environments.
[0100] It should be noted that the above application scenarios are merely exemplary, intended to describe one or more aspects of this disclosure in specific scenarios. However, these aspects are not essential, and various modifications can be made to the application scenario. It is readily understood that the specific application scenarios described in this disclosure are not limited.
[0101] At least some embodiments of this disclosure also provide an electronic device. Figure 9 A schematic diagram of an electronic device 900 according to at least one embodiment of the present disclosure is shown.
[0102] like Figure 9As shown, the electronic device 900 includes one or more processors 910 and a memory 920. The memory 920 includes one or more computer program modules 921. The one or more computer program modules 921 are stored in the memory 920 and are executed by the processor 910. These computer program modules 921 include instructions for executing a smart contract execution method and its additional aspects according to at least one embodiment of the present disclosure. When executed by the processor 910, they can perform one or more steps of the smart contract execution method and its additional aspects according to at least one embodiment of the present disclosure. The memory 920 and the processor 910 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown). For example, the bus can be a Peripheral Component Interconnect Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0103] For example, processor 910 may be a central processing unit (CPU), a digital signal processor (DSP), or other processing unit with data processing and / or program execution capabilities, such as a field-programmable gate array (FPGA). Processor 910 may be a general-purpose processor or a special-purpose processor, capable of controlling other components in electronic device 900 to perform desired functions.
[0104] Exemplarily, memory 920 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules 921 may be stored on the computer-readable storage medium, and processor 910 may run one or more computer program modules 921 to implement various functions of electronic device 900. The computer program modules include multiple computer-executable instructions. Various application programs and various data, as well as various data used and / or generated by the application programs, may also be stored in the computer-readable storage medium.
[0105] For example, electronic device 900 may also include input devices such as touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, and gyroscopes; output devices such as liquid crystal displays, speakers, and vibrators; storage devices such as magnetic tapes and hard disks (HDDs or SDDs); and communication devices such as network interface cards like LAN cards and modems. The communication devices allow electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data and perform communication processing via networks such as the Internet. A drive is connected to the I / O interface as needed. Removable storage media, such as disks, optical disks, magneto-optical disks, and semiconductor memories, are installed on the drive as needed so that computer programs read from them can be installed into the storage device as required.
[0106] For example, the electronic device 900 may further include a peripheral interface (not shown in the figure). This peripheral interface can be various types of interfaces, such as a USB interface, a Lightning interface, etc. The communication device can communicate wirelessly with networks and other devices, such as the Internet, intranets and / or wireless networks such as cellular telephone networks, wireless local area networks (LANs) and / or metropolitan area networks (MANs). Wireless communication can use any of a variety of communication standards, protocols, and technologies, including but not limited to Global System for Mobile Communications (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (W-CDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Bluetooth, Wi-Fi (e.g., based on IEEE 802.11a, IEEE 802.11b, IEEE 802.11g, and / or IEEE 802.11n standards), Voice over Internet Protocol (VoIP), Wi-MAX, protocols for email, instant messaging, and / or Short Message Service (SMS), or any other suitable communication protocol.
[0107] The electronic device 900 can be, for example, a system-on-a-chip (SOC) or a device including the SOC. For instance, it can be any device such as a mobile phone, tablet computer, laptop computer, e-reader, game console, television, digital photo frame, navigator, home appliance, communication base station, industrial controller, server, etc., or any combination of data processing devices and hardware. The embodiments of this disclosure do not limit this. The specific functions and technical effects of the electronic device 900 can be found in the description above of the smart contract execution method and its additional aspects according to at least one embodiment of this disclosure, and will not be repeated here.
[0108] Figure 10 A schematic diagram of a readable storage medium 1000 according to at least one embodiment of the present disclosure is shown.
[0109] like Figure 10 As shown, a computer program 1010 is stored on a readable storage medium 1000, which is a computer-readable storage medium. When the computer program 1010 is executed by a processor, it performs one or more steps of the smart contract execution method and its additional aspects as described above.
[0110] For example, when the program code is read by a computer, the computer can execute the program code stored in the computer storage medium to perform one or more steps to implement, for example, a smart contract execution method and its additional aspects according to at least one embodiment of the present disclosure.
[0111] For example, the readable storage medium may include a memory card of a smartphone, a storage component of a tablet computer, a hard disk of a personal computer, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), flash memory, and other readable storage media or any combination thereof. The readable storage medium 1000 may be a non-transitory readable storage medium.
[0112] At least some of the embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other.
[0113] It should be noted that, in this disclosure, relational terms such as "first," "second," etc., are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0114] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved; that is, the preceding or following operations are not necessarily executed precisely in sequence. Instead, various steps may be processed in reverse order or simultaneously as needed. Furthermore, other operations may be added to these processes, or one or more operations may be removed from these processes.
[0115] The units described in the embodiments of this disclosure can be implemented in software or hardware. The described units can also be located in a processor. The names of these units do not, in some cases, constitute a limitation on the unit itself.
[0116] The following points should be noted regarding this disclosure:
[0117] (1) The accompanying drawings of the embodiments of this disclosure only involve the structures involved in the embodiments of this disclosure. Other structures can be referred to the general design.
[0118] (2) Where there is no conflict, the embodiments of this disclosure and the features in the embodiments can be combined with each other to obtain new embodiments.
[0119] The above are merely exemplary embodiments of this disclosure and are not intended to limit the scope of protection of this disclosure, which is determined by the appended claims.
Claims
1. A method for executing a smart contract, characterized in that, The method includes: The first smart contract execution module performs a first local contract validity check on the first contract instance according to the smart contract call instruction. The smart contract call instruction includes a first contract wallet identifier, which is associated with the first contract instance to be called. If the first local contract validity check passes, the first smart contract execution module loads the first contract instance into the virtual machine for execution and generates a transaction instruction. The first smart contract execution module executes the transaction instruction, and if it determines that the transaction instruction is a cross-module transaction instruction, it sends a cross-module transaction request to the smart contract interoperability module. The smart contract interoperability module sends the cross-module transaction request to the smart contract management module; The smart contract management module performs a central contract validity check and feeds back the check result to the smart contract interoperability module. If the inspection result is passed, the smart contract interoperability module sends the cross-module transaction request to the second smart contract execution module and receives the cross-module transaction response generated by the second smart contract execution module based on the cross-module transaction request; In response to receiving the cross-module transaction response forwarded by the smart contract interoperability module, the first smart contract execution module submits contract data to the smart contract management module through the smart contract interoperability module.
2. The method according to claim 1, characterized in that, The first contract instance is deployed according to the following steps: The first smart contract execution module receives, verifies, and forwards the smart contract deployment request; The smart contract management module verifies the contract deployment permission of the first smart contract execution module. If the verification is successful, it registers the contract information of the first contract instance and sends the deployment instruction of the first contract instance. The first smart contract execution module deploys the first contract instance according to the deployment instruction.
3. The method according to claim 2, characterized in that, The smart contract deployment request is generated and sent by the user's wallet, and includes the user's wallet identifier and the instance identifier of the first contract instance. The method further includes: The first smart contract execution module performs user authentication based on the user wallet identifier and returns the deployment result of the first contract instance to the user wallet.
4. The method according to claim 3, characterized in that, The smart contract call instruction is sent by the user's wallet or automatically generated according to preset conditions.
5. The method according to claim 1, characterized in that, The method further includes: The first smart contract execution module executes the transaction instruction. If it determines that the transaction instruction is an intra-module transaction instruction, it submits contract data to the smart contract management module through the smart contract interconnection module.
6. The method according to claim 1, characterized in that, The cross-module transaction request includes a first contract wallet identifier and a second contract wallet identifier, wherein the second contract wallet identifier is associated with the second contract instance to be invoked; The smart contract management module performs a central contract validity check on the first contract instance and the second contract instance.
7. The method according to claim 6, characterized in that, The method further includes: The second smart contract execution module performs a second local contract validity check on the second contract instance based on the cross-module transaction request. If the second local contract validity check passes, the second contract instance is loaded into the virtual machine for execution to generate the cross-module transaction response.
8. A smart contract execution system, characterized in that, The system includes: The first smart contract execution module is configured to perform a first local contract validity check on a first contract instance according to a smart contract invocation instruction, wherein the smart contract invocation instruction includes a first contract wallet identifier, which is associated with the first contract instance to be invoked; if the first local contract validity check passes, the first contract instance is loaded into a virtual machine for execution and a transaction instruction is generated; the transaction instruction is executed, and if it is determined that the transaction instruction is a cross-module transaction instruction, a cross-module transaction request is sent to the smart contract interoperability module; in response to receiving the cross-module transaction response forwarded by the smart contract interoperability module, contract data is submitted to the smart contract management module through the smart contract interoperability module; The smart contract interoperability module is configured to send the cross-module transaction request to the smart contract management module; if the central contract validity check of the smart contract management module passes, the smart contract interoperability module sends the cross-module transaction request to the second smart contract execution module and receives the cross-module transaction response generated by the second smart contract execution module based on the cross-module transaction request. The smart contract management module is configured to perform a central contract validity check and feed back the check result to the smart contract interconnection module.
9. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Product maintenance support system based on block chain technology
CN116452188A
Data processing method and device based on trusted execution environment, equipment and medium
CN116980163A
Authority control method and equipment
CN117879829A
Blockchain-based bill number allocation method, apparatus and electronic device
US20200234351A1
Systems and methods for microservice execution load balancing in virtual distributed ledger networks
US20200344290A1