Data processing method, node device and system of blockchain

The data processing method for block chain systems filters and prioritizes data traffic using virtual processing units to manage resource contention and load balancing, ensuring efficient operation of multiple groups on a single server.

CN112487101BActive Publication Date: 2025-07-15WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011476882.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-15
Publication Date
2025-07-15
Estimated Expiration
2040-12-15

AI Technical Summary

Technical Problem

When running multiple blockchain groups on the same server, it is easy to have resource competition, load imbalance and network traffic occupancy, resulting in some blockchains not being able to operate normally and service quality decline.

Method used

By performing primary and secondary screening of received message data at the consensus node, screening according to the data volume and communication traffic, virtual processing units are used to independently process the message data of each blockchain group, and sending a abandonment request when the resource usage exceeds the threshold to achieve load balancing.

Benefits of technology

It effectively avoids traffic occupation between blockchain groups, ensures normal consensus and transactions of each blockchain group, improves processing performance, and improves the operating efficiency and service quality of the blockchain network through load balancing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112487101B_ABST
    Figure CN112487101B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a data processing method, a node device, and a system for a blockchain, which receive multiple message data sent by other consensus nodes; wherein, the message data includes a blockchain group identifier, and the multiple message data are screened according to the first data volume of the multiple message data and the maximum communication traffic of the node of the consensus node to obtain primary message data, and the primary message data are screened according to the maximum communication traffic of each blockchain group to obtain secondary message data, and the secondary message data are processed. In the present application, the message data are screened twice according to the maximum communication traffic of the consensus node and the maximum communication traffic of the group, respectively, to achieve screening at the node level and the group level, which can ensure that resource preemption does not occur when multiple blockchain groups run on the same consensus node, so that the blockchain groups can perform normal consensus and transactions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the fields of financial technology (Fintech) and blockchain technology, and in particular, to a method for processing blockchain data, a node device, and a system. Background Art

[0002] Blockchain is a decentralized distributed ledger system that uses cryptography to ensure the security of data transmission and access, and uses a chain structure to ensure that the data on the chain cannot be tampered with.

[0003] During the operation of the blockchain, there is a situation where multiple ledgers are running on the same group of blockchain members. Usually, each blockchain member has multiple servers. If one server is used as a node of a blockchain system, then each blockchain member can participate in multiple blockchain groups, thereby realizing the operation of multiple ledgers on the same group of blockchain members. However, the above method requires more resources. To reduce resource occupancy, each blockchain member only uses one server, and this server serves as a node of multiple blockchain systems, that is, multiple blockchain groups are running on this server.

[0004] However, in the method of running multiple blockchain groups on the same server, it is easy to have the problem that the blockchain groups compete for resources with each other, which may cause some blockchains to fail to operate normally. Summary of the Invention

[0005] The embodiments of the present application provide a method for processing blockchain data, a node device, and a system, aiming to provide a solution that can balance resources among various blockchain groups.

[0006] In a first aspect, the present application provides a method for processing blockchain data. The method is applied to a consensus node and includes:

[0007] Receiving multiple message data sent by other consensus nodes; wherein, the message data includes a blockchain group identifier;

[0008] Screening the multiple message data according to the first data volume of the multiple message data and the maximum communication traffic of the node of the consensus node to obtain primary message data;

[0009] Screening the primary message data according to the maximum communication traffic of each blockchain group to obtain secondary message data, and processing the secondary message data.

[0010] Optionally, screening the multiple message data according to the first data volume of the multiple message data and the maximum communication traffic of the node of the consensus node to obtain primary message data, specifically includes:

[0011] When the first data volume does not exceed the maximum communication traffic of the node, the primary message data is all the received message data;

[0012] When the first data volume exceeds the maximum communication traffic of the node and the second data volume of all key message data does not exceed the maximum communication traffic of the node, the primary message data is the key message data sent by other nodes and some non-key message data;

[0013] When the second data volume exceeds the maximum communication traffic of the node, the primary message data is the key message data sent by other consensus nodes.

[0014] Optionally, the key messages include node detection messages, consensus messages or transaction messages; the non-key messages include peer-to-peer message messages, synchronization messages or instruction messages.

[0015] Optionally, the primary message data is filtered according to the maximum communication traffic of each blockchain group to obtain the secondary message data, specifically including:

[0016] The third data volume of the primary message data corresponding to each blockchain group is statistically obtained according to the blockchain group identifier of the primary message data;

[0017] For each blockchain group, when the third data volume exceeds the maximum communication traffic of the corresponding group, some primary message data is randomly selected from the primary message data corresponding to the blockchain group as the secondary message data;

[0018] For each blockchain group, when the third data volume does not exceed the maximum communication traffic of the corresponding group, the secondary message data is the primary message data corresponding to the blockchain group.

[0019] Optionally, the maximum communication traffic of the group is:

[0020]

[0021] Among them, represents the data volume of the node detection message received by the i-th blockchain group, represents the data volume of the consensus message received by the i-th blockchain group, represents the data volume of the transaction message received by the i-th blockchain group, the maximum data volume received by the i-th blockchain group, 1 ≤ i ≤ n, n represents the total number of blockchain groups, B max represents the maximum communication traffic of the node.

[0022] Optionally, the secondary message data is processed, specifically including:

[0023] For each piece of secondary message data, determine a virtual processing unit for processing the secondary message data according to the blockchain group identifier of the secondary message data;

[0024] Control the virtual processing unit to process the secondary message data.

[0025] Optionally, after determining the virtual processing unit for processing the secondary message data according to the blockchain group identifier of the secondary message data, the method further includes:

[0026] Determine the transmission order of the secondary message data according to the message type of the secondary message data;

[0027] Transmit the secondary message data to the virtual processing unit through the link corresponding to the virtual processing unit according to the transmission order.

[0028] Optionally, the consensus node is the main consensus node. After controlling the virtual processing unit to process the secondary message data, the method further includes:

[0029] Statistically obtain the utilization rate of the hardware resources by all virtual processing units;

[0030] When the utilization rate reaches a preset threshold, send a relinquishment request to other nodes; wherein, the relinquishment request includes the identifier of the blockchain group corresponding to the main consensus node that requests to relinquish.

[0031] In a second aspect, the present application provides a node device, including:

[0032] A memory for storing programs;

[0033] A processor for executing the programs stored in the memory. When the programs are executed, the processor is used to execute the data processing method as involved in the first aspect and the optional solutions.

[0034] In a third aspect, the present application provides a blockchain system, including a plurality of node devices as involved in the second aspect.

[0035] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored;

[0036] Wherein, when the computer-executable instructions are executed by a processor, they are used to implement the data processing method as involved in the first aspect and the optional solutions.

[0037] In a fifth aspect, the present application provides a computer program product, including instructions, which when executed by a processor, implement the data processing method as involved in the first aspect and the optional solutions.

[0038] The embodiments of the present application provide a data processing method, a node device, and a system for a blockchain. The consensus node performs primary screening on the message data according to the total data volume of the received message data and the maximum communication traffic of the node, and then performs secondary screening according to the maximum communication traffic of each blockchain group and the data volume of the message data corresponding to each blockchain group, so as to achieve traffic control of the consensus node, effectively avoid traffic occupation between each blockchain group, and enable multiple blockchain groups to operate normally on the same consensus node in terms of traffic control. Screening, filtering, and transmitting according to the transmission importance of the message data ensure the service quality of the blockchain network operation. After two screenings, a virtual processing unit for processing the message data is determined according to the blockchain group identifier of the message data. Each virtual processing unit is independent in terms of resources and there is no resource competition situation. Furthermore, it can ensure normal consensus and transactions of each blockchain group on the same consensus node from the perspective of hardware resources. In addition, the main consensus node monitors the utilization rate of the hardware resources in the node. When the resource utilization rate of the main consensus node reaches a preset threshold, the main consensus node generates a request to abandon the main consensus node, so as to balance the loads of each consensus node in the blockchain system and improve the processing performance between multiple blockchain groups. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 is an architecture diagram of running multiple blockchains in the same consensus node in the prior art;

[0040] Figure 2 is Figure 1 a schematic structural diagram of the ledger module in the prior art shown;

[0041] Figure 3 is a schematic structural diagram of the blockchain system provided by the embodiments of the present application;

[0042] Figure 4 is an architecture diagram of running multiple blockchains in the consensus node provided by the embodiments of the present application;

[0043] Figure 5 is a schematic structural diagram of the link of the consensus node provided by the embodiments of the present application;

[0044] Figure 6 is a schematic flowchart of the data processing method provided by the embodiments of the present application;

[0045] Figure 7 is a schematic flowchart of screening to obtain primary message data provided by the embodiments of the present application;

[0046] Figure 8 is a schematic structural diagram of the data processing device provided by the embodiments of the present application;

[0047] Figure 9 is a schematic structural diagram of the node device provided by the embodiments of the present application. Detailed implementation manners

[0048] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0049] Technical term explanations:

[0050] A message refers to a data packet used for transmission and synchronization between blockchain network nodes.

[0051] Quality of Service (QoS) refers to the ability of a network to use various underlying technologies to provide better service capabilities for specified network communications. It is a security mechanism of the network and a technology used to solve problems such as network latency and congestion.

[0052] A blockchain is a distributed storage system jointly maintained by multiple consensus nodes. The bottom layer of the blockchain is a chain composed of a series of blocks. In addition to recording the data of the current block, each block also records the hash value of the previous block, forming a chain-like data structure in this way. A block consists of a block header and a block body. Among them, the block header defines important fields such as the block height and the hash value of the previous block, while the block body mainly stores transaction data. The blockchain uses cryptography to ensure the security of data transmission and access, and uses the chain structure to ensure that the data on the chain cannot be tampered with.

[0053] During the operation of the blockchain, there is a situation where multiple ledgers are running on the same group of blockchain members. For example, institutions A, B, C, and D are the same group of blockchain members. There are multiple ledgers among institutions A, B, C, and D.

[0054] Usually, each blockchain member has multiple servers. One server serves as a node of a blockchain system, so each blockchain member can participate in multiple blockchains, thereby realizing the operation of multiple ledgers on the same group of blockchain members. For example, there is a ledger a among institutions A, B, C, and D, and there is a ledger b among institutions A, B, and C. Institutions A, B, and C need to deploy two servers, one for running ledger a and the other for running ledger b.

[0055] However, the above method requires more resources. That is, the more ledgers are run on blockchain members, the more server resources are needed to run the ledgers, which has the disadvantages of resource over - surplus and unreasonable utilization.

[0056] To reduce resource occupancy, each blockchain member only uses one server, which serves as a node for multiple blockchain systems. That is, multiple blockchains are run on this server to achieve server resource reuse. Continuing with the above example, institutions A, B, C, and D each deploy one server. The servers of institutions A, B, and C need to run ledger a and ledger b. That is, the servers of institutions A, B, and C serve as nodes for two blockchain groups. One blockchain group is used to run ledger a, and the other blockchain group is used to run ledger b.

[0057] As Figure 1 shown, in the architecture where multiple blockchain groups run on the same server, the blockchain groups share the network, and network message isolation between each ledger is achieved through network access control and ledger whitelisting. The data - processing processes between groups are also isolated from each other. As Figure 2 shown, each ledger module mainly includes three layers from bottom to top: the core layer, the interface layer, and the scheduling layer, enabling each group to independently run its own consensus algorithm, and different groups can use different consensus algorithms. Through the cooperation of the three - layer structure, the independent and robust operation of a single group can be guaranteed.

[0058] However, when multiple blockchains run on the same server, problems such as resource contention between blockchains are likely to occur, and there are also security vulnerabilities. Since only application - level isolation can be achieved between blockchain groups and not kernel - level isolation of the operating system, problems such as resource occupation and resource idling will occur. Especially when a malicious node serves as a node for multiple blockchain groups and sends large - data transaction messages to other nodes in one blockchain group, occupying the resources of other blockchain groups of this malicious node, making it impossible for other blockchain groups of this malicious node to perform consensus and provide services externally normally.

[0059] In addition, in the method of running multiple blockchains on the same server, when a large amount of non - critical message data occupies the node network traffic, it becomes impossible to receive messages for consensus or transactions in a timely manner, unable to guarantee QoS, and dragging down the normal operation and efficiency of the blockchain network. Moreover, there is a situation where the same node serves as the main consensus node for multiple blockchain groups, resulting in a large data load on this node, causing uneven node loads in the blockchain system, and this node is also likely to become a bottleneck for the entire blockchain group, slowing down the speed and throughput of transaction processing for all blockchain groups.

[0060] To solve the above problems in the prior art, the embodiments of the present application provide a data processing method, a node device, and a system for a blockchain. After the consensus node receives multiple message data, primary screening is performed on the message data according to the data volume of the message data and the maximum communication traffic of the node. Secondary screening is performed on the maximum communication traffic of each blockchain group and the data volume of the message data corresponding to each blockchain group, so as to achieve traffic control of the consensus node and avoid traffic occupation between blockchain groups. After two screenings, a virtual processing unit for processing the message data is determined according to the blockchain group identifier of the message data. Each virtual processing unit is independent in resources and there is no resource competition situation, so as to ensure the normal consensus and transactions of each blockchain group.

[0061] As Figure 3 shown, a blockchain system provided by an embodiment of the present application includes multiple node servers 102 and a terminal device 101. The node server 102 is a consensus node in the blockchain system. The consensus node has a complete copy of the ledger and has the ability to participate in blockchain consensus and maintain the ledger. The terminal device 101 can be any one of devices such as a mobile phone, a tablet computer, a notebook computer, a personal digital assistant, a mobile Internet device (abbreviation: MID), and a wearable device as a user terminal.

[0062] In the above blockchain system, multiple blockchain groups are running, and each blockchain group maintains a ledger. That is, each consensus node serves as a consensus node for multiple blockchain groups. The consensus node can receive message data of multiple blockchain groups and can also send message data of multiple blockchain groups to other nodes.

[0063] When multiple blockchains are run on the same server, the operation and maintenance administrator only needs to maintain one blockchain system, which has better scalability, operability, and flexibility on the basis of meeting the same privacy protection requirements. In the same blockchain system, it is supported that the blockchain nodes start multiple blockchain groups, and the transaction processing, data storage, and block consensus between the blockchain groups are isolated from each other, which not only guarantees the privacy of the blockchain system but also reduces the operation and maintenance complexity of the system.

[0064] The following is an example: The blockchain system includes 4 consensus nodes, which are respectively marked as node 1021, node 1022, node 1023, and node 1024. A blockchain group A is maintained among node 1021, node 1022, node 1023, and node 1024, and a blockchain group B is maintained among node 1021, node 1022, and node 1023. Node 1021 can receive the message data of blockchain group B sent by node 1022, and can also receive the message data of blockchain group A sent by node 1022. Similarly, node 1021 can send the message data of blockchain group B to node 1022, and can also send the message data of blockchain group A to node 1022.

[0065] For each consensus node, multiple virtual processing units are constructed, and the resources occupied by the virtual processing units are independent of each other, that is, network isolation at the operating system kernel level is realized. For blockchain groups, the message data of different blockchain groups are processed in different virtual processing units to achieve isolation between the message data of each group, approaching the physical level.

