Smart contract processing method and device, processor and electronic device
By obtaining the target smart contract parsing component and transaction configuration file, processing and parsing the transaction message, the problem of low efficiency of business smart contracts on blockchain nodes is solved, and efficient business execution is achieved.
Patent Information
- Application Number
- CN202210240967.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-10
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-03-10
AI Technical Summary
When business smart contracts written based on business processing rules are deployed on blockchain nodes, low execution efficiency is caused.
By obtaining the target smart contract parsing component, obtaining the target transaction configuration file according to the target smart contract parsing rules, and processing it through the device of the blockchain node, the target business smart contract is generated, and the target smart contract parsing component and the transaction configuration file are used to parse and process the transaction message to execute the business.
It improves the execution efficiency of business smart contracts on blockchain nodes, avoids business smart contracts written based on business processing rules, and realizes the efficient upgrade and execution of business smart contracts.
Smart Images

Figure CN114581241B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and more specifically, to a method and device for processing smart contracts, a processor, and an electronic device. Background Art
[0002] A blockchain network is a shared accounting solution that leverages P2P communication technology for peer-to-peer communication, consensus mechanisms for ensuring the legitimacy of accounting records, and a chain-like structure for data storage. When blockchain business scenarios are implemented, smart contracts written based on business rules are deployed to every blockchain node in the system. Upon receiving transaction requests from the business system, each blockchain node reaches consensus, executes transactions, and maintains data persistence. Changing business rules or adding new business logic processing interfaces, depending on the business scenario, requires modifying or adding smart contracts to the blockchain system to meet the latest business rules. Smart contracts written based on business rules and then deployed on blockchain nodes can lead to relatively low business execution efficiency.
[0003] There is currently no effective solution to the problem of low efficiency caused by business smart contracts written based on business processing rules in related technologies and deployed on blockchain nodes to execute business. Summary of the Invention
[0004] The main purpose of this application is to provide a method and device for processing smart contracts, a processor and an electronic device to solve the problem of low efficiency in related technologies where business smart contracts are written based on business processing rules and deployed on blockchain nodes to execute business.
[0005] To achieve the above-mentioned objectives, according to one aspect of the present application, a method for processing a smart contract is provided. The method comprises: obtaining a target smart contract parsing component, wherein the target smart contract parsing component is a smart contract parsing component corresponding to a target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, wherein the target smart contract parsing rule is a parsing rule that satisfies the logical requirements of a target business; obtaining a target transaction profile for the target business according to the target smart contract parsing rule; processing the target transaction profile by a first device of the blockchain node to obtain a target business smart contract; obtaining a first transaction message for the target business according to the target transaction profile, wherein the first transaction message includes at least: an ID of the target business smart contract, a name of the target transaction profile, and an ID of the target smart contract parsing component; parsing the first transaction message according to the target smart contract parsing component and the target transaction profile to obtain a second transaction message, and processing the second transaction message according to the target business smart contract to execute the target business.
[0006] Furthermore, the target transaction configuration file is processed by the first device of the blockchain node to obtain the target business smart contract, including: initiating an upload request for the target transaction configuration file; reaching a consensus on the upload request through the first device; if the consensus is passed, saving the transaction configuration file to the transaction file storage device of the blockchain node; and instantiating the target transaction configuration file to obtain the target business smart contract.
[0007] Furthermore, consensus is reached on the upload request 1 through the first device, including: verifying the upload request 1 through the instruction verification module of the first device; if the verification passes, generating a block consensus message 1 corresponding to the upload request 1 through the instruction verification module, and sending the block consensus message 1 to each blockchain node in the blockchain; and performing a three-stage consensus on the upload request 1 through a preset algorithm.
[0008] Furthermore, before parsing and processing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message, the method also includes: initiating a second upload request for the first transaction message; reaching a consensus on the second upload request through the second device of the blockchain node; if the consensus is passed, parsing and processing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message.
[0009] Furthermore, before obtaining the target smart contract parsing component, the method also includes: initializing the configuration of the blockchain node to generate an initialization configuration file, wherein the initialization configuration file is used to maintain the smart contract parsing component; loading the existing transaction configuration file and smart contract parsing component onto the blockchain node, and adding the description information of the smart contract parsing component to the world state data list table of the first device.
[0010] Furthermore, obtaining the target smart contract parsing component includes: determining whether the smart contract parsing rule corresponding to the smart contract parsing component on the blockchain node meets the logical requirements of the target business; if the smart contract parsing rule corresponding to the smart contract parsing component meets the logical requirements of the target business, the smart contract parsing component corresponding to the target smart contract parsing rule that meets the logical requirements of the target business is used as the target smart contract parsing component.
[0011] Furthermore, the method also includes: if the smart contract parsing rule corresponding to the smart contract parsing component cannot meet the logical requirements of the target business, then according to the logical requirements of the target business, the target smart contract parsing rule is written, and a target smart contract parsing component corresponding to the target smart contract parsing rule is generated; the target smart contract parsing component is uploaded to the blockchain node; a first device of the blockchain node is used to reach a consensus on the target smart contract parsing component; if the consensus is passed, an ID is configured for the target smart contract parsing component through the first device, and the target smart contract parsing component is saved to the rule parsing device of the blockchain node; and the description information of the target smart contract parsing component is added to the world state data list table.
[0012] Furthermore, after saving the target smart contract parsing component to the rule parsing device of the blockchain node, the method also includes: if an update operation on the target smart contract parsing component in the rule parsing device is detected; in response to the update operation, updating the target smart contract parsing component to obtain an updated target smart contract parsing component; and saving the updated target smart contract parsing component to the rule parsing device.
[0013] To achieve the above-mentioned object, according to another aspect of the present application, a smart contract processing device is provided. The device includes: a first acquisition unit, configured to acquire a target smart contract parsing component, wherein the target smart contract parsing component is a smart contract parsing component corresponding to a target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, and the target smart contract parsing rule is a parsing rule that satisfies the logical requirements of a target business; a second acquisition unit, configured to acquire a target transaction profile of the target business based on the target smart contract parsing rule; a first processing unit, configured to process the target transaction profile through a first device of the blockchain node to obtain a target business smart contract; a third acquisition unit, configured to acquire a first transaction message of the target business based on the target transaction profile, wherein the first transaction message includes at least: an ID of the target business smart contract, a name of the target transaction profile, and an ID of the target smart contract parsing component; a second processing unit, configured to parse and process the first transaction message based on the target smart contract parsing component and the target transaction profile to obtain a second transaction message, and process the second transaction message based on the target business smart contract to execute the target business.
[0014] Furthermore, the first processing unit includes: an initiating module for initiating an upload request for the target transaction configuration file; a consensus module for reaching a consensus on the upload request through the first device; a saving module for saving the transaction configuration file to the transaction file storage device of the blockchain node if the consensus is passed; and a first processing module for instantiating the target transaction configuration file to obtain the target business smart contract.
[0015] Furthermore, the consensus module includes: a verification submodule, used to verify the upload request 1 through the instruction verification module of the first device; a generation submodule, used to generate a block consensus message 1 corresponding to the upload request 1 through the instruction verification module if the verification passes, and send the block consensus message 1 to each blockchain node in the blockchain; a consensus submodule, used to perform a three-stage consensus on the upload request 1 through a preset algorithm.
[0016] Furthermore, the device also includes: an initiating unit, used to initiate a second upload request for the first transaction message before parsing and processing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message; a first consensus unit, used to reach a consensus on the second upload request through the second device of the blockchain node; and a third processing unit, used to parse and process the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message if the consensus is passed.
[0017] Furthermore, the device also includes: a generation unit, used to initialize the configuration of the blockchain node before obtaining the target smart contract parsing component, and generate an initialization configuration file, wherein the initialization configuration file is used to maintain the smart contract parsing component; a loading unit, used to load the existing transaction configuration file and smart contract parsing component onto the blockchain node, and add the description information of the smart contract parsing component to the world state data list table of the first device.
[0018] Furthermore, the first acquisition unit includes: a judgment module, used to judge whether the smart contract parsing rules corresponding to the smart contract parsing component on the blockchain node meet the logical requirements of the target business; a determination module, used to use the smart contract parsing component corresponding to the target smart contract parsing rules that meet the logical requirements of the target business as the target smart contract parsing component if the smart contract parsing rules corresponding to the smart contract parsing component meet the logical requirements of the target business.
[0019] Furthermore, the device also includes: a writing unit, which is used to write the target smart contract parsing rules according to the logical requirements of the target business if the smart contract parsing rules corresponding to the smart contract parsing component cannot meet the logical requirements of the target business, and generate a target smart contract parsing component corresponding to the target smart contract parsing rules; an uploading unit, which is used to upload the target smart contract parsing component to the blockchain node; a second consensus unit, which is used to use the first device of the blockchain node to reach a consensus on the target smart contract parsing component; a configuration unit, which is used to configure an ID for the target smart contract parsing component through the first device if the consensus is passed, and save the target smart contract parsing component to the rule parsing device of the blockchain node; an adding unit, which is used to add the description information of the target smart contract parsing component to the world state data list table.
[0020] Furthermore, the device also includes: a detection unit, which is used to detect an update operation of the target smart contract parsing component in the rule parsing device after saving the target smart contract parsing component to the rule parsing device of the blockchain node; an updating unit, which is used to respond to the update operation, update the target smart contract parsing component to obtain an updated target smart contract parsing component; and a saving unit, which is used to save the updated target smart contract parsing component to the rule parsing device.
[0021] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a processor is provided, which is used to run a program, wherein the program executes any one of the above-mentioned smart contract processing methods when running.
[0022] In order to achieve the above-mentioned purpose, according to one aspect of the present application, an electronic device is provided, which includes one or more processors and a memory, and the memory is used to store a processing method for the one or more processors to implement any of the above-mentioned smart contracts.
[0023] Through this application, the following steps are adopted: obtaining a target smart contract parsing component; obtaining a target transaction profile of a target business according to the target smart contract parsing rules; processing the target transaction profile through the first device of the blockchain node to obtain a target business smart contract; obtaining a first transaction message of the target business according to the target transaction profile; parsing and processing the first transaction message according to the target smart contract parsing component and the target transaction profile to obtain a second transaction message, and processing the second transaction message according to the target business smart contract to execute the target business, which solves the problem of low efficiency caused by business smart contracts written based on business processing rules in the related art and deploying the business smart contracts on the blockchain node to execute the business. The target transaction profile for the target business is obtained through the target smart contract parsing rules, the target transaction profile is processed through the first device of the blockchain node to obtain the target business smart contract, and then the target business smart contract executes the target business according to the target smart contract parsing component and the target transaction profile, avoiding the business smart contracts written based on business processing rules, thereby achieving the effect of improving efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings:
[0025] Figure 1 This is a flowchart of a method for processing a smart contract according to an embodiment of the present application;
[0026] Figure 2 is a flowchart of an optional smart contract processing method provided according to an embodiment of the present application;
[0027] Figure 3 is a schematic diagram of an optional smart contract processing system provided according to an embodiment of the present application;
[0028] Figure 4 is a schematic diagram of an optional blockchain node provided according to an embodiment of the present application;
[0029] Figure 5 is a schematic diagram of a smart contract processing device provided according to an embodiment of the present application;
[0030] Figure 6 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0032] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] The present invention will be described below in conjunction with preferred implementation steps. Figure 1 This is a flowchart of a method for processing a smart contract according to an embodiment of the present application. Figure 1 As shown, the method includes the following steps:
[0035] Step S101: Obtain a target smart contract parsing component, wherein the target smart contract parsing component is a smart contract parsing component corresponding to a target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, and the target smart contract parsing rule is a parsing rule that meets the logical requirements of the target business.
[0036] Specifically, a business chain is established for the target business to be executed. The business chain consists of multiple blockchain nodes. Multiple smart contract parsing components and multiple transaction configuration files are deployed on the blockchain nodes. The target smart contract component is obtained from these smart contract parsing components. The parsing rules corresponding to the target smart contract parsing component are the target smart contract parsing rules. The target smart contract parsing rules can meet the logical requirements of the target business. The storage format of the smart contract rule parsing component is: component ID component name component update time component description configuration example. For example:
[0037] module000001 numAdd 20211015 numeric type addition "module000001 interface field";
[0038] module000002 numSub 20211015 numeric type subtraction "module000002 interface field";
[0039] module000005 strAppend 20211015 string type accumulates "module000005 interface field".
[0040] Step S102: Obtain the target transaction configuration file of the target business according to the target smart contract parsing rules.
[0041] Specifically, based on the target smart contract parsing rules, a target transaction profile for the target business is generated. This target transaction profile can be an existing transaction profile on the blockchain node. If the existing transaction profile on the blockchain node cannot implement the target business, a new transaction profile can be written based on the target smart contract parsing rules. The target transaction profile includes the ID of the target smart contract parsing component, the transaction type, the transaction amount, and the account information of both parties to the transaction.
[0042] Step S103: Process the target transaction configuration file through the first device of the blockchain node to obtain the target business smart contract.
[0043] Specifically, a first device of the blockchain node (e.g., a system contract consensus and execution device) is used to reach consensus and instantiate the target transaction profile to obtain a business smart contract for the target business.
[0044] Step S104: Obtain a first transaction message of the target business based on the target transaction configuration file, wherein the first transaction message includes at least: the ID of the target business smart contract, the name of the target transaction configuration file, and the ID of the target smart contract parsing component.
[0045] Specifically, the first transaction message of the target business is assembled according to the target smart contract transaction profile. For example, if the union appropriation balance of a certain account increases by 100,000 yuan in the third quarter, the content of the first transaction message is: {“dsrName”:“lucusAccount(name of the target transaction profile)”
[0046] "module0":{
[0047] "moduleID": "module000005 (target smart contract parsing component ID)";
[0048] "fildName":"communication";
[0049] "fildValue":"3rd Quarter Union Appropriation"};
[0050] "module1":{
[0051] "moduleID": "module000001 (target smart contract parsing component ID)";
[0052] "fildName":"account(account name)";
[0053] "fildValue":100000(transaction amount)};
[0054] "module2":{
[0055] "moduleID": "module000002 (target smart contract parsing component ID)";
[0056] "fildName": "account (account name)";
[0057] "fildValue":0}
[0058] }.
[0059] In step S105, the first transaction message is parsed and processed according to the target smart contract parsing component and the target transaction configuration file to obtain a second transaction message, and the second transaction message is processed according to the target business smart contract to execute the target business.
[0060] Specifically, according to the target smart contract parsing component and the target transaction configuration file, the first transaction message is parsed and processed to obtain a second transaction message that can be processed by the target business smart contract. The second transaction message is processed by the target business smart contract to execute the target business.
[0061] To sum up, the target transaction profile for the target business is obtained through the target smart contract parsing rules, and the target transaction profile is processed by the first device of the blockchain node to obtain the target business smart contract. Then, according to the target smart contract parsing component and the target transaction profile, the target business smart contract executes the target business, avoiding the business smart contract written based on the business processing rules. The business smart contract upgrade only needs to update the transaction profile or add the smart contract parsing component, thereby improving the business processing efficiency.
[0062] Optionally, in the smart contract processing method provided in the embodiment of the present application, the target transaction configuration file is processed by the first device of the blockchain node to obtain the target business smart contract, including: initiating an upload request one for the target transaction configuration file; reaching consensus on the upload request one through the first device; if the consensus is passed, saving the transaction configuration file to the transaction file storage device of the blockchain node; and instantiating the target transaction configuration file to obtain the target business smart contract.
[0063] Specifically, an upload request for a target transaction profile can be initiated through the operation and maintenance management system. A consensus on the upload request for the target transaction profile is reached through the first device on the blockchain (e.g., the system contract consensus and execution device). If consensus is achieved, the target transaction profile is saved to the transaction file storage device of the blockchain node, and the name of the target transaction profile is updated in the world state data for subsequent use. The blockchain node instantiates the target transaction profile as the corresponding target business smart contract. These steps ensure that the blockchain node can successfully execute the target business.
[0064] Optionally, in the smart contract processing method provided in the embodiment of the present application, consensus is reached on the upload request one through the first device, including: verifying the upload request one through the instruction verification module of the first device; if the verification passes, generating a block consensus message one corresponding to the upload request one through the instruction verification module, and sending the block consensus message one to each blockchain node in the blockchain; and performing a three-stage consensus on the upload request one through a preset algorithm.
[0065] Specifically, reaching consensus on the upload request includes: performing parameter verification on the upload request through the instruction verification module of the first device (for example, the system contract consensus and execution device), generating a block consensus message corresponding to the upload request after the verification is passed, and sending the block consensus message to each blockchain node in the blockchain to achieve consensus, and using the Byzantine consensus algorithm (i.e., the above-mentioned preset algorithm) to perform a three-stage consensus process on the upload request, the first stage is the pre-prepare consensus, the second stage is the prepare consensus, and the third stage is the commit consensus. The three stages are executed sequentially. After the current stage has received consistent confirmation messages from 2f+1 other blockchain nodes, the consensus of the current stage is completed and enters the next stage. After all three stages of consensus are completed, it means that the request is legal. Among them, f represents the number of fault-tolerant nodes that can be supported, and the minimum value is 1. Through the above operations, the legality and security of the upload request are guaranteed.
[0066] Optionally, in the smart contract processing method provided in the embodiment of the present application, before parsing and processing the first transaction message based on the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message, the method also includes: initiating a second upload request for the first transaction message; reaching a consensus on the second upload request through the second device of the blockchain node; if the consensus is passed, parsing and processing the first transaction message based on the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message.
[0067] Specifically, a business system can initiate an upload request for a first transaction message. This upload request also requires consensus processing. Only when consensus is passed can the operation request and business request be executed, and the execution results can be used as legal data and persisted. Therefore, a second device of the blockchain node (for example, a business contract consensus and execution device) reaches consensus on the second upload request. After consensus is passed, the first transaction message is parsed and processed to obtain the second transaction message. Only through the parsing of the first transaction message can the target business smart contract successfully execute the target business.
[0068] Optionally, in the smart contract processing method provided in the embodiment of the present application, before obtaining the target smart contract parsing component, the method also includes: initializing the configuration of the blockchain node and generating an initialization configuration file, wherein the initialization configuration file is used to maintain the smart contract parsing component; loading the existing transaction configuration file and the smart contract parsing component onto the blockchain node, and adding the description information of the smart contract parsing component to the world state data list table of the first device.
[0069] Specifically, each blockchain node undergoes initial configuration to generate an initialization configuration file. The existing transaction configuration file and smart contract parsing component information are then loaded onto the blockchain node, and the smart contract parsing component's description is added to the world state data list. This allows the existing smart contract parsing rules to be retrieved when the target business needs to be executed, facilitating subsequent acquisition of the target transaction configuration file.
[0070] Optionally, in the smart contract processing method provided in the embodiment of the present application, obtaining the target smart contract parsing component includes: determining whether the smart contract parsing rules corresponding to the smart contract parsing component on the blockchain node meet the logical requirements of the target business; if the smart contract parsing rules corresponding to the smart contract parsing component meet the logical requirements of the target business, the smart contract parsing component corresponding to the target smart contract parsing rules that meet the logical requirements of the target business is used as the target smart contract parsing component.
[0071] Specifically, the first step is to determine whether the smart contract parsing rules corresponding to the existing smart contract parsing component meet the logical requirements of the target business to be executed. If so, the smart contract parsing component corresponding to the target smart contract parsing rules that meet the logical requirements of the target business is directly used as the target smart contract parsing component. This allows the existing smart contract parsing component to be directly called, reducing the user's workload and improving task execution efficiency.
[0072] Optionally, in the smart contract processing method provided in the embodiment of the present application, the method also includes: if the smart contract parsing rules corresponding to the smart contract parsing component cannot meet the logical requirements of the target business, then according to the logical requirements of the target business, write the target smart contract parsing rules, and generate a target smart contract parsing component corresponding to the target smart contract parsing rules; upload the target smart contract parsing component to the blockchain node; use the first device of the blockchain node to reach a consensus on the target smart contract parsing component; if the consensus is passed, configure an ID for the target smart contract parsing component through the first device, and save the target smart contract parsing component to the rule parsing device of the blockchain node; add the description information of the target smart contract parsing component to the world state data list table.
[0073] Specifically, when the smart contract parsing rules corresponding to the existing smart contract parsing component cannot meet the logical requirements of the target business to be executed, a target smart contract parsing rule is written according to the logical requirements of the target business, and a target smart contract parsing component corresponding to the target smart contract parsing rule is generated. The target smart contract parsing component is then uploaded to the blockchain node. The first device of the blockchain node (for example, the system contract consensus and execution device) reaches a consensus on the target smart contract parsing component. After the consensus is passed, a unique ID for the target smart contract parsing component is generated; finally, the target smart contract parsing component is stored in the rule parsing device and the description information of the target smart contract parsing component is added to the world state data list table. Through the above steps, the situation where the target business cannot be executed when the existing smart contract parsing rules cannot meet the logical requirements of the target business to be executed is avoided.
[0074] Optionally, in the smart contract processing method provided in the embodiment of the present application, after saving the target smart contract parsing component to the rule parsing device of the blockchain node, the method also includes: if an update operation of the target smart contract parsing component in the rule parsing device is detected; in response to the update operation, the target smart contract parsing component is updated to obtain an updated target smart contract parsing component; and the updated target smart contract parsing component is saved to the rule parsing device.
[0075] Specifically, when only the type of certain data changes, it is troublesome to rebuild the smart contract parsing component. In this case, the target smart contract parsing component can be updated, and then the updated target smart contract parsing component can be saved to the rule parsing device.
[0076] The processing method of the smart contract provided in the embodiment of the present application is as follows: obtaining a target smart contract parsing component; obtaining a target transaction profile of a target business according to a target smart contract parsing rule; processing the target transaction profile by a first device of a blockchain node to obtain a target business smart contract; obtaining a first transaction message of the target business according to the target transaction profile; parsing and processing the first transaction message according to the target smart contract parsing component and the target transaction profile to obtain a second transaction message, and processing the second transaction message according to the target business smart contract to execute the target business, thereby solving the problem of low efficiency caused by business smart contracts written based on business processing rules in the related art and deploying business smart contracts on blockchain nodes to execute business. Obtaining a target transaction profile for the target business through a target smart contract parsing rule, processing the target transaction profile by a first device of a blockchain node to obtain a target business smart contract, and then executing the target business according to the target smart contract parsing component and the target transaction profile, thereby avoiding business smart contracts written based on business processing rules, thereby achieving the effect of improving efficiency.
[0077] like Figure 2As shown, a flowchart of an optional smart contract processing method provided in an embodiment of the present application is shown. S201: A business chain is established based on the target business requirements. After the blockchain node is started, initialization operations are performed and an initial configuration file is generated. The existing transaction configuration file and smart contract parsing component information are loaded into the blockchain node, and a determination is made as to whether the smart contract parsing rules meet the logical requirements of the target business. S202A: If the existing smart contract parsing rules meet the logical requirements of the target business, a smart contract transaction configuration file is compiled based on the smart contract parsing rules, and a transaction configuration file upload request is initiated. S202B: If the existing smart contract parsing rules do not meet the logical requirements of the target business, a new smart contract parsing rule is compiled based on the logical requirements of the target business, the corresponding smart contract parsing component is obtained, and a smart contract parsing component upload request is initiated. S203: The system contract consensus and execution device reaches consensus on the smart contract parsing component upload request. After consensus is reached, a unique ID is assigned to the smart contract parsing component and the smart contract parsing component is stored in the rule parsing device. A smart contract transaction configuration file is then compiled, and a transaction configuration file upload request is initiated. S204: The system contract consensus and execution device reaches consensus on the transaction configuration file upload request. After consensus is reached, the transaction configuration file name is updated in the world state data and the transaction configuration file is stored in the transaction file storage device. S205: Based on the smart contract transaction configuration file, a first transaction message is obtained and sent to the blockchain node. S206: Based on the transaction configuration file ID in the first transaction message, the transaction configuration file is loaded from the transaction file storage device. Based on the smart contract parsing component ID in the first transaction message, the corresponding smart contract parsing component is loaded. S207: Based on the transaction configuration file and the smart contract parsing component, the first transaction message is parsed and processed to obtain a second transaction message. The second transaction message is processed by the business smart contract to execute the target business.
[0078] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0079] The present application also provides a smart contract processing device. It should be noted that the smart contract processing device of the present application can be used to execute the smart contract processing method provided in the present application. The following describes the smart contract processing device provided in the present application.
[0080] Figure 3 Schematic diagram of a smart contract processing device according to an embodiment of the present application. Figure 3As shown, the device includes: a first acquiring unit 301 , a second acquiring unit 302 , a first processing unit 303 , a third acquiring unit 304 and a second processing unit 305 .
[0081] The first acquisition unit 301 is used to obtain a target smart contract parsing component, wherein the target smart contract parsing component is a smart contract parsing component corresponding to a target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, and the target smart contract parsing rule is a parsing rule that meets the logical requirements of the target business.
[0082] The second acquisition unit 302 is used to acquire a target transaction configuration file of a target business according to the target smart contract parsing rule.
[0083] The first processing unit 303 is configured to process the target transaction configuration file through the first device of the blockchain node to obtain a target business smart contract.
[0084] The third acquisition unit 304 is configured to acquire a first transaction message of the target business based on the target transaction configuration file, wherein the first transaction message includes at least: the ID of the target business smart contract, the name of the target transaction configuration file, and the ID of the target smart contract parsing component.
[0085] The second processing unit 305 is used to parse the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain a second transaction message, and process the second transaction message according to the target business smart contract to execute the target business.
[0086] The smart contract processing device provided in the embodiment of the present application obtains a target smart contract parsing component through a first acquisition unit 301, wherein the target smart contract parsing component is a smart contract parsing component corresponding to the target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, and the target smart contract parsing rule is a parsing rule that meets the logical requirements of the target business; a second acquisition unit 302 obtains a target transaction configuration file of the target business based on the target smart contract parsing rule; a first processing unit 303 processes the target transaction configuration file through the first device of the blockchain node to obtain a target business smart contract; a third acquisition unit 304 obtains a first transaction message of the target business based on the target transaction configuration file, wherein the first transaction message includes at least: an ID of the target business smart contract, a name of the target transaction configuration file, and an ID of the target smart contract parsing component; a second processing unit 305 parses and processes the first transaction message based on the target smart contract parsing component and the target transaction configuration file to obtain a second transaction message, and processes the second transaction message based on the target business smart contract to execute the target business. This solves the problem in the related art that business smart contracts are written based on business processing rules and deployed on blockchain nodes to execute business, resulting in relatively low efficiency. The target transaction profile for the target business is obtained through the target smart contract parsing rules, and the target transaction profile is processed by the first device of the blockchain node to obtain the target business smart contract. Then, according to the target smart contract parsing component and the target transaction profile, the target business smart contract executes the target business, avoiding the business smart contract written based on the business processing rules, thereby achieving the effect of improving efficiency.
[0087] Optionally, in the smart contract processing device provided in the embodiment of the present application, the first processing unit 303 includes: an initiating module, used to initiate an upload request one of the target transaction configuration file; a consensus module, used to reach a consensus on the upload request one through the first device; a saving module, used to save the transaction configuration file to the transaction file storage device of the blockchain node if the consensus is passed; and a first processing module, used to instantiate the target transaction configuration file to obtain the target business smart contract.
[0088] Optionally, in the smart contract processing device provided in the embodiment of the present application, the consensus module includes: a verification submodule, which is used to verify the upload request one through the instruction verification module of the first device; a generation submodule, which is used to generate a block consensus message one corresponding to the upload request one through the instruction verification module if the verification passes, and send the block consensus message one to each blockchain node in the blockchain; a consensus submodule, which is used to perform a three-stage consensus on the upload request one through a preset algorithm.
[0089] Optionally, in the smart contract processing device provided in the embodiment of the present application, the device also includes: an initiating unit, used to parse and process the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message, before initiating a second upload request for the first transaction message; a first consensus unit, used to reach a consensus on the second upload request through the second device of the blockchain node; and a third processing unit, used to parse and process the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message if the consensus is passed.
[0090] Optionally, in the smart contract processing device provided in the embodiment of the present application, the device also includes: a generation unit, used to initialize and configure the blockchain node before obtaining the target smart contract parsing component, and generate an initialization configuration file, wherein the initialization configuration file is used to maintain the smart contract parsing component; a loading unit, used to load the existing transaction configuration file and smart contract parsing component onto the blockchain node, and add the description information of the smart contract parsing component to the world state data list table of the first device.
[0091] Optionally, in the smart contract processing device provided in the embodiment of the present application, the first acquisition unit 301 includes: a judgment module, used to judge whether the smart contract parsing rules corresponding to the smart contract parsing component on the blockchain node meet the logical requirements of the target business; a determination module, used to use the smart contract parsing component corresponding to the target smart contract parsing rule that meets the logical requirements of the target business as the target smart contract parsing component if the smart contract parsing rules corresponding to the smart contract parsing component meet the logical requirements of the target business.
[0092] Optionally, in the smart contract processing device provided in the embodiment of the present application, the device also includes: a writing unit, which is used to write the target smart contract parsing rules based on the logical requirements of the target business if the smart contract parsing rules corresponding to the smart contract parsing component cannot meet the logical requirements of the target business, and generate a target smart contract parsing component corresponding to the target smart contract parsing rules; an uploading unit, which is used to upload the target smart contract parsing component to the blockchain node; a second consensus unit, which is used to use the first device of the blockchain node to reach a consensus on the target smart contract parsing component; a configuration unit, which is used to configure an ID for the target smart contract parsing component through the first device if the consensus is passed, and save the target smart contract parsing component to the rule parsing device of the blockchain node; and an adding unit, which is used to add the description information of the target smart contract parsing component to the world state data list table.
[0093] Optionally, in the smart contract processing device provided in the embodiment of the present application, the device also includes: a detection unit, which is used to detect an update operation of the target smart contract parsing component in the rule parsing device after saving the target smart contract parsing component to the rule parsing device of the blockchain node; an update unit, which is used to respond to the update operation, update the target smart contract parsing component, and obtain an updated target smart contract parsing component; and a saving unit, which is used to save the updated target smart contract parsing component to the rule parsing device.
[0094] The processing device of the smart contract includes a processor and a memory. The above-mentioned first acquisition unit 301, second acquisition unit 302, first processing unit 303, third acquisition unit 304 and second processing unit 305 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0095] The processor contains a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the deployment of business smart contracts can be achieved by adjusting the kernel parameters.
[0096] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0097] like Figure 4 As shown, a schematic diagram of an optional smart contract processing system provided according to an embodiment of the present application. Figure 5 As shown, a schematic diagram of an optional blockchain node provided according to an embodiment of the present application. The smart contract processing system and blockchain node can be used to execute the processing method for smart contracts provided in the embodiment of the present application. The above-mentioned processing system includes a business chain 1, a blockchain node 2, an operation and maintenance management system 3 and a business system 4. The above-mentioned blockchain node includes a transaction routing device 11, a system contract consensus and execution device 12, a business contract consensus and execution device 13, a rule parsing device 14, and a transaction file storage device 15. The transaction routing device 11 is responsible for receiving the smart contract parsing component initiated by the operation and maintenance management system 3, the upload request of the transaction configuration file and the business execution request initiated by the business system 4. The transaction routing device 11 forwards the smart contract parsing component operation request and the transaction configuration file operation request initiated by the operation and maintenance management system 3 to the system contract consensus and execution device 12; the transaction routing device 11 forwards the business request initiated by the business system 4 to the business contract consensus and execution device 13.
[0098] The system contract consensus and execution device 12 is responsible for maintaining and operating the smart contract parsing component, as well as updating smart contract transaction configuration files. The system contract consensus and execution device 12 includes a command verification module 121, a command consensus module 122, and a persistence module 123. The command verification module 121 and the command consensus module 122 verify and reach consensus on operation requests, while the persistence module 123 performs the final execution of operation requests that pass consensus.
[0099] The business contract consensus and execution device 13 is responsible for verifying the legitimacy of business requests initiated by the business system 4 and mobilizing transaction configuration files and smart contract parsing components to execute business requests as needed. The business contract consensus and execution device 13 includes a transaction verification module 131, a transaction consensus module 132, and a persistence module 133. The transaction verification module 131 and the transaction consensus module 132 complete the verification and consensus of business requests, while the persistence module 133 performs the final execution of business requests that pass consensus.
[0100] An embodiment of the present invention provides a processor, which is used to run a program, wherein the processing method of the smart contract is executed when the program is running.
[0101] like Figure 6 As shown, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: obtaining a target smart contract parsing component, wherein the target smart contract parsing component is a smart contract parsing component corresponding to a target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, and the target smart contract parsing rule is a parsing rule that meets the logical requirements of a target business; obtaining a target transaction profile of the target business according to the target smart contract parsing rule; processing the target transaction profile through a first device of the blockchain node to obtain a target business smart contract; obtaining a first transaction message of the target business according to the target transaction profile, wherein the first transaction message includes at least: an ID of the target business smart contract, a name of the target transaction profile, and an ID of the target smart contract parsing component; parsing and processing the first transaction message according to the target smart contract parsing component and the target transaction profile to obtain a second transaction message, and processing the second transaction message according to the target business smart contract to execute the target business.
[0102] Optionally, the target transaction configuration file is processed by the first device of the blockchain node to obtain the target business smart contract, including: initiating an upload request for the target transaction configuration file; reaching a consensus on the upload request through the first device; if the consensus is passed, saving the transaction configuration file to the transaction file storage device of the blockchain node; and instantiating the target transaction configuration file to obtain the target business smart contract.
[0103] Optionally, consensus is reached on upload request one through the first device, including: verifying upload request one through the instruction verification module of the first device; if the verification passes, generating block consensus message one corresponding to upload request one through the instruction verification module, and sending block consensus message one to each blockchain node in the blockchain; and performing three-stage consensus on upload request one through a preset algorithm.
[0104] Optionally, before parsing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message, the method also includes: initiating a second upload request for the first transaction message; reaching a consensus on the second upload request through the second device of the blockchain node; if the consensus is passed, parsing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message.
[0105] Optionally, before obtaining the target smart contract parsing component, the method further includes: initializing the configuration of the blockchain node and generating an initialization configuration file, wherein the initialization configuration file is used to maintain the smart contract parsing component; loading the existing transaction configuration file and the smart contract parsing component onto the blockchain node, and adding the description information of the smart contract parsing component to the world state data list table of the first device.
[0106] Optionally, obtaining the target smart contract parsing component includes: determining whether the smart contract parsing rules corresponding to the smart contract parsing component on the blockchain node meet the logical requirements of the target business; if the smart contract parsing rules corresponding to the smart contract parsing component meet the logical requirements of the target business, the smart contract parsing component corresponding to the target smart contract parsing rules that meet the logical requirements of the target business is used as the target smart contract parsing component.
[0107] Optionally, the method also includes: if the smart contract parsing rules corresponding to the smart contract parsing component cannot meet the logical requirements of the target business, then writing the target smart contract parsing rules based on the logical requirements of the target business, and generating a target smart contract parsing component corresponding to the target smart contract parsing rules; uploading the target smart contract parsing component to the blockchain node; using the first device of the blockchain node to reach a consensus on the target smart contract parsing component; if the consensus is passed, configuring an ID for the target smart contract parsing component through the first device, and saving the target smart contract parsing component to the rule parsing device of the blockchain node; adding the description information of the target smart contract parsing component to the world state data list table.
[0108] Optionally, after saving the target smart contract parsing component to the rule parsing device of the blockchain node, the method further includes: upon detecting an update operation on the target smart contract parsing component in the rule parsing device; in response to the update operation, updating the target smart contract parsing component to obtain an updated target smart contract parsing component; and saving the updated target smart contract parsing component to the rule parsing device. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
[0109] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialized program having the following method steps: obtaining a target smart contract parsing component, wherein the target smart contract parsing component is a smart contract parsing component corresponding to a target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, and the target smart contract parsing rule is a parsing rule that meets the logical requirements of a target business; obtaining a target transaction profile of the target business based on the target smart contract parsing rule; processing the target transaction profile through a first device of the blockchain node to obtain a target business smart contract; obtaining a first transaction message of the target business based on the target transaction profile, wherein the first transaction message includes at least: the ID of the target business smart contract, the name of the target transaction profile and the ID of the target smart contract parsing component; parsing and processing the first transaction message based on the target smart contract parsing component and the target transaction profile to obtain a second transaction message, and processing the second transaction message based on the target business smart contract to execute the target business.
[0110] Optionally, the target transaction configuration file is processed by the first device of the blockchain node to obtain the target business smart contract, including: initiating an upload request for the target transaction configuration file; reaching a consensus on the upload request through the first device; if the consensus is passed, saving the transaction configuration file to the transaction file storage device of the blockchain node; and instantiating the target transaction configuration file to obtain the target business smart contract.
[0111] Optionally, consensus is reached on upload request one through the first device, including: verifying upload request one through the instruction verification module of the first device; if the verification passes, generating block consensus message one corresponding to upload request one through the instruction verification module, and sending block consensus message one to each blockchain node in the blockchain; and performing three-stage consensus on upload request one through a preset algorithm.
[0112] Optionally, before parsing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message, the method also includes: initiating a second upload request for the first transaction message; reaching a consensus on the second upload request through the second device of the blockchain node; if the consensus is passed, parsing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message.
[0113] Optionally, before obtaining the target smart contract parsing component, the method further includes: initializing the configuration of the blockchain node and generating an initialization configuration file, wherein the initialization configuration file is used to maintain the smart contract parsing component; loading the existing transaction configuration file and the smart contract parsing component onto the blockchain node, and adding the description information of the smart contract parsing component to the world state data list table of the first device.
[0114] Optionally, obtaining the target smart contract parsing component includes: determining whether the smart contract parsing rules corresponding to the smart contract parsing component on the blockchain node meet the logical requirements of the target business; if the smart contract parsing rules corresponding to the smart contract parsing component meet the logical requirements of the target business, the smart contract parsing component corresponding to the target smart contract parsing rules that meet the logical requirements of the target business is used as the target smart contract parsing component.
[0115] Optionally, the method also includes: if the smart contract parsing rules corresponding to the smart contract parsing component cannot meet the logical requirements of the target business, then writing the target smart contract parsing rules based on the logical requirements of the target business, and generating a target smart contract parsing component corresponding to the target smart contract parsing rules; uploading the target smart contract parsing component to the blockchain node; using the first device of the blockchain node to reach a consensus on the target smart contract parsing component; if the consensus is passed, configuring an ID for the target smart contract parsing component through the first device, and saving the target smart contract parsing component to the rule parsing device of the blockchain node; adding the description information of the target smart contract parsing component to the world state data list table.
[0116] Optionally, after saving the target smart contract parsing component to the rule parsing device of the blockchain node, the method further includes: if an update operation on the target smart contract parsing component in the rule parsing device is detected; in response to the update operation, the target smart contract parsing component is updated to obtain an updated target smart contract parsing component; and the updated target smart contract parsing component is saved to the rule parsing device.
[0117] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0118] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0119] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0120] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0121] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0122] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0123] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0124] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0125] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0126] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A method for processing a smart contract, characterized in that: include: Obtaining a target smart contract parsing component, wherein the target smart contract parsing component is a smart contract parsing component corresponding to a target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, and the target smart contract parsing rule is a parsing rule that meets the logical requirements of the target business; Obtaining a target transaction profile for the target business according to the target smart contract parsing rules; Processing the target transaction configuration file through the first device of the blockchain node to obtain a target business smart contract; Obtaining, based on the target transaction configuration file, a first transaction message of the target business, wherein the first transaction message includes at least: an ID of the target business smart contract, a name of the target transaction configuration file, and an ID of the target smart contract parsing component; Parsing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain a second transaction message, and processing the second transaction message according to the target business smart contract to execute the target business; Processing the target transaction configuration file by the first device of the blockchain node to obtain a target business smart contract, including: initiating a first upload request for the target transaction configuration file; reaching a consensus on the first upload request by the first device; if the consensus is reached, saving the transaction configuration file to a transaction file storage device of the blockchain node; and instantiating the target transaction configuration file to obtain the target business smart contract; Reaching consensus on the upload request 1 through the first device includes: verifying the upload request 1 through the instruction verification module of the first device; if the verification passes, generating a block consensus message 1 corresponding to the upload request 1 through the instruction verification module, and sending the block consensus message 1 to each blockchain node in the blockchain; and performing a three-stage consensus on the upload request 1 through a preset algorithm.
2. The method according to claim 1, characterized in that Before parsing the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain a second transaction message, the method further includes: Initiating a second upload request for the first transaction message; A second device of the blockchain node reaches a consensus on the second upload request; If the consensus is passed, the first transaction message is parsed and processed according to the target smart contract parsing component and the target transaction configuration file to obtain the second transaction message.
3. The method according to claim 1, characterized in that Before obtaining the target smart contract parsing component, the method further includes: Initializing and configuring the blockchain node to generate an initialization configuration file, wherein the initialization configuration file is used to maintain the smart contract parsing component; The existing transaction configuration file and smart contract parsing component are loaded onto the blockchain node, and the description information of the smart contract parsing component is added to the world state data list table of the first device.
4. The method according to claim 3, characterized in that Obtaining the target smart contract parsing component includes: Determine whether the smart contract parsing rules corresponding to the smart contract parsing component on the blockchain node meet the logical requirements of the target business; If the smart contract parsing rule corresponding to the smart contract parsing component meets the logical requirements of the target business, the smart contract parsing component corresponding to the target smart contract parsing rule that meets the logical requirements of the target business will be used as the target smart contract parsing component.
5. The method according to claim 4, characterized in that The method further comprises: If the smart contract parsing rule corresponding to the smart contract parsing component cannot meet the logical requirements of the target business, then write the target smart contract parsing rule according to the logical requirements of the target business, and generate the target smart contract parsing component corresponding to the target smart contract parsing rule; Upload the target smart contract parsing component to the blockchain node; Using the first device of the blockchain node to reach a consensus on the target smart contract parsing component; If the consensus is passed, the first device configures an ID for the target smart contract parsing component and saves the target smart contract parsing component to the rule parsing device of the blockchain node; Add the description information of the target smart contract parsing component to the world state data list table.
6. The method according to claim 5, characterized in that After saving the target smart contract parsing component to the rule parsing device of the blockchain node, the method further includes: If an update operation on the target smart contract parsing component in the rule parsing device is detected; In response to the update operation, the target smart contract parsing component is updated to obtain an updated target smart contract parsing component; The updated target smart contract parsing component is saved in the rule parsing device.
7. A smart contract processing device, characterized in that: include: A first acquisition unit is configured to acquire a target smart contract parsing component, wherein the target smart contract parsing component is a smart contract parsing component corresponding to a target smart contract parsing rule among multiple smart contract parsing components in a blockchain node, and the target smart contract parsing rule is a parsing rule that meets the logical requirements of a target business; A second acquisition unit is configured to acquire a target transaction configuration file of the target business according to the target smart contract parsing rule; A first processing unit, configured to process the target transaction configuration file through a first device of the blockchain node to obtain a target business smart contract; a third acquiring unit, configured to acquire, based on the target transaction configuration file, a first transaction message of the target business, wherein the first transaction message includes at least: an ID of the target business smart contract, a name of the target transaction configuration file, and an ID of the target smart contract parsing component; a second processing unit, configured to parse the first transaction message according to the target smart contract parsing component and the target transaction configuration file to obtain a second transaction message, and process the second transaction message according to the target business smart contract to execute the target business; The first processing unit includes: an initiating module for initiating an upload request for the target transaction configuration file; a consensus module for reaching a consensus on the upload request through the first device; a saving module for saving the transaction configuration file to the transaction file storage device of the blockchain node if the consensus is reached; and a first processing module for instantiating the target transaction configuration file to obtain the target business smart contract. The consensus module includes: a verification submodule, which is used to verify the upload request 1 through the instruction verification module of the first device; a generation submodule, which is used to generate a block consensus message 1 corresponding to the upload request 1 through the instruction verification module if the verification passes, and send the block consensus message 1 to each blockchain node in the blockchain; and a consensus submodule, which is used to perform a three-stage consensus on the upload request 1 through a preset algorithm.
8. A processor, characterized in that: The processor is used to run a program, wherein the program, when running, executes the smart contract processing method described in any one of claims 1 to 6.
9. An electronic device, characterized in that: The system comprises one or more processors and a memory, wherein the memory is used to store 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 smart contract processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Intelligent contract invocation method and device based on block chain, and electronic device
CN109146679A
Blockchain intelligent contract processing system and method
CN110392052A