WO2021238298A1 - Consensus method, apparatus and device for blockchain system, and medium - Google Patents

Consensus method, apparatus and device for blockchain system, and medium Download PDF

Info

Publication number
WO2021238298A1
WO2021238298A1 PCT/CN2021/075339 CN2021075339W WO2021238298A1 WO 2021238298 A1 WO2021238298 A1 WO 2021238298A1 CN 2021075339 W CN2021075339 W CN 2021075339W WO 2021238298 A1 WO2021238298 A1 WO 2021238298A1
Authority
WO
WIPO (PCT)
Prior art keywords
cluster
consensus
target
node
information
Prior art date
Application number
PCT/CN2021/075339
Other languages
French (fr)
Chinese (zh)
Inventor
黄彦
周钰
胡庆林
刘为怀
朱涛
胡景秀
刘苏林
许玉壮
王贺贺
Original Assignee
中国银联股份有限公司
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 中国银联股份有限公司 filed Critical 中国银联股份有限公司
Publication of WO2021238298A1 publication Critical patent/WO2021238298A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0823Network architectures or network communication protocols for network security for authentication of entities using certificates
    • 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/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context
    • 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

Definitions

  • the present invention belongs to the field of blockchain technology, and in particular relates to a consensus method, device, equipment and medium of a blockchain system.
  • the consensus mechanism is a mechanism by which each node in the blockchain system reaches a consensus on block information throughout the network. It can ensure that the latest block is accurately added to the blockchain and the blockchain information stored by each node is consistent and does not fork. It can even resist malicious attacks.
  • the embodiments of the present invention provide a consensus method, device, equipment, and medium of a blockchain system, which can solve the problem that the existing consensus mechanism is insufficient to meet the high throughput requirements of the blockchain system.
  • an embodiment of the present invention provides a consensus method for a blockchain system, including:
  • the target consensus cluster in at least one available consensus cluster, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
  • an embodiment of the present invention provides a consensus method of a blockchain system, including:
  • a target peer node Receives a transaction request sent by a target peer node, where the target peer node sends a transaction request based on the target cluster address, and the target cluster address is determined in at least one available consensus cluster according to the node location of the target peer node, and the available consensus cluster is a block The consensus cluster in the normal working state of the chain system;
  • an embodiment of the present invention provides a consensus method of a blockchain system, including:
  • address query request information which includes target channel information
  • the cluster address corresponding to the target channel information is sent to the peer node corresponding to the node address.
  • an embodiment of the present invention provides a consensus method for a blockchain system, including:
  • a transaction request is sent to the target consensus cluster.
  • an embodiment of the present invention provides a consensus device for a blockchain system, including:
  • the first receiving module is used to receive the consensus cluster routing request sent by the target peer node;
  • the first parsing module is used to parse the consensus cluster routing request to obtain routing request information, and the routing request information includes the node location of the target peer node;
  • the first determining module is used to determine the target consensus cluster in at least one available consensus cluster according to the position of the node, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
  • the first sending module is used to send the target cluster address of the target consensus cluster to the target peer node.
  • an embodiment of the present invention provides a consensus device for a blockchain system, including:
  • the second receiving module is used to receive the transaction request sent by the target peer node, where the target peer node sends the transaction request based on the target cluster address, and the target cluster address is determined in at least one available consensus cluster according to the node location of the target peer node ,
  • the available consensus cluster is the consensus cluster in the normal working state of the blockchain system;
  • the second analysis module is used to analyze the transaction request to obtain transaction request information, the transaction request information including transaction information;
  • Information consensus module used to initiate consensus on transaction information
  • the transaction execution module is used to execute the transaction corresponding to the transaction information when the consensus is successful.
  • an embodiment of the present invention provides a consensus device for a blockchain system, including:
  • the third receiving module is used to receive the address query request sent by the target consensus cluster, and the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster;
  • the third parsing module is used to parse the address query request to obtain address query request information, and the address query request information includes target channel information;
  • the address query module is used to query the cluster address corresponding to the target channel information in the distributed database
  • the second sending module is configured to send the cluster address corresponding to the target channel information to the peer node corresponding to the node address when the address query request information also includes the node address.
  • an embodiment of the present invention provides a consensus device for a blockchain system, including:
  • the third sending module is used to send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, according to the node position included in the routing request information of the consensus cluster routing request, in at least one available consensus cluster Determine the target consensus cluster, and feed back the target cluster address corresponding to the target consensus cluster, where the available consensus cluster is the consensus cluster in the blockchain system that is in a normal working state;
  • the fourth receiving module is used to receive the target cluster address fed back by the cluster scheduling node;
  • the fourth sending module is used to send a transaction request to the target consensus cluster based on the target cluster address.
  • an embodiment of the present invention provides a consensus device of a blockchain system, the device including: a processor and a memory storing computer program instructions;
  • the processor implements the consensus method of the blockchain system as described in the first aspect, the second aspect, the third aspect, or the fourth aspect when the processor executes the computer program instructions.
  • an embodiment of the present invention provides a computer-readable storage medium with computer program instructions stored on the computer-readable storage medium.
  • the computer program instructions are executed by a processor, the The consensus method of the blockchain system described in the third aspect or the fourth aspect.
  • the consensus method, device, equipment, and medium of the blockchain system in the embodiment of the present invention can be based on the node position of the target peer node carried in the consensus cluster routing request sent by the target peer node, in at least one of the blockchain systems In the available consensus clusters in a normal working state, assign the target consensus cluster to the target peer node, and send the target cluster address of the target consensus cluster to the target peer node, so as to realize the distribution of peer nodes through the node location, so that different pairs
  • the peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used to consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system and can meet the high throughput of the blockchain system.
  • the amount of demand is based on the node position of the target peer node carried in the consensus cluster routing request sent by the target peer node, in at least one of the blockchain systems In the available consensus clusters in a normal working state, assign the target consensus cluster to the target peer node
  • Figure 1 is a schematic diagram of the structure of a blockchain system in the prior art
  • Figure 2 is a system architecture diagram of the blockchain system in Figure 1;
  • Figure 3 is a system architecture diagram of a blockchain system provided by an embodiment of the present invention.
  • Fig. 4 is a schematic structural diagram of a blockchain system under the system architecture shown in Fig. 3;
  • FIG. 5 is a schematic flowchart of a consensus method of a blockchain system provided by an embodiment of the present invention.
  • FIG. 6 is a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
  • FIG. 7 is a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
  • FIG. 8 is a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
  • Fig. 11 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
  • Fig. 13 is a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.
  • the consensus mechanism is a mechanism by which each node in the blockchain system reaches a consensus on block information throughout the network. It can ensure that the latest block is accurately added to the blockchain and the blockchain information stored by each node is consistent and does not fork. It can even resist malicious attacks.
  • Figure 1 shows a schematic structural diagram of a blockchain system in the prior art.
  • the blockchain system includes a consensus cluster OC, a peer-to-peer cluster PC-1, a peer-to-peer cluster PC-2, and a user cluster CC.
  • the consensus cluster OC includes at least one consensus node.
  • the peer-to-peer cluster PC1 and the peer-to-peer cluster PC2 respectively include at least one peer node, and the peer nodes may be divided into different peer clusters according to node locations.
  • Blockchain ledgers BC-1, BC-2, BC-3, BC-4, BC-5, BC-6 respectively correspond to different channels (such as sub-blockchains) formed by the consensus cluster OC and different peer nodes Blockchain ledger.
  • the user cluster CC includes at least one user node.
  • Figure 2 shows the system architecture diagram of the blockchain system in Figure 1.
  • the blockchain system is a Hyperledger (Hyperledger Fabric) architecture.
  • the Hyperledger Fabric architecture includes a Certificate Authority (CA) layer 201, a consensus layer 202, and a peer layer 203.
  • CA layer 201 includes a CA management node, which is responsible for certificate distribution, revocation, and other authority control operations related to blockchain transactions for all level nodes.
  • the consensus layer 202 includes the consensus cluster OC shown in FIG. 1, and the peer layer 203 includes the peer cluster PC1 and the peer cluster PC2 shown in FIG. 1.
  • each user node can communicate with a peer node in a corresponding peer-to-peer cluster, and send a service request to the peer node or receive the request result fed back by the peer node.
  • Each peer node can also communicate with the consensus cluster OC, and send a transaction request to the consensus cluster OC based on the received service request or receive the request result fed back by the consensus cluster OC.
  • the embodiments of the present invention provide a new system architecture applied to a blockchain system and a blockchain system corresponding to the system architecture.
  • Figure 3 shows a system architecture diagram of a blockchain system provided by an embodiment of the present invention.
  • the system architecture diagram includes a CA layer 301, a channel coordination layer 302, a consensus cluster layer 303, a cluster scheduling layer 304, and a peer layer 305.
  • the CA layer 301 includes a CA management node, which is responsible for certificate distribution, revocation, and other authority control operations related to blockchain transactions for all level nodes.
  • the consensus cluster layer 303 may include one or more consensus clusters, which are used to perform consensus based on transaction requests and achieve uniform sequencing of blockchain transactions.
  • the channel coordination layer 302 includes channel coordination nodes, which are used for channel coordination routing of transaction requests across consensus clusters, so as to improve the system's cross-regional service capabilities.
  • the peer-to-peer layer 305 includes at least one peer-to-peer cluster, which is used to initiate a transaction request to the consensus cluster layer.
  • the cluster scheduling layer 304 includes a cluster scheduling node, which is used to allocate a consensus cluster to each peer node in the peer cluster, so as to realize the dynamic allocation of the consensus cluster.
  • system architecture may be a Hyperledger Fabric architecture. In other embodiments of the present invention, the system architecture may also be other architectures similar to the Hyperledger Fabric architecture.
  • Fig. 4 shows a schematic structural diagram of a blockchain system under the system architecture shown in Fig. 3.
  • the blockchain system includes a channel coordination layer, a consensus cluster OC-1, a consensus cluster OC-2, a consensus cluster OC-3, a peer-to-peer cluster PC-1, a cluster scheduling layer, and a peer-to-peer cluster PC- 2 and user cluster CC.
  • the channel coordination layer includes channel coordination nodes located in each consensus cluster.
  • the consensus cluster OC-1, the consensus cluster OC-2, and the consensus cluster OC-3 each include at least one consensus node, and different consensus clusters correspond to different location areas.
  • the peer-to-peer cluster PC1 and the peer-to-peer cluster PC2 respectively include at least one peer node, and the peer nodes may be divided into different peer clusters according to node locations.
  • the cluster scheduling layer includes at least one cluster scheduling node.
  • Blockchain ledgers BC-1, BC-2, BC-3, and BC-4 are respectively the blockchain ledgers corresponding to different channels (such as sub-blockchains) established by different consensus clusters for different peer nodes.
  • the user cluster CC includes at least one user node.
  • each user node can communicate with a peer node in a corresponding peer-to-peer cluster, and send a service request to the peer node or receive a request result fed back by the peer node.
  • Each peer node can also communicate with the cluster scheduling node, and send a consensus cluster routing request to the cluster scheduling node based on the received service request, so that the cluster scheduling node is based on the node location of the peer node carried in the consensus cluster routing request.
  • the peer nodes allocate consensus clusters.
  • Each peer node can also communicate with the consensus cluster allocated by the cluster scheduling node, and send a transaction request to the consensus cluster based on the received service request or receive the request result fed back by the consensus cluster.
  • the consensus cluster When the consensus cluster receives a cross-consensus cluster transaction request, it can also perform channel coordination routing for the transaction request through the channel coordination node, and find the consensus cluster to which the channel corresponding to the transaction request belongs, so that the pair sending the transaction request Waiting for the node to be able to re-send the transaction request to the consensus cluster to which the channel corresponding to the transaction request belongs.
  • the blockchain system provided by the embodiment of the present invention can realize the distribution of peer nodes through the node position, so that different peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used in parallel Consensus on a large number of peer nodes improves the throughput of the blockchain system, which in turn can meet the needs of the blockchain system for high throughput, and can adapt to efficient and secure business requirements.
  • the channel collaboration nodes are respectively embedded in the corresponding consensus clusters.
  • the channel collaboration node can also be set separately from the corresponding consensus cluster, which is not limited here.
  • the embodiment of the present invention provides a consensus method, device, equipment, and medium of the blockchain system.
  • Fig. 5 shows a schematic flowchart of a consensus method of a blockchain system provided by an embodiment of the present invention.
  • the method shown in FIG. 5 may be executed by the cluster scheduling node shown in FIG. 4.
  • the cluster scheduling node may be a server or a server cluster.
  • the consensus method of the blockchain system can include:
  • the target peer node may be any peer node in the blockchain system.
  • the target peer node may be any peer node in the blockchain system shown in FIG. 4.
  • the routing request type of the consensus cluster routing request received by the cluster scheduling node may include a first routing type and a second routing type.
  • the first routing type can be used to characterize that the routing request is a consensus cluster routing request sent by the peer node when the channel is first established
  • the second routing type can be used to characterize that the routing request is that the peer node is joining an existing channel.
  • a channel may be a sub-blockchain.
  • the cluster scheduling node may perform request analysis processing on the received consensus cluster routing request to obtain the routing request information contained in the consensus cluster routing request.
  • the route request information may include the node location of the target peer node, and the node location includes the geographic location of the target peer node. In other embodiments, the routing request information may also include the routing request type. In still other embodiments, the routing request information may also include node verification information, and the node verification information includes information used to verify the validity of the certificate of the target peer node. In some embodiments, the routing request information may further include the node address of the target peer node, and the node address includes the node Internet Protocol (IP) address of the target peer node.
  • IP Internet Protocol
  • routing request information may also include other information used to assist the cluster scheduling node to allocate the target consensus cluster to the target peer node, which is not limited here.
  • S530 Determine a target consensus cluster in at least one available consensus cluster according to the location of the node, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system.
  • the cluster scheduling node may allocate a target consensus cluster to the target peer node based on the shortest time principle, according to the node location and the cluster location of each available consensus cluster.
  • the cluster scheduling node can continuously monitor the heartbeat of each consensus cluster in the consensus cluster layer, and calculate the response time of each consensus cluster. After receiving the consensus cluster routing request, it can be based on the target peering carried in the consensus cluster routing request For the node position of the node, select the consensus cluster within the preset distance corresponding to the node position from multiple consensus clusters, and select the consensus cluster with the shortest response time from the selected consensus clusters as the target consensus cluster, based on The shortest time principle allocates the target consensus cluster to the target peer node.
  • the preset distance range can be set as required, and there is no limitation here.
  • the cluster scheduling node can allocate the target consensus cluster with the shortest response time to the target peer node, thereby improving the efficiency of transaction processing and improving the user experience.
  • the cluster scheduling node can also allocate a target consensus cluster to the target peer node based on the shortest distance principle, according to the node location and the cluster location of each available consensus cluster.
  • the cluster location may include the geographic location of the consensus cluster.
  • the consensus cluster with the cluster location closest to the node location can be selected from multiple consensus clusters
  • the cluster as the target consensus cluster, allocates the target consensus cluster to the target peer nodes based on the shortest distance principle.
  • the cluster scheduling node can allocate the closest target consensus cluster to the target peer node, thereby improving the efficiency of transaction processing and improving the user experience.
  • each consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.
  • the normal working state is a working state of normal operation.
  • S540 Send the target cluster address of the target consensus cluster to the target peer node.
  • the cluster scheduling node can query the target cluster address of the target consensus cluster, and send the target cluster address of the target consensus cluster to the target peer node.
  • the routing request information may include the node address of the target peer node, and the cluster scheduling node may send the target cluster address of the target consensus cluster to the target peer node through the node address.
  • the target peer node based on the node position of the target peer node carried in the consensus cluster routing request sent by the target peer node, in at least one available consensus cluster in the normal working state of the blockchain system, it is the target The peer node allocates the target consensus cluster, and sends the target cluster address of the target consensus cluster to the target peer node to realize the distribution of peer nodes through the node location, so that different peer nodes can match different consensus clusters based on their node locations In this way, multiple consensus clusters can be used to perform consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system, and thus can meet the demand for high throughput of the blockchain system.
  • the routing request information may also include node verification information
  • the node verification information can also be verified.
  • the specific method of S530 may include:
  • the target consensus cluster is determined in at least one available consensus cluster according to the location of the node.
  • the node verification information may be generated by the target peer node according to the certificate distributed by the certificate authority node.
  • the certificate authority node may be a node in the CA layer 301 shown in FIG. 3.
  • the node verification information can be used to verify the validity of the certificate of the target peer node, so that the cluster scheduling node can determine whether the target peer node is a legal node of the blockchain system.
  • the cluster scheduling node can determine the target consensus cluster in at least one available consensus cluster according to the node location; if If the node verification information fails the verification, it means that the target peer node is not a legal node of the blockchain system, and the cluster scheduling node stops responding to consensus cluster routing requests, and does not allocate any consensus cluster to the target peer node.
  • the cluster scheduling node can first verify the legitimacy of the node verification information of the target peer node, and if the node verification information passes the verification, allocate the target consensus cluster to the target peer node, and then Improve the security of the blockchain system.
  • the consensus method of the blockchain system may further include:
  • the cluster registration request information includes cluster verification information
  • the consensus cluster In the case of monitoring that the consensus cluster is in a normal working state, the consensus cluster is regarded as an available consensus cluster.
  • each consensus cluster when each consensus cluster is first started, it will send a cluster registration request to the cluster scheduling node to register in the cluster registration request.
  • the cluster scheduling node After the cluster scheduling node receives the cluster registration request sent by the consensus cluster, it can parse the cluster registration request to obtain the cluster verification information, and then verify the legitimacy of the consensus cluster based on the cluster verification information, and if the cluster verification information is verified, The consensus cluster is successfully registered, and the cluster scheduling node can continuously monitor the consensus cluster.
  • the consensus cluster is regarded as an available consensus cluster and added to the consensus cluster dynamic network map; if it is monitored that the consensus cluster is not in a normal working state, the consensus cluster is regarded as an unavailable consensus cluster, and Remove the consensus cluster from the consensus cluster dynamic network map.
  • the cluster verification information includes information used to verify the validity of the certificate of the consensus cluster.
  • the cluster verification information can be generated by the consensus cluster according to the certificate distributed by the certificate authority node.
  • the certificate authority node may be a node in the CA layer 301 shown in FIG. 3.
  • the cluster verification information can be used to verify the validity of the certificate of the consensus cluster, so that the cluster scheduling node can determine whether the consensus cluster is a legal cluster of the blockchain system.
  • the consensus cluster after the consensus cluster is successfully registered, it can send the heartbeat of the consensus cluster to the cluster scheduling node, and the cluster scheduling node can monitor the consensus cluster based on the heartbeat of the consensus cluster to determine whether the consensus cluster is working normally state.
  • the specific method of S530 may include:
  • the target consensus cluster is determined in at least one available consensus cluster in the consensus cluster dynamic network map.
  • the cluster scheduling node can dynamically allocate the target consensus cluster in the normal working state to the target peer node to improve the block The reliability of the chain system.
  • the cluster registration request information may also include cluster configuration information
  • the cluster configuration information may include the identity document (ID) of the consensus cluster, the cluster IP address, and the cluster location equal to the configuration related information of the consensus cluster. information.
  • the consensus method of the blockchain system may further include:
  • the cluster scheduling node can query the target cluster configuration information corresponding to the target consensus cluster in the cluster configuration information of each registered consensus cluster based on the target cluster ID of the target consensus cluster, and extract the target from the target cluster configuration information
  • the cluster address is used to send the target cluster address of the target consensus cluster allocated to the target peer node.
  • the consensus method of the blockchain system may further include:
  • the cluster performance parameters may include parameters such as the throughput of the consensus cluster and the average transaction delay.
  • the average transaction delay can be obtained from the peer node communicating with the consensus cluster. After the peer node sends a transaction request to the consensus cluster, it can send the average transaction delay of the consensus cluster communication with the cluster scheduling node to the cluster scheduling node at regular intervals. Time.
  • the specific method of using the available consensus cluster with the shortest response time as the target consensus cluster may include:
  • the available consensus cluster with the shortest response time is taken as the target consensus cluster.
  • the cluster scheduling node may determine whether the cluster performance parameters of the available consensus cluster meet the first preset condition after determining the available consensus cluster with the shortest response time to the target peer node, and determine whether the available consensus cluster has reached Saturated state. If it is determined that the cluster performance parameters do not meet the first preset condition, that is, the available consensus cluster has not reached the saturation state, the available consensus cluster with the shortest response time may be used as the target consensus cluster.
  • the consensus method of the blockchain system may further include:
  • the available consensus cluster with the second shortest response time is taken as the target consensus cluster.
  • the cluster scheduling node may also determine whether the cluster performance parameters of the available consensus cluster meet the first preset condition, and if it is determined that the cluster performance parameters meet the first preset condition, that is, the available consensus cluster reaches a saturated state, then The available consensus cluster with the shortest response time is taken as the target consensus cluster.
  • a comprehensive judgment can be made based on the saturation and response time of the available consensus clusters, so as to dynamically allocate the target consensus clusters in the normal working state for the target peer nodes, and further improve the performance of the blockchain system. reliability.
  • the method for judging the saturation of the available consensus cluster with the shortest response time is similar to the method for judging the saturation of the available consensus cluster with the shortest response time. Determine whether the available consensus cluster with the shortest response time is determined.
  • the method for the target consensus cluster is similar to the method for determining whether the available consensus cluster with the shortest response time is used as the target consensus cluster, and will not be repeated here.
  • the routing request information may also include the routing request type
  • the specific method for judging whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition may further include:
  • the routing request type is the first routing type
  • the routing request type of the consensus cluster routing request can also be determined. If the routing request type is the first routing type, that is, the routing request type is the consensus cluster routing request sent by the peer node when the channel is first established, then determine whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first preset Conditions, and no longer consider the consensus cluster that has been saturated.
  • the routing request type is the second routing type, that is, the routing request type is the consensus cluster routing request sent by the peer node when joining an existing channel, there is no need to determine whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first With preset conditions, consensus clusters that are already saturated can still be considered.
  • the first preset condition may include at least one of the following:
  • the throughput in the cluster performance parameter is greater than or equal to the preset throughput threshold
  • the first duration for which the throughput is greater than or equal to the preset throughput threshold is greater than or equal to the first preset duration
  • the average transaction delay in the cluster performance parameters is greater than or equal to the preset delay threshold
  • the second time period when the average transaction delay is greater than or equal to the preset delay threshold is greater than or equal to the second preset time period.
  • the preset throughput threshold may correspond to the critical level of the benchmark technical indicator.
  • the preset throughput threshold may be 90%, or may be other thresholds set as needed.
  • the average transaction delay can also correspond to the critical level of the benchmark technical indicator.
  • the preset delay threshold can be 10%, or other thresholds set as needed.
  • the first preset duration and the second preset duration may be durations set according to needs, respectively, and there is no limitation here.
  • the average transaction delay greater than or equal to the preset delay threshold may be that the average transaction delay of all consensus nodes in the consensus cluster is greater than or equal to the preset delay threshold. In other embodiments, the average transaction delay is greater than or equal to the preset delay threshold may be that the average transaction delay of the predetermined number of consensus nodes in the consensus cluster is greater than or equal to the preset delay threshold.
  • the predetermined number can be 10% of the total number of consensus nodes in the consensus cluster, or other numbers set as needed.
  • the cluster scheduling node may directly determine whether the cluster performance parameter of the available consensus cluster meets the first preset condition based on the cluster performance parameter.
  • the specific method for judging whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition further includes:
  • the cluster scheduling node may determine whether the cluster performance parameters of each available consensus cluster meet the first preset condition at regular intervals, and add a saturation state mark to the available consensus clusters whose cluster performance parameters meet the first preset condition.
  • the saturation status flag can be used to determine whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first preset condition, thereby reducing the data processing of the cluster scheduling node Increase the efficiency of data processing.
  • a consensus cluster can correspond to a location area (ie a geographic area), and a location area can correspond to at least one consensus cluster.
  • the cluster scheduling node can be based on different location areas that may cause problems due to different economic development levels. Associate the difference in the degree of activity of the blockchain business, implement a load balancing mechanism, and reasonably allocate consensus clusters for each peer node, so as to realize the regional division of peer nodes to solve the performance limitation of the consensus algorithm of a single consensus cluster. The situation where the transaction consensus processing capacity of the location area is saturated.
  • FIG. 6 shows a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
  • the method shown in FIG. 6 may be executed by any consensus cluster shown in FIG. 4.
  • the consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.
  • the consensus method of the blockchain system can include:
  • S610 Receive a transaction request sent by the target peer node, where the target peer node sends the transaction request based on the target cluster address, and the target cluster address is determined in at least one available consensus cluster according to the node location of the target peer node.
  • the available consensus cluster is A consensus cluster in a normal working state in the blockchain system;
  • the target peer node may be any peer node in the blockchain system.
  • the target peer node may be any peer node in the blockchain system shown in FIG. 4.
  • the transaction request type of the transaction request received by the consensus cluster may include a first transaction type, a second transaction type, and a third transaction type.
  • the first transaction type can be used to indicate that the transaction request is a transaction request to establish a channel
  • the second transaction type can be used to indicate that the transaction request is a transaction request to join an existing channel
  • the third transaction type can be used to indicate that the transaction request is an initiation A transaction request for a transaction in an existing channel.
  • S620 Parse the transaction request to obtain transaction request information, where the transaction request information includes transaction information
  • the consensus cluster may perform request analysis processing on the received transaction request, and obtain the transaction request information contained in the transaction request.
  • the transaction request information may include transaction information, and the transaction information is information used to initiate a consensus.
  • the transaction request information may include the transaction request type.
  • the transaction request information may also include target channel information.
  • the transaction request information may further include the node address of the target peer node, and the node address includes the node IP address of the target peer node.
  • the transaction request information may further include node verification information, and the node verification information includes information used to verify the validity of the certificate of the target peer node.
  • transaction request information may also include other information used to assist the consensus cluster to conduct transaction consensus for the target peer node, which is not limited here.
  • the consensus cluster may initiate a consensus on transaction information based on a single zookeeper consensus algorithm. In other embodiments of the present invention, the consensus cluster may also initiate a consensus on transaction information based on the supported raft consensus algorithm. In other embodiments of the present invention, the consensus cluster may also initiate a consensus on transaction information based on other consensus algorithms, which is not limited here.
  • the consensus cluster can receive transaction requests sent by target peer nodes based on node location allocation, so as to realize the distribution of peer nodes through node locations, so that different peer nodes can match different nodes based on their node locations.
  • Consensus clusters can use multiple consensus clusters to perform consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system, and thus can meet the high throughput requirements of the blockchain system when a large number of nodes are connected. At the same time, even if the number of participating nodes increases, the scalability of the blockchain system can continue to be maintained.
  • the transaction request information may also include the transaction request type.
  • the specific method for initiating a consensus on transaction information may include:
  • the transaction request type is the first transaction type
  • a consensus is initiated for the transaction information.
  • the transaction request type is the first transaction type, that is, the transaction request can be a transaction request that characterizes the establishment of a channel, and the transaction information can be directly initiated. Consensus, thereby improving the data processing efficiency of the consensus cluster.
  • the transaction request information may also include target channel information.
  • the consensus method of the blockchain system may further include:
  • the transaction request type is not the first transaction type, obtain the target channel information
  • the target channel list can include multiple first channel information, and each first channel information can be based on the attributes of a locally established channel Information generation.
  • the specific method for initiating a consensus on transaction information may include:
  • the transaction request type of the transaction request can be determined first. If the transaction request type is not the first transaction type, but the second transaction type or the third transaction type.
  • Transaction type that is, if the transaction request is a transaction request to join an existing channel or a transaction request to initiate a transaction in an existing channel, it needs to be further generated in the target channel list stored locally based on the attribute information of the locally established channel
  • the target channel information is queried in the first channel information. If the target channel information is queried from multiple first channel information in the target channel list, a consensus can be initiated on the transaction information, which can prevent the consensus cluster from processing transactions corresponding to other consensus clusters Request to improve the reliability of the consensus cluster.
  • the locally stored channel list refers to the channel list stored in the consensus cluster corresponding to the target cluster address
  • the locally established channel refers to the channel established by the consensus cluster corresponding to the target cluster address.
  • the consensus method of the blockchain system may further include:
  • An address query request is sent to the channel coordination node, and the address query request is used to enable the channel coordination node to query the cluster address corresponding to the target channel information.
  • the consensus cluster queries the target channel information in the preset channel list
  • the target channel information is not queried in the preset channel list
  • it can be determined that the transaction request is a transaction request corresponding to other consensus clusters, and the transaction request can be generated.
  • An address query request corresponding to the target channel information is sent, and an address query request is sent to the channel cooperation node, so that the channel cooperation node queries the cluster address corresponding to the target channel information in response to the address query request.
  • the consensus method of the blockchain system may further include:
  • the channel cooperation node may, after querying the cluster address corresponding to the target channel information, feed back the cluster address corresponding to the target channel information to the consensus cluster that sent the address query request.
  • the consensus cluster receives the cluster address corresponding to the target channel information fed back by the channel cooperative node, it can send the cluster address corresponding to the target channel information to the target peer node, so that the target peer node sends the correct cluster address based on the target channel information.
  • the consensus cluster resends the transaction request to ensure the reliability of the blockchain system.
  • the address query request may also carry the node address of the target peer node, and the channel coordinating node may query the cluster address corresponding to the target channel information directly based on the node address to send the target peer node address.
  • the cluster address corresponding to the target channel information fed back by the node, thereby reducing the number of information forwarding, and improving the response speed to the transaction request of the target peer node.
  • the channel coordination node since only the channel information corresponding to the channel established by the consensus cluster is stored in the target channel information, if the target channel information is not queried in the target channel list, it indicates the existing channel targeted by the target peer node If the channel is not established by the consensus cluster, the channel coordination node needs to find the cluster address of the consensus cluster that established the existing channel for it.
  • the target channel information is a target hash value, which is generated according to the attribute information of the target channel corresponding to the transaction request;
  • the target channel list is a target hash table, and the target hash table includes a plurality of A hash value, each first hash value is generated according to the attribute information of a locally established channel.
  • the consensus cluster can convert the attribute information of the created channel into a unique hash value through a preset hash algorithm, and store it in the consensus cluster as the first hash value In the target hash table.
  • the consensus cluster Before the consensus cluster initiates a consensus on the transaction information, after parsing the transaction request to obtain the transaction request information, if the transaction request type is not the first transaction type, you need to further query the target hash value in the multiple first hash values of the target hash table. Hope value. If the target hash value is queried, a consensus can be initiated for the transaction information; if the target hash value is not queried, it can be determined that the transaction request is a transaction request corresponding to other consensus clusters.
  • the channel information corresponding to each channel can correspond to a hash value, which can improve the security of using the channel information, thereby improving the security of the blockchain system.
  • the attribute information includes at least one of the following:
  • Channel name channel creator, channel creation time.
  • the attribute information may include any one of the channel name, channel creator, and channel creation time. In other embodiments, the attribute information may also include any two of the channel name, channel creator, and channel creation time. In still other embodiments, the attribute information may also include the channel name, channel creator, and channel creation time.
  • the channel creator may be represented by the node IP address of the peer node requesting to create the channel. In other embodiments, the channel creator may also indicate the public key of the peer node requesting to create the channel, which is not limited here.
  • the channel creation time may be the timestamp of channel creation.
  • FIG. 7 shows a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
  • the method shown in FIG. 7 may be executed by any channel coordination node shown in FIG. 4.
  • the channel cooperation node may be a server or a server cluster.
  • the consensus method of the blockchain system can include:
  • the target consensus cluster may be any consensus cluster in the blockchain system.
  • the target consensus cluster may be any consensus cluster in the blockchain system shown in FIG. 4.
  • the address query request information may include target channel information.
  • the address query request information may further include a node address, which may be the node address of a peer node that sends a transaction request to the target consensus cluster, and the node address may include the node IP address of the peer node.
  • the address query request information may further include the cluster address of the target consensus cluster, and the cluster address of the target consensus cluster may include the cluster IP address of the target consensus cluster.
  • the address query request information may also include other information used to assist the channel coordination node to query the cluster address, which is not limited here.
  • the distributed database may store at least one second channel information in the blockchain system, and each sub-database in the distributed database is stored in a preset channel coordination node corresponding to a consensus cluster, Makes each preset channel coordination node can query the target channel coordination node storing the target channel information in the distributed database based on the protocol of the distributed database, and use the cluster address of the consensus cluster corresponding to the target channel coordination node as the target channel information correspondence The cluster address.
  • a second channel information corresponds to an existing channel in the blockchain system.
  • the preset channel collaboration node is a node used to maintain a distributed database in the blockchain system, and a preset channel collaboration node corresponds to a consensus cluster.
  • each consensus cluster establishes a new channel
  • the routing information of the channel will be sent to the preset channel collaboration node corresponding to the consensus cluster
  • each preset channel collaboration node can store the distributed database belonging to In the sub-database of the preset channel cooperative node
  • the method for each preset channel cooperative node to find the target channel cooperative node that stores the target channel information based on the distributed database can be implemented by the existing distributed database query method, that is, in the adjacent
  • the preset channel coordination node corresponding to the consensus cluster forwards the address query request, so that the preset channel coordination node that receives the address query request queries the target channel information in the locally stored sub-database, so as to achieve the target channel coordination node For the query, I won’t repeat it here.
  • the address query request may also be generated according to the node address, so that the address query request carries the node address, and the address query request information includes the node address.
  • the channel coordinating node After the channel coordinating node has inquired about the cluster address corresponding to the target channel information, it can directly send the cluster address corresponding to the target channel information to the peer node corresponding to the node address based on the node address, so that the peer node is based on the target channel
  • the cluster address corresponding to the information resends the transaction request to the correct consensus cluster.
  • the channel cooperation node can directly send the cluster address corresponding to the target channel information to the peer node, thereby improving the response speed to the peer node.
  • the cluster address of the consensus cluster corresponding to the transaction request can be queried through the channel collaboration node, so as to ensure the orderly progress of cross-consensus cluster transaction requests and improve the performance of the blockchain system. reliability.
  • the target channel information is a target hash value
  • the target hash value is generated according to the attribute information of the target channel corresponding to the transaction request
  • the distributed database includes a distributed hash table, and the distributed hash table includes multiple Each second hash value is generated according to the attribute information of a channel in the blockchain system.
  • the specific method of S730 may include:
  • a preset channel collaboration node Based on the distributed hash table, among multiple preset channel collaboration nodes, query the target channel collaboration node that stores the target hash value, where the preset channel collaboration node is used to maintain the distributed hash in the blockchain system Table node, a preset channel collaboration node corresponds to a consensus cluster;
  • the cluster address of the consensus cluster corresponding to the target channel cooperative node is used as the cluster address corresponding to the target channel information.
  • a second hash value corresponds to a channel.
  • the attribute information of the channel can be used to generate the hash value corresponding to the channel, and then the hash value corresponding to the channel is sent to The preset channel collaboration node corresponding to the consensus cluster, and the preset channel collaboration node will store the received hash value as the second hash value in the distributed hash table.
  • Each preset channel collaboration node can store a hash sub-table belonging to the preset channel collaboration node in the distributed hash table, and each preset channel collaboration node searches for the target channel collaboration that stores the target channel information based on the distributed hash table.
  • the node method can be realized by using the existing distributed hash table query method, that is, since the channel coordination node corresponding to the target consensus cluster starts, the address query request is forwarded between the preset channel coordination nodes corresponding to the adjacent consensus clusters , So that the preset channel cooperation node that received the address query request parses the target hash value in the address query request, and then compares the parsed target hash value with each second hash in the locally stored hash sub-table The value is compared to determine whether the target hash value exists in the locally stored hash sub-table.
  • the preset channel coordination node can determine that it is the target channel coordination node, and The cluster address of its corresponding consensus cluster is fed back to the channel coordination node that sent the address query request to it, and finally returned to the channel coordination node that needs to query the cluster address corresponding to the target channel information, that is, the channel coordination node corresponding to the target consensus cluster.
  • the channel coordination node corresponding to the target consensus cluster receives the cluster address of the consensus cluster corresponding to the target channel coordination node, it can be used as the cluster address corresponding to the target channel information.
  • the distributed hash table may be a distributed hash table based on the Kademlia protocol, or a distributed hash table based on other protocols, which is not limited here.
  • the attribute information includes at least one of the following:
  • Channel name channel creator, channel creation time.
  • the consensus method of the blockchain system may further include:
  • the cluster address corresponding to the target channel information is sent to the target consensus cluster.
  • the address query request may not be generated based on the node address, so that the address query request does not carry the node address, and the address query request information does not include the node address.
  • the channel cooperative node after the channel cooperative node has inquired about the cluster address corresponding to the target channel information, it can send the cluster address corresponding to the target channel information to the target consensus cluster based on the cluster address of the target consensus cluster, so that the target consensus cluster corresponds to the target channel information
  • the cluster address of is forwarded to the peer node that sends the transaction request carrying the target channel information, so that the peer node resends the transaction request to the correct consensus cluster based on the cluster address corresponding to the target channel information.
  • the channel cooperation node can forward the cluster address corresponding to the target channel information to the peer node through the target consensus cluster, so as to reduce the amount of data carried in the address query request.
  • the production company B in area A needs to distribute the products produced to the distribution company D in area C, and the goods need to be tracked on the blockchain.
  • the consensus cluster allocated by the production enterprise A is the consensus cluster O1
  • the channel E is first established through the consensus cluster O1.
  • the distribution company B initiates a transaction request to join the channel E to the consensus cluster O2 assigned by the cluster scheduling node. Since the consensus cluster O2 does not contain channel E-related information and cannot process the transaction request, it sends an address query request to the channel cooperative node.
  • the channel coordination node forwards the address query request between each channel coordination node in the channel coordination layer (eventually to the consensus cluster O1) and finds the cluster address of the consensus cluster O1 corresponding to the channel, and finally returns the corresponding cluster address to the distribution enterprise B, B Update the cluster address corresponding to channel E.
  • the production company A and the distribution company B can communicate normally based on the cluster address corresponding to the channel E to create a specific smart contract that meets the business needs and interests of both parties, and coordinate the supply chain traceability business.
  • the channel collaboration node can implement a channel-oriented consensus cluster dynamic switching mechanism, which can ensure the existence and circulation of blockchain transactions in any globally available consensus cluster based on multi-consensus cluster scheduling, and finally go on the chain. Ensure the security and completeness of the blockchain system.
  • FIG. 8 shows a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
  • the method shown in FIG. 8 may be executed by any peer node shown in FIG. 4.
  • the peer node may be a server or a server cluster.
  • the consensus method of the blockchain system can include:
  • S810 Send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, and determines the target consensus cluster in at least one available consensus cluster according to the node position included in the routing request information of the consensus cluster routing request. And feedback the target cluster address corresponding to the target consensus cluster, where the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;
  • S820 Receive the target cluster address fed back by the cluster scheduling node
  • the distribution of peer nodes can be realized by node positions, so that different peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used to perform parallel operations on a large number of peer nodes. Consensus improves the throughput of the blockchain system, which in turn can meet the demand for high throughput of the blockchain system.
  • the target consensus cluster may directly initiate a consensus based on the transaction request.
  • the transaction request may carry the target channel information of the target channel corresponding to the transaction request.
  • the consensus method of the blockchain system may also include:
  • the transaction request type of the transaction request is not the first transaction type
  • the transaction request is sent to the consensus cluster to which the target channel corresponding to the transaction request belongs.
  • the embodiments of the present invention can meet the high throughput requirements of the blockchain system when a large number of blockchain nodes are connected.
  • the performance of the blockchain system can be parallelized.
  • the increase in throughput greatly improves the throughput.
  • Fig. 9 shows a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.
  • the device shown in FIG. 9 may be set in the cluster scheduling node shown in FIG. 4, and the cluster scheduling node may be a server or a server cluster.
  • the consensus device of the blockchain system may include:
  • the first receiving module 910 is configured to receive a consensus cluster routing request sent by the target peer node
  • the first parsing module 920 is configured to parse the consensus cluster routing request to obtain routing request information, where the routing request information includes the node location of the target peer node;
  • the first determination module 930 is used to determine the target consensus cluster in at least one available consensus cluster according to the position of the node, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
  • the first sending module 940 is configured to send the target cluster address of the target consensus cluster to the target peer node.
  • the target peer node based on the node position of the target peer node carried in the consensus cluster routing request sent by the target peer node, in at least one available consensus cluster in the normal working state of the blockchain system, it is the target The peer node allocates the target consensus cluster, and sends the target cluster address of the target consensus cluster to the target peer node to realize the distribution of peer nodes through the node location, so that different peer nodes can match different consensus clusters based on their node locations In this way, multiple consensus clusters can be used to perform consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system, and thus can meet the demand for high throughput of the blockchain system.
  • the first determining module 930 is specifically configured to:
  • node location and cluster location determine the response time of each available consensus cluster to the target peer node
  • the available consensus cluster with the shortest response time is taken as the target consensus cluster.
  • the consensus device of the blockchain system may further include:
  • the first judgment module is used to judge whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first preset condition
  • the first determining module 930 is further used for:
  • the available consensus cluster with the shortest response time is taken as the target consensus set.
  • the first determining module 930 is further configured to:
  • the available consensus cluster with the second shortest response time is taken as the target consensus cluster.
  • the routing request information further includes the routing request type
  • the first judgment module is specifically used for:
  • the routing request type is the first routing type
  • the first judgment module is further used for:
  • the first preset condition includes at least one of the following:
  • the throughput in the cluster performance parameter is greater than or equal to the preset throughput threshold
  • the first duration for which the throughput is greater than or equal to the preset throughput threshold is greater than or equal to the first preset duration
  • the average transaction delay in the cluster performance parameters is greater than or equal to the preset delay threshold
  • the second time period when the average transaction delay is greater than or equal to the preset delay threshold is greater than or equal to the second preset time period.
  • the consensus device of the blockchain system may further include:
  • the fifth receiving module is used to receive the cluster registration request sent by the consensus cluster
  • the fourth parsing module is used to parse the cluster registration request to obtain cluster registration request information, where the cluster registration request information includes cluster verification information;
  • the cluster monitoring module is used to monitor the consensus cluster when the cluster verification information is verified
  • the first processing module is used to treat the consensus cluster as an available consensus cluster when it is monitored that the consensus cluster is in a normal working state.
  • the cluster registration request information further includes cluster configuration information
  • the consensus device of the blockchain system may further include:
  • the information query module is used to query the target cluster configuration information corresponding to the target consensus cluster
  • the address extraction module is used to extract the target cluster address from the target cluster configuration information.
  • the routing request information further includes node verification information
  • the first determining module 930 is also specifically used for:
  • the target consensus cluster is determined in at least one available consensus cluster according to the location of the node.
  • FIG. 10 shows a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
  • the device shown in FIG. 10 may be set in any consensus cluster shown in FIG. 4, the consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.
  • the consensus device of the blockchain system may include:
  • the second receiving module 1010 is configured to receive a transaction request sent by a target peer node, where the target peer node sends the transaction request based on the target cluster address, and the target cluster address is in at least one available consensus cluster based on the node location of the target peer node Confirm that the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
  • the second parsing module 1020 is used for parsing the easy request to obtain transaction request information, the transaction request information including transaction information;
  • Information consensus module 1030 used to initiate a consensus on transaction information
  • the transaction execution module 1040 is used to execute the transaction corresponding to the transaction information when the consensus is successful.
  • the consensus cluster can receive transaction requests sent by target peer nodes based on node location allocation, so as to realize the distribution of peer nodes through node locations, so that different peer nodes can match different nodes based on their node locations.
  • Consensus clusters can use multiple consensus clusters to perform consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system, and thus can meet the high throughput requirements of the blockchain system when a large number of nodes are connected. At the same time, even if the number of participating nodes increases, the scalability of the blockchain system can continue to be maintained.
  • the transaction request information further includes the transaction request type
  • the information consensus module 1030 is specifically used for:
  • the transaction request type is the first transaction type
  • a consensus is initiated for the transaction information.
  • the transaction request information further includes target channel information
  • the consensus device of the blockchain system may further include:
  • the first obtaining module is used to obtain target channel information when the transaction request type is not the first transaction type
  • the channel query module is used to query the target channel information in the target channel list, where the target channel list is a channel list stored locally;
  • the information consensus module 1030 is further used to:
  • the consensus device of the blockchain system may further include:
  • the first generation module is used to generate an address query request according to the target channel information when the target channel information is not queried;
  • the fifth sending module is used to send an address query request to the channel cooperation node, and the address query request is used to make the channel cooperation node query the cluster address corresponding to the target channel information.
  • the consensus device of the blockchain system may further include:
  • the sixth receiving module is configured to receive the cluster address corresponding to the target channel information fed back by the channel cooperation node;
  • the sixth sending module is used to send the cluster address corresponding to the target channel information to the target peer node.
  • the target channel information is a target hash value, which is generated according to the attribute information of the target channel corresponding to the transaction request;
  • the target channel list is a target hash table, and the target hash table includes a plurality of A hash value, each first hash value is generated according to the attribute information of a locally established channel.
  • the attribute information includes at least one of the following:
  • Channel name channel creator, channel creation time.
  • FIG. 11 shows a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
  • the device shown in FIG. 11 may be set in any channel cooperation node shown in FIG. 4.
  • the channel cooperation node may be a server or a server cluster.
  • the consensus device of the blockchain system may include:
  • the third receiving module 1110 is configured to receive an address query request sent by the target consensus cluster, and the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster;
  • the third parsing module 1120 is configured to parse the address query request to obtain address query request information, where the address query request information includes target channel information;
  • the address query module 1130 is used to query the cluster address corresponding to the target channel information in the distributed database
  • the second sending module 1140 is configured to send the cluster address corresponding to the target channel information to the peer node corresponding to the node address when the address query request information also includes the node address.
  • the cluster address of the consensus cluster corresponding to the transaction request can be queried through the channel collaboration node, so as to ensure the orderly progress of cross-consensus cluster transaction requests and improve the performance of the blockchain system. reliability.
  • the target channel information is a target hash value, and the target hash value is generated according to the attribute information of the target channel corresponding to the transaction request;
  • the distributed database includes a distributed hash table, and the distributed hash table includes multiple Two second hash values, each second hash value is generated according to the attribute information of a channel in the blockchain system;
  • the address query module 1130 is specifically used for:
  • a preset channel collaboration node Based on the distributed hash table, among multiple preset channel collaboration nodes, query the target channel collaboration node that stores the target hash value, where the preset channel collaboration node is used to maintain the distributed hash in the blockchain system Table node, a preset channel collaboration node corresponds to a consensus cluster;
  • the cluster address of the consensus cluster corresponding to the target channel cooperative node is used as the cluster address corresponding to the target channel information.
  • the attribute information includes at least one of the following:
  • Channel name channel creator, channel creation time.
  • the consensus device of the blockchain system may further include:
  • the seventh sending module is used to send the cluster address corresponding to the target channel information to the target consensus cluster when the address query request information does not include the node address.
  • FIG. 12 shows a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
  • the device shown in FIG. 12 may be set in any peer node shown in FIG. 4, and the peer node may be a server or a server cluster.
  • the consensus device of the blockchain system may include:
  • the third sending module 1210 is used to send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, according to the node position included in the routing request information of the consensus cluster routing request, in at least one available consensus cluster Determine the target consensus cluster in the process, and feed back the target cluster address corresponding to the target consensus cluster.
  • the available consensus cluster is the consensus cluster in the normal working state of the blockchain system;
  • the fourth receiving module 1220 is configured to receive the target cluster address fed back by the cluster scheduling node;
  • the fourth sending module 1230 is used to send a transaction request to the target consensus cluster based on the target cluster address.
  • the distribution of peer nodes can be realized by node positions, so that different peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used to perform parallel operations on a large number of peer nodes. Consensus improves the throughput of the blockchain system, which in turn can meet the demand for high throughput of the blockchain system.
  • the transaction request carries target channel information
  • the consensus device of the blockchain system may also include:
  • the seventh receiving module is used to receive the cluster address corresponding to the target channel information fed back by the target consensus cluster or the channel collaboration node when the transaction request type of the transaction request is not the first transaction type;
  • the eighth sending module is used to send a transaction request to the consensus cluster to which the target channel corresponding to the transaction request belongs based on the cluster address corresponding to the target channel information.
  • Fig. 13 shows a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.
  • the consensus device 1300 of the blockchain system includes an input device 1301, an input interface 1302, a central processing unit 1303, a memory 1304, an output interface 1305, and an output device 1306.
  • the input interface 1302, the central processing unit 1303, the memory 1304, and the output interface 1305 are connected to each other through the bus 1310
  • the input device 1301 and the output device 1306 are connected to the bus 1310 through the input interface 1302 and the output interface 1305, respectively, and then connected to the blockchain
  • the other components of the consensus device 1300 of the system are connected.
  • the input device 1301 receives input information from the outside, and transmits the input information to the central processing unit 1303 through the input interface 1302; the central processing unit 1303 processes the input information based on the computer executable instructions stored in the memory 1304 to generate output Information, the output information is temporarily or permanently stored in the memory 1304, and then the output information is transmitted to the output device 1306 through the output interface 1305; the output device 1306 outputs the output information to the outside of the consensus device 1300 of the blockchain system for users to use .
  • the consensus device of the blockchain system shown in FIG. 13 can also be implemented as including: a memory storing computer-executable instructions; and a processor, which can implement the present invention when executing computer-executable instructions
  • the embodiment describes the consensus method and device of the blockchain system.
  • the embodiment of the present invention also provides a computer-readable storage medium on which computer program instructions are stored; when the computer program instructions are executed by a processor, the consensus method of the blockchain system provided by the embodiments of the present invention is realized .
  • Examples of computer-readable storage media include non-transitory computer-readable storage media, such as Read-Only Memory (ROM), Random Access Memory (RAM), magnetic disks, or optical disks.
  • the functional blocks shown in the above structural block diagram can be implemented as hardware, software, firmware, or a combination thereof.
  • hardware When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, plug-ins, function cards, and so on.
  • ASIC application specific integrated circuit
  • the elements of the present invention are programs or code segments used to perform required tasks.
  • the program or code segment may be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link through a data signal carried in a carrier wave.
  • "Machine-readable medium" may include any medium that can store or transmit information.
  • machine-readable media examples include electronic circuits, semiconductor memory devices, ROM, flash memory, Erasable Programmable Read-Only Memory (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, and radio frequency (Radio Frequency). , RF) link, etc.
  • the code segment can be downloaded via a computer network such as the Internet, an intranet, and so on.
  • Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic array. It can also be understood that each block in the block diagram and/or flowchart and the combination of the blocks in the block diagram and/or flowchart can also be implemented by dedicated hardware that performs the specified function or action, or can be implemented by dedicated hardware and A combination of computer instructions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Supplying Of Containers To The Packaging Station (AREA)
  • Adornments (AREA)
  • Meat, Egg Or Seafood Products (AREA)

