CN113938494B - Chain network segmentation and recombination method and system for large-scale Internet of things scene - Google Patents

Chain network segmentation and recombination method and system for large-scale Internet of things scene Download PDF

Info

Publication number
CN113938494B
CN113938494B CN202111193816.7A CN202111193816A CN113938494B CN 113938494 B CN113938494 B CN 113938494B CN 202111193816 A CN202111193816 A CN 202111193816A CN 113938494 B CN113938494 B CN 113938494B
Authority
CN
China
Prior art keywords
consensus
information
group
algorithm
segmentation
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
CN202111193816.7A
Other languages
Chinese (zh)
Other versions
CN113938494A (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.)
National University of Defense Technology
Original Assignee
National University of Defense Technology
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 National University of Defense Technology filed Critical National University of Defense Technology
Priority to CN202111193816.7A priority Critical patent/CN113938494B/en
Publication of CN113938494A publication Critical patent/CN113938494A/en
Application granted granted Critical
Publication of CN113938494B publication Critical patent/CN113938494B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1059Inter-group management mechanisms, e.g. splitting, merging or interconnection of groups
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Bioethics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a chain network segmentation and recombination method and a system for a large-scale Internet of things scene, wherein the method comprises the steps that a consensus main body firstly executes active recombination or segmentation based on a guide instruction, performs network detection, and selects to execute passive segmentation operation, passive recombination operation or keep the original network structure unchanged based on the dynamic change condition of a network; finally, all consensus main bodies tie a knot on the history state in parallel, respectively determine consensus algorithms for the current consensus groups to which the history state belongs, and perform consensus in parallel, so that the round of consensus is finally completed. When a network partition appears, the invention can ensure that the block chain-based man-machine collaboration system of the Internet of things continuously achieves consensus to generate blocks, and can fuse the blocks generated during the partition after the network is restored, so that the partition or the fusion is quick in time, and the traceability and the non-tamper property of data are ensured; the method supports a plurality of consensus algorithms and a block chain organization structure with coexistence of different block chain structures.

Description

