Data processing method, device, program, and equipment for consensus network

JP7631661B2Active Publication Date: 2025-02-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
JP2023572514
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-07-08
Filing Date
2023-04-23
Publication Date
2025-02-19
Estimated Expiration
2043-04-23

AI Technical Summary

Benefits of technology

【0011】 本出願において、コンセンサスネットワークはN個のコンセンサスノードを含み、コンセンサスネットワークにおける第1の主ノードは第1のブロックのコンセンサス過程を発起し、第1のブロックのコンセンサス過程で、第1のコンセンサスノードは、第2のコンセンサスサブネットワークにおいて第2のコンセンサスノードがブロードキャストした第1のブロックを受信する。第2のコンセンサスサブネットワークはN個のコンセンサスノードのうちのK個のコンセンサスノードを含み、第1のコンセンサスノード及び第2のコンセンサスノードは何れも第2のコンセンサスサブネットワークに属し、第2のコンセンサスノードはN個のコンセンサスノードのうちの第1のコンセンサスノードを除いた何れか1つであり、KはNより小さい正の整数であり、つまり、コンセンサスネットワークより、第2のコンセンサスサブネットワークは小規模ネットワークである。第2のコンセンサスサブネットワークにおいて第1のブロックに対してコンセンサス処理を行って、第1のコンセンサスノードの、第1のブロックに対するコンセンサス結果を取得し、第1のコンセンサスノードの、第1のブロックに対するコンセンサス結果がコンセンサス達成結果であると決定した場合、第1のコンセンサスサブネットワークにおいて第1のブロックに対して引き続いてコンセンサス処理を実行するように、第1のコンセンサスノードが所属する第1のコンセンサスサブネットワークにおいて第1のブロックをブロードキャストする。第1のコンセンサスサブネットワークはN個のコンセンサスノードのうちのM個のコンセンサスノードを含み、MはNより小さい正の整数であり、つまり、コンセンサスネットワークより、第1のコンセンサスサブネットワークも小規模ネットワークである。これによって、大規模コンセンサスネットワークにおけるコンセンサスを、いくつかの小規模コンセンサスサブネットワークにおけるコンセンサスに変換する。コンセンサスネットワークにおいて第1のコンセンサスノードの、第1のブロックに対するコンセンサス達成結果をブロードキャストして、コンセンサスネットワークにおける第1のブロックのコンセンサス達成結果の第1の数を取得し、第1の数に基づいて第1のブロックに対してアップリンク処理を行う。このように、本出願が提出する方法によれば、各コンセンサスノードは何れもコンセンサスネットワークの小さなネットワーク内(例えば第1のコンセンサスサブネットワーク及び第2のコンセンサスサブネットワーク)においてブロックをブロードキャストでき、さらに、小さなネットワーク内においてもブロックに対してコンセンサス処理を行って、ブロックに対してコンセンサスを行う時の通信量を減少して、コンセンサスネットワークの、ブロックに対するコンセンサス効率及び性能を向上する。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007631661000001
    Figure 0007631661000001
  • Figure 0007631661000002
    Figure 0007631661000002
  • Figure 0007631661000003
    Figure 0007631661000003
Patent Text Reader

Abstract

The present application discloses a data processing method, an apparatus, a program product, an apparatus and a medium for a consensus network, in which a first consensus node receives a first block broadcast by a second consensus node in a second consensus sub-network of the consensus network, performs a consensus process on the first block in the second consensus sub-network, and obtains a consensus result of the first consensus node for the first block; broadcasts the first block in the first consensus sub-network of the consensus network, so as to perform a consensus process on the first block in the first consensus sub-network if the consensus result of the first consensus node for the first block is a consensus achievement result; broadcasts the consensus achievement result of the first consensus node for the first block in the consensus network, obtains a first number of consensus achievement results of the first block in the consensus network, and performs uplink processing on the first block according to the first number. According to the present application, the amount of communication when performing consensus on a block is reduced, thereby improving the efficiency and performance of consensus on a block.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] This application claims priority to a Chinese patent application filed with the China Patent Office on July 8, 2022, bearing application number 202210800712.6 and entitled "Consensus network data processing method, device, program product, equipment and medium", the entire contents of which are incorporated herein by reference.

[0002] The present application relates to the technical field of blockchain, and in particular to a data processing method, device, program product, apparatus, and medium for a consensus network. [Background technology]

[0003] Blockchain is a new application mode of computer technology, including distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. A block in a blockchain network can only undergo uplink processing if it has achieved consensus in the consensus network. Summary of the Invention [Problem to be solved by the invention]

[0004] In the consensus process for a block in a consensus network, the block needs to be broadcast among each consensus node in the consensus network before consensus can be carried out. If the scale of the consensus network is large and there are many consensus nodes, the amount of communication required when broadcasting and reaching consensus on a block in the consensus network will be extremely large, which will severely degrade the processing performance of the entire consensus network.

[0005] The present application provides a data processing method, device, program product, apparatus, and medium for a consensus network, which reduces the amount of communication during the process of consensus on a block in the consensus network, and improves the consensus efficiency and performance of the consensus network for the block. [Means for solving the problem]

[0006] One aspect of the present application provides a data processing method for a consensus network, the consensus network includes N consensus nodes, N is a positive integer, the N consensus nodes include a first principal node, the method is executed by the first consensus node, the first consensus node is any one of the N consensus nodes excluding the first principal node, the method includes: receiving a first block broadcast by a second consensus node in a second consensus sub-network, the second consensus sub-network including K consensus nodes among N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, K is a positive integer smaller than N, the second consensus node is any one of the N consensus nodes excluding the first consensus node, and the consensus process of the first block is initiated by the first principal node; A step of performing a consensus process on the first block in the second consensus sub-network to obtain a consensus result of the first consensus node on the first block, and when it is determined that the consensus result of the first consensus node on the first block is a consensus achievement result, broadcasting the first block in the first consensus sub-network to which the first consensus node belongs, so as to perform a consensus process on the first block in the first consensus sub-network subsequently, where the first consensus sub-network includes M consensus nodes among the N consensus nodes, and M is a positive integer smaller than N; The method includes a step of broadcasting a consensus achievement result for the first block of a first consensus node in the consensus network to obtain a first number of consensus achievement results for the first block in the consensus network, and performing uplink processing for the first block based on the first number.

[0007] One aspect of the present application provides a data processing device for a consensus network, the consensus network includes N consensus nodes, N is a positive integer, the N consensus nodes include a first principal node, the device is applied to the first consensus node, the first consensus node is any one of the N consensus nodes except the first principal node, and the device includes: A receiving module for receiving a first block broadcast by a second consensus node in a second consensus sub-network, the second consensus sub-network includes K consensus nodes among N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, K is a positive integer smaller than N, the second consensus node is any one of the N consensus nodes excluding the first consensus node, and the consensus process of the first block is initiated by the first main node; A consensus module performs a consensus process on a first block in a second consensus sub-network to obtain a consensus result of the first consensus node on the first block, and when determining that the consensus result of the first consensus node on the first block is a consensus achievement result, broadcasts the first block in a first consensus sub-network to which the first consensus node belongs, and performs a subsequent consensus process on the first block in the first consensus sub-network, where the first consensus sub-network includes M consensus nodes among the N consensus nodes, and M is a positive integer less than N; The consensus achievement result of the first block of the first consensus node is broadcast in the consensus network, and an acquisition module is configured to acquire a first number of the consensus achievement results of the first block in the consensus network, and perform uplink processing on the first block based on the first number.

[0008] One aspect of the present application provides a computing device, comprising a memory and a processor, the memory storing a computer program, the computer program, when executed by the processor, causing the processor to perform a method of any one of the aspects of the present application.

[0009] One aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, the computer program including program instructions that, when executed by a processor, cause the processor to perform a method of any one of the above aspects.

[0010] According to one aspect of the present application, there is provided a computer program product, the computer program product including a computer program, the computer program being stored in a computer readable storage medium, a processor of a computing device reading the computer program from the computer readable storage medium, and the processor executing the computer program, thereby causing the computing device to perform a method provided by any one of the various preferred methods of any one of the above aspects. Effect of the Invention

[0011] In this application, the consensus network includes N consensus nodes, a first principal node in the consensus network initiates a consensus process of a first block, and in the consensus process of the first block, the first consensus node receives the first block broadcast by the second consensus node in the second consensus sub-network. The second consensus sub-network includes K consensus nodes among the N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, and the second consensus node is any one of the N consensus nodes except the first consensus node, where K is a positive integer smaller than N, that is, the second consensus sub-network is a smaller network than the consensus network. A consensus process is performed on the first block in the second consensus sub-network to obtain a consensus result of the first consensus node on the first block, and when it is determined that the consensus result of the first consensus node on the first block is a consensus achievement result, the first block is broadcast in the first consensus sub-network to which the first consensus node belongs, so as to perform a consensus process on the first block in the first consensus sub-network subsequently. The first consensus sub-network includes M consensus nodes among the N consensus nodes, where M is a positive integer smaller than N, that is, the first consensus sub-network is also a small-scale network compared to the consensus network. This converts the consensus in the large-scale consensus network into the consensus in several small-scale consensus sub-networks. A consensus achievement result for a first block of a first consensus node in the consensus network is broadcast to obtain a first number of consensus achievement results for the first block in the consensus network, and uplink processing is performed for the first block based on the first number.In this way, according to the method proposed in the present application, each consensus node can broadcast blocks within a small network of the consensus network (e.g., the first consensus sub-network and the second consensus sub-network), and further perform consensus processing on blocks even within the small network, thereby reducing the amount of communication when performing consensus on blocks, and improving the consensus efficiency and performance of the consensus network for blocks. [Brief description of the drawings]