Abstract

Disclosed are a consensus method, apparatus and device for a blockchain system, and a medium. A consensus method for a blockchain system comprises: receiving a consensus cluster routing request sent by a target peer node; parsing the consensus cluster routing request to obtain routing request information, the routing request information comprising the node position of the target peer node; determining a target consensus cluster from at least one available consensus cluster according to the node position, the available consensus cluster being a consensus cluster in a normal working state in the blockchain system; and sending the target cluster address of the target consensus cluster to the target peer node. The embodiments of the present invention are able to solve the problem of the existing consensus mechanism being unable to satisfy the high throughput requirement of blockchain systems.

Description

区块链系统的共识方法、装置、设备及介质Consensus method, device, equipment and medium of blockchain system
相关申请的交叉引用Cross-references to related applications
本申请主张在2020年05月29日在中国提交的中国专利申请号202010478177.8的优先权,其全部内容通过引用包含于此。This application claims the priority of Chinese Patent Application No. 202010478177.8 filed in China on May 29, 2020, the entire content of which is incorporated herein by reference.
技术领域Technical field
本发明属于区块链技术领域,尤其涉及一种区块链系统的共识方法、装置、设备及介质。The present invention belongs to the field of blockchain technology, and in particular relates to a consensus method, device, equipment and medium of a blockchain system.
背景技术Background technique
共识机制是区块链系统中的各个节点就区块信息达成全网一致共识的机制,可以保证最新区块被准确添加至区块链以及各个节点所存储的区块链信息一致不分叉,甚至还可以抵御恶意攻击。The consensus mechanism is a mechanism by which each node in the blockchain system reaches a consensus on block information throughout the network. It can ensure that the latest block is accurately added to the blockchain and the blockchain information stored by each node is consistent and does not fork. It can even resist malicious attacks.
但是,随着区块链系统中节点数量的不断增加,已有的共识机制已经不足以满足区块链系统对高吞吐量的需求。However, with the continuous increase of the number of nodes in the blockchain system, the existing consensus mechanism is no longer sufficient to meet the high throughput requirements of the blockchain system.
发明内容Summary of the invention
本发明实施例提供一种区块链系统的共识方法、装置、设备及介质,能够解决已有的共识机制已经不足以满足区块链系统对高吞吐量的需求的问题。The embodiments of the present invention provide a consensus method, device, equipment, and medium of a blockchain system, which can solve the problem that the existing consensus mechanism is insufficient to meet the high throughput requirements of the blockchain system.
第一方面,本发明实施例提供了一种区块链系统的共识方法,包括:In the first aspect, an embodiment of the present invention provides a consensus method for a blockchain system, including:
接收目标对等节点发送的共识集群路由请求;Receive the consensus cluster routing request sent by the target peer node;
解析共识集群路由请求,得到路由请求信息,路由请求信息包括目标对等节点的节点位置;Analyze the consensus cluster routing request to obtain routing request information, which includes the node location of the target peer node;
根据节点位置,在至少一个可用共识集群中,确定目标共识集群,其中,可用共识集群为区块链系统中处于正常工作状态的共识集群;According to the location of the node, determine the target consensus cluster in at least one available consensus cluster, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
向目标对等节点发送目标共识集群的目标集群地址。Send the target cluster address of the target consensus cluster to the target peer node.
第二方面,本发明实施例提供了一种区块链系统的共识方法,包括:In the second aspect, an embodiment of the present invention provides a consensus method of a blockchain system, including:
接收目标对等节点发送的交易请求,其中,目标对等节点基于目标集群地址发送交易请求,目标集群地址根据目标对等节点的节点位置在至少一个可用共识集群中确定,可用共识集群为区块链系统中处于正常工作状态的共识集群;Receive a transaction request sent by a target peer node, where the target peer node sends a transaction request based on the target cluster address, and the target cluster address is determined in at least one available consensus cluster according to the node location of the target peer node, and the available consensus cluster is a block The consensus cluster in the normal working state of the chain system;
解析交易请求,得到交易请求信息,交易请求信息包括交易信息;Analyze the transaction request to obtain transaction request information, which includes transaction information;
针对交易信息发起共识;Initiate a consensus on transaction information;
在共识成功的情况下,执行交易信息对应的交易。In the case of a successful consensus, execute the transaction corresponding to the transaction information.
第三方面,本发明实施例提供了一种区块链系统的共识方法,包括:In the third aspect, an embodiment of the present invention provides a consensus method of a blockchain system, including:
接收目标共识集群发送的地址查询请求,地址查询请求根据目标共识集群所接收的交易请求所携带的目标通道信息生成;Receive an address query request sent by the target consensus cluster, and the address query request is generated based on the target channel information carried in the transaction request received by the target consensus cluster;
解析地址查询请求,得到地址查询请求信息,地址查询请求信息包括目标通道信息;Parse the address query request to obtain address query request information, which includes target channel information;
在分布式数据库中,查询目标通道信息对应的集群地址;In the distributed database, query the cluster address corresponding to the target channel information;
在地址查询请求信息还包括节点地址的情况下,向节点地址对应的对等节点发送目标通道信息对应的集群地址。When the address query request information also includes the node address, the cluster address corresponding to the target channel information is sent to the peer node corresponding to the node address.
第四方面,本发明实施例提供了一种区块链系统的共识方法,包括:In the fourth aspect, an embodiment of the present invention provides a consensus method for a blockchain system, including:
向集群调度节点发送共识集群路由请求,使集群调度节点响应于共识集群路由请求,根据共识集群路由请求的路由请求信息中包括的节点位置,在至少一个可用共识集群中确定目标共识集群,并反馈目标共识集群对应的目标集群地址,其中,可用共识集群为区块链系统中处于正常工作状态的共识集群;Send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, and determines the target consensus cluster in at least one available consensus cluster according to the node location included in the routing request information of the consensus cluster routing request, and feeds it back The target cluster address corresponding to the target consensus cluster, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
接收集群调度节点反馈的目标集群地址;Receive the target cluster address fed back by the cluster scheduling node;
基于目标集群地址,向目标共识集群发送交易请求。Based on the target cluster address, a transaction request is sent to the target consensus cluster.
第五方面,本发明实施例提供了一种区块链系统的共识装置,包括:In the fifth aspect, an embodiment of the present invention provides a consensus device for a blockchain system, including:
第一接收模块,用于接收目标对等节点发送的共识集群路由请求;The first receiving module is used to receive the consensus cluster routing request sent by the target peer node;
第一解析模块,用于解析共识集群路由请求,得到路由请求信息,路由请求信息包括目标对等节点的节点位置;The first parsing module is used to parse the consensus cluster routing request to obtain routing request information, and the routing request information includes the node location of the target peer node;
第一确定模块,用于根据节点位置,在至少一个可用共识集群中,确定目标共识集群,其中,可用共识集群为区块链系统中处于正常工作状态的共识集群;The first determining module is used to determine the target consensus cluster in at least one available consensus cluster according to the position of the node, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
第一发送模块,用于向目标对等节点发送目标共识集群的目标集群地 址。The first sending module is used to send the target cluster address of the target consensus cluster to the target peer node.
第六方面,本发明实施例提供了一种区块链系统的共识装置,包括:In a sixth aspect, an embodiment of the present invention provides a consensus device for a blockchain system, including:
第二接收模块,用于接收目标对等节点发送的交易请求,其中,目标对等节点基于目标集群地址发送交易请求,目标集群地址根据目标对等节点的节点位置在至少一个可用共识集群中确定,可用共识集群为区块链系统中处于正常工作状态的共识集群;The second receiving module is used to receive the transaction request sent by the target peer node, where the target peer node sends the transaction request based on the target cluster address, and the target cluster address is determined in at least one available consensus cluster according to the node location of the target peer node , The available consensus cluster is the consensus cluster in the normal working state of the blockchain system;
第二解析模块,用于解析交易请求,得到交易请求信息,交易请求信息包括交易信息;The second analysis module is used to analyze the transaction request to obtain transaction request information, the transaction request information including transaction information;
信息共识模块,用于针对交易信息发起共识;Information consensus module, used to initiate consensus on transaction information;
交易执行模块,用于在共识成功的情况下,执行交易信息对应的交易。The transaction execution module is used to execute the transaction corresponding to the transaction information when the consensus is successful.
第七方面,本发明实施例提供了一种区块链系统的共识装置,包括:In a seventh aspect, an embodiment of the present invention provides a consensus device for a blockchain system, including:
第三接收模块,用于接收目标共识集群发送的地址查询请求,地址查询请求根据目标共识集群所接收的交易请求所携带的目标通道信息生成;The third receiving module is used to receive the address query request sent by the target consensus cluster, and the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster;
第三解析模块,用于解析地址查询请求,得到地址查询请求信息,地址查询请求信息包括目标通道信息;The third parsing module is used to parse the address query request to obtain address query request information, and the address query request information includes target channel information;
地址查询模块,用于在分布式数据库中,查询目标通道信息对应的集群地址;The address query module is used to query the cluster address corresponding to the target channel information in the distributed database;
第二发送模块,用于在地址查询请求信息还包括节点地址的情况下,向节点地址对应的对等节点发送目标通道信息对应的集群地址。The second sending module is configured to send the cluster address corresponding to the target channel information to the peer node corresponding to the node address when the address query request information also includes the node address.
第八方面,本发明实施例提供了一种区块链系统的共识装置,包括:In an eighth aspect, an embodiment of the present invention provides a consensus device for a blockchain system, including:
第三发送模块,用于向集群调度节点发送共识集群路由请求,使集群调度节点响应于共识集群路由请求,根据共识集群路由请求的路由请求信息中包括的节点位置,在至少一个可用共识集群中确定目标共识集群,并反馈目标共识集群对应的目标集群地址,其中,可用共识集群为区块链系统中处于正常工作状态的共识集群;The third sending module is used to send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, according to the node position included in the routing request information of the consensus cluster routing request, in at least one available consensus cluster Determine the target consensus cluster, and feed back the target cluster address corresponding to the target consensus cluster, where the available consensus cluster is the consensus cluster in the blockchain system that is in a normal working state;
第四接收模块,用于接收集群调度节点反馈的目标集群地址;The fourth receiving module is used to receive the target cluster address fed back by the cluster scheduling node;
第四发送模块,用于基于目标集群地址,向目标共识集群发送交易请求。The fourth sending module is used to send a transaction request to the target consensus cluster based on the target cluster address.
第九方面,本发明实施例提供了一种区块链系统的共识设备,该设备包括:处理器以及存储有计算机程序指令的存储器;In a ninth aspect, an embodiment of the present invention provides a consensus device of a blockchain system, the device including: a processor and a memory storing computer program instructions;
处理器执行计算机程序指令时实现如第一方面、第二方面、第三方面或 第四方面所述的区块链系统的共识方法。The processor implements the consensus method of the blockchain system as described in the first aspect, the second aspect, the third aspect, or the fourth aspect when the processor executes the computer program instructions.
第十方面,本发明实施例提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序指令,计算机程序指令被处理器执行时实现如第一方面、第二方面、第三方面或第四方面所述的区块链系统的共识方法。In a tenth aspect, an embodiment of the present invention provides a computer-readable storage medium with computer program instructions stored on the computer-readable storage medium. When the computer program instructions are executed by a processor, the The consensus method of the blockchain system described in the third aspect or the fourth aspect.
本发明实施例的区块链系统的共识方法、装置、设备及介质,能够基于目标对等节点发送的共识集群路由请求所携带的目标对等节点的节点位置,在区块链系统的至少一个处于正常工作状态的可用共识集群中,为目标对等节点分配目标共识集群,并且向目标对等节点发送目标共识集群的目标集群地址,以通过节点位置实现对等节点的分流,使不同的对等节点可以基于其节点位置匹配不同的共识集群,从而可以利用多个共识集群并行对大量的对等节点进行共识,提高了区块链系统的吞吐量,进而能够满足区块链系统对高吞吐量的需求。The consensus method, device, equipment, and medium of the blockchain system in the embodiment of the present invention can be based on the node position of the target peer node carried in the consensus cluster routing request sent by the target peer node, in at least one of the blockchain systems In the available consensus clusters in a normal working state, assign the target consensus cluster to the target peer node, and send the target cluster address of the target consensus cluster to the target peer node, so as to realize the distribution of peer nodes through the node location, so that different pairs The peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used to consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system and can meet the high throughput of the blockchain system. The amount of demand.
附图说明Description of the drawings
为了更清楚地说明本发明实施例的技术方案,下面将对本发明实施例中所需要使用的附图作简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present invention more clearly, the following will briefly introduce the drawings needed in the embodiments of the present invention. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative work, other drawings can be obtained from these drawings.
图1是现有技术中的一种区块链系统的结构示意图;Figure 1 is a schematic diagram of the structure of a blockchain system in the prior art;
图2是图1中的区块链系统的系统架构图;Figure 2 is a system architecture diagram of the blockchain system in Figure 1;
图3是本发明一个实施例提供的区块链系统的系统架构图;Figure 3 is a system architecture diagram of a blockchain system provided by an embodiment of the present invention;
图4是图3所示系统架构下的一种区块链系统的结构示意图;Fig. 4 is a schematic structural diagram of a blockchain system under the system architecture shown in Fig. 3;
图5是本发明一个实施例提供的区块链系统的共识方法的流程示意图;FIG. 5 is a schematic flowchart of a consensus method of a blockchain system provided by an embodiment of the present invention;
图6是本发明另一个实施例提供的区块链系统的共识方法的流程示意图;6 is a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention;
图7是本发明又一个实施例提供的区块链系统的共识方法的流程示意图;FIG. 7 is a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention;
图8是本发明再一个实施例提供的区块链系统的共识方法的流程示意图;FIG. 8 is a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention;
图9是本发明一个实施例提供的区块链系统的共识装置的结构示意图;FIG. 9 is a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention;
图10是本发明另一个实施例提供的区块链系统的共识装置的结构示意图;FIG. 10 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention;
图11是本发明又一个实施例提供的区块链系统的共识装置的结构示意 图;Fig. 11 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention;
图12是本发明再一个实施例提供的区块链系统的共识装置的结构示意图;FIG. 12 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention;
图13是本发明一个实施例提供的区块链系统的共识设备的结构示意图。Fig. 13 is a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将详细描述本发明的各个方面的特征和示例性实施例,为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及具体实施例,对本发明进行进一步详细描述。应理解,此处所描述的具体实施例仅被配置为解释本发明,并不被配置为限定本发明。对于本领域技术人员来说,本发明可以在不需要这些具体细节中的一些细节的情况下实施。下面对实施例的描述仅仅是为了通过示出本发明的示例来提供对本发明更好的理解。The features and exemplary embodiments of each aspect of the present invention will be described in detail below. In order to make the objectives, technical solutions, and advantages of the present invention clearer, the following further describes the present invention in detail with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present invention, and are not configured to limit the present invention. For those skilled in the art, the present invention can be implemented without some of these specific details. The following description of the embodiments is only to provide a better understanding of the present invention by showing examples of the present invention.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply one of these entities or operations. There is any such actual relationship or order between. Moreover, the terms "including", "including" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device that includes a series of elements includes not only those elements, but also those that are not explicitly listed Other elements of, or also include elements inherent to this process, method, article or equipment. If there are no more restrictions, the element defined by the sentence "including..." does not exclude the existence of other same elements in the process, method, article, or equipment that includes the element.
共识机制是区块链系统中的各个节点就区块信息达成全网一致共识的机制,可以保证最新区块被准确添加至区块链以及各个节点所存储的区块链信息一致不分叉,甚至还可以抵御恶意攻击。The consensus mechanism is a mechanism by which each node in the blockchain system reaches a consensus on block information throughout the network. It can ensure that the latest block is accurately added to the blockchain and the blockchain information stored by each node is consistent and does not fork. It can even resist malicious attacks.
图1示出了现有技术中的一种区块链系统的结构示意图。Figure 1 shows a schematic structural diagram of a blockchain system in the prior art.
如图1所示,该区块链系统包括共识集群OC、对等集群PC-1、对等集群PC-2和用户集群CC。其中,共识集群OC包括至少一个共识节点。对等集群PC1和对等集群PC2分别包括至少一个对等节点,对等节点可以根据节点位置被划分至不同的对等集群。区块链账本BC-1,BC-2,BC-3,BC-4,BC-5,BC-6分别为共识集群OC与不同对等节点所形成的不同通道(例如子区块 链)对应的区块链账本。用户集群CC包括至少一个用户节点。As shown in Figure 1, the blockchain system includes a consensus cluster OC, a peer-to-peer cluster PC-1, a peer-to-peer cluster PC-2, and a user cluster CC. Among them, the consensus cluster OC includes at least one consensus node. The peer-to-peer cluster PC1 and the peer-to-peer cluster PC2 respectively include at least one peer node, and the peer nodes may be divided into different peer clusters according to node locations. Blockchain ledgers BC-1, BC-2, BC-3, BC-4, BC-5, BC-6 respectively correspond to different channels (such as sub-blockchains) formed by the consensus cluster OC and different peer nodes Blockchain ledger. The user cluster CC includes at least one user node.
图2示出了图1中的区块链系统的系统架构图。Figure 2 shows the system architecture diagram of the blockchain system in Figure 1.
如图2所示,该区块链系统为超级账本(Hyperledger Fabric)架构,Hyperledger Fabric架构包括证书颁发机构(Certificate Authority,CA)层201、共识层202和对等层203。其中,CA层201包括CA管理节点,负责所有层级节点的证书分发、吊销以及其他与区块链交易相关的权限控制操作。共识层202包括图1所示的共识集群OC,对等层203包括图1所示的对等集群PC1和对等集群PC2。As shown in Figure 2, the blockchain system is a Hyperledger (Hyperledger Fabric) architecture. The Hyperledger Fabric architecture includes a Certificate Authority (CA) layer 201, a consensus layer 202, and a peer layer 203. Among them, the CA layer 201 includes a CA management node, which is responsible for certificate distribution, revocation, and other authority control operations related to blockchain transactions for all level nodes. The consensus layer 202 includes the consensus cluster OC shown in FIG. 1, and the peer layer 203 includes the peer cluster PC1 and the peer cluster PC2 shown in FIG. 1.
在图1和图2所示的区块链系统中,每个用户节点可以与对应的对等集群中的对等节点通信,向对等节点发送服务请求或者接收对等节点反馈的请求结果。每个对等节点也可以与共识集群OC通信,基于所接收到的服务请求向共识集群OC发送交易请求或者接收共识集群OC反馈的请求结果。In the blockchain system shown in Figures 1 and 2, each user node can communicate with a peer node in a corresponding peer-to-peer cluster, and send a service request to the peer node or receive the request result fed back by the peer node. Each peer node can also communicate with the consensus cluster OC, and send a transaction request to the consensus cluster OC based on the received service request or receive the request result fed back by the consensus cluster OC.
但是,随着区块链系统中节点数量的不断增加,尤其是对等节点数量的不断增加,已有的共识机制已经不足以满足区块链系统对高吞吐量的需求。However, with the continuous increase in the number of nodes in the blockchain system, especially the continuous increase in the number of peer nodes, the existing consensus mechanism is no longer sufficient to meet the high throughput requirements of the blockchain system.
已有的提高区块链系统的吞吐量的方法一般为在不改变区块链系统的系统架构的情况下,对共识集群的共识算法进行改进,来提高区块链系统的吞吐量。Existing methods for improving the throughput of the blockchain system are generally to improve the consensus algorithm of the consensus cluster without changing the system architecture of the blockchain system to increase the throughput of the blockchain system.
但是,申请人发现,随着接入的用户节点的增多,用户侧每秒能被处理的交易量会迅速下降,仅依靠对共识算法的改进来满足区块链系统对高吞吐量的需求的难度较大,致使区块链系统的吞吐量依然较低。However, the applicant found that as the number of connected user nodes increases, the amount of transactions that can be processed per second on the user side will drop rapidly. It only relies on the improvement of the consensus algorithm to meet the high throughput requirements of the blockchain system. The difficulty is great, resulting in the low throughput of the blockchain system.
为了解决上述的问题,本发明实施例提供了一种新的应用于区块链系统的系统架构以及该系统架构对应的区块链系统。In order to solve the above-mentioned problems, the embodiments of the present invention provide a new system architecture applied to a blockchain system and a blockchain system corresponding to the system architecture.
图3示出了本发明一个实施例提供的区块链系统的系统架构图。Figure 3 shows a system architecture diagram of a blockchain system provided by an embodiment of the present invention.
如图3所示,该系统架构图包括CA层301、通道协同层302、共识集群层303、集群调度层304和对等层305。其中,CA层301包括CA管理节点,负责所有层级节点的证书分发、吊销以及其他与区块链交易相关的权限控制操作。共识集群层303可以包括一个或一个以上共识集群,用于基于交易请求进行共识,实现对区块链交易的统一排序。通道协同层302包括通道协同节点,用于对跨共识集群的交易请求进行通道协同路由,以提升系统跨区域服务能力。对等层305包括至少一个对等集群,用于向共识集群层发起交易请求。集群调度层304包括集群调度节点,用于为对等集群中的每个对等节点分 配共识集群,以实现对共识集群的动态分配。As shown in FIG. 3, the system architecture diagram includes a CA layer 301, a channel coordination layer 302, a consensus cluster layer 303, a cluster scheduling layer 304, and a peer layer 305. Among them, the CA layer 301 includes a CA management node, which is responsible for certificate distribution, revocation, and other authority control operations related to blockchain transactions for all level nodes. The consensus cluster layer 303 may include one or more consensus clusters, which are used to perform consensus based on transaction requests and achieve uniform sequencing of blockchain transactions. The channel coordination layer 302 includes channel coordination nodes, which are used for channel coordination routing of transaction requests across consensus clusters, so as to improve the system's cross-regional service capabilities. The peer-to-peer layer 305 includes at least one peer-to-peer cluster, which is used to initiate a transaction request to the consensus cluster layer. The cluster scheduling layer 304 includes a cluster scheduling node, which is used to allocate a consensus cluster to each peer node in the peer cluster, so as to realize the dynamic allocation of the consensus cluster.
在本发明一些实施例中,该系统架构可以为Hyperledger Fabric架构。在本发明另一些实施例中,该系统架构还可以为其他与Hyperledger Fabric架构相似的架构。In some embodiments of the present invention, the system architecture may be a Hyperledger Fabric architecture. In other embodiments of the present invention, the system architecture may also be other architectures similar to the Hyperledger Fabric architecture.
图4示出了图3所示系统架构下的一种区块链系统的结构示意图。Fig. 4 shows a schematic structural diagram of a blockchain system under the system architecture shown in Fig. 3.
如图4所示,该区块链系统包括通道协同层、共识集群OC-1、共识集群OC-2、共识集群OC-3、对等集群PC-1、集群调度层、对等集群PC-2和用户集群CC。其中,通道协同层包括分别位于每个共识集群内的通道协同节点。共识集群OC-1、共识集群OC-2和共识集群OC-3分别包括至少一个共识节点,不同的共识集群对应不同的位置区域。对等集群PC1和对等集群PC2分别包括至少一个对等节点,对等节点可以根据节点位置被划分至不同的对等集群。集群调度层包括至少一个集群调度节点。区块链账本BC-1,BC-2,BC-3,BC-4分别为不同共识集群为不同对等节点所建立的不同通道(例如子区块链)对应的区块链账本。用户集群CC包括至少一个用户节点。As shown in Figure 4, the blockchain system includes a channel coordination layer, a consensus cluster OC-1, a consensus cluster OC-2, a consensus cluster OC-3, a peer-to-peer cluster PC-1, a cluster scheduling layer, and a peer-to-peer cluster PC- 2 and user cluster CC. Among them, the channel coordination layer includes channel coordination nodes located in each consensus cluster. The consensus cluster OC-1, the consensus cluster OC-2, and the consensus cluster OC-3 each include at least one consensus node, and different consensus clusters correspond to different location areas. The peer-to-peer cluster PC1 and the peer-to-peer cluster PC2 respectively include at least one peer node, and the peer nodes may be divided into different peer clusters according to node locations. The cluster scheduling layer includes at least one cluster scheduling node. Blockchain ledgers BC-1, BC-2, BC-3, and BC-4 are respectively the blockchain ledgers corresponding to different channels (such as sub-blockchains) established by different consensus clusters for different peer nodes. The user cluster CC includes at least one user node.
在图3和图4所示的区块链系统中,每个用户节点可以与对应的对等集群中的对等节点通信,向对等节点发送服务请求或者接收对等节点反馈的请求结果。每个对等节点也可以与集群调度节点通信,基于所接收到的服务请求向集群调度节点发送共识集群路由请求,使集群调度节点基于共识集群路由请求所携带的对等节点的节点位置为该对等节点分配共识集群。每个对等节点也可以与集群调度节点为其分配的共识集群通信,基于所接收到的服务请求向共识集群发送交易请求或者接收共识集群反馈的请求结果。在共识集群接收到跨共识集群的交易请求的情况下,还可以通过通道协同节点为该交易请求进行通道协同路由,查找该交易请求对应的通道所属的共识集群,以使发送该交易请求的对等节点能够重新向交易请求交易请求对应的通道所属的共识集群发送该交易请求。In the blockchain systems shown in Figures 3 and 4, each user node can communicate with a peer node in a corresponding peer-to-peer cluster, and send a service request to the peer node or receive a request result fed back by the peer node. Each peer node can also communicate with the cluster scheduling node, and send a consensus cluster routing request to the cluster scheduling node based on the received service request, so that the cluster scheduling node is based on the node location of the peer node carried in the consensus cluster routing request. The peer nodes allocate consensus clusters. Each peer node can also communicate with the consensus cluster allocated by the cluster scheduling node, and send a transaction request to the consensus cluster based on the received service request or receive the request result fed back by the consensus cluster. When the consensus cluster receives a cross-consensus cluster transaction request, it can also perform channel coordination routing for the transaction request through the channel coordination node, and find the consensus cluster to which the channel corresponding to the transaction request belongs, so that the pair sending the transaction request Waiting for the node to be able to re-send the transaction request to the consensus cluster to which the channel corresponding to the transaction request belongs.
由此,本发明实施例提供的区块链系统,能够通过节点位置实现对等节点的分流,使不同的对等节点可以基于其节点位置匹配不同的共识集群,从而可以利用多个共识集群并行对大量的对等节点进行共识,提高了区块链系统的吞吐量,进而能够满足区块链系统对高吞吐量的需求,并且能够适应高效、安全的业务需求。Therefore, the blockchain system provided by the embodiment of the present invention can realize the distribution of peer nodes through the node position, so that different peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used in parallel Consensus on a large number of peer nodes improves the throughput of the blockchain system, which in turn can meet the needs of the blockchain system for high throughput, and can adapt to efficient and secure business requirements.
需要说明的是,在图4所示的区块链系统中,通道协同节点分别内嵌于对 应的共识集群中。在另一些实施例中,通道协同节点也可以与对应的共识集群分离设置,在此不做限制。It should be noted that in the blockchain system shown in Figure 4, the channel collaboration nodes are respectively embedded in the corresponding consensus clusters. In other embodiments, the channel collaboration node can also be set separately from the corresponding consensus cluster, which is not limited here.
基于本发明实施例提供的区块链系统,本发明实施例提供了一种区块链系统的共识方法、装置、设备及介质。下面首先对本发明实施例所提供的区块链系统的共识方法进行介绍。Based on the blockchain system provided by the embodiment of the present invention, the embodiment of the present invention provides a consensus method, device, equipment, and medium of the blockchain system. The following first introduces the consensus method of the blockchain system provided by the embodiment of the present invention.
图5示出了本发明一个实施例提供的区块链系统的共识方法的流程示意图。Fig. 5 shows a schematic flowchart of a consensus method of a blockchain system provided by an embodiment of the present invention.
在本发明一些实施例中,图5所示的方法可以由图4所示的集群调度节点执行。其中,集群调度节点可以为服务器或者服务器集群。In some embodiments of the present invention, the method shown in FIG. 5 may be executed by the cluster scheduling node shown in FIG. 4. Among them, the cluster scheduling node may be a server or a server cluster.
如图5所示,该区块链系统的共识方法可以包括:As shown in Figure 5, the consensus method of the blockchain system can include:
S510、接收目标对等节点发送的共识集群路由请求。S510. Receive a consensus cluster routing request sent by the target peer node.
在本发明一些实施例中,目标对等节点可以为区块链系统中的任意对等节点。例如,目标对等节点可以为图4所示的区块链系统中的任一个对等节点。In some embodiments of the present invention, the target peer node may be any peer node in the blockchain system. For example, the target peer node may be any peer node in the blockchain system shown in FIG. 4.
在本发明一些实施例中,集群调度节点所接收的共识集群路由请求的路由请求类型可以包括第一路由类型和第二路由类型。其中,第一路由类型可以用于表征该路由请求为对等节点在首次建立通道时所发送的共识集群路由请求,第二路由类型可以用于表征该路由请求为对等节点在加入已有通道时所发送的共识集群路由请求。In some embodiments of the present invention, the routing request type of the consensus cluster routing request received by the cluster scheduling node may include a first routing type and a second routing type. Among them, the first routing type can be used to characterize that the routing request is a consensus cluster routing request sent by the peer node when the channel is first established, and the second routing type can be used to characterize that the routing request is that the peer node is joining an existing channel. The consensus cluster routing request sent at the time.
在本发明一些实施例中,一个通道可以为一个子区块链。In some embodiments of the present invention, a channel may be a sub-blockchain.
S520、解析共识集群路由请求,得到路由请求信息,路由请求信息包括目标对等节点的节点位置。S520. Parse the consensus cluster routing request to obtain routing request information, where the routing request information includes the node location of the target peer node.
在本发明一些实施例中,集群调度节点可以对所接收的共识集群路由请求进行请求解析处理,得到共识集群路由请求中所包含的路由请求信息。In some embodiments of the present invention, the cluster scheduling node may perform request analysis processing on the received consensus cluster routing request to obtain the routing request information contained in the consensus cluster routing request.
在一些实施例中,路由请求信息可以包括目标对等节点的节点位置,节点位置包括目标对等节点的地理位置。在另一些实施例中,路由请求信息还可以包括路由请求类型。在又一些实施例中,路由请求信息也可以包括节点验证信息,节点验证信息包括用于验证目标对等节点的证书合法性的信息。在一些实施例中,路由请求信息还可以包括目标对等节点的节点地址,节点地址包括目标对等节点的节点互联网协议(Internet Protocol,IP)地址。In some embodiments, the route request information may include the node location of the target peer node, and the node location includes the geographic location of the target peer node. In other embodiments, the routing request information may also include the routing request type. In still other embodiments, the routing request information may also include node verification information, and the node verification information includes information used to verify the validity of the certificate of the target peer node. In some embodiments, the routing request information may further include the node address of the target peer node, and the node address includes the node Internet Protocol (IP) address of the target peer node.
需要说明的是,路由请求信息中还可以包括其他用于辅助集群调度节点 为目标对等节点分配目标共识集群的信息,在此不做限制。It should be noted that the routing request information may also include other information used to assist the cluster scheduling node to allocate the target consensus cluster to the target peer node, which is not limited here.
S530、根据节点位置,在至少一个可用共识集群中,确定目标共识集群,其中,可用共识集群为区块链系统中处于正常工作状态的共识集群。S530. Determine a target consensus cluster in at least one available consensus cluster according to the location of the node, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system.
在本发明一些实施例中,集群调度节点可以基于最短时间原则,根据节点位置和每个可用共识集群的集群位置,为目标对等节点分配目标共识集群。In some embodiments of the present invention, the cluster scheduling node may allocate a target consensus cluster to the target peer node based on the shortest time principle, according to the node location and the cluster location of each available consensus cluster.
具体地,集群调度节点可以持续监听共识集群层中的各个共识集群的心跳,并计算各个共识集群的响应时间,在接收到共识集群路由请求之后,可以基于共识集群路由请求所携带的目标对等节点的节点位置,在多个共识集群中选取位于该节点位置对应的预设距离范围内的共识集群,并在所选取的共识集群中选取响应时间最短的共识集群,作为目标共识集群,以基于最短时间原则为目标对等节点分配目标共识集群。Specifically, the cluster scheduling node can continuously monitor the heartbeat of each consensus cluster in the consensus cluster layer, and calculate the response time of each consensus cluster. After receiving the consensus cluster routing request, it can be based on the target peering carried in the consensus cluster routing request For the node position of the node, select the consensus cluster within the preset distance corresponding to the node position from multiple consensus clusters, and select the consensus cluster with the shortest response time from the selected consensus clusters as the target consensus cluster, based on The shortest time principle allocates the target consensus cluster to the target peer node.
其中,预设距离范围可以根据需要设置,在此不做限制。Among them, the preset distance range can be set as required, and there is no limitation here.
由此,在本发明实施例中,集群调度节点可以为目标对等节点分配响应时间最短的目标共识集群,进而提高交易处理的效率,提高用户的使用体验。Therefore, in the embodiment of the present invention, the cluster scheduling node can allocate the target consensus cluster with the shortest response time to the target peer node, thereby improving the efficiency of transaction processing and improving the user experience.
在本发明另一些实施例中,集群调度节点还可以基于最短距离原则,根据节点位置和每个可用共识集群的集群位置,为目标对等节点分配目标共识集群。In some other embodiments of the present invention, the cluster scheduling node can also allocate a target consensus cluster to the target peer node based on the shortest distance principle, according to the node location and the cluster location of each available consensus cluster.
其中,集群位置可以包括共识集群的地理位置。Among them, the cluster location may include the geographic location of the consensus cluster.
具体地,集群调度节点在接收到共识集群路由请求之后,可以基于共识集群路由请求所携带的目标对等节点的节点位置,在多个共识集群中选取集群位置与该节点位置的距离最近的共识集群,作为目标共识集群,以基于最短距离原则为目标对等节点分配目标共识集群。Specifically, after the cluster scheduling node receives the consensus cluster routing request, based on the node location of the target peer node carried in the consensus cluster routing request, the consensus cluster with the cluster location closest to the node location can be selected from multiple consensus clusters The cluster, as the target consensus cluster, allocates the target consensus cluster to the target peer nodes based on the shortest distance principle.
由此,在本发明实施例中,集群调度节点可以为目标对等节点分配距离最近的目标共识集群,进而提高交易处理的效率,提高用户的使用体验。Therefore, in the embodiment of the present invention, the cluster scheduling node can allocate the closest target consensus cluster to the target peer node, thereby improving the efficiency of transaction processing and improving the user experience.
在本发明一些实施例中,每个共识集群可以包括至少一个共识节点,共识节点可以为服务器或者服务器集群。In some embodiments of the present invention, each consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.
在本发明一些实施例中,正常工作状态为正常运行的工作状态。In some embodiments of the present invention, the normal working state is a working state of normal operation.
S540、向目标对等节点发送目标共识集群的目标集群地址。S540: Send the target cluster address of the target consensus cluster to the target peer node.
在本发明一些实施例中,集群调度节点在确定了目标共识集群之后,可 以查询该目标共识集群的目标集群地址,并且向目标对等节点发送目标共识集群的目标集群地址。In some embodiments of the present invention, after determining the target consensus cluster, the cluster scheduling node can query the target cluster address of the target consensus cluster, and send the target cluster address of the target consensus cluster to the target peer node.
在本发明一些实施例中,路由请求信息可以包括目标对等节点的节点地址,集群调度节点可以通过节点地址向目标对等节点发送目标共识集群的目标集群地址。In some embodiments of the present invention, the routing request information may include the node address of the target peer node, and the cluster scheduling node may send the target cluster address of the target consensus cluster to the target peer node through the node address.
在本发明实施例中,能够基于目标对等节点发送的共识集群路由请求所携带的目标对等节点的节点位置,在区块链系统的至少一个处于正常工作状态的可用共识集群中,为目标对等节点分配目标共识集群,并且向目标对等节点发送目标共识集群的目标集群地址,以通过节点位置实现对等节点的分流,使不同的对等节点可以基于其节点位置匹配不同的共识集群,从而可以利用多个共识集群并行对大量的对等节点进行共识,提高了区块链系统的吞吐量,进而能够满足区块链系统对高吞吐量的需求。In the embodiment of the present invention, based on the node position of the target peer node carried in the consensus cluster routing request sent by the target peer node, in at least one available consensus cluster in the normal working state of the blockchain system, it is the target The peer node allocates the target consensus cluster, and sends the target cluster address of the target consensus cluster to the target peer node to realize the distribution of peer nodes through the node location, so that different peer nodes can match different consensus clusters based on their node locations In this way, multiple consensus clusters can be used to perform consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system, and thus can meet the demand for high throughput of the blockchain system.
下面将详细介绍S530的具体实现方式。The specific implementation of S530 will be described in detail below.
在本发明一些实施例中,为了提高区块链系统的安全性,路由请求信息中还可以包括节点验证信息;In some embodiments of the present invention, in order to improve the security of the blockchain system, the routing request information may also include node verification information;
在集群调度节点执行S530之前,还可以对节点验证信息进行验证。Before the cluster scheduling node executes S530, the node verification information can also be verified.
相应地,S530的具体方法可以包括:Correspondingly, the specific method of S530 may include:
在节点验证信息通过验证的情况下,根据节点位置,在至少一个可用共识集群中,确定目标共识集群。In the case where the node verification information is verified, the target consensus cluster is determined in at least one available consensus cluster according to the location of the node.
在一些实施例中,节点验证信息可以由目标对等节点根据证书颁发机构节点为其分发的证书生成。例如,证书颁发机构节点可以为图3所示的CA层301中的节点。节点验证信息可以用于验证目标对等节点的证书合法性,以使集群调度节点确定目标对等节点是否为区块链系统的合法节点。In some embodiments, the node verification information may be generated by the target peer node according to the certificate distributed by the certificate authority node. For example, the certificate authority node may be a node in the CA layer 301 shown in FIG. 3. The node verification information can be used to verify the validity of the certificate of the target peer node, so that the cluster scheduling node can determine whether the target peer node is a legal node of the blockchain system.
在这些实施例中,若节点验证信息通过验证,则说明目标对等节点是区块链系统的合法节点,集群调度节点可以根据节点位置,在至少一个可用共识集群中,确定目标共识集群;若节点验证信息未通过验证,则说明目标对等节点不是区块链系统的合法节点,集群调度节点停止响应共识集群路由请求,不为目标对等节点分配任何的共识集群。In these embodiments, if the node verification information is verified, it means that the target peer node is a legitimate node of the blockchain system, and the cluster scheduling node can determine the target consensus cluster in at least one available consensus cluster according to the node location; if If the node verification information fails the verification, it means that the target peer node is not a legal node of the blockchain system, and the cluster scheduling node stops responding to consensus cluster routing requests, and does not allocate any consensus cluster to the target peer node.
由此,在本发明实施例中,集群调度节点可以首先验证目标对等节点的节点验证信息的合法性,并且在节点验证信息通过验证的情况下,为目标对等节点分配目标共识集群,进而提高区块链系统的安全性。Therefore, in the embodiment of the present invention, the cluster scheduling node can first verify the legitimacy of the node verification information of the target peer node, and if the node verification information passes the verification, allocate the target consensus cluster to the target peer node, and then Improve the security of the blockchain system.
在本发明一些实施例中,为了提高区块链系统的可靠性,在S530之前,该区块链系统的共识方法还可以包括:In some embodiments of the present invention, in order to improve the reliability of the blockchain system, before S530, the consensus method of the blockchain system may further include:
接收共识集群发送的集群注册请求;Receive the cluster registration request sent by the consensus cluster;
解析集群注册请求,得到集群注册请求信息,集群注册请求信息包括集群验证信息;Parse the cluster registration request to obtain cluster registration request information. The cluster registration request information includes cluster verification information;
在集群验证信息通过验证的情况下,监听共识集群;When the cluster verification information is verified, monitor the consensus cluster;
在监听到共识集群处于正常工作状态的情况下,将共识集群作为可用共识集群。In the case of monitoring that the consensus cluster is in a normal working state, the consensus cluster is regarded as an available consensus cluster.
具体地,每个共识集群在初次启动时,均会向集群调度节点发送集群注册请求,以在集群注册请求中进行注册。集群调度节点在接收到共识集群发送的集群注册请求之后,可以解析集群注册请求,得到集群验证信息,然后基于集群验证信息验证该共识集群的合法性,并且在集群验证信息通过验证的情况下,该共识集群注册成功,集群调度节点可以持续监听该共识集群。如果监听到共识集群处于正常工作状态,则将该共识集群作为可用共识集群,加入共识集群动态网络地图;如果监听到共识集群未处于正常工作状态,则将该共识集群作为不可用共识集群,并且将该共识集群从共识集群动态网络地图中移除。Specifically, when each consensus cluster is first started, it will send a cluster registration request to the cluster scheduling node to register in the cluster registration request. After the cluster scheduling node receives the cluster registration request sent by the consensus cluster, it can parse the cluster registration request to obtain the cluster verification information, and then verify the legitimacy of the consensus cluster based on the cluster verification information, and if the cluster verification information is verified, The consensus cluster is successfully registered, and the cluster scheduling node can continuously monitor the consensus cluster. If it is monitored that the consensus cluster is in a normal working state, the consensus cluster is regarded as an available consensus cluster and added to the consensus cluster dynamic network map; if it is monitored that the consensus cluster is not in a normal working state, the consensus cluster is regarded as an unavailable consensus cluster, and Remove the consensus cluster from the consensus cluster dynamic network map.
其中,集群验证信息包括用于验证共识集群的证书合法性的信息。集群验证信息可以由共识集群根据证书颁发机构节点为其分发的证书生成。例如,证书颁发机构节点可以为图3所示的CA层301中的节点。集群验证信息可以用于验证共识集群的证书合法性,以使集群调度节点确定共识集群是否为区块链系统的合法集群。Wherein, the cluster verification information includes information used to verify the validity of the certificate of the consensus cluster. The cluster verification information can be generated by the consensus cluster according to the certificate distributed by the certificate authority node. For example, the certificate authority node may be a node in the CA layer 301 shown in FIG. 3. The cluster verification information can be used to verify the validity of the certificate of the consensus cluster, so that the cluster scheduling node can determine whether the consensus cluster is a legal cluster of the blockchain system.
在本发明一些实施例中,共识集群在注册成功之后,可以向集群调度节点发送共识集群的心跳,集群调度节点可以基于共识集群的心跳,对共识集群进行监听,以确定共识集群是否处于正常工作状态。In some embodiments of the present invention, after the consensus cluster is successfully registered, it can send the heartbeat of the consensus cluster to the cluster scheduling node, and the cluster scheduling node can monitor the consensus cluster based on the heartbeat of the consensus cluster to determine whether the consensus cluster is working normally state.
在这些实施例中,可选地,S530的具体方法可以包括:In these embodiments, optionally, the specific method of S530 may include:
根据节点位置,在共识集群动态网络地图中的至少一个可用共识集群中,确定目标共识集群。According to the position of the node, the target consensus cluster is determined in at least one available consensus cluster in the consensus cluster dynamic network map.
由于共识集群动态网络地图中的可用共识集群是基于各个共识集群的工作状态动态变化的,因此,集群调度节点可以为目标对等节点动态地分配处于正常工作状态的目标共识集群,以提高区块链系统的可靠性。Since the available consensus clusters in the consensus cluster dynamic network map are dynamically changed based on the working status of each consensus cluster, the cluster scheduling node can dynamically allocate the target consensus cluster in the normal working state to the target peer node to improve the block The reliability of the chain system.
在本发明另一些实施例中,集群注册请求信息还可以包括集群配置信息,集群配置信息可以包括共识集群的集群标识(Identity Document,ID)、集群IP地址和集群位置等于共识集群的配置相关的信息。In other embodiments of the present invention, the cluster registration request information may also include cluster configuration information, and the cluster configuration information may include the identity document (ID) of the consensus cluster, the cluster IP address, and the cluster location equal to the configuration related information of the consensus cluster. information.
在这些实施例中,可选地,在S540之前,该区块链系统的共识方法还可以包括:In these embodiments, optionally, before S540, the consensus method of the blockchain system may further include:
查询目标共识集群对应的目标集群配置信息;Query the target cluster configuration information corresponding to the target consensus cluster;
在目标集群配置信息中,提取目标集群地址。In the target cluster configuration information, extract the target cluster address.
具体地,集群调度节点可以在各个已经注册的共识集群的集群配置信息中,基于目标共识集群的目标集群ID,查询目标共识集群对应的目标集群配置信息,并且在目标集群配置信息中,提取目标集群地址,以向目标对等节点发送为其分配的目标共识集群的目标集群地址。Specifically, the cluster scheduling node can query the target cluster configuration information corresponding to the target consensus cluster in the cluster configuration information of each registered consensus cluster based on the target cluster ID of the target consensus cluster, and extract the target from the target cluster configuration information The cluster address is used to send the target cluster address of the target consensus cluster allocated to the target peer node.
在本发明一些实施例中,为了提高区块链系统的交易处理效率,在将响应时间最短的可用共识集群作为目标共识集群之前,该区块链系统的共识方法还可以包括:In some embodiments of the present invention, in order to improve the transaction processing efficiency of the blockchain system, before the available consensus cluster with the shortest response time is used as the target consensus cluster, the consensus method of the blockchain system may further include:
判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件。Determine whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first preset condition.
其中,集群性能参数可以包括共识集群的吞吐量和交易平均延时等参数。交易平均延时可以从与该共识集群通信的对等节点获取,对等节点在向该共识集群发送交易请求后,可以每隔一定时间向集群调度节点发送与其通信的共识集群通信的交易平均延时。Among them, the cluster performance parameters may include parameters such as the throughput of the consensus cluster and the average transaction delay. The average transaction delay can be obtained from the peer node communicating with the consensus cluster. After the peer node sends a transaction request to the consensus cluster, it can send the average transaction delay of the consensus cluster communication with the cluster scheduling node to the cluster scheduling node at regular intervals. Time.
在这些实施例中,可选地,将响应时间最短的可用共识集群作为目标共识集群的具体方法可以包括:In these embodiments, optionally, the specific method of using the available consensus cluster with the shortest response time as the target consensus cluster may include:
在集群性能参数不满足第一预设条件的情况下,将响应时间最短的可用共识集群作为目标共识集群。In the case that the cluster performance parameters do not meet the first preset condition, the available consensus cluster with the shortest response time is taken as the target consensus cluster.
具体地,集群调度节点可以在确定了对目标对等节点的响应时间最短的可用共识集群之后,判断该可用共识集群的集群性能参数是否满足第一预设条件,确定该可用共识集群是否达到了饱和状态。如果确定集群性能参数不满足第一预设条件,即该可用共识集群未达到饱和状态,则可以将响应时间最短的可用共识集群作为目标共识集群。Specifically, the cluster scheduling node may determine whether the cluster performance parameters of the available consensus cluster meet the first preset condition after determining the available consensus cluster with the shortest response time to the target peer node, and determine whether the available consensus cluster has reached Saturated state. If it is determined that the cluster performance parameters do not meet the first preset condition, that is, the available consensus cluster has not reached the saturation state, the available consensus cluster with the shortest response time may be used as the target consensus cluster.
在另一些实施例中,在判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件之后,该区块链系统的共识方法还可以包括:In other embodiments, after determining whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first preset condition, the consensus method of the blockchain system may further include:
在集群性能参数满足第一预设条件的情况下,将响应时间次最短的可用共识集群作为目标共识集群。When the cluster performance parameters meet the first preset condition, the available consensus cluster with the second shortest response time is taken as the target consensus cluster.
具体地,集群调度节点还可以在判断该可用共识集群的集群性能参数是否满足第一预设条件之后,如果确定集群性能参数满足第一预设条件,即该可用共识集群达到饱和状态,则可以将响应时间次最短的可用共识集群作为目标共识集群。Specifically, the cluster scheduling node may also determine whether the cluster performance parameters of the available consensus cluster meet the first preset condition, and if it is determined that the cluster performance parameters meet the first preset condition, that is, the available consensus cluster reaches a saturated state, then The available consensus cluster with the shortest response time is taken as the target consensus cluster.
由此,在本发明实施例中,可以进一步基于可用共识集群的饱和情况和响应时间进行综合判断,以为目标对等节点动态地分配处于正常工作状态的目标共识集群,进一步提高区块链系统的可靠性。Therefore, in the embodiment of the present invention, a comprehensive judgment can be made based on the saturation and response time of the available consensus clusters, so as to dynamically allocate the target consensus clusters in the normal working state for the target peer nodes, and further improve the performance of the blockchain system. reliability.
在本发明一些实施例中,还可以对响应时间次最短的可用共识集群进行饱和情况的判断,并且确定是否将响应时间次最短的可用共识集群作为目标共识集群。In some embodiments of the present invention, it is also possible to judge the saturation of the available consensus cluster with the next shortest response time, and determine whether to use the available consensus cluster with the next shortest response time as the target consensus cluster.
需要说明的是,对响应时间次最短的可用共识集群进行饱和情况的判断的方法与对响应时间最短的可用共识集群进行饱和情况的判断的方法相似,确定是否将响应时间次最短的可用共识集群作为目标共识集群的方法与确定是否将响应时间最短的可用共识集群作为目标共识集群的方法相似,在此不做赘述。It should be noted that the method for judging the saturation of the available consensus cluster with the shortest response time is similar to the method for judging the saturation of the available consensus cluster with the shortest response time. Determine whether the available consensus cluster with the shortest response time is determined. The method for the target consensus cluster is similar to the method for determining whether the available consensus cluster with the shortest response time is used as the target consensus cluster, and will not be repeated here.
在本发明一些实施例中,为了进一步提高区块链系统的交易处理效率,路由请求信息还可以包括路由请求类型;In some embodiments of the present invention, in order to further improve the transaction processing efficiency of the blockchain system, the routing request information may also include the routing request type;
在这些实施例中,判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件的具体方法还可以包括:In these embodiments, the specific method for judging whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition may further include:
在路由请求类型为第一路由类型的情况下,判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件。When the routing request type is the first routing type, it is determined whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition.
具体地,在判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件之前,还可以判断共识集群路由请求的路由请求类型。如果路由请求类型为第一路由类型,即路由请求类型为对等节点在首次建立通道时所发送的共识集群路由请求,则判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件,并且不再考虑已经为饱和状态的共识集群。如果路由请求类型为第二路由类型,即路由请求类型为对等节点在加入已有通道时所发送的共识集群路由请求,则无需判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件,仍可考虑已经为饱和状态的共识 集群。Specifically, before determining whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition, the routing request type of the consensus cluster routing request can also be determined. If the routing request type is the first routing type, that is, the routing request type is the consensus cluster routing request sent by the peer node when the channel is first established, then determine whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first preset Conditions, and no longer consider the consensus cluster that has been saturated. If the routing request type is the second routing type, that is, the routing request type is the consensus cluster routing request sent by the peer node when joining an existing channel, there is no need to determine whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first With preset conditions, consensus clusters that are already saturated can still be considered.
在本发明一些实施例中,第一预设条件可以包括下列中的至少一项:In some embodiments of the present invention, the first preset condition may include at least one of the following:
集群性能参数中的吞吐量大于或等于预设吞吐量阈值;The throughput in the cluster performance parameter is greater than or equal to the preset throughput threshold;
吞吐量大于或等于预设吞吐量阈值的第一时长大于或等于第一预设时长;The first duration for which the throughput is greater than or equal to the preset throughput threshold is greater than or equal to the first preset duration;
集群性能参数中的交易平均延时大于或等于预设延时阈值;The average transaction delay in the cluster performance parameters is greater than or equal to the preset delay threshold;
交易平均延时大于或等于预设延时阈值的第二时长大于或等于第二预设时长。The second time period when the average transaction delay is greater than or equal to the preset delay threshold is greater than or equal to the second preset time period.
具体地,预设吞吐量阈值可以对应基准技术指标临界水平,例如,预设吞吐量阈值可以为90%,也可以为根据需要设置的其他阈值。交易平均延时也可以对应基准技术指标临界水平,例如,预设延时阈值可以为10%,也可以为根据需要设置的其他阈值。第一预设时长和第二预设时长可以分别为根据需要设置的时长,在此不做限制。Specifically, the preset throughput threshold may correspond to the critical level of the benchmark technical indicator. For example, the preset throughput threshold may be 90%, or may be other thresholds set as needed. The average transaction delay can also correspond to the critical level of the benchmark technical indicator. For example, the preset delay threshold can be 10%, or other thresholds set as needed. The first preset duration and the second preset duration may be durations set according to needs, respectively, and there is no limitation here.
在一些实施例中,交易平均延时大于或等于预设延时阈值可以为共识集群中的全部共识节点的交易平均延时大于或等于预设延时阈值。在另一些实施例中,交易平均延时大于或等于预设延时阈值可以为共识集群中的预定数量的共识节点的交易平均延时大于或等于预设延时阈值。In some embodiments, the average transaction delay greater than or equal to the preset delay threshold may be that the average transaction delay of all consensus nodes in the consensus cluster is greater than or equal to the preset delay threshold. In other embodiments, the average transaction delay is greater than or equal to the preset delay threshold may be that the average transaction delay of the predetermined number of consensus nodes in the consensus cluster is greater than or equal to the preset delay threshold.
其中,预定数量可以为共识集群中共识节点总数的10%,也可以为根据需要设置的其他数量。Among them, the predetermined number can be 10% of the total number of consensus nodes in the consensus cluster, or other numbers set as needed.
在本发明一些实施例中,集群调度节点可以直接基于集群性能参数来判断该可用共识集群的集群性能参数是否满足第一预设条件。In some embodiments of the present invention, the cluster scheduling node may directly determine whether the cluster performance parameter of the available consensus cluster meets the first preset condition based on the cluster performance parameter.
在另一些实施例中,为了减少集群调度节点的数据处理量,判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件的具体方法还包括:In other embodiments, in order to reduce the data processing volume of the cluster scheduling node, the specific method for judging whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition further includes:
检测响应时间最短的可用共识集群是否具有饱和状态标记;Check whether the available consensus cluster with the shortest response time has a saturation status mark;
在检测到具有饱和状态标记的情况下,确定响应时间最短的可用共识集群的集群性能参数满足第一预设条件;In the case of detecting a saturation state mark, determine that the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition;
在检测到不具有饱和状态标记的情况下,确定响应时间最短的可用共识集群的集群性能参数不满足第一预设条件。In the case where it is detected that it does not have a saturation state mark, it is determined that the cluster performance parameter of the available consensus cluster with the shortest response time does not meet the first preset condition.
具体地,集群调度节点可以每隔一定时间判断每个可用共识集群的集群性能参数是否满足第一预设条件,并为集群性能参数满足第一预设条件的可 用共识集群添加饱和状态标记。Specifically, the cluster scheduling node may determine whether the cluster performance parameters of each available consensus cluster meet the first preset condition at regular intervals, and add a saturation state mark to the available consensus clusters whose cluster performance parameters meet the first preset condition.
在集群调度节点获取了响应时间最短的可用共识集群之后,既可以通过饱和状态标记判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件,进而可以减少集群调度节点的数据处理量,提高数据处理效率。After the cluster scheduling node obtains the available consensus cluster with the shortest response time, the saturation status flag can be used to determine whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first preset condition, thereby reducing the data processing of the cluster scheduling node Increase the efficiency of data processing.
在本发明一些实施例中,一个共识集群可以对应一个位置区域(即地理区域),一个位置区域可以对应至少一个共识集群,集群调度节点可以基于不同位置区域间由于经济发展程度不同而可能导致所关联区块链业务在活跃程度上的差异,实现负载均衡机制,为每个对等节点合理分配共识集群,从而实现将对等节点进行区域划分,以解决单一共识集群的共识算法性能限制而使该位置区域的交易共识处理能力饱和的情况。In some embodiments of the present invention, a consensus cluster can correspond to a location area (ie a geographic area), and a location area can correspond to at least one consensus cluster. The cluster scheduling node can be based on different location areas that may cause problems due to different economic development levels. Associate the difference in the degree of activity of the blockchain business, implement a load balancing mechanism, and reasonably allocate consensus clusters for each peer node, so as to realize the regional division of peer nodes to solve the performance limitation of the consensus algorithm of a single consensus cluster. The situation where the transaction consensus processing capacity of the location area is saturated.
图6示出了本发明另一个实施例提供的区块链系统的共识方法的流程示意图。FIG. 6 shows a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
在本发明一些实施例中,图6所示的方法可以由图4所示的任一个共识集群执行。其中,共识集群可以包括至少一个共识节点,共识节点可以为服务器或者服务器集群。In some embodiments of the present invention, the method shown in FIG. 6 may be executed by any consensus cluster shown in FIG. 4. Among them, the consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.
如图6所示,该区块链系统的共识方法可以包括:As shown in Figure 6, the consensus method of the blockchain system can include:
S610、接收目标对等节点发送的交易请求,其中,目标对等节点基于目标集群地址发送交易请求,目标集群地址根据目标对等节点的节点位置在至少一个可用共识集群中确定,可用共识集群为区块链系统中处于正常工作状态的共识集群;S610. Receive a transaction request sent by the target peer node, where the target peer node sends the transaction request based on the target cluster address, and the target cluster address is determined in at least one available consensus cluster according to the node location of the target peer node. The available consensus cluster is A consensus cluster in a normal working state in the blockchain system;
在本发明一些实施例中,目标对等节点可以为区块链系统中的任意对等节点。例如,目标对等节点可以为图4所示的区块链系统中的任一个对等节点。In some embodiments of the present invention, the target peer node may be any peer node in the blockchain system. For example, the target peer node may be any peer node in the blockchain system shown in FIG. 4.
在本发明一些实施例中,共识集群所接收的交易请求的交易请求类型可以包括第一交易类型、第二交易类型和第三交易类型。其中,第一交易类型可以用于表征交易请求为建立通道的交易请求,第二交易类型可以用于表征交易请求为加入已有通道的交易请求,第三交易类型可以用于表征交易请求为发起已有通道内的交易的交易请求。In some embodiments of the present invention, the transaction request type of the transaction request received by the consensus cluster may include a first transaction type, a second transaction type, and a third transaction type. Among them, the first transaction type can be used to indicate that the transaction request is a transaction request to establish a channel, the second transaction type can be used to indicate that the transaction request is a transaction request to join an existing channel, and the third transaction type can be used to indicate that the transaction request is an initiation A transaction request for a transaction in an existing channel.
S620、解析交易请求,得到交易请求信息,交易请求信息包括交易信息;S620: Parse the transaction request to obtain transaction request information, where the transaction request information includes transaction information;
在本发明一些实施例中,共识集群可以对所接收的交易请求进行请求解析处理,得到交易请求所包含的交易请求信息。In some embodiments of the present invention, the consensus cluster may perform request analysis processing on the received transaction request, and obtain the transaction request information contained in the transaction request.
在一些实施例中,交易请求信息可以包括交易信息,交易信息为用于发起共识的信息。在另一些实施例中,交易请求信息可以包括交易请求类型。在又一些实施例中,交易请求信息也可以包括目标通道信息。在再一些实施例中,交易请求信息还可以包括目标对等节点的节点地址,节点地址包括目标对等节点的节点IP地址。在一些实施例中,交易请求信息还可以包括节点验证信息,节点验证信息包括用于验证目标对等节点的证书合法性的信息。In some embodiments, the transaction request information may include transaction information, and the transaction information is information used to initiate a consensus. In other embodiments, the transaction request information may include the transaction request type. In still other embodiments, the transaction request information may also include target channel information. In still other embodiments, the transaction request information may further include the node address of the target peer node, and the node address includes the node IP address of the target peer node. In some embodiments, the transaction request information may further include node verification information, and the node verification information includes information used to verify the validity of the certificate of the target peer node.
需要说明的是,交易请求信息中还可以包括其他用于辅助共识集群为目标对等节点进行交易共识的信息,在此不做限制。It should be noted that the transaction request information may also include other information used to assist the consensus cluster to conduct transaction consensus for the target peer node, which is not limited here.
S630、针对交易信息发起共识;S630. Initiate a consensus on transaction information;
在本发明一些实施例中,共识集群可以基于单一的zookeeper共识算法针对交易信息发起共识。在本发明另一些实施例中,共识集群也可以基于支持的raft共识算法针对交易信息发起共识。在本发明其他实施例中,共识集群也可以基于其他共识算法针对交易信息发起共识,在此不做限制。In some embodiments of the present invention, the consensus cluster may initiate a consensus on transaction information based on a single zookeeper consensus algorithm. In other embodiments of the present invention, the consensus cluster may also initiate a consensus on transaction information based on the supported raft consensus algorithm. In other embodiments of the present invention, the consensus cluster may also initiate a consensus on transaction information based on other consensus algorithms, which is not limited here.
S640、在共识成功的情况下,执行交易信息对应的交易。S640. In the case that the consensus is successful, execute the transaction corresponding to the transaction information.
在本发明实施例中,共识集群能够接收基于节点位置分配的目标对等节点发送的交易请求,以通过节点位置实现对等节点的分流,使不同的对等节点可以基于其节点位置匹配不同的共识集群,从而可以利用多个共识集群并行对大量的对等节点进行共识,提高了区块链系统的吞吐量,进而能够满足大量节点接入时区块链系统对高吞吐量的需求。同时,即使参与节点增多,区块链系统的扩展性能也可以继续保持。In the embodiment of the present invention, the consensus cluster can receive transaction requests sent by target peer nodes based on node location allocation, so as to realize the distribution of peer nodes through node locations, so that different peer nodes can match different nodes based on their node locations. Consensus clusters can use multiple consensus clusters to perform consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system, and thus can meet the high throughput requirements of the blockchain system when a large number of nodes are connected. At the same time, even if the number of participating nodes increases, the scalability of the blockchain system can continue to be maintained.
下面将详细介绍S630的具体实现方式。The specific implementation of S630 will be described in detail below.
在本发明一些实施例中,为了提高共识集群的数据处理效率,交易请求信息还可以包括交易请求类型。In some embodiments of the present invention, in order to improve the data processing efficiency of the consensus cluster, the transaction request information may also include the transaction request type.
在这些实施例中,可选地,针对交易信息发起共识的具体方法可以包括:In these embodiments, optionally, the specific method for initiating a consensus on transaction information may include:
在交易请求类型为第一交易类型的情况下,针对交易信息发起共识。In the case where the transaction request type is the first transaction type, a consensus is initiated for the transaction information.
具体地,在针对交易信息发起共识之前,可以首先判断交易请求的交易请求类型,如果交易请求类型为第一交易类型,即交易请求可以为表征建立通道的交易请求,则可以直接针对交易信息发起共识,进而提高共识集群的 数据处理效率。Specifically, before initiating a consensus on transaction information, you can first determine the transaction request type of the transaction request. If the transaction request type is the first transaction type, that is, the transaction request can be a transaction request that characterizes the establishment of a channel, and the transaction information can be directly initiated. Consensus, thereby improving the data processing efficiency of the consensus cluster.
在本发明另一些实施例中,为了提高共识集群的可靠性,交易请求信息还可以包括目标通道信息。In other embodiments of the present invention, in order to improve the reliability of the consensus cluster, the transaction request information may also include target channel information.
在这些实施例中,可选地,解析交易请求得到交易请求信息之后,该区块链系统的共识方法还可以包括:In these embodiments, optionally, after parsing the transaction request to obtain the transaction request information, the consensus method of the blockchain system may further include:
在交易请求类型不是第一交易类型的情况下,获取目标通道信息;In the case that the transaction request type is not the first transaction type, obtain the target channel information;
在目标通道列表中查询目标通道信息,其中,目标通道列表为本地存储的通道列表,目标通道列表中可以包括多个第一通道信息,每个第一通道信息可以根据一个本地建立的通道的属性信息生成。Query the target channel information in the target channel list, where the target channel list is a channel list stored locally. The target channel list can include multiple first channel information, and each first channel information can be based on the attributes of a locally established channel Information generation.
在这些实施例中,可选地,针对交易信息发起共识的具体方法可以包括:In these embodiments, optionally, the specific method for initiating a consensus on transaction information may include:
在查询到目标通道信息的情况下,针对交易信息发起共识。When the target channel information is queried, a consensus is initiated for the transaction information.
具体地,在针对交易信息发起共识之前,在解析交易请求得到交易请求信息之后,可以首先判断交易请求的交易请求类型,如果交易请求类型不是第一交易类型,而是第二交易类型或第三交易类型,即交易请求为加入已有通道的交易请求或发起已有通道内的交易的交易请求,则需要进一步在本地存储的目标通道列表中的多个根据本地建立的通道的属性信息生成的第一通道信息中查询目标通道信息,如果在目标通道列表中的多个第一通道信息中查询到目标通道信息,则可以针对交易信息发起共识,进而可以避免共识集群处理其他共识集群对应的交易请求,提高共识集群的可靠性。Specifically, before initiating a consensus on the transaction information, after parsing the transaction request to obtain the transaction request information, the transaction request type of the transaction request can be determined first. If the transaction request type is not the first transaction type, but the second transaction type or the third transaction type. Transaction type, that is, if the transaction request is a transaction request to join an existing channel or a transaction request to initiate a transaction in an existing channel, it needs to be further generated in the target channel list stored locally based on the attribute information of the locally established channel The target channel information is queried in the first channel information. If the target channel information is queried from multiple first channel information in the target channel list, a consensus can be initiated on the transaction information, which can prevent the consensus cluster from processing transactions corresponding to other consensus clusters Request to improve the reliability of the consensus cluster.
在这些实施例中,本地存储的通道列表指的是目标集群地址对应的共识集群中所存储的通道列表,本地建立的通道指的是目标集群地址对应的共识集群所建立的通道。当目标对等节点想要加入一个已有通道或者发起已有通道内的交易时,仅能通过建立该已有通道的共识集群发起共识,因此,交易请求类型不是第一交易类型,而是第二交易类型或第三交易类型,则需要通过交易请求信息中的目标通道信息确定目标对等节点所针对的已有通道是否为该共识集群所建立的通道,由于目标通道信息中仅会存储该共识集群所建立的通道对应的通道信息,如果在目标通道列表中查询目标通道信息,则说明目标对等节点所针对的已有通道为该共识集群所建立的通道,则可以针对交易信息发起共识。In these embodiments, the locally stored channel list refers to the channel list stored in the consensus cluster corresponding to the target cluster address, and the locally established channel refers to the channel established by the consensus cluster corresponding to the target cluster address. When the target peer node wants to join an existing channel or initiate a transaction in an existing channel, it can only initiate a consensus by establishing the consensus cluster of the existing channel. Therefore, the transaction request type is not the first transaction type, but the first transaction type. For the second transaction type or the third transaction type, the target channel information in the transaction request information needs to be used to determine whether the existing channel targeted by the target peer node is the channel established by the consensus cluster, because only the target channel information will be stored The channel information corresponding to the channel established by the consensus cluster. If the target channel information is queried in the target channel list, it means that the existing channel targeted by the target peer node is the channel established by the consensus cluster, and consensus can be initiated for transaction information .
在另一些实施例中,在目标通道列表中查询目标通道信息之后,该区块 链系统的共识方法还可以包括:In other embodiments, after querying the target channel information in the target channel list, the consensus method of the blockchain system may further include:
在未查询到目标通道信息的情况下,根据目标通道信息,生成地址查询请求;If the target channel information is not queried, generate an address query request based on the target channel information;
向通道协同节点发送地址查询请求,地址查询请求用于使通道协同节点查询目标通道信息对应的集群地址。An address query request is sent to the channel coordination node, and the address query request is used to enable the channel coordination node to query the cluster address corresponding to the target channel information.
具体地,共识集群在预设通道列表中查询目标通道信息之后,如果在预设通道列表中未查询到目标通道信息,则可以确定该交易请求为其他共识集群对应的交易请求,则可以生成该目标通道信息对应的地址查询请求,并且向通道协同节点发送地址查询请求,使通道协同节点响应于地址查询请求查询目标通道信息对应的集群地址。Specifically, after the consensus cluster queries the target channel information in the preset channel list, if the target channel information is not queried in the preset channel list, it can be determined that the transaction request is a transaction request corresponding to other consensus clusters, and the transaction request can be generated. An address query request corresponding to the target channel information is sent, and an address query request is sent to the channel cooperation node, so that the channel cooperation node queries the cluster address corresponding to the target channel information in response to the address query request.
在本发明一些实施例中,在向通道协同节点发送地址查询请求之后,该区块链系统的共识方法还可以包括:In some embodiments of the present invention, after sending an address query request to the channel coordination node, the consensus method of the blockchain system may further include:
接收通道协同节点反馈的目标通道信息对应的集群地址;Receive the cluster address corresponding to the target channel information fed back by the channel cooperative node;
向目标对等节点发送目标通道信息对应的集群地址。Send the cluster address corresponding to the target channel information to the target peer node.
在这些实施例中,通道协同节点可以在查询到目标通道信息对应的集群地址之后,向发送该地址查询请求的共识集群反馈目标通道信息对应的集群地址。共识集群接收到通道协同节点反馈的目标通道信息对应的集群地址之后,可以将目标通道信息对应的集群地址发送给目标对等节点,使目标对等节点基于目标通道信息对应的集群地址向正确的共识集群重新发送交易请求,进而保证区块链系统的可靠性。In these embodiments, the channel cooperation node may, after querying the cluster address corresponding to the target channel information, feed back the cluster address corresponding to the target channel information to the consensus cluster that sent the address query request. After the consensus cluster receives the cluster address corresponding to the target channel information fed back by the channel cooperative node, it can send the cluster address corresponding to the target channel information to the target peer node, so that the target peer node sends the correct cluster address based on the target channel information. The consensus cluster resends the transaction request to ensure the reliability of the blockchain system.
在本发明另一些实施例中,地址查询请求还可以携带有目标对等节点的节点地址,通道协同节点可以在查询到目标通道信息对应的集群地址之后,可以直接基于节点地址,向目标对等节点反馈的目标通道信息对应的集群地址,进而减少信息转发次数,提高对目标对等节点的交易请求的响应速度。In other embodiments of the present invention, the address query request may also carry the node address of the target peer node, and the channel coordinating node may query the cluster address corresponding to the target channel information directly based on the node address to send the target peer node address. The cluster address corresponding to the target channel information fed back by the node, thereby reducing the number of information forwarding, and improving the response speed to the transaction request of the target peer node.
需要说明的是,通道协同节点响应于地址查询请求反馈目标通道信息对应的集群地址的具体方法将在下文详细说明,在此不做赘述。It should be noted that the specific method for the channel coordination node to feed back the cluster address corresponding to the target channel information in response to the address query request will be described in detail below, and will not be repeated here.
在这些实施例中,由于目标通道信息中仅会存储该共识集群所建立的通道对应的通道信息,如果在目标通道列表中未查询目标通道信息,则说明目标对等节点所针对的已有通道不是该共识集群所建立的通道,则需要通过通道协同节点为其查找建立该已有通道的共识集群的集群地址。In these embodiments, since only the channel information corresponding to the channel established by the consensus cluster is stored in the target channel information, if the target channel information is not queried in the target channel list, it indicates the existing channel targeted by the target peer node If the channel is not established by the consensus cluster, the channel coordination node needs to find the cluster address of the consensus cluster that established the existing channel for it.
在本发明一些实施例中,目标通道信息为目标哈希值,目标哈希值根据 交易请求对应的目标通道的属性信息生成;目标通道列表为目标哈希表,目标哈希表包括多个第一哈希值,每个第一哈希值根据一个本地建立的通道的属性信息生成。In some embodiments of the present invention, the target channel information is a target hash value, which is generated according to the attribute information of the target channel corresponding to the transaction request; the target channel list is a target hash table, and the target hash table includes a plurality of A hash value, each first hash value is generated according to the attribute information of a locally established channel.
具体地,在共识集群每创建一个通道时,该共识集群可以将所创建的通道的属性信息通过预设哈希算法转换为唯一的哈希值,并作为第一哈希值存储在该共识集群的目标哈希表中。Specifically, when a consensus cluster creates a channel, the consensus cluster can convert the attribute information of the created channel into a unique hash value through a preset hash algorithm, and store it in the consensus cluster as the first hash value In the target hash table.
在共识集群针对交易信息发起共识之前,在解析交易请求得到交易请求信息之后,如果交易请求类型不是第一交易类型,则需要进一步在目标哈希表的多个第一哈希值中查询目标哈希值。如果查询到目标哈希值,则可以针对交易信息发起共识;如果未查询到目标哈希值,则可以确定该交易请求为其他共识集群对应的交易请求。Before the consensus cluster initiates a consensus on the transaction information, after parsing the transaction request to obtain the transaction request information, if the transaction request type is not the first transaction type, you need to further query the target hash value in the multiple first hash values of the target hash table. Hope value. If the target hash value is queried, a consensus can be initiated for the transaction information; if the target hash value is not queried, it can be determined that the transaction request is a transaction request corresponding to other consensus clusters.
由此,在本发明实施例中,每个通道对应的通道信息可以对应一个哈希值,可以提高利用通道信息的安全性,进而提高区块链系统的安全性。Therefore, in the embodiment of the present invention, the channel information corresponding to each channel can correspond to a hash value, which can improve the security of using the channel information, thereby improving the security of the blockchain system.
在本发明一些实施例中,属性信息包括下列中的至少一项:In some embodiments of the present invention, the attribute information includes at least one of the following:
通道名称、通道创建者、通道创建时间。Channel name, channel creator, channel creation time.
在一些实施例中,属性信息可以包括通道名称、通道创建者和通道创建时间中的任意一个。在另一些实施例中,属性信息还可以包括通道名称、通道创建者和通道创建时间中的任意两个。在又一些实施例中,属性信息也可以包括通道名称、通道创建者和通道创建时间。In some embodiments, the attribute information may include any one of the channel name, channel creator, and channel creation time. In other embodiments, the attribute information may also include any two of the channel name, channel creator, and channel creation time. In still other embodiments, the attribute information may also include the channel name, channel creator, and channel creation time.
在一些实施例中,通道创建者可以通过请求创建通道的对等节点的节点IP地址表示。在另一些实施例中,通道创建者也可以通过请求创建通道的的对等节点的公钥表示,在此不做限制。In some embodiments, the channel creator may be represented by the node IP address of the peer node requesting to create the channel. In other embodiments, the channel creator may also indicate the public key of the peer node requesting to create the channel, which is not limited here.
在一些实施例中,通道创建时间可以为通道创建的时间戳。In some embodiments, the channel creation time may be the timestamp of channel creation.
图7示出了本发明又一个实施例提供的区块链系统的共识方法的流程示意图。FIG. 7 shows a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
在本发明一些实施例中,图7所示的方法可以由图4所示的任一个通道协同节点执行。其中,通道协同节点可以为服务器或者服务器集群。In some embodiments of the present invention, the method shown in FIG. 7 may be executed by any channel coordination node shown in FIG. 4. Among them, the channel cooperation node may be a server or a server cluster.
如图7所示,该区块链系统的共识方法可以包括:As shown in Figure 7, the consensus method of the blockchain system can include:
S710、接收目标共识集群发送的地址查询请求,地址查询请求根据目标共识集群所接收的交易请求所携带的目标通道信息生成。S710. Receive an address query request sent by the target consensus cluster, and the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster.
在本发明一些实施例中,目标共识集群可以为区块链系统中的任意共识 集群。例如,目标共识集群可以为图4所示的区块链系统中的任一个共识集群。In some embodiments of the present invention, the target consensus cluster may be any consensus cluster in the blockchain system. For example, the target consensus cluster may be any consensus cluster in the blockchain system shown in FIG. 4.
S720、解析地址查询请求,得到地址查询请求信息,地址查询请求信息包括目标通道信息。S720. Parse the address query request to obtain address query request information, where the address query request information includes target channel information.
在一些实施例中,地址查询请求信息可以包括目标通道信息。在另一些实施例中,地址查询请求信息还可以包括节点地址,节点地址可以为向目标共识集群发送交易请求的对等节点的节点地址,节点地址可以包括对等节点的节点IP地址。在又一些实施例中,地址查询请求信息还可以包括目标共识集群的集群地址,目标共识集群的集群地址可以包括目标共识集群的集群IP地址。In some embodiments, the address query request information may include target channel information. In other embodiments, the address query request information may further include a node address, which may be the node address of a peer node that sends a transaction request to the target consensus cluster, and the node address may include the node IP address of the peer node. In still other embodiments, the address query request information may further include the cluster address of the target consensus cluster, and the cluster address of the target consensus cluster may include the cluster IP address of the target consensus cluster.
需要说明的是,地址查询请求信息中还可以包括其他用于辅助通道协同节点为查询集群地址的信息,在此不做限制。It should be noted that the address query request information may also include other information used to assist the channel coordination node to query the cluster address, which is not limited here.
S730、在分布式数据库中,查询目标通道信息对应的集群地址;S730. Query the cluster address corresponding to the target channel information in the distributed database;
在本发明一些实施例中,分布式数据库中可以存储有区块链系统中的至少一个第二通道信息,分布式数据库中的每个子数据库存储于一个共识集群对应的预设通道协同节点中,使得各个预设通道协同节点可以基于分布式数据库的协议在分布式数据库中,查询存储有目标通道信息的目标通道协同节点,并将目标通道协同节点对应的共识集群的集群地址作为目标通道信息对应的集群地址。In some embodiments of the present invention, the distributed database may store at least one second channel information in the blockchain system, and each sub-database in the distributed database is stored in a preset channel coordination node corresponding to a consensus cluster, Makes each preset channel coordination node can query the target channel coordination node storing the target channel information in the distributed database based on the protocol of the distributed database, and use the cluster address of the consensus cluster corresponding to the target channel coordination node as the target channel information correspondence The cluster address.
其中,一个第二通道信息对应区块链系统中的一个已有通道。预设通道协同节点为区块链系统中用于维护分布式数据库的节点,一个预设通道协同节点对应一个共识集群。Among them, a second channel information corresponds to an existing channel in the blockchain system. The preset channel collaboration node is a node used to maintain a distributed database in the blockchain system, and a preset channel collaboration node corresponds to a consensus cluster.
需要说明的是,每个共识集群建立新的通道以后,会将该通道的路由信息发送给该共识集群对应的预设通道协同节点,每个预设通道协同节点中可以存储分布式数据库中属于该预设通道协同节点的子数据库,各个预设通道协同节点基于分布式数据库查找存储有目标通道信息的目标通道协同节点的方法可以利用已有的分布式数据库的查询方法实现,即在相邻的共识集群对应的预设通道协同节点之间转发地址查询请求,以使接收到地址查询请求的预设通道协同节点在本地存储的子数据库中查询该目标通道信息,以实现对目标通道协同节点的查询,在此不做赘述。It should be noted that after each consensus cluster establishes a new channel, the routing information of the channel will be sent to the preset channel collaboration node corresponding to the consensus cluster, and each preset channel collaboration node can store the distributed database belonging to In the sub-database of the preset channel cooperative node, the method for each preset channel cooperative node to find the target channel cooperative node that stores the target channel information based on the distributed database can be implemented by the existing distributed database query method, that is, in the adjacent The preset channel coordination node corresponding to the consensus cluster forwards the address query request, so that the preset channel coordination node that receives the address query request queries the target channel information in the locally stored sub-database, so as to achieve the target channel coordination node For the query, I won’t repeat it here.
S740、在地址查询请求信息还包括节点地址的情况下,向节点地址对应 的对等节点发送目标通道信息对应的集群地址。S740: If the address query request information also includes the node address, send the cluster address corresponding to the target channel information to the peer node corresponding to the node address.
具体地,地址查询请求还可以根据节点地址生成,使地址查询请求携带有节点地址,进而使地址查询请求信息包括节点地址。此时,通道协同节点在查询到目标通道信息对应的集群地址之后,可以直接基于节点地址,向节点地址对应的对等节点发送目标通道信息对应的集群地址,进而使该对等节点基于目标通道信息对应的集群地址向正确的共识集群重新发送交易请求。Specifically, the address query request may also be generated according to the node address, so that the address query request carries the node address, and the address query request information includes the node address. At this time, after the channel coordinating node has inquired about the cluster address corresponding to the target channel information, it can directly send the cluster address corresponding to the target channel information to the peer node corresponding to the node address based on the node address, so that the peer node is based on the target channel The cluster address corresponding to the information resends the transaction request to the correct consensus cluster.
由此,通道协同节点可以直接向对等节点发送目标通道信息对应的集群地址,提高对对等节点的响应速度。In this way, the channel cooperation node can directly send the cluster address corresponding to the target channel information to the peer node, thereby improving the response speed to the peer node.
在本发明实施例中,对于跨共识集群的交易请求,可以通过通道协同节点查询交易请求对应的共识集群的集群地址,从而保障跨共识集群的交易请求的有序进行,提高区块链系统的可靠性。In the embodiment of the present invention, for cross-consensus cluster transaction requests, the cluster address of the consensus cluster corresponding to the transaction request can be queried through the channel collaboration node, so as to ensure the orderly progress of cross-consensus cluster transaction requests and improve the performance of the blockchain system. reliability.
下面将详细介绍S730的具体实现方式。The specific implementation of S730 will be described in detail below.
在本发明一些实施例中,目标通道信息为目标哈希值,目标哈希值根据交易请求对应的目标通道的属性信息生成;分布式数据库包括分布式哈希表,分布式哈希表包括多个第二哈希值,每个第二哈希值根据区块链系统中的一个通道的属性信息生成。In some embodiments of the present invention, the target channel information is a target hash value, and the target hash value is generated according to the attribute information of the target channel corresponding to the transaction request; the distributed database includes a distributed hash table, and the distributed hash table includes multiple Each second hash value is generated according to the attribute information of a channel in the blockchain system.
在这些实施例中,可选地,S730的具体方法可以包括:In these embodiments, optionally, the specific method of S730 may include:
基于分布式哈希表,在多个预设通道协同节点中,查询存储有目标哈希值的目标通道协同节点,其中,预设通道协同节点为区块链系统中用于维护分布式哈希表的节点,一个预设通道协同节点对应一个共识集群;Based on the distributed hash table, among multiple preset channel collaboration nodes, query the target channel collaboration node that stores the target hash value, where the preset channel collaboration node is used to maintain the distributed hash in the blockchain system Table node, a preset channel collaboration node corresponds to a consensus cluster;
将目标通道协同节点对应的共识集群的集群地址,作为目标通道信息对应的集群地址。The cluster address of the consensus cluster corresponding to the target channel cooperative node is used as the cluster address corresponding to the target channel information.
具体地,一个第二哈希值对应一个通道,每个共识集群建立新的通道以后,可以利用该通道的属性信息生成该通道对应的哈希值,然后将该通道对应的哈希值发送给该共识集群对应的预设通道协同节点,预设通道协同节点会将接收到的哈希值作为第二哈希值存储在分布式哈希表中。Specifically, a second hash value corresponds to a channel. After each consensus cluster establishes a new channel, the attribute information of the channel can be used to generate the hash value corresponding to the channel, and then the hash value corresponding to the channel is sent to The preset channel collaboration node corresponding to the consensus cluster, and the preset channel collaboration node will store the received hash value as the second hash value in the distributed hash table.
每个预设通道协同节点中可以存储分布式哈希表中属于该预设通道协同节点的哈希子表,各个预设通道协同节点基于分布式哈希表查找存储有目标通道信息的目标通道协同节点的方法可以利用已有的分布式哈希表的查询方法实现,即由于目标共识集群相对应的通道协同节点开始,在相邻的共识集群对应的预设通道协同节点之间转发地址查询请求,以使接收到地址查询请 求的预设通道协同节点解析地址查询请求中的目标哈希值后,然后将解析得到的目标哈希值与在本地存储的哈希子表中的各个第二哈希值进行对比,进而确定目标哈希值是否存在于本地存储的哈希子表中,如果存在于本地存储的哈希子表中,则该预设通道协同节点可以确定其为目标通道协同节点,并将其对应的共识集群的集群地址反馈给向其发送地址查询请求的通道协同节点,最终返回至需要查询目标通道信息对应的集群地址的通道协同节点,即与目标共识集群相对应的通道协同节点。当与目标共识集群相对应的通道协同节点接收到目标通道协同节点对应的共识集群的集群地址后,可以将其作为目标通道信息对应的集群地址。Each preset channel collaboration node can store a hash sub-table belonging to the preset channel collaboration node in the distributed hash table, and each preset channel collaboration node searches for the target channel collaboration that stores the target channel information based on the distributed hash table. The node method can be realized by using the existing distributed hash table query method, that is, since the channel coordination node corresponding to the target consensus cluster starts, the address query request is forwarded between the preset channel coordination nodes corresponding to the adjacent consensus clusters , So that the preset channel cooperation node that received the address query request parses the target hash value in the address query request, and then compares the parsed target hash value with each second hash in the locally stored hash sub-table The value is compared to determine whether the target hash value exists in the locally stored hash sub-table. If it exists in the locally stored hash sub-table, the preset channel coordination node can determine that it is the target channel coordination node, and The cluster address of its corresponding consensus cluster is fed back to the channel coordination node that sent the address query request to it, and finally returned to the channel coordination node that needs to query the cluster address corresponding to the target channel information, that is, the channel coordination node corresponding to the target consensus cluster. After the channel coordination node corresponding to the target consensus cluster receives the cluster address of the consensus cluster corresponding to the target channel coordination node, it can be used as the cluster address corresponding to the target channel information.
在本发明实施例中,分布式哈希表可以为基于Kademlia协议的分布式哈希表,也可以为基于其他协议的分布式哈希表,在此不做限制。In the embodiment of the present invention, the distributed hash table may be a distributed hash table based on the Kademlia protocol, or a distributed hash table based on other protocols, which is not limited here.
在本发明一些实施例中,属性信息包括下列中的至少一项:In some embodiments of the present invention, the attribute information includes at least one of the following:
通道名称、通道创建者、通道创建时间。Channel name, channel creator, channel creation time.
其中,属性信息已在上文说明,在此不做赘述。Among them, the attribute information has been described above, and will not be repeated here.
以上为S730的具体实现方式。The above is the specific implementation of S730.
在本发明一些实施例中,在S730之后,该区块链系统的共识方法还可以包括:In some embodiments of the present invention, after S730, the consensus method of the blockchain system may further include:
在地址查询请求信息不包括节点地址的情况下,向目标共识集群发送目标通道信息对应的集群地址。In the case that the address query request information does not include the node address, the cluster address corresponding to the target channel information is sent to the target consensus cluster.
具体地,地址查询请求还可以不根据节点地址生成,使地址查询请求不携带节点地址,进而使地址查询请求信息不包括节点地址。此时,通道协同节点在查询到目标通道信息对应的集群地址之后,可以基于目标共识集群的集群地址,向目标共识集群发送目标通道信息对应的集群地址,以使目标共识集群将目标通道信息对应的集群地址转发至发送该携带有目标通道信息的交易请求的对等节点,进而使该对等节点基于目标通道信息对应的集群地址向正确的共识集群重新发送交易请求。Specifically, the address query request may not be generated based on the node address, so that the address query request does not carry the node address, and the address query request information does not include the node address. At this point, after the channel cooperative node has inquired about the cluster address corresponding to the target channel information, it can send the cluster address corresponding to the target channel information to the target consensus cluster based on the cluster address of the target consensus cluster, so that the target consensus cluster corresponds to the target channel information The cluster address of is forwarded to the peer node that sends the transaction request carrying the target channel information, so that the peer node resends the transaction request to the correct consensus cluster based on the cluster address corresponding to the target channel information.
由此,通道协同节点可以通过目标共识集群向对等节点转发目标通道信息对应的集群地址,以减少地址查询请求所携带的数据量。Therefore, the channel cooperation node can forward the cluster address corresponding to the target channel information to the peer node through the target consensus cluster, so as to reduce the amount of data carried in the address query request.
以基于区块链系统的供应链溯源场景为例,假设地区A的生产企业B需要将所生产产品分销至地区C的经销企业D,并需要在区块链上对货物进行追踪。为不失一般性,假设生产企业A所分配的共识集群为共识集群O1,并 通过共识集群O1首先建立通道E。此后,经销企业B向集群调度节点所分配的共识集群O2发起加入该通道E的交易请求。由于共识集群O2不含有通道E相关信息,无法处理该交易请求,因此,向通道协同节点发送地址查询请求。通道协同节点在通道协同层的各个通道协同节点之间转发地址查询请求(最终至共识集群O1)并查找到该通道对应的共识集群O1的集群地址,最终返回对应集群地址给经销企业B,B更新通道E所对应的集群地址。此后,生产企业A与经销企业B可以基于通道E对应的集群地址正常沟通创建符合双方业务需求和利益的具体智能合约,协同开展供应链溯源业务。Taking the supply chain traceability scenario based on the blockchain system as an example, suppose that the production company B in area A needs to distribute the products produced to the distribution company D in area C, and the goods need to be tracked on the blockchain. For the sake of generality, suppose that the consensus cluster allocated by the production enterprise A is the consensus cluster O1, and the channel E is first established through the consensus cluster O1. Thereafter, the distribution company B initiates a transaction request to join the channel E to the consensus cluster O2 assigned by the cluster scheduling node. Since the consensus cluster O2 does not contain channel E-related information and cannot process the transaction request, it sends an address query request to the channel cooperative node. The channel coordination node forwards the address query request between each channel coordination node in the channel coordination layer (eventually to the consensus cluster O1) and finds the cluster address of the consensus cluster O1 corresponding to the channel, and finally returns the corresponding cluster address to the distribution enterprise B, B Update the cluster address corresponding to channel E. After that, the production company A and the distribution company B can communicate normally based on the cluster address corresponding to the channel E to create a specific smart contract that meets the business needs and interests of both parties, and coordinate the supply chain traceability business.
综上所述,通道协同节点可以实现面向通道的共识集群动态切换机制,能够在多共识集群调度基础上保障区块链交易在全局任一可用共识集群中的存续与流转,并最终上链,保证区块链系统的安全性与完备性。In summary, the channel collaboration node can implement a channel-oriented consensus cluster dynamic switching mechanism, which can ensure the existence and circulation of blockchain transactions in any globally available consensus cluster based on multi-consensus cluster scheduling, and finally go on the chain. Ensure the security and completeness of the blockchain system.
图8示出了本发明再一个实施例提供的区块链系统的共识方法的流程示意图。FIG. 8 shows a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.
在本发明一些实施例中,图8所示的方法可以由图4所示的任一个对等节点执行。其中,对等节点可以为服务器或者服务器集群。In some embodiments of the present invention, the method shown in FIG. 8 may be executed by any peer node shown in FIG. 4. Among them, the peer node may be a server or a server cluster.
如图8所示,该区块链系统的共识方法可以包括:As shown in Figure 8, the consensus method of the blockchain system can include:
S810、向集群调度节点发送共识集群路由请求,使集群调度节点响应于共识集群路由请求,根据共识集群路由请求的路由请求信息中包括的节点位置,在至少一个可用共识集群中确定目标共识集群,并反馈目标共识集群对应的目标集群地址,其中,可用共识集群为区块链系统中处于正常工作状态的共识集群;S810. Send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, and determines the target consensus cluster in at least one available consensus cluster according to the node position included in the routing request information of the consensus cluster routing request. And feedback the target cluster address corresponding to the target consensus cluster, where the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;
S820、接收集群调度节点反馈的目标集群地址;S820: Receive the target cluster address fed back by the cluster scheduling node;
S830、基于目标集群地址,向目标共识集群发送交易请求。S830. Send a transaction request to the target consensus cluster based on the target cluster address.
在本发明实施例中,能够通过节点位置实现对等节点的分流,使不同的对等节点可以基于其节点位置匹配不同的共识集群,从而可以利用多个共识集群并行对大量的对等节点进行共识,提高了区块链系统的吞吐量,进而能够满足区块链系统对高吞吐量的需求。In the embodiment of the present invention, the distribution of peer nodes can be realized by node positions, so that different peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used to perform parallel operations on a large number of peer nodes. Consensus improves the throughput of the blockchain system, which in turn can meet the demand for high throughput of the blockchain system.
在本发明一些实施例中,在交易请求的交易请求类型是第一交易类型的情况下,目标共识集群可以直接基于交易请求发起共识。In some embodiments of the present invention, in the case that the transaction request type of the transaction request is the first transaction type, the target consensus cluster may directly initiate a consensus based on the transaction request.
在本发明另一些实施例中,交易请求中可以携带有该交易请求对应的目标通道的目标通道信息,在S830之后,该区块链系统的共识方法还可以包 括:In other embodiments of the present invention, the transaction request may carry the target channel information of the target channel corresponding to the transaction request. After S830, the consensus method of the blockchain system may also include:
在交易请求的交易请求类型不是第一交易类型的情况下,接收目标共识集群或通道协同节点反馈的目标通道信息对应的集群地址;In the case that the transaction request type of the transaction request is not the first transaction type, receive the cluster address corresponding to the target channel information fed back by the target consensus cluster or channel collaboration node;
基于目标通道信息对应的集群地址,向交易请求对应的目标通道所属的共识集群发送交易请求。Based on the cluster address corresponding to the target channel information, the transaction request is sent to the consensus cluster to which the target channel corresponding to the transaction request belongs.
综上所述,本发明实施例能够满足大量区块链节点接入时对区块链系统的高吞吐量需求,通过多共识集群的共识架构和共识调度机制,使得区块链系统性能得到并行的提升,吞吐量大大提高。In summary, the embodiments of the present invention can meet the high throughput requirements of the blockchain system when a large number of blockchain nodes are connected. Through the consensus architecture and consensus scheduling mechanism of multi-consensus clusters, the performance of the blockchain system can be parallelized. The increase in throughput greatly improves the throughput.
图9示出了本发明一个实施例提供的区块链系统的共识装置的结构示意图。Fig. 9 shows a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.
在本发明一些实施例中,图9所示的装置可以设置于图4所示的集群调度节点内,集群调度节点可以为服务器或者服务器集群。In some embodiments of the present invention, the device shown in FIG. 9 may be set in the cluster scheduling node shown in FIG. 4, and the cluster scheduling node may be a server or a server cluster.
如图9所示,该区块链系统的共识装置可以包括:As shown in Figure 9, the consensus device of the blockchain system may include:
第一接收模块910,用于接收目标对等节点发送的共识集群路由请求;The first receiving module 910 is configured to receive a consensus cluster routing request sent by the target peer node;
第一解析模块920,用于解析共识集群路由请求,得到路由请求信息,路由请求信息包括目标对等节点的节点位置;The first parsing module 920 is configured to parse the consensus cluster routing request to obtain routing request information, where the routing request information includes the node location of the target peer node;
第一确定模块930,用于根据节点位置,在至少一个可用共识集群中,确定目标共识集群,其中,可用共识集群为区块链系统中处于正常工作状态的共识集群;The first determination module 930 is used to determine the target consensus cluster in at least one available consensus cluster according to the position of the node, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
第一发送模块940,用于向目标对等节点发送目标共识集群的目标集群地址。The first sending module 940 is configured to send the target cluster address of the target consensus cluster to the target peer node.
在本发明实施例中,能够基于目标对等节点发送的共识集群路由请求所携带的目标对等节点的节点位置,在区块链系统的至少一个处于正常工作状态的可用共识集群中,为目标对等节点分配目标共识集群,并且向目标对等节点发送目标共识集群的目标集群地址,以通过节点位置实现对等节点的分流,使不同的对等节点可以基于其节点位置匹配不同的共识集群,从而可以利用多个共识集群并行对大量的对等节点进行共识,提高了区块链系统的吞吐量,进而能够满足区块链系统对高吞吐量的需求。In the embodiment of the present invention, based on the node position of the target peer node carried in the consensus cluster routing request sent by the target peer node, in at least one available consensus cluster in the normal working state of the blockchain system, it is the target The peer node allocates the target consensus cluster, and sends the target cluster address of the target consensus cluster to the target peer node to realize the distribution of peer nodes through the node location, so that different peer nodes can match different consensus clusters based on their node locations In this way, multiple consensus clusters can be used to perform consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system, and thus can meet the demand for high throughput of the blockchain system.
在本发明一些实施例中,第一确定模块930具体用于:In some embodiments of the present invention, the first determining module 930 is specifically configured to:
获取每个可用共识集群的集群位置;Obtain the cluster location of each available consensus cluster;
根据节点位置和集群位置,确定每个可用共识集群对目标对等节点的响 应时间;According to the node location and cluster location, determine the response time of each available consensus cluster to the target peer node;
将响应时间最短的可用共识集群作为目标共识集群。The available consensus cluster with the shortest response time is taken as the target consensus cluster.
在本发明一些实施例中,该区块链系统的共识装置还可以包括:In some embodiments of the present invention, the consensus device of the blockchain system may further include:
第一判断模块,用于判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件;The first judgment module is used to judge whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first preset condition;
其中,第一确定模块930进一步用于:Wherein, the first determining module 930 is further used for:
在集群性能参数不满足第一预设条件的情况下,将响应时间最短的可用共识集群作为目标共识集。In the case that the cluster performance parameters do not meet the first preset condition, the available consensus cluster with the shortest response time is taken as the target consensus set.
在本发明一些实施例中,第一确定模块930还进一步用于:In some embodiments of the present invention, the first determining module 930 is further configured to:
在集群性能参数满足第一预设条件的情况下,将响应时间次最短的可用共识集群作为目标共识集群。When the cluster performance parameters meet the first preset condition, the available consensus cluster with the second shortest response time is taken as the target consensus cluster.
在本发明一些实施例中,路由请求信息还包括路由请求类型;In some embodiments of the present invention, the routing request information further includes the routing request type;
其中,第一判断模块具体用于:Among them, the first judgment module is specifically used for:
在路由请求类型为第一路由类型的情况下,判断响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件。When the routing request type is the first routing type, it is determined whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition.
在本发明一些实施例中,第一判断模块进一步用于:In some embodiments of the present invention, the first judgment module is further used for:
检测响应时间最短的可用共识集群是否具有饱和状态标记;Check whether the available consensus cluster with the shortest response time has a saturation status mark;
在检测到具有饱和状态标记的情况下,确定响应时间最短的可用共识集群的集群性能参数满足第一预设条件;In the case of detecting a saturation state mark, determine that the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition;
在检测到不具有饱和状态标记的情况下,确定响应时间最短的可用共识集群的集群性能参数不满足第一预设条件。In the case where it is detected that it does not have a saturation state mark, it is determined that the cluster performance parameter of the available consensus cluster with the shortest response time does not meet the first preset condition.
在本发明一些实施例中,第一预设条件包括下列中的至少一项:In some embodiments of the present invention, the first preset condition includes at least one of the following:
集群性能参数中的吞吐量大于或等于预设吞吐量阈值;The throughput in the cluster performance parameter is greater than or equal to the preset throughput threshold;
吞吐量大于或等于预设吞吐量阈值的第一时长大于或等于第一预设时长;The first duration for which the throughput is greater than or equal to the preset throughput threshold is greater than or equal to the first preset duration;
集群性能参数中的交易平均延时大于或等于预设延时阈值;The average transaction delay in the cluster performance parameters is greater than or equal to the preset delay threshold;
交易平均延时大于或等于预设延时阈值的第二时长大于或等于第二预设时长。The second time period when the average transaction delay is greater than or equal to the preset delay threshold is greater than or equal to the second preset time period.
在本发明一些实施例中,该区块链系统的共识装置还可以包括:In some embodiments of the present invention, the consensus device of the blockchain system may further include:
第五接收模块,用于接收共识集群发送的集群注册请求;The fifth receiving module is used to receive the cluster registration request sent by the consensus cluster;
第四解析模块,用于解析集群注册请求,得到集群注册请求信息,集群 注册请求信息包括集群验证信息;The fourth parsing module is used to parse the cluster registration request to obtain cluster registration request information, where the cluster registration request information includes cluster verification information;
集群监听模块,用于在集群验证信息通过验证的情况下,监听共识集群;The cluster monitoring module is used to monitor the consensus cluster when the cluster verification information is verified;
第一处理模块,用于在监听到共识集群处于正常工作状态的情况下,将共识集群作为可用共识集群。The first processing module is used to treat the consensus cluster as an available consensus cluster when it is monitored that the consensus cluster is in a normal working state.
在本发明一些实施例中,集群注册请求信息还包括集群配置信息;In some embodiments of the present invention, the cluster registration request information further includes cluster configuration information;
其中,向目标对等节点发送目标共识集群的目标集群地址之前,该区块链系统的共识装置还可以包括:Wherein, before sending the target cluster address of the target consensus cluster to the target peer node, the consensus device of the blockchain system may further include:
信息查询模块,用于查询目标共识集群对应的目标集群配置信息;The information query module is used to query the target cluster configuration information corresponding to the target consensus cluster;
地址提取模块,用于在目标集群配置信息中,提取目标集群地址。The address extraction module is used to extract the target cluster address from the target cluster configuration information.
在本发明一些实施例中,路由请求信息还包括节点验证信息;In some embodiments of the present invention, the routing request information further includes node verification information;
其中,第一确定模块930还具体用于:Wherein, the first determining module 930 is also specifically used for:
在节点验证信息通过验证的情况下,根据节点位置,在至少一个可用共识集群中,确定目标共识集群。In the case where the node verification information is verified, the target consensus cluster is determined in at least one available consensus cluster according to the location of the node.
图10示出了本发明另一个实施例提供的区块链系统的共识装置的结构示意图。FIG. 10 shows a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
在本发明一些实施例中,图10所示的装置可以设置于图4所示的任一个共识集群内,共识集群可以包括至少一个共识节点,共识节点可以为服务器或者服务器集群。In some embodiments of the present invention, the device shown in FIG. 10 may be set in any consensus cluster shown in FIG. 4, the consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.
如图10所示,该区块链系统的共识装置可以包括:As shown in Figure 10, the consensus device of the blockchain system may include:
第二接收模块1010,用于接收目标对等节点发送的交易请求,其中,目标对等节点基于目标集群地址发送交易请求,目标集群地址根据目标对等节点的节点位置在至少一个可用共识集群中确定,可用共识集群为区块链系统中处于正常工作状态的共识集群;The second receiving module 1010 is configured to receive a transaction request sent by a target peer node, where the target peer node sends the transaction request based on the target cluster address, and the target cluster address is in at least one available consensus cluster based on the node location of the target peer node Confirm that the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
第二解析模块1020,用于解析易请求,得到交易请求信息,交易请求信息包括交易信息;The second parsing module 1020 is used for parsing the easy request to obtain transaction request information, the transaction request information including transaction information;
信息共识模块1030,用于针对交易信息发起共识;Information consensus module 1030, used to initiate a consensus on transaction information;
交易执行模块1040,用于在共识成功的情况下,执行交易信息对应的交易。The transaction execution module 1040 is used to execute the transaction corresponding to the transaction information when the consensus is successful.
在本发明实施例中,共识集群能够接收基于节点位置分配的目标对等节点发送的交易请求,以通过节点位置实现对等节点的分流,使不同的对等节 点可以基于其节点位置匹配不同的共识集群,从而可以利用多个共识集群并行对大量的对等节点进行共识,提高了区块链系统的吞吐量,进而能够满足大量节点接入时区块链系统对高吞吐量的需求。同时,即使参与节点增多,区块链系统的扩展性能也可以继续保持。In the embodiment of the present invention, the consensus cluster can receive transaction requests sent by target peer nodes based on node location allocation, so as to realize the distribution of peer nodes through node locations, so that different peer nodes can match different nodes based on their node locations. Consensus clusters can use multiple consensus clusters to perform consensus on a large number of peer nodes in parallel, which improves the throughput of the blockchain system, and thus can meet the high throughput requirements of the blockchain system when a large number of nodes are connected. At the same time, even if the number of participating nodes increases, the scalability of the blockchain system can continue to be maintained.
在本发明一些实施例中,交易请求信息还包括交易请求类型;In some embodiments of the present invention, the transaction request information further includes the transaction request type;
其中,信息共识模块1030具体用于:Among them, the information consensus module 1030 is specifically used for:
在交易请求类型为第一交易类型的情况下,针对交易信息发起共识。In the case where the transaction request type is the first transaction type, a consensus is initiated for the transaction information.
在本发明一些实施例中,交易请求信息还包括目标通道信息;In some embodiments of the present invention, the transaction request information further includes target channel information;
其中,在本发明一些实施例中,该区块链系统的共识装置还可以包括:Among them, in some embodiments of the present invention, the consensus device of the blockchain system may further include:
第一获取模块,用于在交易请求类型不是第一交易类型的情况下,获取目标通道信息;The first obtaining module is used to obtain target channel information when the transaction request type is not the first transaction type;
通道查询模块,用于在目标通道列表中查询目标通道信息,其中,目标通道列表为本地存储的通道列表;The channel query module is used to query the target channel information in the target channel list, where the target channel list is a channel list stored locally;
其中,信息共识模块1030进一步用于:Among them, the information consensus module 1030 is further used to:
在查询到目标通道信息的情况下,针对交易信息发起共识。When the target channel information is queried, a consensus is initiated for the transaction information.
在本发明一些实施例中,该区块链系统的共识装置还可以包括:In some embodiments of the present invention, the consensus device of the blockchain system may further include:
第一生成模块,用于在未查询到目标通道信息的情况下,根据目标通道信息,生成地址查询请求;The first generation module is used to generate an address query request according to the target channel information when the target channel information is not queried;
第五发送模块,用于向通道协同节点发送地址查询请求,地址查询请求用于使通道协同节点查询目标通道信息对应的集群地址。The fifth sending module is used to send an address query request to the channel cooperation node, and the address query request is used to make the channel cooperation node query the cluster address corresponding to the target channel information.
在本发明一些实施例中,该区块链系统的共识装置还可以包括:In some embodiments of the present invention, the consensus device of the blockchain system may further include:
第六接收模块,用于接收通道协同节点反馈的目标通道信息对应的集群地址;The sixth receiving module is configured to receive the cluster address corresponding to the target channel information fed back by the channel cooperation node;
第六发送模块,用于向目标对等节点发送目标通道信息对应的集群地址。The sixth sending module is used to send the cluster address corresponding to the target channel information to the target peer node.
在本发明一些实施例中,目标通道信息为目标哈希值,目标哈希值根据交易请求对应的目标通道的属性信息生成;目标通道列表为目标哈希表,目标哈希表包括多个第一哈希值,每个第一哈希值根据一个本地建立的通道的属性信息生成。In some embodiments of the present invention, the target channel information is a target hash value, which is generated according to the attribute information of the target channel corresponding to the transaction request; the target channel list is a target hash table, and the target hash table includes a plurality of A hash value, each first hash value is generated according to the attribute information of a locally established channel.
在本发明一些实施例中,属性信息包括下列中的至少一项:In some embodiments of the present invention, the attribute information includes at least one of the following:
通道名称、通道创建者、通道创建时间。Channel name, channel creator, channel creation time.
图11示出了本发明又一个实施例提供的区块链系统的共识装置的结构示意图。FIG. 11 shows a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
在本发明一些实施例中,图11所示的装置可以设置于图4所示的任一个通道协同节点内。其中,通道协同节点可以为服务器或者服务器集群。In some embodiments of the present invention, the device shown in FIG. 11 may be set in any channel cooperation node shown in FIG. 4. Among them, the channel cooperation node may be a server or a server cluster.
如图11所示,该区块链系统的共识装置可以包括:As shown in Figure 11, the consensus device of the blockchain system may include:
第三接收模块1110,用于接收目标共识集群发送的地址查询请求,地址查询请求根据目标共识集群所接收的交易请求所携带的目标通道信息生成;The third receiving module 1110 is configured to receive an address query request sent by the target consensus cluster, and the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster;
第三解析模块1120,用于解析地址查询请求,得到地址查询请求信息,地址查询请求信息包括目标通道信息;The third parsing module 1120 is configured to parse the address query request to obtain address query request information, where the address query request information includes target channel information;
地址查询模块1130,用于在分布式数据库中,查询目标通道信息对应的集群地址;The address query module 1130 is used to query the cluster address corresponding to the target channel information in the distributed database;
第二发送模块1140,用于在地址查询请求信息还包括节点地址的情况下,向节点地址对应的对等节点发送目标通道信息对应的集群地址。The second sending module 1140 is configured to send the cluster address corresponding to the target channel information to the peer node corresponding to the node address when the address query request information also includes the node address.
在本发明实施例中,对于跨共识集群的交易请求,可以通过通道协同节点查询交易请求对应的共识集群的集群地址,从而保障跨共识集群的交易请求的有序进行,提高区块链系统的可靠性。In the embodiment of the present invention, for cross-consensus cluster transaction requests, the cluster address of the consensus cluster corresponding to the transaction request can be queried through the channel collaboration node, so as to ensure the orderly progress of cross-consensus cluster transaction requests and improve the performance of the blockchain system. reliability.
在本发明一些实施例中,目标通道信息为目标哈希值,目标哈希值根据交易请求对应的目标通道的属性信息生成;分布式数据库包括分布式哈希表,分布式哈希表包括多个第二哈希值,每个第二哈希值根据区块链系统中的一个通道的属性信息生成;In some embodiments of the present invention, the target channel information is a target hash value, and the target hash value is generated according to the attribute information of the target channel corresponding to the transaction request; the distributed database includes a distributed hash table, and the distributed hash table includes multiple Two second hash values, each second hash value is generated according to the attribute information of a channel in the blockchain system;
其中,地址查询模块1130具体用于:Among them, the address query module 1130 is specifically used for:
基于分布式哈希表,在多个预设通道协同节点中,查询存储有目标哈希值的目标通道协同节点,其中,预设通道协同节点为区块链系统中用于维护分布式哈希表的节点,一个预设通道协同节点对应一个共识集群;Based on the distributed hash table, among multiple preset channel collaboration nodes, query the target channel collaboration node that stores the target hash value, where the preset channel collaboration node is used to maintain the distributed hash in the blockchain system Table node, a preset channel collaboration node corresponds to a consensus cluster;
将目标通道协同节点对应的共识集群的集群地址,作为目标通道信息对应的集群地址。The cluster address of the consensus cluster corresponding to the target channel cooperative node is used as the cluster address corresponding to the target channel information.
在本发明一些实施例中,属性信息包括下列中的至少一项:In some embodiments of the present invention, the attribute information includes at least one of the following:
通道名称、通道创建者、通道创建时间。Channel name, channel creator, channel creation time.
在本发明一些实施例中,该区块链系统的共识装置还可以包括:In some embodiments of the present invention, the consensus device of the blockchain system may further include:
第七发送模块,用于在地址查询请求信息不包括节点地址的情况下,向目标共识集群发送目标通道信息对应的集群地址。The seventh sending module is used to send the cluster address corresponding to the target channel information to the target consensus cluster when the address query request information does not include the node address.
图12示出了本发明再一个实施例提供的区块链系统的共识装置的结构示意图。FIG. 12 shows a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention.
在本发明一些实施例中,图12所示的装置可以设置于图4所示的任一个对等节点内,对等节点可以为服务器或者服务器集群。In some embodiments of the present invention, the device shown in FIG. 12 may be set in any peer node shown in FIG. 4, and the peer node may be a server or a server cluster.
如图12所示,该区块链系统的共识装置可以包括:As shown in Figure 12, the consensus device of the blockchain system may include:
第三发送模块1210,用于向集群调度节点发送共识集群路由请求,使集群调度节点响应于共识集群路由请求,根据共识集群路由请求的路由请求信息中包括的节点位置,在至少一个可用共识集群中确定目标共识集群,并反馈目标共识集群对应的目标集群地址,其中,可用共识集群为区块链系统中处于正常工作状态的共识集群;The third sending module 1210 is used to send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, according to the node position included in the routing request information of the consensus cluster routing request, in at least one available consensus cluster Determine the target consensus cluster in the process, and feed back the target cluster address corresponding to the target consensus cluster. Among them, the available consensus cluster is the consensus cluster in the normal working state of the blockchain system;
第四接收模块1220,用于接收集群调度节点反馈的目标集群地址;The fourth receiving module 1220 is configured to receive the target cluster address fed back by the cluster scheduling node;
第四发送模块1230,用于基于目标集群地址,向目标共识集群发送交易请求。The fourth sending module 1230 is used to send a transaction request to the target consensus cluster based on the target cluster address.
在本发明实施例中,能够通过节点位置实现对等节点的分流,使不同的对等节点可以基于其节点位置匹配不同的共识集群,从而可以利用多个共识集群并行对大量的对等节点进行共识,提高了区块链系统的吞吐量,进而能够满足区块链系统对高吞吐量的需求。In the embodiment of the present invention, the distribution of peer nodes can be realized by node positions, so that different peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used to perform parallel operations on a large number of peer nodes. Consensus improves the throughput of the blockchain system, which in turn can meet the demand for high throughput of the blockchain system.
在本发明一些实施例中,交易请求携带有目标通道信息;In some embodiments of the present invention, the transaction request carries target channel information;
其中,该区块链系统的共识装置还可以包括:Among them, the consensus device of the blockchain system may also include:
第七接收模块,用于在交易请求的交易请求类型不是第一交易类型的情况下,接收目标共识集群或通道协同节点反馈的目标通道信息对应的集群地址;The seventh receiving module is used to receive the cluster address corresponding to the target channel information fed back by the target consensus cluster or the channel collaboration node when the transaction request type of the transaction request is not the first transaction type;
第八发送模块,用于基于目标通道信息对应的集群地址,向交易请求对应的目标通道所属的共识集群发送交易请求。The eighth sending module is used to send a transaction request to the consensus cluster to which the target channel corresponding to the transaction request belongs based on the cluster address corresponding to the target channel information.
图13示出了本发明一个实施例提供的区块链系统的共识设备的结构示意图。Fig. 13 shows a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.
如图13所示,区块链系统的共识设备1300包括输入设备1301、输入接口1302、中央处理器1303、存储器1304、输出接口1305、以及输出设备1306。其中,输入接口1302、中央处理器1303、存储器1304、以及输出接口1305通过总线1310相互连接,输入设备1301和输出设备1306分别通过输入接口1302和输出接口1305与总线1310连接,进而与区块链系统的共识设备 1300的其他组件连接。As shown in FIG. 13, the consensus device 1300 of the blockchain system includes an input device 1301, an input interface 1302, a central processing unit 1303, a memory 1304, an output interface 1305, and an output device 1306. Among them, the input interface 1302, the central processing unit 1303, the memory 1304, and the output interface 1305 are connected to each other through the bus 1310, and the input device 1301 and the output device 1306 are connected to the bus 1310 through the input interface 1302 and the output interface 1305, respectively, and then connected to the blockchain The other components of the consensus device 1300 of the system are connected.
具体地,输入设备1301接收来自外部的输入信息,并通过输入接口1302将输入信息传送到中央处理器1303;中央处理器1303基于存储器1304中存储的计算机可执行指令对输入信息进行处理以生成输出信息,将输出信息临时或者永久地存储在存储器1304中,然后通过输出接口1305将输出信息传送到输出设备1306;输出设备1306将输出信息输出到区块链系统的共识设备1300的外部供用户使用。Specifically, the input device 1301 receives input information from the outside, and transmits the input information to the central processing unit 1303 through the input interface 1302; the central processing unit 1303 processes the input information based on the computer executable instructions stored in the memory 1304 to generate output Information, the output information is temporarily or permanently stored in the memory 1304, and then the output information is transmitted to the output device 1306 through the output interface 1305; the output device 1306 outputs the output information to the outside of the consensus device 1300 of the blockchain system for users to use .
也就是说,图13所示的区块链系统的共识设备也可以被实现为包括:存储有计算机可执行指令的存储器;以及处理器,该处理器在执行计算机可执行指令时可以实现本发明实施例描述的区块链系统的共识方法和装置。In other words, the consensus device of the blockchain system shown in FIG. 13 can also be implemented as including: a memory storing computer-executable instructions; and a processor, which can implement the present invention when executing computer-executable instructions The embodiment describes the consensus method and device of the blockchain system.
本发明实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序指令;该计算机程序指令被处理器执行时实现本发明实施例提供的区块链系统的共识方法。计算机可读存储介质的示例包括非暂态计算机可读存储介质,如只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。The embodiment of the present invention also provides a computer-readable storage medium on which computer program instructions are stored; when the computer program instructions are executed by a processor, the consensus method of the blockchain system provided by the embodiments of the present invention is realized . Examples of computer-readable storage media include non-transitory computer-readable storage media, such as Read-Only Memory (ROM), Random Access Memory (RAM), magnetic disks, or optical disks.
以上的结构框图中所示的功能块可以实现为硬件、软件、固件或者它们的组合。当以硬件方式实现时,其可以例如是电子电路、专用集成电路(Application Specific Integrated Circuit,ASIC)、适当的固件、插件、功能卡等等。当以软件方式实现时,本发明的元素是被用于执行所需任务的程序或者代码段。程序或者代码段可以存储在机器可读介质中,或者通过载波中携带的数据信号在传输介质或者通信链路上传送。“机器可读介质”可以包括能够存储或传输信息的任何介质。机器可读介质的例子包括电子电路、半导体存储器设备、ROM、闪存、可擦除ROM(Erasable Programmable Read-Only Memory,EROM)、软盘、CD-ROM、光盘、硬盘、光纤介质、射频(Radio Frequency,RF)链路,等等。代码段可以经由诸如因特网、内联网等的计算机网络被下载。The functional blocks shown in the above structural block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, plug-ins, function cards, and so on. When implemented in software, the elements of the present invention are programs or code segments used to perform required tasks. The program or code segment may be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link through a data signal carried in a carrier wave. "Machine-readable medium" may include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, Erasable Programmable Read-Only Memory (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, and radio frequency (Radio Frequency). , RF) link, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, and so on.
上面参考根据本发明的实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各方面。应当理解,流程图和/或框图中的每个方框以及流程图和/或框图中各方框的组合可以由计算机程序指令实现。这些计算机程序指令可被提供给通用计算机、专用计算机、或其它可编程数据处理装置的处理器,以产生一种机器,使得经由计算机或其它可编程数据 处理装置的处理器执行的这些指令使能对流程图和/或框图的一个或多个方框中指定的功能/动作的实现。这种处理器可以是但不限于是通用处理器、专用处理器、特殊应用处理器或者现场可编程逻辑阵列。还可理解,框图和/或流程图中的每个方框以及框图和/或流程图中的方框的组合,也可以由执行指定的功能或动作的专用硬件来实现,或可由专用硬件和计算机指令的组合来实现。The various aspects of the present disclosure have been described above with reference to the flowcharts and/or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present invention. It should be understood that each block in the flowcharts and/or block diagrams and combinations of blocks in the flowcharts and/or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine that enables the execution of these instructions via the processor of the computer or other programmable data processing device Implementation of functions/actions specified in one or more blocks of the flowchart and/or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic array. It can also be understood that each block in the block diagram and/or flowchart and the combination of the blocks in the block diagram and/or flowchart can also be implemented by dedicated hardware that performs the specified function or action, or can be implemented by dedicated hardware and A combination of computer instructions.
还需要说明的是,上述对本发明特定实施例进行了描述。其它实施例在所附权利要求的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。It should also be noted that the specific embodiments of the present invention are described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be executed in the order in different embodiments and still achieve desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown in order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
以上所述,仅为本发明的具体实施方式,所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的系统、模块和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。应理解,本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。The above are only specific implementations of the present invention. Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working process of the above-described systems, modules and units can be referred to the foregoing method embodiments. The corresponding process in, I will not repeat it here. It should be understood that the protection scope of the present invention is not limited to this, and any person skilled in the art can easily think of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should cover Within the protection scope of the present invention.