[0066] More specifically, virtual processing units are created according to the configuration file, and the system resources within the virtual processing units are isolated from each other. These system resources include process identifiers, host names, user identifiers, network access, inter-process communication, and file systems, etc. Each process is bound to a virtual processing unit and can only view and operate on the resources bound to this virtual processing unit.

[0067] As Figure 4 shown, for each consensus node, when the program of the consensus node starts, the blockchain group program is started, the configuration of the group is read, virtual processing units are constructed according to the number of groups, and a bridge and virtual links are created. The two ends of the virtual link are respectively connected to the bridge and the virtual processing unit.

[0068] The blockchain group can connect to the external network through the bridge. Set the IP address of the link and open the network port. Different blockchain groups within the same consensus node can be addressed through the IP address and port, and the loopback is enabled. All transaction messages of the blockchain group will be received and sent through the internal address and port of the link. The network between the nodes of the blockchain can achieve isolation at the operating system kernel level, and the network between different groups can achieve isolation outside the application.

[0069] As Figure 5 shown, if 3 virtual processing units are created in the consensus node, then 3 links are correspondingly created. All 3 links are connected to the bridge. The IP address of the bridge is 10.0.1.0 / 24, then the IP addresses of the 3 links are 10.0.1.1 / 24, 10.0.1.2 / 24, and 10.0.1.3 / 24 in sequence.

[0070] The receiving unit in the consensus node receives the message data sent by other consensus nodes, and transmits the message data to the traffic control unit. The traffic control unit performs two screenings on the message data to obtain secondary message data, and determines the transmission link and the virtual processing unit according to the blockchain group identifier of the secondary message data. The process in the virtual processing unit monitors the IP address and port of the corresponding link. When it is determined that there is message data transmission, it reads the message data and processes the message data.

[0071] As Figure 6 shown, an embodiment of the present application provides a data processing method for a blockchain. The data processing method is applied to Figures 3 to 5 the blockchain system shown, and the method includes the following steps:

[0072] S201. The consensus node receives multiple message data sent by other consensus nodes.

[0073] Among them, the consensus node participates in multiple blockchain groups, that is, the consensus node receives the message data of multiple blockchain groups sent by other consensus nodes. Each message data includes a blockchain group identifier, and the blockchain group identifier is used to identify the blockchain group operated by the message data.

[0074] After the consensus node is started, the receiving unit receives the message data sent by other consensus nodes, and transmits the received message data to the traffic control module.

[0075] S202. The consensus node screens the multiple message data according to the first data volume of the multiple message data and the maximum communication traffic of the node to obtain primary message data.

[0076] Among them, the maximum communication traffic of the node is restricted by the configuration parameters of the node. The traffic control module in the consensus node counts the first data volume of the message data received at the current moment, compares the first data volume with the maximum communication traffic of the node, and screens the multiple message data according to the comparison result to obtain primary message data.

[0077] If the first data volume does not exceed the maximum communication traffic of the node, there is no need to discard the message data, that is, the primary message data is all the received message data. If the first data volume exceeds the maximum communication traffic of the node, some message data needs to be discarded.

[0078] S203. Screen the primary message data according to the maximum communication traffic of each blockchain group to obtain secondary message data, and process the secondary message data.

[0079] Among them, after the traffic control module in the consensus node obtains the primary message data, it counts the data volume of the primary message data corresponding to each blockchain group according to the blockchain group identifier of the primary message data. If the data volume exceeds the maximum communication traffic of the group, it randomly selects some primary message data from the primary message data as secondary message data so that the data volume of the secondary message data does not exceed the maximum communication traffic of the group. If the data volume does not exceed the maximum communication traffic of the group, all the primary message data of the blockchain group is retained.

[0080] After obtaining the secondary message data, perform a preliminary parsing of the message header, read the size, the group to which it belongs, and the type of the message according to the message header, and then perform operations in the blockchain group according to the message type and the message content.

[0081] In the data processing method of the blockchain provided in the embodiment of the present application, the message data is screened according to the message data volume received by the node and the maximum communication traffic of the node, and traffic control is realized at the node level. Then, the message data volume of each blockchain group is determined according to the blockchain group identifier of the primary message data, and the message data is screened again according to the maximum communication traffic of the group, and traffic control is realized at the blockchain group level. Through two levels of traffic control, each blockchain group can perform consensus and transactions, which can effectively avoid the blockchain from being unable to perform normal consensus and transactions due to the traffic occupation between blockchain groups.

[0082] Another embodiment of the present application provides a data processing method for a blockchain, and this data processing method is applied to Figures 4 to 5 the blockchain system shown, and the method includes the following steps:

[0083] S301. The consensus node receives a plurality of message data sent by other consensus nodes.

[0084] Among them, this step has been described in detail in the above embodiment and will not be elaborated here.

[0085] S302. The consensus node screens the plurality of message data according to the first data volume of the plurality of message data and the maximum communication traffic of the consensus node to obtain primary message data.

[0086] Among them, as Figure 7 shown, the traffic controller of the consensus node specifically screens the message data for the first time in the following manner to obtain primary message data:

[0087] S3001. The traffic controller of the consensus node counts the first data volume of the received message data.

