Block processing method, node, equipment, storage medium and program product

By obtaining the execution information and content of non-consensus blocks in the blockchain system, generating proposals and conducting voting verification, the problem of traditional blockchain consensus algorithms relying on specific programming languages ​​is solved, and lower-cost and more efficient block consensus processing is achieved.

CN120675997APending Publication Date: 2025-09-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410329870.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-19
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

Traditional blockchain consensus algorithms rely on self-developed Java virtual machine models and cannot be applied to general programming languages ​​to verify non-consensus blocks, resulting in increased block consensus costs and poor processing performance, especially when processing random number transactions.

Method used

By obtaining the execution information and block content of non-consensus blocks, a proposal is generated and broadcast to the blockchain. Other node devices vote based on the execution information and proposal to determine the consensus result, thus realizing the universal programming language verification of block consensus.

Benefits of technology

It reduces the cost of block consensus, improves the performance of processing random number transactions, saves the need to learn specific programming languages, and improves the processing efficiency of the blockchain system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120675997A_ABST
    Figure CN120675997A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a block processing method, a node, equipment, a storage medium and a program product, which are used for reducing the cost of block consensus and improving the processing performance in the processes of random number class transaction and the like. The method comprises the steps that first execution information of a first block and a second block are acquired, the first execution information is used for representing a result when a first node device transacts first block content in the first block, and the second block comprises second block content; after a first proposal is generated based on the second block content, broadcasting the first proposal and first execution information in the block chain, the first proposal and the first execution information being used for a second node device except the first node device in the block chain, and determining first voting information and second voting information; obtaining first voting information and second voting information sent by the second node equipment from the block chain; and determining a first consensus result based on the first voting information and the second voting information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of blockchain technology, and specifically to a block processing method, node, device, storage medium, and program product. Background Art

[0002] Blockchain is a decentralized, distributed ledger system characterized by data immutability, decentralization, and openness. The consensus mechanism, at the core of blockchain technology, ensures that the latest blocks are accurately added to the blockchain and that the blockchain information stored by nodes remains consistent and unforked. Consensus nodes play a crucial role in this mechanism.

[0003] In traditional blockchain consensus algorithms, consensus nodes in the blockchain typically generate proposals for blocks that haven't reached consensus, and other consensus nodes then verify the proposals. In this way, the entire blockchain uses the approval vote for the proposal as the basis for determining whether the entire block has been stored, thereby completing consensus and on-chain processing of the block. However, this traditional consensus algorithm relies on a self-developed Java virtual machine (VM) model to achieve consensus, and is not suitable for general programming languages ​​that support, for example, time and random numbers, to verify blocks that haven't reached consensus. This requires learning more specific programming languages ​​for modeling, increasing the cost of block consensus, and exhibiting poor processing performance in situations such as random number transactions. Summary of the Invention

[0004] The embodiments of the present application provide a block processing method, node, device, storage medium, and program product for reducing the cost of block consensus and improving processing performance in processes such as random number transactions.

[0005] In a first aspect, embodiments of the present application provide a block processing method. The method can be applied to a first node device in a blockchain. The method includes: obtaining first execution information of a first block and a second block, the first execution information representing the result of a transaction performed by the first node device on the first block content in the first block, the second block including the second block content, the first block and the second block being adjacent blocks in the blockchain that have not reached consensus, and the first block being located before the second block; after generating a first proposal based on the second block content, broadcasting the first proposal and the first execution information in the blockchain, the first proposal and the first execution information being used for second node devices in the blockchain other than the first node device, determining first voting information and second voting information, the first voting information representing the voting status of the second node device when voting on the first execution information, and the second voting information representing the voting status of the second node device on the first proposal; obtaining the first voting information and the second voting information sent by the second node device from the blockchain; and determining a first consensus result based on the first voting information and the second voting information, the first consensus result representing the consensus status of the first block and the consensus status of the second block.

[0006] In a second aspect, embodiments of the present application provide another block processing method. This method can be applied to a second node device in a blockchain. The method includes: obtaining the first block content of a first block and performing a transaction on the first block content to obtain second execution information of the first block, where the first block is a block that has not been agreed upon in the blockchain; obtaining a first proposal and first execution information broadcast by the first node device from the blockchain, where the first proposal is obtained by the first node device for the second block content in the second block, and the first execution information is used to represent the result of the first node device performing a transaction on the first block content, where the second block is an adjacent block that has not been agreed upon in the blockchain, and the first block is located before the second block; determining first voting information and second voting information based on the second execution information, the first execution information, and the second block content, where the first voting information is used to represent the voting status of each second node device when voting on the first execution information, and the second voting information is used to represent the voting status of each second node device on the first proposal; broadcasting the first voting information and the second voting information to the blockchain so that the first node determines a first consensus result based on the first voting information and the second voting information, where the first consensus result is used to represent the consensus status of the first block and the consensus status of the second block.

[0007] In a third aspect, embodiments of the present application provide a first node device. The first node device includes an acquisition unit and a processing unit. Exemplarily, the first node device also includes a sending unit. The acquisition unit is configured to acquire first execution information of a first block and a second block. The first execution information represents the result of a transaction performed by the first node device on the first block content within the first block. The second block includes the second block content. The first block and the second block are adjacent blocks in the blockchain that have not yet reached consensus, and the first block is located before the second block. The processing unit is configured to, after generating a first proposal based on the second block content, broadcast the first proposal and the first execution information to the blockchain. The first proposal and the first execution information are used by second node devices in the blockchain other than the first node device to determine first and second voting information. The first voting information represents the voting results of the second node device when voting on the first execution information, and the second voting information represents the voting results of the second node device on the first proposal. The acquisition unit is configured to acquire the first and second voting information sent by the second node device from the blockchain. The processing unit is configured to determine a first consensus result based on the first voting information and the second voting information, where the first consensus result is used to represent the consensus status of the first block and the consensus status of the second block.

[0008] In some optional embodiments, the acquiring unit is configured to: acquire a first number of affirmative votes from the first voting information, and acquire a second number of affirmative votes from the second voting information, wherein the first number of affirmative votes is the total number of affirmative votes for the first block in the first voting information of each second node device, and the second number of affirmative votes is the total number of affirmative votes for the second block in the second voting information of each second node device. The processing unit is configured to determine a first consensus result based on the first number of affirmative votes and the second number of affirmative votes.

[0009] In other optional embodiments, the first consensus result includes the consensus result of the first block and the consensus result of the second block; the processing unit is used to: when a first threshold condition is met, determine the consensus result of the first block as consensus passing the first block; when the second number of votes in favor meets the first threshold condition, determine the consensus result of the second block as consensus passing the first proposal; or when the second number of votes in favor does not meet the first threshold condition, determine the consensus result of the second block as consensus not passing the first proposal.

[0010] In some other optional implementations, the processing unit is further configured to, after determining that the consensus result of the first block is that the first block has been passed by consensus, perform accounting processing on the first block that has passed the consensus.

[0011] In other optional embodiments, the processing unit is further used to, before accounting processing is performed on the first block that has passed the consensus, concatenate the hash value of the first block and the first execution information to obtain target data; perform a hash operation on the target data to obtain the hash value of the first block after consensus; obtain the block height and transaction data of the first block from the content of the first block; and generate the first block that has passed the consensus based on the hash value, block height and transaction data of the first block after consensus.

[0012] In some other optional implementations, the processing unit is further configured to, after determining that the consensus result of the second block is that the first proposal is passed by consensus, perform block consensus processing on the second block corresponding to the first proposal passed by consensus.

[0013] In other optional embodiments, the sending unit is further used to send a first message on the blockchain after determining that the consensus result of the second block is that the first proposal has not been passed by consensus. The first message is used to instruct the target node device to obtain the third block content of the second block and generate a second proposal based on the third block content. The second proposal is used to perform block consensus processing on the second block in the next round of consensus stage. The target node device is one of the second node devices.

[0014] In some other optional implementations, the processing unit is further configured to determine that the consensus result of the first block is that the first block has not been passed by consensus when the first number of affirmative votes does not satisfy a first threshold condition.

[0015] In other optional embodiments, the processing unit is further configured to, after determining that the consensus result of the first block is that the first block was not passed by consensus, delete the content of the first block and obtain the content of a fourth block of the first block when determining that the consensus result of the second block is that the first proposal was passed by consensus; and in the next round of consensus phase, perform block consensus processing on the first block based on the content of the fourth block.