Chain network segmentation and recombination method and system for large-scale Internet of things scene
Technical Field
The invention relates to the field of Internet of things and blockchain, in particular to a large-scale Internet of things scene-oriented chain network segmentation and recombination method and system.
Background
The blockchain technology is originally born in the text of Bizhi Zhi: a point-to-point electronic cash payment System of Benzhi in 08, and provides a new technical idea for solving the consistency problem of a distributed system. The core of this new technical idea is a consensus mechanism based on a distributed system, that is, a node lacking trust (i.e., a device with a certain computing power and a certain storage power) in a point-to-point network finally achieves data consistency by following a preset mechanism (usually, such a preset mechanism that the data finally achieve the agreement is called a consensus algorithm). The payment action of the user is completed through the transaction, the transaction is recorded in a block (one block is a data structure capable of storing a plurality of transactions) after verification, and the data organization structure formed by the blocks connected according to a certain sequence (such as time stamps) can be divided into a chain structure and a schema structure (the first block is specified to be called an creation block) according to the structural characteristics of the data organization structure. The special data structure and the consensus mechanism enable the blockchain to have the properties of decentralization, tamper resistance, traceability and the like, and the public transparency of the data is indirectly ensured.
The internet of things is a network concept which extends and expands a user end of the internet of things to any article to article on the basis of the traditional internet to exchange information and communicate. The internet of things breaks through the connection mode of the previous internet, so that devices of different types and different types form a self-organizing network by utilizing a wireless communication module and a standard communication protocol, information sharing and fusion are realized, and an application system with higher automation degree, stronger function and better environmental adaptability is created in various industries. The development of the Internet of things promotes the possibility of large-scale human-computer cooperation, and the robot technology, the unmanned aerial vehicle technology and the intelligent terminal wearable by human bodies which are vigorously developed at present are all the basis of large-scale human-computer cooperation. The blockchain has important influence on the Internet of things by virtue of the characteristics of peer-to-peer, public transparency, secure communication, difficulty in tampering, multiparty consensus and the like of a main body: the characteristics of multi-center and weak centralization can reduce the high operation and maintenance cost of a centralization architecture, the characteristics of information encryption and secure communication can help to protect privacy, the identity authority management and multiparty consensus can help to identify illegal nodes, access and disfigurement of malicious nodes can be prevented in time, the chain-based structure can help to construct evidence-traceable electronic evidence storage, and the characteristics of distributed architecture and main body peer-to-peer can help to break the existing multiple information island-based devices of the Internet of things and promote the transverse flow and multiparty collaboration of information. The main problems faced by applying blockchain technology to the internet of things include: 1) Failure of the nodes, interference or even blocking of network communications between the nodes may cause the collaborative population to partition into different populations. 2) Different groups can not acknowledge the block chain organization structures generated by different groups at the same time or can not continue to use the original consensus algorithm, so that the whole system is in a disorder state in a period of time when network communication is interfered, and the system state can be recovered after the network is recovered; this results in performance loss when the network is frustrated. In this environment, how to keep large-scale man-machine cooperated is a problem to be solved.
In the existing blockchain system, the common network partition problem of the internet of things is faced, the method is often adopted that nodes do not participate in consensus offline, or blocks generated after node consensus, blockchains and the like are verified after network recovery, and rollback is possibly performed due to being not accepted by the system during re-verification, that is, the blocks are likely to fail in network recovery and verification links, and transaction information in the failed blocks needs to be repackaged for consensus again. This causes the system performance (mainly the speed of block generation) to be affected after network partitioning; even when the network is unreliable or the large-scale Internet of things terminal node is offline, the offline node exceeds the maximum error node number which can be tolerated by the consensus algorithm, so that the consensus algorithm is invalid, an effective block cannot be generated, and the system cannot complete the normal function. In addition, the existing consensus algorithm does not support active chain network segmentation. When the nodes face different application scenes, different consensus algorithms cannot be actively selected. That is, there is currently no blockchain system that is suitable for a multi-tasking environment that supports multiple consensus algorithms.
Therefore, how to apply the blockchain technology to the internet of things and effectively cope with the dynamic segmentation and merging of the chain network is a technical problem faced by the person skilled in the field of the internet of things system at present.
Disclosure of Invention
The invention aims to solve the technical problems: aiming at the problems in the prior art, the invention provides a chain network segmentation and recombination method and system for a large-scale Internet of things scene, which can ensure that when network partitions appear, a block chain-based Internet of things man-machine cooperation system continuously achieves consensus generation blocks, and can fuse the blocks generated during the partition after the network is restored, so that the partition or the fusion is rapid in time, and traceability and non-tamper property of data are ensured; the method supports a plurality of consensus algorithms and a block chain organization structure with coexistence of different block chain structures.
In order to solve the technical problems, the invention adopts the following technical scheme:
a chain network segmentation and recombination method for a large-scale Internet of things scene comprises the following steps:
1) The consensus main body communicates with other consensus main bodies in the Internet of things to generate an initial consensus group;
2) The consensus main body monitors whether a guide reorganization instruction or a guide segmentation instruction is received, and if the guide reorganization instruction is received, the step 3) is skipped; if the guide segmentation instruction is received, jumping to the step 4); otherwise, jumping to the step 5);
3) Determining that all the consensus subjects in the block chain consensus system are guidance recombination instructions, and recombining the consensus subjects related to the guidance recombination instructions into a new consensus group by performing recombination operation on the consensus subjects related to the guidance recombination instructions; jump to step 8);
4) Determining an instruction for controlling a consensus group as a guide segmentation instruction by all consensus subjects in the block chain consensus system, and segmenting the consensus group into a plurality of sub-consensus groups based on the guide segmentation instruction by performing segmentation operation on the current consensus group; jump to step 8);
5) The consensus main body carries out network detection on the current consensus group members, and if the network needs to carry out segmentation operation, the step 6) is carried out in a jumping way; if the network needs to carry out the reorganization operation, the step 7) is carried out in a jumping way; otherwise, jumping to execute the step 8);
6) Determining that all consensus main bodies in the block chain consensus system determine a command for controlling a consensus group as a passive recombination command, and recombining each sub-consensus group obtained by segmentation into a consensus group by carrying out recombination operation; jump to step 8);
7) Determining that all consensus subjects in the block chain consensus system determine a command for controlling a consensus group as a passive segmentation command, and carrying out segmentation operation on the current consensus group to segment the consensus group into a plurality of sub-consensus groups; jump to step 8);
8) All consensus subjects in the block chain consensus system tie a knot to the history state in parallel;
9) A consensus main body in the block chain consensus system respectively determines a consensus algorithm for a current consensus group to which the block chain consensus main body belongs;
10 All consensus bodies in the block chain consensus system perform consensus in parallel, the round of consensus is completed, and step 2) is performed in a jumping mode.
Optionally, when the reorganizing operation is performed on the consensus entity related to the guided reorganizing instruction in step 3), the step of reorganizing any consensus entity G in the blockchain consensus system includes:
3.1 Detecting whether the recombined consensus group member list in the guide recombination instruction is consistent with the last consensus group member list in the history consensus group information, and if so, jumping to the step 3.2); if not, jumping to the step 5);
3.2 Detecting whether the list of all sub-consensus groups before recombination in the guide recombination instruction contains the current consensus group or not, and if so, jumping to the step 3.3); if not, jumping to the step 5);
3.3 Broadcasting a guide reorganization instruction to all reorganized consensus group members;
3.4 All reorganized consensus group members receive a guide reorganization instruction;
3.5 All the reorganized consensus group members update the current consensus group information into the last consensus group information acquired from the history consensus group information;
3.6 All the reorganized consensus group members determine that the command of the consensus group control is a guide reorganization command, and the step 8) is performed in a jumping manner.
Optionally, when the instruction for guiding the partitioning instruction to perform the partitioning operation on the current consensus group in step 4), the step of performing the partitioning operation on any consensus entity G in the blockchain consensus system includes:
4.1 Detecting whether the list of the pre-segmentation consensus group members in the guide segmentation instruction is consistent with the current consensus group member list, if so, jumping to the step 4.2); if not, jumping to the step 5);
4.2 Broadcasting a guide segmentation instruction to all current consensus group members;
4.3 All current consensus group members receive the guide segmentation instruction;
4.4 All current consensus group members store the current consensus group information into the historical consensus group information;
4.5 All current consensus group members store the sub-consensus group member list containing the affiliated consensus main body in all sub-consensus group member lists after being segmented in the guide segmentation instruction as a member list of the current consensus group information, the consensus round n of the current consensus group information is set as 0, and the grouping mark is set as an active grouping mark;
4.6 All current consensus members determine the instruction of the consensus control as a pilot split instruction, step 8) is performed in a jump.
Optionally, when the reorganizing operation is performed on each sub-consensus group obtained by segmentation in step 6), the step of reorganizing any consensus entity G in the blockchain consensus system includes:
6.1 The consensus body G integrates all received reply messages of recombination detection into recombination information, wherein the recombination information comprises a recombination information mark, a current consensus body identification number, a consensus round n, a recombined consensus group member list and all received recombination detection reply message sets, and the recombination information is broadcast to all consensus group members in the last consensus group member list;
6.2 After receiving the reorganization information sent by other nodes, the consensus body G checks whether the reorganization information is valid, if so, the reorganization information is forwarded to all other members in the last consensus group member list, and the reorganization information sent by each node is forwarded once in the nth round;
6.3 The consensus subject G updates the current consensus group information into the last consensus group information extracted from the history consensus group information;
6.4 The consensus main body G combines the consensus group member list in the reply of all received recombination detection information into all sub-consensus group member lists before recombination, takes the last consensus group member list as a recombination consensus group member list, and combines the last consensus group member list with a recombination zone bit to generate a passive recombination instruction, wherein the passive recombination instruction comprises a passive recombination mark, all sub-consensus group member lists before recombination and the recombination consensus group member list after recombination;
6.5 The consensus subject G determines that the command of the consensus group control is a passive reorganization command, and jumps to execute the step 8).
Optionally, when performing the splitting operation for the current consensus group in step 7), the step of performing the splitting operation for any consensus entity G in the blockchain consensus system includes:
7.1 The received replying broadcast detection information and the replied node list are counted as a list to obtain a preliminary consensus group member list, the preliminary consensus group member list contains reply information signed by all members on the list, the preliminary segmentation information is broadcast to all members of the consensus group member list, and the preliminary segmentation information comprises a preliminary segmentation information mark, an identification number of a consensus subject G, a consensus round, the consensus group member list, the preliminary consensus group member list and signature reply information of all members;
7.2 After the first time of receiving the preliminary segmentation information sent by other consensus group control submodules for the nth round, firstly detecting the validity of the preliminary segmentation information, and taking the union of the received preliminary consensus group member list and the preliminary consensus group member list stored locally as new preliminary consensus group member list information after the validity detection is passed, and generating new preliminary segmentation information and broadcasting the new preliminary segmentation information to all consensus group members; if the list information received by the nth round is a subset of the current preliminary consensus group member list, not forwarding the reply operation;
7.3 After a preset timeout t3, the list of the preliminary consensus group members is not updated any more; if the number of the final preliminary consensus group member list still does not meet the minimum member number required by the current consensus algorithm, jumping to the step 7.4); otherwise, judging that the consensus group is unchanged, and jumping to the step 10);
7.4 The consensus group control sub-module stores the current consensus group member list into the history consensus group member list, and the current consensus group member list becomes a new last consensus group member list after the current consensus group member list is stored;
7.5 Updating the current consensus group member list into a final preliminary consensus group member list, resetting the consensus round n to 0, and setting a grouping mark as a passive grouping mark;
7.6 After the update of the member lists of the consensus groups is completed, generating a passive segmentation instruction, wherein the passive segmentation instruction comprises a passive segmentation flag bit, a member list of the consensus groups before segmentation and a member list of all sub-consensus groups after segmentation, taking the current member list of the consensus groups as one sub-consensus group, taking all members which are not in the current member list of the last consensus group as another sub-consensus group, taking the two sub-consensus groups as member lists of all sub-consensus groups after segmentation, taking the member list of the last consensus group as member list of the consensus groups before segmentation, and combining the segmentation instruction by the segmentation flag bit;
7.7 The consensus subject G determines that the command for consensus group control is a passive partition command, and jumps to execute step 8).
Optionally, when all consensus subjects in the block chain consensus system tie a knot in the historical state in parallel in step 8), the step of tie a knot in the historical state by any consensus subject G in the block chain consensus system includes:
8.1 The consensus subject G obtains the hash information of the newly determined block;
8.2 If the instruction of the consensus group control of the consensus subject G is a split instruction, the split instruction includes a guide split instruction and a passive split instruction, then the step 8.3 is skipped; if the consensus subject G receives a command of the consensus group control as a reorganization command, wherein the reorganization command comprises a guide reorganization command and a passive reorganization command, the step 8.5 is skipped;
8.3 The consensus subject G encapsulates all the obtained hash information to generate a first block header;
8.4 If the command for controlling the consensus group of the consensus main body G is a guide division command, wherein the guide division command comprises a consensus algorithm of all sub-consensus groups, a sub-consensus group member list comprising the consensus main body and a corresponding consensus algorithm are selected from the sub-consensus group member list after being divided in the guide division command, and the sub-consensus group member list and the corresponding consensus algorithm are combined with a first block head generated by encapsulation to generate information of the change of the consensus group, and the step 10 is skipped; if the command of the consensus main body G for performing the consensus group control is a passive segmentation command or a guide segmentation command without a specified consensus algorithm, selecting a sub-consensus group member list containing the consensus main body G from the sub-consensus group member lists segmented in the command, merging with a first block head generated by encapsulation and a corresponding division flag bit, and jumping to the step 9);
8.5 The consensus subject G obtains a hash set of the latest confirmed block information in the block graph chain organization structure generated by each consensus group from all consensus group members before recombination;
8.6 The consensus subject G encapsulates all the obtained hash sets to generate a second block header;
8.7 The consensus main body G merges the reorganization flag bit, the reorganized consensus member list in the received reorganization instruction and the second block header generated by encapsulation, and jumps to the step 9).
Optionally, when the consensus subject in step 9) determines a consensus algorithm for each of the current consensus groups to which the consensus subject belongs, the step of determining the consensus algorithm by any consensus subject G in the blockchain consensus system includes:
9.1 The method comprises the steps that) a consensus subject G receives historical state knotting information from the consensus subject G, wherein the historical state knotting information comprises a zone bit, a consensus group member list and block head information; if the flag bit is a segmentation flag, jumping to the step 9.2); if the flag bit is a recombinant flag, jumping to the step 9.8);
9.2 The consensus subject G sends consensus algorithm solicitation information which comprises a consensus algorithm solicitation information mark, a consensus subject identification number, a consensus group member list and a supported consensus algorithm list, and broadcasts the consensus algorithm supported by the consensus subject G to which the consensus algorithm belongs to all current consensus group members to wait for solicitation information from other nodes;
9.3 After receiving the effective consensus algorithm solicitation information from other node consensus subjects, the consensus subject G selects the intersection of the consensus algorithm list and signs to generate the reply information, wherein the reply information comprises a consensus algorithm solicitation reply flag, a consensus subject identification number, a consensus group member list and a supported consensus algorithm integration list, replies the reply information to the sent consensus subject, and solicits the received consensus algorithmThe information is forwarded to other members of the current consensus group, and a replied member list is recorded; if at preset timeout time t 4 The operation is not performed when the consensus algorithm list of the same consensus main body is received again;
9.4 A) consensus subject G is in a preset timeout time t 5 In the method, the received all consensus algorithm sets are collected to form an intersection, and one consensus algorithm is selected according to the priority;
9.5 The consensus main body G broadcasts a consensus algorithm selection message, wherein the consensus algorithm selection message comprises a consensus algorithm selection information mark, a consensus main body identification number, a selected consensus algorithm, all signed reply messages received by the selected consensus algorithm and a sequence number m, wherein the sequence number m is initially 0, and if the selected consensus algorithm in the effective broadcast messages of other nodes is not consistent with the received consensus algorithm selection message of the broadcast of the node, the broadcast information is regenerated and the sequence number m in the selected consensus algorithm selection message is added with a rebroadcast;
9.6 After receiving the consensus algorithm selection information from the consensus main body of other nodes, recording the consensus algorithm selection information of the sequence number m of the received node, if the effective broadcast information of the received other nodes is inconsistent with the effective broadcast information of the received node, regenerating the broadcast information, updating the selected consensus algorithm, adding one to the sequence number m, and rebroadcasting; if the two types of the data are consistent, not performing operation; if at preset timeout time t 5 The consensus algorithm list with the same or smaller serial number of the same consensus main body is received again, and then the operation is not performed;
9.7 Algorithm control module of consensus subject G at preset timeout time t 5 Then, the selected consensus algorithm is not updated any more, a consensus member list and a block head in the selected consensus algorithm and the information of knotting of the history state from the consensus subject G are generated, the information of the change of the consensus group is generated, and the step 10 is skipped;
9.8 The consensus subject G takes out the last consensus algorithm from the history consensus algorithm, generates the information of the change of the consensus group by the last consensus algorithm, the consensus member list and the block head from the history state knotting information, and jumps to the step 10).
Optionally, in step 10), when all the consensus entities in the block chain consensus system perform consensus in parallel, the step of performing consensus on any consensus entity G in the block chain consensus system includes:
10.1 The consensus entity G continuously monitors whether transaction request information from a user exists, and if the transaction request information from the user exists, the step is skipped to the next step;
10.2 The consensus body G verifies the validity of the received transaction request information, including verifying the validity of the user and whether the user corresponds to the transaction information body, storing the legal transaction request locally and marking the legal transaction request as unused, and directly discarding the illegal transaction information;
10.3 Judging whether the consensus group is changed or not by the consensus subject G), and if the consensus group is not changed, jumping to the step 10.7); otherwise, if the consensus group changes, jumping to the next step;
10.4 The consensus subject G updates the current consensus algorithm according to the consensus group member list and the consensus algorithm, and performs consensus on the block header information in the consensus change information to generate an generated block of the current consensus algorithm;
10.5 The consensus subject G performs block confirmation on the generated generation block;
10.6 After confirming the created block, the consensus subject G performs rollback operation on all blocks that have been generated but not confirmed before, and jumps to step 10.14);
10.7 The consensus subject G obtains the unused transaction data stored locally and marks it as to be confirmed;
10.8 A block generation submodule of the consensus subject G performs consensus with other consensus subjects of the current consensus group to which the consensus subject G belongs according to a specified consensus algorithm, and transaction information is packed to generate a block;
10.9 The consensus subject G obtains the generated but unacknowledged block;
10.10 The consensus subject G performs block confirmation on all generated but not confirmed blocks according to the current consensus algorithm, and if the block confirmation result is confirmation operation, the step is skipped to step 10.11); if the operation is a rollback operation, jumping to the step 10.14); if no operation is needed or the confirmation/rollback operation cannot be confirmed temporarily, completing the current round consensus, and jumping to the step 2);
10.11 The consensus subject G stores the corresponding blocks into the corresponding block graph chain organization structures according to the assigned consensus algorithm according to the consensus algorithm used by the current consensus group;
10.12 The consensus subject G obtains the transaction information number contained in the confirmed block;
10.13 The consensus subject G deletes the transaction information corresponding to the acquired transaction information number, completes the current round consensus, and jumps to the step 2);
10.14 The consensus entity G discards the corresponding blocks and all the blocks subsequent thereto and determines the transaction information numbers contained in the discarded blocks;
10.15 The consensus body G completes the current round consensus by using the transaction information flag positions corresponding to the transaction information numbers included in the discarded blocks as unused, and jumps to step 2).
In addition, the invention also provides a chain network segmentation and recombination system oriented to the large-scale Internet of things scene, which comprises a microprocessor and a memory which are mutually connected, wherein the microprocessor is programmed or configured to execute the steps of the chain network segmentation and recombination method oriented to the large-scale Internet of things scene.
In addition, the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program programmed or configured to execute the chain network segmentation and recombination method facing the large-scale Internet of things scene.
Compared with the prior art, the invention has the following advantages: the method comprises the steps that a consensus main body firstly executes active recombination or segmentation based on a guide instruction, performs network detection, and selects to execute passive segmentation operation, passive recombination operation or keep the original network structure unchanged based on the dynamic change condition of a network; finally, all consensus main bodies tie a knot on the history state in parallel, respectively determine consensus algorithms for the current consensus groups to which the history state belongs, and perform consensus in parallel, so that the round of consensus is finally completed. The invention adds the functional modules for detecting the network state, supervising the dynamic change of the member nodes and corresponding in time on the basis of the original block chain consensus system: when network segmentation occurs, the consensus main bodies in the sub-networks are regrouped, so that the block chain consensus system can continuously respond to the request to generate a block structure; when the network is restored, the consensus groups among different sub-networks record the block structures generated by all the consensus groups in the network segmentation process with each other, and mutually acknowledge the legality of the block structures. The node of the internet of things can divide the consensus main body into different consensus groups according to actual conditions, and all the consensus main bodies in the consensus groups are subjected to consensus concurrently, so that each consensus group can simultaneously generate blocks for transaction packaging, namely, the blocks are packaged concurrently in the same time. The consensus group can customize the most suitable chain or pattern organization structure and the corresponding consensus algorithm according to the actual requirement. When a network partition appears, the invention can ensure that the block chain-based man-machine collaboration system of the Internet of things continuously achieves consensus to generate blocks, and can fuse the blocks generated during the partition after the network is restored, so that the partition or the fusion is quick in time, and the traceability and the non-tamper property of data are ensured; the method supports a plurality of consensus algorithms and a block chain organization structure with coexistence of different block chain structures.
Drawings
FIG. 1 is a schematic diagram of a basic flow of a method according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a logic structure of a common body in an embodiment of the present invention.
FIG. 3 is a detailed flowchart of step 5) in an embodiment of the present invention.
Fig. 4 is a monitoring flow of the consensus group control submodule involved in step 5) to step 7) in the embodiment of the present invention.
Fig. 5 is a detailed flowchart of step 8) in an embodiment of the present invention.
FIG. 6 is a detailed flow chart of step 10) in an embodiment of the present invention.
Detailed Description
As shown in fig. 1, the chain network segmentation and recombination method for a large-scale internet of things scene in this embodiment includes:
1) The consensus main body communicates with other consensus main bodies in the Internet of things to generate an initial consensus group;
2) The consensus main body monitors whether a guide reorganization instruction or a guide segmentation instruction is received, and if the guide reorganization instruction is received, the step 3) is skipped; if the guide segmentation instruction is received, jumping to the step 4); otherwise, jumping to the step 5);
3) Determining that all the consensus subjects in the block chain consensus system are guidance recombination instructions, and recombining the consensus subjects related to the guidance recombination instructions into a new consensus group by performing recombination operation on the consensus subjects related to the guidance recombination instructions; jump to step 8);
4) Determining an instruction for controlling a consensus group as a guide segmentation instruction by all consensus subjects in the block chain consensus system, and segmenting the consensus group into a plurality of sub-consensus groups based on the guide segmentation instruction by performing segmentation operation on the current consensus group; jump to step 8);
5) The consensus main body carries out network detection on the current consensus group members, and if the network needs to carry out segmentation operation, the step 6) is carried out in a jumping way; if the network needs to carry out the reorganization operation, the step 7) is carried out in a jumping way; otherwise, jumping to execute the step 8);
6) Determining that all consensus main bodies in the block chain consensus system determine a command for controlling a consensus group as a passive recombination command, and recombining each sub-consensus group obtained by segmentation into a consensus group by carrying out recombination operation; jump to step 8);
7) Determining that all consensus subjects in the block chain consensus system determine a command for controlling a consensus group as a passive segmentation command, and carrying out segmentation operation on the current consensus group to segment the consensus group into a plurality of sub-consensus groups; jump to step 8);
8) All consensus subjects in the block chain consensus system tie a knot to the history state in parallel;
9) A consensus main body in the block chain consensus system respectively determines a consensus algorithm for a current consensus group to which the block chain consensus main body belongs;
10 All consensus bodies in the block chain consensus system perform consensus in parallel, the round of consensus is completed, and step 2) is performed in a jumping mode.
Wherein the consensus body is each member node participating in the consensus. The member node is an internet of things hardware device capable of running a software program, such as an unmanned vehicle, an unmanned plane, an intelligent wearable device and the like. The member nodes are interconnected through a network. The nodes can communicate with each other, and all communication information is signed and sent.
Referring to fig. 2, in this embodiment, each member node is equipped with a network detection module, a history state knotting module, an algorithm control module, and a consensus module in addition to an operating system.
The network detection module consists of a consensus group control submodule and a guide instruction response submodule, receives a guide instruction from a user and detection information of the consensus group control submodule from other consensus main bodies, and transmits updated consensus group information to the history state knotting module when the consensus group information is updated; otherwise, the 'no change information' is transmitted to the consensus module. The consensus group information includes a consensus group member list (including numbers and public keys of all consensus subjects of one consensus group), a consensus round n and a grouping flag (active grouping flag if grouping is performed according to a guidance instruction, passive grouping flag if grouping is not performed according to a guidance instruction), where n is a positive integer and is initially 0.
In this embodiment, the consensus group is a group of consensus subjects, and the generation of the block is performed according to a agreed consensus algorithm. Different consensus algorithms have different requirements for the minimum number of members. The consensus group information stored in the consensus group control submodule comprises current consensus group information and historical consensus group information, wherein the current consensus group information refers to the consensus group information which is used by a consensus main body in a consensus manner, the historical consensus group information refers to the consensus information before all the divisions (including active division and passive division) experienced by the consensus main body are added into the blockchain consensus system, and when the consensus main body experiences the combination, the corresponding divided consensus group information is taken out from the historical consensus group information; before the consensus main body does not join the system and becomes a member of a consensus group, the history consensus group information is an empty set; if the historical consensus group information of the plurality of consensus subjects is the same, the recombination operation can be carried out, and the plurality of consensus subjects are combined into one consensus group. The current consensus group information is generated after communicating with network detection modules of other consensus principals. The consensus set is created at the beginning, and the consensus set rotation is 0.
The guide instruction response sub-module is connected with the consensus group control sub-module of the belonging consensus main body and is responsible for receiving the guide instruction from the user and transmitting the checked guide instruction to the consensus group control sub-module so that the consensus group control sub-module can perform active segmentation or recombination of the consensus group according to the guide instruction.
The guiding instruction refers to an instruction which is sent by a user or a node with authority and used for guiding the consensus group to divide or reorganize, the guiding instruction is divided into a guiding dividing instruction and a guiding reorganizing instruction, the guiding dividing instruction is used for forcedly dividing the current consensus group, and the guiding reorganizing instruction is used for combining a plurality of consensus groups into one consensus group. The guide division instruction must contain a guide division flag bit (which indicates that the instruction is a guide division instruction), a member list of a consensus group before division, a member list of all sub-consensus groups after division, and a list of consensus algorithms for specifying all sub-consensus groups can be added; the guide reorganization instruction comprises a guide reorganization flag bit (which indicates that the instruction is a guide reorganization instruction), all sub-reorganization group member lists participating in reorganization and a reorganization post-reorganization consensus group member list, and the guide reorganization instruction does not add the reorganization post-reorganization consensus algorithm because the reorganization will continue to generate a chain block chain structure or a schema block chain structure (collectively referred to as a block diagram chain organization structure) according to the pre-segmentation consensus algorithm. And after the guide instruction response submodule receives the guide instruction, checking the guide instruction, broadcasting and forwarding the guide instruction after the guide instruction passes the check, updating the consensus group information according to the guide instruction, and then sending the guide instruction to the history state knotting module of the belonging consensus main body.
The consensus group control submodule is connected with the guide instruction response submodule of the belonging consensus main body, the consensus module, the history state knotting module and the consensus group control submodule of other consensus main bodies. The consensus group control submodule mainly aims at generating, storing and updating consensus group information. The consensus group control submodule receives the guide instruction transmitted by the guide instruction response submodule, or manages the consensus group information by mutually sending detection instructions with the consensus group control submodules of other consensus subjects; sending a minimum membership request to an algorithm control module to acquire the minimum membership number required by the algorithm used by the current membership node; if the consensus group member list in the consensus group information changes, transmitting the received guide instruction or the generated segmentation instruction and recombination instruction to a history state knotting module; if no change exists, the 'no change information' is transmitted to the consensus module.
The consensus group control submodule is responsible for detecting connectivity of the consensus group members in the current consensus group information. Before the first consensus, the first consensus information is generated by communicating with a consensus group control submodule of other consensus subjects (namely mutually sending detection information in groups). And then communicating with the consensus group control submodule of other consensus main bodies, and determining whether to carry out grouping processing on the current consensus group according to the number of the consensus group members losing communication when the network is found to be segmented through the received detection information, namely when part of members on the consensus group member list cannot carry out communication. If the current consensus group is not segmented by the guide instruction, the consensus group control submodule detects connectivity of members in the last consensus group (namely, the last group of consensus group information in the history consensus group information, namely, the consensus group which is grouped by taking the current consensus group as the sub-consensus group and is before grouping), and when the last consensus group is found that the online members are higher than the minimum number of members required by consensus and can be communicated with all sub-consensus groups (the common set of the consensus group members where all members are located is the same as the last consensus group), all sub-consensus groups are recombined. When the segmentation or recombination operation is needed (when the situation is generated), the consensus group control submodule is in broadcast communication with the consensus group control submodules of other connected consensus main bodies, the current consensus group information is counted into the historical consensus group information and the most current consensus group information is generated, the segmentation or recombination operation is imitated to the format of a guiding instruction, a passive segmentation or recombination instruction is generated and sent to a historical state knotting module, wherein the passive segmentation instruction comprises a passive segmentation zone bit, a pre-segmentation consensus group member list and all sub-consensus group member lists after segmentation; the reorganization guide instruction comprises a passive reorganization flag bit (which indicates that the instruction is a passive reorganization instruction), a list of all sub-consensus group members before reorganization and a list of the consensus group members after reorganization; when the splitting or reorganizing operation is not needed (i.e. the situation is not satisfied), the consensus group control submodule transmits 'no change information' to the consensus module, so that the consensus module can continue to perform consensus according to the current consensus group.
The consensus group control submodule presets a timeout time t 1 、t 2 、t 3 Communication timeout time of the consensus group control submodule corresponding to the other consensus body. Wherein t is 1 To wait for the timeout time of the reply message of the detection information, t 2 To wait for the timeout time of the reply message of the reassembly detection message, t 3 To wait for a timeout of the preliminary consensus group member list information.
The history state knotting module is connected with the consensus group control submodule, the algorithm control module, the consensus module and the history state knotting modules of other consensus subjects, receives a guide instruction, a segmentation instruction or a recombination instruction from the consensus group control submodule of the belonging consensus subject, obtains a current segmentation or recombination zone bit, a current consensus group member list and a consensus group member list before segmentation or all sub-consensus group member lists before recombination, and is responsible for fixing the history state of the consensus group before segmentation or recombination and generating block heads containing the history state information. When the instruction received by the history state knotting module is a guide segmentation instruction and the guide segmentation instruction comprises a specified consensus algorithm, the history state knotting module sends a consensus group member list, the consensus algorithm and the block head to the consensus module; when the instruction received by the history state knotting module is a re-set instruction, a passive segmentation instruction or a guide segmentation instruction which does not contain a specified consensus algorithm, the history state knotting module sends a segmentation or re-set flag bit, a consensus group member list and a block to the algorithm control module.
When the history state knot-tying module fixes the history state, the latest confirmed block information in the block diagram chain organization structure of the consensus group where the current consensus body is located before segmentation or recombination is received from the consensus module of the consensus body. If the instruction received from the consensus group control submodule of the consensus main body is a reconstruction instruction, the history state knotting module needs to communicate with the history state knotting modules of the consensus nodes in other sub-consensus groups before reconstruction at the same time, so as to obtain the latest block information in the block graph chain organization structures of the other sub-consensus groups. The history state knotting module packs the latest block in the block diagram chain organization structure of the consensus group before segmentation or the latest block information of all the block diagram chain organization structures generated by all the sub-consensus groups before recombination and generates a block header which is contained in the first block information after segmentation or recombination, so that the block diagram chain organization structure of the consensus group before segmentation or the sub-consensus groups before recombination can be traced through the block.
If the instruction received by the history state knotting module is a guide segmentation instruction containing a consensus algorithm, the history state knotting module directly sends the current consensus group member list, the consensus algorithm and block header information to the consensus module as the consensus algorithm is already determined; if the instruction received by the history state knotting module is a recombinant instruction, a passive segmentation instruction or a guide segmentation instruction which does not contain a specified consensus algorithm, the history state knotting module sends the current consensus group member list and block header information to the algorithm control module.
The algorithm control module is connected with the history state knotting module of the belonging consensus main body, the consensus module and the algorithm control modules of other consensus main bodies and is responsible for selecting the consensus algorithm used by the consensus group. The algorithm control module stores all supported algorithms and corresponding priorities of the block chain consensus system, and stores a consensus algorithm list supported by the belonging consensus main body. The algorithm control module receives the current consensus group member list and the block head information from the history state knotting module, and communicates with the algorithm control modules of the consensus main bodies on the consensus group member list, and selects one consensus algorithm from the consensus algorithm sets supported by all the consensus main bodies according to the priority as the consensus algorithm of the current consensus group, and transmits the current consensus group member list, the selected consensus algorithm and the block head information to the consensus module. The algorithm control module presets the timeout time t 4 、t 5 ,t 4 For forwardingLatency of replying to consensus list, t 5 Time-out for communication with other algorithm control modules of the consensus principal.
The consensus module is connected with the consensus module of the user, the algorithm control module, the history state knotting module, the network detection module and other consensus subjects, receives the current consensus group member list, the selected consensus algorithm and the block header information from the algorithm control module or the history state knotting module, receives unchanged information from the consensus group control submodule of the network detection module and receives transaction request information from the user. The consensus module consists of a request processing submodule, a local buffer submodule, a block generating submodule and a block confirming submodule. The request processing sub-module is responsible for receiving transaction request information (including transaction information) from a user, verifying the validity of the received transaction request information, transmitting the legal transaction request information to the local buffer sub-module, marking the local buffer sub-module as unused, and discarding the illegal transaction request information; the local buffering submodule is responsible for storing the transaction request information received from the request processing submodule, and the local buffering submodule sets all the transaction request information marks which are not in the uplink from an unused state to a state to be confirmed and sends the transaction request information marks to the block generating submodule; after receiving the confirmation information from the block confirmation submodule, deleting the corresponding transaction request information; if the uplink failure information (i.e., the block rollback information) is received from the block acknowledgement submodule, the state of the corresponding transaction information is reset from the to-be-acknowledged state to the unused state. The block generating sub-module acquires transaction information of all unused states from the local buffering sub-module (after the transaction information is acquired, the local buffering sub-module sets the states of the transaction information to be confirmed). The block is generated after consensus among all consensus main bodies of the consensus group is participated in according to a selected consensus algorithm received from an algorithm control module or a history state knotting module, and the block is sent to a block confirmation sub-module; the block confirmation sub-module receives the blocks from the block generation sub-module, and confirms the blocks according to the requirements of the consensus algorithm (the confirmation requirements of different consensus algorithms are inconsistent, such as a PBFT algorithm, the generation of the blocks is regarded as confirmation, the PoW algorithm needs to wait for the blocks to be confirmed after a certain length is formed, the HashGraph algorithm needs to confirm after virtual voting), if the rollback blocks are generated, the corresponding blocks and all the blocks which take the block failed in the uplink as ancestors (if the block A can trace back to the block B, the block B is the ancestor block of the block A) are discarded, the information of the uplink failure is transferred to the local buffering sub-module, and if the block is confirmed, the corresponding blocks are stored into the block chain organization structure according to the requirements of the consensus algorithm. When the block generation sub-module receives the block header information from the historical state knotting module or the algorithm control module, a block header of a first block is generated, and the block header of the first block contains the received block header information, so that a new consensus group and a block graph chain organization structure generated by a consensus algorithm can be traced back to the block graph chain organization structure before segmentation or recombination.
When the reorganizing operation is performed on the consensus subject related to the guided reorganizing instruction in the step 3), the step of reorganizing any consensus subject G in the blockchain consensus system includes:
3.1 Detecting whether the recombined consensus group member list in the guide recombination instruction is consistent with the last consensus group member list in the history consensus group information, and if so, jumping to the step 3.2); if not, jumping to the step 5);
3.2 Detecting whether the list of all sub-consensus groups before recombination in the guide recombination instruction contains the current consensus group or not, and if so, jumping to the step 3.3); if not, jumping to the step 5);
3.3 Broadcasting a guide reorganization instruction to all reorganized consensus group members;
3.4 All reorganized consensus group members receive a guide reorganization instruction;
3.5 All the reorganized consensus group members update the current consensus group information into the last consensus group information acquired from the history consensus group information;
3.6 All the reorganized consensus group members determine that the command of the consensus group control is a guide reorganization command, and the step 8) is performed in a jumping manner.
In connection with the modular structure of consensus entity G in fig. 2, the step of reorganizing any consensus entity G within the blockchain consensus system comprises: 3.1 A guide instruction response sub-module detects whether the recombined consensus member list in the guide recombination instruction is consistent with the last consensus member list in the history consensus information, and if so, the step is skipped to step 3.2); if not, jump to step 5). 3.2 A guide instruction response sub-module detects whether the list of all sub-consensus groups before recombination in the guide recombination instruction contains the current consensus group or not, and if so, the step is skipped to step 3.3); if not, go to step 5). 3.3 A bootstrap response sub-module that broadcasts bootstrap reorganization commands to all reorganized bootstrap response sub-modules of the consensus group members. 3.4 The guiding command response sub-module of all the reorganized consensus group members sends guiding reorganization commands to the consensus group control sub-module of the belonging consensus body. 3.5 The consensus group control submodule of all the reorganized consensus group members updates the current consensus group information into the last consensus group information acquired from the historical consensus group information. 3.6 And (3) the consensus group control submodule of all the reorganized consensus group members sends a guide reorganization instruction to the history state knotting module of the belonging consensus main body, and the step 8 is executed in a jumping mode.
In step 4), when the partition instruction is directed to perform the partition operation on the current consensus group, the step of performing the partition operation on any consensus entity G in the blockchain consensus system includes:
4.1 Detecting whether the list of the pre-segmentation consensus group members in the guide segmentation instruction is consistent with the current consensus group member list, if so, jumping to the step 4.2); if not, jumping to the step 5);
4.2 Broadcasting a guide segmentation instruction to all current consensus group members;
4.3 All current consensus group members receive the guide segmentation instruction;
4.4 All current consensus group members store the current consensus group information into the historical consensus group information;
4.5 All current consensus group members store the sub-consensus group member list containing the affiliated consensus main body in all sub-consensus group member lists after being segmented in the guide segmentation instruction as a member list of the current consensus group information, the consensus round n of the current consensus group information is set as 0, and the grouping mark is set as an active grouping mark;
4.6 All current consensus members determine the instruction of the consensus control as a pilot split instruction, step 8) is performed in a jump.
In connection with the modular structure of the consensus entity G in fig. 2, the step of splitting any consensus entity G within the blockchain consensus system comprises: 4.1 A boot instruction response sub-module detects whether the pre-segmentation consensus group member list in the boot segmentation instruction is consistent with the current consensus group member list, and if so, jumps to step 4.2); if not, jumping to the step 5); 4.2 A boot instruction response sub-module that broadcasts a boot split instruction to all currently-identified group members. 4.3 The guidance command response sub-module of all the current consensus group members sends guidance segmentation commands to the consensus group control sub-module of the belonging consensus subject. 4.4 The consensus group control sub-module of all the current consensus group members stores the current consensus group information into the historical consensus group information. 4.5 The consensus group control submodule of all the current consensus group members stores a sub-consensus group member list containing a belonging consensus subject in all sub-consensus group member lists after being segmented in the guide segmentation instruction as a member list of the current consensus group information, sets the consensus round n of the current consensus group information as 0, and sets a grouping mark as an active grouping mark. 4.6 And (3) the consensus group control submodule of all the current consensus group members sends a guide segmentation instruction to the history state knotting module of the belonging consensus main body, and the step 8 is executed in a jumping manner.
And 5) detecting the network state by using the consensus group control submodules of all the consensus subjects in the block chain consensus system, wherein the detection method of each consensus group control submodule is the same. Referring to fig. 3 and fig. 4, taking an example of a consensus group control submodule of an arbitrary consensus subject G, the step of performing network detection on a current consensus group member by the consensus subject in step 5) includes:
5.1 If the present consensus subject (consensus subject G) is not in an offline state, the consensus round n=n+1 in the current consensus group information.
5.2 If the consensus round n in the current consensus group information is 1, acquiring the lowest membership number of the currently used consensus algorithm and the last used consensus algorithm from an algorithm control module;
5.3 Broadcasting detection information (including detection information mark, current consensus main body identification number, current consensus group list and consensus round n) to all members of current consensus group;
5.4 After receiving the detection information from the nth turn of other consensus subjects for the first time and verifying whether the signature and the consensus group list are consistent or not and whether the detection information is the current turn or not, forwarding the detection information to other members of the consensus group; a consensus group control submodule for generating a reply message (a detection message reply flag, a current consensus subject identification number, a consensus round n) and replying the reply message to the consensus subject sending the detection message; a list of consensus principals that have been received and replied to for the nth round is recorded. If the consensus body has been replied to on the nth round, no forwarding and replying operations are performed (to prevent unnecessary retransmissions);
5.5 Counting received reply information within a timeout time t 1; if the number of the recovered consensus main body is less than the preset threshold (the value is 4 in the embodiment), the state of the consensus main body G is placed in an offline state, and the round is ended, and the step 2) is skipped; if the number of the recovered consensus subjects is not less than the preset threshold value 4 and the consensus subject G is in an offline state, removing the offline state of the current consensus subject; if the returned consensus main body number does not meet the minimum node number required by the current consensus algorithm, jumping to the step 7); if the number of the recovered consensus subjects is not less than the minimum number of the consensus subjects required by the current consensus algorithm, the step is skipped to step 5.6).
5.6 If the grouping mark is active grouping in the current consensus group information, judging that the consensus group is unchanged, and jumping to the step 10); otherwise, jumping to the step 5.7);
5.7 Detecting the number of online members on the last consensus group member list, and broadcasting the recombination detection information (recombination detection mark, identification number of consensus subject G, current consensus group list, last consensus group member list, consensus round n) to all last consensus group members.
5.8 After receiving the reorganization detection information, checking whether the reorganization detection information is effective (whether the reorganization detection information is the same round, whether the current consensus group list is consistent, whether the last consensus group member list is consistent, whether the signature is effective, etc.), and after receiving the reorganization detection information of the nth round from other nodes for the first time, forwarding the reorganization detection information to other consensus group members in the last consensus group member list; generating reply information (a reply sign of the reorganization detection information, a current consensus main body identification number, a consensus group member list and a consensus round n) and replying the reply information to the consensus main body sending the reorganization detection information; recording a list of nodes which have replied to the reorganization detection information for the nth round; if the recombination detection information is not received for the first time in the nth round, forwarding and replying operations are not performed.
5.9 Counting the received reply message within the timeout time t 2. If the replied node number meets the minimum node number required by the last consensus algorithm, and the union of all the received member lists is consistent with the last consensus member list, jumping to the step 6); otherwise, judging that the consensus group is unchanged, and jumping to the step 10).
Referring to fig. 3 and 4, in combination with the module structure of the common entity G in fig. 2, the step of the common entity performing network detection on the current common entity group member in step 5) includes: 5.1 If the consensus main body G to which the consensus group control submodule belongs is not in an offline state, the consensus round n=n+1 in the current consensus group information of the consensus group control submodule. 5.2 If the consensus round n in the current consensus group information in the consensus group control submodule is 1, the lowest member number of the currently used consensus algorithm and the last used consensus algorithm is obtained from the algorithm control module. 5.3 The consensus group control sub-module broadcasts detection information (including a detection information flag, a current consensus subject identification number, a current consensus group list, a consensus round n) to all members of the current consensus group. 5.4 After receiving the detection information from the nth turn of other consensus main bodies for the first time and verifying the signature, whether the consensus group list is consistent or not and whether the consensus group list is the current turn or not, the consensus group control submodule forwards the detection information to other members of the consensus group; a consensus group control submodule for generating a reply message (a detection message reply flag, a current consensus subject identification number, a consensus round n) and replying the reply message to the consensus subject sending the detection message; a list of consensus principals that have been received and replied to for the nth round is recorded. If the consensus body has been replied to on the nth round, no forwarding and replying operations are performed (to prevent unnecessary retransmissions). 5.5 The consensus group control sub-module counts the received reply messages within the timeout time t 1. If the number of the recovered consensus main bodies is less than 4, putting the state of the consensus main body G in an offline state, and turning to a second step; if the number of the recovered consensus main bodies is not less than 4 and the consensus main body G is in an offline state, removing the offline state of the current consensus main body; if the returned consensus main body number does not meet the minimum node number required by the current consensus algorithm, jumping to the step 7); if the number of the recovered consensus subjects is not less than the minimum consensus subject number required by the current consensus algorithm, the process goes to 5.6.5.6 If the grouping mark is active grouping in the current consensus group information of the consensus group control submodule, the 'no change' information is sent to the consensus module, the step 10 is skipped, otherwise, the step 5.7 is skipped. 5.7 The consensus group control submodule detects the online membership number on the last consensus group membership list and broadcasts recombination detection information (recombination detection mark, identification number of consensus subject G, current consensus group list, last consensus group membership list and consensus round n) to all last consensus group members. 5.8 After receiving the reorganization detection information, the consensus group control submodule checks whether the reorganization detection information is valid (whether the reorganization detection information is the same round, whether the current consensus group list is consistent, whether the last consensus group member list is consistent, whether the signature is valid, etc.), and forwards the reorganization detection information to other consensus group members in the last consensus group member list after receiving the reorganization detection information of the nth round from other nodes for the first time; generating reply information (a reply sign of the reorganization detection information, a current consensus main body identification number, a consensus group member list and a consensus round n) and replying the reply information to the consensus main body sending the reorganization detection information; recording a list of nodes which have replied to the reorganization detection information for the nth round; if the recombination detection information is not received for the first time in the nth round, forwarding and replying operations are not performed. 5.9 The consensus group control sub-module counts the received reply messages within the timeout time t 2. If the replied node number meets the minimum node number required by the last consensus algorithm, and the union of all the received member lists is consistent with the last consensus member list, turning to a sixth step; otherwise, sending 'no change' information to the consensus module, and jumping to step 10).
And 6) carrying out passive recombination operation on the consensus group control submodules of all the consensus subjects in the block chain consensus system in parallel, wherein the passive recombination operation of each consensus subject is the same. In step 6) of this embodiment, when the reorganizing operation is performed on each sub-consensus group obtained by segmentation, the step of reorganizing any consensus entity G in the blockchain consensus system includes:
6.1 The consensus body G integrates all received reply messages of recombination detection into recombination information, wherein the recombination information comprises a recombination information mark, a current consensus body identification number, a consensus round n, a recombined consensus group member list and all received recombination detection reply message sets, and the recombination information is broadcast to all consensus group members in the last consensus group member list;
6.2 After receiving the reorganization information sent by other nodes, the consensus body G checks whether the reorganization information is valid, if so, the reorganization information is forwarded to all other members in the last consensus group member list, and the reorganization information sent by each node is forwarded once in the nth round;
6.3 The consensus subject G updates the current consensus group information into the last consensus group information extracted from the history consensus group information;
6.4 The consensus main body G combines the consensus group member list in the reply of all received recombination detection information into all sub-consensus group member lists before recombination, takes the last consensus group member list as a recombination consensus group member list, and combines the last consensus group member list with a recombination zone bit to generate a passive recombination instruction, wherein the passive recombination instruction comprises a passive recombination mark, all sub-consensus group member lists before recombination and the recombination consensus group member list after recombination;
6.5 The consensus subject G determines that the command of the consensus group control is a passive reorganization command, and jumps to execute the step 8).
In connection with the modular structure of the consensus G in fig. 2, the step of reorganizing any consensus G in the block chain consensus system in step 6) comprises: 6.1 The consensus group control sub-module of the consensus subject G integrates all received reply messages of the recombination detection into recombination information (comprising a recombination information mark, a current consensus subject identification number, a consensus round n, a recombined consensus group member list, and all received recombination detection reply message sets), and broadcasts the recombination information to all consensus group members in the last consensus group member list. 6.2 After receiving the reorganization information sent by other reorganization nodes, the reorganization group control submodule of the reorganization main body G checks whether the reorganization information is valid (check whether all reorganization detection reply information sets in the information are signed valid, whether the number of signature nodes meets the lowest reorganization requirement, whether the reorganized reorganization group member list is consistent with the last reorganization group member list, etc.), and forwards the reorganization information to all other members in the last reorganization group member list (the reorganization information sent by each node is forwarded only once in the nth round). 6.3 The consensus group control sub-module of the consensus subject G updates the current consensus group information to the last consensus group information extracted from the historical consensus group information. 6.4 The consensus group control submodule of the consensus main body G combines the consensus group member list in the received reply of all the recombination detection information into all the sub-consensus group member lists before recombination, takes the last consensus group member list as the consensus group member list after recombination, and combines the last consensus group member list with the recombination zone bit to generate a passive recombination instruction (a passive recombination mark, all the sub-consensus group member lists before recombination and the consensus group member list after recombination). 6.5 The consensus group control sub-module of the consensus subject G sends a passive reorganization instruction to the historical state knotting module, and the step 8) is executed in a jumping manner.
And 7) carrying out passive segmentation operation on the consensus group control submodules of all the consensus subjects in the block chain consensus system in parallel, wherein the passive segmentation operation of each consensus subject is the same. In step 7) of this embodiment, when performing the splitting operation for the current consensus group, the step of performing the splitting operation for any consensus entity G in the blockchain consensus system includes:
7.1 The received replying broadcast detection information and the replied node list are counted as a list to obtain a preliminary consensus group member list, the preliminary consensus group member list contains reply information signed by all members on the list, the preliminary segmentation information is broadcast to all members of the consensus group member list, and the preliminary segmentation information comprises a preliminary segmentation information mark, an identification number of a consensus subject G, a consensus round, the consensus group member list, the preliminary consensus group member list and signature reply information of all members;
7.2 After the first time of receiving the preliminary segmentation information sent by other consensus group control submodules for the nth round, firstly detecting the validity of the preliminary segmentation information, and taking the union of the received preliminary consensus group member list and the preliminary consensus group member list stored locally as new preliminary consensus group member list information after the validity detection is passed, and generating new preliminary segmentation information and broadcasting the new preliminary segmentation information to all consensus group members; if the list information received by the nth round is a subset of the current preliminary consensus group member list, not forwarding the reply operation;
7.3 After a preset timeout t3, the list of the preliminary consensus group members is not updated any more; if the number of the final preliminary consensus group member list still does not meet the minimum member number required by the current consensus algorithm, jumping to the step 7.4); otherwise, judging that the consensus group is unchanged, and jumping to the step 10);
7.4 The consensus group control sub-module stores the current consensus group member list into the history consensus group member list, and the current consensus group member list becomes a new last consensus group member list after the current consensus group member list is stored;
7.5 Updating the current consensus group member list into a final preliminary consensus group member list, resetting the consensus round n to 0, and setting a grouping mark as a passive grouping mark;
7.6 After the update of the member lists of the consensus groups is completed, generating a passive segmentation instruction, wherein the passive segmentation instruction comprises a passive segmentation flag bit, a member list of the consensus groups before segmentation and a member list of all sub-consensus groups after segmentation, taking the current member list of the consensus groups as one sub-consensus group, taking all members which are not in the current member list of the last consensus group as another sub-consensus group, taking the two sub-consensus groups as member lists of all sub-consensus groups after segmentation, taking the member list of the last consensus group as member list of the consensus groups before segmentation, and combining the segmentation instruction by the segmentation flag bit;
7.7 The consensus subject G determines that the command for consensus group control is a passive partition command, and jumps to execute step 8).
Referring to fig. 4, in connection with the module structure of the common subject G in fig. 2, the step 7) of performing the splitting operation on any common subject G in the block chain common system includes: 7.1 The consensus group control sub-module counts the received replying broadcast detection information and the replying node list into a list to obtain a preliminary consensus group member list (including reply information signed by all members on the list), and broadcasts preliminary segmentation information (including a preliminary segmentation information mark, an identification number of a consensus main body G, a consensus round, the consensus group member list, the preliminary consensus group member list and signature reply information of all members) to all members of the consensus group member list. 7.2 After the first time of receiving the preliminary segmentation information sent by other consensus group control submodules in the nth round, the consensus group control submodule firstly detects the validity (whether the consensus round is matched, whether the consensus group member list is matched, verifying signature information and the like), takes the union of the received preliminary consensus group member list and the preliminary consensus group member list stored locally as new preliminary consensus group member list information, and generates new preliminary segmentation information and broadcasts the new preliminary segmentation information to all consensus group members; if the list information received in the nth round is a subset of the current preliminary consensus group member list, the reply operation is not forwarded. 7.3 After a timeout period t 3), the consensus control submodule does not update the preliminary consensus member list. If the number of the final preliminary consensus group member list still does not meet the minimum member number required by the current consensus algorithm, skipping to execute the step 7.4); otherwise, sending unchanged information to the consensus module, and executing step 10 in a jumping manner. 7.4 The consensus group control sub-module stores the current consensus group member list into a history consensus group member list (the last member list, i.e., the last consensus group member list after the storing, the current consensus group member list becomes the new last consensus group member list). 7.5 The consensus group control sub-module updates the current consensus group member list to a final preliminary consensus group member list, resets the consensus round n to 0, and sets the grouping flag to a passive grouping flag. 7.6 After the consensus group control submodule completes the update of the consensus group member list, a passive segmentation instruction (comprising a passive segmentation flag bit, a pre-segmentation consensus group member list and all sub-consensus group member lists after segmentation) is generated, the current consensus group member list is used as one sub-consensus group, all members which are not in the current consensus group member list in the last consensus group member list are used as another sub-consensus group, the two sub-consensus groups are used as all sub-consensus group member lists after segmentation (the second consensus group is not a real post-segmentation consensus group, only serves as a supplementary bit and is not actually used), and the last consensus group member list is used as the pre-segmentation consensus group member list and the segmentation flag bit is used for synthesizing the segmentation instruction. 7.7 The consensus group control sub-module sends the passive segmentation instruction to the historical state knotting module, and the step 8) is executed in a jumping mode.
As shown in fig. 5, in step 8) of the present embodiment, when all consensus subjects in the block chain consensus system tie a knot to a history state in parallel, the step of tying a knot to a history state by any consensus subject G in the block chain consensus system includes:
8.1 The consensus subject G obtains the hash information of the newly determined block;
8.2 If the instruction of the consensus group control of the consensus subject G is a split instruction, the split instruction includes a guide split instruction and a passive split instruction, then the step 8.3 is skipped; if the consensus subject G receives a command of the consensus group control as a reorganization command, wherein the reorganization command comprises a guide reorganization command and a passive reorganization command, the step 8.5 is skipped;
8.3 The consensus subject G encapsulates all the obtained hash information to generate a first block header;
8.4 If the command for controlling the consensus group of the consensus main body G is a guide division command, wherein the guide division command comprises a consensus algorithm of all sub-consensus groups, a sub-consensus group member list comprising the consensus main body and a corresponding consensus algorithm are selected from the sub-consensus group member list after being divided in the guide division command, and the sub-consensus group member list and the corresponding consensus algorithm are combined with a first block head generated by encapsulation to generate information of the change of the consensus group, and the step 10 is skipped; if the command of the consensus main body G for performing the consensus group control is a passive segmentation command or a guide segmentation command without a specified consensus algorithm, selecting a sub-consensus group member list containing the consensus main body G from the sub-consensus group member lists segmented in the command, merging with a first block head generated by encapsulation and a corresponding division flag bit, and jumping to the step 9);
8.5 The consensus subject G obtains a hash set of the latest confirmed block information in the block graph chain organization structure generated by each consensus group from all consensus group members before recombination;
8.6 The consensus subject G encapsulates all the obtained hash sets to generate a second block header;
8.7 The consensus main body G merges the reorganization flag bit, the reorganized consensus member list in the received reorganization instruction and the second block header generated by encapsulation, and jumps to the step 9).
Referring to fig. 5, in connection with the module structure of the consensus G in fig. 2, the step of knotting the history status by any consensus G in the block chain consensus system in step 8) includes: 8.1 A history state knotting module of the consensus subject G acquires the hash information of the newly determined block from the consensus module of the consensus subject G. 8.2 If the history state knotting module of the consensus subject G receives the segmentation instruction (including the guide segmentation instruction and the passive segmentation instruction) from the consensus group control submodule of the consensus subject G, 8.3 is changed; if it is a reorganization instruction (including a guided reorganization instruction and a passive reorganization instruction), 8.5 is transferred. 8.3 A history state knotting module of the consensus subject G encapsulates all the obtained hash information into a block header. 8.4 If the dividing instruction received by the history state knotting module of the consensus subject G is a guide dividing instruction, and the guide dividing instruction includes a consensus algorithm of all sub-consensus groups, selecting a sub-consensus group member list including the consensus subject from the sub-consensus group member lists divided in the guide dividing instruction
And corresponding consensus algorithm, merging with the block header generated in 8.3) to generate consensus variation information and sending the consensus variation information to a consensus subject G
The consensus module jumps to step 10); if the dividing instruction received by the history state knotting module of the consensus body G is a passive dividing instruction or a guiding dividing instruction without a specified consensus algorithm, selecting a sub-consensus group member list containing the consensus body G from the sub-consensus group member list divided in the instruction, combining with the block header generated in 8.3) and the corresponding dividing flag bit, and sending to the algorithm control module of the consensus body G, and jumping to step 9). 8.5 The history state knotting module of the consensus subject G obtains a hash set of the latest confirmed block information in the block diagram chain organization structure generated by each consensus group from all the consensus group members before recombination. 8.6 A history state knotting module of the consensus subject G encapsulates all the obtained hash sets into a block header. 8.7 The history state knotting module of the consensus subject G sends the reorganization flag bit, the reorganized consensus member list in the received reorganization instruction and the block header generated in 8.6 to the algorithm control module of the consensus subject G, and jumps to step 9). When the history state knotting module of the consensus subject G in step 8.1) obtains the hash information of the last determined block from the consensus module of the consensus subject G, if the current block diagram chain organization structure is a chain structure, only obtaining the hash information of the last determined block; and if the structure is a pattern structure, acquiring the hash information of the determined blocks at all the tail ends.
In step 9) of this embodiment, when the consensus subjects determine the consensus algorithm for the current consensus group to which they belong, the step of determining the consensus algorithm by any consensus subject G in the blockchain consensus system includes:
9.1 The method comprises the steps that) a consensus subject G receives historical state knotting information from the consensus subject G, wherein the historical state knotting information comprises a zone bit, a consensus group member list and block head information; if the flag bit is a segmentation flag, jumping to the step 9.2); if the flag bit is a recombinant flag, jumping to the step 9.8);
9.2 The consensus subject G sends consensus algorithm solicitation information which comprises a consensus algorithm solicitation information mark, a consensus subject identification number, a consensus group member list and a supported consensus algorithm list, and broadcasts the consensus algorithm supported by the consensus subject G to which the consensus algorithm belongs to all current consensus group members to wait for solicitation information from other nodes;
9.3 After receiving the effective consensus algorithm solicitation information from other node consensus principals, the consensus principal G selects the intersection of the consensus algorithm list and signs to generate the reply information, wherein the reply information comprises a consensus algorithm solicitation reply sign, a consensus principal identification number, a consensus group member list and a supported consensus algorithm integration list, replies the reply information to the sent consensus principal, forwards the received consensus algorithm solicitation information to other members of the current consensus group, and records the replied member list; if at preset timeout time t 4 The operation is not performed when the consensus algorithm list of the same consensus main body is received again;
9.4 A) consensus subject G is in a preset timeout time t 5 In the method, the received all consensus algorithm sets are collected to form an intersection, and one consensus algorithm is selected according to the priority;
9.5 The consensus main body G broadcasts a consensus algorithm selection message, wherein the consensus algorithm selection message comprises a consensus algorithm selection information mark, a consensus main body identification number, a selected consensus algorithm, all signed reply messages received by the selected consensus algorithm and a sequence number m, wherein the sequence number m is initially 0, and if the selected consensus algorithm in the effective broadcast messages of other nodes is not consistent with the received consensus algorithm selection message of the broadcast of the node, the broadcast information is regenerated and the sequence number m in the selected consensus algorithm selection message is added with a rebroadcast;
9.6 After receiving the consensus algorithm selection information from the consensus main body of other nodes, recording the consensus algorithm selection information of the sequence number m of the received node, if the effective broadcast information of the received other nodes is inconsistent with the effective broadcast information of the received node, regenerating the broadcast information, updating the selected consensus algorithm, adding one to the sequence number m, and rebroadcasting; if the two types of the data are consistent, not performing operation; if at preset timeout time t 5 The consensus algorithm list with the same or smaller serial number of the same consensus main body is received again, and then the operation is not performed;
9.7 Algorithm control module of consensus subject G at preset timeout time t 5 Then, the selected consensus algorithm is not updated any more, a consensus member list and a block head in the selected consensus algorithm and the information of knotting of the history state from the consensus subject G are generated, the information of the change of the consensus group is generated, and the step 10 is skipped;
9.8 The consensus subject G takes out the last consensus algorithm from the history consensus algorithm, generates the information of the change of the consensus group by the last consensus algorithm, the consensus member list and the block head from the history state knotting information, and jumps to the step 10).
Referring to fig. 6, in conjunction with the modular structure of the consensus G in fig. 2, the step of determining a consensus algorithm for any consensus G in the block chain consensus system in step 9) comprises: 9.1 The algorithm control module of the consensus subject G receives information (segmentation or recombination flag bit, consensus group member list and block header information) from the history state knotting module of the consensus subject G, and if the flag bit is a segmentation flag, the process goes to 9.2; if the flag bit is the recombinant flag, turning to the step 9.8); 9.2 The algorithm control module of the consensus subject G transmits consensus algorithm solicitation information (including a consensus algorithm solicitation information flag, a consensus subject identification number, a consensus group member list, a supported consensus algorithm list), broadcasts the consensus algorithm supported by the consensus subject G to which the consensus algorithm belongs to all current consensus group members, and waits for solicitation information from other nodes. 9.3 After receiving the effective consensus algorithm solicitation information from other node consensus subjects, the algorithm control module of the consensus subject G selects the intersection of the consensus algorithm list and signs to generate reply information (including a consensus algorithm solicitation reply flag, a consensus subject identification number, a consensus group member list and a supported consensus algorithm integration list), replies the reply information to the sent consensus subject, and forwards the received consensus algorithm solicitation information to other members of the current consensus group, and records the replied member list; if the consensus algorithm list of the same consensus main body is received again within the timeout time t4, no operation is performed. 9.4 The algorithm control module of the consensus subject G takes the received all consensus algorithm sets as intersections and selects one consensus algorithm according to the priority within the timeout time t 5. 9.5 The algorithm control module of the consensus subject G broadcasts a consensus algorithm selection message (including a consensus algorithm selection information flag, a consensus subject identification number, a selected consensus algorithm and all signed reply messages received by the selected consensus algorithm, a sequence number m), wherein the sequence number m is initially 0, and if the selected consensus algorithm in the valid broadcast information of other nodes is received, and all the received signed reply messages are inconsistent with the broadcast consensus algorithm selection message of the node, the broadcast information is regenerated, wherein the sequence number is increased by one, and the broadcast is rebroadcast. 9.6 After receiving the consensus algorithm selection information from the consensus main body of other nodes, the algorithm control module of the consensus main body G records the consensus algorithm selection information of the sequence number m of the received node, and if the effective broadcast information of the received node is inconsistent with the effective broadcast information of the received node, the broadcast information is regenerated, the selected consensus algorithm is updated, the sequence number is added by one, and the broadcast is rebroadcast; if the two types of the data are consistent, not performing operation; if the consensus algorithm list with the same or smaller serial number of the same consensus main body is received again within the timeout time t5, no operation is performed. 9.7 After the overtime time t5, the algorithm control module of the consensus subject G does not update the selected consensus algorithm any more, and the selected consensus algorithm, a consensus member list and a block header in the information of knotting the history state from the consensus subject G, generate consensus change information and send the consensus change information to the consensus module of the consensus subject G, and jump to the step 10); 9.8 The algorithm control module of the consensus subject G takes out the last consensus algorithm from the historical consensus algorithm, generates the consensus change information to the consensus module of the consensus subject G by the last consensus algorithm, the consensus member list and the block head from the historical state knotting information, and jumps to the step 10).
In step 10) of this embodiment, when all consensus entities in the block chain consensus system perform consensus in parallel, the step of performing consensus on any consensus entity G in the block chain consensus system includes:
10.1 The consensus entity G continuously monitors whether transaction request information from a user exists, and if the transaction request information from the user exists, the step is skipped to the next step;
10.2 The consensus body G verifies the validity of the received transaction request information, including verifying the validity of the user and whether the user corresponds to the transaction information body, storing the legal transaction request locally and marking the legal transaction request as unused, and directly discarding the illegal transaction information;
10.3 Judging whether the consensus group is changed or not by the consensus subject G), and if the consensus group is not changed, jumping to the step 10.7); otherwise, if the consensus group changes, jumping to the next step;
10.4 The consensus subject G updates the current consensus algorithm according to the consensus group member list and the consensus algorithm, and performs consensus on the block header information in the consensus change information to generate an generated block of the current consensus algorithm;
10.5 The consensus subject G performs block confirmation on the generated generation block;
10.6 After confirming the created block, the consensus subject G performs rollback operation on all blocks that have been generated but not confirmed before, and jumps to step 10.14);
10.7 The consensus subject G obtains the unused transaction data stored locally and marks it as to be confirmed;
10.8 A block generation submodule of the consensus subject G performs consensus with other consensus subjects of the current consensus group to which the consensus subject G belongs according to a specified consensus algorithm, and transaction information is packed to generate a block;
10.9 The consensus subject G obtains the generated but unacknowledged block;
10.10 The consensus subject G performs block confirmation on all generated but not confirmed blocks according to the current consensus algorithm, and if the block confirmation result is confirmation operation, the step is skipped to step 10.11); if the operation is a rollback operation, jumping to the step 10.14); if no operation is needed or the confirmation/rollback operation cannot be confirmed temporarily, completing the current round consensus, and jumping to the step 2);
10.11 The consensus subject G stores the corresponding blocks into the corresponding block graph chain organization structures according to the assigned consensus algorithm according to the consensus algorithm used by the current consensus group;
10.12 The consensus subject G obtains the transaction information number contained in the confirmed block;
10.13 The consensus subject G deletes the transaction information corresponding to the acquired transaction information number, completes the current round consensus, and jumps to the step 2);
10.14 The consensus entity G discards the corresponding blocks and all the blocks subsequent thereto and determines the transaction information numbers contained in the discarded blocks;
10.15 The consensus body G completes the current round consensus by using the transaction information flag positions corresponding to the transaction information numbers included in the discarded blocks as unused, and jumps to step 2).
In connection with the modular structure of the consensus G in fig. 2, the step of consensus any consensus G in the block chain consensus system in step 10) comprises: 10.1 The request processing sub-blockchain consensus module of the consensus entity G continuously listens for transaction request information from the user. 10.2 The request processing submodule of the consensus body G verifies the validity of the received transaction request information (verifies the validity of the user and whether the user corresponds to the transaction information body), stores the legal transaction request into the local buffer submodule, marks the legal transaction request as unused, and directly discards the illegal transaction information. 10.3 If the "no change" information is received from the consensus group control submodule of the consensus entity G, step 10.7 is entered. 10.4 If the history state knotting module or the algorithm control module from the consensus main body G receives the consensus change information, updating the current consensus algorithm according to the consensus group member list and the consensus algorithm, and performing consensus on the block header information in the consensus change information to generate an generated block of the current consensus algorithm. 10.5 A block generation sub-module of the consensus subject G transfers the generated block to a block confirmation sub-module of the consensus subject G. 10.6 After receiving the created block, the block confirmation sub-module of the consensus entity G performs a rollback operation on all blocks that have been generated but not confirmed before, and goes to step 10.14. 10.7. ) The block generating sub-module of the consensus entity G obtains transaction data marked as unused from the local buffering sub-module of the consensus entity G, which marks these transaction data as to be validated. 10.8 The block generation submodule of the consensus subject G performs consensus with other consensus subjects of the current consensus group to which the consensus subject G belongs according to a specified consensus algorithm, and the transaction information is packed to generate a block. 10.9 A block generation sub-module of the consensus subject G transfers the generated block to a block confirmation sub-module of the consensus subject G. 10.10 Block confirmation sub-module of the consensus body G performs block confirmation according to the current consensus algorithm for all generated but not confirmed blocks. If the operation is the confirmation operation, turning to 10.11; if the operation is the rollback operation, the operation is switched to 10.14; if no operation is needed or the confirmation/rollback operation is temporarily unavailable, the current round consensus is completed, and the process goes to step 2). 10.11 The block confirmation submodule of the consensus subject G stores the corresponding block into the corresponding block graphic chain organization structure according to the assigned consensus algorithm according to the consensus algorithm used by the current consensus group of the consensus subject G. 10.12 The block generation sub-module of the consensus entity G transfers the transaction information number contained in the identified block to the local cache sub-module of the consensus entity G. 10.13 The local buffer submodule of the consensus entity G receives the transaction information number from the block generation submodule of the consensus entity G and deletes the transaction information of the corresponding number. Completing the current round consensus, and turning to step 2). 10.14 The block confirmation submodule of the consensus body G discards the corresponding block and all the blocks subsequent thereto, and transfers the transaction information numbers contained in the blocks to the local cache submodule. 10.15 After receiving the transaction information number from the block generation sub-module of the consensus subject G, the local buffer sub-module of the consensus subject G completes the current round consensus by turning to step 2) with the transaction information flag position corresponding to the transaction information number as unused.
In summary, the chain network segmentation and recombination method for the large-scale internet of things scene in the embodiment has the following advantages: 1. the special node network detection of the invention supports that under the condition that a large number of terminals of the Internet of things are offline or network conditions are bad, and under the condition that the original consensus algorithm is continued to possibly cause that a system cannot normally generate a block in a consensus mode, the residual online nodes can form a new consensus group, so that corresponding and collected data are ensured to generate a sub-chain, and the reliability of the system is improved. 2. Aiming at different tasks, the invention can generate the possibility of only locally achieving consensus (for example, when an unmanned automobile passes through an intersection, only a consensus of a sequence of travel is achieved with vehicles and pedestrians near the intersection, and no position information of vehicles in the whole market is needed). 3. The invention carries out transaction processing simultaneously by different consensus groups to generate blocks in parallel, thereby improving the transaction processing capability of the system. 4. Different consensus algorithms have different advantages and disadvantages, such as the chain type block chain system represented by the PoW algorithm consumes a great amount of calculation power and has low block output rate, the DAG pattern type block chain algorithm is not suitable for the deployment condition of large-scale consensus nodes due to high communication overhead, and the method supports autonomous selection of the consensus algorithm when the consensus group is generated, so that the consensus group can select a more suitable consensus algorithm according to the actual condition. 5. When the consensus group has completed the task, the invention supports merging the consensus group, attaches the generated sub-block structure to the main block chain organization structure, ensures that the generated sub-block chain organization structure data is not tamperable, and supports tracing.
In addition, the embodiment also provides a chain network segmentation and recombination system facing the large-scale internet of things scene, which comprises a microprocessor and a memory which are connected with each other, wherein the microprocessor is programmed or configured to execute the steps of the chain network segmentation and recombination method facing the large-scale internet of things scene.
In addition, the embodiment also provides a computer readable storage medium, and a computer program programmed or configured to execute the chain network segmentation and recombination method facing the large-scale internet of things scene is stored in the computer readable storage medium.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein. The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above examples, and all technical solutions belonging to the concept of the present invention belong to the protection scope of the present invention. It should be noted that modifications and adaptations to the present invention may occur to one skilled in the art without departing from the principles of the present invention and are intended to be within the scope of the present invention.

