CN112787849B - Block chain state control method and device, terminal and storage medium - Google Patents

Block chain state control method and device, terminal and storage medium Download PDF

Info

Publication number
CN112787849B
CN112787849B CN202011576944.5A CN202011576944A CN112787849B CN 112787849 B CN112787849 B CN 112787849B CN 202011576944 A CN202011576944 A CN 202011576944A CN 112787849 B CN112787849 B CN 112787849B
Authority
CN
China
Prior art keywords
chain
state
node
final
link
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011576944.5A
Other languages
Chinese (zh)
Other versions
CN112787849A (en
Inventor
李伟
张帅
邱炜伟
谭锦志
张丁文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202011576944.5A priority Critical patent/CN112787849B/en
Publication of CN112787849A publication Critical patent/CN112787849A/en
Application granted granted Critical
Publication of CN112787849B publication Critical patent/CN112787849B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/084Configuration by using pre-existing information, e.g. using templates or copying from other elements
    • H04L41/0846Configuration by using pre-existing information, e.g. using templates or copying from other elements based on copy from other elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application is applicable to the technical field of block chains, and provides a block chain state control method, a device, a terminal and a storage medium, wherein the method comprises the following steps: outputting the current chain state in the block chain platform to the user terminal; if the user side triggers a processing action of a chain or a node in the chain in the block chain platform based on the current chain state, acquiring a final state of the node fed back by the node in the processing action after the processing action is finished; determining a final chain state in the block chain platform based on a consensus algorithm in the block chain platform according to the final state of the node; and setting the current chain state of the block chain platform as the final chain state. According to the scheme, scientific synchronization of the chain and the node state is realized, and the state control effect of the block chain platform is improved.

Description

Block chain state control method and device, terminal and storage medium
Technical Field
The present application belongs to the field of block chain technologies, and in particular, to a method, an apparatus, a terminal, and a storage medium for managing and controlling a block chain state.
Background
The blockchain is a novel distributed book, and a chain structure on a p2p network is formed by a plurality of nodes, so that safe and credible data sharing management service is provided. The blockchain, as a back-end service, also requires lifecycle management. The life cycle management of the block chain mainly comprises the steps of creating the chain, adding nodes, starting the chain and the nodes, stopping the chain and the nodes, restarting the chain and the nodes and deleting the chain and the nodes. Because blockchain lifecycle management is directed to two objects associated with each other, a chain and a node, it is more complex relative to traditional back-end service lifecycles that manage only a single object.
At present, life cycle management methods for block chains are simple, or corresponding actions are executed directly according to attributes of the block chains and nodes, or states of the block chains and the nodes are adjusted according to current operations on the blocks and the nodes. The existing block chain state monitoring strategy cuts a chain and a node apart for respective control, ignores the association relationship between the chain and the node, is difficult for a user to timely sense the change of the chain when operating the node, and has poor block chain state control effect.
Disclosure of Invention
The embodiment of the application provides a block chain state control method, a block chain state control device, a terminal and a storage medium, and aims to solve the problems that in the prior art, a block chain state monitoring strategy splits a chain and a node to be respectively controlled, association between the chain and the node is ignored, a user is difficult to timely perceive changes of the chain when operating the node, and the block chain state control effect is poor.
A first aspect of the embodiments of the present application provides a method for managing and controlling a block chain state, including:
outputting the current chain state in the block chain platform to the user terminal;
if the user side triggers a processing action of a chain or a node in the chain in the block chain platform based on the current chain state, acquiring a final state of the node fed back by the node in the processing action after the processing action is finished;
Determining a final link state in the block link platform based on a consensus algorithm in the block link platform according to the final node state;
setting a current chain state of the blockchain platform to the final chain state, wherein the final chain state comprises any one of available chain, unavailable chain and deleted chain.
A second aspect of the present embodiment provides a device for managing and controlling a block chain state, including:
the state output module is used for outputting the current chain state in the block chain platform to the user side;
an obtaining module, configured to, if a user side triggers a processing action of a link or a node in the link in the block link platform based on the current link state, obtain a final state of the node fed back by the node in the processing action after the processing action is completed;
a determining module, configured to determine a final link state in the blockchain platform based on a consensus algorithm in the blockchain platform according to the final state of the node;
and the state setting module is used for setting the current chain state of the block chain platform to be the final chain state, wherein the final chain state comprises any one of chain available, chain unavailable and chain deleted.
A third aspect of embodiments of the present application provides a terminal, which includes 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 method according to the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, in which a computer program is stored, which computer program, when executed by a processor, performs the steps of the method according to the first aspect.
A fifth aspect of the present application provides a computer program product, which, when run on a terminal, causes the terminal to perform the steps of the method of the first aspect described above.
As can be seen from the above, in the embodiment of the present application, the current link state in the block link platform is output to the user end, if the user end triggers a processing action of a link or a node in the link in the block link platform based on the current link state, after the processing action is completed, the final state of the node fed back by the node in the processing action is obtained, and according to the final state of the node, based on a consensus algorithm in the block link platform, the final link state in the block link platform is determined, and the current link state of the block link platform is set as the final link state, in the process, a link driver is introduced as a middleware for determining the link state according to the state of the node in the block link, functions of collecting, determining the link state, and setting the link state of the node are realized in each processing action of the block link, a function of maintaining a relationship between the link and the node is performed, a scientific synchronization between the link and the node state is realized, so that the user can sense a collaborative change of the state between the node and the link, and the state control effect of the block chain platform is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a first flowchart of a method for managing and controlling a block chain state according to an embodiment of the present application;
FIG. 2 is a block chain lifecycle management state machine flow diagram provided by an embodiment of the present application;
fig. 3 is a second flowchart of a method for managing and controlling a block chain state according to an embodiment of the present application;
fig. 4 is a structural diagram of a block chain state management and control device according to an embodiment of the present disclosure;
fig. 5 is a structural diagram of a terminal according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
In particular implementations, the terminals described in embodiments of the present application include, but are not limited to, other portable devices such as mobile phones, laptop computers, or tablet computers having touch sensitive surfaces (e.g., touch screen displays and/or touch pads). It should also be understood that in some embodiments, the device is not a portable communication device, but is a desktop computer having a touch-sensitive surface (e.g., a touch screen display and/or a touchpad).
In the discussion that follows, a terminal that includes a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and/or joystick.
The terminal supports various applications, such as one or more of the following: a drawing application, a presentation application, a word processing application, a website creation application, a disc burning application, a spreadsheet application, a gaming application, a telephone application, a video conferencing application, an email application, an instant messaging application, an exercise support application, a photo management application, a digital camera application, a web browsing application, a digital music player application, and/or a digital video player application.
Various applications that may be executed on the terminal may use at least one common physical user interface device, such as a touch-sensitive surface. One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal can be adjusted and/or changed between applications and/or within respective applications. In this way, a common physical architecture (e.g., touch-sensitive surface) of the terminal can support various applications with user interfaces that are intuitive and transparent to the user.
It should be understood that, the sequence numbers of the steps in this embodiment do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation to the implementation process of the embodiment of the present application.
In order to explain the technical means described in the present application, the following description will be given by way of specific examples.
Referring to fig. 1, fig. 1 is a first flowchart of a method for managing and controlling a block chain state according to an embodiment of the present application. As shown in fig. 1, a method for managing a blockchain state includes the following steps:
step 101, outputting the current link state in the block link platform to the user side.
The current chain state may be any one of an initial state, a chain available, a chain unavailable, a chain deleted.
In the initial state, corresponding to the situation that no chain is established in the block chain platform, a new operation on the chain can be executed at this time. And in the chain available state, the chain can be restarted, stopped, deleted and the like. In the state that the chain is unavailable, operations such as deleting and enabling the chain can be carried out.
The management and control method is realized by setting a chain drive, the chain drive is a middleware for judging the state of the chain according to the state of the node, has the functions of collecting the state of the node, judging the state of the chain and setting the state of the chain, plays an important role in maintaining the relationship between the chain and the node, and can realize scientific synchronization of the states of the chain and the node.
Specifically, in the subsequent process, the control of the states of the nodes and the chain can be realized by setting a state machine, the chain driver acquires the changed node states related to the processing actions triggered by the user on the basis of the state machine, and the states of the chain to which the nodes belong are set on the basis of the changed node states.
The state machine is a directed graph and consists of a group of nodes and corresponding transfer functions. Nodes of the state machine represent the state of the target object and by running a transfer function in response to an event, proceed from one node to the next. Referring to fig. 2, a block chain lifecycle management state machine flow diagram is shown.
The state machine of the block lifecycle management has states including: "initial state/existing chain", "chain available", "in chain processing", "chain unavailable", "chain deleted", "node available", "in node processing", "node unavailable", "node deleted". Wherein "initial state/existing chain" is the initial state and "chain deleted" is the terminal state.
Events that have (i.e., the user triggers the processing action performed by the system) include: the method comprises the steps of creating a chain, adding a node, deactivating the chain, restarting the chain, starting the chain, deleting the chain, deactivating the node, restarting the node, starting the node and deleting the node. These events correspond to different state transition logic.
The conditions for each state transition are the user input parameters, system environment variables, and the operating software and hardware environment during the actual operation of the system, and will generally be reflected in the outcome of whether the action was successfully performed while in "chain processing" or "node processing", which is either "chain available" or "chain unavailable" for the chain and "node available" or "node unavailable" for the node. And the chain drive acquires the result states of whether the actions are successful or not, and determines the chain state according to the node states after the actions are executed.
Step 102, if the user side triggers a processing action of a chain or a node in the chain in the block chain platform based on the current chain state, after the processing action is finished, a final state of the node fed back by the node in the processing action is obtained.
Here, the user may be given the trigger for different processing actions in different chain states. For example, in the initial state, corresponding to the situation that no chain is established in the blockchain platform, a new operation on the chain can be performed at this time. In the chain available state, operations such as restarting, deactivating and deleting can be carried out on the chain. In the state that the chain is not available, operations such as deleting and enabling the chain can be carried out.
Since a chain has an inclusion-contained relationship with a node, a change in the state of the node is caused after a processing action is executed, regardless of whether the processing action is a user-triggered processing action on the chain or a processing action on the node.
And acquiring the state of the subsequent chain by acquiring the final state of the nodes in the subsequent chain after the processing action is executed.
Specifically, in the process of collecting node states by the chain driver, when a certain node enters the states of "node available", "node unavailable", and "node deleted", the state is fed back to the chain driver. The chain driver records the state into the final state of the node in the action.
As an optional implementation manner, if the user side triggers a processing action of a chain or a node in the chain in the block chain platform based on the current chain state, after the processing action is completed, acquiring a final state of the node fed back by the node in the processing action, including:
and if the current link state is the initial state, the user side triggers the creation action of the link based on the initial state, and after the creation action of the link is processed, the final state of the node after the creation action of each node related in the created link is executed is obtained.
The node end state includes any one of node available, node unavailable, and node deleted.
If a chain has not been created in the system, then the chain state is considered to be the initial state, and the action of creating a chain may be performed. After the action of creating the chain is executed, the chain in the state machine enters a 'chain processing' state, and all nodes in the chain enter a 'node processing' state. If a certain node in the chain is successfully established, the node enters a node available state and feeds back the state to the chain driver; if the creation fails, a 'node unavailable' state is entered and the state is fed back to the chain driver.
Differently, as another optional implementation manner, if the user side triggers a processing action of a chain or a node in the chain in the block chain platform based on the current chain state, after the processing action is completed, acquiring a final state of a node fed back by the node in the processing action, including:
And if the current link state is the link available state or the link unavailable state, the user side triggers the node adding action in the link based on the current link state, and after the node adding action is processed, the node adding action is obtained, and the final state of the node which is added in the link and the node which is originally in the link is obtained.
Wherein the node final state comprises any one of node available, node unavailable and node deleted.
If the current chain state is a chain available state or a chain unavailable state, which indicates that a created chain exists in the system, namely, the chain is in an 'existing chain' state, the action of adding a node in the chain can be executed. After the action of the new node is executed, the new node in the state machine enters a node processing state, and the state of the existing node in the chain is unchanged. If the node is successfully added after the node addition action is processed, the node enters a node available state and feeds back a node state corresponding to the processing result to the chain drive; and if the new addition fails, the node enters a 'node unavailable' state, and feeds back a node state corresponding to the processing result to the chain drive. Here, in order to subsequently determine the link state, it is necessary to obtain the final state of the node of the existing node in the link at the same time.
Differently, as another optional implementation manner, if the user side triggers a processing action of a chain or a node in the chain in the block chain platform based on the current chain state, after the processing action is completed, acquiring a final state of a node fed back by the node in the processing action, including:
if the current chain state is the chain available state, the user side triggers the restarting or stopping action of the chain based on the chain available state, the node state in the chain is determined to be a first target node available for the node, and after the restarting or stopping action of the chain is processed, the final state of the node after the first target node executes the restarting or stopping action is determined.
Wherein the node final state comprises any one of node available, node unavailable and node deleted.
When restarting or deactivating a chain, a target node in the chain, the state of which is available to the node, needs to be restarted or deactivated correspondingly.
If the chain is in a "chain available" state in the system, an action to deactivate the chain or restart the chain may be performed. And executing the actions of stopping the chain or restarting the chain, wherein the chain in the state machine enters a 'chain processing' state, and meanwhile, the state machine sets all nodes to enter a 'node processing' state. And correspondingly executing actions of stopping the nodes or restarting the nodes by the target nodes of the nodes in the usable node state in the chain. Performing a deactivate node or restart node action, the node will enter a "node in progress" state. If the deactivation of a certain node is successful, the node enters a 'node unavailable' state and feeds back the state to a chain driver; if the deactivation fails, a "node available" state is entered and the state is fed back to the chain drive. If a certain node is restarted successfully, the node enters a node available state and feeds back the state to a chain drive; and if the restart fails, entering a 'node unavailable' state and feeding back the state to the chain driver.
Differently, as another optional implementation manner, if the user side triggers a processing action of a link or a node in the link in the block chain platform based on the current link state, after the processing action is completed, acquiring a final state of the node fed back by the node in the processing action, including:
and if the current link state is the link unavailable state, the user side triggers the starting action of the link based on the link unavailable state, then the node state in the link is determined to be a second target node with the node unavailable, and after the starting action of the link is processed, the final state of the node after the starting action is executed by the second target node is determined.
Wherein the node final state comprises any one of node available, node unavailable and node deleted.
If a chain is in a "chain unavailable" state in the system, an action to enable the chain may be performed. The enable chain action is performed and the state machine sets the chain to the "in chain processing" state and sets all nodes to enter the "in node processing" state. And correspondingly executing the action of enabling the node by the target node of the node in the 'node unavailable' state in the chain. An enable node action is performed and the node will enter a "node in progress" state. If a certain node is successfully started, the node enters a 'node available' state and feeds back the state to a chain drive; and if the node fails to be enabled, entering a 'node unavailable' state and feeding back the state to the chain driver.
Differently, as a further optional implementation manner, if the user side triggers a processing action of a link or a node in the link in the block chain platform based on the current link state, after the processing action is completed, acquiring a final state of the node fed back by the node in the processing action, including:
and if the current link state is the link available state or the link unavailable state, the user side triggers the deletion action of the link based on the current link state, and after the deletion action of the link is processed, the final state of the nodes of all the nodes related in the link is set to be the deleted state of the nodes.
If the current chain state is a chain available state or a chain unavailable state, which indicates that a created chain exists in the system, namely, the chain is in an 'existing chain' state, an action of deleting the chain can be executed. And executing the action of deleting the chain, and simultaneously executing the action of deleting the nodes in the chain, wherein the nodes enter a 'node deleted' state and feed back the state to the chain drive.
And 103, determining the final chain state in the block chain platform based on the consensus algorithm in the block chain platform according to the final state of the node.
And the chain drive collects the state fed back by the node and combines the states of other existing nodes, judges whether the chain state is available according to the consensus algorithm of the block chain, sets the chain state as 'chain available' if the chain state is available, and sets the chain state as 'chain unavailable' if the chain state is unavailable.
Specifically, for a certain action, after the chain driver records enough final states of the nodes (the final states of the nodes are "node available", "node unavailable", and "node deleted"), the final state of the chain is determined according to the type of the consensus algorithm of the current chain.
If more information about the node (which refers to information other than the node state, such as the type of the node) needs to be utilized in the determination process, the node also needs to feed back the information when feeding back the state. Whether more information is fed back depends on the consensus algorithm of the current chain, so that the chain-driven judgment process can be different for different chains and different consensus algorithms.
And step 104, setting the current chain state of the block chain platform as the final chain state.
Wherein the final chain state includes any one of chain available, chain unavailable, and chain deleted.
When the chain state is set, the chain drive determines the final state of the chain for a certain processing operation, and then sets the state of the chain to the final state (the final state of the chain is "chain available", "chain unavailable", or "chain deleted").
In the process, the state machine is used, so that the process of block chain life cycle management is coherent and clear, and the maintenance is easy. If the 'chain unavailable' or 'node unavailable' state is entered due to failure when a certain action is executed, the action can be executed again at regular time, the original state flow is repeated, and other functions such as automatic recovery and the like are easily realized. And the state machine is combined with two technical means of a mechanism for setting node states by a chain and chain driving, and the relationship between two objects of the chain and the nodes is scientifically maintained. When the user operates the nodes, all the nodes can immediately respond, and when the user operates the nodes, the change of the chain can be correctly and timely sensed.
In the embodiment of the application, the current chain state in the block chain platform is output to the user terminal, if the user terminal triggers the processing action of the chain or the nodes in the chain in the block chain platform based on the current chain state, after the processing action is finished, the final state of the nodes fed back by the nodes in the processing action is obtained, the final chain state in the block chain platform is determined according to the final state of the nodes and based on the consensus algorithm in the block chain platform, the current chain state of the block chain platform is set as the final chain state, the process introduces a chain drive as a middleware for judging the chain state according to the state of the nodes in the block chain, the functions of collecting, judging and setting the chain state of the nodes are realized in each processing action of the block chain, the function of maintaining the relationship between the chain and the nodes is realized, the scientific synchronization of the chain and the node state is realized, and the user can timely sense the cooperative change of the states between the nodes and the chain, and the state control effect of the block chain platform is improved.
Different embodiments of the block chain state management and control method are also provided in the embodiment of the application.
Referring to fig. 3, fig. 3 is a second flowchart of a block chain state management and control method provided in the embodiment of the present application. As shown in fig. 3, a method for managing and controlling a block chain state includes the following steps:
Step 301, the current link status in the block link platform is output to the user side.
The implementation process of this step is the same as that of step 101 in the foregoing embodiment, and is not described here again.
Step 302, if the user side triggers a processing action of a chain or a node in the chain in the block chain platform based on the current chain state, after the processing action is completed, a final state of the node fed back by the node in the processing action is obtained.
The implementation process of this step is the same as that of step 102 in the foregoing embodiment, and is not described here again.
And step 303, judging whether the number of nodes corresponding to the final states of different nodes in the chain is greater than a threshold value or not based on a consensus algorithm in the block chain platform according to the final states of the nodes.
Different nodes in a chain may have different node states, such as some processing nodes in an available state and some nodes in an unavailable state. And counting the number of nodes in different node states so as to judge the state of a chain containing the nodes.
In step 304, if the number of nodes in the chain whose final state is the node available state is greater than the first threshold, it is determined that the final chain state in the block chain platform is the chain available state.
And counting the number of nodes in the node available state, and determining that the chain state is available when the number of the nodes is greater than a threshold value.
In step 305, if the number of nodes in the chain whose final state is the node unavailable state is greater than the second threshold, it is determined that the final chain state in the blockchain platform is the chain unavailable state.
And counting the number of nodes in the node unavailable state, and determining that the chain state is chain unavailable when the number of the nodes is greater than a threshold value.
In step 306, if the final state of the nodes in the chain is that the number of the nodes deleted by the nodes is greater than the third threshold, it is determined that the final state of the chain in the block chain platform is that the chain is deleted.
The third threshold is, for example, the value of the total number of nodes in the chain minus 1.
Step 307, the current chain state of the blockchain platform is set to the final chain state.
The implementation process of this step is the same as that of step 104 in the foregoing embodiment, and is not described here again.
The following describes an example of the above process, taking the processing action of creating a chain when the system is in the initial state as an example.
The user triggers the system to perform the action of creating the chain. The chain to be created is Hyperchain, and 4 VP-type nodes are created by adopting an RBFT (Redundant Byzantine Fault Tolerance) consensus algorithm to form a 1 chain; the state machine sets the chain to be in the 'chain processing' state, and sets 4 VP nodes to be in the 'node processing' state; the system installs 4 VP nodes of Hyperchain on a specified host according to the needs of a user. For a certain node, if the installation process is smoothly executed and the node is successfully established, the system sets the node to be in a 'node available' state and sends the node state to the chain drive through an HTTP request; if the installation process is wrong and the node is failed to be created, the system sets the node to be in a 'node unavailable' state and sends the node state to the chain driver through an HTTP request. Suppose that 3 nodes are successfully created during the installation, the node is in the state of being available, and 1 node is failed to be created, and the node is in the state of being unavailable.
After the chain driver receives the feedback states of all 4 nodes in sequence (namely 3 nodes are available and 1 node is unavailable), the chain state is judged according to the consensus algorithm of the block chain. The RBFT consensus algorithm of the block chain Hyperchain requires that: when the number of the available VP nodes is larger than or equal to 3/4 of the total number of the nodes, the chain is available; otherwise the chain is not available. In this case, the total node number is 4, and the available VP node number is 3, which satisfies the requirement, so the chain driver determines that the current chain is available. The chain drive sets the chain state to "chain available". The execution of the action of creating the chain ends.
In the embodiment of the application, the current chain state in the block chain platform is output to the user terminal, if the user terminal triggers the processing action of the chain or the nodes in the chain in the block chain platform based on the current chain state, after the processing action is finished, the final state of the nodes fed back by the nodes in the processing action is obtained, the relationship between the number of the nodes corresponding to the final states of different nodes in the chain and the threshold is judged based on the consensus algorithm in the block chain platform according to the final state of the nodes to determine the final chain state in the block chain platform, the current chain state of the block chain platform is set as the final chain state, the process introduces a chain drive as a middleware for judging the chain state according to the states of the nodes in the block chain, the functions of collecting the node states, judging the chain states and setting the chain states are realized in each processing action of the block chain, and the function of maintaining the relationship between the chain and the nodes is played, the state control method and the state control system realize scientific synchronization of the chain and the node state, enable a user to timely sense the cooperative change of the state between the node and the chain, and improve the state control effect of the block chain platform.
Referring to fig. 4, fig. 4 is a structural diagram of a block chain state managing and controlling device provided in the embodiment of the present application, and for convenience of description, only parts related to the embodiment of the present application are shown.
The apparatus 400 for managing block chain status comprises:
a state output module 401, configured to output a current link state in the block link platform to the user side;
an obtaining module 402, configured to, if a user side triggers a processing action of a link or a node in a link in the block chain platform based on the current link state, obtain a final state of the node fed back by the node in the processing action after the processing action is completed;
a determining module 403, configured to determine, according to the final node state, a final chain state in the blockchain platform based on a consensus algorithm in the blockchain platform;
a state setting module 404, configured to set a current chain state of the blockchain platform to the final chain state, where the final chain state includes any one of chain available, chain unavailable, and chain deleted.
The obtaining module 402 is specifically configured to:
if the current link state is an initial state, the user side triggers a link creating action based on the initial state, and then after the link creating action is processed, a node final state after each node related in the created link is executed with the creating action is obtained, wherein the node final state comprises any one of node availability, node unavailability and node deletion.
The obtaining module 402 is specifically configured to:
if the current link state is a link available state or a link unavailable state, the user side triggers a node adding action in the link based on the current link state, and then after the node adding action is processed, node final states of the node added in the link and an original node in the link are obtained, wherein the node final states include any one of node availability, node unavailability and node deletion.
The obtaining module 402 is specifically configured to:
if the current chain state is a chain available state, the user side triggers a restarting or stopping action of the chain based on the chain available state, the node state in the chain is determined to be a first target node with a node available, and after the restarting or stopping action of the chain is processed, the node final state after the first target node executes the restarting or stopping action is determined, and the node final state comprises any one of node available state, node unavailable state and node deleted state.
The obtaining module 402 is specifically configured to:
if the current chain state is a chain unavailable state, the user side triggers a chain starting action based on the chain unavailable state, then the node state in the chain is determined to be a second target node with unavailable nodes, and after the chain starting action is processed, the node final state after the second target node executes the starting action is determined, wherein the node final state comprises any one of node available, node unavailable and node deleted.
The obtaining module 402 is specifically configured to:
and if the current link state is a link available state or a link unavailable state, the user side triggers a link deletion action based on the current link state, and after the link deletion action is processed, the final state of all nodes related in the link is set to be a node deleted state.
The determining module 403 is specifically configured to:
judging whether the number of nodes corresponding to different node final states in the chain is larger than a threshold value or not based on a consensus algorithm in the block chain platform according to the node final state;
determining that the final link state in the blockchain platform is chain available if the number of nodes in the chain whose final state is node available state is greater than a first threshold;
if the number of the nodes of which the final states of the nodes in the chain are node unavailable states is larger than a second threshold value, determining that the final chain state in the block chain platform is chain unavailable;
and if the final state of the nodes in the chain is that the number of the nodes deleted by the nodes is larger than a third threshold value, determining that the final state of the chain in the block chain platform is that the chain is deleted.
The control device for the block chain state provided in the embodiment of the present application can implement each process of the above embodiment of the control method for the block chain state, and can achieve the same technical effect, and for avoiding repetition, the details are not repeated here.
Fig. 5 is a block diagram of a terminal according to an embodiment of the present disclosure. As shown in the figure, the terminal 5 of this embodiment includes: at least one processor 50 (only one shown in fig. 5), a memory 51, and a computer program 52 stored in the memory 51 and executable on the at least one processor 50, the steps of any of the various method embodiments described above being implemented when the computer program 52 is executed by the processor 50.
The terminal 5 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal 5 may include, but is not limited to, a processor 50, a memory 51. It will be appreciated by those skilled in the art that fig. 5 is only an example of a terminal 5 and does not constitute a limitation of the terminal 5 and may include more or less components than those shown, or some components in combination, or different components, for example the terminal may also include input output devices, network access devices, buses, etc.
The Processor 50 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the terminal 5, such as a hard disk or a memory of the terminal 5. The memory 51 may also be an external storage device of the terminal 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) and the like provided on the terminal 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the terminal 5. The memory 51 is used for storing the computer program and other programs and data required by the terminal. The memory 51 may also be used to temporarily store data that has been output or is to be output.
It should be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional units and modules is only used for illustration, and in practical applications, the above function distribution may be performed by different functional units and modules as needed, that is, the internal structure of the apparatus may be divided into different functional units or modules to perform all or part of the above described functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only used for distinguishing one functional unit from another, and are not used for limiting the protection scope of the present application. For the specific working processes of the units and modules in the system, reference may be made to the corresponding processes in the foregoing method embodiments, which are not described herein again.
In the above embodiments, the description of each embodiment has its own emphasis, and reference may be made to the related description of other embodiments for parts that are not described or recited in any embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal and method may be implemented in other ways. For example, the above-described apparatus/terminal embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The present application realizes all or part of the processes in the method of the above embodiments, and may also be implemented by a computer program product, when the computer program product runs on a terminal, the steps in the above method embodiments may be implemented when the terminal executes the computer program product.
The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method for managing and controlling a chain of blocks, comprising:
outputting the current chain state in the block chain platform to the user terminal;
if the user side triggers a processing action of a chain or a node in the chain in the block chain platform based on the current chain state, acquiring a final state of the node fed back by the node in the processing action after the processing action is finished;
Determining a final link state in the block link platform based on a consensus algorithm in the block link platform according to the final node state;
setting a current chain state of the blockchain platform to the final chain state, wherein the final chain state includes any one of chain available, chain unavailable, chain deleted.
2. The control method according to claim 1, wherein if the user side triggers a processing action of a node in a chain or a chain in the blockchain platform based on the current chain state, acquiring a final state of the node fed back by the node in the processing action after the processing action is completed, includes:
if the current link state is an initial state, the user side triggers a link creating action based on the initial state, and after the link creating action is processed, a node final state is obtained after each node related in the created link is executed with the creating action, and the node final state comprises any one of node availability, node unavailability and node deletion.
3. The control method according to claim 1, wherein if the user side triggers a processing action of a node in a chain or a chain in the blockchain platform based on the current chain state, acquiring a final state of the node fed back by the node in the processing action after the processing action is completed, includes:
If the current link state is a link available state or a link unavailable state, the user side triggers a node adding action in the link based on the current link state, and after the node adding action is processed, node final states of the node added in the link and an original node in the link are obtained, wherein the node final states include any one of node availability, node unavailability and node deletion.
4. The control method according to claim 1, wherein if the user side triggers a processing action of a node in a chain or a chain in the blockchain platform based on the current chain state, acquiring a final state of the node fed back by the node in the processing action after the processing action is completed, includes:
if the current chain state is a chain available state, the user side triggers a restarting or stopping action of the chain based on the chain available state, the node state in the chain is determined to be a first target node with a node available, and after the restarting or stopping action of the chain is processed, the node final state after the first target node executes the restarting or stopping action is determined, and the node final state comprises any one of node available state, node unavailable state and node deleted state.
5. The control method according to claim 1, wherein if the user side triggers a processing action of a node in a chain or a chain in the blockchain platform based on the current chain state, acquiring a final state of the node fed back by the node in the processing action after the processing action is completed, includes:
if the current chain state is a chain unavailable state, the user side triggers a chain starting action based on the chain unavailable state, then the node state in the chain is determined to be a second target node with unavailable nodes, and after the chain starting action is processed, the node final state after the second target node executes the starting action is determined, wherein the node final state comprises any one of node available, node unavailable and node deleted.
6. The control method according to claim 1, wherein if the user side triggers a processing action of a node in a chain or a chain in the blockchain platform based on the current chain state, acquiring a final state of the node fed back by the node in the processing action after the processing action is completed, includes:
and if the current link state is a link available state or a link unavailable state, the user side triggers a link deletion action based on the current link state, and after the link deletion action is processed, the final state of all nodes related in the link is set to be a node deleted state.
7. The method according to any one of claims 1 to 6, wherein the determining a final chain state in the blockchain platform based on a consensus algorithm in the blockchain platform according to the node final state comprises:
according to the final state of the node, judging whether the number of the nodes corresponding to different final states of the node in the chain is larger than a threshold value or not based on a consensus algorithm in the block chain platform;
if the number of the nodes of which the final states of the nodes in the chain are node available states is larger than a first threshold value, determining that the final chain state in the block chain platform is chain available;
if the number of the nodes of which the final states of the nodes in the chain are unavailable states is larger than a second threshold value, determining that the final chain state in the block chain platform is unavailable;
and if the final state of the nodes in the chain is that the number of the nodes deleted by the nodes is larger than a third threshold value, determining that the final state of the chain in the block chain platform is that the chain is deleted.
8. A device for managing and controlling a chain of blocks, comprising:
the state output module is used for outputting the current chain state in the block chain platform to the user side;
An obtaining module, configured to, if a user side triggers a processing action of a link or a node in the link in the block link platform based on the current link state, obtain a final state of the node fed back by the node in the processing action after the processing action is completed;
a determining module, configured to determine a final link state in the blockchain platform based on a consensus algorithm in the blockchain platform according to the final state of the node;
and the state setting module is used for setting the current chain state of the block chain platform to be the final chain state, wherein the final chain state comprises any one of chain available, chain unavailable and chain deleted.
9. A terminal comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202011576944.5A 2020-12-28 2020-12-28 Block chain state control method and device, terminal and storage medium Active CN112787849B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011576944.5A CN112787849B (en) 2020-12-28 2020-12-28 Block chain state control method and device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011576944.5A CN112787849B (en) 2020-12-28 2020-12-28 Block chain state control method and device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN112787849A CN112787849A (en) 2021-05-11
CN112787849B true CN112787849B (en) 2022-05-24