[0016] In other optional embodiments, the processing unit is further used to, after determining that the consensus result of the first block is that the first block has not been passed by consensus, when determining that the consensus result of the second block is that the first proposal has not been passed by consensus, delete the content of the first block and send a second message on the blockchain. The second message is used to instruct the target node device to obtain the fifth block content of the first block and generate a third proposal based on the fifth block content. The third proposal is used to perform block consensus processing on the first block in the next round of consensus stage. The target node device is one of the second node devices.

[0017] In other optional implementations, the first threshold condition includes the number of affirmative votes being greater than or equal to a preset affirmative threshold.

[0018] In a fourth aspect, an embodiment of the present application provides a second node device. The second node device includes an acquisition module and a processing module. The acquisition module is used to obtain the first block content of the first block and trade the first block content to obtain the second execution information of the first block. The first block is a block in the blockchain that has not reached consensus. The acquisition module is used to obtain the first proposal and first execution information broadcast by the first node device from the blockchain. The first proposal is obtained by the first node device for the second block content in the second block. The first execution information is used to represent the result when the first node device trades the first block content. The second block is an adjacent block in the blockchain that has not reached consensus. The first block is located before the second block. The processing module is used to determine the first voting information and the second voting information based on the second execution information, the first execution information, and the second block content. The first voting information is used to represent the voting status of each second node device when voting on the first execution information, and the second voting information is used to represent the voting status of each second node device for the first proposal. The sending module is used to broadcast the first voting information and the second voting information to the blockchain, so that the first node determines a first consensus result based on the first voting information and the second voting information. The first consensus result is used to represent the consensus status of the first block and the consensus status of the second block.

[0019] In some optional embodiments, the processing module is used to: perform a hash operation on the content of the second block to obtain a first hash value; when the first hash value and the second hash value are the same, determine that the second voting information is an affirmative vote, and the second hash value is a value obtained by performing a hash operation on the content of the second block by the remaining second node devices in the blockchain; perform a hash operation on the second execution information to obtain a hash value of the second execution information; when the hash value of the first execution information is the same as the hash value of the second execution information, determine that the first voting information is an affirmative vote, and the hash value of the first execution information is obtained by performing a hash operation on the first execution information by the first node device.

[0020] A fifth aspect of the present application provides a block processing device, comprising: a memory, an input / output (I / O) interface, and a memory. The memory is configured to store program instructions. A processor is configured to execute the program instructions in the memory to perform the block processing method corresponding to the embodiment of the first aspect described above; or to perform the block processing method corresponding to the embodiment of the second aspect described above.

[0021] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is run on a computer, it enables the computer to execute the block processing method corresponding to the implementation method of the first aspect above; or execute the block processing method corresponding to the implementation method of the second aspect above.

[0022] A seventh aspect of the embodiments of the present application provides a computer program product comprising instructions, which, when executed on a computer or processor, enables the computer or processor to execute the block processing method corresponding to the implementation of the first aspect; or to execute the block processing method corresponding to the implementation of the second aspect.

[0023] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0024] In an embodiment of the present application, the first execution information of the first block can be used to represent the result of a transaction performed by a first node device on the first block's content. Furthermore, the second block includes the second block's content. The first and second blocks are adjacent blocks in the blockchain that have not reached consensus, with the first block preceding the second block. Therefore, in this application, after a first node device in the blockchain obtains the first execution information and the second block, the first node device can generate a first proposal based on the second block's content. After generating the first proposal based on the second block's content, the first node device can broadcast the first proposal and the first execution information to the blockchain, allowing second node devices in the blockchain other than the first node device to use the first proposal and the first execution information to determine first and second voting information. The first voting information represents the voting results of the second node device when voting on the first execution information, and the second voting information represents the voting results of the second node device on the first proposal. The first node device then obtains the first and second voting information sent by the second node device from the blockchain and determines the first consensus result based on the first and second voting information. The described first consensus result is used to characterize the consensus situation of the first block and the consensus situation of the second block. In the above manner, after broadcasting the first execution information and the first proposal of the first block to the blockchain, the present application can enable other node devices to fully consider the execution results when trading the block content of the first block in the subsequent verification voting stage, and also consider the block content of the current block (i.e., the second block), thereby realizing the addition of the execution result of the previous block to the voting processing flow of the current block, and realizing the post-positioning of the transaction execution operation. In other words, the present application not only does not require the learning of more specific programming languages, but can use a general programming language to complete the block consensus, saving the cost of block consensus; it can also handle random number transactions, greatly improving the processing performance in processes such as random number transactions. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0026] Figure 1 The flowchart of traditional block consensus is shown;

[0027] Figure 2A A schematic diagram of a network architecture provided by an embodiment of the present application is shown;

[0028] Figure 2B An optional schematic diagram of a blockchain provided in an embodiment of the present application is shown;

[0029] Figure 2C An optional schematic diagram of a block provided in an embodiment of the present application is shown;

[0030] Figure 3 A flow chart of a block processing method provided by an embodiment of the present application is shown;

[0031] Figure 4 An optional schematic diagram showing the broadcast content provided by this application is shown;

[0032] Figure 5 An optional schematic diagram showing voting content provided by this application is shown;

[0033] Figure 6 A schematic diagram showing the changes in the block hash before and after consensus provided by this application is shown;

[0034] Figure 7 An optional schematic diagram showing the consensus provided by this application passing the first block;

[0035] Figure 8 An optional schematic diagram of block processing provided by this application is shown;

[0036] Figure 9 An optional schematic diagram of the first block that has not been passed by consensus provided by this application is shown;

[0037] Figure 10 An optional schematic diagram of block processing provided by this application is shown;

[0038] Figure 11 Another processing flow diagram of the block processing method provided by the present application is shown;

[0039] Figure 12 An optional schematic diagram showing the functional module structure of the first node device provided in an embodiment of the present application;

[0040] Figure 13 An optional schematic diagram showing the functional module structure of the second node device provided in an embodiment of the present application;

[0041] Figure 14 An optional schematic diagram showing the hardware structure of the block processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The embodiments of the present application provide a block processing method, node, device, storage medium, and program product for reducing the cost of block consensus and improving processing performance in processes such as random number transactions.

[0043] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0044] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0045] The terms "first," "second," "third," "fourth," and the like (if any) in the specification and claims of the present application and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the implementation of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to such processes, methods, products, or apparatus.

[0046] Blockchain is a novel application model for computer technologies, including distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a series of data blocks linked using cryptographic methods. Each block contains information about a batch of online transactions, used to verify the validity of this information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product and service layer, and the application service layer.

[0047] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operation control. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the corresponding relationship between the user's real identity and the blockchain address (authority management), etc., and under authorization, it supervises and audits the transactions of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records the valid requests to the storage after consensus is reached. For a new business request, the basic service first adapts the interface to parse and authenticate the request (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration, issuance, triggering and execution of contracts. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the contract logic is triggered by calling keys or other events to trigger execution. The contract logic is completed, and the contract upgrade and cancellation functions are also provided. The operation and control module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the release process, such as alarms, network control, and node device health status.

[0048] In a blockchain system, each blockchain node executes transactions on blocks and reaches consensus based on the results of these transactions. Once consensus is reached, the block and its resulting state data are saved to a database and uploaded to the blockchain. Conversely, if consensus is not reached, the consensus result is discarded and the next master node must re-propose (i.e., re-propose consensus on the block that did not reach consensus) and then re-run the consensus process.

[0049] Figure 1 The following is a flowchart of the traditional block consensus process. Figure 1 As shown, in the traditional block consensus scheme, the master node (e.g. Figure 1Peer1 (shown) generates a proposal based on a block that has not been agreed upon and broadcasts it on the blockchain. In this way, other consensus nodes on the blockchain (e.g. Figure 1 Peer2, Peer3, and Peer4 (shown in the figure) can obtain the proposal from the blockchain and then perform a voting verification process on it to obtain the voting information of each consensus node for the proposal. In this way, after collecting the voting information of all consensus nodes for the proposal, each consensus node determines whether consensus has been reached on the proposal based on this voting information. If the proposal is passed by consensus based on the voting information, the corresponding block of the proposal is submitted to the database. After the block is stored in the database, the transaction processing of the block in the proposal is carried out in parallel. Conversely, if the proposal is not passed by consensus based on the voting information, it is re-proposed.

[0050] However, Figure 1 The block consensus solution shown needs to rely on a self-developed VM model to complete. It is not suitable for general programming languages ​​that support time, random numbers, etc. to verify non-consensus blocks. As a result, it is necessary to learn more specific programming languages ​​for modeling, resulting in increased block consensus costs. In addition, the processing performance is poor in processing random number transactions and other situations.

[0051] Therefore, in order to solve the above-mentioned technical problems, the present invention provides a block processing method. The block processing method can be applied to the present invention. Figure 2A In the network architecture shown in Figure 2A As shown, the network architecture may include multiple node devices, such as node devices in the blockchain network and node devices outside the blockchain network. Specifically, the node devices in the blockchain network may include, for example, node devices 10a, 10b, 10c, 10d, and 10e in the blockchain network.

[0052] In other words, node devices 10a, 10b, 10c, 10d, and 10e can all be represented as blockchain nodes in a blockchain network. Blockchain nodes can include consensus nodes and synchronization nodes. Consensus nodes can share blockchain data within the blockchain network and participate in the blockchain consensus process. Synchronization nodes can share blockchain data within the blockchain network but do not have the authority to participate in the blockchain consensus process.

[0053] Node device 10f refers to a node device outside the blockchain network. Node device 10f can upload transaction data to the blockchain network in the form of network message data. After completing identity registration in the blockchain network, node device 10f can upload transaction data to the blockchain network, allowing node devices in the blockchain network to generate blocks based on the transaction data.

[0054] In the present application, each node device in the blockchain network needs to obtain the first block content of the previous block (for example, the first block mentioned in the present application). Moreover, taking a node device on the blockchain network as the first node device mentioned in the present application as an example, the first node device also needs to execute a transaction on the first block content to obtain the first execution information when the transaction is performed on the first block. For example, taking block 101 as the first block and node device 10a as the first node device as an example, after obtaining the first block content of block 101 (for example, content A), the node device 10a performs a transaction on the content A, thereby obtaining the first execution information, for example, execution information A.

[0055] Similarly, other second node devices, such as node devices 10b through 10e, also need to, after obtaining the first block content of the first block, concurrently perform transaction processing on the first block content with the first node device, thereby obtaining second execution information for the first block content from each second node device. For example, after node devices 10b through 10e each perform a transaction on the first block content of block 101 (e.g., content A), the second execution information they obtain is: execution information B, execution information C, execution information D, and execution information E, respectively.

[0056] After the first node device and each second node device determine the corresponding execution information in parallel, the first node device also needs to obtain the second block content such as transaction data for the second block (for example, block 102), and then package the second block content into a new block to generate a first proposal.

[0057] In this way, the first node device then broadcasts the first proposal and its obtained first execution information (e.g., execution information A) to the blockchain, thereby enabling other node devices in the blockchain network to perform consensus verification on the first proposal and the first execution information. In this way, each node device in the blockchain network, including the first node device, then determines the first consensus result based on the first voting information obtained during the consensus verification of the first execution information and the second voting information obtained during the consensus verification of the first proposal. The first consensus result can be used to represent the consensus status of the first block and the consensus status of the second block. Through the above method, the impact of the execution result of the transaction on the block content of the first block on the consensus verification is fully considered, as well as the impact of the block content of the current block (i.e., the second block) on the consensus verification. This allows the execution result of the previous block to be added to the voting process of the current block, thus achieving post-transaction execution. In other words, this application not only does not require the learning of multiple specific programming languages, but can also use general programming languages ​​to complete block consensus, saving block consensus costs. It can also handle random number transactions, greatly improving the processing performance of random number transactions and other processes.

[0058] It should be noted that the first and second blocks mentioned above can be understood as adjacent blocks in the blockchain that have not yet reached consensus, with the first block preceding the second block. Since a blockchain is constructed by connecting blocks one after another in series, the first and second blocks described in this application can also be understood as the first block followed by the second block in series; alternatively, the first block can be understood as the block immediately preceding the second block, though this is not a limitation in this application. For example, the first block could be block 101 in the blockchain, and the second block could be the block following block 101, such as block 102.

[0059] It is understood that the blockchain mentioned in the embodiment of the present application is a series of text records that are connected and protected by cryptography, and is composed of multiple blocks. Figure 2B As can be seen, the first block in a blockchain is called the genesis block. The genesis block consists of a block header and a block body. The block header stores the input information characteristic value, version number, timestamp, and difficulty value, while the block body stores the input information. The next block after the genesis block uses the genesis block as its parent block and also includes a block header and a block body. The block header stores the input information characteristic value of the current block, the block header characteristic value, version number, timestamp, and difficulty value of the parent block, and so on. This ensures that the block data stored in each block in the blockchain is linked to the block data stored in the parent block, ensuring the security of the input information in the block.

[0060] When generating each block in the blockchain, see Figure 2C As shown in the figure, when the consensus node of the blockchain receives input information, it verifies the input information. After verification, it stores the input information in the memory pool and updates the hash tree used to record the input information. After that, it updates the update timestamp to the time when the input information is received, tries different random numbers, and calculates the eigenvalue multiple times so that the calculated eigenvalue can satisfy the following formula:

[0061] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))

[0062] In this way, when a random number that satisfies the above formula is calculated, the corresponding information can be stored, generating a block header and block body, and obtaining the current block. Subsequently, the consensus node in the blockchain sends the newly generated block to other consensus nodes based on the node identifiers of other consensus nodes in the base chain. These other consensus nodes verify the newly generated block and, after verification, add it to their stored blockchains. As can be seen, each block contains a cryptographic hash of the previous block, a corresponding timestamp, and input information (usually represented by a hash value calculated using a Merkle tree algorithm). This design makes the block content difficult to tamper with. Distributed ledgers connected by blockchain technology allow both parties to effectively record transactions and permanently verify these transactions. Therefore, blockchain is a secure, shared, decentralized data ledger. All data is stored in a chain of blocks, and encryption technology is used to ensure traceability, non-repudiation, non-forgeability, immutability, and decentralization.

[0063] In addition, the described node devices 10a, 10b, 10c, 10d, 10e and 10f may be, for example, terminal devices or servers, etc., which are not limited in the embodiments of the present application. The terminal devices may include smart phones, desktop computers, laptop computers, tablet computers, smart speakers, vehicle-mounted devices, smart watches, wearable smart devices (such as smart watches, smart bracelets, etc.), smart voice interaction devices, smart home appliances, aircraft, handheld computers, mobile internet devices (mobile internet devices, MIDs), etc., but are not limited thereto. The server may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (context delivery networks, CDNs), and big data and artificial intelligence platforms. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0064] The aforementioned cloud computing refers to the delivery and usage model of IT infrastructure, which provides on-demand, scalable access to required resources over the Internet. In a broader sense, cloud computing refers to the delivery and usage model of services, which provide on-demand, scalable access to required services over the Internet. These services can be IT-related, software-related, internet-related, or other services. Cloud computing is the product of the integration of traditional computer and network technologies, including grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.

[0065] Cloud computing has rapidly grown with the development of the internet, real-time data streams, and the diversification of connected devices, as well as the growing demand for search services, social networks, mobile commerce, and open collaboration. Unlike conventional parallel and distributed computing, the emergence of cloud computing will fundamentally revolutionize the entire internet model and enterprise management model. In this application, cloud computing technology can be used to implement the computational and processing processes involved in the consensus phase, improving computational efficiency.

[0066] It should be noted that in actual applications, the node devices in the blockchain are Figure 2AIn addition to the node devices 10a to 10e shown, other node devices may also be included, such as node device 2, node device 3, node device 4, etc. The present application does not limit the number of node devices, device form, etc.

[0067] To facilitate understanding of the present application, a block processing method provided in an embodiment of the present application is introduced below with reference to the accompanying drawings. Figure 3 A flow chart of the block processing method provided in the embodiment of the present application is shown. Figure 3 As shown, the block processing method includes at least the following steps:

[0068] 301. A first node device obtains first execution information of a first block and a second block, where the first execution information is used to represent a result of the first node device performing a transaction on the first block content in the first block, the second block includes the second block content, the first block and the second block are adjacent blocks in the blockchain that have not reached consensus, and the first block is located before the second block.

[0069] In this example, when using blocks to store transaction data and other content on a blockchain system, the master node device on the blockchain usually generates a proposal for the unstored block, which then causes other node devices on the blockchain to perform consensus verification on the proposal to determine whether consensus has been reached on the block. Once consensus verification is complete, the block can be uploaded to the chain and stored in the database. This same consensus verification process is repeated, and each consensus-verified block is connected in series to construct the blockchain.