[0012] In order to more clearly explain the technical solutions in the present application or the prior art, the following briefly introduces the necessary drawings in the embodiments or prior art description. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can obtain other drawings based on these drawings on the premise that they do not make efforts worthy of inventive step. [Figure 1] FIG. 1 is a structural schematic diagram of the network architecture of the consensus network provided by the present application; [Diagram 2] FIG. 1 is a schematic diagram of a block consensus scenario provided by the present application. [Diagram 3] FIG. 2 is a schematic flow diagram of a data processing method for a consensus network provided by the present application. [Figure 4a] FIG. 1 is a schematic diagram of a block broadcast scenario provided by the present application. [Figure 4b] FIG. 1 is a schematic diagram of a block broadcast scenario provided by the present application. [Diagram 5] FIG. 1 is a schematic diagram of a block consensus scenario provided by the present application. [Figure 6] FIG. 2 is a schematic diagram of a scenario of proposed content of blocks provided by the present application; [Figure 7] 1 is a flow diagram of a block processing method provided by the present application; [Figure 8] FIG. 2 is a schematic diagram of a block weight setting scenario provided by the present application; [Figure 9]FIG. 2 is a schematic diagram of a block processing scenario provided by the present application; [Figure 10] FIG. 1 is a schematic diagram of the block consensus flow provided by the present application. [Figure 11] FIG. 1 is a flow diagram of the addition method provided by the present application. [Figure 12] FIG. 2 is a structural schematic diagram of a data processing device of a consensus network provided by the present application; [Figure 13] FIG. 2 is a structural schematic diagram of a computer device provided by the present application; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0013] Hereinafter, the technical solution of this application will be clearly and completely described in conjunction with the drawings of this application, and obviously, the described embodiments are not all the embodiments, but only some of the embodiments of this application. Based on the embodiments of this application, on the premise that a person skilled in the art does not make an effort worthy of inventive step, all other embodiments obtained fall within the protection scope of this application.

[0014] This application relates to the related technology of blockchain. Blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Essentially, blockchain is a decentralized database, a series of data blocks generated to be associated using encryption methods, each data block contains information of a batch of network transactions to verify the validity (anti-counterfeiting) of the information and generate the next block. Blockchain includes a blockchain base platform, a platform product service layer and an application service layer. Blockchain includes a series of blocks connected to each other according to the order of generation, and when a new block is added to the blockchain, it is not removed, and the blocks record data submitted by the nodes in the blockchain system. In this application, a large-scale consensus network is transformed into individual small-scale consensus sub-networks to realize consensus on blocks, thereby improving the performance and efficiency of consensus network consensus on blocks.

[0015] This application relates to cloud technology; for example, blockchain nodes (e.g., consensus nodes) can communicate between each other via the “cloud.”

[0016] Here, all data collected by this application (e.g., blocks and traffic data in blocks) are collected with the individual consent and authentication of the object (e.g., user) to which the traffic data belongs, and the collection, use and processing of related data must comply with the relevant laws and standards of relevant countries and regions.

[0017] Refer to Figure 1, which is a structural schematic diagram of the network architecture of the consensus network provided by the present application. As shown in Figure 1, the consensus network includes several consensus nodes, namely, consensus node 1 to consensus node N, where N is a positive integer, and the specific value of N is determined according to the actual application scenario. Any one of the consensus nodes is composed of one or more computer devices, and the computer devices may be terminal devices or servers.

[0018] If the computer device constituting the consensus node is a server, the server may be an independent physical server, a server cluster or a distributed system consisting of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, big data and artificial intelligence platforms. If the computer device constituting the consensus node is a terminal device, the terminal device may be a smart terminal such as a smartphone, a tablet computer, a laptop computer, a desktop computer, a smart TV, or an in-vehicle terminal.

[0019] Please also refer to Figure 2, which is a schematic diagram of a block consensus scenario provided by the present application. As shown in Figure 2, the master node in the consensus network can be replaced, and consensus node 1 is currently the master node that initiated the proposal and consensus for the block. Consensus node 1 first broadcasts the block that needs consensus to the corresponding consensus sub-network 1, which includes consensus node 1, consensus node 2, consensus node 3 and consensus node 4.

[0020] Furthermore, after consensus is carried out on the block initiated by the consensus node 1 in the consensus sub-network 1 and the consensus is completed, each consensus node in the consensus sub-network 1 obtains its own consensus result on the block, which is not the final consensus result on the block of all the consensus nodes in the consensus sub-network 1, but each consensus node's own consensus result on the block (for example, a consensus achieved result or a consensus not achieved result). The consensus results on the block of each consensus node may be similar or different.

[0021] When the consensus of the block is achieved in the consensus node 2, that is, the consensus result of the consensus node 2 for the block is a consensus achievement result, the consensus node 2 subsequently broadcasts the block to the corresponding consensus subnetwork 2, which includes the consensus node 2, the consensus node 5, the consensus node 6 and the consensus node 7, and further, the consensus is subsequently carried out on the block initiated by the consensus nodes in the consensus subnetwork 2. After the consensus is completed, each consensus node in the consensus subnetwork 2 can respectively obtain its own consensus result for the block.

[0022] Similarly, when consensus on a block is achieved at consensus node 3, that is, the consensus result of consensus node 3 on the block is a consensus achievement result, the consensus node 3 then broadcasts the block to the corresponding consensus subnetwork 3, which includes consensus node 3, consensus node 8, consensus node 9 and consensus node 10, and further, the consensus nodes in the consensus subnetwork 3 then continue to perform consensus on the block initiated by the consensus nodes. After the consensus is completed, each consensus node in the consensus subnetwork 3 can respectively obtain its own consensus result on the block.

[0023] Similarly, when consensus on a block is achieved at the consensus node 4, that is, the consensus result of the consensus node 4 on the block is a consensus achievement result, the consensus node 4 then broadcasts the block to the corresponding consensus subnetwork 4, which includes the consensus node 4, the consensus node 11, the consensus node 12 and the consensus node 13, and further, the consensus is then carried out on the block initiated by the consensus nodes in the consensus subnetwork 4. After the consensus is completed, each consensus node in the consensus subnetwork 4 can respectively obtain its own consensus result on the block.

[0024] Furthermore, in consensus node 5, consensus node 6, consensus node 7, consensus node 8, consensus node 9, consensus node 10, consensus node 11, consensus node 12 and consensus node 13, the consensus nodes that achieve block consensus will subsequently broadcast the block to more consensus nodes in the consensus network (e.g., broadcast to corresponding consensus sub-networks), and further perform consensus processing on the block, so as to achieve the purpose of consensus on the block in the entire consensus network after performing diffuse broadcast consensus on the block in each consensus sub-network.

[0025] Furthermore, the consensus nodes that have achieved block consensus in the consensus network will broadcast their respective consensus achievement results for the block within the entire network (the entire consensus network), and when each consensus node obtains a consensus achievement result for a block whose number is equal to or greater than the quantity threshold from the consensus network, it represents that consensus for the block has been achieved in the entire network, and can perform uplink processing for the block, for example, adding the block to the blockchain to which the consensus network belongs. For the specific process of consensus on a block, please refer to the description of the embodiment corresponding to Figure 3 below.

[0026] According to the method provided by the present application, consensus on a block is performed in each small network (e.g., each small consensus sub-network) rather than the entire large consensus network, thereby reducing the complexity and amount of communication during the consensus process for the block, improving the consensus efficiency for the block, and enhancing the consensus performance for the block in the entire consensus network.

[0027] Please refer to Figure 3, which is a flow diagram of the consensus network data processing method provided by the present application. As shown in Figure 3, the method includes the following steps: S101: Receive a first block broadcast by a second consensus node in a second consensus subnetwork, where the second consensus subnetwork includes K consensus nodes among N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus subnetwork, K is a positive integer smaller than N, the second consensus node is any one of the N consensus nodes excluding the first consensus node, and the consensus process of the first block is initiated by the first principal node.

[0028] In a possible implementation, the consensus network includes N consensus nodes, the N consensus nodes are block chain nodes that perform consensus processing for blocks that need to be uplinked, N is a positive integer, and the specific value of N is determined according to an actual application scenario. Any one consensus node is composed of one or more computer devices, the computer devices may be servers or terminal devices, and the specific value may be determined according to an actual application scenario, and is not limited thereto.

[0029] The above N consensus nodes include a first principal node, which is a principal node that needs to initiate a proposal and consensus for a block at present, and generally, the first principal node is a consensus node, that is, a consensus node that currently initiates a consensus for a block. Therefore, the execution body in the embodiment of the present application is the first consensus node, and the first consensus node is any one of the N consensus nodes, except for the first principal node.

[0030] Thus, the first consensus node receives a first block broadcast by a second consensus node in a second consensus sub-network, the first block is a block that currently requires consensus, the consensus process of the first block is initiated by the above-mentioned first main node, the first block is initially proposed by the first main node, the first block may be generated by the first main node, and the first block may include any traffic data that requires uplink, such as transaction data.

[0031] In a possible implementation form, the method provided by the embodiments of the present application improves the consensus process of TBFT (TendermintBFT, consensus algorithm). In TBFT, the master node in the consensus network can be replaced, and the replacement method is diverse. For example, each consensus node in the consensus network has a corresponding node number, and the master node in the consensus network can be replaced in sequence based on the node number of each consensus node, or can be replaced according to other policies. Each consensus node in the consensus network knows the master node replacement policy, so in the consensus network using TBFT, each consensus node can know which master node it is at each time without notifying each other.

[0032] Therefore, according to the method provided by the present application, the large-scale consensus network in TBFT is transformed into several small networks (e.g., several consensus sub-networks) to perform consensus on blocks, thereby reducing the amount of data and communication complexity when broadcasting data during the consensus process.

[0033] The above-mentioned second consensus node is any one of the above-mentioned N consensus nodes excluding the first consensus node, and the above-mentioned second consensus sub-network is a consensus sub-network corresponding to the second consensus node, the second consensus sub-network is a sub-network (also called a small network or a small-scale network) in the consensus network, the second consensus sub-network includes K consensus nodes, K is a positive integer smaller than N, the value of K is smaller than the value of N, and the value of K is determined according to an actual application scenario. The first consensus node and the second consensus node both belong to the second consensus sub-network, that is, the second consensus sub-network includes the first consensus node and the second consensus node.

[0034] The first remaining consensus nodes in the above K consensus nodes are K-1 consensus nodes that are mutually connected (i.e., communicated) with the second consensus node and selected (randomly selected) from the N consensus nodes by the second consensus node, and the K-1 consensus nodes are consensus nodes that can broadcast a block that requires consensus when the second consensus node obtains the block. The first remaining consensus nodes are consensus nodes among the K consensus nodes excluding the second consensus node. Alternatively, in a possible implementation form, the K-1 consensus nodes may be consensus nodes close to the second consensus node selected based on a routing table, or may be consensus nodes that can broadcast a block that requires consensus by the pre-installed second consensus node. When the K-1 consensus nodes are pre-installed, the K-1 consensus nodes are periodically updated, for example, updated every predetermined period (for example, every period), and the value of K can also be updated when updating, that is, the number of consensus nodes to which the second consensus node can broadcast the block requiring consensus can be changed, in other words, the number of consensus nodes to which the second consensus node can broadcast the block requiring consensus can be periodically updated and dynamically changed. In a possible implementation, specifically, the method of determining the second consensus sub-network corresponding to the second consensus node is determined according to an actual application scenario, and is not limited thereto.

[0035] The above-mentioned second consensus sub-network is a virtual consensus sub-network for broadcasting the first block formed when the second consensus node broadcasts the first block, and the consensus sub-network does not have to be a separate sub-network partitioned in advance.

[0036] Here, if the second consensus node is the first main node, the first block broadcast by the second consensus node may be generated by the second consensus node, and the second consensus node may initiate a consensus process for the first block. If the second consensus node is not the first main node, the first block broadcast by the second consensus node is obtained by a third consensus node among the above N consensus nodes broadcasting to the second consensus node, and the third consensus node is any one of the N consensus nodes excluding the first consensus node and the second consensus node. The principle of a third consensus node among the N consensus nodes broadcasting a first block to a second consensus node is similar to the principle of a second consensus node broadcasting a first block to a first consensus node, for example, broadcasting the first block to a corresponding consensus sub-network, which includes the second consensus node.

[0037] In other words, the first block is initially generated by the first main node and broadcast to the corresponding consensus sub-network, the first block received by each consensus node in the consensus sub-network corresponding to the first main node is broadcast by the first main node, and the first block received by other consensus nodes among the N consensus nodes is broadcast by consensus nodes among the N consensus nodes other than the first main node, where the other consensus nodes are consensus nodes among the N consensus nodes other than the consensus nodes included in the consensus sub-network corresponding to the first main node.

[0038] S102: Perform a consensus process on the first block in a second consensus sub-network to obtain a consensus result of the first consensus node for the first block, and if it is determined that the consensus result of the first consensus node for the first block is a consensus achievement result, broadcast the first block in the first consensus sub-network to which the first consensus node belongs, so as to continuously perform a consensus process on the first block in the first consensus sub-network, where the first consensus sub-network includes M consensus nodes among the N consensus nodes, and M is a positive integer smaller than N.

[0039] In a possible implementation, after the first consensus node receives the first block broadcast by the second consensus node, the first consensus node performs a consensus process on the first block in the second consensus sub-network to obtain the consensus result of the first consensus node on the first block. That is, the consensus nodes in the second consensus sub-network may perform a consensus process on the first block together using the BTFT consensus algorithm. In a possible implementation, the consensus nodes in the second consensus sub-network perform a consensus process on the first block using the BTFT consensus algorithm, and the consensus process includes three consensus stages, namely, a propose stage, a prevote stage, and a precommit stage, and in the early voting stage and the precommit stage, data that needs to be mutually broadcast (e.g., voting data for the first block) exists between the consensus nodes in the second consensus sub-network.

[0040] After the consensus nodes in the second consensus sub-network reach a consensus on the first block through the above three consensus steps together, each consensus node in the second consensus sub-network can obtain a consensus result on the first block, which may be a consensus achievement result or a consensus failure result, and the consensus results on the first block obtained by different consensus nodes may be similar or different. The consensus achievement result represents that the consensus on the first block is achieved and the uplink for the first block is agreed upon, and conversely, the consensus failure result represents that the consensus on the first block is not achieved and the uplink for the first block is not agreed upon.

[0041] Here, the above first principal node is currently the principal node of the entire consensus network and proposes to the blockchain, and regardless of whether the second consensus node is the first principal node, the second consensus node is understood as the "principal node" in the second consensus sub-network, that is, the second consensus node initiates the proposal and consensus for the first block in the second consensus sub-network.

[0042] Therefore, when the first consensus node achieves consensus on the first block (i.e., the first consensus node obtains its own consensus achievement result for the first block), the first consensus node continues to broadcast the first block in the corresponding consensus sub-network (also referred to as the first consensus sub-network), thereby performing a consensus process on the first block in the first consensus sub-network.

[0043] Similarly, the first consensus sub-network may be a sub-network (small network) in the consensus network, and the first consensus sub-network includes M consensus nodes, where M is a positive integer smaller than N, and the value of M may be the same as or different from the value of K above, and is specifically determined based on the actual application scenario. The second remaining consensus nodes in the M consensus nodes are M-1 consensus nodes that are mutually connected to the first consensus node and selected (for example, randomly selected) by the first consensus node from the N consensus nodes. The second remaining consensus nodes are the consensus nodes of the M consensus nodes excluding the first consensus node.

[0044] The M-1 consensus nodes are consensus nodes that can broadcast a block that requires consensus (e.g., a first block) when the first consensus node obtains the block that requires consensus. Or, in a possible implementation form, the M-1 consensus nodes are consensus nodes close to the first consensus node selected based on a routing table, or the M-1 consensus nodes are consensus nodes that the first consensus node previously installed can broadcast a block that requires consensus, and when the M-1 consensus nodes are previously installed, they may be periodically updated, for example, updated every predetermined period (e.g., every period), and when updating, the value of M is also updated, that is, the number of consensus nodes that the first consensus node can broadcast a block that requires consensus can also change, in other words, some consensus nodes that the first consensus node can broadcast a block that requires consensus can be periodically updated and dynamically changed. In a possible implementation, specifically, the method of determining the first consensus sub-network corresponding to the first consensus node is determined based on an actual application scenario, and is not limited thereto.

[0045] Similarly, here, the first consensus subnetwork may be a virtual consensus subnetwork for broadcasting the first block formed when the first consensus node broadcasts the first block, and the consensus subnetwork may not be a pre-partitioned individual subnetwork.

[0046] When consensus is reached on a first block in a second consensus sub-network, if a first consensus node does not achieve consensus on the first block, the first consensus node does not need to continue broadcasting the first block to the corresponding first consensus sub-network, but only needs to record the failure to achieve consensus on the first block.

[0047] Similarly, after broadcasting the first block in the first consensus subnetwork to which the first consensus node belongs, each consensus node in the first consensus subnetwork continues to perform the above three steps of consensus processing on the first block, and each consensus node in the first consensus subnetwork obtains its own consensus result on the first block, which may be a consensus achievement result or a consensus failure result. By analogy, the consensus node in the first consensus subnetwork that obtains the consensus achievement result on the first block will continue to broadcast the first block to the corresponding consensus subnetwork, thereby continuing to perform consensus processing on the first block in the consensus subnetwork.

[0048] Similarly, the above first master node is currently the master node of the entire consensus network and proposes to the blockchain, and the first consensus node can be understood as the "master node" in the first consensus sub-network, i.e., in the first consensus sub-network, the first consensus node initiates the proposal and consensus for the first block.

[0049] According to the above process, the first block is continuously and diffusely broadcast among each consensus sub-network, and a complete consensus process (including the above three consensus steps) is performed on the first block in each consensus sub-network, thereby realizing consensus on the first block in the entire consensus network. In the last two consensus steps (prevote step and precommit step) of the three consensus steps, there is consensus data (e.g., voting data) that needs to be mutually broadcast among consensus nodes that mutually agree on the block. Therefore, when data is mutually broadcast in the entire consensus network including N consensus nodes, the communication complexity is O(N 2 ).

[0050] Therefore, according to the method provided by the present application, when the consensus processing of the above three consensus steps is performed for a block, in the last two consensus steps, the consensus nodes can mutually broadcast the consensus data in the corresponding consensus sub-networks, rather than in the entire large-scale consensus network, thereby reducing the amount of data that needs to be broadcast and transmitted in the consensus process and reducing the complexity of communication during the consensus process.

[0051] The method in which each of the above consensus subnetworks continuously and diffusely broadcasts consensus on the first block is realized based on the principles of the Gossip protocol (communication protocol), which can improve the consensus performance of the entire blockchain by changing the consensus of large nodes into the consensus of several small nodes.

[0052] 4a-4b, which are schematic diagrams of a block broadcast scenario provided by the present application. As shown in FIG. 4a, the consensus nodes in the consensus network include Node 1-Node 14, where Node 1 is the first main node, and Node 1 first broadcasts a first block that needs consensus to a corresponding consensus sub-network, where the consensus sub-network corresponding to Node 1 includes Node 1, Node 2, Node 3 and Node 4. Furthermore, each consensus node in the consensus sub-network corresponding to Node 1 performs a consensus process on the first block, and any consensus node in the consensus sub-network that achieves consensus on the first block can subsequently broadcast the first block to its corresponding consensus sub-network, and each consensus node in the consensus sub-network can subsequently perform a consensus process on the first block.

[0053] As shown in Fig. 4a, if node 2 achieves consensus on the first block, node 2 is a second consensus node, and thus node 2 will subsequently broadcast the first block to a corresponding consensus sub-network (e.g., a second consensus sub-network), where the consensus sub-network corresponding to node 2 includes node 2, node 5, node 6, and node 7. Furthermore, each consensus node in the consensus sub-network corresponding to node 2 will subsequently perform a consensus process on the first block, and if it is a consensus node in the consensus sub-network that has achieved consensus on the first block, it will subsequently broadcast the first block to its corresponding consensus sub-network, and further, each consensus node in the consensus sub-network can subsequently perform a consensus process on the first block.

[0054] As shown in Fig. 4b, if node 6 achieves consensus on the first block, node 6 is the first consensus node, and then node 6 will subsequently broadcast the first block to a corresponding consensus sub-network (e.g., the first consensus sub-network), where the consensus sub-network corresponding to node 6 includes node 6, node 8, node 9 and node 14. By analogy, any consensus node in the consensus sub-network corresponding to node 6 that achieves consensus on the first block will subsequently broadcast the first block to its corresponding consensus sub-network, and each consensus node in the consensus sub-network will subsequently perform consensus processing on the first block, so as to achieve the purpose of achieving consensus on the first block in the entire consensus network.

[0055] For the same block, each consensus node in the consensus network may broadcast it only once to the corresponding consensus sub-network.

[0056] Please refer to Figure 5, which is a schematic diagram of the block consensus scenario provided by the present application. As shown in Figure 5, the N consensus nodes in the consensus network include node 0 to node 30, and node 0 is the first principal node.

[0057] Therefore, first, node 0 broadcasts a first block that requires consensus in the corresponding consensus sub-network (including nodes 0 to 4), and then performs consensus processing on the first block in the consensus sub-network.