Family

ID=75752778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011576944.5A Active CN112787849B (en) 2020-12-28 2020-12-28 Block chain state control method and device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN112787849B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108134819A (en) * 2017-12-06 2018-06-08 北京连琪科技有限公司 Block chain operating status is collected and transfer approach, device and server
CN110149316A (en) * 2019-04-22 2019-08-20 众安信息技术服务有限公司 A kind of dissemination method and device of block chain
WO2019179538A2 (en) * 2019-07-11 2019-09-26 Alibaba Group Holding Limited Shared blockchain data storage
CN110458538A (en) * 2019-07-31 2019-11-15 阿里巴巴集团控股有限公司 State machine maintenance method and device, electronic equipment, storage medium based on block chain
CN111355780A (en) * 2020-02-18 2020-06-30 杭州云象网络技术有限公司 Block chain-based Internet of things monitoring management method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108134819A (en) * 2017-12-06 2018-06-08 北京连琪科技有限公司 Block chain operating status is collected and transfer approach, device and server
CN110149316A (en) * 2019-04-22 2019-08-20 众安信息技术服务有限公司 A kind of dissemination method and device of block chain
WO2019179538A2 (en) * 2019-07-11 2019-09-26 Alibaba Group Holding Limited Shared blockchain data storage
CN110458538A (en) * 2019-07-31 2019-11-15 阿里巴巴集团控股有限公司 State machine maintenance method and device, electronic equipment, storage medium based on block chain
CN111355780A (en) * 2020-02-18 2020-06-30 杭州云象网络技术有限公司 Block chain-based Internet of things monitoring management method and system