[0088] S3002. The traffic controller of the consensus node determines whether the first data volume exceeds the maximum communication traffic of the node. If so, enter S3003; if not, enter S3004.

[0089] S3003. The traffic controller of the consensus node counts the second data volume of the key messages.

[0090] Among them, the key messages include node detection messages, consensus messages, or transaction messages. The node detection message refers to the message of the service status and node authentication between blockchain nodes, such as heartbeat messages, protocol handshake messages, etc. The consensus message refers to the message of the consensus algorithm between blockchain nodes. The transaction message refers to the message for the blockchain node to receive and execute transactions, such as transaction broadcast messages.

[0091] The non - key messages include peer - to - peer message messages, synchronization messages, or instruction messages. The instruction message refers to the message for the blockchain node to receive control instructions, such as the parameter adjustment message of the node. The synchronization message refers to the message for blockchain nodes to synchronize the latest blocks, such as node block synchronization messages. The peer - to - peer message message refers to the message for peer - to - peer transmission of messages between blockchain nodes, such as the message queue information message between nodes, etc.

[0092] S3004. The traffic controller of the consensus node determines whether the second data volume exceeds the maximum communication traffic of the node. If so, go to S3005; otherwise, go to S3006.

[0093] S3005. The primary message is the key message data sent by other consensus nodes.

[0094] Among them, the message type of the primary message data is identified, and the node detection message, consensus message, and transaction message are used as the secondary message data.

[0095] S3006. The primary message is the key message data sent by other nodes and part of the non - key message data.

[0096] Among them, the message type of the primary message data is identified, and the node detection message, consensus message, and transaction message are used as the secondary message data. And a part is selected from the peer - to - peer message message, synchronization message, or instruction message as the secondary message data.

[0097] S3007. The primary message data is all the received message data.

[0098] For S3006, the priority of the non - key message data can be further distinguished, and the message data is retained according to the priority of the message data points.

[0099] Set the priority sorting of the non - key message as: the priority of the instruction message > the priority of the synchronization message > the priority of the peer - to - peer message message, and retain part of the non - key message data in the following way:

[0100] S001. First, retain the point-to-point message packets, synchronization packets, and instruction packets, and discard the packet data sent by the consensus role as an observer.

[0101] S002. Determine whether the total data volume of the point-to-point message packets, synchronization packets, instruction packets, and key packets is greater than the maximum communication traffic of the node. If so, proceed to S003; otherwise, proceed to S007.

[0102] S003. Retain the synchronization packets and instruction packets, and discard the packet data sent by the consensus role as an observer and the point-to-point message packets.

[0103] S004. Determine whether the total data volume of the synchronization packets, instruction packets, and key packets is greater than the maximum communication traffic of the node. If so, proceed to S005; otherwise, proceed to S008.

[0104] S005. Retain the instruction packets, and discard the packet data sent by the consensus role as an observer, the point-to-point message packets, and the synchronization packets.

[0105] S006. Retain the instruction packets and the key packet data as secondary packet data.

[0106] S007. Retain the point-to-point message packets, synchronization packets, instruction packets, and key packet data as secondary packet data.

[0107] S008. Retain the synchronization packets, instruction packets, and key packet data as secondary packet data.

[0108] Through S001 to S008, it is possible to screen out the secondary packet data from the non-critical packet data.

[0109] S303. Screen the primary packet data according to the maximum communication traffic of each blockchain group to obtain the secondary packet data.

[0110] Among them, the traffic control module in the consensus node statistically obtains the third data volume of the primary packet data corresponding to each blockchain group according to the blockchain group identifier of the primary packet data. For each blockchain group, if the third data volume exceeds the maximum communication traffic of the corresponding group, randomly select some of the primary packet data corresponding to the blockchain group as the secondary packet data. If the third data volume does not exceed the maximum communication traffic of the corresponding group, the secondary packet data is the primary packet data corresponding to the blockchain group.

[0111] For example: After primary screening, 3 pieces of primary message data are retained. Among them, 1 piece of primary message data is used to operate on blockchain group a, and the data volume of this primary message data is 100K. The other 2 pieces of primary message data are used to operate on blockchain group b, and the data volume of the 2 pieces of primary message data is 1M. The maximum group communication traffic of the two blockchain groups a and b is 500k. To retain the primary message data of blockchain group a, one of the primary message data from blockchain group b needs to be selected so that the message data volume of blockchain group b is less than the maximum group communication traffic. The other primary message data can be deleted. It can also be cached for the next transmission.

[0112] When setting the maximum group communication traffic, the maximum group communication traffic can be calculated according to the following formula:

[0113]

[0114] Where, represents the data volume of the node detection message received by the i-th blockchain group, represents the data volume of the consensus message received by the i-th blockchain group, represents the data volume of the transaction message received by the i-th blockchain group, the maximum data volume received by the i-th blockchain group, 1 ≤ i ≤ n, n represents the total number of blockchain groups, B max represents the maximum node communication traffic.

[0115] It should be noted here that the priority of non-critical messages is dynamically changing, and the maximum group communication traffic of each group.

[0116] S304. Determine the transmission order of the secondary message data according to the message type of the secondary message data.