[0058] When consensus on the first block is completed in the consensus subnetwork corresponding to node 0, and nodes 1 to 4 have all achieved consensus on the first block, nodes 1 to 4 can subsequently broadcast the first block to their respective consensus subnetworks.

[0059] Here, the consensus subnetwork corresponding to node 1 includes node 1, node 5, node 6, and node 7, so node 1 will broadcast the first block to node 5, node 6, and node 7; the consensus subnetwork corresponding to node 2 includes node 2, node 8, node 9, and node 10, so node 2 will broadcast the first block to node 8, node 9, and node 10; the consensus subnetwork corresponding to node 3 includes node 3, node 11, node 12, and node 13, so node 3 will broadcast the first block to node 11, node 12, and node 13; and the consensus subnetwork corresponding to node 4 includes node 4, node 14, node 15, and node 16, so node 4 will broadcast the first block to node 14, node 15, and node 16.

[0060] By this analogy, the consensus node in each consensus sub-network that has achieved consensus on the first block will subsequently broadcast the first block to the corresponding consensus sub-network to perform consensus processing, and thereafter, if the number of consensus nodes in the consensus network that have achieved consensus on the first block is equal to or greater than the quantity threshold, they can perform uplink processing on the first block. If the consensus node in each consensus sub-network has not achieved consensus on the first block, it will no longer be necessary to broadcast the first block to more consensus nodes.

[0061] S103: Broadcast a consensus achievement result for the first block of a first consensus node in the consensus network to obtain a first number of consensus achievement results for the first block in the consensus network, and perform uplink processing for the first block based on the first number.

[0062] In a possible implementation, the first consensus node broadcasts its own consensus achievement result for the first block in the consensus network, so that other consensus nodes in the consensus network can also know the consensus achievement result of the first consensus node for the first block. If the first consensus node has not achieved consensus on the first block, the first consensus node does not need to broadcast the consensus failure result for the first block.

[0063] Similarly, in a consensus network, a first consensus node broadcasts its own consensus achievement result for the first block to the corresponding consensus sub-network based on the principle of the gossip protocol, and then the consensus nodes in the consensus sub-network corresponding to the first consensus node subsequently broadcast the consensus achievement result of the first consensus node for the first block to the corresponding consensus sub-network, and by analogy, subsequently broadcasts diffusely, thereby achieving the purpose of broadcasting the consensus achievement result of the first consensus node for the first block to the entire consensus network.

[0064] In fact, each consensus node in the consensus network that has achieved consensus on the first block can broadcast its own consensus achievement result on the first block in the consensus network according to the principle that the first consensus node broadcasts the consensus achievement result on the first block in the consensus network. Therefore, each consensus node in the consensus network can obtain the consensus achievement result on the first block of other consensus nodes.

[0065] Therefore, the first consensus node further obtains the number of consensus achievement results for the first block in the consensus network (also referred to as the first number), where the first number is the total number of consensus achievement results for the first block of each consensus node obtained by the first consensus node from the entire consensus network.

[0066] Furthermore, the first consensus node performs an uplink process on the first block according to the first number, and if the first number is equal to or greater than a quantity threshold, it represents that the consensus of the first block has been achieved in the entire consensus network, and the first consensus node can perform an uplink process on the first block, i.e., add the first block to the blockchain network. If the first number is smaller than the quantity threshold, it represents that the consensus of the first block has not been achieved in the entire consensus network, and the first consensus node discards the first block, i.e., does not perform an uplink process on the first block.

[0067] The above quantity threshold is set according to actual needs. In a possible implementation, the quantity threshold is set according to the maximum number of fraudulent nodes supported by the consensus network, for example, 2f+1, where f is the maximum number of fraudulent nodes supported by the consensus network (i.e., the maximum number of fraudulent consensus nodes that can be tolerated), in which case, N above is also related to the maximum number of fraudulent nodes supported by the consensus network, for example, N above is greater than or equal to 3f+1.

[0068] In a possible implementation, the consensus achievement result of any one of the consensus nodes in the consensus network for any one of the blocks is the node signature of the any one of the consensus nodes for the any one of the blocks. The first consensus node caches a node signature set associated with the first block, and the node signature set stores the node signature (i.e., the consensus achievement result) of each consensus node in the consensus network for the first block, and when the first consensus node achieves consensus for the first block, the node signature set includes the node signature of the first consensus node for the first block.

[0069] Therefore, in the process of performing consensus processing on the first block in the consensus network (i.e., in the process of performing consensus processing on the first block in each consensus sub-network of the consensus network), the first consensus node receives the node signature for the first block broadcast by the third remaining consensus node (the one broadcast may be the node signature for the first block of the consensus node itself, or may be the node signature for the first block of the other consensus node that has received it), and the first consensus node adds all of the received node signatures for the first block to the node signature set associated with the first block. Note that the third remaining consensus node is the consensus node of the N consensus nodes excluding the first consensus node.

[0070] Further, the first consensus node obtains the number of node signatures in the node signature set associated with the first block, which is the above-mentioned first number, and if the first number is greater than or equal to the above-mentioned quantity threshold, the first consensus node may perform an uplink process on the first block (i.e., write, e.g., add to the first consensus node's local ledger).

[0071] Each consensus node in the consensus network can perform uplink processing on the first block based on the consensus achievement result for the received first block, according to the principle of the above-mentioned first consensus node performing uplink processing on the first block.

[0072] Please refer to Fig. 6, which is a schematic diagram of the scenario of block proposal content provided by the present application. As shown in Fig. 6, the content proposed (i.e., the content broadcasted) by any one consensus node in the corresponding consensus sub-network includes Block (a block, for example, the first block), the signature of the master node for the block (for example, the signature of the first master node for the first block), a set of node signatures, a set of consensus node IDs (identifiers) of this round (the set includes the node IDs of all consensus nodes in the current consensus sub-network), and a current node signature (i.e., the node signature of the "master node" in the current consensus sub-network for the block).

[0073] The block in the proposed content is marked with the block height and consensus round (i.e., consensus round) corresponding to the block, and the block height and consensus round uniquely mark the block. The signature of the principal node (e.g., the first principal node, a principal node without quotation marks indicates a principal node in the entire consensus network) in the proposed content on the block is used to verify the proposed content, i.e., to verify that the consensus of the current block is initiated from the current principal node.

[0074] The node signature set in the proposed content records the node signature of each consensus node in the consensus network for the first block, and the node signature is the consensus achievement result for the first block, where when a "principal node" in the consensus sub-network (the "principal node" in quotation marks refers to a consensus node that performs the role of a principal node in the corresponding consensus sub-network) first broadcasts the proposed content to the corresponding consensus sub-network, the node signature set may initially include only the node signature of the "principal node" for the first block, and thereafter, the node signature set can be continuously updated.

[0075] According to the consensus node ID set of this round in the proposed content, each consensus node in the current consensus subnetwork can clearly know which consensus node and block it is currently completing the consensus process for.

[0076] The current node signature is used to verify that the current proposal content was currently broadcast by the consensus node as the “principal node” in the consensus sub-network.

[0077] Furthermore, if the above second consensus node is the first principal node, the above K consensus nodes include a second principal node, and the second principal node is the next principal node in the N consensus nodes to replace the first principal node as the principal node, that is, the second principal node is the next principal node to propose a block after the first principal node.

[0078] Therefore, when the second consensus node determines that the consensus result for the first block is a consensus achievement result, the second main node initiates a consensus process for the second block in the consensus network, and the principle of the second main node initiating the consensus process for the second block is the same as the principle of the first main node initiating the consensus process for the first block, for example, both are broadcast to the corresponding consensus sub-networks, and broadcast consensus is diffused among each consensus sub-network of the consensus network. Note that the block height corresponding to the second block may be the next block height of the block height corresponding to the first block.

[0079] Here, the block height corresponding to any one block that requires consensus is the block height after the consensus for that block is achieved in the entire consensus network and the block is uplinked.

[0080] As can be seen from the above, when the current master node in a consensus network initiates a proposal for a block, it preferentially broadcasts the block to the next master node (i.e., the consensus sub-network corresponding to the current master node includes the next master node of the current master node), and after the current master node completes the consensus for the block broadcasted by the current master node, the next master node initiates the consensus process for the next block (e.g., the second block) ahead of schedule, thereby synchronizing the consensus process for the next block with the consensus process for the current block, thereby improving the efficiency of the consensus process for the blocks.

[0081] In this application, the consensus network includes N consensus nodes, a first principal node in the consensus network initiates a consensus process of a first block, and in the consensus process of the first block, the first consensus node receives the first block broadcast by the second consensus node in the second consensus sub-network. The second consensus sub-network includes K consensus nodes among the N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, and the second consensus node is any one of the N consensus nodes except the first consensus node, where K is a positive integer smaller than N, that is, the second consensus sub-network is a smaller network than the consensus network. A consensus process is performed on the first block in the second consensus sub-network to obtain a consensus result of the first consensus node on the first block, and when it is determined that the consensus result of the first consensus node on the first block is a consensus achievement result, the first block is broadcast in the first consensus sub-network to which the first consensus node belongs, so as to perform a consensus process on the first block in the first consensus sub-network subsequently. The first consensus sub-network includes M consensus nodes among the N consensus nodes, where M is a positive integer smaller than N, that is, the first consensus sub-network is also a smaller network than the consensus network. This converts the consensus in the large consensus network into a consensus in several small consensus sub-networks. A consensus achievement result for a first block of a first consensus node in the consensus network is broadcast to obtain a first number of consensus achievement results for the first block in the consensus network, and uplink processing is performed for the first block based on the first number.In this way, according to the method proposed in the present application, each consensus node can broadcast blocks within a small network of the consensus network (e.g., the first consensus sub-network and the second consensus sub-network), and further perform consensus processing on blocks even within the small network, thereby reducing the amount of communication when performing consensus on blocks, and improving the consensus efficiency and performance of the consensus network for blocks.

[0082] Please refer to Figure 7, which is a flow diagram of the block processing method provided by the present application. As shown in Figure 7, the method includes the following steps: S201: A third block to be a target of consensus is obtained, the third block is a block that requires consensus initiated by a third main node if the first block is not obtained within a specified time period, the block height corresponding to the third block is the first block height, and the third main node is a consensus node among N consensus nodes for replacing the first main node as the next main node.

[0083] In a possible implementation form, the execution body in the embodiment of the present application may be the above-mentioned first consensus node. The block height corresponding to the above-mentioned first block may be the first block height, that is, the first block is a block proposed at the first block height, and if the first block achieves consensus in the entire network (e.g., the entire consensus network) (e.g., the number of consensus achievement results of the first block in the consensus network is equal to or greater than the above-mentioned quantity threshold), the block height after the uplink of the first block is the first block height.

[0084] The predetermined time period is a time period set based on actual needs, which is a time limit for the third master node to wait to receive the first block, and if the third master node does not obtain the first block within the predetermined time period, it determines that the waiting has timed out, in which case the third master node can initiate the third block to be consensused. There are various reasons why the third master node does not obtain the first block within the predetermined time period, such as transmission delay or network abnormality.

[0085] The first consensus node can obtain a third block to be consensus-targeted, and the third block is a block that requires consensus initiated by the third main node when the first block has not been obtained even after a timeout, or a block that requires consensus generated by the third main node when the block proposed by the first block height has not been obtained even after a timeout (due to transmission delay or network abnormality), and the block height corresponding to the third block is also the first block height, that is, the block height corresponding to the first block and the block height corresponding to the third block may be the same.

[0086] That is, at the same block height, one or more rounds of consensus for blocks are initiated, and one round of consensus corresponds to one block that needs consensus, but for the same block height, only blocks in one round can achieve consensus in the entire network, that is, only one block at the same block height can achieve consensus in the entire network. The above first block and third block correspond to the same block height, but are blocks with different consensus rounds.

[0087] The third main node is a consensus node for replacing the first main node among the above N consensus nodes, and may be, for example, the first main node following the first main node (for example, the above second main node), or the second main node following the first main node, or the third main node following the first main node, etc.

[0088] The third block obtained by the first consensus node may be broadcast from the third main node, or may not be broadcast from the third main node, but may be broadcast from other consensus nodes that receive the third block initiated by the first consensus node. The principle of the third main node broadcasting and consensus on the third block in the consensus network may be similar to the principle of the first main node broadcasting and consensus on the first block in the consensus network, for example, both may diffusively broadcast the consensus among each consensus sub-network.

[0089] S202: A consensus process is performed on the third block. When the consensus process on the third block is completed, the third block is cached.

[0090] In a possible implementation, when the first consensus node performs a consensus process on the acquired third block and completes the consensus process on the second block, it can first cache the third block, and subsequently obtain the consensus achievement result of other consensus nodes in the consensus network for the third block. After completing the consensus process on the third block, the first consensus node can obtain the consensus result on the third block, which can be a consensus achievement result or a consensus failure result. That is, after completing the consensus process on the third block, regardless of whether the consensus on the third block is achieved, the first consensus node can cache the third block, and subsequently obtain the consensus achievement result of other consensus nodes in the consensus network for the third block, and further flexibly process the first block according to the actual situation. Here, generally, at one block height, one consensus node can only achieve consensus for one block, that is, one consensus node votes for only one block in any one round of consensus among several rounds of consensus at the same block height (i.e., achieves consensus, that is, obtains consensus achievement result). Also, generally, after one consensus node votes for one block, it cannot vote against the block thereafter (i.e., does not achieve consensus, that is, obtains consensus failure result). However, in a special case, after one consensus node votes against a block, it obtains the number of consensus achievement results of the block in the consensus network, and if the number is equal to or greater than the quantity threshold, it represents that the consensus of the block has been achieved in the entire consensus network, and the consensus node changes the vote against the block to a vote for it.

[0091] Similarly, after completing the consensus process for the first block, whether the first consensus node obtains a consensus achievement result for the first block or a consensus failure result for the first block, the first consensus node caches the first block, and subsequently obtains the consensus achievement result for the first block of other consensus nodes in the consensus network, and further flexibly processes the first block according to actual circumstances.

[0092] In the above case, the first consensus node may obtain the number of consensus achievement results (also called the second number) of the third block in the consensus network, and if the second number is equal to or greater than the above quantity threshold, the consensus of the third block is achieved in the entire consensus network, and therefore the first consensus node performs an uplink process on the third block and deletes the first block. At the same block height, there can only be one block that has achieved consensus, that is, in multiple rounds of consensus at the same block height, there can only be one round of blocks whose number of consensus achievements in the consensus network is equal to or greater than the quantity threshold.

[0093] Therefore, if the second number of the consensus achievement results of the third block in the consensus network is equal to or greater than the quantity threshold, the first number of the consensus achievement results of the first block in the consensus network is necessarily equal to or less than the quantity threshold, that is, after the consensus of the third block is successful (i.e., consensus is achieved) in the entire consensus network, the consensus of the first block cannot be successful in the entire consensus network, thereby ensuring the accuracy of block consensus.

[0094] Similarly, if the first number is greater than or equal to the quantity threshold, the second number cannot be greater than or equal to the quantity threshold. In this case, consensus is achieved for the first block in the entire consensus network, and the first consensus node performs an uplink process on the first block and deletes the cached third block.

[0095] Furthermore, in this application, at the same block height, there may be multiple blocks that make proposals and consensuses, that is, at the same block height, the first consensus node may cache multiple blocks, and the corresponding block heights of the multiple blocks are similar. Therefore, the following describes the process of determining the parent block of the block at the next block height from the multiple cached blocks when a block at the next block height is obtained.

[0096] In this application, a block weight is added to each cached block, and then the parent block of each block is selected according to the block weight. The larger the block weight, the higher the reliability of the corresponding block at the current block height; the smaller the block weight, the lower the reliability of the corresponding block at the current block height. In the following, the first block and the third block are taken as examples. When there are many blocks at the same block height, the processing logic between the two blocks is similar. Please refer to the following content description.

[0097] The first consensus node obtains a block weight for the first block based on the number of child blocks of the first block that are cached. In a possible implementation, the block weight for the first block is equal to the number of child blocks of the first block that are cached in the first consensus node.

[0098] Similarly, the first consensus node further obtains a block weight of the third block based on the number of child blocks of the third block that are cached. In a possible implementation, the block weight of the third block is equal to the number of child blocks of the third block that are cached in the first consensus node. The block weight of the first block and the block weight of the third block determine the parent block of the fourth block, and the block height corresponding to the fourth block is the second block height, and the second block height is the next block height of the first block height.

[0099] The child blocks of any one block include block a which has that block as its parent block, block b which has block a as its parent block, block c which has block b as its parent block, block d which has block c as its parent block, etc. In other words, the child blocks of any one block include all blocks which can be traced back successively upward (i.e., forward) to the parent block and back to that one block.

[0100] The sibling blocks of any one block are all blocks whose corresponding block height is similar to the block height corresponding to that one block, and since the first block and the third block both correspond to the first block height, the first block and the third block are sibling blocks of each other.

[0101] As can be seen from the above, the larger the block weight of a block, the more blocks will subsequently perform consensus based on that block; conversely, the smaller the block weight of a block, the fewer blocks will subsequently perform consensus based on that block. Therefore, the larger the block weight, the higher the reliability of the corresponding block at the current block height.

[0102] Furthermore, the first node can obtain a fourth block to be consensused, and the block height corresponding to the fourth block is also called the second block height, where the second block height is the next block height of the first block height. For example, if the first block height is 99, the second block height is 100. In a possible implementation, the fourth block can be the second block or a sibling block of the second block.

[0103] Therefore, when the blocks corresponding to the cached first block height include only the first block and the third block, and the block weight of the first block is greater than the block weight of the third block, the first consensus node can perform consensus processing on the fourth block with the first block as the parent block of the fourth block.

[0104] When the blocks corresponding to the cached first block height include only the first block and the third block, and the block weight of the first block is smaller than the block weight of the third block, the first consensus node can perform consensus processing on the fourth block with the third block as the parent block of the fourth block.

[0105] When the blocks corresponding to the cached first block height include only the first block and the third block, and the block weight of the first block is equal to the block weight of the third block, the first consensus node can select one of the first block and the third block as the parent block of the fourth block and perform consensus processing on the fourth block.

[0106] Similarly, when the first consensus node completes the consensus process for the fourth block and obtains a consensus result for the fourth block (consensus achievement result or consensus failure result), the first consensus node may cache the fourth block.

[0107] Similarly, the first consensus node can obtain the number of consensus achievement results of the fourth block in the consensus network, where when the consensus of one block is achieved in the consensus network, the consensus of all parent blocks that the block can trace back to can also be achieved, so if the number of consensus achievement results of the fourth block in the consensus network is equal to or greater than the quantity threshold, and the parent block of the fourth block is the first block, it represents that the consensus of the fourth block and the first block can be achieved in the entire consensus network, and the first consensus node deletes the sibling blocks of the cached third block and the fourth block, and performs uplink processing on the cached first block and the fourth block.

[0108] Due to network delay, if the first consensus node obtains the consensus achievement result of the fourth block, the number of which is equal to or greater than the quantity threshold, from the consensus network, but does not obtain the consensus achievement result of the first block, the number of which is equal to or greater than the quantity threshold, the first consensus node performs uplink processing on the first block and the fourth block after obtaining the consensus achievement result of the first block, the number of which is equal to or greater than the quantity threshold, from the consensus network.

[0109] Similarly, if the number of consensus achievement results of the fourth block in the consensus network is equal to or greater than the quantity threshold, and it is determined that the parent block of the fourth block is the third block, a consensus of the fourth block and the third block can be achieved in the entire consensus network, and the first consensus node deletes the cached sibling blocks of the first block and the fourth block, and performs uplink processing on the cached third block and the fourth block.

[0110] In other words, when consensus is reached for a block that is cached across the entire consensus network, an uplink process is performed on that block and all parent blocks that can be traced back by that block (i.e., upwards, e.g., blocks whose corresponding block height is smaller than the block height corresponding to that block) to delete the sibling blocks of that block and all sibling blocks of the parent blocks that can be traced back by that block.

[0111] Furthermore, after determining the parent block of the fourth block, completing the consensus process for the fourth block, and caching the fourth block, the first consensus node further updates the block weight of the first block, the block weight of the third block, and the block weight of the fourth block according to the cached fourth block and the parent block of the fourth block.

[0112] If the parent block of the fourth block is the first block, then the update of the block weight of the first block will add 1 to the existing block weight of the first block, if the parent block of the fourth block is the third block, then the update of the block weight of the third block will add 1 to the existing block weight of the third block, and finally the block weight added to the cached fourth block will be equal to 0.

[0113] Please refer to Figure 8, which is a schematic diagram of the block weight setting scenario provided by the present application. As shown in Figure 8, the first consensus node caches block 1, block 2, block 22, block 3, block 33, block 4, block 44 and block 444.

[0114] Note that blocks 2 and 22 belong to sibling blocks, and the block height corresponding to block 2 is the same as the block height corresponding to block 22. Blocks 2 and 22 are blocks that are proposed and consensus-driven in different rounds with the same block height, and consensus is initiated from different consensus nodes.

[0115] Similarly, block 3 and block 33 belong to sibling blocks, the block height corresponding to block 3 is the same as the block height corresponding to block 33, and block 3 and block 33 are blocks proposed and consensus-driven in different rounds with the same block height, and consensus is initiated from different consensus nodes.

[0116] Furthermore, block 4, block 44, and block 444 belong to sibling blocks, and the block height corresponding to block 4, block 44, and block 444 are similar. Blocks 4, 44, and 444 are blocks that propose and reach consensus in different rounds with the same block height, and initiate consensus from different consensus nodes.

[0117] The block that any one of the block arrows points to is the parent block of that one of the blocks; the parent blocks of block 2 and block 22 are both block 1, the parent block of block 3 is block 2, the parent block of block 33 is block 22, and the parent block of block 4, block 44, and block 444 are all block 3.

[0118] Here, the block weight is denoted as β. The child blocks of block 1 include seven child blocks, namely, block 2, block 22, block 3, block 33, block 4, block 44, and block 444, and therefore the block weight of block 1 is 7, the child blocks of block 2 include four child blocks, namely, block 3, block 4, block 44, and block 444, and therefore the block weight of block 2 is 4, the child blocks of block 22 include one child block, namely, block 33, and therefore the block weight of block 22 is 1, the child blocks of block 3 include three child blocks, namely, block 4, block 44, and block 444, and therefore the block weight of block 3 is 3, no child block is connected next to block 33, and therefore the block weight of block 33 is 0, and similarly, no child block is connected next to block 4, block 44, and block 444, and therefore the block weights of blocks 4, 44, and 444 are all 0.

[0119] In this case, if it is necessary to add one block x whose block height is similar to the block heights corresponding to blocks 3 and 33, the block x can have block 2 as its parent block, and therefore the block weight 4 of block 2 is greater than the block weight 1 of block 22.

[0120] Please refer to Fig. 9, which is a schematic diagram of a block processing scenario provided by the present application. As shown in Fig. 9, here, currently, the first consensus node caches block 1, block 2, block 22, block 3, block 33, block 4, block 44, block 444, block 5, block 55 and block 555. Block 2 and block 22 are sibling blocks of each other, block 3 and block 33 are sibling blocks of each other, block 4, block 44 and block 444 are sibling blocks of each other, and block 5, block 55 and block 555 are sibling blocks of each other.

[0121] If the number of consensus achievement results for block 444 obtained by the first consensus node in the consensus network is equal to or greater than the quantity threshold (i.e., 2f+1), the consensus of block 444 is achieved in the entire consensus network, and the consensus of all parent blocks (including blocks 3, 2, and 1) that can be traced back by block 444 in the consensus network can also be achieved. Therefore, the first consensus node deletes all sibling blocks (including blocks 22 and 33) of the parent blocks that can be traced back, deletes sibling blocks (including blocks 4 and 44) ​​of block 444, and further deletes child blocks (including blocks 5 and 55) of the sibling blocks of block 444. Currently, the final consensus result of block 555 in the consensus network has not been determined, so the cached block 555 is reserved, i.e., block 555 is continuously cached.

[0122] In this application, a corresponding block weight is added to each block that is cached, and the block weight added to each block that is cached thereafter accurately positions the parent block of the newly cached block, thereby improving the accuracy of the consensus on the blocks across the network.

[0123] Please refer to Figure 10, which is a schematic flow diagram of the block consensus provided by the present application. As shown in Figure 10, the process is carried out by any one consensus node. 1. A new block height (e.g., block height H, where H is a positive integer) is entered and the consensus round (i.e., round) is 0 (rounds may count from 0 or 1). 2. The consensus node determines whether it is currently the master node; if not, perform step 3; if not, perform step 4. 3. The consensus node adds a timer and waits to receive a proposal message (in which a block requiring consensus is initiated by the current master node). 4. Consensus nodes now produce blocks that require consensus. 5. The consensus node randomly selects neighboring nodes as the consensus node set for this round, which includes the consensus nodes in the consensus subnetwork corresponding to the consensus node, and generates a proposal (including the generated block). 6. The consensus node broadcasts the generated proposal to selected neighboring nodes. 7. The Consensus Node, together with the surrounding nodes, completes the consensus for the currently proposed block. 8. The consensus node determines whether it has achieved consensus on the current consensus block. If NO, perform step 9; if YES, perform step 10. 9. Consensus nodes enter a new consensus round for the current block height and perform step 2 again. 10. The consensus node caches the current block and updates the weight values ​​(i.e., block weights) of the block’s parent blocks (including all parent blocks that can be traced back) in memory. 11. The consensus node starts a timer and broadcasts its approval for the block, i.e., its consensus achievement result for the block, via an additional protocol (a protocol that runs an additional flow, which broadcasts its approval for the block throughout the network). 12. The consensus node determines whether there are other node signatures for the block in the cache, i.e., whether it has obtained the node signatures for the block (i.e., the consensus achievement result) of other consensus nodes in the consensus network. If YES, execute step 13; if NO, it indicates that the consensus for the current block has failed in the entire network, and execute step 1 again. 13. If a consensus node adds all node signatures for a acquired block to the block extension data, the block extension data includes a node signature set associated with the block, and adding all node signatures for the block to the block extension data means adding all node signatures for the block to the node signature set associated with the block. 14. The consensus node determines whether the number of node signatures for the block in the block extension data is 2f+1 or more. If YES, execute step 15. If NO, it indicates that consensus for the current block has failed in the entire network, and execute step 1 again. 15. The consensus node writes the block, i.e., writes the block to the local ledger and performs the uplink process for the block.

[0124] Please refer to Figure 11, which is a flow diagram of the addition method provided by the present application. As shown in Figure 11, the flow is executed by any one of the consensus nodes. 1. A consensus node receives a voting message broadcast by other consensus nodes through an additional protocol, and the voting message is obtained by other consensus nodes performing sequencing on the consensus achievement result of the current block (e.g., the first block). Thus, the consensus node performs de-sequencing on the voting message to obtain an additional message object, which includes the node signature (i.e., the consensus achievement result) of the other consensus nodes for the current block, and the additional message object is assigned a node ID corresponding to the consensus node, and the additional message object represents that the consensus node to which the node ID belongs has achieved consensus on the current block and obtained it. 2. The consensus node determines whether the currently acquired additional message object has been received, and if YES, executes step 3; if NO, executes step 4. 3. The consensus node discards the additional message object it has just acquired. 4. The consensus node verifies the legitimacy of the currently obtained additional message object, for example, whether it was obtained by the corresponding consensus node signing the current block with its private key (verifying it with the public key corresponding to the consensus node). If it is illegal, execute step 3; if it is legal, execute step 5. 5. The consensus node determines whether a block corresponding to the additional message object has been written (e.g., uplinked), and if YES, executes step 3; if NO, executes step 6. 6. The consensus node further determines whether the block corresponding to the additional message object itself has been processed (e.g., whether it has been cached after the consensus has been completed), and if NO, executes step 7; if YES, executes step 8. 7. The consensus node first caches the additional message object, and then uses it after completing consensus on the block corresponding to the additional message object. 8. The consensus node adds the node signature in the additional message object to the block extension data of the corresponding block (i.e., adds it to the node signature set associated with the corresponding block). 9. The consensus node determines whether the number of node signatures for the block in the block extension data is 2f+1 or more. If YES, execute step 10. If NO, it indicates that consensus for the current block has failed in the entire network, and ends processing of the current block. 10. The consensus node writes the block, i.e., writes the block to the local ledger, i.e., performs the uplink process for the block.

[0125] Refer to Figure 12, which is a structural schematic diagram of a data processing device of a consensus network provided by the present application. The data processing device of the consensus network may be a computer program (including program code) executed on a computer device, for example, the data processing device of the consensus network is application software, which executes the corresponding steps of the method provided by the embodiments of the present application. The consensus network includes N consensus nodes, N is a positive integer, the N consensus nodes include a first principal node, and the device is applied to the first consensus node, and the first consensus node is any one of the N consensus nodes except the first principal node. As shown in Figure 12, the data processing device 1 of the consensus network includes: A receiving module 11 for receiving a first block broadcast by a second consensus node in a second consensus sub-network, the second consensus sub-network includes K consensus nodes among N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, K is a positive integer smaller than N, the second consensus node is any one of the N consensus nodes excluding the first consensus node, and the consensus process of the first block is initiated by a first master node; A consensus module 12, which performs a consensus process on a first block in a second consensus sub-network, obtains a consensus result of a first consensus node on the first block, and broadcasts the first block in a first consensus sub-network to which the first consensus node belongs, when the consensus result of the first consensus node on the first block is determined to be consensus achieved, so as to perform a subsequent consensus process on the first block in the first consensus sub-network, where the first consensus sub-network includes M consensus nodes among the N consensus nodes, and M is a positive integer less than N; The consensus network further includes an acquisition module 13 for broadcasting a consensus achievement result for a first block of a first consensus node in the consensus network to acquire a first number of consensus achievement results for the first block in the consensus network, and performing uplink processing for the first block based on the first number.

[0126] In a possible implementation, the first remaining consensus node among the K consensus nodes is the K-1 consensus nodes connected to the second consensus node selected by the second consensus node from the N consensus nodes, and the first remaining consensus node is the consensus node among the K consensus nodes excluding the second consensus node; the second remaining consensus node among the M consensus nodes is the M-1 consensus nodes connected to the first consensus node selected by the first consensus node from the N consensus nodes, and the second remaining consensus node is the consensus node among the M consensus nodes excluding the first consensus node; If the second consensus node is the first main node, the first block broadcast by the second consensus node was generated by the second consensus node; if the second consensus node is not the first main node, the first block broadcast by the second consensus node was obtained by a third consensus node among the N consensus nodes broadcasting it to the second consensus node, and the third consensus node is any one of the N consensus nodes excluding the first consensus node and the second consensus node.

[0127] In a possible implementation, the consensus achievement result for any one block of any one consensus node in the consensus network is a node signature for any one block of any one consensus node, and a first block has an associated node signature set, the node signature set including a node signature for the first block of the first consensus node; The acquisition module 13 acquires a first number of consensus achievement results of the first block in the consensus network, and performs uplink processing on the first block according to the first number. In a process of performing a consensus process on a first block in the consensus network, a step of receiving a node signature for the first block broadcast by a third remaining consensus node and adding the received node signature to a node signature set, where the third remaining consensus node is a consensus node among the N consensus nodes excluding the first consensus node; obtaining a first number of node signatures in the node signature set, and performing uplink processing on the first block if the first number is greater than or equal to a quantity threshold.

[0128] In a possible implementation, if the second consensus node is the first principal node, the K consensus nodes include the second principal node, and the second principal node is a next principal node in the N consensus nodes to replace the first principal node; After the second principal node determines that the consensus result of the second consensus node for the first block is a consensus achievement result, it initiates a consensus process for the second block in the consensus network, and the block height corresponding to the second block is the next block height of the block height corresponding to the first block.

[0129] In a possible implementation, the block height corresponding to the first block is a first block height, and the above device 1 further comprises: A third block to be a consensus target is obtained, the third block is a block that requires consensus initiated by a third main node if the first block is not obtained within a predetermined time period, the block height corresponding to the third block is the first block height, and the third main node is a consensus node for replacing the first main node as the next main node among the N consensus nodes; A consensus process is performed on the third block, When the consensus process for the third block is completed, the third block is cached.

[0130] In a possible implementation, the above device 1 further comprises: When the consensus process for the first block is completed, cache the first block; The above-mentioned device 1 further comprises: Obtain a second number of consensus achievement results of the third block in the consensus network, and if the second number is greater than or equal to a quantity threshold, perform an uplink process on the third block and delete the cached first block.

[0131] In a possible implementation, the manner in which the acquisition module 13 performs uplink processing on the first block based on the first number is: If the first number is greater than or equal to the quantity threshold, performing uplink processing on the first block and deleting the cached third block.

[0132] In a possible implementation, the above device 1 further comprises: determining a block weight for the first block based on a number of child blocks of the first block that are cached; determining a block weight for the third block based on a number of child blocks of the third block that are cached; A sibling block of any one block is a block whose corresponding block height is similar to the block height of any one block, and the first block and the third block are sibling blocks of each other; The block weight of the first block and the block weight of the third block are for determining the parent block of the fourth block, and the block height corresponding to the fourth block is the second block height, which is the next block height after the first block height.

[0133] In a possible implementation, the above device 1 further comprises: Obtain the fourth block to be consensused, If the block weight of the first block is greater than the block weight of the third block, the first block is made the parent block of the fourth block, and a consensus process is performed on the fourth block. If the block weight of the first block is smaller than the block weight of the third block, the third block is set as the parent block of the fourth block and a consensus process is performed on the fourth block.

[0134] In a possible implementation, when the number of consensus achievement results of the fourth block in the consensus network is equal to or greater than the quantity threshold and the parent block of the fourth block is determined to be the first block, delete the cached third block and sibling blocks of the fourth block, and perform an uplink process on the first block and the fourth block; When the number of consensus achievement results of the fourth block in the consensus network is equal to or greater than the quantity threshold, and it is determined that the parent block of the fourth block is the third block, delete the cached sibling blocks of the first block and the fourth block, and perform an uplink process on the third block and the fourth block; A sibling block of any one block is a block whose block height is similar to the block height corresponding to any one block, and the first block and the third block are sibling blocks of each other.

[0135] In a possible implementation, the above device 1 further comprises: When the consensus process for the fourth block is completed, the fourth block is cached, The block weight of the first block, the block weight of the third block, and the block weight of the fourth block are updated based on the cached fourth block and the parent block of the fourth block.

[0136] According to one embodiment of the present application, the steps of the data processing method of the consensus network in Fig. 3 may be performed by each module in the data processing device 1 of the consensus network in Fig. 12. For example, S101 in Fig. 3 is performed by the receiving module 11 in Fig. 12, S102 in Fig. 3 is performed by the consensus module 12 in Fig. 12, and S103 in Fig. 3 is performed by the acquiring module 13 in Fig. 12.

[0137] In this application, the consensus network includes N consensus nodes, a first principal node in the consensus network initiates a consensus process of a first block, and in the consensus process of the first block, the first consensus node receives the first block broadcast by the second consensus node in the second consensus sub-network. The second consensus sub-network includes K consensus nodes among the N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, and the second consensus node is any one of the N consensus nodes except the first consensus node, where K is a positive integer smaller than N, that is, the second consensus sub-network is a smaller network than the consensus network. A consensus process is performed on the first block in the second consensus sub-network to obtain a consensus result of the first consensus node on the first block, and when it is determined that the consensus result of the first consensus node on the first block is a consensus achievement result, the first block is broadcast in the first consensus sub-network to which the first consensus node belongs, so as to perform a consensus process on the first block in the first consensus sub-network subsequently. Furthermore, the first consensus sub-network includes M consensus nodes among the N consensus nodes, where M is a positive integer smaller than N, that is, the first consensus sub-network is also a smaller network than the consensus network. This converts the consensus in the large consensus network into a consensus in several small consensus sub-networks. A consensus achievement result for a first block of a first consensus node in the consensus network is broadcast to obtain a first number of consensus achievement results for the first block in the consensus network, and uplink processing is performed for the first block based on the first number.In this way, according to the method proposed in the present application, each consensus node can broadcast blocks within a small network of the consensus network (e.g., the first consensus sub-network and the second consensus sub-network), and further perform consensus processing on blocks even within the small network, thereby reducing the amount of communication when performing consensus on blocks, and improving the consensus efficiency and performance of the consensus network for blocks.

[0138] According to one embodiment of the present application, each module in the data processing device 1 of the consensus network of FIG. 12 is individually or entirely configured as one or several units, or some (several) of the modules are further divided into several smaller subunits by function to realize the same operation, and the realization of the technical effect of the embodiment of the present application is not affected. The above-mentioned modules are divided according to logical functions, and in actual application, the function of one module is realized by several units, or the function of several modules is realized by one unit. In other embodiments of the present application, the data processing device 1 of the consensus network may include other units, and in actual application, these functions may be realized by other units cooperating, or by several units cooperating.

[0139] According to one embodiment of the present application, a general-purpose computing device, such as a computer, including a processing element and a storage element, such as a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), etc., executes a computer program (including program code) capable of executing each step of the corresponding method of Fig. 3, thereby configuring the consensus network data processing device 1 of Fig. 12 to realize the consensus network data processing method of the embodiment of the present application. The above computer program is, for example, written on a computer-readable recording medium, and is loaded into and executed by the above computing device through the computer-readable recording medium.

[0140] Please refer to FIG. 13, which is a structural schematic diagram of a computer device provided by this application. As shown in FIG. 13, the computer device 1000 includes a processor 1001, a network interface 1004 and a memory 1005, and the computer device 1000 further includes a user interface 1003 and at least one communication bus 1002. The communication bus 1002 realizes the connection communication between these components. The user interface 1003 includes a display and a keyboard, and preferably, the user interface 1003 further includes a standard wired interface and a wireless interface. The network interface 1004 includes a standard wired interface and a wireless interface (e.g., a WI-FI interface). The memory 1005 can be a high-speed RAM memory, or a non-volatile memory. The memory 1005 may be at least one storage device remote from the processor 1001. As shown in Fig. 13, the memory 1005 as a computer storage medium includes an operating system, a network communication module, a user interface module, and a device control application program.

[0141] In the computer device 1000 of FIG. 13, the network interface 1004 can provide network communication functions, the user interface 1003 is mainly an interface for providing input to a user, and the processor 1001 calls the device control application program stored in the memory 1005 to realize the method provided by the above embodiment, for example: receiving a first block broadcast by a second consensus node in a second consensus sub-network, the second consensus sub-network including K consensus nodes among N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, K is a positive integer smaller than N, the second consensus node is any one of the N consensus nodes excluding the first consensus node, and the consensus process of the first block is initiated by the first principal node; A step of performing a consensus process on the first block in the second consensus sub-network to obtain a consensus result of the first consensus node on the first block, and when it is determined that the consensus result of the first consensus node on the first block is a consensus achievement result, broadcasting the first block in the first consensus sub-network to which the first consensus node belongs, so as to perform a consensus process on the first block in the first consensus sub-network subsequently, where the first consensus sub-network includes M consensus nodes among the N consensus nodes, and M is a positive integer smaller than N; The method includes the steps of broadcasting a consensus achievement result for the first block of a first consensus node in the consensus network, obtaining a first number of consensus achievement results for the first block in the consensus network, and performing uplink processing for the first block based on the first number.

