A smart contract management method and device
By decoupling the audit and consensus process in the smart contract effective management transaction, and generating effective consensus information based on the audit results of the transaction processing node, the problem of blockchain passively executing the same transaction in a globally consistent state is solved, and the efficiency and accuracy of smart contract management are improved.
Patent Information
- Application Number
- CN202010581714.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-23
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2040-06-23
AI Technical Summary
Blockchain passively executes the same transaction in a globally consistent state, and cannot refuse managed transactions of smart contracts.
By obtaining the audit results of each transaction processing node for the smart contract information operation when the smart contract is effective and when it is determined that the audit result is passed, an effective consensus information is generated and sent to other transaction processing nodes, decoupling the audit and consensus process, and determining the transaction effectiveness is determined based on the consensus results of the target node.
It realizes differentiated management of smart contract effective management transactions, improves the efficiency and accuracy of smart contract management, and avoids the phenomenon of passive execution of the same transaction.
Smart Images

Figure CN111738855B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology (Finetch) and in particular to a smart contract management method and device. Background Art
[0002] With the development of computer technology, more and more technologies are being applied in the financial field. The traditional financial industry is gradually transforming to financial technology (Fintech), and blockchain technology is no exception. However, due to the security and real-time requirements of the financial industry, the financial technology field has also put forward higher requirements for blockchain technology.
[0003] A smart contract is a set of commitments defined in digital form that control digital assets and contain the rights and obligations agreed upon by the contract participants, which are automatically executed by a computer system. A smart contract program is not just a computer program that can be automatically executed, it is itself a system participant that responds to received information, can receive and store value, and can also send information and value outward. This program is like a person who can be trusted to temporarily keep assets and always perform operations according to pre-set rules.
[0004] However, in the prior art, when a management transaction is initiated for a smart contract, the consensus process of all nodes in the blockchain on whether the management transaction can be executed is coupled with the consensus process of the blockchain, resulting in the blockchain passively executing the same transaction in a globally consistent state and being unable to reject the management transaction for the smart contract. Summary of the invention
[0005] The embodiments of the present invention provide a smart contract management method and device to solve the problem in the prior art that the blockchain passively executes the same transaction in a globally consistent state and cannot refuse the management transaction of the smart contract.
[0006] On the one hand, an embodiment of the present invention provides a smart contract management method, which is applicable to each transaction processing node in the blockchain. For any transaction processing node, the method includes:
[0007] When processing a smart contract effectiveness management transaction, obtaining a first review result of pre-effectiveness transaction information, where the pre-effectiveness transaction information is determined based on the smart contract information and a contract effectiveness operation or a contract upgrade operation for the smart contract information;
[0008] If it is determined that the first audit result is approved, generating effective consensus information, and sending the effective consensus information to other transaction processing nodes;
[0009] The effectiveness management consensus result is determined according to the obtained target node list and each effectiveness consensus information received, and when it is determined that the effectiveness management consensus result meets the obtained effectiveness management conditions, the smart contract effectiveness management transaction is determined to be completed.
[0010] In an embodiment of the present invention, when each transaction processing node performs an effective management transaction on a smart contract, it first obtains the audit results of each transaction processing node on the smart contract information operation, and then, when it is determined that the audit result is passed, it generates effective consensus information and sends it to other transaction processing nodes, so as to notify other transaction processing nodes that they have agreed to perform effective management on the smart contract; each transaction processing node has sent the effective consensus information to each target node, and determines the effective management consensus result based on the target nodes to which the effective consensus information has been sent; if it is determined that the effective management consensus result meets the effective management conditions, it can be determined that the smart contract effective management transaction is completed, that is, the management transaction for the contract effectiveness is executed.
[0011] Through the above process, the processing process of smart contract effectiveness management transactions is divided into two stages, one is the stage of reviewing the smart contract information operation, and the other is the consensus process of each transaction node with other transaction nodes. In the consensus process, the consensus result of the target node is considered, rather than the consensus result of all blockchain nodes, and whether the consensus result of the target node can take effect is determined by setting the effectiveness management conditions. Therefore, in the embodiment of the present invention, the review and consensus process of the smart contract information operation are decoupled, and whether the consensus can take effect is determined based on the node information of each target node that has actual processing significance for the smart contract effectiveness management transaction, that is, the two processing results of the transaction taking effect or the transaction not taking effect are determined by the review result of the effective transaction processing node. Compared with the prior art, the efficiency and accuracy of smart contract management are improved.
[0012] Optionally, the target node list includes identification information of each target node, the effective management condition is a node quantity threshold, and the effective management consensus result is determined according to the acquired target node list and each received effective consensus information, including:
[0013] Determine, according to each received valid consensus information, each node identification information of each transaction processing node corresponding to each valid consensus information;
[0014] The transaction processing node corresponding to the node identification information that matches the identification information in the target node list in each node identification information is taken as the target node;
[0015] The total number of target nodes is used as the effective management consensus result;
[0016] Determine whether the effective management consensus result meets the effective management conditions obtained, including:
[0017] If it is determined that the total number of target nodes is greater than the node number threshold, it is determined that the effective management consensus result meets the obtained effective management conditions.
[0018] In an embodiment of the present invention, if it is determined that the total number of target nodes that have passed the audit result is greater than the node number threshold, then the result for the effective management transaction can be determined to be a consensus success. Compared with the prior art of reaching a consensus through all nodes in the blockchain, only the total number of target nodes is counted, and the audit results of other nodes are not used, thereby realizing differentiated management of smart contract effective management transactions, so that each target node that has effective management rights over the effective management transaction can effectively manage the smart contract effective management transaction.
[0019] Optionally, the target node list includes identification information of each target node and a weight value corresponding to each target node. The effective management condition is a total weight threshold. Each transaction processing node determines the effective management consensus result according to the obtained target node list and each effective consensus information received, including:
[0020] Determine the node identification information of each transaction processing node corresponding to each valid consensus information according to each received valid consensus information;
[0021] The transaction processing node corresponding to the node identification information that matches the identification information in the target node list in each node identification information is used as the target node, and the weight value of the target node is determined according to the weight value in the target node list;
[0022] The total weight value of each target node is used as the effective management consensus result;
[0023] Determine whether the effective management consensus result meets the effective management conditions obtained, including:
[0024] If it is determined that the total weight value is greater than the total weight threshold, it is determined that the effective management consensus result meets the obtained effective management conditions.
[0025] In an embodiment of the present invention, a weight can be assigned to each target node according to the different management permissions for the smart contract effectiveness management transaction, and whether the effectiveness management transaction can be completed is determined by calculating the total weight of the target node and the total weight threshold, thereby realizing the management of different permissions of each target node for management transactions.
[0026] Optionally, if it is determined that the first audit result is approved, generating effective consensus information and sending the effective consensus information to other nodes includes:
[0027] If the first audit result is determined to be a pass result, first effective consensus information is generated and sent to other transaction processing nodes;
[0028] Determine the first effective management consensus result according to the target node list and each received first effective consensus information, and send the second effective consensus information to other transaction processing nodes when it is determined that the first effective management consensus result meets the effective management condition;
[0029] The effective management consensus result is determined based on the obtained target node list and each effective consensus information received, including:
[0030] Determine the second effective management consensus result according to the target node list and each received second effective consensus information;
[0031] When it is determined that the effective management consensus result meets the obtained effective management conditions, the smart contract effective management transaction is completed, including:
[0032] When it is determined that the second effectiveness management consensus result meets the obtained effectiveness management conditions, it is determined that the smart contract effectiveness management transaction is completed.
[0033] In the embodiment of the present invention, the consensus information includes two stages. The first stage is to determine whether the audit result of the target node is passed by consensus. The other stage is to determine whether the audit result can be executed after the consensus is determined, that is, whether the smart contract effectiveness management transaction can be completed.
[0034] Optionally, each transaction processing node includes a master transaction processing node and a slave transaction processing node, and before processing the smart contract effectiveness management transaction, it also includes:
[0035] The master transaction processing node determines the pre-effective transaction information based on the acquired smart contract information, the smart contract effectiveness operation or smart contract upgrade operation for the smart contract information, the target node list and the effectiveness management conditions, and sends the pre-effective transaction information to the slave transaction processing node;
[0036] The master transaction processing node sends a review request to the slave transaction processing node, determines a first review result for the pre-effective transaction information, and saves the first review result in a private database of the master transaction processing node. The review request is used to instruct the slave transaction processing node to review the pre-effective transaction information.
[0037] The master transaction processing node determines the smart contract effectiveness management transaction and sends the smart contract effectiveness management transaction processing request to other slave transaction processing nodes.
[0038] In an embodiment of the present invention, the transaction processing node includes a master node and a slave node. The master node is used to determine the pre-transaction information and notify the slave node to review it. The master node and the slave node will save the review results in their respective private databases to record whether the operation of the smart contract to take effect and manage the transaction is agreed. The master node is the node that determines the smart contract to take effect and manage the transaction. By setting the master node and the slave node, hierarchical management of the smart contract to take effect and manage the transaction is achieved.
[0039] Optionally, after the smart contract management transaction is completed, it also includes:
[0040] When processing a smart contract invalidation management transaction, obtain a second review result of the invalidation pre-transaction information, the invalidation pre-transaction information is determined based on the smart contract information and any one of the smart contract destruction operation, smart contract freezing operation and smart contract thawing operation performed on the smart contract information, the smart contract invalidation management transaction request is sent by the smart contract deployment node, and the smart contract deployment node is any one of the transaction processing nodes and non-transaction processing nodes in the blockchain;
[0041] If the second audit result is determined to be approved, an invalidation consensus message is generated and sent to other transaction processing nodes;
[0042] The failure management consensus result is determined according to the target node list and the received failure consensus message, and when it is determined that the failure management consensus result meets the acquired failure management condition, the smart contract failure management transaction is determined to be completed.
[0043] In the embodiment of the present invention, after the effectiveness management transaction is completed, the invalidation management transaction of the smart contract is also involved. Therefore, in the embodiment of the present invention, the invalidation management transaction voting process can be separated from the invalidation management transaction process to complete the effective management of the invalidation management transaction.
[0044] Optionally, the transaction processing node is any node in the target node list.
[0045] In the embodiment of the present invention, the target node may be the one that performs transaction processing in the blockchain, and other nodes may or may not perform the process of smart contract management.
[0046] On the one hand, an embodiment of the present invention provides a smart contract management device, including:
[0047] A first audit result obtaining unit, used to obtain a first audit result of pre-effective transaction information when processing a smart contract effectiveness management transaction, where the pre-effective transaction information is determined based on the smart contract information and a contract effectiveness operation or a contract upgrade operation for the smart contract information;
[0048] The effective consensus information determination unit is used to generate effective consensus information if the first audit result is determined to be approved, and send the effective consensus information to other transaction processing nodes;
[0049] The smart contract management execution unit is used to determine the effectiveness management consensus result based on the obtained target node list and the received effectiveness consensus information, and when it is determined that the effectiveness management consensus result meets the obtained effectiveness management conditions, determine to complete the smart contract effectiveness management transaction.
[0050] Optionally, the target node list includes identification information of each target node, the effective management condition is a node quantity threshold, and the smart contract management execution unit is specifically used to:
[0051] Determine, according to each received valid consensus information, each node identification information of each transaction processing node corresponding to each valid consensus information;
[0052] The transaction processing node corresponding to the node identification information that matches the identification information in the target node list in each node identification information is taken as the target node;
[0053] The total number of target nodes is used as the effective management consensus result;
[0054] If it is determined that the total number of target nodes is greater than the node number threshold, it is determined that the effective management consensus result meets the obtained effective management conditions.
[0055] Optionally, the target node list includes identification information of each target node and a weight value corresponding to each target node. The effective management condition is a total weight threshold. The smart contract management execution unit is specifically used to:
[0056] Determine the node identification information of each transaction processing node corresponding to each valid consensus information according to each received valid consensus information;
[0057] The transaction processing node corresponding to the node identification information that matches the identification information in the target node list in each node identification information is used as the target node, and the weight value of the target node is determined according to the weight value in the target node list;
[0058] The total weight value of each target node is used as the effective management consensus result;
[0059] If it is determined that the total weight value is greater than the total weight threshold, it is determined that the effective management consensus result meets the obtained effective management conditions.
[0060] Optionally, the effective consensus information determination unit is specifically used for:
[0061] If the first audit result is determined to be a pass result, first effective consensus information is generated and sent to the transaction processing node;
[0062] Determine the first effective management consensus result according to the target node list and each received first effective consensus information, and send the second effective consensus information to other transaction processing nodes when it is determined that the first effective management consensus result meets the effective management condition;
[0063] The smart contract management execution unit is specifically used for:
[0064] Determine the second effective management consensus result according to the target node list and each received second effective consensus information;
[0065] When it is determined that the second effectiveness management consensus result meets the effectiveness management conditions, the contract effectiveness management transaction is determined to be completed.
[0066] Optionally, each transaction processing node includes a master transaction processing node and a slave transaction processing node, and the device further includes:
[0067] A pre-effective transaction information determination unit, configured to determine the pre-effective transaction information according to the acquired contract information, the contract effectiveness operation or the contract upgrade operation for the contract information, the target node list and the effectiveness management conditions, and send the pre-effective transaction information to the slave transaction processing node;
[0068] A second audit result determination unit is used to send an audit request to the slave transaction processing node, determine a first audit result for the pre-effective transaction information, and save the first audit result in a private database of the master transaction processing node, wherein the audit request is used to instruct the slave transaction processing node to audit the pre-effective transaction information;
[0069] The contract effectiveness management transaction determination unit is used to determine the contract effectiveness management transaction and send the contract effectiveness management transaction processing request to other slave transaction processing nodes.
[0070] Optionally, the contract effectiveness management transaction determination unit is specifically used to:
[0071] When processing a contract expiration management transaction, obtain a second audit result of the pre-expiration transaction information, the pre-expiration transaction information is determined based on the contract information and any of the contract destruction operation, contract freezing operation and contract thawing operation performed on the contract information, the contract expiration management transaction request is sent by the contract deployment node, and the contract deployment node is any of the transaction processing nodes and non-transaction processing nodes in the blockchain;
[0072] If the second audit result is determined to be approved, an invalidation consensus message is generated and sent to other transaction processing nodes;
[0073] The failure management consensus result is determined based on the target node list and the received failure consensus message, and when it is determined that the failure management consensus result meets the acquired failure management conditions, the smart contract failure management transaction is completed.
[0074] Optionally, the transaction processing node is any node in the target node list.
[0075] On the one hand, an embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above-mentioned smart contract management method when executing the program.
[0076] On the one hand, an embodiment of the present invention also provides a storage medium, which stores a computer program that can be executed by a computer device. When the program runs on the computer device, the computer device executes the steps of the above-mentioned smart contract management method.
[0077] The smart contract management method in the embodiment of the present invention can split the smart contract review process and the consensus process of the smart contract review result, avoiding the problem in the prior art that the same transaction is executed dynamically due to the consistency of the blockchain, and the management transaction of the smart contract cannot be rejected, thereby improving the efficiency and accuracy of smart contract management. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0079] Figure 1 A schematic diagram of a system architecture of a blockchain network provided by an embodiment of the present invention;
[0080] Figure 2 A flowchart of a smart contract management method provided by an embodiment of the present invention;
[0081] Figure 3 A flowchart of a smart contract effectiveness management method provided by an embodiment of the present invention;
[0082] Figure 4 A flowchart of a smart contract failure management method provided by an embodiment of the present invention;
[0083] Figure 5 A schematic diagram of the structure of a smart contract management device provided by an embodiment of the present invention;
[0084] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0085] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0086] For ease of understanding, the terms involved in the embodiments of the present application are explained below:
[0087] Blockchain system: refers to a system that uses blockchain technology to store data. Blockchain technology, also known as distributed ledger technology, is an Internet database technology that is decentralized, open and transparent, allowing everyone to participate in database records. Blockchain technology can be a distributed infrastructure and computing method that uses block chain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses smart contracts composed of automated script codes to program and operate data. The data stored in the blockchain system has high stability and reliability. The blockchain system is an unalterable and trustworthy database. Therefore, compared with the traditional method of centrally storing data related to mortgage business, using a blockchain system to store data related to mortgage business will help improve the security and reliability of data related to mortgage business.
[0088] Smart contract: A computer protocol designed to communicate, verify or execute contracts in an information-based manner. The purpose of smart contracts is to provide a security method superior to traditional contracts and reduce other transaction costs associated with contracts. Smart contracts allow trusted transactions without a third party, which are traceable and irreversible.
[0089] Consensus algorithm: refers to the mathematical algorithm used to establish trust and obtain rights between different node devices in the blockchain system. In the blockchain system, through the voting of special node devices, the verification and confirmation of transactions can be completed in a very short time. For a transaction, if several node devices with irrelevant interests can reach a consensus, it can be considered that all node devices in the system can also reach a consensus on the transaction.
[0090] In the specific practice process, the inventor of this application found that when managing smart contracts, it is necessary to record the status of the smart contracts in the blockchain. The process of modifying the status of the smart contracts is usually carried out by sending transactions to the blockchain. The transactions are consensus-based on the blockchain nodes on the chain, and after the consensus operation is completed, the transactions are written into the blockchain, and the status of the smart contract is modified accordingly.
[0091] However, in the prior art, there are problems with the management process of the smart contract status. In the prior art, the consensus process of whether the smart contract management transaction can be implemented is coupled with the consensus process of the blockchain nodes. In the process of modifying the smart contract status, as long as there are 3f+1 (f is the number of fault-tolerant nodes) blockchain nodes in the blockchain that sign the information package of the smart contract management transaction, the smart contract management transaction can be passed, and the status of the smart contract in the blockchain node is modified. However, some nodes in the blockchain do not have a meaningful management of the smart contract status. If the 3f+1 blockchain nodes that do not have a meaningful sign on the information package of the smart contract management transaction, then regardless of whether the blockchain nodes that have a meaningful management of the smart contract status agree to the transaction, the transaction is passively executed, that is, the status of the smart contract is modified.
[0092] Based on the above problems, the inventor of this application proposes a smart contract management method, which is applicable to each transaction processing node in the blockchain. Specifically, when each transaction processing node in the blockchain reaches a consensus on the smart contract effectiveness management transaction, it first obtains the review result of whether each transaction processing node agrees with the smart contract effectiveness management. If it agrees, it sends a validity consensus message to other transaction processing nodes. In this application, the blockchain node with authority to manage smart contracts is defined as the target node, and the target node list and the set effectiveness management conditions are used to determine whether each transaction processing node can reach a consensus. Therefore, each transaction processing node determines whether the smart contract effectiveness management transaction can be completed according to the target nodes that send the consensus message and the effectiveness management conditions.
[0093] The processing process of the smart contract effectiveness management transaction in the embodiment of the present invention is divided into two stages, one is the stage of reviewing the smart contract information operation, and the other is the consensus process of each transaction node and other transaction nodes. In the consensus process, the consensus result of the target node is considered, rather than the consensus result of all blockchain nodes, and whether the consensus result of the target node can take effect is determined by setting the effectiveness management conditions. Therefore, in the embodiment of the present invention, the review of the smart contract information operation and the consensus process are decoupled, and whether the consensus can take effect is determined based on the node information of each target node that has actual processing significance for the smart contract effectiveness management transaction, that is, the two processing results of the transaction taking effect or the transaction not taking effect are determined by the review result of the effective transaction processing node. Compared with the prior art, the efficiency and accuracy of smart contract management are improved.
[0094] After introducing the design ideas of the embodiments of the present application, the following briefly introduces the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limited. In specific implementation, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.
[0095] Figure 1 A schematic diagram of the architecture of a blockchain system 100 provided in an embodiment of the present invention is shown in FIG. Figure 1 As shown, one or more blockchain nodes 110 may be provided in the blockchain system 100; wherein any two blockchain nodes 110 may be connected via a wired manner or wirelessly, so as to jointly maintain the blockchain system 100.
[0096] Each blockchain node 110 in the blockchain system 100 can also communicate with the client 120 to process and store transaction data sent by the client 120. Each blockchain node 110 includes multiple blocks 1101, and each block 1101 is used to store transaction data sent by the client 120.
[0097] In the embodiment of the present application, the transaction processing node may be all blockchain nodes 110 in the blockchain system 100, or may be part of the blockchain nodes 110.
[0098] Furthermore, different blockchain nodes 110 may have different permissions for transaction data sent by the client 120. For example, some blockchain nodes 110 have the permission to review transactions, while some blockchain nodes 110 do not have the permission to review transactions, such as regulatory agencies.
[0099] It should be noted that the above Figure 1 The structure shown is only an example and is not limited to this embodiment of the present invention.
[0100] To further illustrate the technical solution provided by the embodiment of the present application, this is described in detail below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiment of the present application provides the method operation steps shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided in the embodiment of the present application.
[0101] Combine the following Figure 2 , the technical solution provided by the embodiment of the present invention is described, specifically including:
[0102] Step S201, when processing the smart contract effectiveness management transaction, each transaction processing node in the blockchain obtains a first review result of the pre-effective transaction information. The pre-effective transaction information is determined based on the smart contract information and the smart contract effectiveness operation or smart contract upgrade operation for the smart contract information.
[0103] In the embodiment of the present invention, each transaction processing node may be all blockchain nodes in the blockchain, or may be part of the blockchain nodes. In an optional embodiment, the blockchain includes transaction processing nodes and non-transaction processing nodes, the transaction processing nodes are nodes with set functions that can manage transactions, and the non-transaction processing nodes are nodes that do not have transaction management capabilities.
[0104] Specifically, a smart contract effectiveness management transaction is to modify or upgrade the status of a smart contract. In other words, a smart contract effectiveness management transaction is a transaction sent to the blockchain when a smart contract is deployed or upgraded. A smart contract effectiveness management transaction can be sent by the client or determined by a transaction processing node in the blockchain based on information sent by the client. When the client determines that a smart contract needs to be effective, it sends an effectiveness message to the transaction processing node in the blockchain, and the transaction processing node determines the smart contract effectiveness management transaction based on the effectiveness message.
[0105] In the embodiment of the present invention, each transaction processing node has reviewed the pre-effective transaction information, that is, each transaction processing node has determined the voting result of the smart contract effectiveness management transaction, so in the embodiment of the present invention, the voting result determination process of the smart contract effectiveness management transaction and the consensus process of the smart contract effectiveness management transaction are carried out separately.
[0106] Optionally, in an embodiment of the present invention, the pre-effective transaction information is determined by any transaction processing node among the transaction processing nodes, or is determined by a set transaction node, or can be sent to the blockchain by the client.
[0107] The first review result of each transaction processing node on the pre-effective transaction information refers to the voting result on the effectiveness or upgrade management of the smart contract. The voting result can be passed or failed.
[0108] Furthermore, in order to prevent the voting results from being tampered with, each transaction processing node stores the first audit result in a private database, and does not allow the first audit result to be modified.
[0109] Therefore, in the embodiment of the present invention, each transaction processing node can obtain the first audit result of each transaction processing node from the private database when processing the smart contract effectiveness management transaction.
[0110] Optionally, in an embodiment of the present application, each transaction processing node includes a master transaction processing node and a slave transaction processing node. In an optional embodiment, before processing the smart contract effectiveness management transaction, each transaction processing node must also receive a review request sent by the master transaction processing node to review the pre-effective transaction information.
[0111] The pre-effective transaction information is generated by the main transaction processing node. The main transaction processing node can be the target node, or a blockchain node with set permissions in the blockchain, or a blockchain node that directly interacts with the client.
[0112] Specifically, the main transaction processing node determines the pre-effective transaction information based on the acquired smart contract information, the smart contract effectiveness operation or smart contract upgrade operation for the smart contract information, the target node list, and the effectiveness management conditions. The smart contract information can be the contract identifier and code of the smart contract information. Furthermore, the pre-effective transaction information also includes the pre-effective transaction identifier, which is used to characterize the uniqueness of the pre-effective transaction.
[0113] Step S202: If each transaction processing node determines that the first audit result is approved, it generates effective consensus information and sends the effective consensus information to other transaction processing nodes.
[0114] Specifically, after obtaining the first audit result, if each transaction processing node determines that the first audit result is passed, that is, the transaction processing node agrees to the effective management of the smart contract, it generates effective consensus information. This effective consensus information is used to notify other transaction processing nodes that it has agreed to the effective management of the smart contract.
[0115] Optionally, the effective consensus information also includes identification information of each transaction processing node, which is used to characterize the transaction processing node.
[0116] Since in the embodiment of the present invention, when each transaction processing node generates effective consensus information after determining that the first audit result is approved, when the audit result of each transaction processing node on the effective pre-information is unsuccessful, the effective consensus information is not generated.
[0117] Furthermore, in an embodiment of the present invention, the interaction between the transaction processing nodes can be achieved through the process of generating consensus information twice. Specifically, if each transaction processing node determines that the first review result is an approved result, it generates first effective consensus information and sends the first effective consensus information to the transaction processing node. The first effective consensus information is used to indicate to other transaction processing nodes that the smart contract effective management transaction has been reviewed and approved, and consensus can be reached.
[0118] Each transaction processing node determines the first effective management consensus result according to the target node list and the first effective consensus information received, and when it is determined that the first effective management consensus result meets the effective management conditions, it sends the second effective consensus information to other transaction processing nodes. That is to say, the second effective consensus information is the information used for actual consensus, and in an embodiment of the present invention, the first target node that has sent the first effective consensus information is determined by the obtained target node list, and it is determined whether the first effective consensus information is a consensus success according to the set effective management conditions. If the consensus is determined to be successful, each transaction processing node generates the second effective consensus information and sends the second effective consensus information to other transaction processing nodes.
[0119] In an embodiment of the present invention, each transaction processing node can send the above-mentioned effective consensus information, and can also receive effective consensus information sent by other transaction processing nodes. At the same time, each transaction processing node can use a variety of consensus algorithms when determining whether the first effective consensus information is successfully reached, such as a multi-party secure summation algorithm, etc., which is not specifically limited here.
[0120] In step S203, each transaction processing node determines the effectiveness management consensus result according to the obtained target node list and the received effectiveness consensus information, and determines to complete the smart contract effectiveness management transaction when it is determined that the effectiveness management consensus result meets the obtained effectiveness management conditions.
[0121] Specifically, each transaction processing node determines the effective management consensus result based on the obtained target node list and the received effective consensus information. There are multiple methods for determining the effective management consensus result. In an optional embodiment, the target node list includes the identification information of each target node, as shown in Table 1. Table 1 includes the identification information of each target node.
[0122] Table 1
[0123] Target Node Identification Information Target Node 1 Logo 1 Target Node 2 Logo 2 Target Node 3 Logo 3 …… ……
[0124] When each transaction processing node receives the effective consensus information sent by other transaction processing nodes, it obtains the identification information of each transaction processing node that sends the effective consensus information, and matches it with the identification information in Table 1. If the match is successful, it is determined that the effective consensus information sent by the target node has been received.
[0125] In an embodiment of the present invention, a method for setting an effective management condition is matched with the node information of the target node. In an optional embodiment, if the node information of the target node is quantity information, the set effective management condition is a quantity threshold; in another optional embodiment, if the node information of the target node is weight information, the set effective management condition is a weight threshold.
[0126] Optionally, in an embodiment of the present invention, the target node list also stores weight information of each target node. The weight information of each target node may be determined based on the management authority of different target nodes. The weights assigned to each target node may be the same or different.
[0127] After each transaction processing node determines the effective management consensus result according to the weight and / or quantity, it determines whether the set effective management conditions are met. If so, it is considered that the effective consensus information consensus is completed, and each transaction processing node modifies the status of the smart contract to the effective status, that is, changes the status of the smart contract to the effective status or changes the status of the smart contract to the upgraded status.
[0128] Specifically, the process of each transaction processing node determining whether the set effective management conditions are met is determined based on the specific content of the effective management consensus result and the effective management conditions. In an optional embodiment, the target node list includes identification information of each target node, and the effective management condition is a node number threshold. The number of target nodes that have sent effective consensus information is determined by each transaction processing node. If it is determined that the total number of target nodes is greater than the node number threshold specified by the effective management condition, it is determined that the effective management consensus result meets the effective management condition.
[0129] Exemplarily, for any transaction processing node, the transaction processing node determines that it has received effective consensus information sent by 5 other transaction processing nodes. When it is determined that the effective management conditions are met, it is determined whether the transaction processing node is a target node based on the target node list. If it is a target node, it is determined that the number of target nodes that have sent effective consensus information is 6. If the total number of nodes specified by the effective management conditions is 5, it is determined that the effective management consensus result meets the effective management conditions.
[0130] In another optional embodiment, since each target node has different management permissions, the total weight value can also be determined by the weight value of the target node that has sent the effective consensus information, and then according to the total weight threshold specified by the effective management condition, if the total weight value is greater than the total weight threshold, it is determined that the effective management consensus result meets the effective management condition.
[0131] Furthermore, the transaction processing node can determine the weight of each target node through the target node list. That is, the target node list includes the identification information of the target node and the corresponding weight value. For example, as shown in Table 2, Table 2 includes the identification information and weight value of each target node.
[0132] Table 2
[0133] Target Node Identification Information Weight value Target Node 1 Logo 1 Weight 1 Target Node 2 Logo 2 Weight 2 Target Node 3 Logo 3 Weight 3 …… ……
[0134] In the embodiment of the present invention, the sum of the weight values is equal to 1, and the corresponding weight value of each weight value can be determined according to the management authority of each target node.
[0135] For any transaction processing node, the target node and the weight of the target node are determined based on the effective consensus information and target node list received from other transaction processing nodes, and it is determined whether the transaction processing node is the target node. If it is the target node, the weight of the transaction processing node is obtained from the target list, and the total weight value of all target nodes including the transaction processing node is determined. If it is determined that the total weight value is greater than the total weight specified by the effective management conditions, it is determined that the effective management consensus result meets the effective management conditions.
[0136] Exemplarily, for transaction processing node A, the received effective consensus information is sent by transaction processing node B, transaction processing node C and transaction processing node D, and the target node list determines that transaction processing node A, transaction processing node B, transaction processing node C and transaction processing node D are all target nodes, and at the same time, the target node list determines that the weight value of transaction processing node A is 0.4, the weight value of transaction processing node B is 0.2, the weight value of transaction processing node C is 0.1, and the weight value of transaction processing node D is 0.1. The total weight value of transaction processing node A, transaction processing node B, transaction processing node C and transaction processing node D is 0.8 through calculation, and the total weight value threshold specified by the effective management condition is 0.7, then it is determined that the effective management consensus result meets the effective management condition.
[0137] When each transaction processing node determines that the effectiveness management consensus result meets the effectiveness management conditions, it determines that the smart contract effectiveness management transaction is completed, that is, the status of the smart contract in the block is changed to the effective state.
[0138] Specifically, after the smart contract effectiveness management transaction is determined to be completed, the status of the smart contract in the block of each transaction processing node is modified to the effective state, and the other blockchain nodes in the blockchain will also modify the status of the smart contract to the effective state. These blockchain nodes may be blockchain nodes that do not agree to modify the status of the smart contract. In an optional embodiment, the other blockchain nodes may be non-transaction processing nodes, so through the above method, the transaction processing nodes and non-transaction processing nodes in the blockchain will modify the status of the smart contract to the effective state.
[0139] After introducing the main processing procedures for completing the smart contract effectiveness management transaction as mentioned above, we will now perform invalidation management on the smart contracts that have been effective or upgraded. Specifically, invalidation management can be the smart contract destruction operation, smart contract freezing operation, and smart contract thawing operation on the smart contract.
[0140] Specifically, in an embodiment of the present application, each transaction processing node obtains a second audit result of the pre-invalidation transaction information when processing a smart contract invalidation management transaction. The pre-invalidation transaction information is determined based on the smart contract information and any one of the smart contract destruction operation, smart contract freezing operation and smart contract thawing operation performed on the smart contract information. The smart contract invalidation management transaction request is sent by the smart contract deployment node, and the smart contract deployment node is any one of the transaction processing nodes and non-transaction processing nodes described in the blockchain.
[0141] If each transaction processing node determines that the second audit result is approved, it generates an invalidation consensus message and sends the invalidation consensus message to other transaction processing nodes. Each transaction processing node determines the invalidation management consensus result based on the target node list and the received invalidation consensus message, and when it is determined that the invalidation management consensus result meets the acquired invalidation management conditions, it determines to complete the smart contract invalidation management transaction.
[0142] From the above content, it can be seen that the process of each transaction processing node in processing the smart contract invalidation management transaction is similar to the process of processing the effectiveness management transaction. The smart contract invalidation management transaction request is sent by the smart contract deployment node. The smart contract deployment node can be the above-mentioned transaction processing node or other nodes in the blockchain.
[0143] Specifically, before processing the smart contract invalidation management transaction, each transaction processing node also needs to receive the pre-invalidation transaction information and review the pre-invalidation transaction information.
[0144] In an embodiment of the present invention, the pre-invalidation transaction information may be generated by a smart contract deployment node. Specifically, the pre-invalidation transaction information includes identification information of the pre-invalidation transaction and identification information of the smart contract.
[0145] When the smart contract deployment node generates the pre-expiration transaction information, it sends the pre-expiration transaction information to each transaction processing node and sends a review request to the transaction processing node. Each transaction processing node reviews the pre-expiration transaction information, and the review result is to agree to the expiration management or disagree to the expiration management.
[0146] Therefore, in an embodiment of the present invention, the smart contract deployment node first obtains the identification information of the smart contract to construct the pre-invalidation transaction information, and the pre-invalidation transaction information also includes the identification information of the pre-invalidation transaction.
[0147] The smart contract deployment node sends the invalid pre-transaction information to each transaction processing node. The smart contract deployment node sends an audit request for the invalid pre-transaction information to each transaction processing node. The smart contract deployment node and each transaction processing node audit the invalid pre-transaction information and save the audit results in the private database of the smart contract deployment node and each transaction processing node.
[0148] Specifically, the process of generating an invalidation consensus transaction is similar to the process of generating an effective consensus transaction. Specifically, each transaction processing node obtains the second audit result of the invalidation pre-transaction information when processing the smart contract invalidation management transaction. If each transaction processing node determines that the second audit result is approved, it generates a first invalidation consensus message and sends the first invalidation consensus information to the transaction processing node; each transaction processing node determines the first effective management consensus result of each target node that has sent the first invalidation consensus information based on the target node list and the received first invalidation consensus information, and sends the second effective consensus information to other transaction processing nodes when it is determined that the first effective management consensus result meets the acquired invalidation management condition.
[0149] When each transaction processing node determines the target nodes to which the invalidation consensus message has been sent according to the target node list, and determines the invalidation management consensus result according to the target node list and the received invalidation consensus message; when it is determined that the invalidation management consensus result meets the acquired invalidation management conditions, it is determined that the smart contract invalidation management transaction is completed.
[0150] Similarly, the process of determining whether the failure management consensus result meets the acquired failure management conditions can also be judged using the total number of target nodes or the total weight value, which will not be elaborated here.
[0151] After introducing the effectiveness management and expiration management process of smart contracts, the following is an exemplary explanation based on the processing flow. Specifically, Figure 3 As shown in the figure, for the effectiveness management process of smart contracts, the blockchain nodes involved are the target nodes and other nodes. The specific implementation process is as follows:
[0152] Step S301, the master node constructs pre-effective transaction information, which includes: 1) the identifier and code of the smart contract that needs to be deployed / upgraded; 2) a list of target nodes; 3) the weight value of each target node; 4) the minimum weight value for the smart contract to take effect; 5) the identifier of the pre-effective transaction information. In this embodiment of the present invention, the master node is any node among the target nodes;
[0153] Step S302, the master node sends the effective pre-transaction information to other target nodes and non-target nodes in the blockchain;
[0154] Step S303: The master node, other target nodes, and non-target nodes reach consensus on the pre-effective transaction information and upload it to the blockchain. After the information is uploaded to the blockchain, all nodes in the blockchain network (including each target node and each non-target node) have the smart contract information, and the smart contract has not yet come into effect and cannot be called;
[0155] Step S304: The master node notifies each target node and non-target node to audit the smart contract information that has been uploaded to the chain;
[0156] Step S305: Each target node (including the master node) and non-target node audits the deployment / upgrade smart contract code and the target node weight, and records the pre-effective transaction information in its own private database. The key of the pre-effective transaction information is the identifier of the pre-effective transaction information, and the value is the initiator master node of the deployment / upgrade smart contract, whether it agrees to the deployment / upgrade operation, and other contents of the pre-effective transaction information.
[0157] Step S306, the master node constructs a smart contract validation transaction and sends it to the blockchain;
[0158] Step S307: When each target node (including the master node) and non-target node executes the smart contract effective transaction, it determines whether the smart contract information is recorded in its own private database. If the smart contract information is recorded, it determines whether it agrees to deploy / upgrade the smart contract. If it agrees, it executes step S308, otherwise it executes step S309;
[0159] Step S308, each target node (including the master node) and non-target node signs the execution result, and then executes step S310;
[0160] Step S309, each target node (including the master node) and non-target nodes ignore the transaction;
[0161] Step S310, each target node (including the master node) and non-target node broadcasts a pre-prepare message packet;
[0162] Step S311: After each target node (including the master node) and non-target node collects the pre-prepare message packet, the weight information of each signature target node is counted to determine whether the minimum weight value is met. If so, step S312 is executed, otherwise step S313 is executed;
[0163] Step S312, each target node (including the master node) and non-target node executes the result and signs it, and then executes step S314;
[0164] Step S313: each target node (including the master node) and non-target nodes do not broadcast;
[0165] Step S314, each target node (including the master node) and non-target node broadcasts a commit message packet;
[0166] Step S315: After each target node (including the master node) and non-target node collects the commit message packet, it counts the weight information of the signature target node to determine whether the minimum weight value is met. If so, execute step S316; otherwise, execute step S317;
[0167] Step S316: Each target node (including the master node) and non-target node confirms the transaction is placed on disk, and the deployed / upgraded smart contract takes effect and can be called later;
[0168] Step S317: Each target node (including the master node) and non-target node determines that the deployed / upgraded smart contract is not effective.
[0169] From the above content, it can be seen that for the deployment and upgrade process of smart contracts, after determining that the target node agrees to deploy or upgrade the smart contract, and the weight value of the target node that agrees to deploy or upgrade the smart contract is greater than the minimum weight value, the deployment and upgrade of the smart contract are determined to be effective, and the review results of the deployment or upgrade of the smart contract by each non-target node will not affect the final deployment and upgrade of the smart contract. After each target node determines that the deployment and upgrade of the smart contract are effective, each non-target node also determines that the deployment and upgrade of the smart contract are effective.
[0170] The following is a more specific example of the management method of each node in the blockchain for the effectiveness or upgrade of the smart contract. The specific blockchain includes each target node and non-target node 1 and non-target node 2. Exemplarily, the target nodes in the target list are shown in Table 3, and the weight value of each target node is also shown in Table 3.
[0171] Table 3
[0172] Target Node Identification Information Weight value Target Node 1 Logo 1 0.3 Target Node 2 Logo 2 0.1 Target Node 3 Logo 3 0.2 Target Node 4 Logo 4 0.1 Target Node 5 Logo 5 0.1 Target Node 6 Logo 6 0.2
[0173] Target node 1 is the main node. Target node 1 constructs pre-transaction information before effectiveness. The pre-transaction information before effectiveness includes: 1) the identifier and code of the smart contract that needs to be deployed / upgraded; 2) the target node list; 3) the weight value of each target node; 4) the minimum weight value for the smart contract to take effect; 5) the identifier of the pre-transaction information before effectiveness. The target node list in the embodiment of the present invention is shown in Table 3, and the weight value of each target node is also shown in Table 3.
[0174] Target node 1 sends the pre-effective transaction information to target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2. Each node reaches a consensus on the pre-effective transaction information and uploads it to the chain. After the information is uploaded to the chain, all nodes in the blockchain network have the smart contract information, and the smart contract has not yet taken effect and cannot be called.
[0175] Target node 1 notifies target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2 to audit the smart contract information on the chain. At the same time, target node 1 also audits the smart contract information on the chain.
[0176] The audit result of target node 1 is audit passed, the audit result of target node 2 is audit passed, the audit result of target node 3 is audit failed, the audit result of target node 4 is audit passed, the audit result of target node 5 is audit failed, and the audit result of target node 6 is audit passed. The audit result of non-target node 1 is audit failed, and the audit result of non-target node 2 is audit passed.
[0177] Each of the above nodes audits the deployment / upgrade smart contract code and the target node weight, and records the pre-effective transaction information in its own private database. The key of the pre-effective transaction information is the identifier of the pre-effective transaction information, and the value is the initiator of the deployment / upgrade smart contract, whether it agrees to the deployment / upgrade operation, and other contents of the pre-effective transaction information.
[0178] Target node 1 constructs a smart contract validation transaction and sends it to the blockchain.
[0179] When each node executes a smart contract transaction, it determines whether the smart contract information is recorded in its own private database. If so, it determines whether it agrees to deploy / upgrade the smart contract. If it agrees, it signs the execution result and sends a pre-prepare message package.
[0180] Specifically, target node 1, target node 2, target node 4, target node 6 and non-target node 2 execute results and sign, and send a pre-prepare message packet.
[0181] Each of target node 1, target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2 counts the weight information of each signature target node to determine whether the minimum weight value is met. In an embodiment of the present invention, the minimum weight value is 0.6, and the weight information of each signature target node is counted as 0.3+0.1+0.1+0.2=0.7, then it is determined that the minimum weight value is met.
[0182] Target node 1, target node 2, target node 4, target node 6 and non-target node 2 broadcast commit message packets. Each of target node 1, target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2 counts the weight information of the signature target node to determine whether the minimum weight value is met. Specifically, in an embodiment of the present invention, the weight information of each signature target node is counted as 0.3+0.1+0.1+0.2=0.7, then it is determined that the minimum weight value is met.
[0183] Target node 1, target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2 confirm the transaction, and the deployed / upgraded smart contract takes effect and can be called later.
[0184] After introducing the deployment or upgrade management of smart contracts, the following describes the management of the destruction, freezing or unfreezing of smart contracts with specific embodiments. Specifically, Figure 4 As shown in the figure, for the effectiveness management process of smart contracts, the blockchain nodes involved are the target nodes and other nodes. The specific implementation process is as follows:
[0185] Step S401: any smart contract deployment node that has deployed a smart contract builds pre-invalidation transaction information, where the pre-invalidation transaction information includes: 1) the identifier of the smart contract that needs to be invalidated; 2) the identifier of the pre-invalidation transaction information;
[0186] Step S402, the smart contract deployment node sends the invalidation pre-transaction information to the target node and non-target nodes in the blockchain;
[0187] Step S403: each target node and non-target node reaches consensus on the invalid pre-transaction information and uploads it to the chain;
[0188] Step S404, the smart contract deployment node notifies each target node and non-target node to audit the invalidated pre-transactions that have been uploaded to the chain;
[0189] Step S405: Each target node (including the master node) and non-target node audits the invalidation pre-transaction and records the effective pre-transaction information in its own private database. The key of the invalidation pre-transaction information is the identifier of the effective pre-transaction information, and the value is the initiating master node of the deployment / upgrade of the smart contract, whether it agrees to the invalidation management operation, and other contents of the invalidation pre-transaction information.
[0190] Step S406, the smart contract deployment node constructs a smart contract invalidation transaction and sends it to the blockchain;
[0191] Step S407: When each target node and non-target node executes the smart contract invalidation transaction, it determines whether it agrees with the invalidation management of the smart contract. If it agrees, it executes step S408; otherwise, it executes step S409;
[0192] Step S408, each target node and non-target node signs the execution result, and then executes step S410;
[0193] Step S409, each target node and non-target node ignores the transaction;
[0194] Step S410, each target node and non-target node broadcasts a pre-prepare message packet;
[0195] Step S411: After each target node and non-target node collects the pre-prepare message packet, the weight information of each signature target node is counted to determine whether the minimum weight value is met. If so, step S412 is executed, otherwise step S413 is executed;
[0196] Step S412, each target node and non-target node executes the result and signs it, and then executes step S414;
[0197] Step S413: each target node and non-target node does not broadcast;
[0198] Step S414, each target node and non-target node broadcasts a commit message packet;
[0199] Step S415: After each target node and non-target node collects the commit message packet, it counts the weight information of the signature target node to determine whether the minimum weight value is met. If so, execute step S416; otherwise, execute step S417;
[0200] Step S416: Each target node and non-target node determines the transaction placement and manages the failure of the smart contract;
[0201] Step S417: The smart contract expiration management is not effective for each target node and non-target node.
[0202] From the above content, it can be seen that for the invalidation management process of the smart contract, after determining that the target node agrees to the invalidation management of the smart contract, and when the weight value of the target node that agrees to the invalidation management is greater than the minimum weight value, the smart contract is determined to be invalid, and the invalidation management results of the smart contract by each non-target node will not affect the final invalidation management of the smart contract. After each target node determines the invalidation of the smart contract, each non-target node also determines that the smart contract is invalid.
[0203] The following is a more specific example to introduce the failure management method for smart contracts of each node in the blockchain. The specific blockchain includes each target node and non-target node 1 and non-target node 2. Exemplarily, the target nodes in the target list are shown in Table 3, and the weight value of each target node is also shown in Table 3.
[0204] The smart contract deployment node is target node 1, and target node 1 constructs pre-invalidation transaction information, which includes: 1) the identifier of the smart contract that needs to be invalidated; 2) the identifier of the pre-invalidation transaction information.
[0205] Target node 1 sends the invalid pre-transaction information to target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2, and each node reaches consensus on the effective pre-transaction information and uploads it to the chain.
[0206] Target node 1 notifies target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2 to perform an invalidation management audit on the smart contract information that has been uploaded to the chain. At the same time, target node 1 also performs an invalidation management audit on the smart contract information that has been uploaded to the chain.
[0207] The audit result of target node 1 is audit passed, the audit result of target node 2 is audit passed, the audit result of target node 3 is audit failed, the audit result of target node 4 is audit passed, the audit result of target node 5 is audit failed, and the audit result of target node 6 is audit passed. The audit result of non-target node 1 is audit failed, and the audit result of non-target node 2 is audit passed.
[0208] Each of the above nodes audits the invalidation management and target node weight of the smart contract, and records the invalidation pre-transaction information in its own private database. The key of the effective pre-transaction information is the identifier of the invalidation pre-transaction information, and the value is the initiating node of the invalidation pre-transaction, whether it agrees to the invalidation management operation, and other contents of the invalidation pre-transaction information.
[0209] Target node 1 constructs a smart contract invalidation transaction and sends it to the blockchain.
[0210] When each node executes a smart contract invalidation transaction, it determines whether the invalid smart contract information in its own private database is agreed. If agreed, it signs the execution result and sends a pre-prepare message package.
[0211] Specifically, target node 1, target node 2, target node 4, target node 6 and non-target node 2 execute results and sign, and send a pre-prepare message packet.
[0212] Each of target node 1, target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2 counts the weight information of each signature target node to determine whether the minimum weight value is met. In an embodiment of the present invention, the minimum weight value is 0.6, and the weight information of each signature target node is counted as 0.3+0.1+0.1+0.2=0.7, then it is determined that the minimum weight value is met.
[0213] Target node 1, target node 2, target node 4, target node 6 and non-target node 2 broadcast commit message packets. Each of target node 1, target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2 counts the weight information of the signature target node to determine whether the minimum weight value is met. Specifically, in an embodiment of the present invention, the weight information of each signature target node is counted as 0.3+0.1+0.1+0.2=0.7, then it is determined that the minimum weight value is met.
[0214] Target node 1, target node 2, target node 3, target node 4, target node 5, target node 6, non-target node 1 and non-target node 2 confirm that the transaction is placed, that is, the smart contract is invalid.
[0215] Based on the same technical concept, the embodiment of the present application also provides a smart contract management device 500, such as Figure 5 As shown, including:
[0216] The first audit result obtaining unit 501 is used to obtain a first audit result of pre-effective transaction information when processing a smart contract effectiveness management transaction, where the pre-effective transaction information is determined based on the smart contract information and the contract effectiveness operation or contract upgrade operation for the smart contract information;
[0217] The effective consensus information determination unit 502 is used to generate effective consensus information if it is determined that the first audit result is approved, and send the effective consensus information to other transaction processing nodes;
[0218] The smart contract management execution unit 503 is used to determine the effectiveness management consensus result according to the obtained target node list and the received effectiveness consensus information, and when it is determined that the effectiveness management consensus result meets the obtained effectiveness management conditions, determine to complete the smart contract effectiveness management transaction.
[0219] Optionally, the target node list includes identification information of each target node, the effective management condition is a node quantity threshold, and the smart contract management execution unit 503 is specifically used to:
[0220] Determine, according to each received valid consensus information, each node identification information of each transaction processing node corresponding to each valid consensus information;
[0221] The transaction processing node corresponding to the node identification information that matches the identification information in the target node list in each node identification information is taken as the target node;
[0222] The total number of target nodes is used as the effective management consensus result;
[0223] If it is determined that the total number of target nodes is greater than the node number threshold, it is determined that the effective management consensus result meets the obtained effective management conditions.
[0224] Optionally, the target node list includes identification information of each target node and a weight value corresponding to each target node, and the effective management condition is a total weight threshold. The smart contract management execution unit 503 is specifically used to:
[0225] Determine the node identification information of each transaction processing node corresponding to each valid consensus information according to each received valid consensus information;
[0226] The transaction processing node corresponding to the node identification information that matches the identification information in the target node list in each node identification information is used as the target node, and the weight value of the target node is determined according to the weight value in the target node list;
[0227] The total weight value of each target node is used as the effective management consensus result;
[0228] If it is determined that the total weight value is greater than the total weight threshold, it is determined that the effective management consensus result meets the obtained effective management conditions.
[0229] Optionally, the effective consensus information determining unit 502 is specifically used to:
[0230] If the first audit result is determined to be a pass result, first effective consensus information is generated and sent to the transaction processing node;
[0231] Determine the first effective management consensus result according to the target node list and each received first effective consensus information, and send the second effective consensus information to other transaction processing nodes when it is determined that the first effective management consensus result meets the effective management condition;
[0232] The smart contract management execution unit 503 is specifically used for:
[0233] Determine the second effective management consensus result according to the target node list and each received second effective consensus information;
[0234] When it is determined that the second effectiveness management consensus result meets the effectiveness management conditions, the contract effectiveness management transaction is determined to be completed.
[0235] Optionally, each transaction processing node includes a master transaction processing node and a slave transaction processing node, and the device further includes:
[0236] The pre-effective transaction information determination unit 504 is used to determine the pre-effective transaction information according to the acquired contract information, the contract effectiveness operation or contract upgrade operation for the contract information, the target node list and the effectiveness management conditions, and send the pre-effective transaction information to the slave transaction processing node;
[0237] The second audit result determination unit 505 is used to send an audit request to the slave transaction processing node, determine a first audit result for the pre-effective transaction information, and save the first audit result in a private database of the master transaction processing node. The audit request is used to instruct the slave transaction processing node to audit the pre-effective transaction information.
[0238] The contract effectiveness management transaction determination unit 506 is used to determine the contract effectiveness management transaction and send the contract effectiveness management transaction processing request to other slave transaction processing nodes.
[0239] Optionally, the contract effectiveness management transaction determination unit 506 is specifically used to:
[0240] When processing a contract expiration management transaction, obtain a second audit result of the pre-expiration transaction information, the pre-expiration transaction information is determined based on the contract information and any of the contract destruction operation, contract freezing operation and contract thawing operation performed on the contract information, the contract expiration management transaction request is sent by the contract deployment node, and the contract deployment node is any of the transaction processing nodes and non-transaction processing nodes in the blockchain;
[0241] If the second audit result is determined to be approved, an invalidation consensus message is generated and sent to other transaction processing nodes;
[0242] The failure management consensus result is determined based on the target node list and the received failure consensus message, and when it is determined that the failure management consensus result meets the acquired failure management conditions, the smart contract failure management transaction is completed.
[0243] Optionally, the transaction processing node is any node in the target node list.
[0244] Based on the same technical concept, the embodiment of the present application provides a computer device, such as Figure 6 As shown, it includes at least one processor 601 and a memory 602 connected to the at least one processor. The specific connection medium between the processor 601 and the memory 602 is not limited in the embodiment of the present application. Figure 6 For example, the processor 601 and the memory 602 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0245] In an embodiment of the present application, the memory 602 stores instructions that can be executed by at least one processor 601. The at least one processor 601 can execute the steps included in the aforementioned smart contract management method by executing the instructions stored in the memory 602.
[0246] Among them, the processor 601 is the control center of the computer device, which can use various interfaces and lines to connect various parts of the terminal device, and obtain the client address by running or executing instructions stored in the memory 602 and calling data stored in the memory 602. Optionally, the processor 601 may include one or more processing units, and the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0247] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.
[0248] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 602 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 602 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 602 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0249] Based on the same technical concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program that can be executed by a computer device. When the program runs on the computer device, the computer device executes the steps of the smart contract management method.
[0250] The embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0251] 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 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 processes in the flowchart and / or block diagram. 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.
[0252] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate 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 A function specified in one or more boxes.
[0253] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0254] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A smart contract management method, characterized in that: Applicable to each transaction processing node in the blockchain, for any transaction processing node, the method includes: When processing a smart contract effectiveness management transaction, obtaining a first review result of pre-effectiveness transaction information, where the pre-effectiveness transaction information is determined based on the smart contract information and a contract effectiveness operation or a contract upgrade operation for the smart contract information; If it is determined that the first review result is a review-approved result, first effective consensus information is generated, and the first effective consensus information is sent to other transaction processing nodes. The first effective consensus information is used to indicate to other transaction processing nodes that the smart contract effective management transaction has been reviewed and approved, and consensus can be reached; Determine the first effective management consensus result according to the target node list and each received first effective consensus information, and send the second effective consensus information to other transaction processing nodes when it is determined that the first effective management consensus result meets the effective management condition, where the second effective consensus information is consensus usage information; Determine a second effective management consensus result according to the target node list and each received second effective consensus information; When it is determined that the second effectiveness management consensus result satisfies the obtained effectiveness management condition, determining to complete the smart contract effectiveness management transaction; Among them, the first target node that has sent the first effective consensus information is determined according to the target node list, and whether the first effective consensus information is successfully reached is determined according to the effectiveness management condition. If the consensus is successful, each transaction processing node generates the second effective consensus information and sends the second effective consensus information to other transaction processing nodes.
2. The method according to claim 1, characterized in that The target node list includes identification information of each target node, the effective management condition is a node quantity threshold, and determining the effective management consensus result according to the acquired target node list and each received effective consensus information includes: Determine, according to each received valid consensus information, each node identification information of each transaction processing node corresponding to each valid consensus information; taking the transaction processing node corresponding to the node identification information matching the identification information in the target node list in each node identification information as the target node; The total number of target nodes is used as the effective management consensus result; The determining that the effectiveness management consensus result meets the obtained effectiveness management condition includes: If it is determined that the total number of the target nodes is greater than the node number threshold, it is determined that the effective management consensus result meets the obtained effective management condition.
3. The method according to claim 1, characterized in that The target node list includes identification information of each target node and a weight value corresponding to each target node, the effective management condition is a total weight threshold, and the effective management consensus result is determined according to the acquired target node list and each received effective consensus information, including: Determine the node identification information of each transaction processing node corresponding to each valid consensus information according to each received valid consensus information; taking the transaction processing node corresponding to the node identification information that matches the identification information in the target node list in each node identification information as the target node, and determining the weight value of the target node according to the weight value in the target node list; The total weight value of each target node is used as the effective management consensus result; The determining that the effectiveness management consensus result meets the obtained effectiveness management condition includes: If it is determined that the total weight value is greater than the total weight threshold, it is determined that the effective management consensus result meets the acquired effective management condition.
4. The method according to claim 1, characterized in that: Each transaction processing node includes a master transaction processing node and a slave transaction processing node. Before processing the smart contract effective management transaction, it also includes: The master transaction processing node determines the pre-effective transaction information according to the acquired smart contract information, the smart contract effectiveness operation or smart contract upgrade operation for the smart contract information, the target node list and the effectiveness management condition, and sends the pre-effective transaction information to the slave transaction processing node; The master transaction processing node sends a review request to the slave transaction processing node, determines a first review result for the pre-effective transaction information, and stores the first review result in a private database of the master transaction processing node, wherein the review request is used to instruct the slave transaction processing node to review the pre-effective transaction information; The master transaction processing node determines the smart contract effectiveness management transaction and sends the smart contract effectiveness management transaction processing request to other slave transaction processing nodes.
5. The method according to claim 1, characterized in that After the smart contract effectiveness management transaction is completed, the process further includes: When processing a smart contract invalidation management transaction, obtaining a second audit result of the pre-invalidation transaction information, wherein the pre-invalidation transaction information is determined according to the smart contract information and any one of a smart contract destruction operation, a smart contract freezing operation, and a smart contract thawing operation performed on the smart contract information, and the smart contract invalidation management transaction request is sent by a smart contract deployment node, and the smart contract deployment node is any one of the transaction processing nodes and non-transaction processing nodes in the blockchain; If it is determined that the second audit result is approved, an invalidation consensus message is generated, and the invalidation consensus message is sent to other transaction processing nodes; The failure management consensus result is determined according to the target node list and the received failure consensus message, and when it is determined that the failure management consensus result satisfies the acquired failure management condition, the smart contract failure management transaction is determined to be completed.
6. The method according to claim 5, characterized in that The transaction processing node is any node in the target node list.
7. A smart contract management device, characterized in that: Applicable to each transaction processing node in the blockchain, for any transaction processing node, including: A first audit result obtaining unit, configured to obtain a first audit result of pre-effective transaction information when processing a smart contract effective management transaction, wherein the pre-effective transaction information is determined according to the smart contract information and a contract effective operation or a contract upgrade operation for the smart contract information; A valid consensus information determination unit, configured to generate first valid consensus information if it is determined that the first audit result is a pass result, and send the first valid consensus information to other transaction processing nodes, wherein the first valid consensus information is used to indicate to other transaction processing nodes that the smart contract valid management transaction has been reviewed and passed, and consensus can be reached; Determine the first effective management consensus result according to the target node list and each received first effective consensus information, and send the second effective consensus information to other transaction processing nodes when it is determined that the first effective management consensus result meets the effective management condition, where the second effective consensus information is consensus usage information; Determine a second effective management consensus result according to the target node list and each received second effective consensus information; When it is determined that the second effectiveness management consensus result satisfies the obtained effectiveness management condition, determining to complete the smart contract effectiveness management transaction; Among them, the first target node that has sent the first effective consensus information is determined according to the target node list, and whether the first effective consensus information is successfully reached is determined according to the effectiveness management condition. If the consensus is successful, each transaction processing node generates the second effective consensus information and sends the second effective consensus information to other transaction processing nodes.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of any one of the methods of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that: It stores a computer program executable by a computer device. When the program is run on the computer device, the computer device executes the steps of any method described in claims 1 to 6.
Citation Information
Patent Citations
Block chain consensus method based on DPOS and nodes
CN106603698A
Blockchain user permission system and implementation method
CN110474865A