Claims (29)

  1. 一种区块链系统的共识方法,包括:A consensus method for a blockchain system, including:
    接收目标对等节点发送的共识集群路由请求;Receive the consensus cluster routing request sent by the target peer node;
    解析所述共识集群路由请求,得到路由请求信息,所述路由请求信息包括所述目标对等节点的节点位置;Parse the consensus cluster routing request to obtain routing request information, where the routing request information includes the node location of the target peer node;
    根据所述节点位置,在至少一个可用共识集群中,确定目标共识集群,其中,所述可用共识集群为所述区块链系统中处于正常工作状态的共识集群;According to the position of the node, determine a target consensus cluster in at least one available consensus cluster, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
    向所述目标对等节点发送所述目标共识集群的目标集群地址。Send the target cluster address of the target consensus cluster to the target peer node.
  2. 根据权利要求1所述的方法,其中,所述根据所述节点位置,在至少一个可用共识集群中,确定目标共识集群,包括:The method according to claim 1, wherein the determining a target consensus cluster in at least one available consensus cluster according to the position of the node comprises:
    获取每个所述可用共识集群的集群位置;Acquiring the cluster location of each of the available consensus clusters;
    根据所述节点位置和所述集群位置,确定每个所述可用共识集群对所述目标对等节点的响应时间;Determine the response time of each available consensus cluster to the target peer node according to the node location and the cluster location;
    将响应时间最短的可用共识集群作为所述目标共识集群。The available consensus cluster with the shortest response time is taken as the target consensus cluster.
  3. 根据权利要求2所述的方法,其中,所述将响应时间最短的可用共识集群作为所述目标共识集群之前,所述方法还包括:The method according to claim 2, wherein, before the use of the available consensus cluster with the shortest response time as the target consensus cluster, the method further comprises:
    判断所述响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件;Judging whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition;
    其中,所述将响应时间最短的可用共识集群作为所述目标共识集群,包括:Wherein, the available consensus cluster with the shortest response time as the target consensus cluster includes:
    在所述集群性能参数不满足所述第一预设条件的情况下,将所述响应时间最短的可用共识集群作为所述目标共识集。In the case that the cluster performance parameter does not meet the first preset condition, the available consensus cluster with the shortest response time is used as the target consensus set.
  4. 根据权利要求3所述的方法,其中,所述判断所述响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件之后,所述方法还包括:The method according to claim 3, wherein after determining whether the cluster performance parameters of the available consensus cluster with the shortest response time satisfy a first preset condition, the method further comprises:
    在所述集群性能参数满足所述第一预设条件的情况下,将响应时间次最短的可用共识集群作为所述目标共识集群。When the cluster performance parameter satisfies the first preset condition, the available consensus cluster with the second shortest response time is used as the target consensus cluster.
  5. 根据权利要求3所述的方法,其中,所述路由请求信息还包括路由请求类型;The method according to claim 3, wherein the routing request information further includes a routing request type;
    其中,所述判断所述响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件,包括:Wherein, the judging whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition includes:
    在所述路由请求类型为第一路由类型的情况下,判断所述响应时间最短的可用共识集群的集群性能参数是否满足所述第一预设条件。In a case where the routing request type is the first routing type, it is determined whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition.
  6. 根据权利要求3-5中任一项所述的方法,其中,所述判断所述响应时间最短的可用共识集群的集群性能参数是否满足第一预设条件,包括:The method according to any one of claims 3-5, wherein the judging whether the cluster performance parameter of the available consensus cluster with the shortest response time meets a first preset condition comprises:
    检测所述响应时间最短的可用共识集群是否具有饱和状态标记;Detecting whether the available consensus cluster with the shortest response time has a saturation status mark;
    在检测到具有所述饱和状态标记的情况下,确定所述响应时间最短的可用共识集群的集群性能参数满足所述第一预设条件;In the case of detecting the saturation state flag, determining that the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition;
    在检测到不具有所述饱和状态标记的情况下,确定所述响应时间最短的可用共识集群的集群性能参数不满足所述第一预设条件。In a case where it is detected that it does not have the saturation state flag, it is determined that the cluster performance parameter of the available consensus cluster with the shortest response time does not meet the first preset condition.
  7. 根据权利要求3-5中任一项所述的方法,其中,所述第一预设条件包括下列中的至少一项:The method according to any one of claims 3-5, wherein the first preset condition includes at least one of the following:
    所述集群性能参数中的吞吐量大于或等于预设吞吐量阈值;The throughput in the cluster performance parameter is greater than or equal to a preset throughput threshold;
    所述吞吐量大于或等于所述预设吞吐量阈值的第一时长大于或等于第一预设时长;The first duration for which the throughput is greater than or equal to the preset throughput threshold is greater than or equal to the first preset duration;
    所述集群性能参数中的交易平均延时大于或等于预设延时阈值;The average transaction delay in the cluster performance parameter is greater than or equal to a preset delay threshold;
    所述交易平均延时大于或等于所述预设延时阈值的第二时长大于或等于第二预设时长。The second period of time when the average transaction delay is greater than or equal to the preset delay threshold is greater than or equal to the second preset period of time.
  8. 根据权利要求1所述的方法,其中,所述根据所述节点位置,在至少一个可用共识集群中,确定目标共识集群之前,所述方法还包括:The method according to claim 1, wherein, before determining a target consensus cluster in at least one available consensus cluster according to the node position, the method further comprises:
    接收所述共识集群发送的集群注册请求;Receiving a cluster registration request sent by the consensus cluster;
    解析所述集群注册请求,得到集群注册请求信息,所述集群注册请求信息包括集群验证信息;Parse the cluster registration request to obtain cluster registration request information, where the cluster registration request information includes cluster verification information;
    在所述集群验证信息通过验证的情况下,监听所述共识集群;If the cluster verification information is verified, monitor the consensus cluster;
    在监听到所述共识集群处于正常工作状态的情况下,将所述共识集群作为所述可用共识集群。In the case of monitoring that the consensus cluster is in a normal working state, the consensus cluster is used as the available consensus cluster.
  9. 根据权利要求8所述的方法,其中,所述集群注册请求信息还包括集群配置信息;The method according to claim 8, wherein the cluster registration request information further includes cluster configuration information;
    其中,所述向所述目标对等节点发送所述目标共识集群的目标集群地址之前,所述方法还包括:Wherein, before the sending the target cluster address of the target consensus cluster to the target peer node, the method further includes:
    查询所述目标共识集群对应的目标集群配置信息;Query the target cluster configuration information corresponding to the target consensus cluster;
    在所述目标集群配置信息中,提取所述目标集群地址。In the target cluster configuration information, the target cluster address is extracted.
  10. 根据权利要求1所述的方法,其中,所述路由请求信息还包括节点验证信息;The method according to claim 1, wherein the routing request information further includes node verification information;
    其中,所述根据所述节点位置,在至少一个可用共识集群中,确定目标共识集群,包括:Wherein, determining the target consensus cluster in at least one available consensus cluster according to the node location includes:
    在所述节点验证信息通过验证的情况下,根据所述节点位置,在至少一个所述可用共识集群中,确定所述目标共识集群。In the case where the node verification information is verified, the target consensus cluster is determined in at least one of the available consensus clusters according to the position of the node.
  11. 一种区块链系统的共识方法,包括:A consensus method for a blockchain system, including:
    接收目标对等节点发送的交易请求,其中,所述目标对等节点基于目标集群地址发送所述交易请求,所述目标集群地址根据所述目标对等节点的节点位置在至少一个可用共识集群中确定,所述可用共识集群为所述区块链系统中处于正常工作状态的共识集群;Receive a transaction request sent by a target peer node, where the target peer node sends the transaction request based on a target cluster address, and the target cluster address is in at least one available consensus cluster according to the node location of the target peer node Determine that the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
    解析所述交易请求,得到交易请求信息,所述交易请求信息包括交易信息;Parse the transaction request to obtain transaction request information, where the transaction request information includes transaction information;
    针对所述交易信息发起共识;Initiating a consensus regarding the transaction information;
    在共识成功的情况下,执行所述交易信息对应的交易。If the consensus is successful, execute the transaction corresponding to the transaction information.
  12. 根据权利要求11所述的方法,其中,所述交易请求信息还包括交易请求类型;The method according to claim 11, wherein the transaction request information further includes a transaction request type;
    其中,所述针对所述交易信息发起共识,包括:Wherein, the initiating a consensus on the transaction information includes:
    在所述交易请求类型为第一交易类型的情况下,针对所述交易信息发起共识。In the case where the transaction request type is the first transaction type, a consensus is initiated for the transaction information.
  13. 根据权利要求12所述的方法,其中,所述交易请求信息还包括目标通道信息;The method according to claim 12, wherein the transaction request information further includes target channel information;
    其中,所述解析所述交易请求,得到交易请求信息之后,所述方法还 包括:Wherein, after parsing the transaction request and obtaining transaction request information, the method further includes:
    在所述交易请求类型不是所述第一交易类型的情况下,获取所述目标通道信息;In the case that the transaction request type is not the first transaction type, acquiring the target channel information;
    在目标通道列表中查询所述目标通道信息,其中,所述目标通道列表为本地存储的通道列表;Query the target channel information in the target channel list, where the target channel list is a channel list stored locally;
    其中,所述针对所述交易信息发起共识,包括:Wherein, the initiating a consensus on the transaction information includes:
    在查询到所述目标通道信息的情况下,针对所述交易信息发起共识。In the case where the target channel information is queried, a consensus is initiated for the transaction information.
  14. 根据权利要求13所述的方法,其中,所述在目标通道列表中查询所述目标通道信息之后,所述方法还包括:The method according to claim 13, wherein, after the query of the target channel information in the target channel list, the method further comprises:
    在未查询到所述目标通道信息的情况下,根据所述目标通道信息,生成地址查询请求;In the case where the target channel information is not queried, generate an address query request according to the target channel information;
    向通道协同节点发送所述地址查询请求,所述地址查询请求用于使所述通道协同节点查询所述目标通道信息对应的集群地址。The address query request is sent to a channel coordination node, where the address query request is used to enable the channel coordination node to query the cluster address corresponding to the target channel information.
  15. 根据权利要求14所述的方法,其中,所述向通道协同节点发送所述地址查询请求之后,所述方法还包括:The method according to claim 14, wherein after the sending the address query request to the channel cooperation node, the method further comprises:
    接收所述通道协同节点反馈的所述目标通道信息对应的集群地址;Receiving the cluster address corresponding to the target channel information fed back by the channel cooperation node;
    向所述目标对等节点发送所述目标通道信息对应的集群地址。Sending the cluster address corresponding to the target channel information to the target peer node.
  16. 根据权利要求13-15任一项所述的方法,其中,所述目标通道信息为目标哈希值,所述目标哈希值根据所述交易请求对应的目标通道的属性信息生成;所述目标通道列表为目标哈希表,所述目标哈希表包括多个第一哈希值,每个所述第一哈希值根据一个本地建立的通道的属性信息生成。The method according to any one of claims 13-15, wherein the target channel information is a target hash value, and the target hash value is generated according to the attribute information of the target channel corresponding to the transaction request; the target The channel list is a target hash table, and the target hash table includes a plurality of first hash values, and each of the first hash values is generated according to attribute information of a locally established channel.
  17. 根据权利要求16所述的方法,其中,所述属性信息包括下列中的至少一项:The method according to claim 16, wherein the attribute information includes at least one of the following:
    通道名称、通道创建者、通道创建时间。Channel name, channel creator, channel creation time.
  18. 一种区块链系统的共识方法,包括:A consensus method for a blockchain system, including:
    接收目标共识集群发送的地址查询请求,所述地址查询请求根据所述目标共识集群所接收的交易请求所携带的目标通道信息生成;Receiving an address query request sent by a target consensus cluster, the address query request being generated according to the target channel information carried in the transaction request received by the target consensus cluster;
    解析所述地址查询请求,得到地址查询请求信息,所述地址查询请求 信息包括所述目标通道信息;Parsing the address query request to obtain address query request information, where the address query request information includes the target channel information;
    在分布式数据库中,查询所述目标通道信息对应的集群地址;In the distributed database, query the cluster address corresponding to the target channel information;
    在所述地址查询请求信息还包括节点地址的情况下,向所述节点地址对应的对等节点发送所述目标通道信息对应的集群地址。In the case that the address query request information further includes a node address, the cluster address corresponding to the target channel information is sent to the peer node corresponding to the node address.
  19. 根据权利要求18所述的方法,其中,所述目标通道信息为目标哈希值,所述目标哈希值根据所述交易请求对应的目标通道的属性信息生成;所述分布式数据库包括分布式哈希表,所述分布式哈希表包括多个第二哈希值,每个所述第二哈希值根据所述区块链系统中的一个通道的属性信息生成;The method according to claim 18, wherein the target channel information is a target hash value, and the target hash value is generated according to the attribute information of the target channel corresponding to the transaction request; the distributed database includes distributed A hash table, the distributed hash table includes a plurality of second hash values, and each of the second hash values is generated according to attribute information of a channel in the blockchain system;
    其中,所述在分布式数据库中,查询所述目标通道信息对应的集群地址,包括:Wherein, in the distributed database, querying the cluster address corresponding to the target channel information includes:
    基于所述分布式哈希表,在多个预设通道协同节点中,查询存储有所述目标哈希值的目标通道协同节点,所述预设通道协同节点为所述区块链系统中用于维护所述分布式哈希表的节点,一个所述预设通道协同节点对应一个共识集群;Based on the distributed hash table, among multiple preset channel collaboration nodes, query the target channel collaboration node storing the target hash value, and the preset channel collaboration node is used in the blockchain system For the node that maintains the distributed hash table, one of the preset channel collaboration nodes corresponds to a consensus cluster;
    将所述目标通道协同节点对应的共识集群的集群地址,作为所述目标通道信息对应的集群地址。The cluster address of the consensus cluster corresponding to the target channel collaboration node is used as the cluster address corresponding to the target channel information.
  20. 根据权利要求19所述的方法,其中,所述属性信息包括下列中的至少一项:The method according to claim 19, wherein the attribute information includes at least one of the following:
    通道名称、通道创建者、通道创建时间。Channel name, channel creator, channel creation time.
  21. 根据权利要求18所述的方法,其中,所述在分布式数据库中,查询所述目标通道信息对应的集群地址之后,所述方法还包括:The method according to claim 18, wherein, after querying the cluster address corresponding to the target channel information in the distributed database, the method further comprises:
    在所述地址查询请求信息不包括所述节点地址的情况下,向所述目标共识集群发送所述目标通道信息对应的集群地址。In the case that the address query request information does not include the node address, the cluster address corresponding to the target channel information is sent to the target consensus cluster.
  22. 一种区块链系统的共识方法,包括:A consensus method for a blockchain system, including:
    向集群调度节点发送共识集群路由请求,使所述集群调度节点响应于所述共识集群路由请求,根据所述共识集群路由请求的路由请求信息中包括的节点位置,在至少一个可用共识集群中确定目标共识集群,并反馈所述目标共识集群对应的目标集群地址,其中,所述可用共识集群为所述区 块链系统中处于正常工作状态的共识集群;Send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request and determines the position of the node included in the routing request information of the consensus cluster routing request in at least one available consensus cluster Target consensus cluster, and feed back the target cluster address corresponding to the target consensus cluster, wherein the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
    接收所述集群调度节点反馈的所述目标集群地址;Receiving the target cluster address fed back by the cluster scheduling node;
    基于所述目标集群地址,向所述目标共识集群发送交易请求。Based on the target cluster address, a transaction request is sent to the target consensus cluster.
  23. 根据权利要求22所述的方法,其中,所述交易请求携带有目标通道信息;The method according to claim 22, wherein the transaction request carries target channel information;
    其中,所述基于所述目标集群地址,向所述目标共识集群发送交易请求之后,所述方法还包括:Wherein, after the sending a transaction request to the target consensus cluster based on the target cluster address, the method further includes:
    在所述交易请求的交易请求类型不是第一交易类型的情况下,接收所述目标共识集群或通道协同节点反馈的所述目标通道信息对应的集群地址;In the case that the transaction request type of the transaction request is not the first transaction type, receiving the cluster address corresponding to the target channel information fed back by the target consensus cluster or channel collaboration node;
    基于所述目标通道信息对应的集群地址,向所述交易请求对应的目标通道所属的共识集群发送所述交易请求。Based on the cluster address corresponding to the target channel information, the transaction request is sent to the consensus cluster to which the target channel corresponding to the transaction request belongs.
  24. 一种区块链系统的共识装置,包括:A consensus device for a blockchain system, including:
    第一接收模块,用于接收目标对等节点发送的共识集群路由请求;The first receiving module is used to receive the consensus cluster routing request sent by the target peer node;
    第一解析模块,用于解析所述共识集群路由请求,得到路由请求信息,所述路由请求信息包括所述目标对等节点的节点位置;The first parsing module is configured to parse the consensus cluster routing request to obtain routing request information, where the routing request information includes the node location of the target peer node;
    第一确定模块,用于根据所述节点位置,在至少一个可用共识集群中,确定目标共识集群,其中,所述可用共识集群为所述区块链系统中处于正常工作状态的共识集群;The first determining module is configured to determine a target consensus cluster in at least one available consensus cluster according to the position of the node, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
    第一发送模块,用于向所述目标对等节点发送所述目标共识集群的目标集群地址。The first sending module is configured to send the target cluster address of the target consensus cluster to the target peer node.
  25. 一种区块链系统的共识装置,包括:A consensus device for a blockchain system, including:
    第二接收模块,用于接收目标对等节点发送的交易请求,其中,所述目标对等节点基于目标集群地址发送所述交易请求,所述目标集群地址根据所述目标对等节点的节点位置在至少一个可用共识集群中确定,所述可用共识集群为所述区块链系统中处于正常工作状态的共识集群;The second receiving module is configured to receive a transaction request sent by a target peer node, wherein the target peer node sends the transaction request based on a target cluster address, and the target cluster address is based on the node location of the target peer node Determine in at least one available consensus cluster that the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
    第二解析模块,用于解析所述交易请求,得到交易请求信息,所述交易请求信息包括交易信息;The second analysis module is used to analyze the transaction request to obtain transaction request information, where the transaction request information includes transaction information;
    信息共识模块,用于针对所述交易信息发起共识;The information consensus module is used to initiate a consensus on the transaction information;
    交易执行模块,用于在共识成功的情况下,执行所述交易信息对应的交易。The transaction execution module is used to execute the transaction corresponding to the transaction information when the consensus is successful.
  26. 一种区块链系统的共识装置,包括:A consensus device for a blockchain system, including:
    第三接收模块,用于接收目标共识集群发送的地址查询请求,所述地址查询请求根据所述目标共识集群所接收的交易请求所携带的目标通道信息生成;The third receiving module is configured to receive an address query request sent by a target consensus cluster, and the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster;
    第三解析模块,用于解析所述地址查询请求,得到地址查询请求信息,所述地址查询请求信息包括所述目标通道信息;The third parsing module is configured to parse the address query request to obtain address query request information, where the address query request information includes the target channel information;
    地址查询模块,用于在分布式数据库中,查询所述目标通道信息对应的集群地址;The address query module is used to query the cluster address corresponding to the target channel information in the distributed database;
    第二发送模块,用于在所述地址查询请求信息还包括节点地址的情况下,向所述节点地址对应的对等节点发送所述目标通道信息对应的集群地址。The second sending module is configured to send the cluster address corresponding to the target channel information to the peer node corresponding to the node address when the address query request information also includes the node address.
  27. 一种区块链系统的共识装置,包括:A consensus device for a blockchain system, including:
    第三发送模块,用于向集群调度节点发送共识集群路由请求,使所述集群调度节点响应于所述共识集群路由请求,根据所述共识集群路由请求的路由请求信息中包括的节点位置,在至少一个可用共识集群中确定目标共识集群,并反馈所述目标共识集群对应的目标集群地址,其中,所述可用共识集群为所述区块链系统中处于正常工作状态的共识集群;The third sending module is used to send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, according to the node position included in the routing request information of the consensus cluster routing request, At least one available consensus cluster determines a target consensus cluster, and feeds back the target cluster address corresponding to the target consensus cluster, where the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;
    第四接收模块,用于接收所述集群调度节点反馈的所述目标集群地址;A fourth receiving module, configured to receive the target cluster address fed back by the cluster scheduling node;
    第四发送模块,用于基于所述目标集群地址,向所述目标共识集群发送交易请求。The fourth sending module is configured to send a transaction request to the target consensus cluster based on the target cluster address.
  28. 一种区块链系统的共识设备,包括:处理器以及存储有计算机程序指令的存储器,所述处理器执行所述计算机程序指令时实现如权利要求1-10、权利要求11-17、权利要求18-21或权利要求22-23中任意一项所述的区块链系统的共识方法。A consensus device for a blockchain system, comprising: a processor and a memory storing computer program instructions, and the processor implements claims 1-10, claims 11-17, and claims when executing the computer program instructions The consensus method of the blockchain system described in any one of 18-21 or claims 22-23.
  29. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现如权利要求1- 10、权利要求11-17、权利要求18-21或权利要求22-23中任意一项所述的区块链系统的共识方法。A computer-readable storage medium with computer program instructions stored on the computer-readable storage medium, and when the computer program instructions are executed by a processor, the realization of claims 1-10, 11-17, and 18- 21 or the consensus method of the blockchain system according to any one of claims 22-23.