[0142] Here, the computer device 1000 described in the embodiment of the present application may execute the above-mentioned consensus network data processing method in the embodiment corresponding to Fig. 3 above, or may execute the above-mentioned consensus network data processing device 1 in the embodiment corresponding to Fig. 12 above, and here, no detailed description is given. In addition, no detailed description is given about the beneficial effects of the same method.

[0143] In addition, the present application further provides a computer-readable storage medium, which stores a computer program executed by the above consensus network data processing device 1, the computer program includes program instructions, and the processor executes the program instructions to execute the consensus network data processing method described in the embodiment corresponding to Figure 3 above, so no further description is given here. In addition, no further description is given about the beneficial effects of the same method. For technical details not disclosed in the embodiment of the computer storage medium of the present application, please refer to the description of the method embodiment of the present application.

[0144] For example, the above program instructions may be disposed and executed on one computer device, or disposed and executed on multiple computer devices at one location, or disposed and executed on multiple computer devices distributed at multiple locations and interconnected via a communication network, and the multiple computer devices distributed at multiple locations and interconnected via a communication network may constitute a blockchain network.

[0145] The above-mentioned computer-readable storage medium is the data processing device of the consensus network provided by any one of the above-mentioned embodiments, or the internal storage unit of the above-mentioned computer device, such as the hard disk or memory of the computer device. The above-mentioned computer-readable storage medium can be an external storage device of the computer device, such as an external hard disk, smart media, etc., arranged in the computer device. Examples of such a computer-readable storage medium include a standard memory card (SMC), a secure digital (SD) card, and a flash card. Furthermore, the computer-readable storage medium includes an internal storage unit of the computer device, as well as an external storage device. The computer-readable storage medium stores the computer program and other programs and data required by the computer device. The computer-readable storage medium further temporarily stores data that has been output or is to be output.