Claims (10)

1. A chain network segmentation and recombination method for a large-scale Internet of things scene is characterized by comprising the following steps:
1) The consensus main body communicates with other consensus main bodies in the Internet of things to generate an initial consensus group;
2) The consensus main body monitors whether a guide reorganization instruction or a guide segmentation instruction is received, and if the guide reorganization instruction is received, the step 3) is skipped; if the guide segmentation instruction is received, jumping to the step 4); otherwise, jumping to the step 5);
3) Determining that all the consensus subjects in the block chain consensus system are guidance recombination instructions, and recombining the consensus subjects related to the guidance recombination instructions into a new consensus group by performing recombination operation on the consensus subjects related to the guidance recombination instructions; jump to step 8);
4) Determining an instruction for controlling a consensus group as a guide segmentation instruction by all consensus subjects in the block chain consensus system, and segmenting the consensus group into a plurality of sub-consensus groups based on the guide segmentation instruction by performing segmentation operation on the current consensus group; jump to step 8);
5) The consensus main body carries out network detection on the current consensus group members, and if the network needs to carry out segmentation operation, the step 6) is carried out in a jumping way; if the network needs to carry out the reorganization operation, the step 7) is carried out in a jumping way; otherwise, jumping to execute the step 8);
6) Determining that all consensus main bodies in the block chain consensus system determine a command for controlling a consensus group as a passive recombination command, and recombining each sub-consensus group obtained by segmentation into a consensus group by carrying out recombination operation; jump to step 8);
7) Determining that all consensus subjects in the block chain consensus system determine a command for controlling a consensus group as a passive segmentation command, and carrying out segmentation operation on the current consensus group to segment the consensus group into a plurality of sub-consensus groups; jump to step 8);
8) All consensus subjects in the block chain consensus system tie a knot to the history state in parallel;
9) A consensus main body in the block chain consensus system respectively determines a consensus algorithm for a current consensus group to which the block chain consensus main body belongs;
10 All consensus bodies in the block chain consensus system perform consensus in parallel, the round of consensus is completed, and step 2) is performed in a jumping mode.
2. The method for splitting and reorganizing a chain network for a scene of a large-scale internet of things according to claim 1, wherein when reorganizing a consensus subject related to a guided reorganization instruction in step 3), the step of reorganizing any consensus subject G in a blockchain consensus system includes:
3.1 Detecting whether the recombined consensus group member list in the guide recombination instruction is consistent with the last consensus group member list in the history consensus group information, and if so, jumping to the step 3.2); if not, jumping to the step 5);
3.2 Detecting whether the list of all sub-consensus groups before recombination in the guide recombination instruction contains the current consensus group or not, and if so, jumping to the step 3.3); if not, jumping to the step 5);
3.3 Broadcasting a guide reorganization instruction to all reorganized consensus group members;
3.4 All reorganized consensus group members receive a guide reorganization instruction;
3.5 All the reorganized consensus group members update the current consensus group information into the last consensus group information acquired from the history consensus group information;
3.6 All the reorganized consensus group members determine that the command of the consensus group control is a guide reorganization command, and the step 8) is performed in a jumping manner.
3. The method for splitting and reorganizing a chain network for a scene of a large-scale internet of things according to claim 1, wherein the step of performing the splitting operation on any consensus entity G in the blockchain consensus system in the step 4) when the splitting instruction is directed to perform the splitting operation on the current consensus group includes:
4.1 Detecting whether the list of the pre-segmentation consensus group members in the guide segmentation instruction is consistent with the current consensus group member list, if so, jumping to the step 4.2); if not, jumping to the step 5);
4.2 Broadcasting a guide segmentation instruction to all current consensus group members;
4.3 All current consensus group members receive the guide segmentation instruction;
4.4 All current consensus group members store the current consensus group information into the historical consensus group information;
4.5 All current consensus group members store the sub-consensus group member list containing the affiliated consensus main body in all sub-consensus group member lists after being segmented in the guide segmentation instruction as a member list of the current consensus group information, the consensus round n of the current consensus group information is set as 0, and the grouping mark is set as an active grouping mark;
4.6 All current consensus members determine the instruction of the consensus control as a pilot split instruction, step 8) is performed in a jump.
4. The method for splitting and reorganizing a chain network for a scene of a large-scale internet of things according to claim 1, wherein when reorganizing each sub-consensus group obtained by splitting in step 6), the step of reorganizing any consensus body G in the blockchain consensus system includes:
6.1 The consensus body G integrates all received reply messages of recombination detection into recombination information, wherein the recombination information comprises a recombination information mark, a current consensus body identification number, a consensus round n, a recombined consensus group member list and all received recombination detection reply message sets, and the recombination information is broadcast to all consensus group members in the last consensus group member list;
6.2 After receiving the reorganization information sent by other nodes, the consensus body G checks whether the reorganization information is valid, if so, the reorganization information is forwarded to all other members in the last consensus group member list, and the reorganization information sent by each node is forwarded once in the nth round;
6.3 The consensus subject G updates the current consensus group information into the last consensus group information extracted from the history consensus group information;
6.4 The consensus main body G combines the consensus group member list in the reply of all received recombination detection information into all sub-consensus group member lists before recombination, takes the last consensus group member list as a recombination consensus group member list, and combines the last consensus group member list with a recombination zone bit to generate a passive recombination instruction, wherein the passive recombination instruction comprises a passive recombination mark, all sub-consensus group member lists before recombination and the recombination consensus group member list after recombination;
6.5 The consensus subject G determines that the command of the consensus group control is a passive reorganization command, and jumps to execute the step 8).
5. The method for splitting and reorganizing a chain network for a scene of a large-scale internet of things according to claim 1, wherein the step of performing the splitting operation on any consensus entity G in the blockchain consensus system when performing the splitting operation on the current consensus group in step 7) includes:
7.1 The received replying broadcast detection information and the replied node list are counted as a list to obtain a preliminary consensus group member list, the preliminary consensus group member list contains reply information signed by all members on the list, the preliminary segmentation information is broadcast to all members of the consensus group member list, and the preliminary segmentation information comprises a preliminary segmentation information mark, an identification number of a consensus subject G, a consensus round, the consensus group member list, the preliminary consensus group member list and signature reply information of all members;
7.2 After the first time of receiving the preliminary segmentation information sent by other consensus group control submodules for the nth round, firstly detecting the validity of the preliminary segmentation information, and taking the union of the received preliminary consensus group member list and the preliminary consensus group member list stored locally as new preliminary consensus group member list information after the validity detection is passed, and generating new preliminary segmentation information and broadcasting the new preliminary segmentation information to all consensus group members; if the list information received by the nth round is a subset of the current preliminary consensus group member list, not forwarding the reply operation;
7.3 After a preset timeout t3, the list of the preliminary consensus group members is not updated any more; if the number of the final preliminary consensus group member list still does not meet the minimum member number required by the current consensus algorithm, jumping to the step 7.4); otherwise, judging that the consensus group is unchanged, and jumping to the step 10);
7.4 The consensus group control sub-module stores the current consensus group member list into the history consensus group member list, and the current consensus group member list becomes a new last consensus group member list after the current consensus group member list is stored;
7.5 Updating the current consensus group member list into a final preliminary consensus group member list, resetting the consensus round n to 0, and setting a grouping mark as a passive grouping mark;
7.6 After the update of the member lists of the consensus groups is completed, generating a passive segmentation instruction, wherein the passive segmentation instruction comprises a passive segmentation flag bit, a member list of the consensus groups before segmentation and a member list of all sub-consensus groups after segmentation, taking the current member list of the consensus groups as one sub-consensus group, taking all members which are not in the current member list of the last consensus group as another sub-consensus group, taking the two sub-consensus groups as member lists of all sub-consensus groups after segmentation, taking the member list of the last consensus group as member list of the consensus groups before segmentation, and combining the segmentation instruction by the segmentation flag bit;
7.7 The consensus subject G determines that the command for consensus group control is a passive partition command, and jumps to execute step 8).
6. The method for segmenting and reorganizing a chain network for a scene of a large-scale internet of things according to claim 1, wherein when all consensus subjects in the block chain consensus system tie a knot to a history state in parallel in step 8), the step of tying a knot to a history state by any consensus subject G in the block chain consensus system comprises:
8.1 The consensus subject G obtains the hash information of the newly determined block;
8.2 If the instruction of the consensus group control of the consensus subject G is a split instruction, the split instruction includes a guide split instruction and a passive split instruction, then the step 8.3 is skipped; if the consensus subject G receives a command of the consensus group control as a reorganization command, wherein the reorganization command comprises a guide reorganization command and a passive reorganization command, the step 8.5 is skipped;
8.3 The consensus subject G encapsulates all the obtained hash information to generate a first block header;
8.4 If the command for controlling the consensus group of the consensus main body G is a guide division command, wherein the guide division command comprises a consensus algorithm of all sub-consensus groups, a sub-consensus group member list comprising the consensus main body and a corresponding consensus algorithm are selected from the sub-consensus group member list after being divided in the guide division command, and the sub-consensus group member list and the corresponding consensus algorithm are combined with a first block head generated by encapsulation to generate information of the change of the consensus group, and the step 10 is skipped; if the command of the consensus main body G for performing the consensus group control is a passive segmentation command or a guide segmentation command without a specified consensus algorithm, selecting a sub-consensus group member list containing the consensus main body G from the sub-consensus group member lists segmented in the command, merging with a first block head generated by encapsulation and a corresponding division flag bit, and jumping to the step 9);
8.5 The consensus subject G obtains a hash set of the latest confirmed block information in the block graph chain organization structure generated by each consensus group from all consensus group members before recombination;
8.6 The consensus subject G encapsulates all the obtained hash sets to generate a second block header;
8.7 The consensus main body G merges the reorganization flag bit, the reorganized consensus member list in the received reorganization instruction and the second block header generated by encapsulation, and jumps to the step 9).
7. The method for segmenting and reorganizing a chain network for a scene of the large-scale internet of things according to claim 1, wherein when the consensus subjects in step 9) determine the consensus algorithm for the current consensus group to which the consensus subjects belong, the step of determining the consensus algorithm by any consensus subject G in the blockchain consensus system includes:
9.1 The method comprises the steps that) a consensus subject G receives historical state knotting information from the consensus subject G, wherein the historical state knotting information comprises a zone bit, a consensus group member list and block head information; if the flag bit is a segmentation flag, jumping to the step 9.2); if the flag bit is a recombinant flag, jumping to the step 9.8);
9.2 The consensus subject G sends consensus algorithm solicitation information which comprises a consensus algorithm solicitation information mark, a consensus subject identification number, a consensus group member list and a supported consensus algorithm list, and broadcasts the consensus algorithm supported by the consensus subject G to which the consensus algorithm belongs to all current consensus group members to wait for solicitation information from other nodes;
9.3 After receiving the effective consensus algorithm solicitation information from other node consensus principals, the consensus principal G selects the intersection of the consensus algorithm list and signs to generate the reply information, wherein the reply information comprises a consensus algorithm solicitation reply sign, a consensus principal identification number, a consensus group member list and a supported consensus algorithm integration list, replies the reply information to the sent consensus principal, forwards the received consensus algorithm solicitation information to other members of the current consensus group, and records the replied member list; if at preset timeout time t 4 The operation is not performed when the consensus algorithm list of the same consensus main body is received again;
9.4 A) consensus subject G is in a preset timeout time t 5 In the method, the received all consensus algorithm sets are collected to form an intersection, and one consensus algorithm is selected according to the priority;
9.5 The consensus main body G broadcasts a consensus algorithm selection message, wherein the consensus algorithm selection message comprises a consensus algorithm selection information mark, a consensus main body identification number, a selected consensus algorithm, all signed reply messages received by the selected consensus algorithm and a sequence number m, wherein the sequence number m is initially 0, and if the selected consensus algorithm in the effective broadcast messages of other nodes is not consistent with the received consensus algorithm selection message of the broadcast of the node, the broadcast information is regenerated and the sequence number m in the selected consensus algorithm selection message is added with a rebroadcast;
9.6 After receiving the consensus algorithm selection information from the consensus main body of other nodes, recording the consensus algorithm selection information of the sequence number m of the received node, if the effective broadcast information of the received other nodes is inconsistent with the effective broadcast information of the received node, regenerating the broadcast information, updating the selected consensus algorithm, adding one to the sequence number m, and rebroadcasting; if the two types of the data are consistent, not performing operation; if at preset timeout time t 5 The consensus algorithm list with the same or smaller serial number of the same consensus main body is received again, and then the operation is not performed;
9.7 Algorithm control module of consensus subject G at preset timeout time t 5 After that, the selected co-ordinates are not updated any moreThe identification algorithm, the selected identification algorithm and the identification member list and the block head in the information of the history state knot from the identification main body G are used for generating the information of the change of the identification group, and the step 10 is skipped;
9.8 The consensus subject G takes out the last consensus algorithm from the history consensus algorithm, generates the information of the change of the consensus group by the last consensus algorithm, the consensus member list and the block head from the history state knotting information, and jumps to the step 10).
8. The method for segmenting and reorganizing a chain network for a scene of a large-scale internet of things according to claim 1, wherein when all consensus subjects in the block chain consensus system in step 10) perform consensus in parallel, the step of performing consensus on any consensus subject G in the block chain consensus system includes:
10.1 The consensus entity G continuously monitors whether transaction request information from a user exists, and if the transaction request information from the user exists, the step is skipped to the next step;
10.2 The consensus body G verifies the validity of the received transaction request information, including verifying the validity of the user and whether the user corresponds to the transaction information body, storing the legal transaction request locally and marking the legal transaction request as unused, and directly discarding the illegal transaction information;
10.3 Judging whether the consensus group is changed or not by the consensus subject G), and if the consensus group is not changed, jumping to the step 10.7); otherwise, if the consensus group changes, jumping to the next step;
10.4 The consensus subject G updates the current consensus algorithm according to the consensus group member list and the consensus algorithm, and performs consensus on the block header information in the consensus change information to generate an generated block of the current consensus algorithm;
10.5 The consensus subject G performs block confirmation on the generated generation block;
10.6 After confirming the created block, the consensus subject G performs rollback operation on all blocks that have been generated but not confirmed before, and jumps to step 10.14);
10.7 The consensus subject G obtains the unused transaction data stored locally and marks it as to be confirmed;
10.8 A block generation submodule of the consensus subject G performs consensus with other consensus subjects of the current consensus group to which the consensus subject G belongs according to a specified consensus algorithm, and transaction information is packed to generate a block;
10.9 The consensus subject G obtains the generated but unacknowledged block;
10.10 The consensus subject G performs block confirmation on all generated but not confirmed blocks according to the current consensus algorithm, and if the block confirmation result is confirmation operation, the step is skipped to step 10.11); if the operation is a rollback operation, jumping to the step 10.14); if no operation is needed or the confirmation/rollback operation cannot be confirmed temporarily, completing the current round consensus, and jumping to the step 2);
10.11 The consensus subject G stores the corresponding blocks into the corresponding block graph chain organization structures according to the assigned consensus algorithm according to the consensus algorithm used by the current consensus group;
10.12 The consensus subject G obtains the transaction information number contained in the confirmed block;
10.13 The consensus subject G deletes the transaction information corresponding to the acquired transaction information number, completes the current round consensus, and jumps to the step 2);
10.14 The consensus entity G discards the corresponding blocks and all the blocks subsequent thereto and determines the transaction information numbers contained in the discarded blocks;
10.15 The consensus body G completes the current round consensus by using the transaction information flag positions corresponding to the transaction information numbers included in the discarded blocks as unused, and jumps to step 2).
9. The large-scale Internet of things scene-oriented chain network segmentation and recombination system comprises a microprocessor and a memory which are connected with each other, and is characterized in that the microprocessor is programmed or configured to execute the steps of the large-scale Internet of things scene-oriented chain network segmentation and recombination method according to any one of claims 1 to 8.
10. A computer readable storage medium having stored therein a computer program programmed or configured to perform the large-scale internet of things scenario oriented chain-net segmentation reorganization method of any one of claims 1-8.
CN202111193816.7A 2021-10-13 2021-10-13 Chain network segmentation and recombination method and system for large-scale Internet of things scene Active CN113938494B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111193816.7A CN113938494B (en) 2021-10-13 2021-10-13 Chain network segmentation and recombination method and system for large-scale Internet of things scene

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111193816.7A CN113938494B (en) 2021-10-13 2021-10-13 Chain network segmentation and recombination method and system for large-scale Internet of things scene

