CN110753026A - Block chain-based fragmentation method and device - Google Patents

Block chain-based fragmentation method and device Download PDF

Info

Publication number
CN110753026A
CN110753026A CN201910147729.4A CN201910147729A CN110753026A CN 110753026 A CN110753026 A CN 110753026A CN 201910147729 A CN201910147729 A CN 201910147729A CN 110753026 A CN110753026 A CN 110753026A
Authority
CN
China
Prior art keywords
candidate
node
cluster
nodes
sub
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.)
Granted
Application number
CN201910147729.4A
Other languages
Chinese (zh)
Other versions
CN110753026B (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.)
Beijing Didi Infinity Technology and Development Co Ltd
Original Assignee
Beijing Didi Infinity Technology and Development 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 Beijing Didi Infinity Technology and Development Co Ltd filed Critical Beijing Didi Infinity Technology and Development Co Ltd
Priority to CN201910147729.4A priority Critical patent/CN110753026B/en
Publication of CN110753026A publication Critical patent/CN110753026A/en
Priority to PCT/CN2020/074305 priority patent/WO2020173287A1/en
Application granted granted Critical
Publication of CN110753026B publication Critical patent/CN110753026B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/60Context-dependent security
    • H04W12/63Location-dependent; Proximity-dependent
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • 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
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/20Network architectures or network communication protocols for network security for managing network security; network security policies in general
    • 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
    • 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/1042Peer-to-peer [P2P] networks using topology management mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/52Network services specially adapted for the location of the user terminal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/60Context-dependent security
    • H04W12/69Identity-dependent
    • H04W12/71Hardware identity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Abstract

The application provides a fragmentation method and device based on a block chain, wherein the method comprises the following steps: determining a first main node in the block chain network, and if the first main node is a target node, dividing each candidate node in the block chain network into different network fragments; determining a second main node in a target network fragment where a target node is located; and if the second main node is the target node, determining a verification node for participating in data verification in the target network fragment based on the address information and/or the network delay time of each candidate node in the target network fragment. According to the scheme, the candidate nodes are firstly distributed to different fragments, the throughput of the block chain network can be improved, and then the verification nodes used for participating in data verification in the fragments are selected according to the address information of the nodes and the network delay time, so that the delay of the nodes in data verification is further reduced, and the real-time performance of the block chain network is improved.

Description

