CN113395357B - Method and device for fragmenting block chain system - Google Patents

Method and device for fragmenting block chain system Download PDF

Info

Publication number
CN113395357B
CN113395357B CN202110935016.1A CN202110935016A CN113395357B CN 113395357 B CN113395357 B CN 113395357B CN 202110935016 A CN202110935016 A CN 202110935016A CN 113395357 B CN113395357 B CN 113395357B
Authority
CN
China
Prior art keywords
node
nodes
network
time interval
coordinates
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
CN202110935016.1A
Other languages
Chinese (zh)
Other versions
CN113395357A (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.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202110935016.1A priority Critical patent/CN113395357B/en
Publication of CN113395357A publication Critical patent/CN113395357A/en
Application granted granted Critical
Publication of CN113395357B publication Critical patent/CN113395357B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • 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/1044Group management mechanisms 
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • 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

Abstract

The embodiment of the specification provides a method and a device for fragmenting a block chain system. The method comprises the following steps: acquiring network coordinates of a plurality of first nodes for constructing a block chain system, wherein the network coordinates of two first nodes are used for calculating a network distance between the two first nodes, and the network distance indicates a network delay between the two first nodes; and dividing the plurality of first nodes into a plurality of fragments according to the network coordinates of the plurality of first nodes.

Description

Method and device for fragmenting block chain system
Technical Field
One or more embodiments of the present disclosure relate to the field of computers, and in particular, to a method and an apparatus for sharding a blockchain system.
Background
The Blockchain (Blockchain) is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. In the block chain system, data blocks are combined into a chain data structure in a sequential connection mode according to a time sequence, and the data blocks are guaranteed to be not falsified and forged in a cryptographic mode. The basic idea of blockchain fragmentation is to divide nodes in a blockchain system into a plurality of relatively independent sub-networks, each sub-network includes a part of nodes, one sub-network is a fragment, and a plurality of fragments process transactions in parallel.
A new blockchain fragmentation scheme is desired to improve the performance of blockchain systems.
Disclosure of Invention
One or more embodiments of the present specification provide a method and an apparatus for slicing a blockchain system.
In a first aspect, a fragmentation method for a blockchain system is provided, including: acquiring network coordinates of a plurality of first nodes for constructing a block chain system, wherein the network coordinates of any two first nodes are used for calculating a network distance between the two first nodes, and the network distance indicates a network delay between the two first nodes; and dividing the plurality of first nodes into a plurality of fragments according to the network coordinates of the plurality of first nodes.
In a second aspect, a slicing apparatus for a blockchain system is provided, including: the information acquisition unit is configured to acquire network coordinates of a plurality of first nodes for constructing a block chain system, wherein the network coordinates of any two first nodes are used for calculating a network distance between the two first nodes, and the network distance indicates a network delay between the two first nodes; and the fragment processing unit is configured to divide the plurality of first nodes into a plurality of fragments according to the network coordinates of the plurality of first nodes.
In a third aspect, there is provided a computer readable storage medium having stored thereon a computer program/instructions which, when executed in a computing device, the computing device performs the method according to any of the first aspect.
In a fourth aspect, there is provided a computing device comprising a memory having stored therein a computer program/instructions and a processor executing the computer program/instructions to implement the method of any of the first aspects.
By the method and the device provided in one or more embodiments of the present specification, network delay between nodes included in a single segment can be relatively small, network communication delay between different nodes in a single segment is reduced, and performance of a single segment is improved, thereby improving performance of a whole block chain system using a segmentation technology.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a system framework diagram of a blockchain system provided in embodiments of the present description;
fig. 2 is a flowchart of a fragmentation method of a blockchain system provided in an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of determining network coordinates of landmark nodes based on geometric space;
FIG. 4 is a schematic diagram of determining network coordinates of a first node based on landmark nodes;
FIG. 5 is a schematic diagram of an exemplary first node's location with respect to a point in geometric space;
FIG. 6 is a schematic diagram of fragmentation and main chain interaction information;
FIG. 7 is a flowchart of a method for determining a segment to which a target node requesting to join a blockchain system belongs;
fig. 8 is a schematic diagram of a slicing apparatus of a blockchain system provided in an embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions in the present specification better understood, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the embodiments described below are some, but not all embodiments of the present specification. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without any inventive effort shall fall within the scope of protection of the present specification.
The blockchain technology is different from the traditional technology in one of the decentralization characteristics, namely accounting is performed on each node in the blockchain system, or is called distributed accounting, and is not traditional centralized accounting. To be a difficult-to-defeat, open, non-falsifiable data record decentralized honest and trusted system, the blockchain system needs to be secure, unambiguous, and irreversible in the shortest possible time for distributed data records. Corresponding consensus algorithms/mechanisms are usually required to ensure that the ledger is kept consistent among the nodes recording the ledger. After a node creates a new block, if the new block is approved by other nodes, other nodes record the new block. The process of generating new blocks to be approved by other nodes is a consensus mechanism. The consensus mechanism may ensure that the newly generated tiles are accurately added to the chain of tiles. The current mainstream consensus mechanism comprises: proof of Work (POW), Proof of stock (POS), Proof of commission rights (DPOS), Practical Byzantine Fault Tolerance (PBFT) algorithm, Honey Badger BFT algorithm, etc.
One of the most important factors that currently limit the large-scale landing of blockchain technology is performance, i.e., throughput, which can typically be measured by the number of Transactions Per Second (TPS). Developers have proposed various schemes to try to increase the throughput of blocks, a process known as "capacity expansion". From the direction of the expansion technology, the expansion can be divided into two directions of on-chain expansion and under-chain expansion. Chain expansion generally comprises fragmentation, block expansion, isolation witness and consensus layer improvement. The under-chain expansion generally comprises the schemes of state channel, side chain and under-chain calculation.
The notion of shards, which is derived from the database domain, is intended to mean horizontal partitioning of data in a database (dividing different rows of a table into different partitions), each shard being maintained on a separate database server instance to spread the load. For the blockchain system, the basic idea of the slicing technique is to divide the nodes in the blockchain system into a plurality of relatively independent sub-networks, each sub-network includes a part of nodes, and one sub-network is a slice (shard). A single fragment processes a transaction with a small scale, even only part of network states are stored, and a plurality of fragments process the transaction in parallel, so that the throughput of the whole network is theoretically improved. The fragmentation technology can be divided into three types according to different fragmentation mechanisms: network sharding (network sharding), transaction sharding (transaction sharding), state sharding (state sharding). Network fragmentation is the division of the whole blockchain network/system into multiple sub-networks, i.e. into multiple fragments, which can process different transactions in the network in parallel. The idea of the transaction slicing is to distribute transactions to different slices according to a certain rule, and distribute transactions to the same slice processing according to a specific rule, so that the purpose of parallel processing can be achieved, and the problem of double flowers can be avoided, wherein the transaction slicing is based on the premise that network slicing is firstly carried out. The state fragmentation divides the storage area of the whole blockchain system into a plurality of parts, different fragments store different parts, and each node is only responsible for storing the data of the fragment to which the node belongs, but not directly storing the data of the whole blockchain system.
The architecture of a blockchain system that partially employs the fragmentation technique is shown in fig. 1. The blockchain system may include a main chain, and M slices including slice 1-slice M, where the main chain and each slice each include a plurality of nodes 11. The connecting lines between the nodes 11 indicate peer-to-peer (P2P) connections between the nodes 11, and the respective slices are connected to each other through a main chain, that is, the main chain provides services for all the slices in the blockchain system. In addition, a blockchain system that partially employs fragmentation techniques may not include a main chain, with different fragments being connected directly or through other fragments in the blockchain system.
For a single segment, the aforementioned consensus mechanism also needs to be adopted in the segment to ensure that after a node in the segment generates a new block, the other nodes in the segment record the new block only when the new block is approved by the other nodes in the segment, thereby completing the addition of the new block to the segment. In this process, large-scale information interaction between nodes in a single segment is often required, for example, information interaction between nodes in the segment is required to complete the aforementioned consensus mechanism and other transactions for supporting the consensus mechanism.
Taking the foregoing PBFT algorithm as an example, in the process of implementing the PBFT algorithm, the master node in a single segment may package a plurality of requests from clients, a main chain, or other segments into a message m according to a certain order, and send a consensus proposal containing the message m to each replica node in the segment; each duplicate node can check whether the message m in the consensus proposal received by the duplicate node is legal or not, broadcast the consensus proposal to the main node and other duplicate nodes in the fragment if the consensus proposal is determined to be legal, and return a confirmation message representing that the message m is legal to the main node or the duplicate node corresponding to the consensus proposal received by the duplicate node. In addition, when a duplicate node detects a master node, it may initiate a view switching (view change) protocol stage to change the master node, and the view change stage also requires multiple rounds of information interaction between the duplicate nodes.
If the network delay between nodes belonging to the same segment is high, the performance of the block chain system may be affected due to the inability to complete large-scale information interaction between nodes, for example, the time consumed in the PBFT algorithm process or the View Change protocol stage is increased to affect the performance of the block chain. In view of the foregoing problems, embodiments of the present disclosure provide a method and an apparatus for partitioning a blockchain system, so that network delay between nodes included in a single partition is relatively small, network communication delay between different nodes in the single partition is reduced, and performance of the single partition is improved, thereby improving performance of the blockchain system using a partitioning technique.
Fig. 2 is a flowchart illustrating a fragmentation method of a blockchain system according to an embodiment of the present disclosure. As shown in fig. 2, the method may include at least the following steps 201 and 203, where the steps 201 and 203 may be specifically executed by a main chain of a blockchain system using a fragmentation technique, and may also be executed by any other computing device, platform, or device cluster having computing/processing capabilities.
In step 201, network coordinates of a plurality of first nodes for constructing a blockchain system are obtained.
Specifically, a centralized landmark method or a distributed landmark method may be adopted to obtain the network coordinates of the first node. The centralized landmark approach requires pre-maintenance or determination of a dedicated plurality of landmark nodes, such as a second node selected from a backbone comprised by the blockchain system, or other computing devices not used to deploy the blockchain system; such as gnp (global network positioning) and Virtual Landmarks. The distributed landmark method needs to select a plurality of second nodes from a plurality of first nodes as landmark nodes according to a specific strategy; such as Lighthouse, Hierarchical Method, and Vivaldi, among others.
When a plurality of landmark nodes are determined/selected, network coordinates of the plurality of landmark nodes can be determined based on network delay among the plurality of landmark nodes; and then, for each first node, calculating the network coordinates of the first node according to the network coordinates of the plurality of landmark nodes and the network time delay between the first node and the plurality of landmark nodes. The network time delay between the landmark nodes and the network time delay between the first node and the landmark nodes can be measured by a direct measurement method; for example, for any two landmark nodes, a connectivity test program (Packet Internet Groper, PING) instruction may be executed on one of the landmark nodes based on an Internet Protocol (IP) address of the other landmark node, so as to measure a network delay between the two landmark nodes.
Taking the aforementioned GNP as an example, a process of acquiring the network coordinates of the landmark nodes P1, P2, P3, P4 and the first node S1 is exemplarily described below. First, referring to fig. 3, a geometric space (or referred to as euclidean space) with multiple dimensions (e.g. 3 dimensions) may be constructed, and P1, P2, P3, and P4 may be respectively mapped to points in the geometric space, in which process, it is required to ensure that a distance (e.g. euclidean distance) between points in the geometric space corresponding to any two landmark nodes is respectively capable of being used to indicate a network latency between any two landmark nodes, for example, it is required to ensure that a distance between points in the geometric space corresponding to P1 and P2 is equal to or approximately equal to a network latency between P1 and P2; correspondingly, the absolute coordinates (x 1, y1, z 1) of P1 in the geometric space can be used as the network coordinates of P1, and similarly, the network coordinates (x 2, y2, z 2) of P2, the network coordinates (x 3, y3, z 3) of P3 and the network coordinates (x 4, y4, z 4) of P4 can be obtained. Next, referring to fig. 4, by using various approximate solving methods including the Simplex Downhill method, the absolute coordinates (x 5, y5, z 5) of the point in the geometric space corresponding to S1 are calculated according to the network coordinates of P1, P2, P3, and P4 and the network delays between S1 and P1, P2, P3, and P4, respectively, and in this process, it is also necessary to ensure that the distance between S1 and the point in the geometric space corresponding to the arbitrary landmark node can be used to indicate the network delay between S1 and the arbitrary surface node, where (x 5, y5, z 5) is the network coordinate of S1.
In step 203, the plurality of first nodes are divided into a plurality of segments according to the network coordinates of the plurality of first nodes.
For any two first nodes, the network coordinates can be used to calculate the network distance between the two first nodes, and the network distance can be used to indicate the network delay between the two first nodes. Specifically, the network distance between the two first nodes may be a predicted value obtained by predicting the network delay between the two first nodes. Accordingly, depending on the network coordinates of the plurality of first nodes, the plurality of first nodes may be divided into the plurality of slices in at least two ways.
In the first mode, the plurality of first nodes are clustered based on the network coordinates of the plurality of first nodes to obtain a plurality of clusters, the plurality of clusters correspond to the plurality of fragments, and all nodes belonging to the same cluster are divided into the same fragment. The algorithm for clustering the plurality of first nodes includes, but is not limited to, a k-means algorithm, a density-based DBSCAN algorithm, and modifications or improvements of the respective algorithms of the foregoing examples. In this way, the number of the plurality of slices may be predetermined, or may be determined based on a self-defined convergence condition in the clustering process.
Selecting a plurality of central nodes from the plurality of first nodes, wherein different central nodes belong to different fragments; and for a third node which is not selected as the central node in the plurality of first nodes, determining the fragment to which the third node belongs according to the network distance between the third node and the plurality of central nodes. In this manner, the number of the plurality of slices may be predetermined.
In the second embodiment, the plurality of central nodes may be sequentially selected from the plurality of first nodes through a plurality of selection turns based on the predetermined number of the plurality of segments. Hereinafter, for convenience of description, the first node is also expressed as a sharded node, the number of the plurality of shards is assumed to be M, and the total number of the plurality of sharded nodes is assumed to be N.
In the 1 st selection round, the 1 st central node can be randomly selected from the plurality of fragmented nodes; or calculating the network distance between every two fragment nodes, and selecting the 1 st central node from the two fragment nodes with the maximum network distance.
In the ith selection round larger than 1 in the M selection rounds, assuming that the network coordinate of the jth slicing node is recorded as a vector
Figure DEST_PATH_IMAGE002
The network coordinates of the r-th central node of the selected i-1 central nodes are recorded as vectors
Figure DEST_PATH_IMAGE004
Then can be specifically through the formula
Figure DEST_PATH_IMAGE006
And calculating to obtain the minimum value of i-1 network distances between the N slicing nodes and the i-1 central nodes respectively
Figure DEST_PATH_IMAGE008
Then according to N slicing nodes respectively corresponding
Figure 724697DEST_PATH_IMAGE008
Size to select the ith central node, e.g. to have the largest
Figure 110679DEST_PATH_IMAGE008
Is selected as the ith central node. It should be noted that, in the actual service scenario, the calculation is performed by the formula
Figure 608526DEST_PATH_IMAGE008
In the method, only the N-i +1 fragmentation nodes which are not selected as the central nodes respectively corresponding to the fragmentation nodes can be calculated
Figure 692150DEST_PATH_IMAGE008
And the calculation time is saved.
In the second mode, after the M central nodes are selected in M selection rounds, for each fragmentation node that is not selected as a central node, the fragmentation to which the fragmentation node belongs may be specifically determined according to M network distances between the fragmentation node and the M central nodes. For example, the minimum value of the M network distances is determined, and the segment to which the central node corresponding to the minimum value belongs is determined as the segment to which the segment node belongs.
In some embodiments, the minimum number of sharded nodes included in a single shard may also be configured, for example, to ensure that the aforementioned PBFT algorithm is accurately implemented in a single shard, the minimum number of sharded nodes in a single shard is not less than 4. Correspondingly, for the first mode, the minimum number of the fragment nodes included in a single fragment may be specifically used as a hyper-parameter of a clustering algorithm, and it is ensured that the number of the fragment nodes in each cluster obtained by clustering a plurality of fragment nodes based on the clustering algorithm is not less than the minimum number. As for the second mode, after determining the respective segment to which each segment node belongs, if the number of nodes in a certain segment is less than the minimum number, the cluster center of the segment may be calculated based on the network coordinates of the segment nodes that have been divided into the segment, the network distance between each segment node that has been divided into other segments and the cluster center may be calculated, and one or more segment nodes that have been divided into other segments are re-divided into the segment according to the sequence of the network distances from small to large; and so on, until the number of the fragmentation nodes in each fragmentation is not less than the minimum number. Similarly, the maximum number of sharded nodes included in a single shard can be configured, so that the waste of resources caused by dividing too many sharded nodes into the same shard is avoided.
For example, please refer to fig. 5. The positions of points of 16 slicing nodes mapped in the geometric space are shown, and the network coordinates of 16 slicing nodes with node numbers of 1-16 in sequence are shown in table 1 below.
TABLE 1
Node numbering Node coordinates
1 (6,2,0)
2 (7,6,4)
3 (8,8,8)
4 (1,5,3)
5 (0,5,1)
6 (5,8,7)
7 (6,0,5)
8 (0,6,2)
9 (8,5,0)
10 (2,0,4)
11 (2,0,9)
12 (9,4,9)
13 (2,3,8)
14 (6,3,7)
15 (6,3,1)
16 (1,8,8)
It is continuously assumed that the number of the plurality of slices is configured in advance to be 4, and the number of the nodes in a single slice is 4. When the 16 slicing nodes are divided into 4 slices in the first mode or the second mode, the slicing result is as follows:
shard0, { sharding node 4, sharding node 5, sharding node 8, sharding node 16 };
shard1, { sharding node 1, sharding node 2, sharding node 9, sharding node 15 };
shard2, { sharding node 7, sharding node 10, sharding node 11, and sharding node 13 };
shard3, { sharding node 3, sharding node 6, sharding node 12, sharding node 14 }.
For any single Shard0, Shard1, Shard2 or Shard3, the network distances between different Shard nodes are relatively small, which means that the network delays between different Shard nodes are relatively small, which can reduce the network communication delay between different Shard nodes, save the time for exchanging information between different Shard nodes, and improve the performance of the single Shard, thereby improving the performance of the whole blockchain system adopting the sharding technology.
For a constructed blockchain system employing a fragmentation technique, a master node in a single fragment may be responsible for collecting a change of member event of the fragment to which the master node belongs, where the change of member event is, for example, a notification that a target node joined the fragment or a notification that a node joined the fragment left from the fragment, and the single notification at least includes an identification of the node joining or leaving the fragment and a change of member type indicating to join the fragment or leave the fragment, where the identification of the node includes, for example, an IP address of the node and/or a number of the node in the fragment to which the master node belongs. It should be particularly noted that the master node in a single segment may be selected from the nodes included in the segment not only through the aforementioned View Change protocol stage, but also through other algorithm rules defined by the service provider; for example, according to a time interval (epoch) with a predetermined length, at the end of a previous time interval (denoted as time interval T-1), the network distance between each node included in a single segment in the current event interval (denoted as time interval T) and a specific node (e.g., a master node) in the main chain is determined, and the node with the smallest network distance is determined as the master node of the segment in the time interval T.
The master node of a single segment in time interval T-1 may generate and send to the master chain first node information at the end of time interval T-1 based on member change events it has collected in time interval T-1, the first node information indicating the nodes that the segment includes in time interval T. For example, the master node of a single slice in time interval T-1 may aggregate several member change events it has collected in time interval T-1 into an entry (entry) at the end of time interval T-1, i.e., at the beginning of time interval T, and send the entry as first node information to the master chain, so that the master chain determines, according to the entry, the nodes that the slice includes in the current event interval.
The master node of a single segment in time interval T-1 may also send second node information to the master chain indicating the master node of the segment in time interval T at the end of time interval T-1. It should be noted that the master nodes of the single segment in two adjacent time intervals may be the same, in which case it may not be necessary to send the second node information indicating the master node to the main chain. Referring to fig. 6, for the first node information and the second node information, the master node of a single segment in time interval T-1 may send them to the master chain respectively, or may combine them into new node information and send it to the master chain.
Different fragments respectively have different fragment identifications, and all nodes in a single fragment have the same node list and View in the same time interval. With continued reference to fig. 6, at the end of the time interval T-1, the main chain may obtain, based on at least the node information from each segment, a view summary of each segment in the time interval T, where the view summary includes, for example, a segment identifier of each segment and an IP address of a master node of each segment in the time interval T; accordingly, a single slice may also receive a view summary of other slices at time interval T from the main chain at the end of time interval T-1, so that the slice communicates with other slices through the main chain or directly.
As previously described, a node that has joined the blockchain system may leave from the shard to which it belongs, and there may be a new node joining the blockchain system. In order to ensure that the blockchain system always has better performance, it is necessary to ensure that after a new node joins a certain segment of the blockchain system, the network delay between the new node and each node in the segment to which the new node belongs is still relatively small. Accordingly, on the basis of the slicing method of the blockchain system shown in fig. 2, the method may further include various steps as shown in fig. 7, wherein the various steps shown in fig. 7 may be performed by the main chain of the blockchain system, for example, by the main node in the main chain.
First, in step 701, network coordinates of a target node requesting to join a blockchain system are obtained.
The method for obtaining the network coordinate of the target node is the same as the method for obtaining the network coordinate of the single first node, and is not described again.
Next, in step 703, a target segment to which the target node belongs is determined from the multiple segments according to the network coordinates of the target node and the center coordinates of the multiple segments in the current time interval, where the center coordinates of a single segment in the current time interval are calculated based on the network coordinates of each first node included in the current time interval of the segment.
The center coordinate of a single slice within time interval T may come from the master node of that slice within time interval T-1. Specifically, the master node of a single segment in time interval T-1 may determine, at the end of time interval T-1, each node included in the segment in event interval T according to the member change event of the segment in time interval T-1, and calculate the center coordinate of the segment in time interval T according to the network coordinate of each node included in the segment in time interval T.
The center coordinates of the individual slices within the time interval T can be calculated from the backbone. Specifically, the master node of a single segment within time interval T-1 may send the aforementioned first node information to the master chain at the end of time interval T-1; the main chain may determine, according to the first node information, each segment node included in the segment in the time interval T, and calculate, according to the network coordinates of each node included in the segment in the time interval T, the center coordinate of the segment in the time interval T.
The center coordinates of a single fragment in the current time interval may specifically be a clustering center calculated based on network coordinates of each node included in the fragment in the current time interval; for example, for Shard0, Shard1, Shard2, and Shard3 of the foregoing examples, their respective cluster centers may be calculated as [0.5, 6, 3.5], [7.25, 4, 1.25], [3, 0.75, 6.5], [7, 5.75, 7.75 ]. Or, a cluster center may be first calculated based on the network coordinates of each node included in the segment in the time interval T, then the network distances between each node included in the segment in the time interval T and the cluster center are calculated, and the network coordinate of the node with the smallest network distance in the segment is determined as the center coordinate of the segment in the current time interval.
When the main chain receives node information indicating a main node of a segment within a time interval T from the segment, in addition to obtaining a view summary of the segment based on the node information, if there is a transaction in the main chain that needs to be sent to the segment within the event interval T, for example, there is a transaction requesting to join a target node in a blockchain system or a cross-segment transaction from other segments and needing to be forwarded to the segment, the transaction may be specifically sent to the main node of the segment within the event interval T by the main chain.
In one possible implementation, the target node may send a transaction to the main chain requesting to join the blockchain system, and after determining, from the multiple fragments, a target fragment to which the target node belongs, the main chain may forward the transaction to the target fragment, for example, forward the transaction to the main chain of the target fragment within the event interval T. The transaction may be propagated in the target segment to each node included in the target segment within the event interval T based on the P2P connection between each node, and the aforementioned consensus mechanism for the transaction is completed by each node included in the target segment within the event interval T. After the transaction is agreed, each node in the target fragment stores and executes the transaction locally; accordingly, the target node may synchronize all of the chunk data of the target fragment from the target fragment. In the process of completing synchronization of all the tile data of the target fragment or after completing synchronization of all the tile data of the target fragment, the target fragment may locally update its node list and regard the target node as a copy node in the view of the target fragment and add a number corresponding to the target node, and in addition, the target fragment may also generate a notification that represents that the target node successfully joins the target fragment, where the notification may be a member change event of the target fragment and is recorded locally by at least a master node in the target fragment.
Based on the same concept as the foregoing method embodiment, the embodiment of the present specification further provides a slicing apparatus for a blockchain system. As shown in fig. 8, the apparatus includes: an information obtaining unit 801 configured to obtain network coordinates of a plurality of first nodes used for constructing a blockchain system, where the network coordinates of any two first nodes are used for calculating a network distance between the two first nodes, and the network distance indicates a network delay between the two first nodes; the segment processing unit 803 is configured to divide the plurality of first nodes into a plurality of segments according to the network coordinates of the plurality of first nodes.
In one possible implementation, the blockchain system includes a plurality of second nodes. The information obtaining unit 801 is configured to determine network coordinates of the plurality of second nodes based on network delays among the plurality of second nodes; and determining the network coordinates of the plurality of first nodes according to the network time delay between each second node and each first node and the network coordinates of the plurality of second nodes.
In a possible implementation manner, the information obtaining unit 801 is further configured to obtain network coordinates of a target node requesting to join the blockchain system; the segment processing unit 803 is further configured to determine, according to the network coordinate of the target node and the center coordinates of the multiple segments in the current time interval, a target segment to which the target node belongs from the multiple segments, where the center coordinates of a single segment in the current time interval are calculated based on the network coordinates of each first node included in the segment in the current time interval.
In one possible embodiment, the second node is a node in a backbone of the blockchain system, and the device is deployed at a node in the backbone. The device further comprises: a communication processing unit 805 configured to receive node information of a current time interval from a master node of each of the plurality of slices in a previous time interval, where a single piece of the node information is at least used to indicate each first node included in its corresponding slice in the current time interval.
In a possible implementation, the single piece of node information is further used to indicate the master node of its corresponding slice in the current time interval.
In one possible embodiment, the center coordinates of a single slice in the current time interval are from the master node of the slice in the last time interval.
In a possible implementation manner, the center coordinate of a single fragment in the current time interval is a cluster center calculated based on the network coordinates of each first node included in the fragment in the current time interval.
In a possible implementation, the shard processing unit 803 is configured to select a plurality of central nodes from the plurality of first nodes, where different central nodes belong to different shards; and for a third node which is not selected as the central node in the first nodes, determining the fragment to which the third node belongs according to the network distance between the third node and the central nodes.
In a possible implementation, the fragmentation processing unit 803 is configured to determine, for each fourth node of the plurality of first nodes that is not selected as a central node, a smallest first network distance from i-1 network distances between the fourth node and the selected i-1 central nodes in an ith selection turn of a plurality of selection turns; and selecting the ith central node according to the first network distance corresponding to each fourth node.
In a possible implementation, the fragmentation processing unit 805 is specifically configured to select the fourth node with the largest first network distance as the ith central node.
Those skilled in the art will recognize that in one or more of the examples described above, the functions described in this specification can be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, a computer program corresponding to these functions may be stored in a computer-readable medium or transmitted as one or more instructions/codes on the computer-readable medium, so that when the computer program corresponding to these functions is executed by a computer, the method described in any one of the embodiments of the present specification is implemented by the computer.
Also provided in an embodiment of the present specification is a computer-readable storage medium having a computer program stored thereon, where when the computer program is executed in a computing device, the computing device executes the fragmentation method of the blockchain system provided in any one of the embodiments of the present specification.
The embodiment of the present specification further provides a computing device, which includes a memory and a processor, where the memory stores executable codes, and when the processor executes the executable codes, the method for partitioning a blockchain system provided in any one embodiment of the present specification is implemented.
The embodiments in the present description are described in a progressive manner, and the same and similar parts in the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above-mentioned embodiments, objects, technical solutions and advantages of the present invention are further described in detail, it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the present invention should be included in the scope of the present invention.

Claims (18)

1. A method of sharding a blockchain system, the blockchain system including a plurality of second nodes, comprising:
determining network coordinates of the plurality of second nodes based on network latency between the plurality of second nodes;
determining network coordinates of the plurality of first nodes according to the network delays between the plurality of second nodes and the plurality of first nodes and network coordinates of the plurality of second nodes, wherein the network coordinates of any two first nodes are used for calculating a network distance between the two first nodes, and the network distance indicates the network delay between the two first nodes;
dividing the plurality of first nodes into a plurality of fragments according to the network coordinates of the plurality of first nodes;
acquiring network coordinates of a target node requesting to join the block chain system;
and determining a target fragment to which the target node belongs from the plurality of fragments according to the network coordinate of the target node and the center coordinates of the plurality of fragments in the current time interval, wherein the center coordinate of a single fragment in the current time interval is calculated based on the network coordinates of each first node included in the fragment in the current time interval.
2. The method of claim 1, wherein a second node is a node in a backbone of the blockchain system, the method performed by the backbone, further comprising: and receiving node information of the current time interval from the master node of each of the plurality of fragments in the previous time interval, wherein a single piece of the node information is at least used for indicating each first node included in the corresponding fragment in the current time interval.
3. The method of claim 2, wherein a single said node information is further used to indicate a master node for its corresponding slice within a current time interval.
4. The method of claim 1, wherein the center coordinates of a single slice in a current time interval are from the master node of the slice in a previous time interval.
5. The method of claim 1, wherein the center coordinates of a single segment in the current time interval are cluster centers calculated based on the network coordinates of the first nodes included in the segment in the current time interval.
6. The method of any of claims 1-5, wherein the partitioning the plurality of first nodes into a plurality of shards according to network coordinates of the plurality of first nodes comprises:
selecting a plurality of central nodes from the plurality of first nodes, wherein different central nodes belong to different fragments;
and for a third node which is not selected as the central node in the first nodes, determining the fragment to which the third node belongs according to the network distance between the third node and the central nodes.
7. The method of claim 6, wherein said selecting a plurality of central nodes from said plurality of first nodes comprises: determining, for each fourth node of the plurality of first nodes not selected as a central node, a smallest first network distance from i-1 network distances between the fourth node and the selected i-1 central nodes in an ith selection turn of a plurality of selection turns; and selecting the ith central node according to the first network distance corresponding to each fourth node.
8. The method of claim 7, wherein selecting the ith central node according to the first network distance corresponding to each of the fourth nodes comprises selecting the fourth node with the largest first network distance as the ith central node.
9. A sharer device of a blockchain system, the blockchain system including a plurality of second nodes, comprising:
the information acquisition unit is configured to determine network coordinates of the plurality of second nodes based on network time delay among the plurality of second nodes; determining network coordinates of the plurality of first nodes according to the network delays between the plurality of second nodes and the plurality of first nodes and network coordinates of the plurality of second nodes, wherein the network coordinates of any two first nodes are used for calculating a network distance between the two first nodes, and the network distance indicates the network delay between the two first nodes;
the fragment processing unit is configured to divide the plurality of first nodes into a plurality of fragments according to the network coordinates of the plurality of first nodes;
the information acquisition unit is further configured to acquire a network coordinate of a target node requesting to join the block chain system;
the fragment processing unit is further configured to determine a target fragment to which the target node belongs from the plurality of fragments according to the network coordinate of the target node and the center coordinates of the plurality of fragments in the current time interval, wherein the center coordinate of a single fragment in the current time interval is calculated based on the network coordinates of each first node included in the fragment in the current time interval.
10. The apparatus of claim 9, wherein a second node is a node in a backbone of the blockchain system, the apparatus being deployed at a node in the backbone; the device further comprises: and the communication processing unit is configured to receive node information of a current time interval from a master node of each of the plurality of fragments in a previous time interval, wherein a single piece of the node information is at least used for indicating each first node included in the corresponding fragment in the current time interval.
11. The apparatus of claim 10, wherein a single said node information is further used to indicate a master node for its corresponding slice within a current time interval.
12. The apparatus of claim 9, wherein the center coordinates of a single slice in a current time interval are from the master node of the slice in a previous time interval.
13. The apparatus of claim 9, wherein the center coordinates of a single slice in the current time interval are cluster centers calculated based on the network coordinates of the first nodes included in the slice in the current time interval.
14. The apparatus according to any of claims 9-13, wherein the shard handling unit is configured to select a plurality of central nodes from the plurality of first nodes, different central nodes belonging to different shards; and for a third node which is not selected as the central node in the first nodes, determining the fragment to which the third node belongs according to the network distance between the third node and the central nodes.
15. The apparatus according to claim 14, wherein the shard processing unit is configured to determine, for each fourth node of the plurality of first nodes not selected as a central node, a smallest first network distance from i-1 network distances between the fourth node and the selected i-1 central nodes in an ith selection round of a plurality of selection rounds; and selecting the ith central node according to the first network distance corresponding to each fourth node.
16. The apparatus according to claim 15, wherein the shard processing unit is specifically configured to select the fourth node with the largest first network distance as the ith central node.
17. A computer-readable storage medium having stored thereon a computer program which, when executed in a computing device, performs the method of any of claims 1-8.
18. A computing device comprising a memory having stored therein a computer program and a processor that, when executing the computer program, implements the method of any of claims 1-8.
CN202110935016.1A 2021-08-16 2021-08-16 Method and device for fragmenting block chain system Active CN113395357B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110935016.1A CN113395357B (en) 2021-08-16 2021-08-16 Method and device for fragmenting block chain system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110935016.1A CN113395357B (en) 2021-08-16 2021-08-16 Method and device for fragmenting block chain system

Publications (2)

Publication Number Publication Date
CN113395357A CN113395357A (en) 2021-09-14
CN113395357B true CN113395357B (en) 2021-11-12

Family

ID=77622537

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110935016.1A Active CN113395357B (en) 2021-08-16 2021-08-16 Method and device for fragmenting block chain system

Country Status (1)

Country Link
CN (1) CN113395357B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114546687A (en) * 2022-01-11 2022-05-27 天津眧合数字科技有限公司 Communication method for block chain-based time hybrid queue fragmentation system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101404664A (en) * 2008-11-05 2009-04-08 湖南大学 Network positioning and optimizing algorithm based on node clustering
CN111598127A (en) * 2020-04-09 2020-08-28 南京邮电大学 Block chain consensus algorithm based on machine learning
CN111711976A (en) * 2020-06-04 2020-09-25 中国联合网络通信集团有限公司 Node clustering method, system, terminal equipment and computer readable storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104065737B (en) * 2014-07-03 2018-02-09 湖南网数科技有限公司 Determine the method and system of service node deployment scheme
US10740733B2 (en) * 2017-05-25 2020-08-11 Oracle International Corporaton Sharded permissioned distributed ledgers
CN110753026B (en) * 2019-02-27 2020-10-30 北京嘀嘀无限科技发展有限公司 Block chain-based fragmentation method and device
CN109949160A (en) * 2019-03-27 2019-06-28 上海优扬新媒信息技术有限公司 A kind of sharding method and device of block chain
CN110505305B (en) * 2019-08-27 2022-04-01 深圳市迅雷网络技术有限公司 Block chain fragmentation method and device and block chain system
CN110958324B (en) * 2019-12-12 2023-12-19 度小满科技(北京)有限公司 Data processing method and device of block chain network
CN113132433B (en) * 2019-12-31 2022-09-02 航天信息股份有限公司 Block chain fragmentation method and device, electronic equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101404664A (en) * 2008-11-05 2009-04-08 湖南大学 Network positioning and optimizing algorithm based on node clustering
CN111598127A (en) * 2020-04-09 2020-08-28 南京邮电大学 Block chain consensus algorithm based on machine learning
CN111711976A (en) * 2020-06-04 2020-09-25 中国联合网络通信集团有限公司 Node clustering method, system, terminal equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN113395357A (en) 2021-09-14

Similar Documents

Publication Publication Date Title
US8880941B1 (en) Optimum checkpoint frequency
CN109218348B (en) Method for determining blocks in block chain and node equipment
US7673069B2 (en) Strong routing consistency protocol in structured peer-to-peer overlays
US20060206621A1 (en) Movement of data in a distributed database system to a storage location closest to a center of activity for the data
US9420513B1 (en) Clustering approach to estimating a network metric for nodes
Hassanzadeh-Nazarabadi et al. Decentralized and locality aware replication method for DHT-based P2P storage systems
KR101670343B1 (en) Method, device, and system for peer-to-peer data replication and method, device, and system for master node switching
CN112104558A (en) Method, system, terminal and medium for implementing block chain distribution network
JP2012222402A (en) Relay device, relay program, and relay method
CN106991008B (en) Resource lock management method, related equipment and system
CN100367726C (en) Topological matching method for structured P2P system
CN110324166B (en) Method, device and system for synchronizing target information in multiple nodes
CN113395357B (en) Method and device for fragmenting block chain system
Alqahtani et al. Bigbft: A multileader byzantine fault tolerance protocol for high throughput
CN102546380B (en) Modified tree-based multicast routing scheme
CN107908713B (en) Distributed dynamic rhododendron filtering system based on Redis cluster and filtering method thereof
CN109254844B (en) Triangle calculation method of large-scale graph
Ambalavanan et al. DICer: Distributed coordination for in-network computations
CN114338724A (en) Block synchronization method and device, electronic equipment and storage medium
CN114338714A (en) Block synchronization method and device, electronic equipment and storage medium
CN114422526A (en) Block synchronization method and device, electronic equipment and storage medium
CN114595052A (en) Distributed communication load balancing method based on graph partitioning algorithm
US20160314037A1 (en) Reliable Map-Reduce Communications in a Decentralized, Self-Organizing Communication Orbit of a Distributed Network
CN107222880B (en) WSN abnormal node discovery method and system based on orthogonal tracing
CN117120993A (en) Geographically dispersed hybrid cloud clusters

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