A communication method for a time-mixed queue sharding system based on blockchain
By adopting two-level leadership node structure and time queue sharding technology in blockchain, the communication performance degradation and scalability problems in blockchain sharding technology are solved, and efficient data consistency and fast message delivery are achieved.
Patent Information
- Application Number
- CN202210207461.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-11
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-01-11
AI Technical Summary
When the number of nodes and shards increases, the system communication performance decreases. The scalability of shards is heavily dependent on the performance of the upper-level master nodes, and there are difficulties and consistency in data communication between different shards. Cross-detection puzzle.
Adopt a two-level leadership node structure. The strong leader node is responsible for collecting transactions and proposing new blocks. The weak leader node is responsible for receiving and forwarding messages. The node is sharded through the time queue to achieve local optimal time communication within the shard. Efficiency and make full use of bandwidth and CPU computing performance.
Improve the speed of messaging between nodes and the scalability of the system, ensure data consistency, and improve communication efficiency and effectiveness.
Smart Images

Figure CN114546687B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of blockchain, and in particular to a communication method and system for a time hybrid queue sharding system based on blockchain. Background Art
[0002] With the development of blockchain technology, a number of applications have been implemented in many scenarios such as finance, traceability, supply chain, evidence storage, and e-government. Related technologies such as distributed storage, smart contracts, encryption algorithms and other key technologies have made new progress. However, the performance and scalability of blockchain technology are still the key to limiting the large-scale application of blockchain technology. How to further improve the performance and scalability of blockchain systems has become a technical problem that needs to be solved urgently.
[0003] Sharding technology was first proposed in the traditional database field and is mainly used for the optimization of large commercial databases. The concept is to divide the data in a large database into many data shards, and then store these data shards in different servers to reduce the data access pressure of each server, thereby improving the performance of the entire database system. In short, divide and conquer is the core idea of sharding technology. The idea of applying sharding technology to the blockchain network is to divide the blockchain network with many nodes into several sub-networks, each of which contains a part of the nodes, that is, a "shard". At the same time, transactions in the network will also be divided into different "shards" for processing, so that each node only needs to process a small part of the incoming transactions, and different nodes can process transactions in parallel, which can increase the concurrency of transaction processing and verification, thereby improving the throughput of the entire network. Sharding technology can be divided into three types according to different sharding mechanisms: network sharding, transaction sharding, and state sharding. Although sharding technology is one of the mainstream technologies currently used by blockchain to solve efficiency and scalability problems, its application has the following technical problems: Traditional sharding technology often adopts a single sharding mode such as network sharding, transaction sharding, and state sharding. There are often problems such as data communication difficulties between different shards and difficulty in cross-detection of data consistency during communication. Moreover, as the number of nodes and shards increases, the communication performance of the system decreases, and the scalability of sharding is seriously dependent on the performance of the upper-level master node. Summary of the invention
[0004] The purpose of the present invention is to provide a communication method and system for a time-mixed queue sharding system based on blockchain. The sharding system uses a two-level leader node structure, and the strong leader node shards the nodes according to the communication time queue, so as to achieve the local optimal time communication efficiency within the shard and improve the speed of message transmission between nodes. The strong leader node is responsible for collecting transactions and proposing new blocks, and the weak leader node is responsible for receiving messages from the strong leader node and forwarding them to the shard. While ensuring data consistency, the bandwidth and CPU computing performance of the strong leader node and the weak leader node are fully utilized, thereby improving the scalability of the system.
[0005] On the one hand, the present invention provides a communication method for a time-mixed queue sharding system based on blockchain, comprising:
[0006] Step 1: Broadcast connection detection request, including: each node N i Broadcast the connection detection request Detect to all other nodes in the time hybrid queue sharding system i , and record node N in the database i The Unix timestamp when the message was sent. (i,j) ; wherein the connection detection request Detect i It is expressed as:
[0007] Detect i ={Detect i ,Sig i (v i ,h i ,rand i )};
[0008] Where Detect represents the message type of the connection detection request, i represents the node number, and v i Indicates the connection detection request Detect i Contains nodes N i The view, h i Represents node N i The block height, rand i Represents node N i The random number generated;
[0009] Step 2: Receive the connection detection request and verify the signature information: Node N j Received from node N i After sending the connection detection request message, use node N i The public key PK i Verify whether the signature information of the message is correct and determine the view v contained in the message i and height h iDoes it satisfy v i =v j ,h i =h j , determine whether a connection detection request is received Detect i Whether the view and block height contained in are consistent with themselves, where node N j , j≠i, represents the nodes participating in the consensus;
[0010] Step 3: Reply the connection detection response, including: If the verification is successful, node N j To node N i Reply connection detection response Response j , the reply connection detection response Response j The content is as follows:
[0011] Response j ={Response,Sig j (v j ,h j ,rand i ')};
[0012] Among them, Response indicates the reply connection detection message type, j indicates the node sequence number, and rand i ' represents node N j Received from N i Random number; v j Represents Response j Node N included in the message j The view in which it is located; h j Represents node N j The block height;
[0013] Step 4, recording timestamp information and verifying the validity of the reply connection detection response, including: Node N i Received from node N j After replying the response message, record the Unix timestamp of when the message was received. (j,i) , and perform a validity determination on the response message, the validity determination includes Response j View V in the message j , block height h j , random number rand i 'With node N i The random number generated is rand i Is it consistent?
[0014] Step 5, recording the communication time, including: after determining the validity of the reply connection detection response, based on the communication of the response message, calculating the node N i To other nodes N j The round trip time d (i,j) =t (j,i) -t (i,j) , and save the round-trip communication time in the communication time matrix. All nodes N i The communication time matrix CTM between this node and all other nodes is stored in i ; The communication time matrix CTM i Contains the current node N i View of v i and block height h i , random number rand i , and node N i With other n-1 nodes <N 1 ,…,N n-1 ,N n >communication time d (i,j) =t (j,i) -t (i,j) , where t (i,j) Represents node N i To node N j Unix timestamp of sending the message, t (j,i) Represents node N i Received from node N j Unix timestamp of the response message.
[0015] Preferably, the timestamp of the information sent by the node to itself is equal to the timestamp of the information received, and the communication time between the node and itself is negligible.
[0016] Preferably, the blockchain-based time hybrid queue sharding system includes:
[0017] A blockchain having a plurality of blocks, wherein a block generated in the block generation cycle includes a strong leader node and a plurality of weak leader nodes;
[0018] A preliminary sharding module, used for preliminarily dividing the multiple strong leader nodes and the multiple weak leader nodes into multiple groups of different pre-shards, wherein the pre-shards are obtained by dividing all nodes of the blockchain except the strong leader node after specifying the strong leader node, each group of the pre-shards includes multiple leaf nodes and one of the weak leader nodes, the nodes included in the pre-shards of different groups have no intersection, and the number of nodes in each group of pre-shards is at least greater than or equal to the ratio of the number of all nodes to the number of groups;
[0019] a calculation module, configured to calculate an allocation time for dividing all nodes into a predetermined number of pre-shards and a sum of communication times between the plurality of pre-shards, wherein for the predetermined number of pre-shards, the allocation time is less than a first threshold value, and the sum of communication times of all pre-shards is the smallest; and
[0020] The time mixed queue slicing module is used to determine whether the sum of the communication time between multiple pre-slices meets the minimum. If so, the current pre-slice is the final time mixed queue slicing. Otherwise, all nodes are re-divided into a predetermined number of new pre-slices within the time of the first threshold and re-determined whether the sum of the communication time between multiple new pre-slices meets the minimum.
[0021] Preferably, it also includes a data consensus module for performing data consensus between the pre-shards.
[0022] Preferably, the strong leader node communicates directly with the weak leader node to achieve interaction with different pre-shards. The strong leader node collects and verifies partial threshold signatures of messages from the weak leader node, and collects intra-shard transaction information sent by the weak leader node to synthesize blocks.
[0023] Preferably, the weak leader node within the pre-shard communicates with the leaf nodes, collects transactions of the leaf nodes, and forwards messages sent by the strong leader node to the leaf nodes.
[0024] The second aspect of the present invention further provides a communication system for a blockchain-based time hybrid queue sharding system that implements the communication method of the first aspect, comprising:
[0025] Broadcast connection detection request module, used for each node N i Broadcast the connection detection request Detect to all other nodes in the time hybrid queue sharding system i , and record node N in the database i The Unix timestamp when the message was sent. (i,j) ; wherein the connection detection request Detect i It is expressed as:
[0026] Detect i ={Detect i ,Sig i (v i ,h i ,rand i )};
[0027] Where Detect represents the message type of the connection detection request, i represents the node number, and v iIndicates the connection detection request Detect i Contains nodes N i The view, h i Represents node N i The block height, rand i Represents node N i The random number generated;
[0028] Receive connection detection request and verify signature information module for node N j Received from node N i After sending the connection detection request message, use node N i The public key PK i Verify whether the signature information of the message is correct and determine the view v contained in the message i and height h i Does it satisfy v i =v j ,h i =h j , determine whether a connection detection request is received Detect i Whether the view and block height contained in are consistent with themselves, where node N j , j≠i, represents the nodes participating in the consensus;
[0029] Reply connection detection response module, if the verification is successful, node N j To node N i Reply connection detection response Response j , the reply connection detection response Response j The content is as follows:
[0030] Response j ={Response,Sig j (v j ,h j ,rand i ')};
[0031] Among them, Response indicates the reply connection detection message type, j indicates the node sequence number, and rand i ' represents node N j Received from N i Random number; v j Represents Response j Node N included in the message j The view in which it is located; h j Represents node N j The block height;
[0032] A module for recording timestamp information and verifying the validity of the reply connection detection response is used for node N i Received from node N j After replying the response message, record the Unix timestamp of when the message was received. (j,i) , and perform a validity determination on the response message, the validity determination includes Response j View V in the message j , block height h j , random number rand i 'With node N i The random number generated is rand i Is it consistent?
[0033] The communication time recording module is used to calculate the node N based on the communication of the response message after determining the validity of the response through the reply connection detection response. i To other nodes N j The round trip time d (i,j) =t (j,i) -t (i,j) , and save the round-trip communication time in the communication time matrix. All nodes N i The communication time matrix CTM between this node and all other nodes is stored in i ; The communication time matrix CTM i Contains the current node N i View of v i and block height h i , random number rand i , and node N i With other n-1 nodes <N 1 ,…,N n-1 ,N n >communication time d (i,j) =t (j,i) -t (i,j) , where t (i,j) Represents node N i To node N j Unix timestamp of sending the message, t (j,i) Represents node N i Received from node N j Unix timestamp of the response message.
[0034] A third aspect of the present invention provides an electronic device, comprising a processor and a communication circuit, wherein the processor is connected to the communication circuit, and the processor is used to execute instructions to implement the communication method as described in the first aspect.
[0035] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, and the plurality of instructions can be read by a processor to execute the communication method as described in the first aspect.
[0036] The communication method, system and electronic device for the blockchain-based time hybrid queue sharding system provided by the present invention have the following beneficial effects:
[0037] In this communication method, the strong leader node is responsible for collecting transactions and proposing new blocks, and the weak leader node is responsible for receiving messages from the strong leader node and forwarding them to the shards. While ensuring data consistency, the bandwidth and CPU computing performance of the strong leader node and the weak leader node are fully utilized, thereby improving the communication efficiency and effect of the communication system. Through the two-level leader node structure, the strong leader node shards the nodes according to the communication time queue, achieving the local optimal time communication efficiency within the shard and improving the speed of message transmission between nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a structural principle diagram of a time hybrid queue sharding system based on blockchain according to a preferred embodiment of the present invention;
[0039] Figure 2 It is a flow chart of a communication method of a time hybrid queue sharding system based on blockchain according to a preferred embodiment of the present invention;
[0040] Figure 3 FIG. 1 is a diagram showing the structure of an electronic device according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0041] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0042] Embodiment 1
[0043] See also Figure 1 On the one hand, the present invention provides a time hybrid queue sharding system based on blockchain, which performs sharding based on the communication time between nodes, completes the division of shards through a hybrid time queue, and realizes the local optimal communication time, including:
[0044] A blockchain having a plurality of blocks, wherein a block generated in the block generation cycle includes a strong leader node and a plurality of weak leader nodes;
[0045] A preliminary sharding module, used for preliminarily dividing the multiple strong leader nodes and the multiple weak leader nodes into multiple groups of different pre-shards, wherein the pre-shards are obtained by dividing all nodes of the blockchain except the strong leader node after specifying the strong leader node, each group of the pre-shards includes multiple leaf nodes and one of the weak leader nodes, the nodes included in the pre-shards of different groups have no intersection, and the number of nodes in each group of pre-shards is at least greater than or equal to the ratio of the number of all nodes to the number of groups;
[0046] a calculation module, configured to calculate an allocation time for dividing all nodes into a predetermined number of pre-shards and a sum of communication times between the plurality of pre-shards, wherein for the predetermined number of pre-shards, the allocation time is less than a first threshold value, and the sum of communication times of all pre-shards is the smallest; and
[0047] The time mixed queue slicing module is used to determine whether the sum of the communication time between multiple pre-slices meets the minimum. If so, the current pre-slice is the final time mixed queue slicing. Otherwise, all nodes are re-divided into a predetermined number of new pre-slices within the time of the first threshold and re-determined whether the sum of the communication time between multiple new pre-slices meets the minimum.
[0048] In this embodiment, all n nodes contained in a block of the blockchain are divided into k groups of different shards, each of the k groups of different shards contains a number of leaf nodes and a weak leader node, the nodes contained in the shards of different groups have no intersection, and each group of shards has at least m (m≥└n / k┘) nodes, which are divided and allocated within a limited time and the total communication time of all shards is minimized.
[0049] See also Figure 1 , where N 1 ,N 2 ,N 3 is a strong leader node, N 4 ,N 5 is a weak leader node, N 6 and N 7 is the leaf node of shard-1, N 8 、N 9 、N 10 It is the leaf node of shard-2.
[0050] As a preferred implementation, the application of the sharding system requires an additional data consensus module to better achieve data consensus between shards, and divide the nodes participating in the consensus into leader nodes and leaf nodes, and the leader nodes include strong leader nodes and weak leader nodes. The same block generation cycle in the blockchain contains only one strong leader node and several weak leader nodes, and each group of shards has only one weak leader node and several leaf nodes.
[0051] As a preferred implementation, the strong leader node communicates directly with the weak leader node to achieve interaction with different shards. The strong leader node also needs to collect and verify some threshold signatures from the weak leader node message, and collect the transaction information within the shard sent by the weak leader node to synthesize the block. The weak leader node communicates with the leaf node within the shard, collects the transactions of the leaf node within the shard, and forwards the messages sent by the strong leader node to the leaf node.
[0052] Embodiment 2
[0053] See also Figure 2 , a communication method for a blockchain-based time-mixed queue sharding system, comprising:
[0054] Step 1: Broadcast connection detection request, including: each node N i Broadcast the connection detection request Detect to all other nodes in the time hybrid queue sharding system i , and record node N in the database i The Unix timestamp when the message was sent. (i,j) ; wherein the connection detection request Detect i It is expressed as:
[0055] Detect i ={Detect i ,Sig i (v i ,h i ,rand i )};
[0056] Where Detect represents the message type of the connection detection request, i represents the node number, and v i Indicates the connection detection request Detect i Contains nodes N i The view, h i Represents node N i The block height, rand i Represents node N i The random number generated;
[0057] Step 2: Receive the connection detection request and verify the signature information: Node N j Received from node N i After sending the connection detection request message, use node N i The public key PK i Verify whether the signature information of the message is correct and determine the view v contained in the message i and height h i Does it satisfy v i =v j ,h i =h j , determine whether a connection detection request is received Detect i Whether the view and block height contained in are consistent with themselves, where node N j , j≠i, represents the nodes participating in the consensus;
[0058] Step 3: Reply the connection detection response, including: If the verification is successful, node N j To node N i Reply connection detection response Response j , the reply connection detection response Response j The content is as follows:
[0059] Response j ={Response,Sig j (v j ,h j ,rand i ')};
[0060] Among them, Response indicates the reply connection detection message type, j indicates the node sequence number, and rand i ' represents node N j Received from N i Random number; v j Represents Response j Node N included in the message j The view in which it is located; h j Represents node N j The block height;
[0061] Step 4, recording timestamp information and verifying the validity of the reply connection detection response, including: Node N i Received from node N j After replying the response message, record the Unix timestamp of when the message was received. (j,i) , and perform a validity determination on the response message, the validity determination includes Response j View V in the messagej , block height h j , random number rand i 'With node N i The random number generated is rand i Is it consistent?
[0062] Step 5, recording the communication time, including: after determining the validity of the reply connection detection response, based on the communication of the response message, calculating the node N i To other nodes N j The round trip time d (i,j) =t (j,i) -t (i,j) , and save the round-trip communication time in the communication time matrix. All nodes N i The communication time matrix CTM between this node and all other nodes is stored in i ; The communication time matrix CTM i Contains the current node N i View of v i and block height h i , random number rand i , and node N i With other n-1 nodes <N 1 ,…,N n-1 ,N n >communication time d (i,j) =t (j,i) -t (i,j) , where t (i,j) Represents node N i To node N j Unix timestamp of sending the message, t (j,i) Represents node N i Received from node N j Unix timestamp of the response message.
[0063] As a preferred implementation, the timestamp of the information sent by the node to itself is equal to the timestamp of the information received, and the communication time between the node and itself is negligible.
[0064] Embodiment 3
[0065] A communication system for a blockchain-based time-mixed queue sharding system, including:
[0066] Broadcast connection detection request module, used for each node N i Broadcast the connection detection request Detect to all other nodes in the time hybrid queue sharding system i , and record node N in the database i The Unix timestamp when the message was sent. (i,j); wherein the connection detection request Detect i It is expressed as:
[0067] Detect i ={Detect i ,Sig i (v i ,h i ,rand i )};
[0068] Where Detect represents the message type of the connection detection request, i represents the node number, and v i Indicates the connection detection request Detect i Contains nodes N i The view, h i Represents node N i The block height, rand i Represents node N i The random number generated;
[0069] Receive connection detection request and verify signature information module for node N j Received from node N i After sending the connection detection request message, use node N i The public key PK i Verify whether the signature information of the message is correct and determine the view v contained in the message i and height h i Does it satisfy v i =v j ,h i =h j , determine whether a connection detection request is received Detect i Whether the view and block height contained in are consistent with themselves, where node N j , j≠i, represents the nodes participating in the consensus;
[0070] Reply connection detection response module, if the verification is successful, node N j To node N i Reply connection detection response Response j , the reply connection detection response Response j The content is as follows:
[0071] Response j ={Response,Sig j (v j ,h j ,rand i ')};
[0072] Among them, Response indicates the reply connection detection message type, j indicates the node sequence number, and rand i ' represents node N j Received from N i Random number; v j Represents Response j Node N included in the message j The view in which it is located; h j Represents node N j The block height;
[0073] A module for recording timestamp information and verifying the validity of the reply connection detection response is used for node N i Received from node N j After replying the response message, record the Unix timestamp of when the message was received. (j,i) , and perform a validity determination on the response message, the validity determination includes Response j View V in the message j , block height h j , random number rand i 'With node N i The random number generated is rand i Is it consistent?
[0074] The communication time recording module is used to calculate the node N based on the communication of the response message after determining the validity of the response through the reply connection detection response. i To other nodes N j The round trip time d (i,j) =t (j,i) -t (i,j) , and save the round-trip communication time in the communication time matrix. All nodes N i The communication time matrix CTM between this node and all other nodes is stored in i ; The communication time matrix CTM i Contains the current node N i View of v i and block height h i , random number rand i , and node N i With other n-1 nodes <N 1 ,…,N n-1 ,N n >communication time d (i,j) =t (j,i) -t (i,j) , where t (i,j) Represents node N i To node N jUnix timestamp of sending the message, t (j,i) Represents node N i Received from node N j Unix timestamp of the response message.
[0075] like Figure 3 As shown, this embodiment also provides an electronic device, including a processor 301 and a communication circuit 302 connected to the processor 301, wherein the processor 301 stores a plurality of instructions, which can be loaded and executed by the processor so that the processor 301 can execute the method as in the second embodiment.
[0076] This embodiment also provides a computer-readable storage medium storing a plurality of instructions, wherein the instructions are used to implement the method as in the second embodiment.
[0077] The communication method, system and electronic device provided in this embodiment have the following beneficial effects:
[0078] In this communication method, the strong leader node is responsible for collecting transactions and proposing new blocks, and the weak leader node is responsible for receiving messages from the strong leader node and forwarding them to the shards. While ensuring data consistency, the bandwidth and CPU computing performance of the strong leader node and the weak leader node are fully utilized, thereby improving the communication efficiency and effect of the communication system. Through the two-level leader node structure, the strong leader node shards the nodes according to the communication time queue, achieving the local optimal time communication efficiency within the shard and improving the speed of message transmission between nodes.
[0079] Although preferred embodiments of the present invention have been described, additional changes and modifications may be made to these embodiments by those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A communication method for a time-mixed queue sharding system based on blockchain, characterized in that: include: Step 1: Broadcast connection detection request, including: each node N i Broadcast the connection detection request Detect to all other nodes in the time hybrid queue sharding system i , and record node N in the database i The Unix timestamp when the message was sent. (i,j) ; wherein the connection detection request Detect i It is expressed as: Detect i ={Detect i ,Sig i (v i ,h i ,rand i )}; Where Detect represents the message type of the connection detection request, i represents the node number, and v i Indicates the connection detection request Detect i Contains nodes N i The view, h i Represents node N i The block height, rand i Represents node N i The random number generated; Step 2: Receive the connection detection request and verify the signature information: Node N j Received from node N i After sending the connection detection request message, use node N i The public key PK i Verify whether the signature information of the message is correct and determine the view v contained in the message i and height h i Does it satisfy v i =v j ,h i =h j , determine whether a connection detection request is received i Whether the view and block height contained in are consistent with themselves, where node N j , j≠i, represents the nodes participating in the consensus; Step 3: Reply the connection detection response, including: If the verification is successful, node N j To node N i Reply connection detection response Response j , the reply connection detection response Response j The content is as follows: Response j ={Response,Sig j (v j ,h j ,rand i ’)}; Among them, Response indicates the reply connection detection message type, j indicates the node sequence number, and rand i ' represents node N j Received from N i Random number; v j Represents Response j Node N included in the message j The view in which it is located; h j Represents node N j The block height; Step 4, recording timestamp information and verifying the validity of the reply connection detection response, including: Node N i Received from node N j After replying the response message, record the Unix timestamp of when the message was received. (j,i) , and perform a validity determination on the response message, the validity determination includes Response j View V in Message j , block height h j , random number rand i ’ With node N i The random number generated is rand i Is it consistent? Step 5, recording the communication time, including: after determining the validity of the reply connection detection response, based on the communication of the response message, calculating the node N i To other nodes N j The round trip time d (i,j) =t (j,i) -t (i,j) , and save the round-trip communication time in the communication time matrix. All nodes N i The communication time matrix CTM between this node and all other nodes is stored in i ; The communication time matrix CTM i Contains the current node N i View of v i and block height h i , random number rand i , and node N i With other n-1 nodes <N1,…,N n-1 ,N n >communication time d (i,j) =t (j,i) -t (i,j) , where t (i,j) Represents node N i To node N j Unix timestamp of sending the message, t (j,i) Represents node N i Received from node N j Unix timestamp of the response message.
2. The communication method according to claim 1, characterized in that: The timestamps of the information sent by the node to itself and received are equal, and the communication time between the node and itself is negligible.
3. The communication method according to claim 1, characterized in that: The blockchain-based time hybrid queue sharding system includes: A blockchain having a plurality of blocks, wherein a block generated in the block generation cycle includes a strong leader node and a plurality of weak leader nodes; A preliminary sharding module, used for preliminarily dividing the multiple strong leader nodes and the multiple weak leader nodes into multiple groups of different pre-shards, wherein the pre-shards are obtained by dividing all nodes of the blockchain except the strong leader node after specifying the strong leader node, each group of the pre-shards includes multiple leaf nodes and one of the weak leader nodes, the nodes included in the pre-shards of different groups have no intersection, and the number of nodes in each group of pre-shards is at least greater than or equal to the ratio of the number of all nodes to the number of groups; a calculation module, configured to calculate an allocation time for dividing all nodes into a predetermined number of pre-shards and a sum of communication times between the plurality of pre-shards, wherein for the predetermined number of pre-shards, the allocation time is less than a first threshold value, and the sum of communication times of all pre-shards is the smallest; and The time mixed queue slicing module is used to determine whether the sum of the communication time between multiple pre-slices meets the minimum. If so, the current pre-slice is the final time mixed queue slicing. Otherwise, all nodes are re-divided into a predetermined number of new pre-slices within the time of the first threshold and re-determined whether the sum of the communication time between multiple new pre-slices meets the minimum.
4. The communication method according to claim 3, characterized in that: It also includes a data consensus module for performing data consensus between the pre-shards.
5. The communication method according to claim 3, characterized in that: The strong leader node communicates directly with the weak leader node to achieve interaction with different pre-shards. The strong leader node collects and verifies partial threshold signatures of messages from the weak leader node, and collects intra-shard transaction information sent by the weak leader node to synthesize blocks.
6. The communication method according to claim 5, characterized in that: The weak leader node in the pre-shard communicates with the leaf node, collects transactions of the leaf node, and forwards messages sent by the strong leader node to the leaf node.
7. A communication system for a blockchain-based time-mixed queue sharding system implementing the communication method according to any one of claims 1 to 6, characterized in that: include: Broadcast connection detection request module, used for each node N i Broadcast the connection detection request Detect to all other nodes in the time hybrid queue sharding system i , and record node N in the database i The Unix timestamp when the message was sent. (i,j) ; wherein the connection detection request Detect i It is expressed as: Detect i ={Detect i ,Sig i (v i ,h i ,rand i )}; Where Detect represents the message type of the connection detection request, i represents the node number, and v i Indicates the connection detection request Detect i Contains nodes N i The view in which it is located, h i Represents node N i The block height, rand i Represents node N i The random number generated; Receive connection detection request and verify signature information module for node N j Received from node N i After sending the connection detection request message, use node N i The public key PK i Verify whether the signature information of the message is correct and determine the view v contained in the message i and height h i Does it satisfy v i =v j ,h i =h j , determine whether a connection detection request is received Detect i Whether the view and block height contained in are consistent with themselves, where node N j , j≠i, represents the nodes participating in the consensus; Reply connection detection response module, if the verification is successful, node N j To node N i Reply connection detection response Response j , the reply connection detection response Response j The content is as follows: Response j ={Response,Sig j (v j ,h j ,rand i ’)}; Among them, Response indicates the reply connection detection message type, j indicates the node sequence number, and rand i ' represents node N j Received from N i Random number; v j Represents Response j Node N included in the message j The view in which it is located; h j Represents node N j The block height; A module for recording timestamp information and verifying the validity of the reply connection detection response is used for node N i Received from node N j After replying the response message, record the Unix timestamp of when the message was received. (j,i) , and perform a validity determination on the response message, the validity determination includes Response j View V in Message j , block height h j , random number rand i 'With node N i The random number generated is rand i Is it consistent? The communication time recording module is used to calculate the node N based on the communication of the response message after determining the validity of the response through the reply connection detection response. i To other nodes N j The round trip time d (i,j) =t (j,i) -t (i,j) , and save the round-trip communication time in the communication time matrix. All nodes N i The communication time matrix CTM between this node and all other nodes is stored in i ; The communication time matrix CTM i Contains the current node N i View v i and block height h i , random number rand i , and node N i With other n-1 nodes <N1,…,N n-1 ,N n >communication time d (i,j) =t (j,i) -t (i,j) , where t (i,j) Represents node N i To node N j Unix timestamp of sending the message, t (j,i) Represents node N i Received from node N j Unix timestamp of the response message.
8. An electronic device, characterized in that: It comprises a processor and a communication circuit, wherein the processor is connected to the communication circuit, and the processor is used to execute instructions to implement the communication method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the plurality of instructions can be read by a processor and executed by the communication method according to any one of claims 1 to 6.
Citation Information
Patent Citations
IP fragmentation mechanism-based concealed information communication method
CN106911705A
Method for manufacturing and synchronizing blocks in block chain network and information data processing terminal
CN109978516A