[0117] Among them, after the traffic control module of the consensus node obtains the secondary message data through screening, it identifies the message type of the secondary message data and sorts the secondary message data according to the message type of the secondary message data.

[0118] Preferably, the priority sorting of the secondary message data is: node detection message > consensus message > transaction message > instruction message > synchronization message > peer-to-peer message.

[0119] S305. For each secondary message data, determine the virtual processing unit used to process the secondary message data according to the blockchain group identifier of the secondary message data.

[0120] Among them, a virtual processing unit is used to process the message data of a blockchain group. After the traffic control module in the consensus node obtains the secondary message data, it extracts the blockchain group identifier of the secondary message data, and determines the transmission link and virtual processing unit according to the blockchain group identifier.

[0121] S306. Transmit the secondary message data to the virtual processing unit through the link corresponding to the virtual processing unit according to the transmission order.

[0122] Among them, the secondary message data is classified according to types, and the message data of the same type is put into the same queue. When storing the secondary message data, the first-in-first-out (FIFO for short) data structure is used to store the secondary message data.

[0123] Send and receive messages according to the priority of the secondary message data. The specific message data receiving process is as follows: The operating system kernel can write the configuration file to the specified disk location, where the configuration file is used to configure the priority of the secondary message data. After the message packet arrives at the network card, an interrupt is generated. The interrupt service program copies the received data to the cache of the network protocol packet sending and receiving, then hangs the cache of the network protocol packet sending and receiving on the soft interrupt queue, and at the same time adds the device polling table to the polling table of the soft interrupt and marks it, and then waits for the soft interrupt to be processed. When a soft interrupt occurs, the operating system kernel takes out the cache of the network protocol packet sending and receiving from the soft interrupt queue, uses the corresponding link to transmit the secondary message data to the virtual processing unit and controls the virtual processing unit to process the secondary message data. The process of sending the message data externally is the same and will not be elaborated here.

[0124] S307. Control the virtual processing unit to process the secondary message data.

[0125] Among them, after the virtual processing unit obtains the secondary message data, it preliminarily parses the message header, reads the size, the affiliated group and the type of the message according to the message header, and then operates in the blockchain group according to the message type and message content.

[0126] In the data processing method provided by the embodiments of the present application, message data is screened according to the importance level of the message data. When the amount of message data received by a consensus node exceeds the maximum communication traffic of the node, some non-critical messages are deleted or all non-critical messages are deleted, without affecting the reception and transmission of other critical message data, ensuring that the blockchain group can reach a consensus and conduct transactions normally. Then, the maximum communication traffic of the group is used to limit the amount of data received by each group, evenly distributing the traffic among the groups, and preventing as much as possible that a small number of groups occupy too many resources and affect the normal operation of other groups, realizing the effective isolation and control of different blockchain groups. In addition, the resources occupied by each virtual processing unit are isolated from each other, which can prevent a blockchain group from occupying resources and causing some blockchain groups to be unable to reach a consensus and conduct transactions. In addition, screening, filtering, and transmission are performed according to the transmission importance of the message data, ensuring the service quality of the blockchain network operation.

[0127] Another embodiment of the present application provides a data processing method, which is applied to Figures 3 to 5 the blockchain system shown in the figure, and the method includes the following steps:

[0128] S401. The primary consensus node receives multiple message data sent by other consensus nodes.

[0129] S402. The primary consensus node screens the multiple message data according to the first data volume of the multiple message data and the maximum communication traffic of the consensus node to obtain primary message data.

[0130] S403. The primary consensus node screens the primary message data according to the maximum communication traffic of each blockchain group to obtain secondary message data.

[0131] S404. For each secondary message data, the primary consensus node determines the virtual processing unit used to process the secondary message data according to the blockchain group identifier of the secondary message data, and controls the virtual processing unit to process the secondary message data.

[0132] Among them, S401 to S404 have been described in detail in the above embodiments and will not be elaborated here.

[0133] S405. The primary consensus node statistically obtains the usage rate of the hardware resources by all virtual processing units.

[0134] Among them, different blockchain groups in the blockchain system can be configured with different consensus algorithms. In the consensus process, the nodes are divided into a primary consensus node and secondary consensus nodes, and the load of the primary consensus node is always greater than that of the secondary consensus nodes.

[0135] The current primary consensus node can statistically obtain the utilization rates of all virtual processing units for hardware resources. For example, the primary consensus node statistically calculates the CPU utilization rate, memory occupancy rate, and network occupancy rate. The utilization rate of this hardware resource is used to determine whether the primary consensus node is operating overloaded.

[0136] S406. When the primary consensus node determines that the utilization rate reaches the preset threshold, the primary consensus node sends a relinquishment request to other nodes.

[0137] Among them, when the primary consensus node determines that the utilization rate reaches the preset threshold, it is determined that the primary consensus node is operating overloaded. For example, it is determined whether any one of the CPU utilization rate, memory occupancy rate, and network occupancy rate exceeds 80%. If any one exceeds 80%, it can be determined that the primary consensus node is operating overloaded. The primary consensus node sends a relinquishment request to other nodes. The relinquishment request is used to relinquish the status of the primary consensus node, and the relinquishment request includes the identifier of the blockchain group corresponding to the primary consensus node that requests to relinquish.