PCT/CN2021/075339 2020-05-29 2021-02-04 Consensus method, apparatus and device for blockchain system, and medium WO2021238298A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010478177.8A CN111786952B (en) 2020-05-29 2020-05-29 Consensus method, apparatus, device, and medium for block chain system
CN202010478177.8 2020-05-29

Publications (1)

Publication Number Publication Date
WO2021238298A1 true WO2021238298A1 (en) 2021-12-02

Family

ID=72754441

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/075339 WO2021238298A1 (en) 2020-05-29 2021-02-04 Consensus method, apparatus and device for blockchain system, and medium

Country Status (3)

Country Link
CN (1) CN111786952B (en)
TW (1) TWI790611B (en)
WO (1) WO2021238298A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338677A (en) * 2021-12-30 2022-04-12 中山大学 Block generation method and related device in block chain system

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111786952B (en) * 2020-05-29 2023-03-17 中国银联股份有限公司 Consensus method, apparatus, device, and medium for block chain system
CN113242286B (en) * 2021-05-06 2022-05-24 杭州复杂美科技有限公司 Method, equipment and storage medium for flexibly improving transaction throughput
CN114281888A (en) * 2021-10-30 2022-04-05 中国银联股份有限公司 Block chain consensus method, device, equipment and storage medium
CN114710492B (en) * 2022-03-31 2023-12-22 蚂蚁区块链科技(上海)有限公司 Method and device for establishing direct connection channel, electronic equipment and storage medium
CN114884962B (en) * 2022-04-29 2024-03-26 蚂蚁区块链科技(上海)有限公司 Load balancing method and device and electronic equipment
CN114979166B (en) * 2022-06-09 2023-05-16 中国联合网络通信集团有限公司 Method, device and storage medium for determining consensus node
CN115883315B (en) * 2023-03-01 2023-07-28 中国信息通信研究院 Node joining method, device, electronic equipment and storage medium in blockchain network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150127625A1 (en) * 2011-04-26 2015-05-07 Brian J. Bulkowski Cluster-node load balancing in a distributed database system
CN108154367A (en) * 2017-12-26 2018-06-12 质数链网科技成都有限公司 A kind of block chain business method of calibration and device
CN110113388A (en) * 2019-04-17 2019-08-09 四川大学 A kind of method and apparatus of the block catenary system common recognition based on improved clustering algorithm
CN111786952A (en) * 2020-05-29 2020-10-16 中国银联股份有限公司 Consensus method, apparatus, device and medium for block chain system

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10360191B2 (en) * 2016-10-07 2019-07-23 International Business Machines Corporation Establishing overlay trust consensus for blockchain trust validation system
CN107196989B (en) * 2017-03-21 2019-08-09 阿里巴巴集团控股有限公司 A kind of processing method and processing device of service request
CN113766035B (en) * 2017-03-28 2023-05-23 创新先进技术有限公司 Service acceptance and consensus method and device
CN107623686B (en) * 2017-09-12 2019-09-17 深圳先进技术研究院 Block chain common recognition reaches method, apparatus
CN108256999B (en) * 2018-01-19 2020-08-14 阿里巴巴集团控股有限公司 Capital transfer method and device and electronic equipment
CN108805404B (en) * 2018-05-02 2020-10-09 大国创新智能科技(东莞)有限公司 Robot scheduling method and system based on block chain
CN110046036A (en) * 2018-12-25 2019-07-23 阿里巴巴集团控股有限公司 A kind of operation requests distribution method, device and equipment
CN110601849B (en) * 2019-08-21 2021-05-11 腾讯科技(深圳)有限公司 Trusted timestamp adding method and device and storage medium
CN110647559A (en) * 2019-09-24 2020-01-03 腾讯科技(深圳)有限公司 Data processing method, related node and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150127625A1 (en) * 2011-04-26 2015-05-07 Brian J. Bulkowski Cluster-node load balancing in a distributed database system
CN108154367A (en) * 2017-12-26 2018-06-12 质数链网科技成都有限公司 A kind of block chain business method of calibration and device
CN110113388A (en) * 2019-04-17 2019-08-09 四川大学 A kind of method and apparatus of the block catenary system common recognition based on improved clustering algorithm
CN111786952A (en) * 2020-05-29 2020-10-16 中国银联股份有限公司 Consensus method, apparatus, device and medium for block chain system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338677A (en) * 2021-12-30 2022-04-12 中山大学 Block generation method and related device in block chain system
CN114338677B (en) * 2021-12-30 2022-10-21 中山大学 Block generation method and related device in block chain system