[0146] The present application provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, thereby causing the computer device to execute the above-mentioned consensus network data processing method described in the embodiment corresponding to FIG. 3, and no further description is made herein. In addition, no further description is made of the beneficial effects of the same method. For technical details not disclosed in the embodiment of the computer-readable storage medium related to the present application, please refer to the description of the method embodiment of the present application.

[0147] The terms "first", "second", etc. in the description, claims and drawings of the embodiments of this application are not intended to describe a particular order but to distinguish different objects. Also, the term "comprises" and variations thereof are intended to include a non-exclusive inclusion. For example, a process, method, apparatus, product or device that includes a series of steps or units is not limited to the listed steps or modules, and preferably further includes steps or modules that are not listed, or preferably further includes other steps or units inherent to the process, method, apparatus, product or device.

[0148] As can be appreciated by those skilled in the art, each exemplary unit and algorithm step described in conjunction with the embodiments disclosed herein can be realized by electronic hardware, computer software, or a combination of both, and in the above description, each exemplary structure and step is generally described according to its function in order to clearly explain the interchangeability between hardware and software. Whether these functions are implemented in the form of hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can realize the described functions using different methods for each specific application, and such realization does not go beyond the scope of this application.

[0149] The method and related apparatus provided by the embodiments of the present application are described with reference to the method flowcharts and / or structural diagrams provided by the embodiments of the present application, and in particular, each flow and / or block of the method flowcharts and / or structural diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams are realized by computer program instructions. These computer program instructions are provided to a processor of a general purpose computer, a special purpose computer, an embedded processor, or other programmable data processing device to generate a machine, whereby the instructions executed by the processor of the computer or other programmable data processing device generate an apparatus for implementing the functions specified by one or more flows of the flowcharts and / or one or more blocks of the structural diagrams. These computer program instructions are stored in a computer readable memory capable of directing the computer or other programmable data processing device to operate in a specific manner, whereby the instructions stored in the computer readable memory generate a product including an instruction apparatus, and the instruction apparatus realizes the functions specified by one or more flows of the flowcharts and / or one or more blocks of the structural diagrams. These computer program instructions, when loaded into a computer or other programmable data processing device, cause the computer or other programmable device to perform a series of operational steps to generate a computer-implemented process, and the instructions executed on the computer or other programmable device provide steps for implementing the functions specified by one or more flows of the flowcharts and / or one or more blocks of the structural schematics.

[0150] The above are merely preferred embodiments of the present application, and cannot limit the scope of the claims of the present application. Therefore, any equivalent modifications according to the claims of the present application belong to the scope of the present application.

Claims

1. A data processing method for a consensus network, executed by a first consensus node, the consensus network includes N consensus nodes, N is a positive integer, the N consensus nodes include a first principal node, and the first consensus node is any one of the N consensus nodes excluding the first principal node, the method comprising: receiving a first block broadcast by a second consensus node in a second consensus sub-network, the second consensus sub-network including K consensus nodes among the N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, K is a positive integer smaller than N, the second consensus node is any one of the N consensus nodes excluding the first consensus node, and the consensus process of the first block is initiated by the first principal node; performing a consensus process on the first block in the second consensus sub-network to obtain a consensus result on the first block of the first consensus node; When the first consensus node determines that the consensus result for the first block is a consensus achievement result, the first consensus node broadcasts the first block in a first consensus sub-network to which the first consensus node belongs, so that the first consensus sub-network continues to perform a consensus process for the first block, where the first consensus sub-network includes M consensus nodes among the N consensus nodes, and M is a positive integer smaller than N; broadcasting a consensus achievement result for the first block of the first consensus node in the consensus network, obtaining a first number of consensus achievement results for the first block in the consensus network, and performing uplink processing for the first block based on the first number.

2. The first remaining consensus node among the K consensus nodes is K-1 consensus nodes connected to the second consensus node selected by the second consensus node from the N consensus nodes, and the first remaining consensus node is a consensus node among the K consensus nodes excluding the second consensus node; the second remaining consensus node among the M consensus nodes is M-1 consensus nodes connected to the first consensus node selected by the first consensus node from the N consensus nodes, and the second remaining consensus node is a consensus node among the M consensus nodes excluding the first consensus node; 2. The method of claim 1, wherein if the second consensus node is the first main node, the first block broadcast by the second consensus node is generated by the second consensus node, and if the second consensus node is not the first main node, the first block broadcast by the second consensus node is obtained by a third consensus node among the N consensus nodes broadcasting to the second consensus node, and the third consensus node is any one of the N consensus nodes excluding the first consensus node and the second consensus node.

3. A consensus achievement result of any one of the consensus nodes in the consensus network for any one of the blocks is a node signature of the any one of the consensus nodes for the any one of the blocks, and the first block has an associated node signature set, the node signature set including a node signature of the first consensus node for the first block; The step of obtaining a first number of consensus achievement results of the first block in the consensus network and performing uplink processing on the first block based on the first number includes: In the process of performing a consensus process on the first block in the consensus network, receiving a node signature for the first block broadcast by a third remaining consensus node and adding the received node signature to the node signature set, the third remaining consensus node being a consensus node among the N consensus nodes excluding the first consensus node; 2. The method of claim 1 , further comprising: obtaining the first number of node signatures in the node signature set; and performing uplink processing on the first block if the first number is equal to or greater than a quantity threshold.

4. The second consensus node is the first principal node, the K consensus nodes include a second principal node, and the second principal node is a next principal node in the N consensus nodes to replace the first principal node; 2. The method of claim 1, wherein the second principal node initiates a consensus process for a second block in the consensus network after determining that the consensus result of the second consensus node for the first block is a consensus achievement result, and a block height corresponding to the second block is a block height next to a block height corresponding to the first block.

5. a block height corresponding to the first block is a first block height, and the method further comprises: A step of acquiring a third block to be a consensus target, the third block being a block requiring consensus initiated when a third master node has not acquired the first block within a predetermined time period, a block height corresponding to the third block being the first block height, and the third master node being a consensus node for performing master node replacement after the first master node among the N consensus nodes; performing a consensus process on the third block; 2. The method of claim 1, further comprising: caching the third block when the consensus process for the third block is completed.

6. The method comprises: When the consensus process for the first block is completed, the method further includes caching the first block; The method comprises:

6. The method of claim 5, further comprising: obtaining a second number of consensus achievement results of the third block in the consensus network; and, if the second number is equal to or greater than a quantity threshold, performing uplink processing on the third block and deleting the cached first block.

7. The step of performing uplink processing on the first block based on the first number includes:

7. The method of claim 6, further comprising the step of: performing uplink processing on the first block and deleting the cached third block if the first number is greater than or equal to the quantity threshold.

8. The method comprises: determining a block weight for the first block based on a number of child blocks of the first block that are cached; determining a block weight for the third block based on a number of child blocks of the third block that are cached; 7. The method of claim 6, wherein a block weight of the first block and a block weight of the third block determine a parent block of a fourth block, and a block height corresponding to the fourth block is a second block height, and the second block height is the next block height of the first block height.

9. The method comprises: obtaining the fourth block to be consensused; If the block weight of the first block is greater than the block weight of the third block, performing a consensus process on the fourth block with the first block as a parent block of the fourth block; 9. The method of claim 8, further comprising: if a block weight of the first block is less than a block weight of the third block, performing a consensus process on the fourth block with the third block as a parent block of the fourth block.

10. The method comprises: When the number of consensus achievement results of the fourth block in the consensus network is equal to or greater than a quantity threshold and the parent block of the fourth block is determined to be the first block, deleting the cached sibling blocks of the third block and the fourth block, and performing uplink processing on the first block and the fourth block; When the number of consensus achievement results of the fourth block in the consensus network is equal to or greater than the quantity threshold and the parent block of the fourth block is determined to be the third block, deleting the cached sibling blocks of the first block and the fourth block, and performing uplink processing on the third block and the fourth block; 10. The method of claim 9, wherein a sibling block of any one of the blocks is a block having a block height similar to a block height corresponding to the any one of the blocks, and the first block and the third block are sibling blocks of each other.

11. The method comprises: When the consensus process for the fourth block is completed, caching the fourth block; 10. The method of claim 9, further comprising: updating a block weight of the first block, a block weight of the third block, and a block weight of the fourth block based on the fourth block and a parent block of the fourth block being cached.

12. A data processing device for a consensus network, the consensus network includes N consensus nodes, N is a positive integer, the N consensus nodes include a first principal node, the device is applied to a first consensus node, the first consensus node is any one of the N consensus nodes excluding the first principal node, and the device comprises: A receiving module for receiving a first block broadcast by a second consensus node in a second consensus sub-network, the second consensus sub-network including K consensus nodes among the N consensus nodes, the first consensus node and the second consensus node both belong to the second consensus sub-network, K is a positive integer smaller than N, the second consensus node is any one of the N consensus nodes excluding the first consensus node, and the consensus process of the first block is initiated by the first main node; A consensus module that performs a consensus process on the first block in the second consensus sub-network to obtain a consensus result of the first consensus node for the first block, and broadcasts the first block in a first consensus sub-network to which the first consensus node belongs when the consensus result of the first consensus node for the first block is determined to be a consensus achievement result, so as to perform a subsequent consensus process on the first block in the first consensus sub-network, where the first consensus sub-network includes M consensus nodes among the N consensus nodes, and M is a positive integer less than N; An apparatus comprising: an acquisition module that broadcasts the consensus achievement result for the first block of the first consensus node in the consensus network, acquires a first number of consensus achievement results for the first block in the consensus network, and performs uplink processing on the first block based on the first number.

13. A computer program which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.

14. A computing device comprising a memory and a processor, the memory storing a computer program, the computer program, when executed by the processor, causing the processor to perform the steps of the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Data processing method and device of block chain network, computer equipment and medium

    CN113254272A

  • Blockchain network and establishment method therefor

    JP2019184908A

  • Blockchain data processing method, management side, client side, conversion device and medium

    JP2021512569A

  • Consensus forming method and consensus forming program of distributed ledger network system

    JP2022086931A

  • Temporary consensus subnetwork in a distributed network for payment processing

    US20160224949A1