Block processing method and device, verification node, and storage medium
By constructing a second proposal block with a higher block height in advance in the blockchain network and performing consensus processing, the problem of low blockchain consensus efficiency is solved, and the efficiency of on-chain storage of transaction data and the business throughput of the blockchain network are improved.
Patent Information
- Application Number
- CN202110759515.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-05
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2041-07-05
AI Technical Summary
The low consensus efficiency of existing blockchain technology affects the efficiency of on-chain storage of transaction data and the business throughput of the blockchain network.
During the consensus processing of the first proposal block, a second proposal block with a higher block height is constructed. When the consensus of the first proposal block is passed, it is stored in the blockchain network. At the same time, the second proposal block is broadcast for consensus voting, skipping the creation process. Blockchain forks are prevented by locking tags, thus improving the efficiency of consensus processing.
It improves the efficiency of consensus processing for proposal blocks, increases the efficiency of storing transaction data on the blockchain, and enhances the business throughput of the blockchain network.
Smart Images

Figure CN115577039B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, and particularly relates to a block processing method and device, a verification node and a storage medium. BACKGROUND
[0002] With the continuous development of blockchain technology, the data processing process based on the blockchain has high authenticity and credibility. Since the data stored based on the blockchain technology has the characteristic of being non-tamperable, more and more transaction data relies on the blockchain network for storage to ensure the security of data storage. However, the data storage process based on the blockchain technology needs to be first broadcast for consensus in the blockchain network and then processed for chaining. Therefore, in order to improve the chaining efficiency of transaction data, it is necessary to improve the consensus efficiency of the blockchain. Therefore, how to improve the consensus efficiency of the blockchain has become a research hotspot. SUMMARY
[0003] The embodiment of the present application provides a block processing method, device, verification node and storage medium, which can improve the consensus processing efficiency of the blockchain.
[0004] In one aspect, the embodiment of the present application provides a block processing method, comprising:
[0005] In the process of consensus processing on the first proposal block, a second proposal block is constructed, wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is a block with the maximum corresponding block height among existing proposal blocks;
[0006] The consensus processing result of the first proposal block is obtained, and when the consensus processing result indicates that the first proposal block passes the consensus, the first proposal block is stored to the blockchain network;
[0007] The second proposal block is broadcast in the blockchain network, so that each verification node of the blockchain network performs a consensus vote on the second proposal block to obtain a consensus processing result of the second proposal block.
[0008] In another aspect, the embodiment of the present application provides a data processing device, comprising:
[0009] The construction unit is configured to, in the process of consensus processing on the first proposal block, construct a second proposal block, wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is a block with the maximum corresponding block height among existing proposal blocks;
[0010] a processing unit configured to obtain a consensus processing result of the first proposal block, and store the first proposal block into a blockchain network when the consensus processing result indicates that the first proposal block passes the consensus.
[0011] The processing unit is further configured to broadcast the second proposal block in the blockchain network, so as to make each verification node of the blockchain network perform a consensus voting on the second proposal block, and obtain a consensus processing result of the second proposal block.
[0012] In another aspect, an embodiment of the present application provides a verification node, comprising a processor, an input device, an output device and a memory, which are connected with each other, wherein the memory is configured to store a computer program supporting the verification node to perform the method described above, the computer program comprises program instructions, and the processor is configured to invoke the program instructions to perform the following steps:
[0013] In the consensus processing of the first proposal block, a second proposal block is constructed, wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is a block with the largest corresponding block height among existing proposal blocks;
[0014] The consensus processing result of the first proposal block is obtained, and the first proposal block is stored into a blockchain network when the consensus processing result indicates that the first proposal block passes the consensus.
[0015] The second proposal block is broadcasted in the blockchain network, so as to make each verification node of the blockchain network perform a consensus voting on the second proposal block, and obtain a consensus processing result of the second proposal block.
[0016] In another aspect, an embodiment of the present application provides a computer readable storage medium, which stores program instructions, and the program instructions are executed by a processor to perform the block processing method according to the first aspect.
[0017] In the embodiment of the present application, the verification node can construct the second proposal block in the consensus process of the first proposal block, and obtain the consensus result of the first proposal block after the second proposal block is constructed. When the consensus result indicates that the first proposal block is consensus passed, the first proposal block is stored in the blockchain network, and the consensus process of the second proposal block is triggered. When the verification node performs consensus processing on the second proposal block, the verification node no longer needs to create the second proposal block, thereby improving the consensus processing efficiency of the proposal block, and improving the efficiency of the transaction data stored on the blockchain, so that the blockchain network can improve the throughput of the external business of the blockchain. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0019] Figure 1a is a schematic diagram of a data sharing system provided by an embodiment of the present application;
[0020] Figure 1b is a schematic diagram of a blockchain provided by an embodiment of the present application;
[0021] Figure 1c is a schematic diagram of generating each block of a blockchain provided by an embodiment of the present application;
[0022] Figure 2 is a schematic flow chart of a block processing method provided by an embodiment of the present application;
[0023] Figure 3 is a schematic flow chart of a block processing method provided by an embodiment of the present application;
[0024] Figure 4 is a schematic block diagram of a block processing device provided by an embodiment of the present application;
[0025] Figure 5 is a schematic block diagram of a verification node provided by an embodiment of the present application. DETAILED DESCRIPTION
[0026] The embodiment of the present application proposes a block processing method, so that any verification node in the block chain network can prepare the second proposal block to be consensus in the next round in advance when performing consensus verification on the first proposal block in the block chain network, that is, the verification node can generate the second proposal block in advance in the process of consensus verification on the first proposal block, so that the verification node can directly enter the consensus node of the second proposal block after the consensus of the first proposal block is successful, and skip the creation stage of the second proposal block, so as to improve the generation and creation process of the subsequent proposal block, and the consensus processing process of each proposal block in the block chain network can be realized. The block chain is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. The block chain is essentially a decentralized database, which is a series of data blocks associated by using cryptographic methods. Each data block contains the information of a batch of network transactions, and is used to verify the validity (anti-fake) of the information and generate the next block (i.e. the proposal block, such as the first proposal block and the second proposal block described above). The block chain can include a block chain underlying platform, a platform product service layer and an application service layer. In addition, the block chain network based on the block chain technology can be a data sharing system as shown in Figure 1a The data sharing system 100 is a system for sharing data between nodes. The data sharing system can include a plurality of nodes 101, which can be client nodes in the data sharing system. Each node 101 can receive input information and maintain shared data in the data sharing system based on the received input information. To ensure information exchange in the data sharing system, each node in the data sharing system can be connected by information. The nodes can transmit information through the information connection. For example, when any node in the data sharing system receives input information, other nodes in the data sharing system can obtain the input information according to a consensus algorithm, store the input information as data in the shared data, and ensure that the data stored on all nodes in the data sharing system is consistent. The verification node mentioned in the embodiment of the present application can be any node in the data sharing system as shown in Figure 1a The verification node can be any one or more nodes labeled 101 in Figure 1a
[0027] For each node (such as the above-mentioned verification node) in the data sharing system, there is a node identifier corresponding thereto, and each node in the data sharing system can store the node identifiers of other nodes in the data sharing system, so as to subsequently broadcast the generated proposal block to other nodes in the data sharing system according to the node identifiers of the other nodes. Each node can maintain a node identifier list as shown in the following table, and store the node name and the node identifier into the node identifier list. The node identifier can be an IP (Internet Protocol) address and any other information capable of identifying the node, and the IP address is taken as an example in Table 1 for illustration.
[0028] Table 1
[0029] Node name Node identification Node 1 117.114.151.174 Node 2 117.116.189.145 … … Node N 119.123.789.258
[0030] Each node in the data sharing system stores a same blockchain. The blockchain is composed of multiple proposal blocks, as shown in Figure 1b The blockchain is composed of multiple proposal blocks, the genesis block includes a block header and a block body, the block header stores an input information feature value, a version number, a timestamp and a difficulty value, and the block body stores the input information; the next proposal block of the genesis block takes the genesis block as a parent proposal block, and the next proposal block also includes a block header and a block body, the block header stores the input information feature value of the current proposal block, the block header feature value of the parent proposal block, the version number, the timestamp and the difficulty value, and the same applies to the next proposal block, so that the block data stored in each proposal block in the blockchain is associated with the proposal block data stored in the parent proposal block, thereby ensuring the security of the input information in the proposal block.
[0031] When generating each proposal block in the blockchain, as shown in Figure 1c The node where the blockchain is located receives the input information, checks the input information, stores the input information into the memory pool after completing the checking, and updates the hash tree used to record the input information; then, the update timestamp is updated to the time when the input information is received, and different random numbers are tried to perform multiple times of feature value calculation, so that the calculated feature value can satisfy the following formula:
[0032] SHA256(SHA256(version+prev_hash+markle_root+ntime+nbits+x))<TARGET
[0033] SHA256(version, prev_hash, merkle_root, ntime, nbits, x) < TARGET
[0034] In this way, when the random number satisfying the above formula is calculated, the information is correspondingly stored, the block header and the block body are generated, and the current proposal block is obtained. Subsequently, the node of the block chain sends the newly generated proposal block to other nodes in the data sharing system according to the node identifiers of the other nodes in the data sharing system, and the other nodes check the newly generated proposal block, and add the newly generated proposal block to the stored block chain after the checking is completed.
[0035] In an embodiment, the block chain is composed of one or more proposal blocks for storing transaction data. It can be understood that the plurality of proposal blocks are connected in sequence to form the block chain. The generation (or creation) of each proposal block in the block chain is different. Generally, the next proposal block is created only after the previous proposal block is created and consensus is reached. The proposal block corresponding to an earlier time of being added to the chain is the parent proposal block of the proposal block corresponding to a later time of being added to the chain. The first proposal block mentioned in the embodiment of the present application is the proposal block corresponding to an earlier time of being added to the chain, that is, the first proposal block mentioned in the embodiment of the present application can be called the parent proposal block of the second proposal block.
[0036] Since the verification node broadcasts the generated proposal block to the blockchain network after creating the proposal block, the verification node can store the generated proposal block on the chain after the other verification nodes in the blockchain network reach consensus on the proposal block. In an embodiment, the consensus process for the proposal block generally includes block proposal, pre-voting stage and pre-commit stage. The block proposal is used for creating the proposal block, and the pre-voting stage and the pre-commit stage can be considered as two voting stages of the block consensus process. The pre-voting stage is the first voting stage of the block consensus process, and the pre-commit stage is the second voting stage of the block consensus process. The first voting stage is used to select the proposal block from the existing proposal blocks that can be subsequently voted (i.e., participate in the second voting stage). For example, if the existing proposal blocks include proposal blocks 1-5, the proposal blocks selected for subsequent consensus voting based on the first voting stage can be proposal blocks 1 and 2. After the first voting stage (i.e., the pre-voting stage) is completed, the verification node obtains the consensus voting result of the corresponding proposal block in the second voting stage (i.e., the pre-commit stage), and then stores the proposal block based on the consensus voting result.
[0037] Please refer to Figure 2 is a schematic flowchart of a block processing method proposed in an embodiment of the present application. The block processing method can be executed by the verification node described above. The verification node can be any verification node in the blockchain network. The verification node in the blockchain network can be a terminal device or a server. The terminal device can be, for example, a smartphone, a wearable watch, etc. The server can be a physical server or a cloud server, etc. It should be noted that the verification node can be composed of one terminal device or one server, or can be composed of a device cluster composed of multiple terminal devices or multiple servers. In addition, the verification node can also be a module in a terminal device or a server, etc. The block processing method can specifically include the following steps.
[0038] S201, in the consensus process for the first proposal block, a second proposal block is constructed, wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is the block with the largest corresponding block height among the existing proposal blocks.
[0039] In one embodiment, if the first proposal block is the first proposal block of the blockchain, i.e. if the first proposal block is the genesis block of the blockchain, the first proposal block is generated in the block proposal stage of the consensus process, and the consensus process for the proposal block further includes a pre-vote stage and a pre-commit stage, and in the consensus process of the first proposal block, the second proposal block is constructed in the pre-commit stage. In another implementation, if the first proposal block is not the genesis block of the blockchain, it can be understood that the first proposal is not generated in the proposal stage, but is constructed when the last proposal block of the first proposal block (or the parent proposal block of the first proposal block) is in the pre-commit stage, and the second proposal block is created after the first proposal block enters the pre-commit stage, and the cycle is repeated continuously, the next proposal block is created when the last proposal block is in the pre-commit stage, and further consensus processing is performed.
[0040] The flow of the three stages of the block proposal stage, the pre-vote stage and the pre-commit stage included in the consensus process is driven by consensus messages such as proposal messages, pre-vote messages and pre-commit messages. It can be understood that the proposal message is used to carry the generated proposal block, and the generated proposal block is broadcast to the blockchain network through the proposal message, and the pre-vote message and the pre-commit message are used to carry the voting results of each verification node in the blockchain network. In one embodiment, the verification node has two triggering conditions from the proposal stage to the pre-vote stage, one is to receive the proposal message within the timeout time, and the other is to not receive the proposal message within the timeout time.
[0041] In one embodiment, before the verification node performs the consensus processing of the proposal block, the proposal block needs to be created first, and after the verification node creates the proposal block, it needs to perform a pre-voting stage first, and after the pre-voting stage passes, it performs a pre-commit stage. Among them, when the first proposal block is in the pre-voting stage, the verification node can obtain the voting results of other verification nodes in the blockchain network except the current verification node on the first proposal block, and further determine whether the first proposal block passes the pre-voting stage based on the voting results of other verification nodes on the first proposal block. In a specific implementation, after the verification node obtains the voting results of other verification nodes on the first proposal block, if more than a preset ratio threshold of other verification nodes in the voting results of the first proposal block think that the first proposal block passes the pre-voting, the verification node thinks that the first proposal block passes the pre-voting. Based on the voting of the first proposal block in the pre-voting stage, other verification nodes in the blockchain network can vote by judging whether the first proposal block is the block with the largest corresponding block height in the current proposal block. It can be understood that in order to prevent the problem of blockchain fork caused by abnormal situation, other verification nodes in the blockchain network can confirm that the first proposal block passes the pre-voting stage when the first proposal block is the block with the largest corresponding block height in the existing block.
[0042] After the verification node determines that the first proposal block passes the pre-voting, the first proposal block can be locked, and after the first proposal block enters the pre-commit stage, the second proposal block is constructed. Based on the locking of the first proposal block, the verification node will not select other proposal blocks with the same block height as the first proposal block, thereby preventing the blockchain from appearing fork due to abnormal situation. Therefore, the block height of the second proposal block constructed by the verification node in the consensus processing of the first proposal block must be greater than the block height of the first proposal block.
[0043] After the verification node constructs the second proposal block in the consensus processing of the first proposal block, the first proposal block is stored on the chain based on the consensus processing result of the first proposal block, that is, step S202 is performed.
[0044] S202, obtain the consensus processing result of the first proposal block, and store the first proposal block to the blockchain network when the consensus processing result indicates that the first proposal block consensus passes.
[0045] S203, broadcast the second proposal block in the blockchain network, so that each verification node of the blockchain network performs consensus voting on the second proposal block to obtain the consensus processing result of the second proposal block.
[0046] In step S202 and step S203, the verification node can obtain the second round voting result of the first proposal block in the pre-commit phase, i.e., the consensus processing result of the first proposal block, after the first proposal block passes the pre-vote phase and enters the pre-commit phase. The verification node determines the consensus processing result of the first proposal block by obtaining the pre-commit message from each other verification node in the blockchain network. In an embodiment, each other verification node in the blockchain network can broadcast the pre-commit message to the blockchain network when confirming that the first proposal block passes the consensus verification. Then, the verification node can determine that the first proposal block passes the consensus by counting the proportion of the other verification nodes that send the pre-commit message, and the proportion threshold can be 2 / 3 or 3 / 4, etc. In another implementation, each other verification node in the blockchain network can store the consensus verification result (including consensus pass or consensus fail) of the first proposal block in the pre-commit message. Then, the verification node can count the number of other verification nodes that confirm that the first proposal block passes the consensus and the number of other verification nodes that confirm that the first proposal block fails the consensus based on the pre-commit message obtained from each other verification node, and then determine whether the first proposal block passes the consensus.
[0047] After the verification node determines that the first proposal block passes the consensus, the verification node can store the first proposal block in the blockchain network. The verification node can call the virtual machine to execute and write the ledger (i.e., the blockchain network), and at the same time, start the next round of consensus, i.e., start the consensus of the second proposal block. In an embodiment, since the second proposal block has been created in the consensus process of the first proposal block, when starting the consensus processing of the second proposal block, the verification node directly broadcasts the generated second proposal block to the blockchain network, so that each other verification node in the blockchain network performs the consensus voting on the second proposal block, and then counts the consensus processing result of the second proposal block. In an embodiment, the verification node becomes the master node after entering the next round of consensus, i.e., the consensus processing of the second proposal block, and obtains the second proposal block. After obtaining the second proposal block, the verification node broadcasts the second proposal block to the other verification nodes in the blockchain network to perform the consensus voting on the second proposal block. If the verification node counts the consensus processing result of the first proposal block as the first proposal block failing the consensus, the verification node discards the first proposal block, selects another verification node as the master node from the other verification nodes, and triggers the pre-vote phase and the pre-commit phase.
[0048] In the embodiment of the present application, the verification node can construct the second proposal block in the consensus process of the first proposal block, and obtain the consensus result of the first proposal block after the second proposal block is constructed. Then, when the consensus result indicates that the first proposal block is consensus passed, the first proposal block is stored in the blockchain network, and the consensus process of the second proposal block is triggered. When the verification node performs the consensus process on the second proposal block, the verification node does not need to create the second proposal block because the second proposal block has been created in the consensus process of the first proposal block. Therefore, the consensus processing efficiency of the proposal block is improved, and the efficiency of storing transaction data on the blockchain is also improved, so that the throughput of the blockchain external service is improved.
[0049] Please refer to Figure 3 FIG. 1 is a schematic flowchart of a block processing method according to an embodiment of the present application. The block processing method can also be executed by the verification node described above, and specifically by the proposal component newly added to the verification node. The proposal component newly added to the verification node can pre-process the construction of the block, the signature of the block, and the serialization of the block. Specifically, the block processing method can include:
[0050] S301, adding a lock tag to the first proposal block to lock the first proposal block.
[0051] S302, constructing a second proposal block in the consensus process of the first proposal block, wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is the block with the largest corresponding block height among the existing proposal blocks.
[0052] In step S301 and step S302, the verification node can determine that when the first proposal block receives more than 2 / 3 of the other verification nodes confirming that the first proposal block passes the pre-vote in the pre-vote stage, the verification node (i.e. the proposal component specifically included in the verification node) can lock the first proposal block. In an embodiment, the verification node can lock the first proposal block by adding a lock tag to the first proposal block. After locking the first proposal block, other proposal blocks at the same block height as the first proposal block cannot enter the pre-commit stage, which can effectively prevent the blockchain from branching. The consensus processing process includes at least a pre-vote stage and a pre-commit stage. In the pre-vote stage, each verification node of the blockchain network votes on the existing proposal blocks to determine the proposal block associated with each block height from the existing proposal blocks. One block height is associated with one proposal block. In the pre-commit stage, each verification node of the blockchain network votes on the proposal blocks associated with each block height to generate a blockchain according to the result of the on-chain voting. The second proposal block is constructed when the first proposal block is in the pre-commit stage. Therefore, the verification node can obtain the pre-vote votes corresponding to the first proposal block in the pre-vote stage. When the pre-vote votes are greater than or equal to the vote threshold, the first proposal block enters the pre-commit stage. The pre-vote votes can be a preset vote value, such as 10 or 15, or a vote ratio value, such as 2 / 3 or 3 / 4.
[0053] In one embodiment, the second proposal block is constructed by a proposal component in the verification node, and the consensus processing procedure for the first proposal block is performed by the verification node, and after the first proposal block enters the pre-commit stage, the verification node can check whether it is the block node of the next round of consensus, and if so, the verification node can notify the proposal component in advance to prepare the related data of the next block (i.e. the second proposal block), such as block height, hash of the previous block, etc., to realize the creation of the second proposal block. That is, the verification node will first determine whether the verification node is the block node of the second proposal block, and generate a notification message when it is determined that the verification node is the block node; further, the notification message can be sent to the proposal component, so that the proposal component constructs the second proposal block according to the notification message. In one embodiment, after the verification node sends the notification message to the proposal component, the verification node will continue to process other messages such as pre-commit messages while the proposal component creates the second proposal block. That is, the verification node can obtain pre-commit messages from each verification node in the blockchain network, wherein the pre-commit messages are sent by any verification node after confirming that the first proposal block passes the consensus, and further, the verification node can determine the consensus processing result for the first proposal block according to the number of obtained pre-commit messages.
[0054] After the proposal component receives the notification message, it can obtain the transaction data to be packaged from the transaction pool, and then construct the second proposal block, and at the same time obtain the corresponding block information from the previous first proposal block and store it in the block header of the second proposal block. After the construction of the second proposal block is completed, the verification node can package the second proposal block as a proposal block message, and the signature information of the proposal block message, and further serialize the signature of the proposal block message and the proposal block message, so as to store the serialized code stream into the prepared proposal queue. In one embodiment, the serialization processing of the proposal block message and the corresponding signature information is to enable the proposal block message and the corresponding signature to be transmitted in a machine device, that is, the serialization processing of the proposal block message and the corresponding signature information obtains a binary code stream.
[0055] After the verification node constructs the second proposal block, it can store the first proposal block according to the consensus processing result of the first proposal block, and broadcast the second proposal block to the blockchain network for consensus processing.
[0056] S303, obtain the consensus processing result of the first proposal block, and store the first proposal block to the blockchain network when the consensus processing result indicates that the first proposal block passes the consensus.
[0057] S304, broadcast the second proposal block in the blockchain network, so that each verification node of the blockchain network performs a consensus vote on the second proposal block to obtain a consensus processing result of the second proposal block.
[0058] In step S303 and step S304, when constructing the second proposal block, the verification node first acquires a notification message indicating the generation of a new proposal block, the notification message including the block height of the block to be generated and the hash value of the first proposal block, and then acquires one or more transaction data from the transaction pool as the to-be-stored data, and constructs a new proposal block according to the notification message and the to-be-stored data, wherein the constructed new proposal block is the second proposal block. After generating the second proposal block, the verification node can generate a proposal block message and signature information for the proposal block message, the proposal block message including the second proposal block, and then can serialize the proposal block message and the signature information respectively, and store the serialized proposal block message and the serialized signature information in the proposal queue in association, so as to read the second proposal block from the proposal queue.
[0059] After the verification node stores the serialized proposal block message and the serialized signature information in the proposal queue, the verification node determines whether to store the first proposal block in the blockchain network based on the consensus processing result of the first proposal block. If it is determined that the first proposal block can be stored in the blockchain network, the virtual machine is called to execute and write the first proposal block in parallel in the ledger, and the next round of consensus phase is started, so that the second proposal block is broadcast to the blockchain network. When the verification node needs to broadcast the second proposal block in the blockchain network, the verification node can first read the serialized proposal block message and the serialized signature information stored in association in the proposal queue, then deserializes the serialized proposal block message to obtain the proposal block message, and deserializes the serialized signature information to obtain the signature information, and then performs signature verification on the signature information, and broadcasts the second proposal block included in the proposal block message in the blockchain network after passing the signature verification.
[0060] In the embodiment of the present application, the verification node can effectively prevent the occurrence of blockchain bifurcation by locking the first proposal block. Then, the verification node can concurrently generate the subsequent proposal block (i.e., the second proposal block) of the first proposal block in the consensus processing of the first proposal block. By preparing the proposal stage of the next round of consensus in advance, that is, the verification node can concurrently process the next round of consensus proposal block in the current consensus pre-commit stage, and prepare the block and write the account book in the virtual machine execution period in advance, so that the verification node can broadcast the prepared second proposal block to the verification node at the start of the next round of consensus, skipping the preparation process of the proposal message of the current round, thereby effectively improving the blockchain consensus efficiency and improving the throughput of the blockchain external business.
[0061] Based on the description of the above block processing method embodiment, the embodiment of the present application further proposes a block processing device, which can be a computer program (including program code) running in the above verification node. The block processing device can be used to execute the block processing method as described in Figure 2 and Figure 3 Please refer to Figure 4 , the block processing device includes a construction unit 401 and a processing unit 402.
[0062] The construction unit 401 is configured to construct a second proposal block in the consensus processing of a first proposal block, wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is a block with the largest corresponding block height among existing proposal blocks.
[0063] The processing unit 402 is configured to obtain a consensus processing result of the first proposal block, and store the first proposal block to a blockchain network when the consensus processing result indicates that the first proposal block passes the consensus.
[0064] The processing unit 402 is further configured to broadcast the second proposal block in the blockchain network, so that each verification node of the blockchain network performs a consensus vote on the second proposal block to obtain a consensus processing result of the second proposal block.
[0065] In one embodiment, the consensus processing process includes at least a pre-vote stage and a pre-commit stage.
[0066] In the pre-vote stage, each verification stage of the blockchain network respectively votes on the existing proposal blocks to determine the proposal block associated with each block height from the existing proposal blocks, wherein one block height is associated with one proposal block.
[0067] In the pre-committing phase, each validation node in the blockchain network respectively votes for the proposal block associated with each block height to generate the blockchain according to the voting result;
[0068] The second proposal block is constructed when the first proposal block is in the pre-committing phase.
[0069] In an embodiment, the processing unit 402 is further configured to add a lock tag to the first proposal block to lock the first proposal block.
[0070] After locking the first proposal block, other proposal blocks at the same block height as the first proposal block cannot enter the pre-committing phase.
[0071] In an embodiment, the second proposal block is constructed by a proposal component, and the proposal component is in a validation node of the blockchain network, and the consensus processing procedure for the first proposal block is performed by the validation node.
[0072] The processing unit 402 is further configured to determine whether the validation node is a block generation node of the second proposal block, and generate a notification message when it is determined that the validation node is the block generation node.
[0073] The processing unit 402 is further configured to send the notification message to the proposal component, so that the proposal component constructs the second proposal block according to the notification message.
[0074] In an embodiment, the processing unit 402 is further configured to obtain a pre-committing message from each validation node of the blockchain network, wherein the pre-committing message is sent by any validation node after confirming that the first proposal block passes the consensus.
[0075] The processing unit 402 is further configured to determine the consensus processing result for the first proposal block according to the number of obtained pre-committing messages.
[0076] In an embodiment, the processing unit 402 is further configured to obtain a notification message indicating to generate a new proposal block, and the notification message includes the block height of the block to be generated and the hash value of the first proposal block.
[0077] The processing unit 402 is further configured to obtain one or more transaction data from the transaction pool as to-be-stored data, and construct a new proposal block according to the notification message and the to-be-stored data, wherein the constructed new proposal block is a second proposal block.
[0078] In an embodiment, the processing unit 402 is further configured to generate a proposal block message and signature information corresponding to the proposal block message, the proposal block message comprising the second proposal block;
[0079] The processing unit 402 is further configured to serialize the proposal block message and the signature information respectively, and store the serialized proposal block message and the serialized signature information in a proposal queue.
[0080] In an embodiment, the processing unit 402 is specifically configured to:
[0081] read the serialized proposal block message and the serialized signature information stored in the proposal queue;
[0082] de-serialize the serialized proposal block message to obtain a proposal block message, and de-serialize the serialized signature information to obtain signature information;
[0083] perform signature verification on the signature information, and broadcast the second proposal block included in the proposal block message in the blockchain network after passing the signature verification.
[0084] In an embodiment, the processing unit 402 is further configured to obtain a pre-vote vote corresponding to the first proposal block in the pre-vote stage.
[0085] The processing unit 402 is further configured to trigger the first proposal block to enter a pre-commit stage when the pre-vote vote is greater than or equal to a vote threshold.
[0086] In an embodiment of the present application, the construction unit 401 can construct the second proposal block in the process of consensus processing of the first proposal block. After the processing unit 402 constructs the second proposal block, the processing unit 402 obtains the consensus processing result of the first proposal block, and then can store the first proposal block in the blockchain network when the consensus processing result indicates that the first proposal block passes the consensus, and trigger the consensus processing process of the second proposal block. When the processing unit 402 performs consensus processing on the second proposal block, the processing unit 402 does not need to create the second proposal block because the second proposal block has been created in the consensus process of the first proposal block. Therefore, the consensus processing efficiency of the proposal block can be improved, and the efficiency of storing transaction data on the blockchain can be improved, so that the throughput of the blockchain network can be improved.
[0087] Please refer toFigure 5 is a structural schematic block diagram of a verification node provided by an embodiment of the present application. As shown in the embodiment of the present application, the verification node can include one or more processors 501, one or more input devices 502, one or more output devices 503, and a memory 504. The processor 501, the input device 502, the output device 503, and the memory 504 are connected through a bus 505. The memory 504 is configured to store a computer program, and the computer program includes program instructions. The processor 501 is configured to execute the program instructions stored in the memory 504. Figure 5
[0088] The memory 504 can include a volatile memory, such as a random-access memory (RAM), and / or a non-volatile memory, such as a flash memory, a solid-state drive (SSD), and / or the like. The memory 504 can also include combinations of the above-mentioned types of memories.
[0089] The processor 501 can be a central processing unit (CPU). The processor 501 can further include a hardware chip. The hardware chip can be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), and / or the like. The PLD can be a field-programmable gate array (FPGA), a generic array logic (GAL), and / or the like. The processor 501 can also be a combination of the above-mentioned structures.
[0090] In the embodiment of the present application, the memory 504 is configured to store a computer program, and the computer program includes program instructions. The processor 501 is configured to execute the program instructions stored in the memory 504, so as to implement the steps of the above-mentioned corresponding method in Figure 2 and Figure 3 .
[0091] In one embodiment, the processor 501 is configured to invoke the program instructions, so as to execute the following steps.
[0092] In the consensus processing of the first proposal block, a second proposal block is constructed, wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is a block with the largest corresponding block height among existing proposal blocks;
[0093] The consensus processing result of the first proposal block is obtained, and when the consensus processing result indicates that the first proposal block passes the consensus, the first proposal block is stored in the blockchain network;
[0094] The second proposal block is broadcast in the blockchain network, so that each verification node of the blockchain network performs a consensus vote on the second proposal block to obtain a consensus processing result of the second proposal block.
[0095] In one embodiment, the consensus processing process includes at least a pre-vote stage and a pre-commit stage;
[0096] In the pre-vote stage, each verification node of the blockchain network respectively votes for an existing proposal block to determine a proposal block associated with each block height from the existing proposal blocks, wherein one block height is associated with one proposal block.
[0097] In the pre-commit stage, each verification node of the blockchain network respectively votes for a proposal block associated with each block height to generate a blockchain according to the result of the on-chain voting.
[0098] The second proposal block is constructed when the first proposal block is in the pre-commit stage.
[0099] In one embodiment, the processor 501 is configured to invoke the program instructions to perform:
[0100] A lock tag is added to the first proposal block to lock the first proposal block.
[0101] After locking the first proposal block, other proposal blocks at the same block height as the first proposal block cannot enter the pre-commit stage.
[0102] In one embodiment, the second proposal block is constructed by a proposal component, the proposal component is in a verification node of the blockchain network, and the consensus processing of the first proposal block is performed by the verification node; the processor 501 is configured to invoke the program instructions to perform:
[0103] Determine whether the verification node is a block generation node of the second proposal block, and generate a notification message when it is determined that the verification node is the block generation node.
[0104] sending the notification message to the proposal component, so that the proposal component constructs the second proposal block according to the notification message.
[0105] In one embodiment, the processor 501 is configured to invoke the program instructions for performing:
[0106] obtaining a pre-commit message from each verification node of the blockchain network, wherein the pre-commit message is sent by any verification node after confirming that the first proposal block passes the consensus;
[0107] determining a consensus processing result for the first proposal block according to the number of obtained pre-commit messages.
[0108] In one embodiment, the processor 501 is configured to invoke the program instructions for performing:
[0109] obtaining a notification message indicating generation of a new proposal block, the notification message including a block height of a block to be generated and a hash value of the first proposal block;
[0110] obtaining one or more transaction data from a transaction pool as to-be-stored data, and constructing a new proposal block according to the notification message and the to-be-stored data, wherein the constructed new proposal block is a second proposal block.
[0111] In one embodiment, the processor 501 is configured to invoke the program instructions for performing:
[0112] generating a proposal block message and signature information for the proposal block message, the proposal block message including the second proposal block;
[0113] serializing the proposal block message and the signature information respectively, and storing the serialized proposal block message and the serialized signature information in association in a proposal queue, so as to read the second proposal block from the proposal queue.
[0114] In one embodiment, the processor 501 is configured to invoke the program instructions for performing:
[0115] reading the associated stored serialized proposal block message and the serialized signature information from the proposal queue;
[0116] deserializing the serialized proposal block message to obtain a proposal block message, and deserializing the serialized signature information to obtain signature information;
[0117] The signature information is signature verified, and after passing the signature verification, a second proposal block included in the proposal block message is broadcast in the blockchain network.
[0118] In one embodiment, the processor 501 is configured to invoke the program instructions for performing:
[0119] Obtaining a pre-vote vote number corresponding to the first proposal block in the pre-vote stage;
[0120] When the pre-vote vote number is greater than or equal to a vote threshold, triggering the first proposal block to enter a pre-commit stage.
[0121] Embodiments of the present application provide a computer program product or computer program, which includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the above-mentioned method embodiments. Figure 2 or Figure 3 The computer readable storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), or the like.
[0122] The above only discloses some embodiments of the present application, and of course cannot limit the scope of the present application. Those skilled in the art can understand that all or part of the above-mentioned embodiments can be implemented, and equivalent changes made according to the claims of the present application still fall within the scope of the present application.
Claims
1. A block processing method, characterized by, The method comprises the following steps: In the process of consensus processing of the first proposal block, if the first proposal block passes the pre-vote, a lock tag is added to the first proposal block to lock the first proposal block, a second proposal block is constructed according to a notification message when the first proposal block is in the pre-commit stage, a proposal block message including the second proposal block and signature information of the proposal block message are generated, the proposal block message and the signature information are respectively subjected to serialization processing, and the serialized proposal block message and the serialized signature information are stored in a proposal queue in association, so as to read the second proposal block from the proposal queue; wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is the block with the largest corresponding block height among existing proposal blocks; wherein after locking the first proposal block, other proposal blocks at the same block height as the first proposal block cannot enter the pre-commit stage; The consensus processing result of the first proposal block is obtained, and when the consensus processing result indicates that the first proposal block passes the consensus, the first proposal block is stored in a block chain network; In the process of storing the first proposal block in the block chain network, the second proposal block is broadcast in the block chain network through deserialization processing of the proposal queue in parallel, so that each verification node of the block chain network performs consensus voting on the second proposal block to obtain a consensus processing result of the second proposal block.
2. The method of claim 1, wherein, The consensus processing process at least includes a pre-vote stage and a pre-commit stage; In the pre-vote stage, each verification stage of the block chain network respectively votes for an existing proposal block to determine the proposal block associated with each block height from the existing proposal block, wherein one block height is associated with one proposal block; In the pre-commit stage, each verification node in the block chain network respectively votes for the proposal block associated with each block height to generate a block chain according to the result of the on-chain voting; The second proposal block is constructed when the first proposal block is in the pre-commit stage.
3. The method of claim 1, wherein, The second proposal block is constructed by a proposal component, the proposal component is in a verification node of the block chain network, and the consensus processing process of the first proposal block is performed by the verification node; The method further comprises: Determining whether the verification node is a block generation node of the second proposal block, and generating a notification message when it is determined that the verification node is the block generation node; The notification message is sent to the proposal component, so that the proposal component constructs the second proposal block according to the notification message.
4. The method of claim 3, wherein, After the notification message is generated, the method further comprises: A pre-commit message is obtained from each verification node of the block chain network, wherein the pre-commit message is sent by any verification node after confirming that the first proposal block passes the consensus; According to the number of pre-submission messages obtained, the consensus processing result of the first proposal block is determined.
5. The method of claim 1, wherein, The second proposal block is constructed, including: Obtain a notification message indicating the generation of a new proposal block, the notification message including the block height of the to-be-generated block and the hash value of the first proposal block; Obtain one or more transaction data from the transaction pool as to-be-stored data, and construct a new proposal block according to the notification message and the to-be-stored data, wherein the constructed new proposal block is a second proposal block.
6. The method of claim 1, wherein, The second proposal block is broadcast in the blockchain network, including: Reading the associated stored serialized proposal block message and serialized signature information from the proposal queue; Deserializing the serialized proposal block message to obtain a proposal block message, and deserializing the serialized signature information to obtain signature information; Signature verification is performed on the signature information, and after passing the signature verification, the second proposal block included in the proposal block message is broadcast in the blockchain network.
7. The method of claim 2, wherein, The method further includes: Obtaining the pre-vote votes corresponding to the first proposal block in the pre-vote stage; When the pre-vote votes are greater than or equal to the vote threshold, triggering the first proposal block to enter the pre-submission stage.
8. A block processing device, characterized by Including: The construction unit is configured to, in the process of consensus processing of the first proposal block, if the first proposal block passes the pre-vote, add a lock tag to the first proposal block to lock the first proposal block, and when the first proposal block is in the pre-submission stage, construct a second proposal block according to a notification message, generate a proposal block message and signature information of the proposal block message, the proposal block message including the second proposal block; serialize the proposal block message and the signature information respectively, and store the serialized proposal block message and the serialized signature information in the proposal queue in association, so as to read the second proposal block from the proposal queue; wherein the block height of the second proposal block is greater than the block height of the first proposal block, and the first proposal block is the block with the largest corresponding block height among the existing proposal blocks; wherein after locking the first proposal block, other proposal blocks at the same block height as the first proposal block cannot enter the pre-submission stage; The processing unit is configured to obtain the consensus processing result of the first proposal block, and store the first proposal block in the blockchain network when the consensus processing result indicates that the first proposal block consensus passes. The processing unit is further configured to, in the process of storing the first proposal block in the blockchain network, deserializing the proposal queue in parallel to broadcast the second proposal block in the blockchain network, so that each verification node of the blockchain network performs consensus voting on the second proposal block to obtain the consensus processing result of the second proposal block.
9. A validating node, characterized in that, The computer readable storage medium stores a computer program, and the computer program comprises program instructions. The program instructions, when executed by a processor, cause the processor to perform the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program comprises program instructions. The program instructions, when executed by a processor, cause the processor to perform the method according to any one of claims 1-7.
Citation Information
Patent Citations
Consensus method and device based on block chain system
CN110517141A
Prompting message processing method and device, equipment and storage medium
CN111382456A