[0070] During consensus authentication of a non-consensus block, a first node device on the blockchain can first obtain the first execution information of the first block and the second block. The first block and the second block can be understood as adjacent non-consensus blocks on the blockchain, with the first block preceding the second block. For example, if the first block is block 101 on the blockchain, the second block can be understood as block 102 on the blockchain. Alternatively, if the first block is block 100 on the blockchain, the corresponding second block can be understood as block 101 on the blockchain.

[0071] In addition, the first block includes the first block content. Through the first block content, the block status of the first block can be known. For example, the first block content may include information such as the transaction data and block height of the first block. In addition, the first execution information of the first block described can be understood as the result of the first node device performing a transaction on the first block content in the first block. As an illustrative description, after obtaining the first block and obtaining the first block content from the first block, the first node device can perform transaction processing on the first block content, thereby determining the first execution information of the first block. For example, the first node device can perform a hash operation on the first block content to obtain the first execution information.

[0072] In addition, the second block includes second block content. Through the second block content, the block status of the second block can be known. For example, the second block content may include transaction data of the second block, block height, and other information.

[0073] 302. The second node device obtains the first block content of the first block, and performs a transaction on the first block content to obtain second execution information of the first block.

[0074] In this example, before executing the subsequent step 303, that is, before receiving the first proposal and first execution information broadcast by the first node device on the blockchain in this application, each second node device on the blockchain also needs to obtain the first block content of the first block. Furthermore, each second node device trades the first block content in parallel, thereby obtaining its own second execution information for the first block. In other words, the second execution information can be understood as the result of the second node device executing the transaction on the first block content. As an illustrative description, the second node device can perform a hash operation on the first block content to obtain the second execution information.

[0075] For example, assume that there are four node devices on the current blockchain, such as node devices 10a to node devices 10d. Among them, the first node device is node device 10a, and the corresponding second node devices are 3, namely node device 10b, node device 10c, and node device 10d. At this time, before node device 10b obtains the first proposal and first execution information sent by node device 10a from the blockchain, it needs to execute a transaction on the first block content to obtain execution information A. Similarly, node device 10c also performs the same operation as node device 10b, first executes a transaction on the first block content, and obtains execution information B. Similarly, node device 10d also performs the same operation as node devices 10a and node devices 10b, first executes a transaction on the first block content, and obtains execution information C.

[0076] In the above manner, each second node device preferentially determines its own second execution information for the first block, so that it can be used to subsequently verify the first execution information sent by the first node device to ensure whether the first block can be verified by consensus.

[0077] 303. After generating the first proposal based on the content of the second block, the first node device broadcasts the first proposal and first execution information in the blockchain.

[0078] In this example, after obtaining the second block, the first node device can obtain the second block content from the second block. Then, the first node device generates a corresponding first proposal based on the second block content. In other words, this first proposal can be used to instruct consensus verification on the second block.

[0079] After generating the first proposal, the first node device combines the first execution information and sends the first execution information and the first proposal to the blockchain by broadcasting. As an illustrative description, the first node device can broadcast the first proposal and the first execution information to the blockchain through the same message; or, the first node device can also broadcast the first proposal and the first execution information to the blockchain through different messages. The specific sending method is not limited in this application. In this way, after the first node device broadcasts the first proposal and the first execution information to the blockchain, other node devices in the blockchain except the first node device can obtain the first proposal and the first execution information from the blockchain. It should be noted that the other node devices mentioned above may include at least one or more second node devices, which is not limited in this application.

[0080] For example, Figure 4 Schematic diagram of the optional broadcast content provided by this application is shown. Figure 4As shown, the first node device maps the first execution information and the first proposal into the same broadcast message. The broadcast message includes the first execution information and the first proposal. As an illustrative example, the hash value of the first execution information can be represented by PreBlockExecHash. The first proposal includes at least the second block content of the second block, such as the block creation hash, block height, and transaction data. As an illustrative example, the block creation hash may include, but is not limited to, NextBlockGenerateHash and LastBlockGenerateHash, which represent the hash value of the first proposal. NextBlockGenerateHash can be understood as the hash value of the first proposal generated based on PreBlockExecHash; LastBlockGenerateHash can be understood as the hash value of the proposal generated based on the ExecHash of the previous block (i.e., the first block). In addition, the block height may include, but is not limited to, NextBlockHeight and LastBlockHeight. NextBlockHeight can be understood as the height corresponding to PreBlockExecHash; and LastBlockHeight can be understood as the height corresponding to PreBlockExecHash. In addition, transaction data may include but is not limited to different transactions such as Tx1, Tx2, and Tx3.

[0081] 304. The second node device obtains the first proposal and first execution information broadcast by the first node device from the blockchain.

[0082] In this example, after the first node device broadcasts the first proposal and first execution information to the blockchain, the second node device also executes a transaction on the first block content. After obtaining the second execution information, the second node device can then retrieve the first proposal and first execution information broadcast by the first node device from the blockchain. In this way, the second node device can extract the second block content of the second block from the first proposal.

[0083] 305. The second node device determines the first voting information and the second voting information based on the second execution information, the first execution information and the second block content. The first voting information is used to represent the voting status of each second node device when voting on the first execution information, and the second voting information is used to represent the voting status of each second node device for the first proposal.

[0084] In this example, after obtaining the first execution information and the first proposal from the blockchain, the second node device can clearly determine that consensus verification processing needs to be performed on the first block corresponding to the first execution information, and consensus verification processing also needs to be performed on the first proposal. Figure 5Schematic diagram of the voting content provided by this application is shown. Figure 5 As shown, the voting content includes voting for the first execution information and voting for the first proposal. During the voting process, the second node device can determine the first voting information and the second voting information based on the second execution information, the first execution information and the second block content. As an illustrative description, the vote for the first execution information can also be signed (signed), and the vote for the first proposal can also be signed; similarly, the entire voting content can also be signed. Through the above-mentioned signing method, after completing the voting processing of the first execution information and the first proposal, it can be ensured that the voting content, the first execution information, the first proposal and other contents are not tampered with, etc., thereby ensuring data security.

[0085] In some optional examples, in the process of determining the first voting information, the second node device can perform a hash operation on the second execution information to obtain a hash value of the second execution information. In this way, after the second node device extracts the hash value of the first execution information from the received first execution information, it determines whether the hash value of the first execution information is the same as the hash value of the second execution information. The hash value of the first execution information described is obtained by the first node device performing a hash operation on the first execution information. For details, please refer to the aforementioned Figure 4 When the second node device determines that the hash value of the first execution information is the same as the hash value of the second execution information, it determines that the first voting information is a positive vote.

[0086] For example, using the example of step 302 above, assume that the hash value of the first execution information calculated by node device 10a is A11, and the hash values ​​of the second execution information calculated by node device 10b, node device 10c, and node device 10c, respectively, are A2, A3, and A4. At this point, if node device 10b compares and finds that A11 and A2 are the same, node device 10b will vote in favor of the first execution information; conversely, if node device 10b compares and finds that A11 and A2 are different, node device 10b will vote against the first execution information. Similarly, for node device 10c, if it compares and finds that A11 and A3 are the same, node device 10c will vote in favor of the first execution information; conversely, if node device 10c compares and finds that A11 and A3 are different, node device 10c will vote against the first execution information. Similarly, for node device 10d, if the comparison shows that A11 is the same as A4, node device 10d will vote in favor of the first execution information; conversely, if the comparison shows that A11 is different from A4, node device 10d will vote against the first execution information.

[0087] In another optional example, in the process of determining the second voting information, the second node device may also perform a hash operation on the second block content to obtain a first hash value. Furthermore, the second node device may also obtain the second hash value from other node devices and then determine whether the first hash value is the same as the other second hash values. The second hash value described can be understood as the value obtained by performing a hash operation on the second block content by the remaining second node devices in the blockchain. In this way, when the current second node device determines that the first hash value is the same as the second hash value, it determines that the second voting information is a positive vote.

[0088] For example, taking node device 10b to node device 10d as an example, assuming that the current second node device is node device 10b, the first hash value calculated by it for the content of the second block is B11. If the remaining second node devices, that is, node device 10c and node device 10d, respectively calculate the second hash values ​​​​for the content of the second block as B2 and B3. If node device 10b determines that B11 is the same as B2, node device 10b will vote in favor of the first proposal. Similarly, if node device 10c also determines that B11 is the same as B2, node device 10c will vote in favor of the first proposal. Similarly, if node device 10d determines that B11 is the same as B2, node device 10d will also vote in favor of the first proposal.

[0089] 306. The second node device broadcasts the first voting information and the second voting information to the blockchain.

[0090] In this example, after determining the first voting information and the second voting information, the second node device can broadcast the first voting information and the second voting information to the blockchain, so that other node devices on the blockchain can know the voting status for the first execution information and the first proposal.

[0091] 307. The first node device determines a first consensus result based on the first voting information and the second voting information. The first consensus result is used to represent the consensus status of the first block and the consensus status of the second block.

[0092] In this example, after each second node device uploads its determined first and second voting information to the blockchain, the first node device can obtain the first and second voting information sent by each second node device from the blockchain. The first node device then determines the first consensus result based on the first and second voting information. As an example, during the process of determining the first consensus result, the first node device can obtain the first number of affirmative votes from the first voting information and the second number of affirmative votes from the second voting information. The first number of affirmative votes can be understood as the total number of affirmative votes for the first block in the first voting information of each second node device. The second number of affirmative votes can be understood as the total number of affirmative votes for the second block in the second voting information of each second node device. The first node device then determines the first consensus result based on the first and second numbers of affirmative votes. This first consensus result provides information on the consensus status of the first block and the second block. More specifically, the first consensus result includes the consensus results of the first block and the second block.

[0093] In one optional example, during the process of determining the first consensus result, the first node device may determine the first consensus result by determining whether the first number of votes in favor meets a first threshold condition, and determining whether the second number of votes in favor also meets the first threshold condition. As an illustrative description, the first node device determines the consensus result of the first block by determining whether the first number of votes in favor meets the first threshold condition. Similarly, the first node device determines the consensus result of the second block by determining whether the second number of votes in favor meets the first threshold condition.

[0094] As an illustrative description, the first threshold condition mentioned above may include, but is not limited to, the number of approval votes being greater than or equal to a preset approval threshold. For example, the preset approval threshold may include, but is not limited to, values ​​such as 2f+1. Here, f represents the number of nodes in the entire blockchain network that are allowed to do malicious things. Taking the first threshold condition that the number of approval votes is greater than or equal to the preset approval threshold as an example, and the preset approval threshold being 2f+1 as an example, the first node device can determine the consensus result of the first block by comparing whether the first number of approval votes is greater than or equal to 2f+1; and determine the consensus result of the second block by comparing whether the second number of approval votes is greater than or equal to 2f+1.

[0095] More specifically, if the first node device determines that the first number of votes in favor meets the first threshold condition, it can determine that the consensus result of the first block is that the first block has been passed by consensus. If the consensus has passed the first block, the node devices may not have approved the first proposal, or they may have approved the first proposal. At this point, if the first node device determines that the second number of votes in favor also meets the first threshold condition, it can determine that the consensus result of the second block is that the first proposal has been passed by consensus; conversely, if the second number of votes in favor does not meet the first threshold condition, it can determine that the consensus result of the second block is that the first proposal has not been passed by consensus.

[0096] Alternatively, if the first node device determines that the first number of votes in favor does not meet the first threshold condition, it can determine that the consensus result of the first block is that the first block was not passed by consensus. If the first block was not passed by consensus, the node devices may not have recognized the first proposal, or they may have recognized the first proposal. At this time, if the first node device determines that the second number of votes in favor also meets the first threshold condition, it can determine that the consensus result of the second block is that the first proposal was passed by consensus; conversely, if it determines that the second number of votes in favor does not meet the first threshold condition, it can determine that the consensus result of the second block is that the first proposal was not passed by consensus.

[0097] That is to say, the consensus result of the first block described in this application includes consensus passing the first block, or consensus not passing the first block. The consensus result of the second block described includes consensus passing the first proposal, or consensus not passing the first proposal. In other words, the first consensus result provided by this application may include 4 situations, namely: ① consensus passing the first block and consensus passing the first proposal; ② consensus passing the first block and consensus not passing the first proposal; ③ consensus not passing the first block and consensus passing the first proposal; ④ consensus not passing the first block and consensus not passing the first proposal. For the above situation ① and situation ②, please refer to the subsequent Figures 7 and 8 For the above cases ③ and ④, please refer to the following Figures 9 and 10 Please understand the content shown in the figure and do not elaborate on it here.

[0098] When the consensus results of the first block and the second block are in different situations, the first node device can take different actions to achieve consensus processing of the blocks. For details, please refer to the descriptions of the following situations ① to ④, namely:

[0099] Case 1: The consensus passes the first block and the consensus passes the first proposal

[0100] In some optional examples, after determining that the consensus result of the first block is a consensus-passed first block, the first node device may perform accounting processing on the consensus-passed first block. The described accounting processing of the consensus-passed first block can be understood as uploading the consensus-passed first block to the blockchain and saving it to the database.

[0101] As a schematic description, since the hash of the block changes before and after consensus, for example Figure 6 The following diagram shows the changes of the block hash before and after consensus provided by this application. Figure 6 As shown, the hash value of the block after consensus can be calculated using the hash value of the block before consensus. More specifically, a hash can be created by combining the hash value of the execution information of the block and the block before consensus, and then performing a hash operation again to obtain the hash value of the block after consensus.

[0102] Therefore, before performing accounting processing on the first block that has passed the consensus, the first node device can also generate the first block that has passed the consensus. For example, the first node device splices the hash value of the first block and the first execution information to obtain the target data. Subsequently, the first node device performs a hash operation on the target data to obtain the hash value after the consensus of the first block. In addition, the first node device also needs to obtain the block height and transaction data of the first block from the content of the first block. In this way, the first node device generates the first block that has passed the consensus based on the hash value, block height and transaction data after the consensus of the first block. For example, the hash value of the first block mentioned above can be understood as Figure 6 The block creation hash shown in , the transaction data can be understood as Figure 6 The data in the transaction set is shown in .

[0103] In other optional examples, if consensus on the first block is passed, after determining that the consensus result for the second block is consensus on the first proposal, the first node device may also perform block consensus processing on the second block corresponding to the first proposal that passed consensus. For example, the first node device and the second node device each perform a hash operation on the second block content of the second block, and then determine whether the hash values ​​calculated by each node device are the same. In this way, if the hash values ​​are the same, the consensus verification process for the second block can be completed.

[0104] Case 2: The first block is passed by consensus, but the first proposal is not passed by consensus.

[0105] In some optional examples, when the consensus passes the first block, if it is determined that the consensus result of the second block is that the first proposal has not been passed by consensus, the first node device may also send a first message on the blockchain. Through the first message, the target node device may be instructed to obtain the third block content for the second block and generate a second proposal based on the third block content. In this way, after receiving the first message, the target node device on the blockchain obtains the third block content as instructed, generates the corresponding second proposal, and also broadcasts the second proposal to the blockchain, thereby enabling the node devices on the blockchain to perform block consensus processing on the second block in the next round of consensus.

[0106] It should be noted that the target node device mentioned above can be understood as one of the second node devices. For example, according to the preset node rotation rules, a node device on the blockchain can be selected as the target node device, so that it can serve as the master node device in different consensus stages to generate and broadcast new proposals.

[0107] For example, Figure 7 Schematic diagram of the consensus provided by this application passing the first block. Figure 7 As shown in the figure, in the blockchain, the blocks submitted to the database are block 100, and the blocks not included in the database are block 101 and block 102. The previous round of consensus phase was a proposal for block 101 (i.e., the first block mentioned in this application), and the current round of consensus phase is a proposal for block 102. Figure 7 The content of this round of proposals shown includes the hash value of the execution information of block 101 (e.g., PreBlockExecHash(101)), the block creation hash (e.g., BlockGenerateHash(101)) and the block height (e.g., BlockHeight(101)) of block 101, and the block creation hash (e.g., BlockGenerateHash(102)) and the block height (e.g., BlockHeight(102)) of block 102. After voting on this content, two results can be determined: Case 1 and Case 2.

[0108] like Figure 7 As shown, in case ①, it indicates that the execution information of block 101 is approved and the proposal of block 102 is approved. In case ②, it indicates that the execution information of block 101 is approved, but the proposal of block 102 is not approved.

[0109] Regarding the above Figure 7 For the following cases, please refer to Figure 8 The optional schematic diagram of the block processing provided by this application is shown for understanding. Figure 8As shown, after the master node device (such as the first node device of the present application) broadcasts the execution information for block 101 and the proposal for block 102, the second node device 1 and the second node device 2 can vote on the execution information of block 101 and the proposal for block 102 respectively. For the second node device 1, it can determine that it has voted in favor of block 101 and voted in favor of the proposal for block 102 through the method shown in the aforementioned step 305. At this time, the first node device can determine the first number of votes in favor cast by all node devices for block 101 and the second number of votes in favor cast for the proposal for block 102, and it can be seen that the first number of votes in favor and the second number of votes in favor are both greater than or equal to 2f+1. At this time, the first node device can submit block 101 to the database and continue to perform block consensus processing on block 102 in the next round of consensus stage. Similarly, for the second node device 2, it can determine to vote in favor of block 101 and to vote against the proposal of block 102 through the method shown in the aforementioned step 305. At this time, the first node device can determine the first number of votes in favor of block 101 cast by all node devices, and the second number of votes in favor of the proposal of block 102, and know that the first number of votes in favor is greater than or equal to 2f+1, but the second number of votes in favor is less than 2f+1. At this time, the first node device can submit block 101 to the database, but it needs to inform the other new master node device to re-propose block 102 so that block consensus processing of block 102 can be performed in the next round of consensus phase.

[0110] In other optional examples, when the first number of votes in favor does not meet the first threshold condition, the first node device determines that the consensus result of the first block is that the first block was not passed by consensus. Since the second block is connected to the first block in the blockchain, in this case, regardless of whether the first proposal is subsequently passed by consensus or not, the consensus processing of the first block needs to be completed again before the consensus processing of the second block can be completed. For details, please refer to the following situations ③ and ④, that is:

[0111] Case ③: The first block is not passed by consensus, but the first proposal is passed by consensus

[0112] In some optional examples, after determining that the consensus result of the first block is that the first block was not passed by consensus, the first node device deletes the first block content and obtains the fourth block content of the first block when determining that the consensus result of the second block is that the first proposal was passed by consensus. Subsequently, the first node device performs block consensus processing on the first block based on the fourth block content in the next round of consensus phase. In other words, the first node device still acts as the master node device, deletes the first block content of the current first block, re-acquires the new block content for the first block (i.e., the fourth block content), and then performs consensus verification processing on the new block content to complete the consensus verification of the first block.

[0113] Case ④: The first block and the first proposal are not passed by consensus.

[0114] In some optional examples, after determining that the consensus result of the first block is that the first block has not been passed by consensus, the first node device deletes the content of the first block and sends a second message on the blockchain when determining that the consensus result of the second block is that the first proposal has not been passed by consensus. Through the second message, the target node device can be instructed to obtain the content of the fifth block for the first block and generate a third proposal based on the content of the fifth block. In this way, after receiving the second message, the target node device on the blockchain obtains the content of the fifth block as instructed, generates the corresponding third proposal, and also broadcasts the third proposal to the blockchain, thereby enabling the target node device on the blockchain to perform block consensus processing on the first block in the next round of consensus phase.

[0115] It should be noted that the target node device mentioned above can be understood as one of the second node devices. For example, according to the preset node rotation rules, a node device on the blockchain can be selected as the target node device, so that it can serve as the master node device in different consensus stages to generate and broadcast new proposals.

