Consensus methods, devices, computer-readable media, and electronic devices for blockchain
By grouping and processing transaction information in the blockchain network to generate temporary blocks and proposal blocks, the problem of slow block generation rate in the blockchain system is solved, and consensus performance is improved.
Patent Information
- Application Number
- CN202210885543.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-26
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-07-26
AI Technical Summary
In existing blockchain systems, the serial packaging mechanism results in a slow block generation rate, which affects consensus performance.
By grouping transaction information in the local transaction pool according to the number of consensus nodes in the blockchain network, generating temporary blocks, and generating proposal blocks after obtaining information from preceding blocks, transaction information is avoided from being packaged repeatedly.
It increases the block generation rate of the blockchain and improves the consensus performance of the blockchain system.
Smart Images

Figure CN117527243B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer and communication technology, and more specifically, to a consensus method, apparatus, computer-readable medium, and electronic device for blockchain. Background Technology
[0002] In blockchain technology, the consensus mechanism is fundamental to ensuring the normal operation of the blockchain system. Consensus means reaching an agreement. Each node in a blockchain system stores its own copy of the distributed ledger (i.e., the blockchain itself). The consensus process is the process of ensuring consistency between the distributed ledgers of all nodes. In a blockchain system, all consensus nodes are equal and can package any transaction information into the block to be agreed upon. To prevent duplicate packaging of certain transaction information, the packaging process proposed in related technologies typically involves packaging the next block only after the previous block has been determined, thus filtering out transaction information already included in the block and avoiding the packaging of duplicate transactions. However, this serial packaging mechanism results in a slow block generation rate, affecting the consensus performance of the blockchain system. Summary of the Invention
[0003] The embodiments of this application provide a consensus method, apparatus, computer-readable medium, and electronic device for blockchain, which can avoid duplicate packaging of transaction information by grouping transactions and improve the block generation rate of the blockchain, thereby improving the consensus performance of the blockchain system.
[0004] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0005] According to one aspect of the embodiments of this application, a consensus method for a blockchain is provided, comprising: grouping transaction information in a local transaction pool according to the number of consensus nodes in the blockchain network to obtain transaction groups corresponding to each consensus node in the blockchain network; generating a temporary block according to the transaction group corresponding to the current consensus node; if information of the preceding block of the temporary block is obtained, generating a proposal block according to the information of the preceding block and the temporary block; and broadcasting the proposal block to the blockchain network for consensus processing.
[0006] According to one aspect of the embodiments of this application, a consensus device for a blockchain is provided, comprising: a grouping unit configured to group transaction information in a local transaction pool according to the number of consensus nodes in the blockchain network to obtain transaction groups corresponding to each consensus node in the blockchain network; a first generation unit configured to generate a temporary block according to the transaction group corresponding to the current consensus node; a second generation unit configured to generate a proposal block according to the information of the preceding block and the temporary block if information of the preceding block is obtained; and a consensus unit configured to broadcast the proposal block to the blockchain network for consensus processing.
[0007] In some embodiments of this application, based on the foregoing scheme, the grouping unit is configured to: calculate the transaction hash corresponding to the transaction information in the local transaction pool; perform a modulo operation on the transaction hash and the number of consensus nodes, and group the transaction information according to the result of the modulo operation.
[0008] In some embodiments of this application, based on the foregoing scheme, the first generation unit is configured to: generate a temporary block according to the transaction group corresponding to the current consensus node before the current consensus node becomes a proposal node; the second generation unit is configured to: determine the information of the preceding block obtained by the current consensus node when the current consensus node receives the preceding block sent by other consensus nodes.
[0009] In some embodiments of this application, based on the foregoing scheme, the second generation unit is configured as follows: if the current consensus node produces multiple blocks when acting as a proposal node, then after the current consensus node generates a proposal block, the generated proposal block is used as the preceding block, and the information of the preceding block to which the temporary block is obtained is determined.
[0010] In some embodiments of this application, based on the foregoing scheme, the consensus device of the blockchain further includes: a detection unit configured to detect the number of transaction information contained in the transaction groups corresponding to other consensus nodes in the local transaction pool; the first generation unit is further configured to: if the number of transaction information contained in the transaction group corresponding to a specified consensus node exceeds a set threshold, then package the transaction information contained in the transaction group corresponding to the specified consensus node to generate the temporary block.
[0011] In some embodiments of this application, based on the foregoing scheme, the process by which the first generation unit packages the transaction information contained in the transaction group corresponding to the designated consensus node includes: selecting transaction information from the transaction group corresponding to the designated consensus node and packaging it into at least one temporary block, until the number of transaction information contained in the transaction group corresponding to the designated consensus node is less than the set threshold.
[0012] In some embodiments of this application, based on the foregoing scheme, the process by which the first generation unit packages the transaction information contained in the transaction group corresponding to the designated consensus node includes: selecting transaction information from the transaction group corresponding to the designated consensus node and packaging it into at least one temporary block, until the number of transaction information contained in the transaction group corresponding to the designated consensus node is 0.
[0013] In some embodiments of this application, based on the foregoing scheme, the consensus device of the blockchain further includes: a detection unit configured to detect whether the proposal blocks broadcast by other consensus nodes contain transaction information in the transaction group corresponding to the current consensus node; and a clearing unit configured to clear all temporary blocks generated by the current consensus node if the proposal blocks broadcast by other consensus nodes contain transaction information in the transaction group corresponding to the current consensus node.
[0014] In some embodiments of this application, based on the foregoing scheme, the grouping unit is further configured to: after clearing all temporary blocks generated by the current consensus node, regroup the transaction information in the local transaction pool of the current consensus node, so that the first generation unit generates the temporary block according to the transaction group corresponding to the current consensus node.
[0015] In some embodiments of this application, based on the foregoing scheme, the first generation unit is configured to: select a corresponding number of transaction information from the transaction group corresponding to the current consensus node and package them according to the number of transaction information contained in each block to generate the temporary block; wherein, the block height field, block hash field and previous block hash field in the temporary block are null values.
[0016] In some embodiments of this application, based on the foregoing scheme, the second generation unit is configured to: determine the hash value of the preceding block, the block height of the next block, and the block hash value of the next block according to the information of the preceding block; update the preceding block hash field in the temporary block according to the preceding block hash value, update the block height field in the temporary block according to the block height of the next block, and update the block hash field in the temporary block according to the block hash value of the next block, so as to generate the proposal block.
[0017] In some embodiments of this application, based on the foregoing scheme, the first generation unit is further configured to: after generating the temporary block and before generating the proposal block, perform duplicate verification processing on the transaction information contained in the temporary block according to the transaction information recorded in the blockchain ledger, and perform serialization processing on the list of transaction information in the temporary block.
[0018] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the blockchain consensus method as described in the above embodiments.
[0019] According to one aspect of the embodiments of this application, an electronic device is provided, including: one or more processors; and a storage device for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the blockchain consensus method as described in the above embodiments.
[0020] According to one aspect of the embodiments of this application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of an electronic device reads from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the blockchain consensus method provided in the various alternative embodiments described above.
[0021] In some embodiments of this application, the technical solutions provided involve grouping transaction information in the local transaction pool according to the number of consensus nodes in the blockchain network to obtain transaction groups corresponding to each consensus node. Then, a temporary block is generated based on the transaction group corresponding to the current consensus node. After obtaining the information of the preceding block of the temporary block, a proposal block is generated based on the information of the preceding block and the temporary block. This allows the transaction information in the local transaction pool of the consensus node to be grouped in advance, and each consensus node can package the transaction information in advance according to the grouping results. This improves the block production rate of the blockchain while avoiding duplicate packaging of transaction information through grouping, which is beneficial to improving the consensus performance of the blockchain system.
[0022] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0023] Figure 1 A schematic diagram of a blockchain network structure is shown.
[0024] Figure 2 This diagram illustrates the connection relationships between blocks in a blockchain. Figure 3 A flowchart of a consensus algorithm is shown; Figure 4 This diagram illustrates a processing flow of transaction information after it enters the blockchain network. Figure 5 This diagram illustrates a processing flow of transaction information after it enters the blockchain network. Figure 6 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown; Figure 7 A flowchart illustrating a blockchain consensus method according to an embodiment of this application is shown; Figure 8 A flowchart illustrating a blockchain consensus method according to an embodiment of this application is shown; Figure 9 A block diagram of a blockchain consensus apparatus according to an embodiment of this application is shown; Figure 10 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0025] Exemplary embodiments will now be described in a more comprehensive manner with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as limited to these examples; rather, these embodiments are provided so that this application will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art.
[0026] Furthermore, the features, structures, or characteristics described in this application can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to provide a full understanding of the embodiments of this application. However, those skilled in the art will recognize that when implementing the technical solutions of this application, not all the detailed features in the embodiments may be used, one or more specific details may be omitted, or other methods, elements, devices, steps, etc., may be employed.
[0027] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0028] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0029] It should be noted that "multiple" in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0030] The technical solutions in this application relate to blockchain technology. Specifically, blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks (i.e., blocks) linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and to generate the next block.
[0031] A blockchain is maintained collaboratively by nodes within a blockchain network. For example, in... Figure 1 The illustrated blockchain network may include multiple nodes 101, which can be various clients forming the blockchain network. Each node 101, in its normal operation, receives input information and maintains shared data within the blockchain network based on this information. To ensure interoperability within the blockchain network, information connections can exist between each node, allowing for information transmission. For example, when any node in the blockchain network receives input information, other nodes in the network obtain this input information according to a consensus algorithm and store it as shared data, ensuring data consistency across all nodes in the blockchain network.
[0032] Each node in a blockchain network has a corresponding node identifier, and each node can store the node identifiers of other nodes. This allows for the broadcast of generated blocks to other nodes in the blockchain network based on their node identifiers. Each node can maintain a list of node identifiers, storing the node name and its corresponding node identifier in this list. The node identifier can be an IP (Internet Protocol) address or any other information that can be used to identify the node.
[0033] Each node in a blockchain network stores the same blockchain. A blockchain consists of multiple blocks; see [link to blockchain documentation]. Figure 2 As shown, a blockchain consists of multiple blocks linked together in ascending order of creation timestamps. Each block includes a block header and a block body. The block header stores the hash of the preceding block and the Merkle root of the current block. The block body contains the complete transaction data of the block, organized in the form of a Merkle tree. The blockchain structure demonstrates that the data stored in each block is related to the data stored in its parent block (i.e., the preceding block), ensuring the security of input information within the blocks.
[0034] In a blockchain network, each node can be a server or a terminal device. A server can be a standalone physical server, a server cluster or distributed system composed 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 communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Terminal devices can be smartphones, tablets, laptops, desktop computers, smart speakers, smartwatches, smart home devices, in-vehicle terminals, aircraft, etc., but are not limited to these. Nodes can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions on this.
[0035] Another crucial technology in blockchain is the consensus mechanism, which is fundamental to ensuring the normal operation of a blockchain system. Consensus means reaching an agreement. Each node in a blockchain system stores its own copy of the distributed ledger (i.e., the blockchain itself). The consensus process is the process of ensuring consistency between these distributed ledgers across all nodes. Some or all nodes in a blockchain system can participate in the consensus process. This process is typically based on a consensus algorithm, with participating nodes executing the corresponding steps of the consensus process by running the algorithm. PoS (Proof of Work), Proof of Stake (Proof of Stake), Delegated Proof of Stake (DPoS), Byzantine Fault Tolerance (BFT), Practical Byzantine Fault Tolerance (PBFT), and Tendermint BFT (TBFT) are among the options available.
[0036] Typically, at a certain block height in a blockchain, one or more rounds of consensus processes are required to reach agreement among the participating node devices. These participating nodes are called consensus nodes, and they ensure data consistency across the entire blockchain system through a specific consensus algorithm. The consensus nodes in a blockchain include proposal nodes and verification nodes. Proposal nodes are responsible for proposing blocks, while verification nodes verify the proposed blocks according to the corresponding consensus algorithm to ensure their correctness and validity.
[0037] Block height is used to represent the number of blocks connected to the blockchain. Block height is a marker of a block and can be used to indicate the position of a block in the blockchain. For example, the block height of the genesis block in the blockchain is 0 by default, the block height of the first block after the genesis block is 1 (this first block can be simply referred to as block 1), the block height of the second block after the genesis block is 2 (this second block can be simply referred to as block 2), and so on.
[0038] For example, if the current block height of a blockchain is 300 (referred to as block 300), this means that 300 blocks have been stacked on top of the genesis block, resulting in 301 blocks on the blockchain from the genesis block to block 300. The consensus process at a specific block height refers to the process of reaching consensus on the blocks to be added to the blockchain when the blockchain is at that height. If the consensus is successful, the block is added to the blockchain, and the block height is incremented by 1. For instance, the consensus process at block height 10 refers to the process of reaching consensus on the blocks to be added to the blockchain when the blockchain is at block height 10. If the consensus is successful, the block is added to the blockchain, increasing the block height from 10 to 11.
[0039] Generally speaking, such as Figure 3 As shown, a consensus process can be divided into three phases in sequence: the proposal phase, the prevote phase, and the precommit phase. The participating nodes in the same consensus process include two types: proposal nodes and non-proposal nodes. A proposal node is an node elected by the participating nodes. This node is responsible for both generating the block to be agreed upon in the proposal phase and broadcasting it to the other participating nodes for consensus processing; it is also responsible for processing the block itself. Non-proposal nodes, on the other hand, only process the block to be agreed upon.
[0040] Consensus processing includes pre-voting and pre-committing. Pre-voting occurs during the pre-voting phase, while pre-committing occurs during the pre-committing phase. Pre-voting refers to the process of agreeing to pre-vote on a block to be agreed upon. If a pre-vote is agreed upon, it means agreeing to add that block to the blockchain. Pre-committing refers to the process of agreeing to pre-commit a block to be agreed upon. If a pre-commit is agreed upon, it means confirming agreement to add that block to the blockchain. In multiple rounds of consensus at the same block height, the participating node devices may change in different rounds. That is, the node devices participating in each round may change, the proposing nodes may change, and the blocks awaiting consensus may also change.
[0041] The following combination Figure 4 and Figure 5 The processing flow of transaction information after it enters the blockchain network is explained: like Figure 4 As shown, transaction information generated by the client may be sent to any consensus node. The consensus node receiving the transaction information will broadcast it to other consensus nodes, and each node will place it in its local transaction pool. Once a proposal block initiated by a proposing node successfully reaches consensus and is submitted to the blockchain, each consensus node will remove the transaction information from its local transaction pool. The proposing node will then retrieve the transaction information from its local pool, repackage it into a new block, and perform consensus processing on the blockchain network.
[0042] After receiving transaction information, a consensus node broadcasts it to other consensus nodes in the blockchain network for two reasons. First, if the receiving node malfunctions and fails to include the transaction in a block, other nodes can still process it. Second, it allows other nodes to prioritize received transactions, ensuring that earlier received transactions are processed as quickly as possible. However, this can lead to different consensus nodes collecting the same transaction information. Therefore, when a proposing node packages a new block, it must wait for previous blocks to be finalized to prevent different nodes from repeatedly packaging the same transaction information.
[0043] Specifically, for example in Figure 5 In the processing diagram shown, transaction information is submitted to the transaction pool of the consensus node after creation. After receiving the transaction information, the consensus node will verify the validity of the transaction, such as whether the transaction information is duplicated and whether the signature of the transaction information is valid. If the verification is successful, the verified transaction information will be put into the local transaction pool, while the transaction information that fails the verification (i.e. invalid transaction information) will be rejected and put into the transaction pool.
[0044] Simultaneously, the consensus node receiving the transaction information broadcasts it to other consensus nodes, ensuring that each node's local transaction pool contains the same transaction information. During the consensus process, the proposing node retrieves unpackaged transactions from its local transaction pool, packages them into a block, generates a newly created block, and then broadcasts the newly created block to the blockchain network for consensus processing. If the block consensus is successful and it is committed to the blockchain, the transaction information contained in the successfully consensused block (such as...) can be... Figure 5 The transaction 501 shown is removed from the local transaction pool.
[0045] pass Figure 4 and Figure 5As explained, since all consensus nodes in a blockchain system are peers and can package any transaction information into the block awaiting consensus, to ensure that certain transaction information is not packaged repeatedly, the next block is usually packaged only after the previous block is determined. This filters out transaction information already packaged into the block and avoids packaging duplicate transaction information. However, this serial packaging mechanism results in a slow block generation rate, affecting the consensus performance of the blockchain system.
[0046] Based on the above-mentioned technical problems, the technical solution of this application proposes a new consensus scheme for blockchain, specifically as follows: Figure 6 As shown, assume that the blockchain network contains 4 consensus nodes (i.e. Figure 6 As shown in the diagram (nodes 1, 2, 3, and 4), for any consensus node 1 (using node 1 as an example here), it can group the transaction information in its local transaction pool according to the number of consensus nodes in the blockchain network, obtaining transaction groups corresponding to each consensus node, for example... Figure 6 The transaction groups of node 1, node 2, node 3, and node 4 shown in the diagram are all packaged by the node when it acts as a proposal node to generate a block. This avoids the problem of repeatedly packaging the same transactions.
[0047] Furthermore, node 1 can generate a temporary block in advance based on the transaction information contained in the transaction group corresponding to node 1 (such as...). Figure 6 The temporary blocks N, N+1, and N+2 shown in the diagram can be pre-processed to check for duplicate transactions and to serialize the transaction list. If node 1 obtains the information of the preceding block, it can generate a proposal block based on the information of the preceding block and the temporary block, and then broadcast the generated proposal block to the blockchain network for consensus processing.
[0048] For example, when generating a temporary block, the block height, block hash, and previous block hash fields in the temporary block are empty. After node 1 obtains the information of the previous block, it can determine the previous block hash value, the block height of the next block, and the next block hash value based on the previous block information. Then, it updates the previous block hash field in the temporary block based on the previous block hash value, updates the block height field in the temporary block based on the next block block height, and updates the block hash field in the temporary block based on the next block block hash value, thereby generating the proposal block.
[0049] As can be seen, the technical solution of this application avoids the problem of repeatedly packaging transaction information by grouping transactions, and can improve the block generation rate of the blockchain, which is beneficial to improving the consensus performance of the blockchain system.
[0050] The implementation details of the technical solutions in the embodiments of this application are described in detail below: Figure 7 A flowchart illustrating a blockchain consensus method according to an embodiment of this application is shown. This consensus method can be executed by consensus nodes in a blockchain network, which can be any one or all consensus nodes in the blockchain network. (Refer to...) Figure 7 As shown, the consensus method of this blockchain includes at least steps S710 to S740, which are described in detail below: In step S710, the transaction information in the local transaction pool is grouped according to the number of consensus nodes in the blockchain network to obtain transaction groups corresponding to each consensus node in the blockchain network.
[0051] In some optional embodiments, grouping transaction information in the local transaction pool is to determine the transaction information that each consensus node can package into the block when acting as a proposal node. By grouping transaction information in the local transaction pool, each consensus node only needs to focus on the part of transaction information that it needs to package, thereby avoiding the problem of different consensus nodes repeatedly packaging the same transaction information.
[0052] In some optional embodiments, when grouping transaction information, grouping can be done according to the unique identifier of the transaction information. That is, the unique identifier of the transaction information can be used to ensure that the grouping results of each consensus node are consistent. Optionally, the unique identifier can be the transaction hash of the transaction information. Then, when grouping the transaction information in the local transaction pool according to the number of consensus nodes in the blockchain network, the transaction hash corresponding to the transaction information in the local transaction pool can be calculated, and then a modulo operation can be performed between the transaction hash and the number of consensus nodes. The transaction information can then be grouped according to the result of the modulo operation.
[0053] Specifically, in a blockchain network with four consensus nodes (nodes 1, 2, 3, and 4), the transaction hash of a given transaction can be modulo 4. The transaction is then grouped based on the modulo result. For example, if the modulo result is 0, the transaction is assigned to the group corresponding to node 1; if it's 1, it's assigned to the group corresponding to node 2; if it's 2, it's assigned to the group corresponding to node 3; and if it's 3, it's assigned to the group corresponding to node 4.
[0054] In step S720, a temporary block is generated based on the transaction group corresponding to the current consensus node.
[0055] In some optional embodiments, the current consensus node is the one executing... Figure 7 The consensus node in the technical solution of the illustrated embodiment can generate temporary blocks in advance based on the corresponding transaction groups. For example, before becoming a proposal node, the current consensus node can generate temporary blocks based on the transaction groups corresponding to the current consensus node. Furthermore, it can perform deduplication processing on the transaction information contained in the temporary blocks based on the transaction information recorded in the blockchain ledger, and serialize the list of transaction information in the temporary blocks. This allows for transaction packaging, transaction deduplication, and transaction information list serialization before becoming a proposal node, enabling the rapid generation of proposal blocks based on the temporary blocks after becoming a proposal node. This significantly shortens the block generation time and improves block generation efficiency.
[0056] In step S730, if the information of the preceding block of the temporary block is obtained, a proposal block is generated based on the information of the preceding block and the temporary block.
[0057] In some optional embodiments, the current consensus node can determine that it has obtained the information of the preceding block of the temporary block when it receives the preceding block sent by other consensus nodes. Specifically, if other consensus nodes initiate a consensus process for a certain block to be agreed upon, then after the current consensus node receives the block to be agreed upon, if the current consensus node is the proposal node in the next round of consensus process, then the block to be agreed upon can be used as the preceding block. The proposal block can then be generated based on the information of the preceding block and the temporary block generated in advance by the current consensus node. This allows the proposal block to be generated before the current consensus node becomes the proposal node, thereby improving the output efficiency of the blockchain system.
[0058] In some optional embodiments, if the current consensus node produces multiple blocks when acting as a proposal node, after the current consensus node generates a proposal block, the generated proposal block is used as a preceding block, and the information of the preceding block for which the temporary block is obtained is determined. Specifically, if the current consensus node produces three blocks when acting as a proposal node, after the proposal node generates the first proposal block, it can use this proposal block as a preceding block, and then generate the next proposal block based on the information of the preceding block and the pre-generated temporary block; similarly, after the proposal node generates the second proposal block, it can use this second proposal block as a preceding block, and then generate the next proposal block based on the information of the preceding block and the pre-generated temporary block.
[0059] In one embodiment of this application, since the temporary block is pre-generated, information such as the block height is uncertain. Therefore, when generating the temporary block, a corresponding number of transaction information can be selected from the transaction group corresponding to the current consensus node and packaged according to the number of transaction information contained in each block to generate the temporary block. In this case, the block height field, block hash field, and previous block hash field in the temporary block are empty values.
[0060] Based on this, after obtaining the information of the preceding block, the information in the temporary block can be supplemented according to the information of the preceding block to generate the proposal block. Specifically, the hash value of the preceding block, the block height of the next block, and the block hash value of the next block can be determined according to the information of the preceding block. Then, the preceding block hash field in the temporary block is updated according to the preceding block hash value, the block height field in the temporary block is updated according to the block height of the next block, and the block hash field in the temporary block is updated according to the block hash value of the next block to generate the proposal block.
[0061] In step S740, the proposal block is broadcast to the blockchain network for consensus processing.
[0062] In some alternative embodiments, after the proposal block is broadcast to the blockchain network, consensus processing can be performed by referring to the consensus process mentioned in the foregoing embodiments. For example, a consensus process may include a proposal phase, a pre-voting phase, and a pre-commit phase. After these processes, a proposal block is submitted to the blockchain.
[0063] Figure 7The technical solution of the embodiment shown can pre-group the transaction information in the local transaction pool of the consensus node, and each consensus node can pre-package the transaction information according to the grouping result. In this way, the block production rate of the blockchain can be improved by avoiding the duplicate packaging of transaction information through grouping, which is conducive to improving the consensus performance of the blockchain system.
[0064] Figure 8 A flowchart illustrating a blockchain consensus method according to an embodiment of this application is shown. This consensus method can be executed by consensus nodes in a blockchain network, which can be any one or all consensus nodes in the blockchain network. (Refer to...) Figure 8 As shown, the consensus method of this blockchain includes... Figure 7 In addition to steps S710 to S740 shown, steps S810 to S830 may also be included, as detailed below: Step S810: In the local transaction pool, detect the number of transaction information contained in the transaction groups corresponding to other consensus nodes.
[0065] In some optional embodiments, transaction information in the local transaction pool is cleaned up based on whether a proposal block is uploaded to the blockchain. For example, if a proposal block is successfully uploaded, the transaction information contained in that proposal block is deleted from the local transaction pool. Therefore, if the number of transaction information contained in the transaction group corresponding to a certain consensus node is relatively large in the local transaction pool, it indicates that the transaction information in the transaction group corresponding to that consensus node may not have been successfully consensused. A major reason for this is that the consensus node has encountered an anomaly (such as crashing, network disconnection, etc.) and has not generated a proposal block for consensus. Therefore, in the embodiments of this application, the anomaly of other consensus nodes can be determined by detecting the number of transaction information contained in the transaction groups corresponding to other consensus nodes.
[0066] Step S820: Determine whether the number of transaction information contained in the transaction group corresponding to the specified consensus node exceeds the set threshold. If so, proceed to step S830.
[0067] Optionally, if the number of transaction information contained in the transaction group corresponding to the specified consensus node does not exceed a set threshold, then the specified consensus node is normal, and the specified consensus node will then execute. Figure 7 The process shown is sufficient.
[0068] Step S830: If the number of transaction information contained in the transaction group corresponding to the specified consensus node exceeds the set threshold, the transaction information contained in the transaction group corresponding to the specified consensus node is packaged to generate a temporary block.
[0069] As mentioned earlier, if the number of transactions contained in the transaction group corresponding to a specified consensus node exceeds a set threshold, it indicates that the transaction information in the transaction group corresponding to the specified consensus node may not have been successfully consensused, meaning that the specified consensus node may have encountered an anomaly (such as a crash or network disconnection). In this case, the current consensus node can package the transaction information contained in the transaction group corresponding to the specified consensus node to generate a temporary block, in order to prevent the transaction information contained in the transaction group corresponding to the specified consensus node from being unable to be processed on the blockchain for an extended period due to the anomaly of the specified consensus node.
[0070] In some optional embodiments, the process by which the current consensus node packages the transaction information contained in the transaction group corresponding to the specified consensus node can be as follows: selecting transaction information from the transaction group corresponding to the specified consensus node and packaging it into at least one temporary block, until the number of transaction information contained in the transaction group corresponding to the specified consensus node is less than a set threshold. For example, if the transaction group corresponding to the specified consensus node contains 60 transaction information items, and a block can hold 20 transaction information items, and the set threshold is 50, then 20 transaction information items can be selected from the transaction group corresponding to the specified consensus node to generate one temporary block. At this time, the number of transaction information items in the transaction group corresponding to the specified consensus node is less than the set threshold of 50.
[0071] In some optional embodiments, the process by which the current consensus node packages the transaction information contained in the transaction group corresponding to the specified consensus node can be as follows: selecting transaction information from the transaction group corresponding to the specified consensus node and packaging it into at least one temporary block, until the number of transaction information contained in the transaction group corresponding to the specified consensus node is 0. For example, if the transaction group corresponding to the specified consensus node contains 60 transaction information items, and a block can hold 20 transaction information items, with a threshold of 50, then 20 transaction information items can be selected from the transaction group corresponding to the specified consensus node to generate 3 temporary blocks. At this time, the number of transaction information items in the transaction group corresponding to the specified consensus node is 0. The technical solution of this embodiment can ensure that the transaction information in the transaction group corresponding to the specified consensus node is processed in a timely manner, avoiding delays in the consensus processing of transaction information.
[0072] It should be noted that after executing step S830, you can jump to step S730, that is, for the already generated temporary block, if the information of the preceding block of the temporary block is obtained, a proposal block is generated based on the information of the preceding block and the temporary block, and then consensus processing is performed on the proposal block.
[0073] In one embodiment of this application, the current consensus node can also detect whether the proposal blocks broadcast by other consensus nodes contain transaction information from the transaction group corresponding to the current consensus node. If the proposal blocks broadcast by other consensus nodes contain transaction information from the transaction group corresponding to the current consensus node, then all temporary blocks generated by the current consensus node are cleared. Specifically, if the proposal blocks broadcast by other consensus nodes contain transaction information from the transaction group corresponding to the current consensus node, it indicates that the transaction information in the transaction group corresponding to the current consensus node may have been packaged and processed by other consensus nodes. In this case, the transaction information in the transaction group corresponding to the current consensus node is no longer accurate. To avoid packaging duplicate transaction information, all temporary blocks generated by the current consensus node can be cleared.
[0074] In some optional embodiments, after clearing all temporary blocks generated by the current consensus node, the current consensus node can regroup the transaction information in its local transaction pool and generate temporary blocks based on the transaction groups corresponding to the current consensus node, i.e., re-execute. Figure 7 The process is shown below.
[0075] As can be seen, the technical solution of this application embodiment enables consensus nodes to pre-package transaction information in parallel and to perform tasks such as transaction duplication verification and transaction list serialization in advance, thereby optimizing the serial packaging process in related technologies into a semi-parallel packaging process, which greatly improves the consensus performance of the blockchain system.
[0076] In a specific application scenario, after a client generates a series of transaction information, it can submit it to the consensus node of the blockchain. After receiving the transaction information, the consensus node verifies the validity of the transaction, such as whether the transaction information is duplicated and whether the signature is valid. Transaction information that passes the verification will be put into the transaction pool, and invalid transactions will be rejected.
[0077] Then, the transaction information in the transaction pool will be assigned to different transaction groups based on the transaction hash. Specifically, the transaction hash of each transaction information can be calculated, and then the transaction group can be calculated, i.e., group number = transaction hash % number of nodes; then the group number is matched one by one with the node number.
[0078] Furthermore, consensus nodes pre-package transactions logically belonging to their node into temporary blocks and pre-serialize them. Specifically, by default, each node only packages transaction information from its own transaction group when generating a block. Consensus nodes can pre-package multiple blocks based on the number of transactions (block height, block hash, and preHash of the preceding block can be temporarily set to empty values, and these values are only set after the preceding block is determined). Simultaneously, they pre-interact with the blockchain ledger layer to perform transaction deduplication and pre-serialize the transaction list. Since transaction deduplication involves multiple database queries, consuming considerable time, and serializing the transaction list is also time-consuming when there is a large amount of transaction information, pre-completing these two steps helps save time and improve system performance.
[0079] In one embodiment of this application, if a consensus node only packages transaction information logically belonging to its own group, then when some consensus nodes fail and stop producing blocks, the transaction information belonging to the group corresponding to the failed node may remain unprocessed for a long time. To solve this problem, the consensus node can check the number of transactions in other logical groups. If the number of transactions exceeds a threshold (which can be configured according to actual needs), it can package some transaction information belonging to other node groups. Optionally, when packaging transaction information belonging to other node groups, it can be ensured that the transaction information in the packaged temporary block comes only from the same logical group, that is, the transaction information in the packaged temporary block all comes from the same node group.
[0080] In one embodiment of this application, when a consensus node receives a block from another node, if it discovers that another node has packaged transaction information that logically belongs to its own group, then all previously pre-packaged temporary blocks can be cleared. This is because some transactions logically belonging to the current consensus node have already been packaged by other nodes, so some transaction information in the temporary blocks packaged by the current consensus node may have already been produced as blocks, causing the temporary blocks to become invalid. When the abnormal node recovers and becomes a block-producing node, it can re-group the transactions logically, thus ensuring that transactions are not packaged repeatedly.
[0081] After a temporary block is generated, the information of the packaged temporary block can be supplemented during the proposal phase. Then, it is broadcast to the blockchain for consensus processing. After consensus is achieved, the block is submitted to the blockchain and removed from the temporary block list. At the same time, the transaction information contained in the submitted block is also deleted from the local transaction pool.
[0082] In summary, the technical solution of this application embodiment can pre-group the transaction information in the local transaction pool of the consensus node, and each consensus node can pre-package the transaction information according to the grouping result. Thus, by avoiding duplicate packaging of transaction information through grouping, the block production rate of the blockchain is improved, which is conducive to improving the consensus performance of the blockchain system.
[0083] The following describes an apparatus embodiment of this application, which can be used to execute the blockchain consensus method in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the above embodiments of the blockchain consensus method of this application.
[0084] Figure 9 A block diagram of a blockchain consensus apparatus according to an embodiment of this application is shown.
[0085] Reference Figure 9 As shown, a blockchain consensus device 900 according to an embodiment of this application includes: a grouping unit 902, a first generation unit 904, a second generation unit 906, and a consensus unit 908.
[0086] Specifically, the grouping unit 902 is configured to group the transaction information in the local transaction pool according to the number of consensus nodes in the blockchain network, thereby obtaining transaction groups corresponding to each consensus node in the blockchain network; the first generation unit 904 is configured to generate a temporary block according to the transaction group corresponding to the current consensus node; the second generation unit 906 is configured to generate a proposal block according to the information of the preceding block and the temporary block if the information of the preceding block is obtained; and the consensus unit 908 is configured to broadcast the proposal block to the blockchain network for consensus processing.
[0087] In some embodiments of this application, based on the foregoing scheme, the grouping unit 902 is configured to: calculate the transaction hash corresponding to the transaction information in the local transaction pool; perform a modulo operation on the transaction hash and the number of consensus nodes, and group the transaction information according to the result of the modulo operation.
[0088] In some embodiments of this application, based on the foregoing scheme, the first generation unit 904 is configured to generate a temporary block according to the transaction group corresponding to the current consensus node before the current consensus node becomes a proposal node; the second generation unit 906 is configured to determine the information of the preceding block of the temporary block when the current consensus node receives the preceding block sent by other consensus nodes.
[0089] In some embodiments of this application, based on the foregoing scheme, the second generation unit 906 is configured as follows: if the current consensus node produces multiple blocks when acting as a proposal node, then after the current consensus node generates a proposal block, the generated proposal block is used as the preceding block, and the information of the preceding block of the temporary block is determined.
[0090] In some embodiments of this application, based on the foregoing scheme, the consensus device 900 of the blockchain further includes: a detection unit configured to detect the number of transaction information contained in the transaction groups corresponding to other consensus nodes in the local transaction pool; the first generation unit 904 is further configured to: if the number of transaction information contained in the transaction group corresponding to a specified consensus node exceeds a set threshold, then package the transaction information contained in the transaction group corresponding to the specified consensus node to generate the temporary block.
[0091] In some embodiments of this application, based on the foregoing scheme, the process by which the first generation unit 904 packages the transaction information contained in the transaction group corresponding to the designated consensus node includes: selecting transaction information from the transaction group corresponding to the designated consensus node and packaging it into at least one temporary block, until the number of transaction information contained in the transaction group corresponding to the designated consensus node is less than the set threshold.
[0092] In some embodiments of this application, based on the foregoing scheme, the process by which the first generation unit 904 packages the transaction information contained in the transaction group corresponding to the designated consensus node includes: selecting transaction information from the transaction group corresponding to the designated consensus node and packaging it into at least one temporary block until the number of transaction information contained in the transaction group corresponding to the designated consensus node is 0.
[0093] In some embodiments of this application, based on the foregoing scheme, the consensus device 900 of the blockchain further includes: a detection unit configured to detect whether the proposal blocks broadcast by other consensus nodes contain transaction information in the transaction group corresponding to the current consensus node; and a clearing unit configured to clear all temporary blocks generated by the current consensus node if the proposal blocks broadcast by other consensus nodes contain transaction information in the transaction group corresponding to the current consensus node.
[0094] In some embodiments of this application, based on the foregoing scheme, the grouping unit 902 is further configured to: after clearing all temporary blocks generated by the current consensus node, regroup the transaction information in the local transaction pool of the current consensus node, so that the first generation unit 904 generates the temporary block according to the transaction group corresponding to the current consensus node.
[0095] In some embodiments of this application, based on the foregoing scheme, the first generation unit 904 is configured to: select a corresponding number of transaction information from the transaction group corresponding to the current consensus node and package them according to the number of transaction information contained in each block to generate the temporary block; wherein, the block height field, block hash field and previous block hash field in the temporary block are null values.
[0096] In some embodiments of this application, based on the foregoing scheme, the second generation unit 906 is configured to: determine the hash value of the preceding block, the block height of the next block, and the block hash value of the next block according to the information of the preceding block; update the preceding block hash field in the temporary block according to the preceding block hash value, update the block height field in the temporary block according to the block height of the next block, and update the block hash field in the temporary block according to the block hash value of the next block, so as to generate the proposal block.
[0097] In some embodiments of this application, based on the foregoing scheme, the first generation unit 904 is further configured to: after generating the temporary block and before generating the proposal block, perform duplicate verification processing on the transaction information contained in the temporary block according to the transaction information recorded in the blockchain ledger, and perform serialization processing on the list of transaction information in the temporary block.
[0098] Figure 10 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0099] It should be noted that, Figure 10 The computer system 1000 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0100] like Figure 10 As shown, the computer system 1000 includes a Central Processing Unit (CPU) 1001, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 1002 or programs loaded from storage portion 1008 into Random Access Memory (RAM) 1003, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in RAM 1003. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. An Input / Output (I / O) interface 1005 is also connected to bus 1004.
[0101] The following components are connected to I / O interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to I / O interface 1005 as needed. Removable media 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1010 as needed so that computer programs read from them can be installed into storage section 1008 as needed.
[0102] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by central processing unit (CPU) 1001, it performs various functions defined in the system of this application.
[0103] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0104] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and a computer program.
[0105] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0106] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more computer programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.
[0107] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0108] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.
[0109] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0110] The data collection and processing plan outlined in this application must be implemented in strict accordance with the requirements of relevant national laws and regulations, obtaining the informed consent or separate consent of the data subject (or having a legal basis as stipulated by the relevant national laws and regulations), and conducting subsequent data use and processing within the scope authorized by laws and regulations and the data subject.
[0111] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A consensus method of a blockchain, characterized in that, include: Calculate the transaction hash corresponding to the transaction information in the local transaction pool; The transaction hash is moduloed by the number of consensus nodes in the blockchain network, and the transaction information is grouped according to the result of the modulo operation to obtain transaction groups corresponding to each consensus node in the blockchain network. A temporary block is generated based on the transaction group corresponding to the current consensus node, wherein the block height field, block hash field, and previous block hash field in the temporary block are empty values; If the information of the preceding block of the temporary block is obtained, the hash value of the preceding block, the block height of the next block, and the block hash value of the next block are determined based on the information of the preceding block. The preceding block hash field in the temporary block is updated according to the preceding block hash value, the block height field in the temporary block is updated according to the block height of the next block, and the block hash field in the temporary block is updated according to the block hash value of the next block to generate a proposal block. The proposed block is broadcast to the blockchain network for consensus processing. 2.The consensus method of the blockchain of claim 1, wherein, Generating a temporary block based on the transaction group corresponding to the current consensus node includes: generating a temporary block based on the transaction group corresponding to the current consensus node before the current consensus node becomes a proposal node; The method further includes: when the current consensus node receives the preceding block sent by other consensus nodes, determining the information of the preceding block of the temporary block. 3.The consensus method of the blockchain of claim 1, wherein, The method further includes: If the current consensus node produces multiple blocks when acting as a proposal node, then after the current consensus node generates a proposal block, the generated proposal block is used as the preceding block, and the information of the preceding block to which the temporary block is obtained is determined.
4. The consensus method of blockchain of claim 1, wherein, The method further includes: In the local transaction pool, the number of transaction information contained in the transaction packets corresponding to other consensus nodes is detected; If the number of transaction information contained in the transaction group corresponding to the specified consensus node exceeds a set threshold, the transaction information contained in the transaction group corresponding to the specified consensus node is packaged to generate the temporary block. 5.The consensus method of the blockchain of claim 4, wherein, The transaction information contained in the transaction group corresponding to the specified consensus node is packaged, including: Select transaction information from the transaction group corresponding to the designated consensus node and package it into at least one temporary block until the number of transaction information contained in the transaction group corresponding to the designated consensus node is less than the set threshold.
6. The consensus method for blockchain according to claim 5, characterized in that, The transaction information contained in the transaction group corresponding to the specified consensus node is packaged, including: Select transaction information from the transaction group corresponding to the designated consensus node and package it into at least one temporary block until the number of transaction information contained in the transaction group corresponding to the designated consensus node is 0.
7. The consensus method for blockchain according to claim 1, characterized in that, The method further includes: Check whether the proposal blocks broadcast by other consensus nodes contain transaction information from the transaction group corresponding to the current consensus node; If the proposal blocks broadcast by other consensus nodes contain transaction information from the transaction group corresponding to the current consensus node, then all temporary blocks generated by the current consensus node are cleared.
8. The consensus method for blockchain according to claim 7, characterized in that, The method further includes: After clearing all temporary blocks generated by the current consensus node, the transaction information in the local transaction pool of the current consensus node is regrouped, and the temporary block is generated according to the transaction group corresponding to the current consensus node.
9. The consensus method for blockchain according to claim 1, characterized in that, A temporary block is generated based on the transaction group corresponding to the current consensus node, including: Based on the number of transactions contained in each block, a corresponding number of transactions are selected from the transaction group corresponding to the current consensus node and packaged to generate the temporary block.
10. The consensus method for blockchain according to any one of claims 1 to 9, characterized in that, The method further includes: After the temporary block is generated but before the proposal block is generated, the transaction information contained in the temporary block is deduplicated based on the transaction information recorded in the blockchain ledger, and the list of transaction information in the temporary block is serialized.
11. A consensus device for blockchain, characterized in that, include: The grouping unit is configured to group transaction information in the local transaction pool according to the number of consensus nodes in the blockchain network, so as to obtain transaction groups corresponding to each consensus node in the blockchain network. The grouping unit is configured to: calculate the transaction hash corresponding to the transaction information in the local transaction pool; perform a modulo operation on the transaction hash and the number of consensus nodes; and group the transaction information according to the result of the modulo operation. The first generation unit is configured to generate a temporary block based on the transaction group corresponding to the current consensus node, wherein the block height field, block hash field, and previous block hash field in the temporary block are empty values; The second generation unit is configured to generate a proposal block based on the information of the preceding block and the temporary block if the information of the preceding block is obtained. The second generation unit is configured to: determine the hash value of the preceding block, the block height of the next block, and the block hash value of the next block based on the information of the preceding block; update the preceding block hash field in the temporary block based on the preceding block hash value, update the block height field in the temporary block based on the block height of the next block, and update the block hash field in the temporary block based on the block hash value of the next block, so as to generate the proposal block; The consensus unit is configured to broadcast the proposal block to the blockchain network for consensus processing.
12. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the consensus method of the blockchain as described in any one of claims 1 to 10.
13. An electronic device, characterized in that, include: One or more processors; A memory for storing one or more computer programs that, when executed by one or more processors, cause the electronic device to implement the consensus method of a blockchain as described in any one of claims 1 to 10.
14. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, wherein a processor of an electronic device reads from and executes the computer program, causing the electronic device to perform a blockchain consensus method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Block chain block-building method based on parallel PipeLine technology
CN106406896A