[0138] S407. Other consensus nodes switch views.

[0139] Among them, the view records the consensus status of each node, and nodes with the same view maintain the same list of primary and secondary consensus nodes. After receiving this relinquishment request, other consensus nodes restart the election process for the primary consensus node of the blockchain group and initiate a view switch.

[0140] Taking the PBFT algorithm as an example, the algorithm for view switching is as follows:

[0141] l i =(v i +n b )%n n

[0142] Among them, l i represents the identifier of the new primary consensus node, v i represents the view version, n b represents the number of blocks, and n n represents the number of consensus nodes.

[0143] When the Leader fails, a view switch will occur. If the view switch is successful, that is, at least 2f + 1 nodes reach the same view, then a new primary consensus node is selected according to the new view. If the new consensus node does not send a relinquishment request, the new consensus node starts to generate blocks; otherwise, the view switch continues until the views of at least 2f + 1 consensus nodes are the same.

[0144] After receiving the message indicating successful election sent by other consensus nodes, the primary consensus node is responsible for fetching transactions from the transaction pool and packing them into a new block. After receiving the consensus message, other secondary consensus nodes execute the consensus process from the threads of the consensus nodes. During the consensus process, the block is executed. After successful consensus, the block and the execution result of the block are submitted to the blockchain. The blockchain uniformly writes this information into the underlying storage, triggers the transaction pool to delete all transactions included in the block on the chain, and notifies the client of the transaction execution result in the form of a callback.

[0145] In the above embodiment, considering that the primary consensus node has a large amount of data processing, which will occupy a lot of resources and is likely to become the bottleneck of the entire blockchain system, the primary consensus node monitors the usage rate of its own hardware resources in real time. When the usage rate exceeds the preset threshold, it sends a waiver request so that other nodes can compete for the primary consensus node of the blockchain system, balance the data load of each consensus node, and improve the operating efficiency of the blockchain.

[0146] As Figure 8 shown, another embodiment of the present application provides a data processing device 500 for a blockchain. The data processing device 500 includes:

[0147] A receiving module 501, configured to receive multiple message data sent by other consensus nodes; wherein, the message data includes a blockchain group identifier;

[0148] A processing module 502, configured to screen the multiple message data according to the first data volume of the multiple message data and the maximum communication traffic of the node of the consensus node to obtain primary message data;

[0149] The processing module 502 is further configured to screen the primary message data according to the maximum communication traffic of each blockchain group to obtain secondary message data, and process the secondary message data.

[0150] Optionally, the processing module 502 is specifically configured to:

[0151] If the first data volume does not exceed the maximum communication traffic of the node, the primary message data is all the received message data;

[0152] If the first data volume exceeds the maximum communication traffic of the node and the second data volume of all key message data does not exceed the maximum communication traffic of the node, receive the key message data and some non-key message data sent by other nodes;

[0153] If the second data volume exceeds the maximum communication traffic of the node, receive the key message data sent by other consensus nodes.

[0154] Optionally, the key messages include node detection messages, consensus messages or transaction messages; the non-key messages include peer-to-peer message messages, synchronization messages or instruction messages.

[0155] Optionally, the processing module 502 is specifically configured to:

[0156] Obtain the third data volume of the primary message data corresponding to each blockchain group according to the statistics of the blockchain group identifier of the primary message data;

[0157] For each blockchain group, if the third data volume exceeds the maximum communication traffic of the corresponding group, randomly select some primary message data from the primary message data corresponding to the blockchain group as the secondary message data;

[0158] For each blockchain group, if the third data volume does not exceed the maximum communication traffic of the corresponding group, the secondary message data is the primary message data corresponding to the blockchain group.

[0159] Optionally, the maximum communication traffic of the group is:

[0160]

[0161] Wherein, represents the data volume of the node detection message received by the i-th blockchain group, represents the data volume of the consensus message received by the i-th blockchain group, represents the data volume of the transaction message received by the i-th blockchain group, the maximum data volume received by the i-th blockchain group, 1 ≤ i ≤ n, n represents the total number of blockchain groups, B max represents the maximum communication traffic of the node.

[0162] Optionally, the processing module 502 is specifically configured to:

[0163] For each secondary message data, determine the virtual processing unit used to process the secondary message data according to the blockchain group identifier of the secondary message data;

[0164] Control the virtual processing unit to process the secondary message data.

[0165] Optionally, the processing module 502 is further configured to:

[0166] Determine the transmission order of the secondary message data according to the message type of the secondary message data;

[0167] Transmit the secondary message data to the virtual processing unit through the link corresponding to the virtual processing unit according to the transmission order.

[0168] Optionally, the processing module 502 is further configured to:

[0169] Obtain the usage rate of the hardware resources by all virtual processing units;

[0170] When the usage rate reaches a preset threshold, send a relinquishment request to other nodes; wherein, the relinquishment request includes the identifier of the blockchain group corresponding to the primary consensus node that requests to relinquish.

[0171] As Figure 9 shown, the node device 600 provided by another embodiment of the present application includes: a transmitter 601, a receiver 602, a memory 603, and a processor 604.