Also Published As

Publication number Publication date
CN112787849A (en) 2021-05-11

Similar Documents

Publication Publication Date Title
CN102349062B (en) Method and system for synchronizing browser caches across devices and web services
WO2018049888A1 (en) Application data migration method and device
KR20120037397A (en) Catalog-based software component management
CN105786405A (en) Online upgrading method, device and system
CN109445861A (en) System start method, device, computer installation and storage medium
CN112612853A (en) Data processing method and device based on database cluster and electronic equipment
CN111913667A (en) OSD blocking detection method, system, terminal and storage medium based on Ceph
WO2021072880A1 (en) Method for asynchronously creating internal snapshot of virtual machine, apparatus, system and storage medium
WO2018031351A1 (en) Discovery of calling application for control of file hydration behavior
CN112698793B (en) Data storage method, device, machine-readable medium and equipment
US20130246347A1 (en) Database file groups
CN109445909A (en) Backup method, system, terminal and the storage medium of virtual-machine data
CN112787849B (en) Block chain state control method and device, terminal and storage medium
CN117270891A (en) Firmware burning method, device, terminal and storage medium of Bluetooth headset
CN111193804B (en) Distributed storage method and device, network node and storage medium
CN116208487A (en) Method, device, equipment and medium for upgrading consensus algorithm in block chain system
CN111475334A (en) TiDB database maintenance method and device, computer equipment and storage medium
CN113760610A (en) OpenStack-based bare computer high-availability realization method and device and electronic equipment
CN111130856A (en) Server configuration method, system, equipment and computer readable storage medium
CN111078418A (en) Operation synchronization method and device, electronic equipment and computer readable storage medium
US11552840B2 (en) Intention-based device component tracking system
CN108632366B (en) File downloading method and device and terminal equipment
CN113656378A (en) Server management method, device and medium
US20170091253A1 (en) Interrupted synchronization detection and recovery
WO2022086571A1 (en) Providing application error data for use by third-party library development systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant