Data processing method, system and apparatus for blockchain, and computer device
By introducing transaction, consensus, and data message queues into the blockchain network, the data interaction process between nodes is optimized, the latency problem caused by complex node communication is solved, and the data processing performance and response speed are improved.
Patent Information
- Application Number
- PCT/CN2023/140150
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-08
- Filing Date
- 2023-12-20
- Publication Date
- 2024-11-14
AI Technical Summary
The complex communication connections between nodes in a blockchain network result in high data transmission latency and slow response speed.
By introducing transaction message queues, consensus message queues, and data message queues, centralized processing of transaction data and queue interaction of consensus data are achieved, reducing the complexity of network connections between nodes and avoiding broadcast data transmission.
It improves the data processing performance and transaction response speed of the blockchain network, reduces network resource consumption, and increases data transmission efficiency.
Smart Images

Figure CN2023140150_14112024_PF_FP_ABST
Abstract
Description
Blockchain data processing method, system, device and computer equipment
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on May 8, 2023, with application number 2023105149736, and invention name “Blockchain data processing method, system, device and computer equipment”, all contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of blockchain technology, and in particular to a blockchain data processing method, system, device, computer equipment, storage medium, and computer program product. Background Art
[0003] With the development of internet technology, blockchain has garnered increasing attention. Blockchain is a novel application model for computer technologies, integrating distributed data storage, peer-to-peer (P2P) transmission, consensus mechanisms, and encryption algorithms. Essentially, it is a decentralized database. A network based on blockchain and peer-to-peer networks is called a blockchain network, which typically consists of multiple nodes.
[0004] In related technologies, nodes in a blockchain network can communicate data through P2P. However, the communication connections between multiple nodes are complex, resulting in high data transmission delays and slow response speeds of the blockchain network.
[0005] Summary of the Invention
[0006] According to various embodiments provided in this application, a blockchain data processing method, system, apparatus, computer device, computer-readable storage medium, and computer program product are provided.
[0007] In a first aspect, the present application provides a blockchain data processing method, which is executed by a first consensus node and includes:
[0008] Transaction data is read from the transaction message queue. The transaction data is sent to the transaction message queue by the business node in the business network through the proxy node; proposal information of the target block is generated according to the transaction data, and the proposal information is sent to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. Each consensus node includes a first consensus node and each second consensus node; and when consensus is reached, the target block is sent to the data message queue, so that the business node reads the target block from the data message queue.
[0009] In a second aspect, the present application also provides a blockchain data processing device. The device includes:
[0010] A first transaction message queue interaction module is configured to read transaction data from the transaction message queue; the transaction data is sent from a service node in the service network to the transaction message queue via a proxy node;
[0011] A consensus message queue interaction module is used to generate proposal information of the target block based on the transaction data and send the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. Each consensus node includes a first consensus node and a second consensus node; and
[0012] The first data message queue interaction module is used to send the target block to the data message queue when consensus is reached, so that the business node reads the target block from the data message queue.
[0013] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed:
[0014] Transaction data is read from the transaction message queue. The transaction data is sent to the transaction message queue by the business node in the business network through the proxy node; proposal information of the target block is generated according to the transaction data, and the proposal information is sent to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. Each consensus node includes a first consensus node and each second consensus node; and when consensus is reached, the target block is sent to the data message queue, so that the business node reads the target block from the data message queue.
[0015] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0016] Transaction data is read from the transaction message queue. The transaction data is sent to the transaction message queue by the business node in the business network through the proxy node; proposal information of the target block is generated according to the transaction data, and the proposal information is sent to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. Each consensus node includes a first consensus node and each second consensus node; and when consensus is reached, the target block is sent to the data message queue, so that the business node reads the target block from the data message queue.
[0017] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:
[0018] Transaction data is read from the transaction message queue. The transaction data is sent to the transaction message queue by the business node in the business network through the proxy node; proposal information of the target block is generated according to the transaction data, and the proposal information is sent to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. Each consensus node includes a first consensus node and each second consensus node; and when consensus is reached, the target block is sent to the data message queue, so that the business node reads the target block from the data message queue.
[0019] In a sixth aspect, the present application provides a blockchain data processing method, which is executed by a proxy node, comprising:
[0020] Obtain transaction data sent by the business node; send the transaction data to the transaction message queue, so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block according to the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. When consensus is reached, the target block is sent to the data message queue, and each consensus node includes the first consensus node and each second consensus node; and reads the target block from the data message queue, and sends the target block to the business node.
[0021] In a seventh aspect, the present application also provides a blockchain data processing device. The device includes:
[0022] Transaction data acquisition module, used to obtain transaction data sent by business nodes;
[0023] The second transaction message queue interaction module is used to send transaction data to the transaction message queue, so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. When consensus is reached, the target block is sent to the data message queue. Each consensus node includes the first consensus node and each second consensus node; and
[0024] The second data message queue interaction module is used to read the target block from the data message queue and send the target block to the service node.
[0025] In an eighth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0026] Obtain transaction data sent by the business node; send the transaction data to the transaction message queue, so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block according to the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. When consensus is reached, the target block is sent to the data message queue, and each consensus node includes the first consensus node and each second consensus node; and reads the target block from the data message queue, and sends the target block to the business node.
[0027] In a ninth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0028] Obtain transaction data sent by the business node; send the transaction data to the transaction message queue, so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block according to the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. When consensus is reached, the target block is sent to the data message queue, and each consensus node includes the first consensus node and each second consensus node; and reads the target block from the data message queue, and sends the target block to the business node.
[0029] In a tenth aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:
[0030] Obtain transaction data sent by the business node; send the transaction data to the transaction message queue, so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block according to the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. When consensus is reached, the target block is sent to the data message queue, and each consensus node includes the first consensus node and each second consensus node; and reads the target block from the data message queue, and sends the target block to the business node.
[0031] In an eleventh aspect, the present application further provides a blockchain data processing system, including a business node and an agent node in a business network and a first consensus node and a second consensus node in a consensus network;
[0032] Business nodes, used to send transaction data to proxy nodes;
[0033] The proxy node is used to obtain transaction data and send the transaction data to the transaction message queue;
[0034] The first consensus node is configured to read transaction data from the transaction message queue, generate proposal information of the target block based on the transaction data, and send the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process; when consensus is reached, the target block is sent to the data message queue. Each consensus node includes the first consensus node and each second consensus node; and
[0035] The proxy node is also used to read the target block from the data message queue and send the target block to the business node.
[0036] The details of one or more embodiments of the present application are set forth in the following drawings and description. Other features, objects, and advantages of the present application will become apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] To more clearly illustrate the technical solutions of the embodiments of this application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are merely exemplary embodiments of this application, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0038] FIG1 is a diagram illustrating an application environment of a blockchain data processing method according to an embodiment;
[0039] FIG2 is a schematic diagram of a flowchart of a data processing method for a blockchain in one embodiment;
[0040] FIG3 is a schematic diagram of each service node in a service network according to an embodiment;
[0041] FIG4 is a schematic diagram of consensus nodes in a consensus network according to one embodiment;
[0042] FIG5 is a schematic diagram of the interaction between each consensus node and the consensus message queue in one embodiment;
[0043] FIG6 is a schematic diagram of interaction among a service node, a proxy node, and a consensus node through a transaction message queue, a consensus message queue, and a data message queue in one embodiment;
[0044] FIG7 is a schematic diagram of synchronizing a target block through a data node in one embodiment;
[0045] FIG8 is a schematic flow chart of a blockchain data processing method according to another embodiment;
[0046] FIG9 is a schematic flow chart of a data processing method for a blockchain according to another embodiment;
[0047] FIG10 is a schematic flow chart of a method for processing blockchain data in yet another embodiment;
[0048] FIG11 is a schematic diagram of a blockchain data processing method applied to an electronic bill scenario in one embodiment;
[0049] FIG12 is a schematic diagram of the structure of a blockchain data processing system according to one embodiment;
[0050] FIG13 is a block diagram of a data processing device for a blockchain according to an embodiment;
[0051] FIG14 is a block diagram of a data processing device for blockchain according to another embodiment;
[0052] FIG15 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0054] In this specification and the accompanying drawings, substantially the same or similar steps and elements are denoted by the same or similar reference numerals, and repeated descriptions of these steps and elements will be omitted. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance or ranking.
[0055] The blockchain data processing method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. In particular, the blockchain network includes a business network and a consensus network, the business node 102 is in the business network, the first consensus node 104 and the second consensus node 106 are in the consensus network, and the business network and the consensus network interact through the proxy node 108. The blockchain data processing method can be executed by the business node 102, or by the first consensus node 104, or by the second consensus node 106, or by the proxy node 108, or can be executed collaboratively by the business node 102, the first consensus node 104, the second consensus node 106, and the proxy node 108.
[0056] Taking the data processing method of the blockchain as an example, which is executed by the first consensus node 104, the first consensus node 104 can read the transaction data from the transaction message queue; the transaction data is sent to the transaction message queue by the business node 102 in the business network through the proxy node 108; the first consensus node 104 can generate proposal information of the target block based on the transaction data, and the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process; the first consensus node 104 can also send the target block to the data message queue when consensus is reached, so that the business node 102 can read the target block from the data message queue.
[0057] The business node 102, the first consensus node 104, the second consensus node 106 and the proxy node 108 can all be independent physical servers or service nodes in the blockchain system. The service nodes in the blockchain system form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP).
[0058] In addition, the business node 102, the first consensus node 104, the second consensus node 106 and the proxy node 108 can also be a server cluster composed of multiple physical servers, which can be cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0059] In some embodiments, as shown in FIG2 , a blockchain data processing method is provided. The method is performed by the business node, proxy node, first consensus node, or second consensus node in FIG1 . The method can also be performed collaboratively by the business node, proxy node, first consensus node, and second consensus node. The method is described by taking the first consensus node in FIG1 as an example, and includes the following steps:
[0060] Step 202: Read transaction data from the transaction message queue. The transaction data is sent to the transaction message queue by the service node in the service network through the proxy node.
[0061] Among them, the business node is deployed in the business network on the public network, the first consensus node is deployed in the consensus network of the private cloud, and the proxy node is used to forward the interaction data between the business network and the consensus network; the business network and the consensus network are layered through the proxy node to form a layered blockchain network architecture. The layered blockchain network architecture makes the consensus nodes in the private cloud more secure.
[0062] The business network includes multiple business nodes. The business node that sends transaction data can be any of these business nodes. Business nodes can be lightweight nodes (Simplified Payment Verification, SPV). SPV nodes generally only store block headers and transaction data associated with the node itself, rather than the complete blockchain data.
[0063] Exemplarily, as shown in FIG3 , each service node in the service network includes service node y1 , service node y2 , . . . , service node yn; wherein service node y1 sends transaction data to the proxy node.
[0064] Transaction data is data that has not yet been verified by the blockchain network consensus. Transaction data can be data corresponding to at least one transaction, such as logistics data, billing data, commodity transaction data, etc.
[0065] The transaction message queue is a message queue in the distributed message center, used to store transaction data. Proxy nodes and consensus nodes can interact with the transaction message queue. The transaction message queue is a one-way write / read message queue: transaction data in the transaction message queue is written by proxy nodes and read by the first consensus node. In practical applications, the distributed message center is also called a streaming message center.
[0066] In some embodiments, the consensus network includes multiple consensus nodes. The first consensus node that reads transaction data from the transaction message queue can be any one of the multiple consensus nodes. The first consensus node can be a fixed consensus node selected from the multiple consensus nodes, or multiple consensus nodes can rotate as the first consensus node, or some of the multiple consensus nodes can rotate as the first consensus node. In practical applications, the first consensus node that reads transaction data from the transaction message queue is also referred to as the first consensus node.
[0067] Exemplarily, as shown in FIG4 , the consensus nodes in the consensus network include a first consensus node g1, a second consensus node g2, a second consensus node g3, ..., a second consensus node gn; wherein the first consensus node g1 reads transaction data from the transaction message queue.
[0068] In some embodiments, when a business node needs to upload certain transaction data to the blockchain network, it sends the transaction data to the proxy node, and the proxy node sends the transaction data to the transaction message queue; when the transaction data is sent to the transaction message queue, the first consensus node reads the transaction data from the transaction message queue.
[0069] In some embodiments, the first consensus node periodically sends a data reading request to the distributed message center. When the proxy node sends the transaction data to the transaction message queue, the first consensus node reads the transaction data from the transaction message queue based on the data reading request; that is, the first consensus node actively pulls the transaction data from the transaction message queue.
[0070] In some embodiments, the first consensus node subscribes to the transaction message queue of the distributed message center. When the proxy node sends the transaction data to the transaction message queue, the distributed message center pushes the transaction data to the consensus node that subscribes to the transaction message queue, so that the first consensus node reads the transaction data from the transaction message queue.
[0071] Step 204: Generate proposal information for the target block based on the transaction data, and send the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. Each consensus node includes a first consensus node and each second consensus node.
[0072] Among them, the target block is the block data corresponding to the transaction data, and the proposal information includes the target block; it should be noted that the proposal information is essentially a consensus verification request, that is, the first consensus node can generate a consensus verification request (proposal information) for the target block based on the transaction data, and send the consensus verification request to the consensus message queue to instruct each second consensus node to read the consensus verification request from the consensus message queue. The consensus verification request is used to instruct each consensus node to reach a consensus on the target block and output its own consensus verification result. According to the consensus verification result output by each consensus node, the consensus result of the target block can be determined.
[0073] The consensus message queue is a message queue in the distributed message center, which is used to store data exchanged between multiple consensus nodes. Consensus data is the data exchanged between multiple consensus nodes during the process of reaching consensus on the target block.
[0074] Each consensus node includes all consensus nodes in the consensus network, that is, the first consensus node and multiple second consensus nodes. Consensus on the target block requires the participation of each consensus node in the consensus network.
[0075] Among them, each consensus node exchanges consensus data through the consensus message queue during the consensus process. It can be understood that during the consensus process, each consensus node reads the consensus data sent by other consensus nodes from the consensus message queue, and after consensus verification of the target block based on the read consensus data, it sends the consensus data generated by itself to the consensus message queue. In other words, the consensus message queue is equivalent to the data interaction platform of each consensus node.
[0076] In some embodiments, the first consensus node generates proposal information of the target block based on the transaction data and sends the proposal information to the consensus message queue. The first consensus node responds to each second consensus node reading the proposal information from the consensus message queue, reaches consensus on the target block based on the proposal information, and sends the consensus data generated by the consensus to the consensus message queue; the first consensus node responds to each second consensus node sending the generated consensus data to the consensus message queue, obtains the consensus data generated by each second consensus node from the consensus message queue, and continues to perform subsequent operations of reaching consensus on the target block based on the read consensus data; wherein, the consensus data generated by the second consensus node is obtained by the second consensus node reaching consensus on the target block based on the proposal information and the consensus data generated by the first consensus node; in this way, each second consensus node reads the proposal information from the consensus message queue, and the first consensus node and each second consensus node exchange consensus data through the consensus message queue during the consensus process.
[0077] Specifically, after the first consensus node sends the proposal information to the consensus message queue, the consensus message queue sends a proposal information push instruction to each second consensus node. In response to the proposal information push instruction, each second consensus node reads the proposal information from the consensus message queue. After reading the proposal information, each second consensus node sends a proposal information read completion instruction to the consensus message queue. The consensus message queue sends each proposal information read completion instruction to the first consensus node. The first consensus node responds to each proposal information read completion instruction, performs the operation of consensus on the target block, and sends the consensus data generated by the consensus to the consensus message queue. The consensus message queue sends a first consensus data push instruction to each second consensus node. In response to the first consensus data push instruction, each second consensus node reads the consensus data sent by the first consensus node from the consensus message queue, and reaches consensus on the target block based on the proposal information and the consensus data sent by the first consensus node, and sends the generated consensus data to the consensus message queue. The consensus message queue sends a second consensus data push instruction to the first consensus node. The first consensus node reads the consensus data generated by the second consensus node from the consensus message queue according to the second consensus data push instruction, and continues to perform subsequent operations of consensus on the target block based on the obtained consensus data.
[0078] In some embodiments, generating proposal information of a target block based on transaction data may be that the first consensus node packages the transaction data to obtain the target block, and generates proposal information corresponding to the target block; specifically, after the first consensus node packages the transaction data to obtain the target block, it determines the block information of the target block according to the block information on the blockchain, and generates proposal information based on the target block and the block information of the target block, the proposal information includes the target block; the block information may include the block height.
[0079] The first consensus node sends the proposal information to the consensus message queue; the second consensus node in the consensus network can read the proposal information from the consensus message queue, and each consensus node reaches a consensus on the target block in the proposal information based on the obtained proposal information; it should be noted that the first consensus node can also read the proposal information from the consensus message queue.
[0080] Each consensus node sends the consensus data generated by the consensus process to the consensus message queue, so that each consensus node can obtain the consensus data from the consensus message queue. Each consensus node interacts with the consensus data through the consensus message queue, completes the consensus on the target block, and obtains the consensus result.
[0081] It should be noted that the consensus of each consensus node on the target block based on the proposal information can be understood as the process of each consensus node jointly verifying the target block; the consensus result obtained by the consensus on the target block can be consensus or no consensus; when the consensus result of the target block is consensus, the target block can be put on the chain; when the consensus result of the target block is no consensus, the target block will not be put on the chain.
[0082] Among them, each consensus node reaches consensus on the target block based on the proposal information, including: each consensus node outputs its own consensus verification result based on the proposal information, and determines the consensus result according to the consensus verification result of each consensus node; it can be seen that the consensus data in the consensus process includes the consensus verification result.
[0083] The consensus verification result output by the consensus node can be either passed or failed. The number of passed and failed verification output by each consensus node is counted respectively. When most consensus nodes determine that the target block has passed verification, it can be determined that the consensus result of the target block is consensus. When most consensus nodes determine that the target block has failed verification, it can be determined that the consensus result of the target block is not consensus. Exemplarily, most consensus nodes can be more than 1 / 3 of all consensus nodes, or more than 1 / 2 of all consensus nodes.
[0084] The consensus verification result output by the consensus node may be a probability value of reaching a consensus. The probability value may be used to reflect the possibility that the consensus node determines that a consensus has been reached on the target block. The larger the probability value, the higher the possibility that the consensus node determines that a consensus has been reached on the target block. An average probability value is determined based on the probability values output by each consensus node, and the consensus result of the target block is determined based on the average probability value and a preset probability threshold. For example, when the average probability value is greater than the probability threshold, it is determined that the consensus result of the target block is that a consensus has been reached. When the average probability value is not greater than the probability threshold, it is determined that the consensus result of the target block is that a consensus has not been reached. Exemplarily, the probability threshold may be 30%, or may be 60%.
[0085] In addition, it can be understood that the above method of determining whether a consensus is reached is only an example. In actual applications, the method of determining whether a consensus is reached can be set according to actual needs.
[0086] In some embodiments, each consensus node can subscribe to the consensus message queue of the distributed message center to read proposal information and consensus data from the consensus message queue; for example, when the first consensus node sends proposal information to the consensus message queue, the distributed message center pushes the proposal information to each second consensus node so that each second consensus node can read the proposal information; when a consensus node sends consensus data to the consensus message queue, the distributed message center pushes the consensus data to each consensus node so that each consensus node can read the consensus data.
[0087] In some embodiments, each consensus node may periodically send a data read request to the distributed message center to read proposal information and consensus data from the consensus message queue; for example, when the first consensus node sends proposal information to the consensus message queue, each second consensus node reads the proposal information from the consensus message queue based on the data read request; when a consensus node sends consensus data to the consensus message queue, each consensus node reads the consensus data from the consensus message queue based on the data read request.
[0088] Exemplarily, as shown in FIG5 , each consensus node includes a first consensus node g1, a second consensus node g2, a second consensus node g3, …, and a second consensus node gn. The first consensus node g1 sends proposal information to a consensus message queue, and the second consensus node g2, the second consensus node g3, …, and the second consensus node gn read the proposal information from the consensus message queue; the second consensus node g2 sends the consensus data generated by consensus on the target block to the consensus message queue, and the first consensus node g1, the second consensus node g3, …, and the second consensus node gn read the consensus data from the consensus message queue.
[0089] Step 206: When consensus is reached, the target block is sent to the data message queue, so that the business node reads the target block from the data message queue.
[0090] The data message queue is a message queue in the distributed message center, used to store consensus-based target blocks. Proxy nodes and consensus nodes can interact with the data message queue. The data message queue is a one-way write / read message queue, meaning the target blocks in the data message queue can be written by consensus nodes and read by proxy nodes.
[0091] In some embodiments, when the first consensus node determines that a consensus has been reached on the target block, the first consensus node sends the consensus target block to the data message queue; when the consensus target block is sent to the data message queue, the distributed message center can send a subscription message to the proxy node, and the proxy node obtains the target block from the data message queue based on the subscription message, and forwards the target block to the business node, so that the business node reads the target block; after the business node reads the target block, it can update the local ledger through the target block.
[0092] It should be noted that, when the first consensus node determines that a consensus has been reached on the target block, it can perform an on-chain operation on the target block. That is to say, the target block in the data message queue is a block that has been on-chain.
[0093] Exemplarily, as shown in Figure 6, the business node y1 in the business network sends the transaction data to the proxy node, the proxy node sends the transaction data to the transaction message queue of the distributed message center, the first consensus node g1 obtains the transaction data from the transaction message queue, and generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue of the distributed message center, so that each second consensus node (consensus node g2, ..., consensus node gn) in the consensus network can obtain the proposal information from the consensus message queue, and each consensus node reaches a consensus on the target block based on the proposal information. Each consensus node interacts with the consensus message queue for consensus data during the consensus process. When the first consensus node g1 determines that a consensus has been reached, it sends the consensus target block to the data message queue of the distributed message center. The proxy node obtains the target block from the data message queue and forwards the target block to the business node y1, so that the business node y1 obtains the target block from the data message queue.
[0094] In related technologies, the proxy node broadcasts transaction data to each consensus node, and each consensus node obtains the transaction data through broadcasting. During the consensus process, each consensus node interacts with consensus data through point-to-point broadcasting, which makes the network connection between the proxy node and each consensus node complex, and the network connection between each consensus node is also complex. Transaction data and consensus data are frequently broadcast in a complex consensus network, resulting in the broadcast transaction data and consensus data occupying more network resources, affecting the data processing performance of the blockchain network and the response speed of transactions.
[0095] In the above-mentioned blockchain data processing method, the proxy node does not need to broadcast the transaction data sent by the business node to each consensus node, but sends the transaction data to the transaction message queue. The first consensus node obtains the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node can read the proposal information from the consensus message queue; during the consensus process, each consensus node interacts with consensus data through the consensus message queue; reduces the complexity of the network connection between the proxy node and each consensus node, as well as the complexity of the network connection between each consensus node, avoids the network resource consumption caused by broadcasting transaction data and consensus data, improves the transmission efficiency of transaction data and consensus data, and improves the data processing performance of the blockchain network and the response speed of transactions.
[0096] In some embodiments, proposal information of a target block is generated based on transaction data, and the proposal information is sent to a consensus message queue, including: packaging the transaction data to obtain a target block; generating proposal information of the target block, and sending the proposal information to a consensus message queue; the proposal information includes the target block, the block height of the target block, and the node information of the first consensus node that generates the target block.
[0097] The block height is the number of blocks of the target block on the blockchain. The block height can be used to determine the position number of the target block on the blockchain. It should be noted that the block height may not start from 1. For example, if the target block is the 100th block on the blockchain, the block height of the target block can be 99.
[0098] The node information of the first consensus node includes but is not limited to: the signature information and node identifier of the first consensus node.
[0099] In some embodiments, after the first consensus node obtains the transaction data, it packages the transaction data to obtain a new block, which is the target block; the first consensus node determines the height of the target block based on the number of blocks on the blockchain, and obtains its own signature information and node identification. The first consensus node generates proposal information based on the target block, the height of the target block, its own signature information and node identification.
[0100] In the above embodiment, after the first consensus node obtains the transaction data from the transaction message queue, it generates proposal information of the target block based on the transaction data, so as to subsequently send the proposal information to the consensus message queue, so that each consensus node reads the proposal information from the consensus message queue and reaches consensus.
[0101] In some embodiments, after generating proposal information of the target block based on the transaction data and sending the proposal information to the consensus message queue, it also includes: pre-voting on the target block based on the proposal information to obtain first pre-voting information; obtaining second pre-voting information stored by each second consensus node in the first consensus stage from the consensus message queue, and determining first voting information in the second consensus stage based on each second pre-voting information and the first pre-voting information; the second pre-voting information is obtained by each second consensus node reaching consensus on the target block based on the proposal information; sending the first voting information to the consensus message queue, so that each second consensus node reads the first voting information from the consensus message queue, reaches consensus on the target block based on the first voting information, obtains second voting information in the second consensus stage, and sends the second voting information to the consensus message queue; and obtaining each second voting information in the second consensus stage from the consensus message queue, and determining the voting approval information of the second consensus stage based on the first voting information and each second voting information.
[0102] This embodiment describes the process by which consensus nodes reach consensus on a target block. The first voting information can be used to reflect the pass / fail outcome of the first consensus phase. The approval vote information includes the number of approval votes. Consensus data includes, but is not limited to, the second pre-voting information, the first voting information, and the second voting information.
[0103] In some embodiments, after sending the proposal information to the consensus message queue, the first consensus node reads the proposal information from the consensus message queue in response to each second consensus node, and the first consensus node pre-votes on the target block based on the proposal information to obtain first pre-voting information; the first consensus node reaches consensus on the target block based on the proposal information in response to each second consensus node to obtain second pre-voting information, and sends each second pre-voting information to the consensus message queue. The first consensus node reads each second pre-voting information from the consensus message queue, determines the first voting information of the second consensus stage based on each second pre-voting information and the first pre-voting information, and sends the first voting information to the consensus message queue; the first consensus node reads the first voting information from the consensus message queue in response to the second consensus node, reaches consensus on the target block based on the first voting information, obtains second voting information of the second consensus stage, and sends the second voting information to the consensus message queue. The first consensus node obtains each second voting information of the second consensus stage from the consensus message queue, and determines the voting approval information of the second consensus stage based on the first voting information and each second voting information.
[0104] In some embodiments, the process of consensus on the target block by each consensus node may include a first consensus stage and a second consensus stage, and the first consensus stage and the second consensus stage are voting stages; next, the consensus nodes include a first consensus node g1, a second consensus node g2, a second consensus node g3, ..., a second consensus node gn as an example for explanation.
[0105] The first consensus node g1 performs consensus verification on the target block in the proposal information and obtains a consensus verification result. The consensus verification result is verification passed or verification failed. The first pre-voting information is determined based on the consensus verification result. When the consensus verification result is verification passed, the first pre-voting information can be approval information. When the consensus verification result is verification failed, the first pre-voting information can be opposition information.
[0106] The second consensus node g2 reads the proposal information from the consensus message queue, performs consensus verification on the target block based on the proposal information, obtains the consensus verification result, and determines the second pre-voting information based on the consensus verification result.
[0107] Since the proposal information may include but is not limited to the target block, the signature information and node identifier of the first consensus node that generates the target block, consensus verification of the target block based on the proposal information may include but is not limited to: verifying the validity of the first consensus node based on the node identifier of the first consensus node, verifying the validity of the signature information of the first consensus node, and verifying the validity of the Merkle tree root in the block header of the target block.
[0108] The second consensus node g2 determines that the consensus verification result is valid and further determines that the second pre-voting information is approval information when it determines that the first consensus node that generates the target block is valid, the signature information of the first consensus node is valid, and the Merkle tree root in the block header of the target block is valid. The second consensus node g2 determines that the consensus verification result is invalid and further determines that the second pre-voting information is disapproval information when it determines that any one of the first consensus node that generates the target block, the signature information of the first consensus node, and the Merkle tree root in the block header of the target block is invalid.
[0109] The validity of the first consensus node that generates the target block is verified based on the node identifier of the first consensus node, which can be to determine whether the node identifier is in the node committee list. When the node identifier is in the node committee list, it is determined that the consensus node that generates the target block is in a working state, and further determines that the first consensus node is valid; when the node identifier is not in the node committee list, it is determined that the first consensus node is invalid.
[0110] Verifying the validity of the signature information of the first consensus node that generates the target block can be done by verifying the signature information based on the public key of the first consensus node. If the verification passes, it is determined that the signature information of the first consensus node is valid; if the verification fails, it is determined that the signature information of the first consensus node is invalid. The signature information can be encrypted by the first consensus node using its private key.
[0111] Verifying the validity of the Merkle root in the block header of the target block may be to recalculate the Merkle root. When the calculated Merkle root is consistent with the Merkle root in the block header of the target block, the Merkle root in the block header of the target block is determined to be valid. When the calculated Merkle root is inconsistent with the Merkle root in the block header of the target block, the Merkle root in the block header of the target block is determined to be invalid.
[0112] The second consensus nodes g3, ..., and the second consensus node gn can determine the second pre-voting information in the same manner as the second consensus node g2 described above; the second consensus nodes g2, the second consensus nodes g3, ..., and the second consensus node gn send their respective second pre-voting information to the consensus message queue, and each consensus node can obtain the second pre-voting information of other consensus nodes from the consensus message queue. Of course, the first consensus node g1 can obtain the second pre-voting information obtained by the second consensus nodes g2, the second consensus nodes g3, ..., and the second consensus node gn from the consensus message queue when they reach consensus on the target block.
[0113] The first consensus node g1 determines the first voting information of the second consensus stage based on the first pre-voting information and each second pre-voting information, and sends the first voting information to the consensus message queue, so that the second consensus node g2, the second consensus node g3, ..., the second consensus node gn obtains the first voting information from the consensus message queue.
[0114] When the second consensus node g2 obtains the first voting information from the consensus message queue, it can be determined that the first consensus phase has ended. The second consensus node g2 then performs a second consensus verification on the target block to obtain the second voting information for the second consensus phase. The process by which the second consensus node g2 performs the second consensus verification on the target block and obtains the second voting information in the second consensus phase is the same as the process by which the second consensus node g2 performs the first consensus verification on the target block and obtains the second pre-voting information in the first consensus phase. The second consensus nodes g3, ..., and gn also determine the second voting information in the same manner as the second consensus node g2.
[0115] The second consensus node g2, the second consensus node g3, ..., the second consensus node gn send their respective second voting information to the consensus message queue. Each consensus node can obtain the second voting information of other consensus nodes from the consensus message queue. Of course, the first consensus node g1 can also obtain the second pre-voting information obtained by the second consensus node g2, the second consensus node g3, ..., the second consensus node gn from the consensus message queue.
[0116] The voting approval information of the second consensus stage is the number of votes in favor of the second consensus stage; based on the first voting information and each second voting information, the voting approval information of the second consensus stage is determined, and the first consensus node g1 obtains the first preset weight of the first consensus stage and the second preset weight of the second consensus stage, and performs weighted summation of the number of votes in favor of the first voting information and each second voting information according to the first preset weight and the second preset weight to obtain the voting approval information of the second consensus stage.
[0117] The voting approval information of the second consensus stage (the number of votes in favor of the second consensus stage) is used to determine the consensus result of the target block; illustratively, when the number of votes in favor of the second consensus stage is greater than 1 / 3 of the total number of consensus nodes, the consensus result of the target block can be determined to be consensus reached; when the number of votes in favor of the second consensus stage is not greater than 1 / 3 of the total number of consensus nodes, the consensus result of the target block can be determined to be no consensus reached; illustratively, when the number of votes in favor of the second consensus stage is greater than the second preset number of votes, the first consensus node determines that the consensus result of the target block is consensus reached; when the number of votes in favor of the second consensus stage is not greater than the second preset number of votes, the first consensus node determines that the consensus result of the target block is no consensus reached; the second preset number of votes can be set according to actual needs, for example, the second preset number of votes can be 1 / 2 of the total number of consensus nodes in the consensus network; the embodiment of the present application does not limit the second preset number of votes.
[0118] During the consensus process, some consensus nodes may be unable to perform consensus verification or send voting information in time due to network delays or network disconnections, resulting in a low number of votes in favor and difficulty in reaching consensus. The above embodiment reaches consensus on the target block through two consensus stages, and determines the number of votes in favor based on the voting information of the two consensus stages. More votes in favor can be counted, avoiding the situation where some consensus nodes are unable to send voting information due to network delays or network disconnections, thereby increasing the probability of reaching consensus; and data interaction between consensus nodes is realized through the consensus message queue, avoiding the situation where point-to-point data interaction between consensus nodes causes complex network connections, reducing network broadcast load, and improving the transmission efficiency of consensus data. In addition, the consensus message queue allows more consensus nodes to access without increasing the complexity of network connections, thereby improving the data processing performance and transaction response speed of the blockchain network.
[0119] In some embodiments, determining the first voting information of the second consensus stage based on each second pre-voting information and the first pre-voting information includes: determining the voting approval information of the first consensus stage based on each second pre-voting information and the first pre-voting information; determining the first voting information of the second consensus stage based on the voting approval information of the first consensus stage.
[0120] Among them, the voting approval information of the first consensus stage can reflect the number of approval information in the first consensus stage. The voting result of the first consensus stage can be determined based on the voting approval information of the first consensus node; the voting result of the first consensus stage is pass or fail.
[0121] The first voting information is approval information or disapproval information, which can be used to reflect whether the voting result in the second consensus stage is passed or not.
[0122] In some embodiments, the first pre-voting information includes approval information or disapproval information, and the second pre-voting information also includes approval information or disapproval information; the first consensus node g1 counts the number of approval information in the first pre-voting information and each second pre-voting information to obtain the approval voting information of the first consensus stage; when the first consensus node g1 determines that the voting result of the first consensus stage is passed based on the approval voting information of the first consensus stage, the first voting information is approval information; when the first consensus node g1 determines that the voting result of the first consensus stage is not passed based on the approval voting information of the first consensus stage, the first voting information is disapproval information.
[0123] In some embodiments, the first consensus node g1 determines whether the number of affirmative votes in the first consensus stage meets the passing condition. When the number of affirmative votes in the first consensus stage meets the passing condition, the voting result of the first consensus stage is determined to be passed, and then the first voting information is determined to be affirmative information; when the number of affirmative votes in the second consensus stage does not meet the passing condition, the voting result of the second consensus stage is determined to be failed, and then the first voting information is determined to be negative information.
[0124] In the above embodiment, the first consensus node determines the voting approval information of the first consensus stage based on the first pre-voting information and the second pre-voting information, and then determines the first voting information of the second consensus stage, so as to subsequently determine the voting approval information of the second consensus stage.
[0125] In some embodiments, the voting approval information of the first consensus stage includes the number of approval information in the first consensus stage; based on the voting approval information of the first consensus stage, determining the first voting information of the second consensus stage includes: when the number of approval information in the first consensus stage is greater than or equal to the first preset number of votes, determining that the first voting information in the second consensus stage is approval information; when the number of approval information in the first consensus stage is less than the first preset number of votes, determining that the first voting information in the second consensus stage is disapproval information.
[0126] The first preset number of votes can be set based on the total number of consensus nodes in the consensus network. For example, the first preset number of votes can be half of the total number of consensus nodes, or the first preset number of votes can be 1 / 3 of the total number of consensus nodes. The embodiment of the present application does not limit the value of the first preset number of votes.
[0127] In some embodiments, when the number of affirmative votes in the first consensus stage is greater than or equal to the first preset number of votes, it can be determined that the number of affirmative votes in the first consensus stage meets the passing condition, and then the first voting information is determined to be affirmative information; when the number of affirmative votes in the first consensus stage is less than the first preset number of votes, it is determined that the number of affirmative votes in the first consensus stage does not meet the passing condition, and the first voting information in the second consensus stage is determined to be negative information.
[0128] Exemplarily, the first preset number of votes can be 1 / 3 of the total number of consensus nodes. The first consensus node g1 counts the number of approval information in each second pre-voting information and the first pre-voting information. When the number of approval information is greater than or equal to 1 / 3 of the total number of consensus nodes in the consensus network, the first voting information is determined to be approval information. When the number of approval information is less than 1 / 3 of the total number of consensus nodes in the consensus network, the first voting information is determined to be disapproval information.
[0129] In the above embodiment, the first voting information of the second consensus stage is determined based on the quantitative relationship between the number of affirmative information and the first preset number of votes in the first consensus stage, so that the first vote is determined based on the voting situation of each consensus node, thereby improving the accuracy of the consensus result.
[0130] In some embodiments, determining the voting approval information of the second consensus stage based on the first voting information and each second voting information includes: summing the number of approval information in the first voting information and the second voting information to obtain the voting approval information of the second consensus stage.
[0131] The first voting information is either approval information or disapproval information, and each second voting information is either approval information or disapproval information; the first consensus node g1 counts the number of approval information in the first voting information and each second voting information, that is, sums the number of approval information in the first voting information and the second voting information to obtain the number of approval votes in the second consensus stage, that is, the approval voting information in the second consensus stage.
[0132] In the above embodiment, the number of approval information in the first voting information and the second voting information is directly summed to obtain the approval voting information of the second consensus stage, which reduces the amount of calculation for determining the approval voting information of the second consensus stage and improves the efficiency of determining the approval voting information of the second consensus stage.
[0133] In some embodiments, when consensus is reached, the target block is sent to the data message queue, including: when the voting approval information of the second consensus stage meets the consensus conditions, synchronizing the target block to the data node so that the data node sends the target block to the data message queue.
[0134] The voting approval information of the second consensus stage includes the number of votes in favor of the second consensus stage; the voting approval information of the second consensus stage satisfies the consensus condition, which may be that the number of votes in favor of the second consensus stage is greater than or equal to the second preset number of votes.
[0135] A data node is a node deployed in the consensus network and is used to synchronize the target blocks that have reached consensus among the consensus nodes. In actual applications, a data node can connect to multiple consensus nodes to synchronize data from multiple consensus nodes.
[0136] In some embodiments, the process of consensus on the target block by each consensus node further includes a determination phase; in the determination phase, the first consensus node can determine whether the number of votes in favor of the second consensus phase is greater than or equal to a second preset number of votes. When the number of votes in favor of the second consensus phase is greater than or equal to the second preset number of votes, the first consensus node determines that the target block has reached consensus, and the first consensus node uploads the target block that has reached consensus to the chain to complete the consensus process. The first consensus node sends the target block to the data node so that the data node obtains the target block that has reached consensus, and the data node sends the target block to the data message queue.
[0137] It should be noted that when the target block is sent to the data message queue through the data node, the data message queue is written by the data node and read by the proxy node.
[0138] Exemplarily, as shown in FIG7 , when the first consensus node g1 determines that a consensus has been reached on the target block, the first consensus node g1 synchronizes the target block to the data node h1 , and the data node h1 sends the target block on which consensus has been reached to the data message queue.
[0139] In the above embodiment, when the number of affirmative votes in the second consensus stage meets the consensus conditions, the target block is synchronized to the data node, so that the data node includes data consistent with the consensus node, so as to realize the backup of the data of the consensus node and ensure the security of the data in the consensus node; by sending the target block to the data message queue, the consensus node does not need to directly interact with the data message queue for data, thereby improving the consensus efficiency of the consensus node; and the proxy node can read the target block from the data message queue, and does not need to obtain the target block broadcast by the consensus node in a point-to-point manner, thereby reducing the resource consumption caused by the broadcast, reducing the complexity of the network connection between the proxy node and the consensus node, improving the transmission efficiency of the consensus target block, and improving the data processing performance of the blockchain network and the response speed of transactions.
[0140] In some embodiments, the blockchain data processing method further includes: generating a purge instruction based on the target block upon reaching consensus; and sending the purge instruction to the distributed message center, the purge instruction being used to instruct the distributed message center to purge transaction data from the transaction message queue. The purge instruction is used to purge transaction data from the transaction message queue.
[0141] In some embodiments, after the first consensus node determines that a consensus has been reached on the target block, it performs an on-chain operation on the target block and generates a clearing instruction corresponding to the target block. The first consensus node sends the clearing instruction to the distributed message center, and the distributed message center clears the transaction data corresponding to the target block according to the clearing instruction corresponding to the target block.
[0142] In some embodiments, the clear instruction may include a data identifier of the transaction data corresponding to the target block, and there is a corresponding relationship between the data identifier and the transaction data; the distributed message center obtains the data identifier in the clear instruction and clears the transaction data corresponding to the data identifier to achieve the clearing of the transaction data corresponding to the target block.
[0143] In the above embodiment, after reaching a consensus, the transaction data that does not need to be processed in the transaction message queue is cleared through a clear instruction, which can ensure the data throughput capacity of the message queue in the distributed message center and improve data interaction efficiency.
[0144] In some embodiments, the data processing method of the blockchain also includes, when consensus is reached, generating a clearing instruction based on the target block, and sending the clearing instruction to the data node to instruct the data node to send a first instruction and a second instruction to the distributed message center, the first instruction being used to clear the proposal information in the consensus message queue, and the second instruction being used to clear the transaction data in the transaction message queue.
[0145] In some embodiments, after the first consensus node determines that a consensus has been reached on the target block, it performs an on-chain operation on the target block and generates a clearing instruction corresponding to the target block, where the clearing instruction includes the block height of the target block and the data identifier of the corresponding transaction data; the first consensus node sends the clearing instruction to the data node, the data node obtains the block height and data identifier in the clearing instruction, generates a first instruction based on the block height, and generates a second instruction based on the data identifier, the data node sends the first instruction and the second instruction to the distributed message center, and the distributed message center clears the proposal information in the consensus message queue according to the block height included in the first instruction, and clears the transaction data in the transaction message queue according to the data identifier included in the second instruction.
[0146] In some embodiments, the first instruction can also be used to clear the consensus data corresponding to the proposal information in the consensus message queue, that is, the voting information generated during the consensus process. By maintaining the data in the message queues of the distributed message center through data nodes, data that does not require subsequent processing can be cleared from the message queues of the distributed message center in a timely manner, thereby ensuring the data throughput capacity of the message queues of the distributed message center and improving data exchange efficiency.
[0147] In some embodiments, the blockchain data processing method also includes: sending a connection request to a distributed message center, where the connection request is used to instruct the distributed message center to perform identity authentication based on the connection request; if the identity authentication is passed, establishing a data connection with the consensus message queue of the distributed message center.
[0148] The connection request is sent by the first consensus node when it wants to establish a data connection with the consensus message queue. Passing the authentication process indicates that the node sending the connection request is a consensus node.
[0149] In some embodiments, the distributed message center receives a connection request and performs identity authentication based on the connection request. When the identity authentication is passed, it indicates that the node sending the connection request is a consensus node, and the distributed message center establishes a data connection between the consensus node and the consensus message queue.
[0150] The distributed message center performs identity authentication based on the connection request. It can obtain the identity carried in the connection request and the ciphertext information obtained by symmetric encryption. The distributed message obtains the symmetric key corresponding to the identity from the pre-saved symmetric key table, and decrypts the ciphertext information using the symmetric key. When the decryption is successful, it is determined that the identity authentication is successful.
[0151] Since each consensus node in the consensus network needs to establish a data connection with the consensus message queue, the second consensus node can send a connection request to the distributed message center. When the connection request sent by the second consensus node passes the identity authentication, the distributed message center establishes a data connection with the second consensus node.
[0152] In the above embodiment, when a consensus node accesses the consensus message queue, identity authentication is required. If the identity authentication is passed, a data connection is established between the consensus node and the consensus message queue, so that only the consensus node can access the consensus message queue, and then only the consensus node can read the data in the consensus message queue, thereby ensuring the security of the consensus node in data interaction through the consensus message queue.
[0153] In some embodiments, the connection request includes verification data, which is encrypted based on the private key of the consensus node; identity authentication is performed based on the connection request, including: decrypting the verification data using the pre-acquired public key of the consensus node; and when the decryption is successful, determining that the identity authentication is passed.
[0154] In some embodiments, the first consensus node sends a connection request to the distributed message center, the connection request including verification data encrypted by the first consensus node using its own private key. The distributed message center obtains the verification data in the connection request and decrypts the verification data using the public key of the first consensus node. When the decryption is successful, it is determined that the identity authentication is passed, and the distributed message center then establishes a data connection between the first consensus node and the consensus message queue. When the decryption is unsuccessful, it is determined that the identity authentication is failed, and the data connection between the first consensus node and the consensus message queue is not established.
[0155] Similarly, the second consensus node can send a connection request to the distributed message center. The connection request includes verification data encrypted by the second consensus node using its own private key. The distributed message center decrypts the verification data using the public key of the second consensus node. When the decryption is successful, it is determined that the identity authentication is passed, and the distributed message center establishes a data connection between the second consensus node and the consensus message queue. If the decryption is unsuccessful, it is determined that the identity authentication is failed, and the data connection between the second consensus node and the consensus message queue is not established.
[0156] In the above embodiment, the distributed message center uses the public key of the consensus node to decrypt the verification data for identity authentication, which improves the security of identity authentication and makes the data in the consensus message queue readable only by the consensus node, thereby ensuring the security of data interaction between the consensus nodes through the consensus message queue.
[0157] In some embodiments, the data processing method of the blockchain also includes: when it is impossible to establish a data connection with the distributed message center, broadcasting interaction status information to other consensus nodes through a point-to-point connection, so as to enable data interaction with other consensus nodes through a point-to-point connection.
[0158] Among them, the interaction status information is used to indicate that the consensus node cannot connect to the distributed message center for data connection.
[0159] In some embodiments, when a consensus node is unable to establish a data connection with a distributed message center, the consensus node broadcasts interaction status information to other consensus nodes through a point-to-point connection. The interaction status information may include verification data encrypted by the consensus node using its own private key. Other consensus nodes can use the public key of the consensus node to decrypt the verification data. When the decryption is successful, data interaction is performed with the consensus node through point-to-point broadcasting.
[0160] In the above embodiment, when a consensus node cannot establish a data connection with the distributed message center, it can interact with other consensus nodes through point-to-point broadcasting. Data interaction between consensus nodes is ensured through multiple interaction methods, thereby ensuring that the blockchain network can process transaction data normally.
[0161] In some embodiments, as shown in FIG8 , the data processing method of the blockchain includes:
[0162] Step 801: The first consensus node reads transaction data from the transaction message queue. The transaction data is sent to the transaction message queue by the business node in the business network through the proxy node.
[0163] In step 802, the first consensus node packages the transaction data to obtain a target block; generates proposal information for the target block and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue; the proposal information includes the target block, the block height of the target block, and the node information of the first consensus node;
[0164] In step 803, the first consensus node pre-votes on the target block based on the proposal information, obtains first pre-voting information, obtains second pre-voting information stored by each second consensus node in the first consensus phase from the consensus message queue, and determines the approval vote information for the first consensus phase based on each second pre-voting information and the first pre-voting information. The approval vote information for the first consensus phase includes the number of approval messages in the first consensus phase. The second pre-voting information is obtained by each second consensus node through consensus on the target block based on the proposal information.
[0165] Step 804: When the number of affirmative votes in the first consensus phase is greater than or equal to the first preset number of votes, the first voting information in the second consensus phase is determined to be affirmative information; when the number of affirmative votes in the first consensus phase is less than the first preset number of votes, the first voting information in the second consensus phase is determined to be negative information.
[0166] Step 805: The first consensus node sends the first voting information to the consensus message queue, so that each second consensus node reads the first voting information from the consensus message queue, reaches consensus on the target block based on the first voting information, obtains second voting information for the second consensus phase, and sends the second voting information to the consensus message queue.
[0167] Step 806: The first consensus node obtains each second voting information of the second consensus stage from the consensus message queue, and sums the number of approval information in the first voting information and the second voting information to obtain the approval voting information of the second consensus stage;
[0168] Step 807: When the voting approval information in the second consensus phase meets the consensus conditions, the first consensus node synchronizes the target block to the data node, so that the data node sends the target block to the data message queue;
[0169] Step 808A: When consensus is reached, the first consensus node generates a clear instruction based on the target block and sends the clear instruction to the distributed message center, where the clear instruction is used to instruct the distributed message center to clear the transaction data in the transaction message queue.
[0170] Step 808B: When consensus is reached, the first consensus node generates a purge instruction based on the target block and sends the purge instruction to the data node, instructing the data node to send a first instruction and a second instruction to the distributed message center. The first instruction is used to purge the proposal information in the consensus message queue, and the second instruction is used to purge the transaction data in the transaction message queue.
[0171] In step 809, the first consensus node sends a connection request to the distributed message center. The connection request includes verification data, which is encrypted based on the private key of the first consensus node. The connection request is used to instruct the distributed message center to decrypt the verification data using the pre-acquired public key of the first consensus node. When the decryption is successful, it is determined that the identity authentication is passed, and a data connection is established between the first consensus node and the consensus message queue of the distributed message center.
[0172] It should be noted that, although the steps in the flowcharts of the embodiments described above are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. For example, step 809 may be executed before step 801. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps may be executed in other orders. Moreover, at least a portion of the steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0173] In the above-mentioned blockchain data processing method, the proxy node does not need to broadcast the transaction data sent by the business node to each consensus node, but sends the transaction data to the transaction message queue. The first consensus node obtains the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node can read the proposal information from the consensus message queue; during the consensus process, each consensus node interacts with consensus data through the consensus message queue; reduces the complexity of the network connection between the proxy node and each consensus node, as well as the complexity of the network connection between each consensus node, avoids the network resource consumption caused by broadcasting transaction data and consensus data, improves the transmission efficiency of transaction data and consensus data, and improves the data processing performance of the blockchain network and the response speed of transactions.
[0174] In some embodiments, as shown in FIG9 , a blockchain data processing method is provided, which is described by taking the method executed by the proxy node in FIG1 as an example, and includes the following steps:
[0175] Step 902: Acquire transaction data sent by the service node.
[0176] In some embodiments, when a business node needs to upload certain transaction data to the blockchain network, the transaction data is sent to the proxy node, so that the proxy node obtains the transaction data sent by the business node.
[0177] Step 904: Send the transaction data to the transaction message queue so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. When consensus is reached, the target block is sent to the data message queue. Each consensus node includes the first consensus node and each second consensus node.
[0178] In some embodiments, the proxy node sends the transaction data to the transaction message queue, causing the first consensus node to read the transaction data from the transaction message queue. The process of the first consensus node reading the transaction data from the transaction message queue, and subsequently reaching consensus on the target block through each consensus node, and sending the target block to the data message queue when consensus is reached, is the same as the process of steps 202 to 206 in the above embodiment. Therefore, the process of the first consensus node reading the transaction data from the transaction message queue, and subsequently reaching consensus on the target block, and sending the target block to the data message queue when consensus is reached, can refer to the description of steps 202 to 206 in the above embodiment.
[0179] Step 906: Read the target block from the data message queue and send the target block to the service node.
[0180] In some embodiments, when a target block on which consensus has been reached is sent to a data message queue, the distributed message center may send a subscription message to the proxy node. The proxy node reads the target block from the data message queue based on the subscription message and forwards the target block to the business node, so that the business node obtains the target block. After the business node obtains the target block, it may update the local ledger through the target block.
[0181] In the above-mentioned blockchain data processing method, the proxy node does not need to broadcast the transaction data sent by the business node to each consensus node, but sends the transaction data to the transaction message queue. The first consensus node obtains the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node can read the proposal information from the consensus message queue; during the consensus process, each consensus node interacts with consensus data through the consensus message queue; reduces the complexity of the network connection between the proxy node and each consensus node, as well as the complexity of the network connection between each consensus node, avoids the network resource consumption caused by broadcasting transaction data and consensus data, improves the transmission efficiency of transaction data and consensus data, and improves the data processing performance of the blockchain network and the response speed of transactions.
[0182] In some embodiments, a subscription message sent by a distributed message center is received; the subscription message is used to indicate that the target block is sent to the data message queue; an execution result is sent to the business node based on the subscription message; the execution result is used to indicate that consensus has been reached on the transaction data.
[0183] Among them, the subscription message is used to indicate that the target block that has reached consensus is sent to the data message queue.
[0184] In some embodiments, after sending transaction data to the transaction message queue, the proxy node subscribes to the data message queue. When a consensus-reached target block is sent to the data message queue, the distributed message center sends a subscription message to the proxy node. Based on the subscription message, the proxy node determines that the transaction data has been uploaded to the blockchain and then sends an execution result, including information that the transaction data has been uploaded to the blockchain, to the service node. It should be noted that reaching consensus on transaction data indicates that the transaction data has been uploaded to the blockchain.
[0185] In the above embodiment, when the target block is sent to the data message queue, the distributed message center sends a subscription message to the proxy node, and the proxy node sends the execution result to the business node based on the subscription message, so that the business node determines that the transaction data has reached a consensus. Data can be read quickly through subscription, thereby improving data reading and writing efficiency.
[0186] In some embodiments, reading the target block from the data message queue and sending the target block to the business node includes: receiving a data synchronization request sent by the business node; sending the data synchronization request to the distributed message center to read the target block from the data message queue of the distributed message center; and sending the target block to the business node.
[0187] The data synchronization request is used to read the target block from the data message queue.
[0188] In some embodiments, after the business node sends the transaction data to the proxy node, it can periodically send a data synchronization request to the proxy node. The proxy node sends the data synchronization request to the distributed message center. When the target block on which consensus is reached is sent to the data message queue, the proxy node can read the target block from the data message queue according to the data synchronization request, and then send the target block to the business node.
[0189] In some embodiments, after obtaining the execution result, the business node can send a data synchronization request to the proxy node. The proxy node sends the data synchronization request to the distributed message center to read the target block from the data message queue according to the data synchronization request, and then send the target block to the business node.
[0190] In the above embodiment, the proxy node does not need to obtain the target block broadcast by the consensus node in a point-to-point manner, but reads the target block on which consensus has been reached from the data message queue, and then forwards the target block to the business node, so that the business node does not need to configure the node information of the consensus network, which reduces the complexity of the network connection between the proxy node and each consensus node, improves the transmission efficiency of the target block, and improves the data processing performance and transaction response speed of the blockchain network.
[0191] In some embodiments, as shown in FIG10 , the data processing method of the blockchain includes:
[0192] Step 1001: The proxy node obtains transaction data sent by the service node;
[0193] Step 1002: The proxy node sends the transaction data to the transaction message queue, so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. When consensus is reached, the target block is sent to the data message queue. Each consensus node includes the first consensus node and each second consensus node.
[0194] Step 1003: The proxy node receives a subscription message from the distributed message center; the subscription message indicates that the target block has been sent to the data message queue; based on the subscription message, the proxy node sends an execution result to the service node; the execution result indicates that consensus has been reached on the transaction data;
[0195] Step 1004: The proxy node receives the data synchronization request sent by the business node; sends the data synchronization request to the distributed message center to read the target block from the data message queue of the distributed message center; and sends the target block to the business node.
[0196] In some embodiments, as shown in FIG11 , the blockchain data processing system is used to execute the blockchain data processing method, and the blockchain data processing system can be applied in electronic bill scenarios.
[0197] The business layer corresponds to the business network in the above embodiment, the routing proxy layer includes the proxy nodes in the above embodiment, and the core consensus network layer corresponds to the consensus network in the above embodiment; the routing proxy layer is used to forward the interaction data between the business layer and the core consensus network layer.
[0198] In the electronic invoice scenario, business nodes in the business layer can include terminals at the electronic tax bureau, terminals corresponding to enterprise users, and terminals corresponding to consumers. The electronic tax bureau can be a local tax bureau within the tax bureau's dedicated network. Enterprise users can be invoicing providers, reimbursement providers, or KAs (Key Account companies, such as large retailers) in the public cloud. Consumers can be payment providers, reimbursement providers, or retailers in the private cloud. Core Chain 1, Core Chain 2, ..., and Core Chain N are blockchains maintained by tax bureaus in different regions.
[0199] When consumers make purchases, corporate users use corresponding terminal devices to issue invoices for the purchases and generate transaction data.
[0200] The proxy nodes in the routing proxy layer can be used to isolate the business layer and the core consensus network layer. The proxy nodes have P2P services, routing services, certificate caches and authentication services. The P2P service enables the proxy nodes to establish point-to-point network connections with proxy nodes and consensus nodes. The routing service enables the proxy nodes to communicate with proxy nodes and consensus nodes. The certificates in the certificate cache can be the public keys of the business nodes. The authentication service can decrypt the data sent by the business nodes through the public keys. For example, the transaction data sent by the business nodes can be encrypted by the private keys of the proxy nodes. The proxy nodes decrypt the encrypted transaction data through the cached public keys, making the transaction data less likely to be leaked and improving the security of the transaction data. After the proxy nodes in the routing proxy layer obtain the transaction data sent by the business nodes, they can send the transaction data to the transaction message queue of the distributed message center, and when the target block corresponding to the transaction data reaches a consensus, the target block is read from the data message queue of the distributed message center and the target block is forwarded to the business nodes.
[0201] The consensus nodes in the core consensus network layer can be trusted nodes (TrustSQL nodes) in the tax bureau's private network. TrustSQL nodes have the ability to package transaction data to obtain the target block and the consensus capability. The TrustSQL nodes in the core consensus network layer can obtain transaction data from the transaction message queue, package the transaction data to obtain the target block, and send proposal information including the target block to the consensus message queue. They can also interact with the consensus message queue for consensus data during the consensus process. When consensus is reached, the target block will be put on the chain and sent to the data message queue.
[0202] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0203] In the above-mentioned blockchain data processing method, the proxy node does not need to broadcast the transaction data sent by the business node to each consensus node, but sends the transaction data to the transaction message queue. The first consensus node obtains the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node can read the proposal information from the consensus message queue; during the consensus process, each consensus node interacts with consensus data through the consensus message queue; reduces the complexity of the network connection between the proxy node and each consensus node, as well as the complexity of the network connection between each consensus node, avoids the network resource consumption caused by broadcasting transaction data and consensus data, improves the transmission efficiency of transaction data and consensus data, and improves the data processing performance of the blockchain network and the response speed of transactions.
[0204] In some embodiments, as shown in FIG12 , a blockchain data processing system is provided, including a business node 1201 in a business network, a proxy node 1202 , and a first consensus node 1203 and a second consensus node 1204 in a consensus network;
[0205] Business node 1201, used to send transaction data to the proxy node;
[0206] Agent node 1202, used to obtain transaction data and send the transaction data to the transaction message queue;
[0207] The first consensus node 1203 is configured to read transaction data from the transaction message queue, generate proposal information of the target block based on the transaction data, and send the proposal information to the consensus message queue, so that each second consensus node 1204 in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process; when consensus is reached, the target block is sent to the data message queue. Each consensus node includes the first consensus node 1203 and each second consensus node 1204;
[0208] The proxy node 1202 is further configured to read the target block from the data message queue and send the target block to the service node.
[0209] Among them, the business nodes, proxy nodes, first consensus nodes and second consensus nodes in the data processing system of the blockchain jointly execute the data processing method of the blockchain. The specific process of the business nodes, proxy nodes, first consensus nodes and second consensus nodes in the data processing system of the blockchain jointly executing the data processing method of the blockchain can refer to the description of the data processing method of the blockchain in the above embodiment.
[0210] In the data processing system of the above-mentioned blockchain, the proxy node does not need to broadcast the transaction data sent by the business node to each consensus node, but sends the transaction data to the transaction message queue. The first consensus node obtains the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node can read the proposal information from the consensus message queue; during the consensus process, each consensus node interacts with consensus data through the consensus message queue; the complexity of the network connection between the proxy node and each consensus node, as well as the complexity of the network connection between each consensus node are reduced, the network resource consumption caused by broadcasting transaction data and consensus data is avoided, the transmission efficiency of transaction data and consensus data is improved, and the data processing performance of the blockchain network and the response speed of transactions are improved.
[0211] Based on the same inventive concept, the present application also provides a blockchain data processing device for implementing the blockchain data processing method described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of the one or more blockchain data processing device embodiments provided below can be found in the above-mentioned limitations of the blockchain data processing method and will not be repeated here.
[0212] In one embodiment, as shown in FIG13 , a blockchain data processing device is provided, including: a first transaction message queue interaction module 1301 , a consensus message queue interaction module 1302 , and a first data message queue interaction module 1303 , wherein:
[0213] The first transaction message queue interaction module 1301 is used to read transaction data from the transaction message queue; the transaction data is sent to the transaction message queue by the service node in the service network through the proxy node;
[0214] Consensus message queue interaction module 1302 is used to generate proposal information of the target block based on the transaction data and send the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process. Each consensus node includes a first consensus node and a second consensus node.
[0215] The first data message queue interaction module 1303 is used to send the target block to the data message queue when consensus is reached, so that the service node reads the target block from the data message queue.
[0216] In some embodiments, the consensus message queue interaction module 1302 includes:
[0217] The block generation unit is used to package the transaction data into a target block;
[0218] The proposal information sending unit is used to generate proposal information of the target block and send the proposal information to the consensus message queue; the proposal information includes the target block, the block height of the target block and the node information of the first consensus node that generates the target block.
[0219] In some embodiments, the consensus message queue interaction module 1302 further includes:
[0220] The consensus unit is configured to pre-vote the target block based on the proposal information to obtain first pre-voting information; obtain second pre-voting information stored by each second consensus node in the first consensus stage from the consensus message queue, and determine first voting information in the second consensus stage based on each second pre-voting information and the first pre-voting information; the second pre-voting information is obtained by each second consensus node reaching consensus on the target block based on the proposal information; send the first voting information to the consensus message queue, so that each second consensus node reads the first voting information from the consensus message queue, reaches consensus on the target block based on the first voting information, obtains second voting information in the second consensus stage, and sends the second voting information to the consensus message queue; and obtain each second voting information in the second consensus stage from the consensus message queue, and determines voting approval information in the second consensus stage based on the first voting information and each second voting information.
[0221] In some embodiments, the consensus unit is configured to determine voting approval information of the first consensus stage based on each second pre-voting information and the first pre-voting information; and determine first voting information of the second consensus stage based on the voting approval information of the first consensus stage.
[0222] In some embodiments, the first data message queue interaction module 1303 is used to synchronize the target block to the data node when the voting approval information in the second consensus stage meets the consensus condition, so that the data node sends the target block to the data message queue.
[0223] In some embodiments, the blockchain data processing device further includes:
[0224] The clearing module is used to generate a clearing instruction based on the target block when consensus is reached; and send the clearing instruction to the distributed message center, which is used to instruct the distributed message center to clear the transaction data in the transaction message queue.
[0225] In some embodiments, the blockchain data processing device further includes:
[0226] The connection module is used to send a connection request to the distributed message center. The connection request is used to instruct the distributed message center to perform authentication based on the connection request; if the authentication is successful, a data connection is established with the consensus message queue of the distributed message center.
[0227] In one embodiment, as shown in FIG14 , a blockchain data processing device is provided, including: a transaction data acquisition module 1401, a second transaction message queue interaction module 1402, and a second data message queue interaction module 1403, wherein:
[0228] Transaction data acquisition module 1401, used to acquire transaction data sent by the service node;
[0229] The second transaction message queue interaction module 1402 is used to send transaction data to the transaction message queue so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block based on the transaction data, and sends the proposal information to the consensus message queue so that each second consensus node in the consensus network reads the proposal information from the consensus message queue. The proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block. During the consensus process, each consensus node exchanges consensus data through the consensus message queue. When consensus is reached, the target block is sent to the data message queue. Each consensus node includes the first consensus node and each second consensus node.
[0230] The second data message queue interaction module 1403 is configured to read the target block from the data message queue and send the target block to the service node.
[0231] In some embodiments, the second data message queue interaction module 1403 is used to receive a data synchronization request sent by a business node; send the data synchronization request to a distributed message center to read a target block from the data message queue of the distributed message center; and send the target block to the business node.
[0232] In some embodiments, a blockchain data processing device includes:
[0233] The subscription module is used to receive subscription messages sent by the distributed message center; subscription messages are used to indicate that the target block has been sent to the data message queue; execution results are sent to the business node based on the subscription messages; execution results are used to indicate that consensus has been reached on the transaction data.
[0234] Each module in the aforementioned blockchain data processing device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor within a computer device in hardware form, or stored in a computer device memory in software form, allowing the processor to call and execute the corresponding operations of each module.
[0235] In one embodiment, a computer device is provided, which may be a server. A diagram of its internal structure may be shown in FIG15 . The computer device includes a processor, memory, an input / output (I / O) interface, and a communication interface. The processor, memory, and I / O interface are connected via a system bus, and the communication interface is connected to the system bus via the I / O interface. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and computer program in the non-volatile storage medium to run. The database of the computer device stores blocks on a blockchain. The I / O interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via a network connection. When executed by the processor, the computer program implements a blockchain data processing method.
[0236] Those skilled in the art will understand that the structure shown in FIG15 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0237] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the above-mentioned blockchain data processing are implemented.
[0238] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned blockchain data processing are implemented.
[0239] In one embodiment, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps of data processing of the above-mentioned blockchain.
[0240] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0241] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0242] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0243] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A data processing method of a blockchain, executed by a first consensus node, the method comprising: Read transaction data from a transaction message queue, where the transaction data is sent to the transaction message queue by a service node in the service network through a proxy node; Generate proposal information of the target block according to the transaction data, and send the proposal information to a consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process, and each consensus node includes the first consensus node and each second consensus node; and When consensus is reached, the target block is sent to the data message queue so that the service node reads the target block from the data message queue.
2. The method according to claim 1, wherein: Generating proposal information of the target block according to the transaction data, and sending the proposal information to the consensus message queue, includes: Packing the transaction data to obtain a target block; and Generate proposal information of the target block, and send the proposal information to a consensus message queue; the proposal information includes the target block, the block height of the target block, and the node information of the first consensus node that generates the target block.
3. The method according to claim 1 or 2, wherein: After generating proposal information of the target block according to the transaction data and sending the proposal information to the consensus message queue, the process further includes: Pre-voting the target block based on the proposal information to obtain first pre-voting information; Obtaining the second pre-voting information stored by each of the second consensus nodes in the first consensus stage from the consensus message queue, and determining the first voting information of the second consensus stage based on each of the second pre-voting information and the first pre-voting information; the second pre-voting information is obtained by each of the second consensus nodes through consensus on the target block based on the proposal information; Sending the first voting information to the consensus message queue, so that each of the second consensus nodes reads the first voting information from the consensus message queue, reaches a consensus on the target block based on the first voting information, obtains second voting information in the second consensus stage, and sends the second voting information to the consensus message queue; and The second voting information of the second consensus stage is obtained from the consensus message queue, and voting approval information of the second consensus stage is determined based on the first voting information and the second voting information.
4. The method according to claim 3, wherein: The determining the first voting information of the second consensus stage based on each of the second pre-voting information and the first pre-voting information includes: Determining voting approval information of the first consensus stage based on each of the second pre-voting information and the first pre-voting information; and Based on the voting approval information of the first consensus stage, first voting information of the second consensus stage is determined.
5. The method according to claim 4, wherein: The voting approval information of the first consensus stage, including the number of approval information in the first consensus stage; The determining, based on the voting approval information in the first consensus stage, the first voting information in the second consensus stage includes: When the number of affirmative information in the first consensus stage is greater than or equal to the first preset number of votes, determining that the first voting information in the second consensus stage is affirmative information; and When the amount of approval information in the first consensus stage is less than the first preset number of votes, the first voting information in the second consensus stage is determined to be opposition information.
6. The method according to any one of claims 3 to 5, wherein: The determining the voting approval information of the second consensus stage based on the first voting information and each of the second voting information includes: The number of approval information in the first voting information and the second voting information is summed to obtain the approval voting information in the second consensus stage.
7. The method according to any one of claims 3 to 5, wherein: When consensus is reached, sending the target block to the data message queue includes: When the voting approval information of the second consensus stage meets the consensus condition, the target block is synchronized to the data node so that the data node sends the target block to the data message queue.
8. The method according to any one of claims 1 to 7, wherein: The method further comprises: If consensus is reached, generating a clearing instruction based on the target block; and The clearing instruction is sent to a distributed message center; the clearing instruction is used to instruct the distributed message center to clear the transaction data in the transaction message queue.
9. The method according to any one of claims 1 to 8, wherein: The method further comprises: When consensus is reached, a clearing instruction is generated based on the target block; A clear instruction is sent to the data node to instruct the data node to send a first instruction and a second instruction to the distributed message center, wherein the first instruction is used to clear the proposal information in the consensus message queue, and the second instruction is used to clear the transaction data in the transaction message queue.
10. The method according to any one of claims 1 to 9, wherein: The method further comprises: Sending a connection request to a distributed message center, the connection request being used to instruct the distributed message center to perform identity authentication based on the connection request; and When the identity authentication is passed, a data connection with the consensus message queue of the distributed message center is established.
11. The method according to claim 10, wherein: The connection request includes verification data, where the verification data is encrypted according to the private key of the first consensus node; The performing identity authentication based on the connection request includes: Decrypting the verification data using the pre-acquired public key of the first consensus node; and When the decryption succeeds, the authentication is determined to be successful.
12. A data processing method of a blockchain, executed by a proxy node, the method comprising: Get the transaction data sent by the business node; Send the transaction data to the transaction message queue, so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block according to the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process, and sends the target block to the data message queue when consensus is reached, and each consensus node includes the first consensus node and each second consensus node; and The target block is read from the data message queue, and the target block is sent to the service node.
13. The method according to claim 12, wherein: The step of reading the target block from the data message queue and sending the target block to the service node includes: Receiving a data synchronization request sent by the service node; Sending the data synchronization request to a distributed message center to read the target block from a data message queue of the distributed message center; and The target block is sent to the service node.
14. The method according to claim 12 or 13, wherein: The method further comprises: receiving a subscription message sent by a distributed message center; the subscription message is used to indicate that the target block is sent to a data message queue; and An execution result is sent to the business node based on the subscription message; the execution result is used to indicate that a consensus has been reached on the transaction data.
15. A blockchain data processing system, wherein: The system includes a business node in a business network, a proxy node, and a first consensus node and a second consensus node in a consensus network; The business node is used to send transaction data to the proxy node; The proxy node is used to obtain the transaction data and send the transaction data to a transaction message queue; The first consensus node is used to read the transaction data from the transaction message queue, generate proposal information of the target block according to the transaction data, and send the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, and the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process; when a consensus is reached, the target block is sent to the data message queue, and each consensus node includes the first consensus node and each second consensus node; and The proxy node is further used to read the target block from the data message queue and send the target block to the service node.
16. A data processing device for a blockchain, wherein: The device comprises: A first transaction message queue interaction module, configured to read transaction data from a transaction message queue; the transaction data is sent to the transaction message queue by a service node in the service network through a proxy node; A consensus message queue interaction module, used to generate proposal information of the target block according to the transaction data, and send the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node exchanges consensus data through the consensus message queue during the consensus process, and each consensus node includes the first consensus node and the second consensus node; and The first data message queue interaction module is used to send the target block to the data message queue when consensus is reached, so that the business node reads the target block from the data message queue.
17. A data processing device for a blockchain, wherein: The device comprises: Transaction data acquisition module, used to obtain transaction data sent by business nodes; A second transaction message queue interaction module is used to send the transaction data to the transaction message queue, so that the first consensus node in the consensus network reads the transaction data from the transaction message queue, generates proposal information of the target block according to the transaction data, and sends the proposal information to the consensus message queue, so that each second consensus node in the consensus network reads the proposal information from the consensus message queue, and the proposal information is used to instruct each consensus node in the consensus network to reach a consensus on the target block, and each consensus node interacts with consensus data through the consensus message queue during the consensus process, and sends the target block to the data message queue when consensus is reached, and each consensus node includes the first consensus node and each second consensus node; and The second data message queue interaction module is used to read the target block from the data message queue and send the target block to the service node.
18. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, one or more processors execute the steps of any one of the methods of claims 1 to 14.
19. One or more non-volatile readable storage media having computer readable instructions stored thereon, wherein: When the computer readable instructions are executed by one or more processors, the one or more processors are caused to implement the steps of the method according to any one of claims 1 to 14.
20. A computer program product comprising computer readable instructions, wherein: When the computer readable instructions are executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.
Citation Information
Patent Citations
Blockchain processing method, system and device, computer equipment and storage medium
CN111510484A
Node management method and device, computer equipment and storage medium
CN111786812A
Block chain transaction execution method and device, electronic equipment and storage medium
CN112838930A
Methods and apparatuses for transmitting messages
US20210329065A1
Consensus service for blockchain networks
US20220103532A1