Block chain-based fragmentation method and device
Technical Field
The application relates to the technical field of internet, in particular to a block chain-based fragmentation method and device.
Background
With the continuous development of the block chain technology, the block chain technology plays an important role in solving the core problems of the current internet, such as information sharing, data right confirmation, privacy protection and the like. The block chain network comprises a plurality of nodes, the nodes are basic units for processing data in the block chain network, each node can pack the processed data to generate blocks, and the blocks are connected according to the time sequence to form the block chain.
At present, the blockchain technology can be applied to application scenarios such as stock exchange, electronic commerce and the like, and each node in a blockchain network can be used for verifying transaction data and the like, but considering that the data processing speed of each node is limited, and certain delay also exists when data to be verified is transmitted between each node, which causes the data processing performance of the blockchain technology to be limited, and is difficult to be applied to application scenarios with higher real-time requirements.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a method and an apparatus for partitioning based on a blockchain, so as to improve the real-time performance of data verification in a blockchain network.
Mainly comprises the following aspects:
in a first aspect, an embodiment of the present application provides a method for partitioning based on a block chain, where the method is applied to a target node in a block chain network, and the method includes:
determining a first main node in the block chain network, and if the first main node is the target node, dividing each candidate node in the block chain network into different network fragments;
determining a second main node in a target network fragment where the target node is located;
if the second master node is the target node, determining a verification node for participating in data verification in the target network fragment based on address information and/or network delay time of each candidate node in the target network fragment.
In a possible implementation manner, the determining, based on address information where each candidate node in the target network segment is located, a verification node in the target network segment for participating in data verification includes:
dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network fragment;
and determining a preset number of verification nodes for participating in data verification in the target network fragment according to the obtained clusters.
In one possible embodiment, the address information includes a geographic location;
the dividing, according to address information where each candidate node in the target network segment is located, each candidate node into at least one cluster includes:
dividing the candidate nodes with the geographic positions in the same geographic region range into the same cluster according to the geographic positions of the candidate nodes in the target network segment;
the determining a preset number of verification nodes for participating in data verification in the target network segment according to the obtained clusters includes:
according to the number of the candidate nodes included in each obtained cluster, arranging each cluster according to the sequence of the number of the candidate nodes from large to small;
if the number of the candidate nodes included in the top-ranked cluster is equal to the preset number, all the candidate nodes in the top-ranked cluster are used as the verification nodes;
and if the number of the candidate nodes included in the first-order cluster is smaller than the preset number, sequentially selecting the verification nodes from the clusters according to the arrangement sequence of the clusters until the number of the selected verification nodes meets the preset number.
In one possible embodiment, the address information comprises an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is greater than the preset number, the method further includes:
determining a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes arranged in the first cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes included in the top sub-cluster is equal to the preset number, all the candidate nodes in the top sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the preset number, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
In one possible embodiment, the address information comprises an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is smaller than the preset number, when the verification node is selected from the ith cluster, the method further includes:
if the number of the candidate nodes included in the ith cluster is greater than the number of the verification nodes to be selected, i is an integer greater than 1, and the preset number of verification nodes for participating in data verification in the target network fragment is determined according to the following mode:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes in the ith cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes in the first sub-cluster is equal to the number of the verification nodes to be selected, all the candidate nodes in the first sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the number of the verification nodes to be selected, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
In one possible embodiment, the method further comprises:
if the number of candidate nodes included in the first target sub-cluster obtained by the first-order cluster meets a second preset condition, determining a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
arranging each candidate node according to the network delay time of each candidate node in the first target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the first target sub-cluster until the total number of the selected verification nodes meets the preset number;
wherein, the first target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the jth bit in each sub-cluster, and j is an integer greater than 1; the second preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the preset number; or the number of the candidate nodes included in the first sub-cluster is less than the preset number, the verification node is selected from the jth sub-cluster, and the number of the candidate nodes included in the jth sub-cluster is greater than the number of the verification nodes to be selected.
In one possible embodiment, the method further comprises:
if the number of candidate nodes included in a second target sub-cluster obtained from the ith cluster meets a third preset condition, determining a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
arranging each candidate node according to the network delay time of each candidate node in the second target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the second target sub-cluster until the total number of the selected verification nodes meets the preset number;
the second target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the kth position in each sub-cluster, and k is an integer greater than 1; the third preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the number of the verification nodes to be selected; or the number of the candidate nodes included in the first sub-cluster is less than the number of the verification nodes to be selected, the verification nodes are selected from the k-th sub-cluster, and the number of the candidate nodes included in the k-th sub-cluster is greater than the number of the verification nodes to be selected.
In one possible implementation, the target node determines the network delay time of each candidate node in the target network slice according to the following:
respectively sending echo request messages to all candidate nodes in the target network fragment, and receiving echo responses sent by all the candidate nodes;
and aiming at each candidate node in the candidate nodes, determining the network delay time of the candidate node according to the time difference between the sending of the echo request message to the candidate node and the receiving of the echo response of the candidate node.
In one possible embodiment, the determining the first master node in the blockchain network includes:
and determining the first main node as the target node if the first random value generated by the target node and the first random values generated by other candidate nodes meet a preset size relationship according to the first random value generated by the target node and the first random values generated by other candidate nodes.
In a possible embodiment, the preset size relationship includes any one of the following:
the first random values generated by other candidate nodes are all larger than the first random value generated by the target node;
the first random values generated by other candidate nodes are smaller than the first random value generated by the target node.
In a possible implementation, the dividing the candidate nodes in the blockchain network into different network segments includes:
generating a random seed according to a second random value generated by the target node and second random values generated by other candidate nodes;
and according to the random seeds, dividing each candidate node into different network fragments.
In a possible implementation manner, the dividing, according to the random seed, each candidate node into different network segments respectively includes:
determining a third random value corresponding to the first candidate node according to the random seed and a preset random function aiming at the first node in each candidate node;
aiming at any one of the other candidate nodes except the first node, generating a third random value corresponding to the candidate node according to the third random value corresponding to the last candidate node of the candidate node; wherein, each third random value is matched with the serial number of one network fragment;
and aiming at each candidate node, distributing the candidate node to the network fragment matched with the third random value corresponding to the candidate node according to the third random value corresponding to the candidate node.
In a possible implementation, before determining the first master node in the blockchain network, the method further includes:
acquiring a public key and a signature of each candidate node, wherein the signature is encrypted information of an IP address encrypted by using a private key of the candidate node;
verifying the signature of the candidate node according to the public key of the candidate node;
and if the verification is passed, obtaining the IP address of the candidate node from the signature, and acquiring the geographical position of the candidate node according to the IP address.
In a possible embodiment, the verifying the signature of the candidate node according to the public key of the candidate node includes:
decrypting the signature of the candidate node by using the public key of the candidate node;
if the decryption is successful, analyzing the IP address in the signature of the candidate node, and judging whether the IP address of the candidate node is consistent with the IP address in the signature when the connection is established with the candidate node;
and if so, determining that the signature of the candidate node passes the verification.
In a second aspect, an embodiment of the present application provides a fragmentation device based on a blockchain, where the fragmentation device is applied to a target node in a blockchain network, and the device includes:
the fragmentation module is used for determining a first main node in the block chain network, and if the first main node is the target node, dividing each candidate node in the block chain network into different network fragments respectively;
a first determining module, configured to determine a second master node in a target network segment where the target node is located;
a second determining module, configured to determine, if the second master node is the target node, a verification node in the target network segment for participating in data verification based on address information and/or network delay time of each candidate node in the target network segment.
In a possible design, when determining, based on address information of each candidate node in the target network segment, a verification node in the target network segment for participating in data verification, the second determining module is specifically configured to:
dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network fragment;
and determining a preset number of verification nodes for participating in data verification in the target network fragment according to the obtained clusters.
In one possible design, the address information includes a geographic location;
the second determining module, when dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network segment, is specifically configured to:
dividing the candidate nodes with the geographic positions in the same geographic region range into the same cluster according to the geographic positions of the candidate nodes in the target network segment;
the second determining module, when determining a preset number of verification nodes for participating in data verification in the target network segment according to the obtained clusters, is specifically configured to:
according to the number of the candidate nodes included in each obtained cluster, arranging each cluster according to the sequence of the number of the candidate nodes from large to small;
if the number of the candidate nodes included in the top-ranked cluster is equal to the preset number, all the candidate nodes in the top-ranked cluster are used as the verification nodes;
and if the number of the candidate nodes included in the first-order cluster is smaller than the preset number, sequentially selecting the verification nodes from the clusters according to the arrangement sequence of the clusters until the number of the selected verification nodes meets the preset number.
In one possible design, the address information includes an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is greater than the preset number, the second determining module determines a preset number of verification nodes for participating in data verification in the target network segment according to the following method:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes arranged in the first cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes included in the top sub-cluster is equal to the preset number, all the candidate nodes in the top sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the preset number, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
In one possible design, the address information includes an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is smaller than the preset number, when the verification node is selected from the ith cluster, the second determining module is specifically configured to:
if the number of the candidate nodes included in the ith cluster is greater than the number of the verification nodes to be selected, i is an integer greater than 1, and the preset number of verification nodes for participating in data verification in the target network fragment is determined according to the following mode:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes in the ith cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes in the first sub-cluster is equal to the number of the verification nodes to be selected, all the candidate nodes in the first sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the number of the verification nodes to be selected, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
In one possible design, the apparatus further includes:
if the number of candidate nodes included in the first target sub-cluster obtained by the first-order cluster meets a second preset condition, the second determining module determines a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
arranging each candidate node according to the network delay time of each candidate node in the first target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the first target sub-cluster until the total number of the selected verification nodes meets the preset number;
wherein, the first target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the jth bit in each sub-cluster, and j is an integer greater than 1; the second preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the preset number; or the number of the candidate nodes included in the first sub-cluster is less than the preset number, the verification node is selected from the jth sub-cluster, and the number of the candidate nodes included in the jth sub-cluster is greater than the number of the verification nodes to be selected.
In one possible design, the apparatus further includes:
if the number of candidate nodes included in a second target sub-cluster obtained from the ith cluster meets a third preset condition, the second determining module determines a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
arranging each candidate node according to the network delay time of each candidate node in the second target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the second target sub-cluster until the total number of the selected verification nodes meets the preset number;
the second target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the kth position in each sub-cluster, and k is an integer greater than 1; the third preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the number of the verification nodes to be selected; or the number of the candidate nodes included in the first sub-cluster is less than the number of the verification nodes to be selected, the verification nodes are selected from the k-th sub-cluster, and the number of the candidate nodes included in the k-th sub-cluster is greater than the number of the verification nodes to be selected.
In one possible design, the target node determines the network delay time of each candidate node in the target network slice according to the following:
respectively sending echo request messages to all candidate nodes in the target network fragment, and receiving echo responses sent by all the candidate nodes;
and aiming at each candidate node in the candidate nodes, determining the network delay time of the candidate node according to the time difference between the sending of the echo request message to the candidate node and the receiving of the echo response of the candidate node.
In one possible design, the fragmentation module determines the first master node in the blockchain network according to the following:
and determining the first main node as the target node if the first random value generated by the target node and the first random values generated by other candidate nodes meet a preset size relationship according to the first random value generated by the target node and the first random values generated by other candidate nodes.
In one possible design, the preset size relationship includes any one of:
the first random values generated by other candidate nodes are all larger than the first random value generated by the target node;
the first random values generated by other candidate nodes are smaller than the first random value generated by the target node.
In a possible design, when dividing each candidate node in the blockchain network into different network segments, the segment dividing module is specifically configured to:
generating a random seed according to a second random value generated by the target node and second random values generated by other candidate nodes;
and according to the random seeds, dividing each candidate node into different network fragments.
In a possible design, when dividing each candidate node into different network segments according to the random seed, the segment dividing module is specifically configured to:
determining a third random value corresponding to the first candidate node according to the random seed and a preset random function aiming at the first node in each candidate node;
aiming at any one of the other candidate nodes except the first node, generating a third random value corresponding to the candidate node according to the third random value corresponding to the last candidate node of the candidate node; wherein, each third random value is matched with the serial number of one network fragment;
and aiming at each candidate node, distributing the candidate node to the network fragment matched with the third random value corresponding to the candidate node according to the third random value corresponding to the candidate node.
In one possible design, before determining the first master node in the blockchain network, the method further includes:
the acquisition module is used for acquiring a public key and a signature of each candidate node, wherein the signature is encrypted information of an IP address encrypted by using a private key of the candidate node;
verifying the signature of the candidate node according to the public key of the candidate node;
and if the verification is passed, obtaining the IP address of the candidate node from the signature, and acquiring the geographical position of the candidate node according to the IP address.
In one possible design, when verifying the signature of the candidate node according to the public key of the candidate node, the obtaining module is specifically configured to:
decrypting the signature of the candidate node by using the public key of the candidate node;
if the decryption is successful, analyzing the IP address in the signature of the candidate node, and judging whether the IP address of the candidate node is consistent with the IP address in the signature when the connection is established with the candidate node;
and if so, determining that the signature of the candidate node passes the verification.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when an electronic device runs, the processor and the storage medium communicate with each other through the bus, and the processor executes the machine-readable instructions to perform the steps of the partition chain based fragmentation method according to the first aspect, or any possible implementation manner of the first aspect.
In a fourth aspect, this embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the partition chain based fragmentation method in the foregoing first aspect, or any possible implementation manner of the first aspect.
According to the fragmentation method and device based on the block chain, firstly, a first determined main node divides each candidate node in the block chain network into different network fragments; then determining a second main node in each network fragment; and the second main node in each network fragment determines a verification node for participating in data verification in the network fragment based on the address information and/or the network delay time of each candidate node in the network fragment. By adopting the scheme, each candidate node in the block chain network is firstly distributed to different network fragments, the throughput of the block chain network can be improved by carrying out network fragmentation, and then the verification node used for participating in data verification in each fragment is selected according to the address information and the network delay time of the node in each fragment, so that the delay of each node in the block chain network in data verification can be further reduced, and the real-time performance of the block chain network in data verification is improved.
Furthermore, in the process of distributing each candidate node in the block chain network to different network fragments, the candidate nodes are randomly distributed, so that the safety can be ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 illustrates a block chain fragmentation diagram provided in an embodiment of the present application;
fig. 2 shows a flowchart of a fragmentation method based on a blockchain according to an embodiment of the present application;
fig. 3 shows a flowchart for dividing each candidate node into different network segments in the segmentation method based on the block chain according to the embodiment of the present application;
fig. 4 shows a specific flowchart of dividing each candidate node into different network segments according to a random seed in the fragmentation method based on a block chain according to the embodiment of the present application;
fig. 5 is a flowchart illustrating that, in the partition method based on a block chain according to the embodiment of the present application, a verification node for participating in data verification in a target network partition is determined based on address information of each candidate node in the target network partition;
fig. 6 shows a specific flowchart of determining a preset number of verification nodes for participating in data verification in a target network segment according to each obtained cluster in the segment partitioning method based on a blockchain according to the embodiment of the present application;
fig. 7 is a specific flowchart illustrating a method for partitioning a target network partition according to a block chain according to an embodiment of the present application, where the specific flowchart is used to determine a preset number of verification nodes for participating in data verification in the target network partition;
fig. 8 is a specific flowchart illustrating a method for partitioning a target network partition according to a block chain according to an embodiment of the present application, where the specific flowchart is used to determine a preset number of verification nodes for participating in data verification in the target network partition;
fig. 9 is a specific flowchart illustrating a method for partitioning a target network partition according to a block chain according to an embodiment of the present application, where the specific flowchart is used to determine a preset number of verification nodes for participating in data verification in the target network partition;
fig. 10 is a flowchart illustrating determining network delay times of candidate nodes in a target network segment in a fragmentation method based on a blockchain according to an embodiment of the present application;
fig. 11 shows a flowchart of verifying a signature of a candidate node in a fragmentation method based on a blockchain according to an embodiment of the present application;
fig. 12 is a schematic structural diagram illustrating a slicing apparatus 120 based on a blockchain according to an embodiment of the present application;
fig. 13 shows a schematic structural diagram of an electronic device 130 provided in an embodiment of the present application.
Detailed Description
In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for illustrative and descriptive purposes only and are not used to limit the scope of protection of the present application. Additionally, it should be understood that the schematic drawings are not necessarily drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be performed out of order, and steps without logical context may be performed in reverse order or simultaneously. One skilled in the art, under the guidance of this application, may add one or more other operations to, or remove one or more operations from, the flowchart.
In addition, the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
For the convenience of understanding the present embodiment, an application background of the technical solution provided by the embodiment of the present application is first described in detail.
At present, with the continuous development of the blockchain technology, the blockchain technology is becoming another important technical innovation following cloud computing, big data and artificial intelligence, playing an important role in continuously solving and renovating the core problems of the current internet such as information sharing, data authority confirmation, privacy protection and the like, and playing an important role in creating future efficient business systems, credit systems and social infrastructures. The blockchain technology can be understood as a data structure which packs and stores transactions occurring in a system for a period of time in units of blocks and connects the blocks into a chain in sequence by a cryptographic method.
The block chain network comprises a plurality of nodes, the nodes are basic units for processing data in the block chain network, each node can pack the processed data to generate blocks, and the blocks are connected according to the time sequence to form the block chain. The node is an electronic device having a data processing function, such as a server.
In an example, when the blockchain technology is applied to a network transaction scenario, each node in the blockchain network may be used to verify each transaction, but currently, when the blockchain technology is used to process Transactions in the transaction scenario, the number of Transactions Per Second (TPS) peak of the bitcoin system is generally only about 7, and the TPS peak of the ethernet is substantially about 15, which is far from the 25 ten thousand TPS peak of the current internet payment transaction scenario. In view of the above problems, the existing blockchain technology is to serve more scenarios, such as application scenarios of securities trading, e-commerce, etc., and it is first required to solve the processing performance problem.
The performance problems of the existing block chain technology include two aspects, namely that the expandability of the block chain system is low, and system delay exists. Wherein the lower scalability results in a lower TPS, i.e. a lower throughput, wherein the throughput can be understood as the amount of tasks processed per unit time; the system delay refers to a network delay in data transmission between respective nodes. The two aspects result in that the data processing performance of the block chain technology is limited, and the block chain technology is difficult to be applied to an application scene with a high real-time requirement.
In view of the above problems, the fragmentation technique can be applied to the blockchain network to solve the processing performance problem of the blockchain network. Referring to fig. 1, an idea of applying the fragmentation technique to the blockchain network is to divide the blockchain network having many nodes into a plurality of subblockchain networks, that is, to divide original nodes in the blockchain network into a plurality of "shards" (shards), where each subblockchain network includes a plurality of blocks, and each shard separately maintains one subblockchain network, that is, separately maintains one distributed account book. For example, in a network transaction scenario, the same transaction may be divided into "slices" to be processed, so that different nodes in the slice may process one transaction in parallel, each node only needs to process a small portion of the incoming transaction, and each completely involved node is no longer required to verify each transaction, thereby increasing the concurrence of transaction processing and verification, and increasing the throughput of the entire network.
It should be noted that the existing fragmentation technique only considers the improvement of system throughput and does not pay attention to the system delay problem. Therefore, in practical application scenarios, for example, in the field of shared economy, the corresponding mobile internet service must be supported by a high-throughput low-latency system, and although the throughput problem is solved by using a fragmentation technology, the low latency of the service is more important in scenarios with very high requirements on real-time performance.
For example, nodes in the same segment may be nodes deployed in country a and nodes deployed in country B, and since nodes in the same segment need to be kept consistent when performing transaction verification, a large network delay problem may exist between two nodes with relatively far different geographic locations (for example, network delay from beijing to virginia in china is about 10 times that of a local network in beijing), where the network delay problem will certainly bring a great obstacle to application of a block chain in a scenario with a very high real-time requirement.
In order to solve the above problems, the present application provides a fragmentation method and device based on a blockchain, where each candidate node in a blockchain network is first allocated to different network fragments, the throughput of the blockchain network can be improved by performing network fragmentation, and then a verification node for participating in data verification in each fragment is selected according to address information and network delay time of the node in each fragment, so that delay of each node in the blockchain network in data verification can be further reduced, and the real-time performance of data verification in the blockchain network is improved, thereby improving the processing performance of the blockchain network.
A block chain based fragmentation method provided in an embodiment of the present application is described in detail below.
The fragmentation method based on the blockchain provided by the embodiment of the application is applied to a target node in a blockchain network, wherein the blockchain network comprises a plurality of nodes, and the target node is any one node in the blockchain network. Referring to fig. 2, a schematic flow chart of a fragmentation method based on a blockchain provided in the embodiment of the present application includes the following steps:
s201: and determining a first main node in the block chain network, and if the first main node is a target node, dividing each candidate node in the block chain network into different network fragments.
In some embodiments of the present application, there are many nodes in the block chain network, and each time data verification is performed through a fragmentation technology, a part of nodes may be randomly selected from all nodes in the entire network as candidate nodes, and then the candidate nodes are divided into a plurality of fragments, each fragment includes a verification node for performing data verification in the fragment, where the data verification may be transaction verification or other data verification. The process of screening the verification nodes from each segment will be described in detail later.
In an implementation, the above fragmentation process may be performed by a first master node in a blockchain network. For example, the target node may determine a first master node in the block chain network from the candidate nodes in the following manner, where the first master node is configured to fragment the candidate nodes:
and if the first random value generated by the target node and the first random values generated by other candidate nodes meet the preset size relationship, determining the first main node as the target node.
Specifically, the target node locally runs a preset Random Function, such as a Verifiable Random Function (VRF), to generate a first Random value, and receives the first Random values generated by other candidate nodes in the same manner. And the target node judges whether the generated first random value and the first random values generated by other candidate nodes meet a preset size relationship, and if the first random value generated by the target node and the first random values generated by other candidate nodes meet the preset size relationship, the first main node is determined to be the target node.
Wherein, the preset size relationship comprises any one of the following:
the first random value generated by each other candidate node is larger than the first random value generated by the target node;
the first random values generated by other candidate nodes are smaller than the first random value generated by the target node.
In a specific implementation, after determining the first master node in the blockchain network, if the first master node is a target node, the target node further may divide each candidate node in the blockchain network into different network segments respectively through the following steps, which are specifically shown in fig. 3:
s301: and generating a random seed according to the second random value generated by the target node and the second random values generated by other candidate nodes.
In specific implementation, the target node locally runs a preset random function to generate a second random value, and receives the second random values generated by other candidate nodes in the same manner. And the target node splices the generated second random value with second random values generated by other candidate nodes to generate a random seed.
For example, if the second random value generated by the target node is 123, and the second random values generated by the other candidate nodes are 234, 345 and 456, respectively, then the random seed may be 123234345456. It should be noted that the form of the second random value is not limited herein, and may be any form of random value with any number of bits, and similarly, the form of the random seed may also be obtained by other concatenation methods.
The generation of the random seeds is related to each candidate node, and is not only generated according to the target node, so that the sufficient randomness of the random seeds can be ensured, and the influence on the subsequent fragmentation process when the target node is attacked is prevented.
S302: and according to the random seeds, dividing each candidate node into different network fragments.
In specific implementation, referring to fig. 4, the target node divides each candidate node into different network segments according to the random seeds through the following steps:
s401: determining a third random value corresponding to the first candidate node according to the random seed and a preset random function aiming at the first node in each candidate node;
s402: aiming at any one of the other candidate nodes except the first node, generating a third random value corresponding to the candidate node according to the third random value corresponding to the last candidate node of the candidate node;
wherein, each third random value is matched with the serial number of one network fragment;
s403: and aiming at each candidate node, distributing the candidate node to the network fragment matched with the third random value corresponding to the candidate node according to the third random value corresponding to the candidate node.
Before the above steps are implemented, the target node first needs to randomly sort each candidate node (including the target node itself) to obtain the serial number of each candidate node, and also needs to randomly sort each network fragment to obtain the serial number of each network fragment.
When each candidate node is fragmented according to the random seeds, first, a first third random value is generated by using the random seeds, the candidate node ranked at the head is distributed to the network fragments matched with the first third random value, then, for any one of the candidate nodes except the first node ranked at the head, a third random value corresponding to the candidate node is generated by using the third random value corresponding to the last candidate node of the candidate node, and finally, each candidate node is distributed to the network fragments matched with the third random values. Because different inputs can generate different outputs when the preset random function runs, the third random value generated by the steps aiming at each candidate node is randomly generated, so that random fragmentation can be fully ensured when each candidate node is fragmented, and the safety of the whole block chain is further ensured.
After the candidate nodes are respectively divided into different network segments in the above manner, steps S202 and S203 may be further performed.
S202: and determining a second main node in the target network fragment where the target node is located.
Here, since the target node is any one node, accordingly, the target network segment to which the target node belongs is also equivalent to any one network segment.
In specific implementation, with reference to the manner of determining the first master node in the block chain network from each candidate node in the foregoing, the second master node in the target network segment where the target node is located may be determined.
S203: and if the second main node is the target node, determining a verification node for participating in data verification in the target network fragment based on the address information and/or the network delay time of each candidate node in the target network fragment.
In one possible implementation, referring to fig. 5, the target node determines the verification node in the target network segment for participating in data verification based on the address information of each candidate node in the target network segment by:
s501: and dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network fragment.
In one possible implementation, the address information includes a geographic location. For example, the geographic location may include a continent, country, province, latitude and longitude information, etc. of where the candidate node is located.
In specific implementation, the target node may divide the candidate nodes whose geographic positions are within the same geographic area range into the same cluster according to the geographic position of each candidate node in the target network segment.
For example, candidate nodes with geographic positions in the same continent may be classified into the same cluster, candidate nodes with geographic positions in the same country may be classified into the same cluster, and the like, and clustering may be performed according to the actual conditions of the geographic positions where all the obtained candidate nodes are respectively located, if all the candidate nodes are located in asia, clustering may be performed according to the country, and if all the candidate nodes are located in asia, clustering may be performed according to the continent, and the like.
S502: and determining a preset number of verification nodes for participating in data verification in the target network fragment according to the obtained clusters.
In the embodiment of the present application, the method for determining the verification node for participating in data verification in the target network segment includes the following several implementation manners:
the first implementation mode comprises the following steps:
referring to fig. 6, the preset number of verification nodes for participating in data verification in the target network segment may be determined according to the obtained clusters through the following steps:
s601: and arranging the clusters according to the sequence of the number of the candidate nodes from large to small according to the number of the candidate nodes included in each cluster.
For example, there are 3 clusters in total, 100 candidate nodes in cluster 1, 80 candidate nodes in cluster 2, and 50 candidate nodes in cluster 3. The sequence obtained by arranging the candidate nodes from large to small is cluster 1, cluster 2 and cluster 3.
S602: and if the number of the candidate nodes in the first-order cluster is equal to the preset number, all the candidate nodes in the first-order cluster are used as verification nodes.
Here, in the embodiment of the present application, a preset number of verification nodes needs to be screened from each fragment to participate in data verification of the fragment, for example, the preset number is g.
For example, if g is 100 and the number of candidate nodes included in the top cluster 1 is exactly equal to 100, all candidate nodes in the top cluster are used as verification nodes.
S603: and if the number of the candidate nodes included in the first-order cluster is greater than the preset number, selecting the verification nodes from the first-order cluster until the number of the selected verification nodes meets the preset number.
For example, if the number of candidate nodes included in the top-ranked cluster 1 is 100 and greater than 80, 80 verification nodes are selected from the top-ranked cluster 1.
S604: and if the number of the candidate nodes included in the first-order cluster is less than the preset number, sequentially selecting verification nodes from each cluster according to the arrangement sequence of each cluster until the number of the selected verification nodes meets the preset number.
For example, if the number of candidate nodes included in the top cluster 1 is 100 and is less than 150, the verification nodes are sequentially selected from the clusters according to the arrangement order of the clusters until the number of the selected verification nodes satisfies the preset number.
In this embodiment, the address information may further include an internet protocol IP address.
For step S603, in a specific implementation, a verification node may be selected based on the IP address information of each candidate node, which is specifically shown in the second embodiment.
The second embodiment:
referring to fig. 7, the preset number of authentication nodes participating in data authentication in the target network segment may be determined according to the following steps:
s701: and dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes arranged in the first cluster.
For example, the cluster arranged at the head is divided into 3 sub-clusters according to the IP addresses of the candidate nodes in the cluster, and the IP addresses of the candidate nodes in each sub-cluster are in the same network segment.
It should be noted that when performing sub-clustering according to the IP addresses of the candidate nodes, the candidate nodes of adjacent network segments may also be divided into the same sub-cluster, and the sub-clustering is specifically performed according to the actual situation.
S702: and arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small.
For example, there are 100 candidate nodes in cluster 1, 50 candidate nodes in sub-cluster 1, 30 candidate nodes in sub-cluster 2, and 20 candidate nodes in sub-cluster 3, which are arranged first. The sequence obtained by arranging the candidate nodes in the sub-clusters from large to small is sub-cluster 1, sub-cluster 2 and sub-cluster 3.
S703: and if the number of the candidate nodes in the first sub-cluster is equal to the preset number, all the candidate nodes in the first sub-cluster are used as verification nodes.
For example, if the number of candidate nodes included in the top sub-cluster 1 is exactly 50, g is 50, all candidate nodes in the top sub-cluster are used as verification nodes.
S704: and if the number of the candidate nodes included in the first sub-cluster is greater than the preset number, sequentially selecting the verification nodes from the first sub-cluster until the number of the selected verification nodes meets the preset number.
For example, if g is 40, the number of candidate nodes included in the top sub-cluster 1 is 50, and is greater than 40, 40 verification nodes are sequentially selected from the top sub-cluster 1.
In this embodiment of the application, for step S704, in a specific implementation, the verification node may be further selected based on a network delay time of each candidate node, which is specifically shown in the third embodiment.
The third embodiment is as follows:
in a specific implementation, if the number of candidate nodes included in the top sub-cluster is greater than a preset number, the top sub-cluster is used as a first target sub-cluster, and referring to fig. 8, the preset number of verification nodes for participating in data verification in the target network segment may be determined according to the following manner:
s801: arranging each candidate node according to the network delay time of each candidate node in the first target sub-cluster and the sequence of the network delay time from small to large;
s802: and sequentially selecting the verification nodes from the first target sub-cluster until the total number of the selected verification nodes meets the preset number.
For example, if g is 40, the number of candidate nodes included in the first sub-cluster 1 is 50, and if g is greater than 40, the 50 candidate nodes included in the sub-cluster 1 are sorted in the order of decreasing network delay time to increasing network delay time, and the first 40 candidate nodes are used as verification nodes.
S705: and if the number of the candidate nodes included in the first sub-cluster is less than the preset number, sequentially selecting verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
For example, if g is 90, the number of candidate nodes included in the top sub-cluster 1 is 50, and is less than 90, then verification nodes are sequentially selected from the sub-clusters according to the arrangement order of the sub-clusters, for example, after 50 candidate nodes arranged in the top sub-cluster 1 are used as verification nodes, then verification nodes are selected from the jth sub-cluster, and j is an integer greater than 1. For example, if 30 candidate nodes exist in the 2 nd sub-cluster, and the sum of 50 and 30 is still smaller than 90, then the verification nodes are selected from the 3 rd sub-cluster, for example, 20 candidate nodes exist in the 3 rd sub-cluster, and only 10 verification nodes need to be selected from the 3 rd sub-cluster.
At this time, the 3 rd sub-cluster may be used as the first target sub-cluster, and the verification nodes are selected based on the network delay time of each candidate node, specifically, with reference to the step shown in fig. 8, 10 verification nodes are selected from the 3 rd sub-cluster, and finally, the total number of the selected verification nodes is equal to g.
Through the above process, the specific implementation process of selecting the verification node from the top-ranked cluster in step S603 may be implemented if the number of candidate nodes included in the top-ranked cluster is greater than the preset number.
For step S604, in a specific implementation, the verification node may be further selected based on the network delay time of each candidate node, which is specifically shown in the fourth embodiment.
The fourth embodiment:
referring to fig. 9, when a verification node is selected from an ith cluster of each cluster, if the number of candidate nodes included in the ith cluster is greater than the number of verification nodes to be selected, a preset number of verification nodes for participating in data verification in a target network segment may be determined according to the following steps:
s901: dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes in the ith cluster;
s902: according to the number of the candidate nodes included in each obtained sub-cluster, arranging each sub-cluster according to the sequence of the number of the candidate nodes from large to small;
s903: if the number of the candidate nodes in the first sub-cluster is equal to the number of the verification nodes to be selected, all the candidate nodes in the first sub-cluster are used as the verification nodes;
s904: and if the number of the candidate nodes included in the first sub-cluster is greater than the number of the verification nodes to be selected, sequentially selecting the verification nodes from the first sub-cluster until the number of the selected verification nodes meets the preset number.
For example, the number of remaining verification nodes to be selected is 50, the number of candidate nodes included in the first sub-cluster 1 in the ith cluster is 60, and if the number of candidate nodes is greater than 50, 50 verification nodes are sequentially selected from the first sub-cluster 1.
In a specific implementation, if the number of candidate nodes included in the top sub-cluster is greater than the preset number, the top sub-cluster is used as the second target sub-cluster, and referring to the steps shown in fig. 8, 50 verification nodes to be selected are selected from the top sub-cluster, and finally, the total number of the selected verification nodes is equal to g.
S905: and if the number of the candidate nodes included in the first sub-cluster is less than the number of the verification nodes to be selected, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
For example, the number of verification nodes to be selected is 50, the number of candidate nodes included in the first sub-cluster 1 in the ith cluster is 40, and is less than 50, the verification nodes to be selected are sequentially selected from the sub-clusters according to the arrangement sequence of the sub-clusters, for example, after the 50 candidate nodes arranged in the first sub-cluster 1 are used as the verification nodes, the verification nodes are selected from the kth sub-cluster, and k is an integer greater than 1. For example, after 40 candidate nodes arranged in the first sub-cluster 1 are used as verification nodes, the verification nodes are selected from the 2 nd sub-cluster, for example, 40 candidate nodes in the 2 nd sub-cluster are 40, 40 plus 40 is greater than 50, and only 10 verification nodes are selected from the 2 nd sub-cluster.
At this time, the 2 nd sub-cluster may be used as the second target sub-cluster, and 10 verification nodes may be selected from the 2 nd sub-cluster by referring to the steps shown in fig. 8, so that the total number of the selected verification nodes is equal to g.
Through the above process, the specific implementation process of step S604, in which the verification nodes are sequentially selected from each cluster according to the arrangement order of each cluster until the number of the selected verification nodes meets the preset number, can be implemented.
The fifth embodiment:
if the number of candidate nodes included in the first-order cluster is smaller than the preset number, and when the difference is smaller, for example, g is 150, the number of candidate nodes included in the first-order cluster 1 is 140, and 10 verification nodes to be selected remain, when the number of candidate nodes included in the second-order cluster 2 is greater than 10, for example, 100, it is no longer necessary to divide the candidate nodes included in the cluster 2 into a plurality of sub-clusters according to the IP addresses, and it is sufficient to directly select 10 IP addresses from other clusters and candidate nodes whose IP addresses included in the first-order cluster are in the same network segment or an adjacent network segment.
In one possible implementation, the target node may determine the verification node in the target network segment for participating in data verification based on the network delay time of each candidate node in the target network segment by:
and arranging the network delay time of each candidate node from small to large according to the network delay time of each candidate node, and sequentially selecting verification nodes for participating in data verification.
It should be noted that, in this way, the nodes are only screened and verified according to the network delay time of each candidate node in the target network segment, and the real-time performance of the obtained system is not as high as that of the obtained system according to the address information or the two ways of the address information and the network delay time.
In one possible implementation, referring to fig. 10, the target node may determine the network delay time of each candidate node in the target network segment according to the following steps:
s1001: and respectively sending echo request messages to each candidate node in the target network fragment, and receiving echo responses sent by each candidate node.
For example, the echo request messages respectively sent to the candidate nodes in the target network segment may be Internet Packet searchers (PING). PING is a command under Windows, Unix and Linux systems, also belongs to a communication Protocol, and is a part of TCP (Transmission Control Protocol)/IP Protocol.
After a PING command is sent to each candidate node in the target network segment, each candidate node automatically sends an echo response to the target node.
S1002: and for each candidate node in each candidate node, determining the network delay time of the candidate node according to the time difference between the sending of the echo request message to the candidate node and the receiving of the echo response of the candidate node.
In a possible implementation manner, before the target node acquires the address information of each candidate node, security verification needs to be performed on each candidate node, so that the IP address of the candidate node establishing connection with the target node is prevented from being spoofed. Before the fragmentation method based on the block chain provided by the embodiment of the application is operated, each node in the network needs to register its own public key and signature on the identity chain of the block chain and broadcast the identity chain to other candidate nodes, wherein the signature is the encrypted information of the IP address encrypted by using the private key of the candidate node.
When the target node verifies each candidate node, receiving the public key and the signature of the candidate node sent to the target node by the candidate node, or acquiring the public key and the signature of the candidate node from the identity chain, and then verifying the signature of the candidate node according to the public key of the candidate node; if the verification is passed, obtaining the IP address of the candidate node from the signature, obtaining the geographic position of the candidate node according to the IP address, and obtaining the time zone, operator and CIDR (class Inter-Domain Routing) information of the candidate node according to the IP address.
In a specific implementation, referring to fig. 11, the signature of the candidate node may be verified through the following steps:
s1101: decrypting the signature of the candidate node by using the public key of the candidate node;
s1102: if the decryption is successful, analyzing the IP address in the signature of the candidate node, and judging whether the IP address of the candidate node is consistent with the IP address in the signature when the connection is established with the candidate node;
s1103: and if so, determining that the signature of the candidate node passes the verification.
After the verification nodes for participating in data verification in each network fragment are determined through the process, the verification nodes in each network fragment can run a consensus algorithm in the fragment to verify the data.
According to the partitioning method based on the block chain, each candidate node in the block chain network is firstly distributed to different network partitions, the throughput of the block chain network can be improved by carrying out network partitioning, and then verification nodes used for participating in data verification in each partition are selected according to the address information and the network delay time of the nodes in each partition, so that the delay of each node in the block chain network in data verification can be further reduced, and the real-time performance of the block chain network in data verification is improved.
Furthermore, in the process of distributing each candidate node in the block chain network to different network fragments, the candidate nodes are randomly distributed, so that the safety can be ensured.
Based on the same technical concept, the embodiment of the present application further provides a device for partitioning based on a block chain, which corresponds to the method for partitioning based on a block chain.
Referring to fig. 12, a schematic structural diagram of a slicing apparatus 120 based on a blockchain according to an embodiment of the present application includes:
a fragmentation module 121, configured to determine a first master node in the blockchain network, and if the first master node is the target node, divide each candidate node in the blockchain network into different network fragments respectively;
a first determining module 122, configured to determine a second master node in a target network segment where the target node is located;
a second determining module 123, configured to determine, if the second master node is the target node, a verification node in the target network segment for participating in data verification based on address information and/or network delay time of each candidate node in the target network segment.
In a possible design, when determining, based on address information of each candidate node in the target network segment, a verification node in the target network segment for participating in data verification, the second determining module 123 is specifically configured to:
dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network fragment;
and determining a preset number of verification nodes for participating in data verification in the target network fragment according to the obtained clusters.
In one possible design, the address information includes a geographic location;
the second determining module 123, when dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network segment, is specifically configured to:
dividing the candidate nodes with the geographic positions in the same geographic region range into the same cluster according to the geographic positions of the candidate nodes in the target network segment;
the second determining module 123, when determining, according to each obtained cluster, a preset number of verification nodes for participating in data verification in the target network segment, is specifically configured to:
according to the number of the candidate nodes included in each obtained cluster, arranging each cluster according to the sequence of the number of the candidate nodes from large to small;
if the number of the candidate nodes included in the top-ranked cluster is equal to the preset number, all the candidate nodes in the top-ranked cluster are used as the verification nodes;
and if the number of the candidate nodes included in the first-order cluster is smaller than the preset number, sequentially selecting the verification nodes from the clusters according to the arrangement sequence of the clusters until the number of the selected verification nodes meets the preset number.
In one possible design, the address information includes an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is greater than the preset number, the second determining module 123 determines, according to the following manner, a preset number of verification nodes for participating in data verification in the target network segment:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes arranged in the first cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes included in the top sub-cluster is equal to the preset number, all the candidate nodes in the top sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the preset number, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
In one possible design, the address information includes an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is smaller than the preset number, when the verification node is selected from the ith cluster, the second determining module 123 is specifically configured to:
if the number of the candidate nodes included in the ith cluster is greater than the number of the verification nodes to be selected, i is an integer greater than 1, and the preset number of verification nodes for participating in data verification in the target network fragment is determined according to the following mode:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes in the ith cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes in the first sub-cluster is equal to the number of the verification nodes to be selected, all the candidate nodes in the first sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the number of the verification nodes to be selected, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
In one possible design, the apparatus further includes:
if the number of candidate nodes included in the first target sub-cluster obtained by arranging the first clusters meets a second preset condition, the second determining module 123 determines a preset number of verification nodes for participating in data verification in the target network segment according to the following manner:
arranging each candidate node according to the network delay time of each candidate node in the first target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the first target sub-cluster until the total number of the selected verification nodes meets the preset number;
wherein, the first target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the jth bit in each sub-cluster, and j is an integer greater than 1; the second preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the preset number; or the number of the candidate nodes included in the first sub-cluster is less than the preset number, the verification node is selected from the jth sub-cluster, and the number of the candidate nodes included in the jth sub-cluster is greater than the number of the verification nodes to be selected.
In one possible design, the apparatus further includes:
if the number of candidate nodes included in the second target sub-cluster obtained in the ith cluster meets a third preset condition, the second determining module 123 determines a preset number of verification nodes for participating in data verification in the target network segment according to the following manner:
arranging each candidate node according to the network delay time of each candidate node in the second target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the second target sub-cluster until the total number of the selected verification nodes meets the preset number;
the second target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the kth position in each sub-cluster, and k is an integer greater than 1; the third preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the number of the verification nodes to be selected; or the number of the candidate nodes included in the first sub-cluster is less than the number of the verification nodes to be selected, the verification nodes are selected from the k-th sub-cluster, and the number of the candidate nodes included in the k-th sub-cluster is greater than the number of the verification nodes to be selected.
In one possible design, the target node determines the network delay time of each candidate node in the target network slice according to the following:
respectively sending echo request messages to all candidate nodes in the target network fragment, and receiving echo responses sent by all the candidate nodes;
and aiming at each candidate node in the candidate nodes, determining the network delay time of the candidate node according to the time difference between the sending of the echo request message to the candidate node and the receiving of the echo response of the candidate node.
In one possible design, the fragmentation module 121 determines the first master node in the blockchain network according to the following:
and determining the first main node as the target node if the first random value generated by the target node and the first random values generated by other candidate nodes meet a preset size relationship according to the first random value generated by the target node and the first random values generated by other candidate nodes.
In one possible design, the preset size relationship includes any one of:
the first random values generated by other candidate nodes are all larger than the first random value generated by the target node;
the first random values generated by other candidate nodes are smaller than the first random value generated by the target node.
In a possible design, when dividing each candidate node in the blockchain network into different network slices, the slicing module 121 is specifically configured to:
generating a random seed according to a second random value generated by the target node and second random values generated by other candidate nodes;
and according to the random seeds, dividing each candidate node into different network fragments.
In a possible design, when dividing each candidate node into different network segments according to the random seed, the segmentation module 121 is specifically configured to:
determining a third random value corresponding to the first candidate node according to the random seed and a preset random function aiming at the first node in each candidate node;
aiming at any one of the other candidate nodes except the first node, generating a third random value corresponding to the candidate node according to the third random value corresponding to the last candidate node of the candidate node; wherein, each third random value is matched with the serial number of one network fragment;
and aiming at each candidate node, distributing the candidate node to the network fragment matched with the third random value corresponding to the candidate node according to the third random value corresponding to the candidate node.
In one possible design, before determining the first master node in the blockchain network, the method further includes:
an obtaining module 124, configured to obtain, for each candidate node, a public key and a signature of the candidate node, where the signature is encrypted information of an IP address that is encrypted by using a private key of the candidate node;
verifying the signature of the candidate node according to the public key of the candidate node;
and if the verification is passed, obtaining the IP address of the candidate node from the signature, and acquiring the geographical position of the candidate node according to the IP address.
In a possible design, when verifying the signature of the candidate node according to the public key of the candidate node, the obtaining module 124 is specifically configured to:
decrypting the signature of the candidate node by using the public key of the candidate node;
if the decryption is successful, analyzing the IP address in the signature of the candidate node, and judging whether the IP address of the candidate node is consistent with the IP address in the signature when the connection is established with the candidate node;
and if so, determining that the signature of the candidate node passes the verification.
According to the fragmentation device based on the block chain, each candidate node in the block chain network is firstly distributed to different network fragments, the throughput of the block chain network can be improved by carrying out network fragmentation, and then verification nodes used for participating in data verification in each fragment are selected according to the address information and the network delay time of the nodes in each fragment, so that the delay of each node in the block chain network in data verification can be further reduced, and the real-time performance of the block chain network in data verification is improved.
Furthermore, in the process of distributing each candidate node in the block chain network to different network fragments, the candidate nodes are randomly distributed, so that the safety can be ensured.
Based on the same technical concept, the embodiment of the application also provides an electronic device 130. Referring to fig. 13, an electronic device 130 provided in the embodiment of the present application includes a processor 131, a memory 132, and a bus 133.
The memory 132 stores machine-readable instructions executable by the processor 131 (such as execution instructions corresponding to the fragmentation module 121, the first determination module 122, the second determination module 123, and the obtaining module 124 in fig. 12, etc.), when the electronic device 130 is running, the processor 131 and the memory 132 communicate via the bus 133, and when the processor 131 executes the following processes:
determining a first main node in the block chain network, and if the first main node is the target node, dividing each candidate node in the block chain network into different network fragments;
determining a second main node in a target network fragment where the target node is located;
if the second master node is the target node, determining a verification node for participating in data verification in the target network fragment based on address information and/or network delay time of each candidate node in the target network fragment.
The specific processing flow of the processor 131 may refer to the description of the above embodiments, and is not described herein again.
Based on the same technical concept, embodiments of the present application further provide a computer-readable storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the steps of the partition chain based fragmentation method.
Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, and the like, and when a computer program on the storage medium is executed, the above fragmentation method based on the blockchain can be executed, so that each candidate node in the blockchain network can be firstly allocated to different network fragments, throughput of the blockchain network can be improved by performing network fragmentation, and then a verification node for participating in data verification in each fragment is selected according to address information and network delay time of the node in each fragment, so that delay of each node in the blockchain network in data verification can be further reduced, and real-time performance of data verification in the blockchain network is improved.
Furthermore, in the process of distributing each candidate node in the block chain network to different network fragments, the candidate nodes are randomly distributed, so that the safety can be ensured.
The computer program product of the partition method based on the block chain provided in the embodiment of the present application includes a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method in the foregoing method embodiment, and specific implementation may refer to the method embodiment, and is not described herein again.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again. In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (30)