[0172] The transmitter 601 is configured to send instructions and data;

[0173] The receiver 602 is configured to receive instructions and data;

[0174] The memory 603 is configured to store computer-executable instructions;

[0175] The processor 604 is configured to execute the computer-executable instructions stored in the memory to implement each step performed by the data processing method of the blockchain in the above embodiment. Specifically, reference can be made to the relevant descriptions in the foregoing embodiments of the data processing method of the blockchain.

[0176] Optionally, the above memory 603 can be either independent or integrated with the processor 604. When the memory 603 is independently provided, the node device further includes a bus for connecting the memory 603 and the processor 604.

[0177] Another embodiment of the present application provides a blockchain system, including a plurality of consensus nodes, wherein each consensus node includes a memory and a server;

[0178] The memory is configured to store a program;

[0179] The processor is configured to execute the program stored in the memory. When the program is executed, the processor is configured to execute the data processing method of the blockchain performed by the above node device.

[0180] Another embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the processor executes the computer-executable instructions, the data processing method of the blockchain performed by the above node device is implemented.

[0181] Another embodiment of the present application further provides a computer program product, including instructions, which implement the data processing method of the blockchain performed by the above node device when executed by the processor.

[0182] Those of ordinary skill in the art will understand that all or part of the steps for implementing the above method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including those of the above method embodiments; and the aforementioned storage medium includes: various media such as ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0183] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A data processing method for a blockchain, characterized in that, The method is applied to consensus nodes, and the method includes: Receiving multiple message data sent by other consensus nodes; wherein, the message data includes a blockchain group identifier; Screening the multiple message data according to the first data volume of the multiple message data and the maximum node communication traffic of the consensus node to obtain primary message data; Screening the primary message data according to the maximum group communication traffic of each blockchain group to obtain secondary message data, and processing the secondary message data; Wherein, the maximum group communication traffic is: Among them, represents the data volume of the node detection message received by the $i$-th blockchain group, represents the data volume of the consensus message received by the $i$-th blockchain group, represents the data volume of the transaction message received by the $i$-th blockchain group, the maximum data volume received by the $i$-th blockchain group, B max represents the maximum communication traffic of the node, where $1\leq i\leq n$, and $n$ represents the total number of blockchain groups.

2. The method according to claim 1, wherein Screening the multiple message data according to the first data volume of the multiple message data and the maximum node communication traffic of the consensus node to obtain primary message data, specifically including: If the first data volume does not exceed the maximum node communication traffic, the primary message data is all the received message data; If the first data volume exceeds the maximum node communication traffic and the second data volume of all key message data does not exceed the maximum node communication traffic, the primary message data is the key message data and part of the non-key message data sent by other nodes; If the second data volume exceeds the maximum node communication traffic, the primary message data is the key message data sent by other consensus nodes.

3. The method according to claim 2, wherein The key message data includes node detection messages, consensus messages or transaction messages; the non-key message data includes peer-to-peer message messages, synchronization messages or instruction messages.

4. The method according to claim 1, wherein Screening the primary message data according to the maximum group communication traffic of each blockchain group to obtain secondary message data, specifically including: Statistically obtaining the third data volume of the primary message data corresponding to each blockchain group according to the blockchain group identifier of the primary message data; For each blockchain group, if the third data volume exceeds the corresponding maximum group communication traffic, randomly select part of the primary message data corresponding to the blockchain group as the secondary message data; For each blockchain group, if the third data volume does not exceed the corresponding maximum group communication traffic, the secondary message data is the primary message data corresponding to the blockchain group.

5. The method according to any one of claims 1 to 4, characterized in that, And processing the secondary message data, specifically including: For each secondary message data, determining a virtual processing unit for processing the secondary message data according to the blockchain group identifier of the secondary message data; Controlling the virtual processing unit to process the secondary message data.

6. The method according to claim 5, wherein After determining the virtual processing unit for processing the secondary message data according to the blockchain group identifier of the secondary message data, the method further includes: Determining the transmission order of the secondary message data according to the message type of the secondary message data; Transmitting the secondary message data to the virtual processing unit through the link corresponding to the virtual processing unit according to the transmission order.

7. The method according to claim 5, wherein The consensus node is the main consensus node. After controlling the virtual processing unit to process the secondary message data, the method further includes: Statistically obtaining the utilization rate of the hardware resources by all virtual processing units; When the usage rate reaches a preset threshold, send a relinquishment request to other nodes; wherein, the relinquishment request includes an identifier of the blockchain group corresponding to the primary consensus node that requests to relinquish.

8. A node device, characterized in that, Comprising: a memory for storing a program; a processor for executing the program stored in the memory, and when the program is executed, the processor is configured to execute the data processing method according to any one of claims 1 to 7.

9. A blockchain system, characterized in that, Comprising a plurality of node devices according to claim 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions; wherein, when the computer-executable instructions are executed by a processor, they are configured to implement the data processing method according to any one of claims 1 to 7.

11. A computer program product comprising instructions, characterized in that, When the instructions are executed by a processor, they implement the data processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Communication control method based on identity information and router

    CN108156094A

  • Method and device for splitting block chain group

    CN110225110A