Publications (2)

Publication Number Publication Date
CN113938494A CN113938494A (en) 2022-01-14
CN113938494B true CN113938494B (en) 2023-09-12

Family

ID=79278721

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111193816.7A Active CN113938494B (en) 2021-10-13 2021-10-13 Chain network segmentation and recombination method and system for large-scale Internet of things scene

Country Status (1)

Country Link
CN (1) CN113938494B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110768798A (en) * 2019-10-24 2020-02-07 中国人民解放军国防科技大学 Lightweight block chain consensus method, system and medium for Internet of things
CN111106942A (en) * 2019-12-13 2020-05-05 南京邮电大学 Block chain credit mechanism based on AP-PBFT algorithm

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110768798A (en) * 2019-10-24 2020-02-07 中国人民解放军国防科技大学 Lightweight block chain consensus method, system and medium for Internet of things
CN111106942A (en) * 2019-12-13 2020-05-05 南京邮电大学 Block chain credit mechanism based on AP-PBFT algorithm

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于分组的区块链共识算法;张思贤;文捷;;计算机应用与软件(第03期);全文 *

Also Published As

Publication number Publication date
CN113938494A (en) 2022-01-14

Similar Documents

Publication Publication Date Title
US20190289068A1 (en) Method, apparatus and system for realizing communication between blockchains
CN110442652B (en) Cross-chain data processing method and device based on block chain
CN111539726B (en) Block chain consensus system and method
CN111752246B (en) Unmanned aerial vehicle bee colony cooperative work platform based on block chain and artificial intelligence drive
CN113347164B (en) Block chain-based distributed consensus system, method, device and storage medium
CN111930598B (en) Information processing method based on block chain and big data analysis and big data platform
CN112291160B (en) BUM message suppression method, device and medium
CN113938494B (en) Chain network segmentation and recombination method and system for large-scale Internet of things scene
CN110933162B (en) Block chain virtual subnet subsection storage method
CN109195160B (en) Tamper-proof storage system of network equipment resource detection information and control method thereof
CN115037472B (en) Transaction processing method and system based on double-layer DAG consensus mechanism and service equipment
CN111865983A (en) Block chain-based data security tracing method
US10104202B2 (en) Collectively loading programs in a multiple program multiple data environment
CN113328954B (en) Method for blocking and limiting transmission of service data packet by source terminal
CN115865705A (en) Multi-party federal learning system, method, equipment and medium based on supervision mechanism
CN114240651A (en) Cross-chain transaction sending method, device, equipment and storage medium
CN113111074A (en) Block chain-based interactive data monitoring method and device
CN117544711B (en) Communication method, device, equipment and medium between multiple processors
CN106487694A (en) A kind of data flow processing method and device
CN110933627A (en) Service processing method, device, equipment and storage medium
CN106817231A (en) A kind of Virtual Cluster rollback method and system based on multicasting technology
CN116633699B (en) Product anti-counterfeiting traceability information trusted processing method and system based on block chain
CN116957110B (en) Trusted federation learning method and system based on federation chain
CN109687411B (en) Fixed value synchronous operation method and device for distributed element protection
CN111277504B (en) Method and system for inserting flow label in MPLS multilayer label stack

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