1. A block chain based fragmentation method is applied to a target node in a block chain network, and comprises the following steps:
determining a first main node in the block chain network, and if the first main node is the target node, dividing each candidate node in the block chain network into different network fragments;
determining a second main node in a target network fragment where the target node is located;
if the second master node is the target node, determining a verification node for participating in data verification in the target network fragment based on address information and/or network delay time of each candidate node in the target network fragment.
2. The method of claim 1, wherein the determining the verification node in the target network segment for participating in data verification based on address information of each candidate node in the target network segment comprises:
dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network fragment;
and determining a preset number of verification nodes for participating in data verification in the target network fragment according to the obtained clusters.
3. The method of claim 2, wherein the address information comprises a geographic location;
the dividing, according to address information where each candidate node in the target network segment is located, each candidate node into at least one cluster includes:
dividing the candidate nodes with the geographic positions in the same geographic region range into the same cluster according to the geographic positions of the candidate nodes in the target network segment;
the determining a preset number of verification nodes for participating in data verification in the target network segment according to the obtained clusters includes:
according to the number of the candidate nodes included in each obtained cluster, arranging each cluster according to the sequence of the number of the candidate nodes from large to small;
if the number of the candidate nodes included in the top-ranked cluster is equal to the preset number, all the candidate nodes in the top-ranked cluster are used as the verification nodes;
and if the number of the candidate nodes included in the first-order cluster is smaller than the preset number, sequentially selecting the verification nodes from the clusters according to the arrangement sequence of the clusters until the number of the selected verification nodes meets the preset number.
4. The method of claim 3, wherein the address information includes an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is greater than the preset number, the method further includes:
determining a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes arranged in the first cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes included in the top sub-cluster is equal to the preset number, all the candidate nodes in the top sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the preset number, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
5. The method of claim 3, wherein the address information includes an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is smaller than the preset number, when the verification node is selected from the ith cluster, the method further includes:
if the number of the candidate nodes included in the ith cluster is greater than the number of the verification nodes to be selected, i is an integer greater than 1, and the preset number of verification nodes for participating in data verification in the target network fragment is determined according to the following mode:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes in the ith cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes in the first sub-cluster is equal to the number of the verification nodes to be selected, all the candidate nodes in the first sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the number of the verification nodes to be selected, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
6. The method of claim 4, wherein the method further comprises:
if the number of candidate nodes included in the first target sub-cluster obtained by the first-order cluster meets a second preset condition, determining a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
arranging each candidate node according to the network delay time of each candidate node in the first target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the first target sub-cluster until the total number of the selected verification nodes meets the preset number;
wherein, the first target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the jth bit in each sub-cluster, and j is an integer greater than 1; the second preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the preset number; or the number of the candidate nodes included in the first sub-cluster is less than the preset number, the verification node is selected from the jth sub-cluster, and the number of the candidate nodes included in the jth sub-cluster is greater than the number of the verification nodes to be selected.
7. The method of claim 5, wherein the method further comprises:
if the number of candidate nodes included in a second target sub-cluster obtained from the ith cluster meets a third preset condition, determining a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
arranging each candidate node according to the network delay time of each candidate node in the second target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the second target sub-cluster until the total number of the selected verification nodes meets the preset number;
the second target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the kth position in each sub-cluster, and k is an integer greater than 1; the third preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the number of the verification nodes to be selected; or the number of the candidate nodes included in the first sub-cluster is less than the number of the verification nodes to be selected, the verification nodes are selected from the k-th sub-cluster, and the number of the candidate nodes included in the k-th sub-cluster is greater than the number of the verification nodes to be selected.
8. The method of claim 1, wherein the target node determines the network delay time of each candidate node in the target network slice according to:
respectively sending echo request messages to all candidate nodes in the target network fragment, and receiving echo responses sent by all the candidate nodes;
and aiming at each candidate node in the candidate nodes, determining the network delay time of the candidate node according to the time difference between the sending of the echo request message to the candidate node and the receiving of the echo response of the candidate node.
9. The method of claim 1, wherein the determining the first master node in the blockchain network comprises:
and determining the first main node as the target node if the first random value generated by the target node and the first random values generated by other candidate nodes meet a preset size relationship according to the first random value generated by the target node and the first random values generated by other candidate nodes.
10. The method of claim 9, wherein the predetermined size relationship comprises any one of:
the first random values generated by other candidate nodes are all larger than the first random value generated by the target node;
the first random values generated by other candidate nodes are smaller than the first random value generated by the target node.
11. The method of claim 1, wherein the partitioning the candidate nodes in the blockchain network into different network slices respectively comprises:
generating a random seed according to a second random value generated by the target node and second random values generated by other candidate nodes;
and according to the random seeds, dividing each candidate node into different network fragments.
12. The method of claim 11, wherein the dividing the candidate nodes into different network segments according to the random seed comprises:
determining a third random value corresponding to the first candidate node according to the random seed and a preset random function aiming at the first node in each candidate node;
aiming at any one of the other candidate nodes except the first node, generating a third random value corresponding to the candidate node according to the third random value corresponding to the last candidate node of the candidate node; wherein, each third random value is matched with the serial number of one network fragment;
and aiming at each candidate node, distributing the candidate node to the network fragment matched with the third random value corresponding to the candidate node according to the third random value corresponding to the candidate node.
13. The method of claim 1, prior to determining the first master node in the blockchain network, further comprising:
acquiring a public key and a signature of each candidate node, wherein the signature is encrypted information of an IP address encrypted by using a private key of the candidate node;
verifying the signature of the candidate node according to the public key of the candidate node;
and if the verification is passed, obtaining the IP address of the candidate node from the signature, and acquiring the geographical position of the candidate node according to the IP address.
14. The method of claim 13, wherein verifying the signature of the candidate node based on the public key of the candidate node comprises:
decrypting the signature of the candidate node by using the public key of the candidate node;
if the decryption is successful, analyzing the IP address in the signature of the candidate node, and judging whether the IP address of the candidate node is consistent with the IP address in the signature when the connection is established with the candidate node;
and if so, determining that the signature of the candidate node passes the verification.
15. A blockchain-based fragmentation device, for use in a target node in a blockchain network, the device comprising:
the fragmentation module is used for determining a first main node in the block chain network, and if the first main node is the target node, dividing each candidate node in the block chain network into different network fragments respectively;
a first determining module, configured to determine a second master node in a target network segment where the target node is located;
a second determining module, configured to determine, if the second master node is the target node, a verification node in the target network segment for participating in data verification based on address information and/or network delay time of each candidate node in the target network segment.
16. The apparatus according to claim 15, wherein the second determining module, when determining the verification node participating in data verification in the target network segment based on the address information of each candidate node in the target network segment, is specifically configured to:
dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network fragment;
and determining a preset number of verification nodes for participating in data verification in the target network fragment according to the obtained clusters.
17. The apparatus of claim 16, wherein the address information comprises a geographic location;
the second determining module, when dividing each candidate node into at least one cluster according to the address information of each candidate node in the target network segment, is specifically configured to:
dividing the candidate nodes with the geographic positions in the same geographic region range into the same cluster according to the geographic positions of the candidate nodes in the target network segment;
the second determining module, when determining a preset number of verification nodes for participating in data verification in the target network segment according to the obtained clusters, is specifically configured to:
according to the number of the candidate nodes included in each obtained cluster, arranging each cluster according to the sequence of the number of the candidate nodes from large to small;
if the number of the candidate nodes included in the top-ranked cluster is equal to the preset number, all the candidate nodes in the top-ranked cluster are used as the verification nodes;
and if the number of the candidate nodes included in the first-order cluster is smaller than the preset number, sequentially selecting the verification nodes from the clusters according to the arrangement sequence of the clusters until the number of the selected verification nodes meets the preset number.
18. The apparatus of claim 17, wherein the address information comprises an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is greater than the preset number, the second determining module determines a preset number of verification nodes for participating in data verification in the target network segment according to the following method:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes arranged in the first cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes included in the top sub-cluster is equal to the preset number, all the candidate nodes in the top sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the preset number, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
19. The apparatus of claim 17, wherein the address information comprises an internet protocol, IP, address; if the number of the candidate nodes included in the first-ranked cluster is smaller than the preset number, when the verification node is selected from the ith cluster, the second determining module is specifically configured to:
if the number of the candidate nodes included in the ith cluster is greater than the number of the verification nodes to be selected, i is an integer greater than 1, and the preset number of verification nodes for participating in data verification in the target network fragment is determined according to the following mode:
dividing the candidate nodes with the IP addresses in the same network segment into the same sub-cluster according to the IP addresses of the candidate nodes in the ith cluster;
arranging the sub-clusters according to the number of the candidate nodes included in each sub-cluster from large to small;
if the number of the candidate nodes in the first sub-cluster is equal to the number of the verification nodes to be selected, all the candidate nodes in the first sub-cluster are used as the verification nodes;
if the number of the candidate nodes included in the first sub-cluster is smaller than the number of the verification nodes to be selected, sequentially selecting the verification nodes from the sub-clusters according to the arrangement sequence of the sub-clusters until the number of the selected verification nodes meets the preset number.
20. The apparatus of claim 18, wherein the apparatus further comprises:
if the number of candidate nodes included in the first target sub-cluster obtained by the first-order cluster meets a second preset condition, the second determining module determines a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
arranging each candidate node according to the network delay time of each candidate node in the first target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the first target sub-cluster until the total number of the selected verification nodes meets the preset number;
wherein, the first target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the jth bit in each sub-cluster, and j is an integer greater than 1; the second preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the preset number; or the number of the candidate nodes included in the first sub-cluster is less than the preset number, the verification node is selected from the jth sub-cluster, and the number of the candidate nodes included in the jth sub-cluster is greater than the number of the verification nodes to be selected.
21. The apparatus of claim 19, wherein the apparatus further comprises:
if the number of candidate nodes included in a second target sub-cluster obtained from the ith cluster meets a third preset condition, the second determining module determines a preset number of verification nodes for participating in data verification in the target network segment according to the following mode:
arranging each candidate node according to the network delay time of each candidate node in the second target sub-cluster and the sequence of the network delay time from small to large;
sequentially selecting the verification nodes from the second target sub-cluster until the total number of the selected verification nodes meets the preset number;
the second target sub-cluster is the sub-cluster arranged at the head or the sub-cluster arranged at the kth position in each sub-cluster, and k is an integer greater than 1; the third preset condition is as follows: the number of the candidate nodes included in the first-ranked sub-cluster is greater than the number of the verification nodes to be selected; or the number of the candidate nodes included in the first sub-cluster is less than the number of the verification nodes to be selected, the verification nodes are selected from the k-th sub-cluster, and the number of the candidate nodes included in the k-th sub-cluster is greater than the number of the verification nodes to be selected.
22. The apparatus of claim 15, wherein the target node determines the network delay time of each candidate node in the target network slice according to:
respectively sending echo request messages to all candidate nodes in the target network fragment, and receiving echo responses sent by all the candidate nodes;
and aiming at each candidate node in the candidate nodes, determining the network delay time of the candidate node according to the time difference between the sending of the echo request message to the candidate node and the receiving of the echo response of the candidate node.
23. The apparatus of claim 15, wherein the fragmentation module determines the first master node in the blockchain network according to:
and determining the first main node as the target node if the first random value generated by the target node and the first random values generated by other candidate nodes meet a preset size relationship according to the first random value generated by the target node and the first random values generated by other candidate nodes.
24. The apparatus of claim 23, wherein the predetermined size relationship comprises any one of:
the first random values generated by other candidate nodes are all larger than the first random value generated by the target node;
the first random values generated by other candidate nodes are smaller than the first random value generated by the target node.
25. The apparatus according to claim 15, wherein the fragmentation module, when dividing each candidate node in the blockchain network into different network fragments, is specifically configured to:
generating a random seed according to a second random value generated by the target node and second random values generated by other candidate nodes;
and according to the random seeds, dividing each candidate node into different network fragments.
26. The apparatus according to claim 25, wherein the fragmentation module, when dividing each candidate node into different network fragments according to the random seed, is specifically configured to:
determining a third random value corresponding to the first candidate node according to the random seed and a preset random function aiming at the first node in each candidate node;
aiming at any one of the other candidate nodes except the first node, generating a third random value corresponding to the candidate node according to the third random value corresponding to the last candidate node of the candidate node; wherein, each third random value is matched with the serial number of one network fragment;
and aiming at each candidate node, distributing the candidate node to the network fragment matched with the third random value corresponding to the candidate node according to the third random value corresponding to the candidate node.
27. The apparatus of claim 15, further comprising, prior to determining the first master node in the blockchain network:
the acquisition module is used for acquiring a public key and a signature of each candidate node, wherein the signature is encrypted information of an IP address encrypted by using a private key of the candidate node;
verifying the signature of the candidate node according to the public key of the candidate node;
and if the verification is passed, obtaining the IP address of the candidate node from the signature, and acquiring the geographical position of the candidate node according to the IP address.
28. The apparatus of claim 27, wherein the obtaining module, when verifying the signature of the candidate node according to the public key of the candidate node, is specifically configured to:
decrypting the signature of the candidate node by using the public key of the candidate node;
if the decryption is successful, analyzing the IP address in the signature of the candidate node, and judging whether the IP address of the candidate node is consistent with the IP address in the signature when the connection is established with the candidate node;
and if so, determining that the signature of the candidate node passes the verification.
29. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is running, the processor executing the machine-readable instructions to perform the steps of the partition chain based fragmentation method according to any of claims 1 to 14.
30. A computer-readable storage medium, having stored thereon a computer program for performing, when being executed by a processor, the steps of the method for partition chain based fragmentation according to any of claims 1 to 14.
CN201910147729.4A 2019-02-27 2019-02-27 Block chain-based fragmentation method and device Active CN110753026B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910147729.4A CN110753026B (en) 2019-02-27 2019-02-27 Block chain-based fragmentation method and device
PCT/CN2020/074305 WO2020173287A1 (en) 2019-02-27 2020-02-05 Systems and methods for determining network shards in blockchain network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910147729.4A CN110753026B (en) 2019-02-27 2019-02-27 Block chain-based fragmentation method and device