Also Published As

Publication number Publication date
TWI790611B (en) 2023-01-21
CN111786952B (en) 2023-03-17
TW202145116A (en) 2021-12-01
CN111786952A (en) 2020-10-16

Similar Documents

Publication Publication Date Title
WO2021238298A1 (en) Consensus method, apparatus and device for blockchain system, and medium
US10616243B2 (en) Route updating method, communication system, and relevant devices
EP2380324B1 (en) Secure node identifier assignment in a distributed hash table for peer-to-peer networks
US20210160171A1 (en) Blockchain-based verifiable inter-domain routing validation method
US10637794B2 (en) Resource subscription method, resource subscription apparatus, and resource subscription system
US20190166042A1 (en) Method for data transmitting, centralized controller, forwarding plane device and communication apparatus
WO2017101426A1 (en) Method for use in file synchronization, recipient device, and system
CN108933804B (en) Peer-to-peer network construction method and device
US10230618B2 (en) Path acquisition method, path computation element, path computation client and system
US8509233B2 (en) Method and apparatus for requesting multicast, processing and assisting multicast request
EP2881861A1 (en) Load distribution device, information processing system, method, and program
US10938556B2 (en) Method of sharing a key serving to derive session keys for encrypting and authenticating communications between an object and a server
CN111555900B (en) Method for guiding client nodes in P2P network to reasonably select node bandwidth, computer readable storage medium and P2P network
CN114389890A (en) User request proxy method, server and storage medium
CN117240900B (en) Block chain node discovery and networking method and device based on software defined network
CN113949730A (en) Communication method and device of equipment
CN114500001B (en) Communication method and device
WO2022004894A1 (en) Transmission source terminal, communication system, communication method, and program
CN111541733B (en) Method for testing message storage in P2P network, computer readable storage medium and P2P network
CN111343002B (en) Server capacity expansion deployment method and device and server
CN108769040B (en) Method and device for identifying nodes in disguised cluster
CN116319946A (en) Session holding method, apparatus, electronic device and storage medium
CN115065526A (en) Block chain based dynamic endorsement method and device, electronic equipment and storage medium
CN114501440A (en) Authentication key protocol applied to edge of wireless sensor network by block chain
KR20170105716A (en) Apparatus for securing network routing and method using the same

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21812734

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21812734

Country of ref document: EP

Kind code of ref document: A1