[0116] For example, Figure 9 : shows an optional schematic diagram of the first block that has not been passed by consensus provided by this application. Figure 9 As shown in the figure, in the blockchain, the blocks submitted to the database are block 100, and the blocks not included in the database are block 101 and block 102. The previous round of consensus phase was a proposal for block 101 (i.e., the first block mentioned in this application), and the current round of consensus phase is a proposal for block 102. Figure 9As can be seen from the content of this round of proposals, it includes the hash value of the execution information of block 101 (such as PreBlockExecHash(101), the block creation hash of block 101 (such as BlockGenerateHash(101) and the block height (such as BlockHeight(101), and the block creation hash of block 102 (such as BlockGenerateHash(102) and the block height (such as BlockHeight(102). After voting on this content, two results can be determined, namely situation ③ and situation ④.

[0117] like Figure 9 As shown, in case ③, it indicates that the execution information of block 101 is not recognized, and the proposal of block 102 is recognized. In case ④, it indicates that the execution information of block 101 is not recognized, and the proposal of block 102 is not recognized.

[0118] Regarding the above Figure 9 For the following cases, please refer to Figure 10 The optional schematic diagram of the block processing provided by this application is shown for understanding. Figure 10As shown, after the master node device (such as the first node device of the present application) broadcasts the execution information for block 101 and the proposal for block 102, the second node device 1 and the second node device 2 can vote on the execution information of block 101 and the proposal for block 102 respectively. For the second node device 1, it can determine that it has voted in favor of block 101 and voted in favor of the proposal for block 102 through the method shown in the aforementioned step 305. At this time, the first node device determines the first number of votes in favor of block 101 cast by all node devices, and the second number of votes in favor of the proposal for block 102. It can be seen that the first number of votes in favor is less than 2f+1 and the second number of votes in favor is greater than or equal to 2f+1. At this time, the first node device can delete the first block content of block 101, obtain the new block content of block 101 (such as the fourth block content), and continue to perform block consensus processing on block 101 in the next round of consensus phase. Similarly, for the second node device 2, it can determine to vote in favor of block 101 and to vote against the proposal of block 102 through the method shown in the aforementioned step 305. At this time, the first node device determines the first number of votes in favor cast by all node devices for block 101 and the second number of votes in favor cast for the proposal of block 102, and it can be seen that the first number of votes in favor is less than 2f+1, but the second number of votes in favor is less than 2f+1. At this time, the first node device informs the other new master node device to delete the first block content of block 101. And the new master node device (such as the second node device 2) obtains the new block content of block 101 (such as the fifth block content), and re-proposes block 101, so as to facilitate block consensus processing of block 101 in the next round of consensus stage.

[0119] Figure 11 FIG. 1 shows another processing flow diagram of the block processing method provided by this application. Figure 11 As shown, taking node device 10a, node device 10b, node device 10c and node device 10d as an example, in the current round of consensus process, node device 10a serves as the master node device. In this block processing scheme, node device 10a first obtains the first block content of the previous block (i.e., the first block of this application), and performs transaction processing on the first block content, thereby obtaining the first execution information for the first block. Similarly, node device 10b, node device 10c and node device 10d also obtain the first block content of the first block, and perform transaction processing on the first block content in parallel, thereby obtaining the second execution information for each of the first blocks.

[0120] After each node device has obtained its own execution information, node device 10a obtains the second block content of the second block and generates a first proposal based on this second block content. Node device 10a then broadcasts the first proposal and its own first execution information to the blockchain, allowing node devices 10b through 10d to learn about the first proposal and first execution information.

[0121] After receiving the first proposal and the first execution information, node device 10b verifies the first execution information and verifies the first proposal. Similarly, node device 10c and node device 10d also verify the first execution information and verify the first proposal respectively after receiving the first proposal and the first execution information. After verification, based on the voting information on the first execution information and the voting information on the first proposal, it is determined whether the consensus has passed the first block and whether the consensus has passed the first proposal. In this way, after the consensus has passed the first block and the first proposal has not been passed by consensus, a new proposal is generated in node device 10b by rotating the master node device, and the block consensus process continues. It should be noted that the specific verification method can be understood by referring to the content described in the aforementioned step 305, and will not be repeated here.

[0122] It should be noted that the above Figure 11 The first block, second block, first execution information, second execution information and other contents mentioned in the above can refer to the Figure 3 Please understand the contents shown in the figure and do not elaborate on them here.

[0123] In the embodiment of the present application, after the first execution information and the first proposal of the first block are broadcasted to the blockchain, other node devices can fully consider the execution results of the transactions on the block content of the first block and the block content of the current block (i.e., the second block) in the subsequent verification and voting phase, thereby adding the execution results of the previous block to the voting process of the current block and postponing the transaction execution operation. In other words, the present application not only does not require the learning of more specific programming languages, but can use a general programming language to complete the block consensus, saving the cost of block consensus; it can also process random number transactions, greatly improving the processing performance in processes such as random number transactions.

[0124] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of method. It can be understood that in order to realize the above functions, the hardware structure and / or software modules corresponding to the execution of each function are included. Those skilled in the art should easily realize that, in combination with the modules and algorithm steps of each example described in the embodiment disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0125] The embodiment of the present application can divide the functional modules of the device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. In actual implementation, there may be other division methods.

[0126] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0127] The first node device in the embodiment of the present application is described in detail below. Figure 12 This is an optional schematic diagram of the functional module structure of the first node device provided in the embodiment of the present application. Figure 12 As shown, the first node device may include an acquiring unit 1201 and a processing unit 1202. Exemplarily, the first node device further includes a sending unit 1203.

[0128] Acquisition unit 1201 is configured to acquire first execution information of a first block and a second block. The first execution information represents the result of a transaction performed by a first node device on the first block's content. The second block includes the second block's content. The first and second blocks are adjacent blocks in the blockchain that have not reached consensus, and the first block precedes the second block. Processing unit 1202 is configured to, after generating a first proposal based on the second block's content, broadcast the first proposal and first execution information in the blockchain. The first proposal and first execution information are used by second node devices in the blockchain other than the first node device to determine first and second voting information. The first voting information represents the voting results of the second node device when voting on the first execution information, and the second voting information represents the voting results of the second node device on the first proposal. Acquisition unit 1201 is configured to acquire the first and second voting information sent by the second node device from the blockchain. Processing unit 1202 is configured to determine a first consensus result based on the first and second voting information. The first consensus result represents the consensus results of the first and second blocks.

[0129] In some optional embodiments, the acquisition unit 1201 is configured to: acquire a first number of approval votes from the first voting information, and acquire a second number of approval votes from the second voting information, where the first number of approval votes is the total number of approval votes for the first block in the first voting information of each second node device, and the second number of approval votes is the total number of approval votes for the second block in the second voting information of each second node device. The processing unit 1202 is configured to determine a first consensus result based on the first number of approval votes and the second number of approval votes.

[0130] In some other optional embodiments, the first consensus result includes the consensus result of the first block and the consensus result of the second block; the processing unit 1202 is used to: when a first threshold condition is met, determine the consensus result of the first block as consensus passing the first block; when the second number of votes in favor meets the first threshold condition, determine the consensus result of the second block as consensus passing the first proposal; or when the second number of votes in favor does not meet the first threshold condition, determine the consensus result of the second block as consensus not passing the first proposal.

[0131] In some other optional implementations, the processing unit 1202 is further configured to, after determining that the consensus result of the first block is that the first block has passed the consensus, perform accounting processing on the first block that has passed the consensus.

[0132] In other optional embodiments, the processing unit 1202 is further used to, before accounting processing is performed on the first block that has passed the consensus, concatenate the hash value of the first block and the first execution information to obtain target data; perform a hash operation on the target data to obtain the hash value of the first block after consensus; obtain the block height and transaction data of the first block from the content of the first block; and generate the first block that has passed the consensus based on the hash value, block height and transaction data of the first block after consensus.

[0133] In some other optional implementations, the processing unit 1202 is further configured to, after determining that the consensus result of the second block is that the first proposal is passed by consensus, perform block consensus processing on the second block corresponding to the first proposal that has passed the consensus.

[0134] In other optional embodiments, the sending unit 1203 is further used to send a first message on the blockchain after determining that the consensus result of the second block is that the first proposal has not been passed by consensus. The first message is used to instruct the target node device to obtain the third block content of the second block and generate a second proposal based on the third block content. The second proposal is used to perform block consensus processing on the second block in the next round of consensus stage. The target node device is one of the second node devices.

[0135] In some other optional implementations, the processing unit 1202 is further configured to determine that the consensus result of the first block is that the first block has not been passed by consensus when the first number of affirmative votes does not meet a first threshold condition.

[0136] In other optional implementations, the processing unit 1202 is further configured to, after determining that the consensus result of the first block is that the first block was not passed by consensus, delete the content of the first block and obtain the content of a fourth block of the first block when determining that the consensus result of the second block is that the first proposal was passed by consensus; and in the next round of consensus phase, perform block consensus processing on the first block based on the content of the fourth block.

[0137] In other optional embodiments, the processing unit 1202 is further used to, after determining that the consensus result of the first block is that the first block has not been passed by consensus, when determining that the consensus result of the second block is that the first proposal has not been passed by consensus, delete the first block content and send a second message on the blockchain. The second message is used to instruct the target node device to obtain the fifth block content of the first block and generate a third proposal based on the fifth block content. The third proposal is used to perform block consensus processing on the first block in the next round of consensus stage. The target node device is one of the second node devices.

[0138] In other optional implementations, the first threshold condition includes the number of affirmative votes being greater than or equal to a preset affirmative threshold.

[0139] above Figure 12 The first node device is mainly described from the perspective of functional modules. The second node device will be described from the perspective of functional modules below. Figure 13 This is an optional schematic diagram of the functional module structure of the second node device provided in the embodiment of the present application. Figure 13 As shown, the second node device may include an acquisition module 1301 , a processing module 1302 and a sending module 1303 .

[0140] Acquisition module 1301 is configured to acquire the first block content of a first block and perform a transaction on the first block content to obtain second execution information for the first block. The first block is a block in the blockchain that has not yet reached consensus. Acquisition module 1301 is configured to acquire, from the blockchain, a first proposal and first execution information broadcast by a first node device. The first proposal is obtained by the first node device with respect to the second block content in the second block. The first execution information represents the result of the first node device performing a transaction on the first block content. The second block is an adjacent block in the blockchain that has not yet reached consensus, and the first block is located before the second block. Processing module 1302 is configured to determine first voting information and second voting information based on the second execution information, the first execution information, and the second block content. The first voting information represents the voting status of each second node device when voting on the first execution information, and the second voting information represents the voting status of each second node device on the first proposal. The sending module 1303 is used to broadcast the first voting information and the second voting information to the blockchain, so that the first node determines a first consensus result based on the first voting information and the second voting information. The first consensus result is used to represent the consensus status of the first block and the consensus status of the second block.

[0141] In some optional embodiments, processing module 1302 is used to: perform a hash operation on the content of the second block to obtain a first hash value; when the first hash value and the second hash value are the same, determine that the second voting information is an approval vote, and the second hash value is a value obtained by performing a hash operation on the content of the second block by the remaining second node devices in the blockchain; perform a hash operation on the second execution information to obtain a hash value of the second execution information; when the hash value of the first execution information is the same as the hash value of the second execution information, determine that the first voting information is an approval vote, and the hash value of the first execution information is obtained by performing a hash operation on the first execution information by the first node device.

[0142] The block processing device in the embodiment of the present application is described above from the perspective of modular functional entities. The block processing device in the embodiment of the present application is described below from the perspective of hardware processing. Figure 14 This is an optional schematic diagram of the hardware structure of the block processing device provided in the embodiment of the present application. The block processing device may have relatively large differences due to different configurations or performances, for example, it may include but is not limited to Figure 12 The first node device shown in, or Figure 13 The second node device is shown in FIG.

[0143] like Figure 14 As shown, the block processing device 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPUs) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) for storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be temporary storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), each module may include a series of instruction operations in the classification processing device. Furthermore, the central processing unit 322 can be configured to communicate with the storage medium 330 and execute a series of instruction operations in the storage medium 330 on the classification processing device 300. Exemplarily, the central processing unit 322 is used to execute the application program 342 stored in the storage medium 330, thereby implementing the block processing method provided in the above embodiment of the present application.

[0144] The block processing device 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0145] For example, Figure 14 The central processing unit 322 in the memory 332 can call the computer execution instructions stored in the memory 332 to make the block processing device execute the following Figures 3 to 11 The method in the corresponding method embodiment.

[0146] Specifically, Figure 12 The processing unit 1202 and Figure 13 The function / implementation process of the processing module 1302 can be achieved by Figure 14 The central processing unit 322 in the memory 332 calls the computer execution instructions stored in the memory 332 to achieve this. Figure 12 The acquiring unit 1201 and the sending unit 1203 in Figure 13 The functions / implementation processes of the acquisition module 1301 and the sending module 1303 can be realized by Figure 14 It is implemented by the input and output interface 358 in.

[0147] The steps performed by the classification processing device in the above embodiment can be based on the Figure 14 The block processing device structure shown.

[0148] A computer-readable storage medium is also provided in an embodiment of the present application, on which a computer program or instruction is stored. When the computer program or instruction is executed by a processor, the steps of the method described in the above embodiments are implemented.

[0149] A computer program product is also provided in an embodiment of the present application, including a computer program or instructions, which, when executed by a processor, implements the steps of the methods described in the above embodiments.

[0150] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0151] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0152] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0153] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0154] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0155] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0156] The computer program product includes one or more computer instructions. When the computer is loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website, a computer, a server or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. Available media can be magnetic media, (such as floppy disk, hard disk, tape), optical media (such as DVD) or semiconductor media (such as SSD)) etc.