Publications (2)

Publication Number Publication Date
CN110753026A true CN110753026A (en) 2020-02-04
CN110753026B CN110753026B (en) 2020-10-30

Family

ID=69275704

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910147729.4A Active CN110753026B (en) 2019-02-27 2019-02-27 Block chain-based fragmentation method and device

Country Status (2)

Country Link
CN (1) CN110753026B (en)
WO (1) WO2020173287A1 (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111491020A (en) * 2020-04-08 2020-08-04 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer equipment and storage medium
CN111510309A (en) * 2020-04-08 2020-08-07 深圳大学 Block chain data transmission method, device, equipment and computer readable storage medium
CN111612466A (en) * 2020-01-17 2020-09-01 厦门潭宏信息科技有限公司 Consensus and resource transmission method, device and storage medium
WO2020173287A1 (en) * 2019-02-27 2020-09-03 Beijing Didi Infinity Technology And Development Co., Ltd. Systems and methods for determining network shards in blockchain network
CN111858771A (en) * 2020-07-30 2020-10-30 杭州复杂美科技有限公司 Distributed data storage method, device and storage medium
CN112260836A (en) * 2020-09-28 2021-01-22 电子科技大学 Method for improving block chain throughput based on fragmentation technology
CN112954074A (en) * 2021-03-29 2021-06-11 北京三快在线科技有限公司 Block chain network connection method and device
CN113395357A (en) * 2021-08-16 2021-09-14 支付宝(杭州)信息技术有限公司 Method and device for fragmenting block chain system
CN113746809A (en) * 2021-08-12 2021-12-03 李蓉 Network node security verification method based on big data and smart city
CN114389825A (en) * 2022-03-24 2022-04-22 腾讯科技(深圳)有限公司 Data communication method based on block chain and related device

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11531982B2 (en) * 2020-06-24 2022-12-20 University Of Florida Research Foundation, Inc. Optimal transactions sharding for scalable blockchain
CN112615905B (en) * 2020-12-03 2022-09-20 广州智链未来科技有限公司 Method, device and equipment for scheduling block chain fragments and storage medium
CN115277031A (en) * 2021-04-13 2022-11-01 华为技术有限公司 Data processing method and device
CN117499017B (en) * 2023-12-31 2024-03-22 湖南天河国云科技有限公司 Block chain network transmission method, system, storage medium and terminal equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107528886A (en) * 2017-07-25 2017-12-29 中国科学院计算技术研究所 Block chain the whole network method for splitting and system
CN107766540A (en) * 2017-10-31 2018-03-06 上海分布信息科技有限公司 A kind of block chain network of subregion and its method for realizing partitioned storage
CN107807984A (en) * 2017-10-31 2018-03-16 上海分布信息科技有限公司 A kind of block chain network of subregion and its method for realizing subregion common recognition
US20180300382A1 (en) * 2017-04-12 2018-10-18 Vijay K. Madisetti Method and System for Tuning Blockchain Scalability for Fast and Low-Cost Payment and Transaction Processing
CN108881488A (en) * 2018-08-01 2018-11-23 夸克链科技(深圳)有限公司 It is a kind of based on the block chain transaction processing method and network that divide domain
CN109086139A (en) * 2018-08-15 2018-12-25 昧来网络科技(上海)有限公司 Dynamic Program Slicing method, equipment and computer storage medium
CN109146447A (en) * 2018-07-09 2019-01-04 矩阵元技术(深圳)有限公司 The transparent sharding method of block chain, apparatus and system
CN109359992A (en) * 2018-10-09 2019-02-19 北京彩球世纪科技有限公司 A kind of novel block chain subregion sliced fashion and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10417188B2 (en) * 2016-05-27 2019-09-17 Mastercard International Incorporated Method and system for transferring trust across block chain segments
US11626993B2 (en) * 2017-05-22 2023-04-11 Visa International Service Association Network for improved verification speed with tamper resistant data
CN107809484B (en) * 2017-10-30 2020-08-18 中国联合网络通信集团有限公司 Block chain transaction information processing method and block chain link point
CN108847925B (en) * 2018-06-20 2020-09-15 深圳大学 Fragment block chain generation method based on tree structure
CN110753026B (en) * 2019-02-27 2020-10-30 北京嘀嘀无限科技发展有限公司 Block chain-based fragmentation method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180300382A1 (en) * 2017-04-12 2018-10-18 Vijay K. Madisetti Method and System for Tuning Blockchain Scalability for Fast and Low-Cost Payment and Transaction Processing
CN107528886A (en) * 2017-07-25 2017-12-29 中国科学院计算技术研究所 Block chain the whole network method for splitting and system
CN107766540A (en) * 2017-10-31 2018-03-06 上海分布信息科技有限公司 A kind of block chain network of subregion and its method for realizing partitioned storage
CN107807984A (en) * 2017-10-31 2018-03-16 上海分布信息科技有限公司 A kind of block chain network of subregion and its method for realizing subregion common recognition
CN109146447A (en) * 2018-07-09 2019-01-04 矩阵元技术(深圳)有限公司 The transparent sharding method of block chain, apparatus and system
CN108881488A (en) * 2018-08-01 2018-11-23 夸克链科技(深圳)有限公司 It is a kind of based on the block chain transaction processing method and network that divide domain
CN109086139A (en) * 2018-08-15 2018-12-25 昧来网络科技(上海)有限公司 Dynamic Program Slicing method, equipment and computer storage medium
CN109359992A (en) * 2018-10-09 2019-02-19 北京彩球世纪科技有限公司 A kind of novel block chain subregion sliced fashion and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
闵新平 等: ""许可链多中心动态共识机制"", 《计算机学报》 *

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020173287A1 (en) * 2019-02-27 2020-09-03 Beijing Didi Infinity Technology And Development Co., Ltd. Systems and methods for determining network shards in blockchain network
CN111612466B (en) * 2020-01-17 2022-02-18 厦门潭宏信息科技有限公司 Consensus and resource transmission method, device and storage medium
CN111612466A (en) * 2020-01-17 2020-09-01 厦门潭宏信息科技有限公司 Consensus and resource transmission method, device and storage medium
CN111510309A (en) * 2020-04-08 2020-08-07 深圳大学 Block chain data transmission method, device, equipment and computer readable storage medium
CN111491020A (en) * 2020-04-08 2020-08-04 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer equipment and storage medium
CN111510309B (en) * 2020-04-08 2022-05-10 深圳大学 Block chain data transmission method, device, equipment and computer readable storage medium
CN111491020B (en) * 2020-04-08 2021-09-28 腾讯科技(深圳)有限公司 Data processing method, data processing device, computer equipment and storage medium
CN111858771A (en) * 2020-07-30 2020-10-30 杭州复杂美科技有限公司 Distributed data storage method, device and storage medium
CN112260836A (en) * 2020-09-28 2021-01-22 电子科技大学 Method for improving block chain throughput based on fragmentation technology
CN112954074A (en) * 2021-03-29 2021-06-11 北京三快在线科技有限公司 Block chain network connection method and device
CN113746809A (en) * 2021-08-12 2021-12-03 李蓉 Network node security verification method based on big data and smart city
CN113395357A (en) * 2021-08-16 2021-09-14 支付宝(杭州)信息技术有限公司 Method and device for fragmenting block chain system
CN114389825A (en) * 2022-03-24 2022-04-22 腾讯科技(深圳)有限公司 Data communication method based on block chain and related device

Also Published As

Publication number Publication date
CN110753026B (en) 2020-10-30
WO2020173287A1 (en) 2020-09-03

Similar Documents

Publication Publication Date Title
CN110753026B (en) Block chain-based fragmentation method and device
CN109165945B (en) Representative node device election method and device, computer device and storage medium
CN109522362B (en) Incomplete data synchronization method, system and equipment based on block chain data
US20220385460A1 (en) Systems and methods for selecting and utilizing a committee of validator nodes in a distributed system
WO2019133568A1 (en) High performance distributed system of record
JP2022508247A (en) High-performance distributed recording system with reliability-based consensus
EP4002181A1 (en) A consensus method and framework for a blockchain system
Conti et al. Blockchain trilemma solver algorand has dilemma over undecidable messages
CN109167660B (en) Method and device for electing representative node equipment, computer equipment and storage medium
JP2022509933A (en) High-performance distributed recording system with key management
CN111556120A (en) Data processing method and device based on block chain, storage medium and equipment
CN113256424B (en) Transaction data processing method, device, equipment and storage medium
Singh et al. Secure and reliable cloud networks for smart transportation services
CN113553375B (en) Partitioned storage device and method for image type block chain
US20180196948A1 (en) Distributed and decentralized clound storage system and method thereof
CN113626875A (en) Knowledge graph file storage method for block chain fragment enabling
Xue et al. STBC: A novel blockchain-based spectrum trading solution
CN111343003A (en) Data analysis method and device based on block chain and SDN edge computing network system
CN110351276A (en) Data processing method, equipment and computer readable storage medium
Alqahtani et al. Bigbft: A multileader byzantine fault tolerance protocol for high throughput
CN114281888A (en) Block chain consensus method, device, equipment and storage medium
CN110351364A (en) Date storage method, equipment and computer readable storage medium
CN113259130B (en) Transaction data processing method, device, equipment and medium
Dhaya et al. Cloud computing security protocol analysis with parity-based distributed file system
CN110071966B (en) Block chain networking and data processing method based on cloud platform

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