Smart contract operation management method, device, equipment and computer storage medium
By receiving and broadcasting target proposals for smart contract updates in the alliance chain and counting and valid voting based on the voting rules, the problem of lack of flexibility in smart contract operation management in the existing technology is solved, and a more reasonable and flexible smart contract update management is achieved.
Patent Information
- Application Number
- CN202011586745.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-28
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2040-12-28
AI Technical Summary
The existing alliance chain lacks flexibility in the rules for smart contract operation management, which makes it unreasonable to ask all members to vote when the smart contract service object is not all members of the alliance chain.
By receiving a contract update request, obtaining a target proposal, and broadcasting it to all nodes of the consortium chain for voting. Receive and count the votes of each node. If the number of valid votes meets the voting rules, the smart contract will be updated.
The flexibility and rationality of smart contract operation management is realized, and all members of the alliance chain are no longer required to vote. It determines whether to update smart contracts based on the voting rules in the target proposal.
Smart Images

Figure CN112612496B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and specifically to a smart contract operation management method, device, equipment and computer storage medium. Background Art
[0002] The consortium chain is aimed at members of a specific group and limited third parties. It designates multiple pre-selected nodes as bookkeepers. The generation of each block is jointly decided by all pre-selected nodes in the consortium chain. Other access nodes can participate in transactions but do not inquire about the accounting process. Other third parties can perform limited queries through the open API of the blockchain.
[0003] At present, there are usually no restrictions on the management of smart contracts on the alliance chain. Clients with blockchain call permissions can deploy smart contracts at will. As for the update, freezing and unfreezing operations of deployed smart contracts, there are usually two existing practices: one is to only allow the smart contract deployer to have the authority to operate; the other is to allow all alliance members holding nodes to vote to operate; the existing permission control rules for smart contract-related operations are basically fixed rules and lack flexibility; if the object served by a smart contract is not all members of a alliance chain, it is unreasonable to require all members of the alliance chain to vote on the operation of the smart contract. Summary of the invention
[0004] The present application provides a smart contract operation management method, device, equipment and computer storage medium, aiming to solve the technical problem that the smart contract operation management in the existing alliance chain lacks flexibility and is unreasonable because the smart contract operation management is executed according to fixed rules.
[0005] On the one hand, the present application provides a smart contract operation management method, the smart contract operation management method comprising the following steps:
[0006] Receive a contract update request, and obtain a target proposal associated with the contract update request;
[0007] Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal;
[0008] Receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes;
[0009] If the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal.
[0010] In some embodiments of the present application, before receiving the contract update request and obtaining the target proposal associated with the contract update request, the method includes:
[0011] Receive contract creation requests and organize smart contract creation target proposals, where the target proposals include voting approval rules, contract source code, contract council member address list, and proposal initiator signature;
[0012] Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain votes on the target proposal;
[0013] Collect votes from each node in the alliance chain on the target proposal and count the number of votes;
[0014] If the number of votes meets the preset consensus rules of the alliance chain, a smart contract is created according to the target proposal.
[0015] In some embodiments of the present application, if the number of votes meets the preset consensus rules of the alliance chain, a smart contract is created according to the target proposal, including:
[0016] If the number of votes meets the preset consensus rules of the alliance chain, the voting approval rules, contract source code and contract council member address list in the target proposal are extracted;
[0017] Deploy the voting admission rules and the contract source code to the contract storage area, and generate a smart contract address;
[0018] The contract council member address list is saved to the contract storage area, the contract council member address list is associated with the smart contract address and the proposal initiator's signature is added to complete the smart contract creation.
[0019] In some embodiments of the present application, after receiving a contract creation request and organizing a smart contract to create a target proposal, the method includes:
[0020] Extract the signature of the proposal initiator in the target proposal, and determine whether the signature of the proposal initiator is included in the preset exception list;
[0021] If the signature of the proposal initiator is included in the preset exception list, output a prompt message indicating that the target proposal is abnormal;
[0022] If the preset exception list does not contain the signature of the proposal initiator, the step of broadcasting the target proposal to all nodes in the alliance chain is performed so that each node in the alliance chain votes on the target proposal;
[0023] After collecting votes of each node in the alliance chain on the target proposal and counting the number of votes, the method includes:
[0024] If the number of votes does not comply with the preset consensus rules of the alliance chain, the signature of the proposal initiator in the target proposal is added to the preset exception list.
[0025] In some embodiments of the present application, receiving votes from each node in the alliance chain, extracting valid votes of contract council members corresponding to the target proposal in the votes, and counting the number of valid votes includes:
[0026] Receive votes from each node in the alliance chain, obtain the voter tag corresponding to the vote, and determine whether the voter corresponding to the voter tag is a member of the contract council corresponding to the target proposal;
[0027] If the voter corresponding to the voter tag is not a member of the contract council, the vote will be considered invalid and deleted;
[0028] If the voter corresponding to the voter tag is a member of the contract council, the vote is regarded as a valid vote and the number of valid votes is counted.
[0029] In some embodiments of the present application,
[0030] If the number of valid votes meets the voting approval rule corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal, including:
[0031] If the number of valid votes meets the voting approval rule corresponding to the target proposal, the smart contract address in the target proposal is extracted;
[0032] The contract source code is extracted from the smart contract address, and the contract source code is updated to the target contract code in the target proposal to complete the smart contract update.
[0033] In some embodiments of the present application, if the number of valid votes meets the voting approval rule corresponding to the target proposal, after the smart contract is updated according to the target contract code in the target proposal, the method includes:
[0034] Receive a contract status adjustment request, and obtain a target proposal associated with the contract status adjustment request;
[0035] Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal;
[0036] Receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes;
[0037] If the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is frozen or unfrozen according to the contract status code in the target proposal.
[0038] On the other hand, the present application provides a smart contract operation management device, the smart contract operation management device comprising:
[0039] A proposal acquisition module, used to receive a contract update request and obtain a target proposal associated with the contract update request;
[0040] A proposal broadcast module, used to broadcast the target proposal to all nodes in the alliance chain, so that each node in the alliance chain can vote on the target proposal;
[0041] A voting statistics module is used to receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the vote, and count the number of valid votes;
[0042] The contract update module is used to update the smart contract according to the target contract code in the target proposal if the number of valid votes meets the voting approval rule corresponding to the target proposal.
[0043] On the other hand, the present application also provides a smart contract operation management device, the smart contract operation management device comprising:
[0044] one or more processors;
[0045] Memory; and
[0046] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the smart contract operation management method.
[0047] On the other hand, the present application also provides a computer storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in the smart contract operation management method.
[0048] In the embodiment of the present application, a contract update request is received, and a target proposal associated with the contract update request is obtained; the target proposal is broadcast to all nodes of the alliance chain so that each node in the alliance chain votes on the target proposal; the votes of each node in the alliance chain are received, and the valid votes of the contract council members corresponding to the target proposal in the vote are extracted, and the number of valid votes is counted; if the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal. In the embodiment of the present application, the contract council members and voting approval rules corresponding to the target proposal are pre-set, and the number of valid votes corresponding to the contract council members is counted. When the number of valid votes meets the voting approval rules, the smart contract is updated. In this way, after the target proposal associated with the smart contract update is broadcast, all members of the alliance chain do not need to vote. At the same time, whether to perform the smart contract update operation is determined according to the voting approval rules corresponding to the target proposal, making the intelligent and reasonable operation management more flexible and reasonable. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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 those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0050] Figure 1 It is a schematic diagram of a scenario of smart contract operation management provided by an embodiment of the present application;
[0051] Figure 2 This is a flowchart of an embodiment of the smart contract operation management method provided in the embodiments of the present application;
[0052] Figure 3 It is a flowchart of an embodiment of creating a smart contract in the smart contract operation management method provided in the embodiment of the present application;
[0053] Figure 4 It is a flowchart of an embodiment of performing permission verification on the initiator of smart contract creation in the smart contract operation management method provided in the embodiment of the present application;
[0054] Figure 5 It is a flowchart of an embodiment of adjusting the state of a smart contract in the smart contract operation management method provided in the embodiment of the present application;
[0055] Figure 6 It is a schematic diagram of the structure of an embodiment of the smart contract operation management device provided in the embodiments of the present application;
[0056] Figure 7 It is a schematic diagram of the structure of an embodiment of the smart contract operation management device provided in the embodiments of the present application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of the present invention.
[0058] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0059] In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any person skilled in the art to implement and use the invention. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the invention can be implemented without using these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of the invention with unnecessary details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in this application.
[0060] A smart contract operation management method, apparatus, device and computer storage medium are provided in the embodiments of the present application, which are described in detail below.
[0061] The smart contract operation management method in the embodiment of the present invention is applied to a smart contract operation management device, and the smart contract operation management device is arranged in the smart contract operation management device. The smart contract operation management device is provided with one or more processors, memories, and one or more applications, wherein the one or more applications are stored in the memories and configured to be executed by the processor to implement the smart contract operation management method; the smart contract operation management device can be a terminal, such as a mobile phone or a tablet computer, and the smart contract operation management device can also be a server, or a service cluster composed of multiple servers.
[0062] like Figure 1 As shown, Figure 1 This is a scenario diagram of smart contract operation management in an embodiment of the present application. The smart contract operation management scenario in the embodiment of the present invention includes a smart contract operation management device 100 (a smart contract operation management device is integrated in the smart contract operation management device 100), and a computer storage medium corresponding to the smart contract operation management is run in the smart contract operation management device 100 to execute the steps of smart contract operation management.
[0063] Understandably, Figure 1 The smart contract operation management device in the scenario of smart contract operation management shown, or the devices included in the smart contract operation management device, does not constitute a limitation on the embodiments of the present invention. That is, the number of devices and types of devices included in the scenario of smart contract operation management, or the number of devices and types of devices included in each device, do not affect the overall implementation of the technical solution in the embodiment of the present invention, and can all be regarded as equivalent replacements or derivatives of the technical solution claimed to be protected in the embodiment of the present invention.
[0064] The smart contract operation management device 100 in the embodiment of the present invention is mainly used for:
[0065] Receive a contract update request, and obtain a target proposal associated with the contract update request;
[0066] Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal;
[0067] Receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes;
[0068] If the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal.
[0069] In the embodiment of the present invention, the smart contract operation management device 100 may be an independent smart contract operation management device, or a smart contract operation management device network or a smart contract operation management device cluster composed of smart contract operation management devices. For example, the smart contract operation management device 100 described in the embodiment of the present invention includes but is not limited to a computer, a network host, a single network smart contract operation management device, a set of multiple network smart contract operation management devices, or a cloud smart contract operation management device composed of multiple smart contract operation management devices. Among them, the cloud smart contract operation management device is composed of a large number of computers or network smart contract operation management devices based on cloud computing.
[0070] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or fewer smart contract operation management devices as shown in , or smart contract operation management device network connection relationships, such as Figure 1 Only one smart contract operation management device is shown. It can be understood that the scenario of smart contract operation management may also include one or more other smart contract operation management devices, which are not limited here. The smart contract operation management device 100 may also include a memory.
[0071] In addition, in the scenario of smart contract operation management of the present application, the smart contract operation management device 100 may be provided with a display device, or the smart contract operation management device 100 may not be provided with a display device and may be communicated with an external display device 200, and the display device 200 is used to output the result of the execution of the smart contract operation management method in the smart contract operation management device. The smart contract operation management device 100 may access a backend database 300 (the backend database may be in the local memory of the smart contract operation management device, or may be set in the cloud), and the backend database 300 may store information related to smart contract operation management.
[0072] It should be noted that Figure 1 The scenario diagram of smart contract operation management shown is only an example. The scenario of smart contract operation management described in the embodiment of the present invention is to more clearly illustrate the technical solution of the embodiment of the present invention, and does not constitute a limitation on the technical solution provided by the embodiment of the present invention.
[0073] Based on the above scenario of smart contract operation management, an embodiment of a smart contract operation management method is proposed.
[0074] Reference Figure 2 , Figure 2This is a flow chart of an embodiment of a smart contract operation management method in an embodiment of the present application. The smart contract operation management method includes steps 201-204:
[0075] 201. Receive a contract update request and obtain a target proposal associated with the contract update request.
[0076] In this embodiment, the smart contract operation management method is applied to a smart contract operation management device, also called a node device. The type of smart contract operation management device is not specifically limited. For example, the smart contract operation management device can be a terminal or a server. In this embodiment, the terminal is used as an example for explanation.
[0077] The terminal receives a contract update request, wherein the contract update request may be actively triggered by the user, for example, the user clicks the "xxx update" button on the terminal display interface to actively trigger the contract update request; in addition, the contract update request may also be automatically triggered by the terminal, for example, the triggering condition for the contract update request is pre-set in the terminal as: when transaction information is generated; the terminal monitors the changes in the transaction information in real time, and the contract update request is automatically triggered when the terminal detects that the transaction information is generated; for another example, the triggering condition for the contract update request is pre-set in the terminal as: when the transaction operation is completed; the terminal monitors the operation of the transaction information in real time, and the terminal automatically triggers the contract update request when it detects that the transaction operation is completed.
[0078] After the terminal receives the contract update request, the terminal obtains the target proposal associated with the contract update request, where the target proposal includes but is not limited to: the target contract code, the smart contract address (the smart contract address refers to the address information of the storage area of the initial contract source code) and the signature of the update submitter.
[0079] 202. Broadcast the target proposal to all nodes in the alliance chain, so that each node in the alliance chain votes on the target proposal.
[0080] After the terminal obtains the target proposal associated with the contract update request, the terminal broadcasts the target proposal to all nodes in the alliance chain. Other nodes in the alliance chain receive the target proposal and store it in the proposal pool. The target proposal is in a voting state. Users corresponding to other nodes can query the target proposal in the proposal pool. Other nodes vote on the target proposal and send the votes to the terminal. That is, other nodes vote, other nodes obtain the update submitter tag in the target proposal, and other nodes feed back the votes to the terminal based on the update submitter tag.
[0081] 203, receiving votes from each node in the alliance chain, extracting valid votes of the contract council members corresponding to the target proposal in the votes, and counting the number of valid votes.
[0082] The terminal receives votes from each node in the alliance chain, obtains the smart contract address in the target proposal, obtains the list of contract council member addresses associated with the smart contract address, determines whether the vote is a valid vote of a contract council member in the list of contract council member addresses, extracts the valid votes corresponding to the contract council members, and counts the number of valid votes to determine whether to perform the update operation, specifically including:
[0083] Step a1, receiving votes from each node in the alliance chain, obtaining the voter label corresponding to the vote, and determining whether the voter corresponding to the voter label is a member of the contract council corresponding to the target proposal;
[0084] Step a2: If the voter corresponding to the voter tag is not a member of the contract council, the vote is considered invalid and deleted;
[0085] Step a3: If the voter corresponding to the voter tag is a member of the contract council, the vote is regarded as a valid vote and the number of valid votes is counted.
[0086] That is, the terminal receives votes from each node in the alliance chain, and the terminal obtains the voter label corresponding to the vote; the terminal obtains the smart contract address in the target proposal, and the terminal obtains the contract council member address list associated with the smart contract address (the contract council member address list contains the contract council member information), and the terminal determines whether the voter corresponding to the voter label is a member of the contract council corresponding to the target proposal; if the voter corresponding to the voter label is not a member of the contract council, the terminal will treat the vote as an invalid vote, and the terminal will delete the invalid vote; if the voter corresponding to the voter label is a member of the contract council, the terminal will treat the vote as a valid vote, and the terminal will count the number of valid votes. In this embodiment, the terminal determines the validity of the vote based on the voter label associated with the vote, which can make the operation and management of smart contracts more targeted.
[0087] 204. If the number of valid votes meets the voting approval rule corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal.
[0088] In this embodiment, the terminal obtains the smart contract address in the target proposal, and obtains the preset voting permission rule corresponding to the smart contract address (the voting permission rule can be created when the smart contract is created, and the voting permission rule can be understood as the voting pass rule. The voting permission rule can be flexibly set according to the specific scenario. For example, the voting permission rule is that more than half of the contract council members vote, and the vote is passed). If the number of valid votes meets the preset voting permission rule in the target proposal, the terminal determines that the target proposal is a valid proposal, and the terminal updates the smart contract according to the target contract code in the target proposal; specifically, it includes:
[0089] Step b1: if the number of valid votes meets the voting approval rule corresponding to the target proposal, extract the smart contract address in the target proposal;
[0090] Step b2, extracting the contract source code from the smart contract address, and updating the contract source code to the target contract code in the target proposal, to complete the smart contract update.
[0091] That is, if the number of valid votes meets the preset voting approval rules in the target proposal, the terminal extracts the smart contract address in the target proposal; the terminal extracts the contract source code from the smart contract address, and the terminal replaces the contract source code with the target contract code in the target proposal to complete the smart contract update.
[0092] The embodiment of the present application receives a contract update request, obtains the target proposal associated with the contract update request; broadcasts the target proposal to all nodes of the alliance chain so that each node in the alliance chain votes on the target proposal; receives the votes of each node in the alliance chain, extracts the valid votes of the contract council members corresponding to the target proposal in the vote, and counts the number of valid votes; if the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal. In the embodiment of the present application, the contract council members and voting approval rules corresponding to the target proposal are pre-set, and the number of valid votes corresponding to the contract council members is counted. When the number of valid votes meets the voting approval rules, the smart contract is updated. After the target proposal associated with the smart contract update is broadcast, all members of the alliance chain do not need to vote. At the same time, the voting approval rules corresponding to the target proposal are used to determine whether to perform the smart contract update operation, making the intelligent and reasonable operation management more flexible and reasonable.
[0093] Reference Figure 3 , Figure 3 It is a flowchart of an embodiment of smart contract creation in the smart contract operation management method provided in the embodiments of the present application;
[0094] In some embodiments of the present application, before updating a smart contract in the smart contract operation management method, it is necessary to pre-create a smart contract, including steps 301-304:
[0095] 301, receiving a contract creation request, organizing a smart contract to create a target proposal, wherein the target proposal includes voting approval rules, contract source code, a list of contract council member addresses, and a signature of the proposal initiator.
[0096] The terminal receives a contract creation request, wherein the contract creation request may be actively triggered by the user, for example, the user clicks the "xxx create" button on the terminal display interface to actively trigger the contract creation request; in addition, the contract creation request may also be automatically triggered by the terminal, for example, the triggering condition for the contract creation request is pre-set in the terminal as: when the transaction information is updated; the terminal monitors the changes in the transaction information in the blockchain in real time, and the contract creation request is automatically triggered when the terminal detects that the transaction information in the blockchain is updated.
[0097] After the terminal receives the contract creation request, the terminal obtains the target proposal associated with the contract creation request, where the target proposal includes but is not limited to: contract source code, smart contract address (smart contract address refers to the address information of the storage area of the contract source code), contract council member address list (contract council member address list refers to a list formed by the aggregation of contract council member addresses), voting admission rules (voting admission rules can be understood as voting approval rules, and voting admission rules can be flexibly set according to specific scenarios. For example, the voting admission rule is that more than half of the contract council members vote, and the vote is passed) and the signature of the proposal initiator.
[0098] 302. Broadcast the target proposal to all nodes in the alliance chain, so that each node in the alliance chain votes on the target proposal.
[0099] The terminal broadcasts the target proposal to all nodes in the alliance chain. Other nodes in the alliance chain receive the target proposal and store it in the proposal pool. The target proposal is in a voting state. Users corresponding to other nodes can query the target proposal in the proposal pool. Other nodes vote on the target proposal and send the vote to the terminal. That is, other nodes vote, other nodes obtain the proposal initiator tag in the target proposal, and other nodes feed back the vote to the terminal according to the proposal initiator tag.
[0100] 303, collecting votes of each node in the alliance chain on the target proposal, and counting the number of votes;
[0101] 304. If the number of votes meets the preset consensus rules of the alliance chain, a smart contract is created according to the target proposal.
[0102] The terminal collects votes from each node in the alliance chain on the target proposal, counts the number of votes, and determines whether to create a smart contract based on the number of votes, specifically including:
[0103] Step c1: if the number of votes meets the preset consensus rules of the alliance chain, then extract the voting approval rules, contract source code and contract council member address list in the target proposal;
[0104] Step c2, deploying the voting admission rules and the contract source code to the contract storage area, and generating a smart contract address;
[0105] Step c3, save the contract council member address list to the contract storage area, associate the contract council member address list with the smart contract address and add the proposal initiator's signature to complete the smart contract creation.
[0106] That is, the alliance chain presets its own consensus rules, the terminal collects votes from each node in the alliance chain on the target proposal, the terminal counts the number of votes, and the terminal determines whether the number of votes complies with the preset self-consensus rules in the alliance chain; if the number of votes complies with the preset self-consensus rules in the alliance chain, the terminal extracts the voting approval rules, contract source code and contract council member address list in the target proposal; the terminal deploys the voting approval rules and contract source code to the contract storage area, and generates a smart contract address; the terminal saves the contract council member address list to the contract storage area, the terminal associates the contract council member address list with the smart contract address and adds the signature of the proposal initiator to complete the creation of the smart contract.
[0107] In this embodiment, the contract council members and voting admission rules are set when the smart contract is created. The smart contract operation management can be performed later based on the contract council members and voting admission rules, making the smart contract operation management more flexible and reasonable.
[0108] Reference Figure 4 , Figure 4 It is a flow chart of an embodiment of performing permission verification on the initiator of smart contract creation in the smart contract operation management method provided in the embodiment of the present application.
[0109] In some embodiments of the present application, after receiving a contract creation request in the smart contract operation management method, the terminal performs a permission check on the initiator of the contract creation to determine whether to execute the smart contract creation operation, specifically, including steps 401-403:
[0110] 401, extracting the signature of the proposal initiator in the target proposal, and determining whether the signature of the proposal initiator is included in the preset exception list.
[0111] The terminal has a preset exception list. The preset exception list refers to the information of users who do not have the smart contract update permission. The setting method of the preset exception list can be flexibly set according to the specific scenario. The terminal extracts the signature of the proposal initiator in the target proposal, and the terminal determines whether the signature of the proposal initiator is included in the preset exception list.
[0112] 402. If the preset exception list includes the signature of the proposal initiator, output prompt information indicating that the target proposal is abnormal.
[0113] 403. If the preset exception list does not contain the signature of the proposal initiator, the step of broadcasting the target proposal to all nodes in the alliance chain is performed so that each node in the alliance chain votes on the target proposal.
[0114] In this embodiment, if the preset exception list contains the signature of the proposal initiator, the terminal determines that the initiator corresponding to the signature of the proposal initiator does not have the permission to create a smart contract, and the terminal outputs a prompt message that the target proposal is abnormal, so that the user can view it; if the preset exception list does not contain the signature of the proposal initiator, the terminal determines that the initiator corresponding to the signature of the proposal initiator has the permission to create a smart contract, and the terminal broadcasts the target proposal to all nodes in the alliance chain, so that each node in the alliance chain votes on the target proposal. In this embodiment, setting an exception list can prevent users without operation permissions from creating smart contracts, making the operation and management of smart contracts safer.
[0115] It is understandable that the terminal collects votes from each node in the alliance chain on the target proposal, and after counting the number of votes, if the number of votes does not meet the preset consensus rules of the alliance chain, the signature of the proposal initiator in the target proposal is added to the preset exception list. In this embodiment, when the terminal fails to pass the vote, the terminal adds the signature of the proposal initiator in the target proposal to the preset exception list, which can realize the update of the exception list and make the creation and management of smart contracts more stringent.
[0116] Reference Figure 5 , Figure 5 It is a flow chart of an embodiment of adjusting the state of a smart contract in the smart contract operation management method provided in the embodiment of the present application.
[0117] In some embodiments of the present application, the terminal in the smart contract operation management method can adjust the smart contract state, specifically, including steps 501-504:
[0118] 501, receiving a contract status adjustment request, and obtaining a target proposal associated with the contract status adjustment request;
[0119] 502, broadcasting the target proposal to all nodes in the alliance chain, so that each node in the alliance chain votes on the target proposal;
[0120] 503, receiving votes from each node in the alliance chain, extracting valid votes of the contract council members corresponding to the target proposal in the votes, and counting the number of valid votes;
[0121] 504. If the number of valid votes meets the voting approval rule corresponding to the target proposal, the smart contract is frozen or unfrozen according to the contract status code in the target proposal.
[0122] In this embodiment, the terminal receives a contract status adjustment request, wherein the contract status adjustment request may be a smart contract freeze request and / or a smart contract thaw request. The terminal obtains the target proposal associated with the contract status adjustment request, and broadcasts the target proposal to all nodes in the alliance chain so that each node in the alliance chain votes on the target proposal.
[0123] The terminal receives votes from each node in the alliance chain, extracts the valid votes of the contract council members corresponding to the target proposal in the vote, and counts the number of valid votes; if the number of valid votes does not meet the voting approval rules preset in the target proposal, the terminal does not adjust the smart contract status; if the number of valid votes meets the voting approval rules preset in the target proposal, the terminal freezes or unfreezes the smart contract according to the contract status code in the target proposal.
[0124] In this embodiment, the terminal adjusts the contract council members and voting approval rules corresponding to the smart contract. In this way, after the target proposal associated with the smart contract status adjustment is broadcast, it is not necessary for all members of the alliance chain to vote, making the intelligent and reasonable operation management more reasonable. At the same time, by specifically counting the number of valid votes corresponding to the contract council members, the smart contract status is adjusted when the number of valid votes meets the voting approval rules, making the operation management of the smart contract more flexible.
[0125] like Figure 6 As shown, Figure 6 It is a schematic diagram of the structure of an embodiment of a smart contract operation management device.
[0126] In order to better implement the smart contract operation management method in the embodiment of the present application, on the basis of the smart contract operation management method, a smart contract operation management device is also provided in the embodiment of the present application, and the smart contract operation management device includes:
[0127] The proposal acquisition module 601 is used to receive a contract update request and acquire a target proposal associated with the contract update request;
[0128] A proposal broadcast module 602 is used to broadcast the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal;
[0129] The voting statistics module 603 is used to receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes;
[0130] The contract update module 604 is used to update the smart contract according to the target contract code in the target proposal if the number of valid votes meets the voting approval rule corresponding to the target proposal.
[0131] In some embodiments of the present application, the smart contract operation management device includes:
[0132] Receive contract creation requests and organize smart contract creation target proposals, where the target proposals include voting approval rules, contract source code, contract council member address list, and proposal initiator signature;
[0133] Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain votes on the target proposal;
[0134] Collect votes from each node in the alliance chain on the target proposal and count the number of votes;
[0135] If the number of votes meets the preset consensus rules of the alliance chain, a smart contract is created according to the target proposal.
[0136] In some embodiments of the present application, if the number of votes in the smart contract operation management device meets the self-consensus rules preset in the alliance chain, a smart contract is created according to the target proposal, including:
[0137] If the number of votes meets the preset consensus rules of the alliance chain, the voting approval rules, contract source code and contract council member address list in the target proposal are extracted;
[0138] Deploy the voting admission rules and the contract source code to the contract storage area, and generate a smart contract address;
[0139] The contract council member address list is saved to the contract storage area, the contract council member address list is associated with the smart contract address and the proposal initiator's signature is added to complete the smart contract creation.
[0140] In some embodiments of the present application, the smart contract operation management device includes:
[0141] Extract the signature of the proposal initiator in the target proposal, and determine whether the signature of the proposal initiator is included in the preset exception list;
[0142] If the signature of the proposal initiator is included in the preset exception list, output a prompt message indicating that the target proposal is abnormal;
[0143] If the preset exception list does not contain the signature of the proposal initiator, the step of broadcasting the target proposal to all nodes in the alliance chain is performed so that each node in the alliance chain votes on the target proposal;
[0144] The collecting votes of each node in the alliance chain on the target proposal and counting the number of votes includes:
[0145] If the number of votes does not comply with the preset consensus rules of the alliance chain, the signature of the proposal initiator in the target proposal is added to the preset exception list.
[0146] In some embodiments of the present application, the voting statistics module 603 includes:
[0147] Receive votes from each node in the alliance chain, obtain the voter tag corresponding to the vote, and determine whether the voter corresponding to the voter tag is a member of the contract council corresponding to the target proposal;
[0148] If the voter corresponding to the voter tag is not a member of the contract council, the vote will be considered invalid and deleted;
[0149] If the voter corresponding to the voter tag is a member of the contract council, the vote is regarded as a valid vote and the number of valid votes is counted.
[0150] In some embodiments of the present application, the contract updating module 604 includes:
[0151] If the number of valid votes meets the voting approval rule corresponding to the target proposal, the smart contract address in the target proposal is extracted;
[0152] The contract source code is extracted from the smart contract address, and the contract source code is updated to the target contract code in the target proposal to complete the smart contract update.
[0153] In some embodiments of the present application, the smart contract operation management device includes:
[0154] Receive a contract status adjustment request, and obtain a target proposal associated with the contract status adjustment request;
[0155] Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal;
[0156] Receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes;
[0157] If the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is frozen or unfrozen according to the contract status code in the target proposal.
[0158] In the embodiment of the present application, the smart contract operation management device receives a contract update request, obtains the target proposal associated with the contract update request; broadcasts the target proposal to all nodes of the alliance chain, so that each node in the alliance chain votes on the target proposal; receives the votes of each node in the alliance chain, extracts the valid votes of the contract council members corresponding to the target proposal in the vote, and counts the number of valid votes; if the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal. In the embodiment of the present application, the contract council members and voting approval rules corresponding to the target proposal are pre-set, and the number of valid votes corresponding to the contract council members is counted. When the number of valid votes meets the voting approval rules, the smart contract is updated. In this way, after the target proposal associated with the smart contract update is broadcast, all members of the alliance chain do not need to vote. At the same time, the voting approval rules corresponding to the target proposal are used to determine whether to perform the smart contract update operation, making the intelligent and reasonable operation management more flexible and reasonable.
[0159] The embodiment of the present invention also provides a smart contract operation management device, such as Figure 7 As shown, Figure 7 It is a schematic diagram of the structure of an embodiment of the smart contract operation management device provided in the embodiments of the present application.
[0160] The smart contract operation management device integrates any one of the smart contract operation management devices provided in the embodiments of the present invention, and the smart contract operation management device includes:
[0161] one or more processors;
[0162] Memory; and
[0163] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor in the steps of the smart contract operation management method described in any of the above-mentioned smart contract operation management method embodiments.
[0164] Specifically, the smart contract operation management device may include one or more processing core processors 701, one or more computer storage media memories 702, a power supply 703, an input unit 704 and other components. Those skilled in the art will understand that Figure 7 The structure of the smart contract operation management device shown in the figure does not constitute a limitation on the smart contract operation management device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0165] The processor 701 is the control center of the smart contract operation management device. It uses various interfaces and lines to connect the various parts of the entire smart contract operation management device. By running or executing the software programs and / or modules stored in the memory 702, and calling the data stored in the memory 702, it executes various functions of the smart contract operation management device and processes data, thereby monitoring the smart contract operation management device as a whole. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 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 701.
[0166] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and data processing by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the smart contract operation management device, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.
[0167] The smart contract operation management device also includes a power supply 703 for supplying power to each component. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 703 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0168] The smart contract operation management device may also include an input unit 704, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0169] Although not shown, the smart contract operation management device may also include a display unit, etc., which will not be described in detail here. Specifically in this embodiment, the processor 701 in the smart contract operation management device will load the executable files corresponding to the processes of one or more applications into the memory 702 according to the following instructions, and the processor 701 will run the application stored in the memory 702 to achieve various functions, as follows:
[0170] Receive a contract update request, and obtain a target proposal associated with the contract update request;
[0171] Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal;
[0172] Receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes;
[0173] If the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal.
[0174] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer storage medium and loaded and executed by a processor.
[0175] To this end, an embodiment of the present invention provides a computer storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any of the smart contract operation management methods provided in the embodiments of the present invention. For example, the computer program can be loaded by a processor to execute the following steps:
[0176] Receive a contract update request, and obtain a target proposal associated with the contract update request;
[0177] Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal;
[0178] Receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes;
[0179] If the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal.
[0180] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above, and will not be repeated here.
[0181] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments, which will not be repeated here.
[0182] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0183] The above is a detailed introduction to a smart contract operation management method provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A smart contract operation management method, characterized in that: The smart contract operation management method includes: Receive a contract update request, and obtain a target proposal associated with the contract update request; Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal; Receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes; If the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal; Before receiving the contract update request and obtaining the target proposal associated with the contract update request, the method includes: Receive contract creation requests and organize smart contract creation target proposals, where the target proposals include voting approval rules, contract source code, contract council member address list, and proposal initiator signature; Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain votes on the target proposal; Collect votes from each node in the alliance chain on the target proposal and count the number of votes; If the number of votes meets the preset consensus rules of the alliance chain, a smart contract is created according to the target proposal.
2. The smart contract operation management method according to claim 1, characterized in that: If the number of votes meets the preset consensus rules of the alliance chain, a smart contract is created according to the target proposal, including: If the number of votes meets the preset consensus rules of the alliance chain, the voting approval rules, contract source code and contract council member address list in the target proposal are extracted; Deploy the voting admission rules and the contract source code to the contract storage area, and generate a smart contract address; The contract council member address list is saved to the contract storage area, the contract council member address list is associated with the smart contract address and the proposal initiator's signature is added to complete the smart contract creation.
3. The smart contract operation management method according to claim 1, characterized in that: After receiving the contract creation request and organizing the smart contract to create a target proposal, the method includes: Extract the signature of the proposal initiator in the target proposal, and determine whether the signature of the proposal initiator is included in the preset exception list; If the signature of the proposal initiator is included in the preset exception list, output a prompt message indicating that the target proposal is abnormal; If the preset exception list does not contain the signature of the proposal initiator, the step of broadcasting the target proposal to all nodes in the alliance chain is performed so that each node in the alliance chain votes on the target proposal; After collecting votes of each node in the alliance chain on the target proposal and counting the number of votes, the method includes: If the number of votes does not comply with the preset consensus rules of the alliance chain, the signature of the proposal initiator in the target proposal is added to the preset exception list.
4. The smart contract operation management method according to claim 1, characterized in that: The receiving of votes from each node in the alliance chain, extracting valid votes from the contract council members corresponding to the target proposal in the votes, and counting the number of valid votes, includes: Receive votes from each node in the alliance chain, obtain the voter tag corresponding to the vote, and determine whether the voter corresponding to the voter tag is a member of the contract council corresponding to the target proposal; If the voter corresponding to the voter tag is not a member of the contract council, the vote will be considered invalid and deleted; If the voter corresponding to the voter tag is a member of the contract council, the vote is regarded as a valid vote and the number of valid votes is counted.
5. The smart contract operation management method according to claim 1, characterized in that: If the number of valid votes meets the voting approval rule corresponding to the target proposal, the smart contract is updated according to the target contract code in the target proposal, including: If the number of valid votes meets the voting approval rule corresponding to the target proposal, the smart contract address in the target proposal is extracted; The contract source code is extracted from the smart contract address, and the contract source code is updated to the target contract code in the target proposal to complete the smart contract update.
6. The smart contract operation management method according to any one of claims 1 to 5, characterized in that: If the number of valid votes meets the voting approval rule corresponding to the target proposal, after the smart contract is updated according to the target contract code in the target proposal, the method includes: Receive a contract status adjustment request, and obtain a target proposal associated with the contract status adjustment request; Broadcasting the target proposal to all nodes in the alliance chain so that each node in the alliance chain can vote on the target proposal; Receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the votes, and count the number of valid votes; If the number of valid votes meets the voting approval rules corresponding to the target proposal, the smart contract is frozen or unfrozen according to the contract status code in the target proposal.
7. A smart contract operation management device, characterized in that: The smart contract operation management device comprises: A proposal acquisition module, used to receive a contract update request and obtain a target proposal associated with the contract update request; A proposal broadcast module, used to broadcast the target proposal to all nodes in the alliance chain, so that each node in the alliance chain can vote on the target proposal; A voting statistics module is used to receive votes from each node in the alliance chain, extract valid votes of the contract council members corresponding to the target proposal in the vote, and count the number of valid votes; A contract update module, configured to update the smart contract according to the target contract code in the target proposal if the number of valid votes meets the voting approval rule corresponding to the target proposal; Among them, the smart contract operation management device is also used to receive a contract creation request, organize a smart contract to create a target proposal, wherein the target proposal includes voting approval rules, contract source code, a list of contract council member addresses and a signature of the proposal initiator; broadcast the target proposal to all nodes in the alliance chain so that each node in the alliance chain votes on the target proposal; collect votes from each node in the alliance chain on the target proposal, and count the number of votes; if the number of votes meets the preset consensus rules of the alliance chain, create a smart contract according to the target proposal.
8. A smart contract operation management device, characterized in that: The smart contract operation management device includes: one or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the smart contract operation management method according to any one of claims 1 to 6.
9. A computer storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the smart contract operation management method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Intelligent contract management method and system
CN110138592A