[0157] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A block processing method, characterized in that: Applied to a first node device in a blockchain, the method includes: Obtaining first execution information of a first block and a second block, where the first execution information is used to represent a result of a transaction performed by the first node device on first block content in the first block, the second block includes second block content, the first block and the second block are adjacent blocks in the blockchain that have not been reached by consensus, and the first block is located before the second block; After generating a first proposal based on the content of the second block, broadcasting the first proposal and the first execution information in the blockchain, wherein the first proposal and the first execution information are used by a second node device other than the first node device in the blockchain to determine first voting information and second voting information, wherein the first voting information is used to represent the voting status of the second node device when voting on the first execution information, and the second voting information is used to represent the voting status of the second node device on the first proposal; Obtaining the first voting information and the second voting information sent by the second node device from the blockchain; A first consensus result is determined based on the first voting information and the second voting information, where the first consensus result is used to represent the consensus status of the first block and the consensus status of the second block.

2. The method according to claim 1, characterized in that Determining a first consensus result based on the first voting information and the second voting information includes: Obtaining a first number of approval votes from the first voting information, and obtaining a second number of approval votes from the second voting information, wherein the first number of approval votes is the total number of approval votes for the first block in the first voting information of each second node device, and the second number of approval votes is the total number of approval votes for the second block in the second voting information of each second node device; A first consensus result is determined based on the first number of votes in favor and the second number of votes in favor.

3. The method according to claim 2, characterized in that The first consensus result includes the consensus result of the first block and the consensus result of the second block; Determining a first consensus result based on the first number of affirmative votes and the second number of affirmative votes includes: When the first number of affirmative votes meets a first threshold condition, determining that the consensus result of the first block is that the first block is passed by consensus; When the second number of votes in favor meets the first threshold condition, the consensus result of the second block is determined to be the consensus approval of the first proposal; or when the second number of votes in favor does not meet the first threshold condition, the consensus result of the second block is determined to be the consensus failure to approve the first proposal.

4. The method according to claim 3, characterized in that After determining that the consensus result of the first block is that the consensus passes the first block, the method further includes: The first block that passes the consensus is recorded.

5. The method according to claim 4, characterized in that Before performing accounting processing on the first block that has passed consensus, the method further includes: Concatenating the hash value of the first block and the first execution information to obtain target data; Performing a hash operation on the target data to obtain a hash value after consensus on the first block; Obtaining the block height and transaction data of the first block from the content of the first block; Based on the hash value of the first block after consensus, the block height and the transaction data, the first block that passes the consensus is generated.

6. The method according to claim 3, characterized in that After determining that the consensus result of the second block is that the first proposal is approved by consensus, the method further includes: Perform block consensus processing on the second block corresponding to the first proposal that has passed consensus.

7. The method according to claim 3, characterized in that After determining that the consensus result of the second block is that the first proposal was not passed by consensus, the method further includes: A first message is sent on the blockchain, where the first message is used to instruct a target node device to obtain the third block content of the second block and generate a second proposal based on the third block content, where the second proposal is used to perform block consensus processing on the second block in a next consensus phase, and the target node device is one of the second node devices.

8. The method according to claim 3, characterized in that The method further comprises: When the first number of affirmative votes does not meet the first threshold condition, the consensus result of the first block is determined to be that the first block has not been passed by consensus.

9. The method according to claim 8, characterized in that After determining that the consensus result of the first block is that the first block has not been passed by consensus, the method further includes: When it is determined that the consensus result of the second block is that the first proposal is passed by consensus, deleting the content of the first block and obtaining the content of the fourth block of the first block; In the next round of consensus, block consensus processing is performed on the first block based on the content of the fourth block.

10. The method according to claim 8, characterized in that After determining that the consensus result of the first block is that the first block has not been passed by consensus, the method further includes: When it is determined that the consensus result of the second block is that the first proposal is not passed by consensus, the first block content is deleted, and a second message is sent on the blockchain, where the second message is used to instruct a target node device to obtain the fifth block content of the first block and generate a third proposal based on the fifth block content. The third proposal is used to perform block consensus processing on the first block in the next round of consensus phase. The target node device is one of the second node devices.

11. The method according to any one of claims 3 to 10, characterized in that The first threshold condition includes the number of affirmative votes being greater than or equal to a preset affirmative threshold.

12. A block processing method, characterized in that: Applied to a second node device in a blockchain, the method includes: Obtaining first block content of a first block and performing a transaction on the first block content to obtain second execution information of the first block, where the first block is a block in the blockchain that has not reached consensus; Obtaining a first proposal and first execution information broadcast by a first node device from the blockchain, wherein the first proposal is obtained by the first node device with respect to the content of a second block in a second block, and the first execution information is used to represent a result of a transaction performed by the first node device on the content of the first block, wherein the second block is an adjacent block on the blockchain that has not been reached consensus, and the first block is located before the second block; Determine, based on the second execution information, the first execution information, and the second block content, first voting information and second voting information, where the first voting information is used to represent a voting result of each second node device when voting on the first execution information, and the second voting information is used to represent a voting result of each second node device on the first proposal; The first voting information and the second voting information are broadcast to the blockchain, so that the first node determines a first consensus result based on the first voting information and the second voting information, where the first consensus result is used to represent the consensus status of the first block and the consensus status of the second block.

13. The method according to claim 12, characterized in that Determining first voting information and second voting information based on the second execution information, the first execution information, and the second block content includes: Performing a hash operation on the content of the second block to obtain a first hash value; When the first hash value and the second hash value are the same, determining that the second voting information is a yes vote, and the second hash value is a value obtained by performing a hash operation on the second block content by the remaining second node devices in the blockchain; Performing a hash operation on the second execution information to obtain a hash value of the second execution information; When the hash value of the first execution information is the same as the hash value of the second execution information, the first voting information is determined to be a positive vote, and the hash value of the first execution information is obtained by the first node device performing a hash operation on the first execution information.

14. A first node device, characterized in that: include: an acquiring unit, configured to acquire first execution information of a first block and a second block, wherein the first execution information is used to represent a result of a transaction performed by the first node device on first block content in the first block, the second block includes second block content, the first block and the second block are adjacent blocks in the blockchain that have not been reached by consensus, and the first block is located before the second block; a processing unit, configured to, after generating a first proposal based on the content of the second block, broadcast the first proposal and the first execution information in the blockchain, wherein the first proposal and the first execution information are used by a second node device other than the first node device in the blockchain to determine first voting information and second voting information, wherein the first voting information is used to represent a voting result of the second node device when voting on the first execution information, and the second voting information is used to represent a voting result of the second node device on the first proposal; The acquiring unit is configured to acquire, from the blockchain, the first voting information and the second voting information sent by the second node device; The processing unit is configured to determine a first consensus result based on the first voting information and the second voting information, where the first consensus result is used to represent a consensus status of the first block and a consensus status of the second block.

15. A second node device, characterized in that: include: an acquisition module, configured to acquire first block content of a first block, perform a transaction on the first block content, and obtain second execution information of the first block, wherein the first block is a block in the blockchain that has not reached consensus; The acquisition module is configured to acquire, from the blockchain, a first proposal and first execution information broadcast by a first node device, wherein the first proposal is obtained by the first node device with respect to content of a second block in a second block, and the first execution information is used to represent a result of a transaction performed by the first node device on the content of the first block, wherein the second block is an adjacent block on the blockchain that has not been reached by consensus, and the first block is located before the second block; a processing module, configured to determine, based on the second execution information, the first execution information, and the second block content, first voting information and second voting information, wherein the first voting information is used to represent a voting result of each second node device when voting on the first execution information, and the second voting information is used to represent a voting result of each second node device on the first proposal; A sending module is configured to broadcast the first voting information and the second voting information to the blockchain, so that the first node determines a first consensus result based on the first voting information and the second voting information, where the first consensus result is used to represent the consensus status of the first block and the consensus status of the second block.

16. A block processing device, characterized in that: include: An input / output interface, a processor, and a memory, wherein program instructions are stored in the memory; The processor is configured to execute program instructions stored in the memory to execute the method according to any one of claims 1 to 11; or to execute the method according to any one of claims 12 to 13.

17. A computer-readable storage medium, characterized in that The computer-readable storage medium includes instructions, and when the instructions are executed on a computer device, the computer device executes the method according to any one of claims 1 to 11; or executes the method according to any one of claims 12 to 13.

18. A computer program product, characterized in that The computer program product includes instructions, and when the instructions are executed on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 11; or execute the method according to any one of claims 12 to 13.