Data processing method and device based on block chain, equipment and medium
By dynamically updating the distribution strategy, based on the real-time transaction pool utilization rate of blockchain network nodes, the problem of transaction data loss when the transaction pool is full of blockchain network nodes is solved, and the load balancing and stability of data processing is achieved.
Patent Information
- Application Number
- CN202311462823.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-03
- Publication Date
- 2025-05-06
AI Technical Summary
The transaction pool capacity of blockchain network nodes is fixed, resulting in the inability to receive more transaction data when the transaction pool is full, resulting in the loss of transaction data.
By receiving transaction data to be stored on the blockchain network, obtaining the configured distribution strategy, selecting the target node and sending the transaction data. Determine the transaction pool usage rate based on the transaction cache and transaction pool configuration capacity of the target node. When the usage rate exceeds the preset value, update the distribution strategy to reduce the frequency of sending transaction data to the target node.
While avoiding transaction data loss, it can improve the stability and reliability of the blockchain network through load balancing.
Smart Images

Figure CN119945653A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to blockchain technology, and more particularly to the fields of finance and payment, and in particular to a blockchain-based data processing method, device, equipment and medium. Background Art
[0002] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods, namely blocks. Each block contains a batch of network transaction information, which is used to verify the validity of its information and generate the next block. It can be understood that the blockchain includes a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain network.
[0003] In traditional technology, the transaction pool capacity and related configuration parameters of the nodes in the blockchain network are fixed. When the number of transactions cached in the transaction pool of the node reaches the transaction pool capacity of the node, the node will no longer be able to receive transaction data, resulting in the loss of transaction data. Summary of the invention
[0004] Based on this, it is necessary to provide a blockchain-based data processing method, device, equipment and medium that can avoid the loss of transaction data in response to the above technical problems.
[0005] In a first aspect, the present application provides a data processing method based on blockchain, the method comprising:
[0006] Receive transaction data to be stored in the blockchain network;
[0007] Obtaining a configured distribution strategy, selecting a target node from the nodes of the blockchain network according to the configured distribution strategy, and sending the transaction data to the target node, wherein the transaction data is used to instruct the target node to store the transaction data in the blockchain network;
[0008] Acquire the transaction cache amount and transaction pool configuration capacity of the target node, and determine the transaction pool utilization rate of the target node according to the transaction cache amount and the transaction pool configuration capacity;
[0009] When the transaction pool usage rate exceeds a preset usage rate, the configured distribution strategy is updated, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy.
[0010] In a second aspect, the present application provides a data processing device based on blockchain, the device comprising:
[0011] A receiving module, used to receive transaction data to be stored in the blockchain network;
[0012] A distribution module, used to obtain a configured distribution strategy, select a target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node, wherein the transaction data is used to instruct the target node to store the transaction data in the blockchain network;
[0013] A determination module, used to obtain the transaction cache amount and transaction pool configuration capacity of the target node, and determine the transaction pool usage rate of the target node according to the transaction cache amount and the transaction pool configuration capacity;
[0014] An update module is used to update the configured distribution strategy when the usage rate of the transaction pool exceeds a preset usage rate, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy.
[0015] In one embodiment, the apparatus further comprises:
[0016] The adjustment module is used to obtain the block interval, block capacity and transaction validity period of the target node; determine the standard capacity of the transaction pool of the target node based on the block interval, the block capacity and the transaction validity period; obtain the transaction pool configuration capacity of the target node; when the transaction pool configuration capacity does not match the transaction pool standard capacity, adjust at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period of the target node.
[0017] In one embodiment, the adjustment module is further used to determine the transaction consumption speed of the target node based on the product of the block capacity and the block interval; and to determine the standard capacity of the transaction pool of the target node based on the product of the transaction validity period and the transaction consumption speed.
[0018] In one embodiment, the adjustment module is also used to determine the initial transaction pool standard capacity of the target node based on the product of the transaction validity period and the transaction consumption speed; obtain the node memory capacity of the target node and the memory occupancy of each transaction data; determine the maximum transaction pool capacity based on the ratio of the node memory capacity to the memory occupancy; and determine the smaller one of the initial transaction pool standard capacity and the transaction pool maximum capacity as the transaction pool standard capacity of the target node.
[0019] In one embodiment, the transaction pool configuration capacity, the block interval, the block capacity and the transaction validity period are obtained from the node configuration file of the target node, the node memory capacity is obtained from the memory information file of the target node, and the transaction cache amount and the memory occupancy are obtained from the software development kit provided by the blockchain network.
[0020] In one embodiment, the transaction pool configuration capacity, the block interval duration, the block capacity, the transaction validity duration, the node memory capacity, the transaction cache capacity and the memory occupancy are obtained periodically through scheduled tasks during the operation of the blockchain network.
[0021] In one embodiment, the adjustment module is also used to adjust the target node by at least reducing the transaction pool configuration capacity, extending the block interval, increasing the block capacity, or extending the transaction validity period when the transaction pool configuration capacity is greater than the transaction pool standard capacity.
[0022] In one embodiment, the adjustment module is also used to adjust the target node by at least increasing the transaction pool configuration capacity, shortening the block interval, reducing the block capacity, or shortening the transaction validity period when the transaction pool configuration capacity is less than the transaction pool standard capacity.
[0023] In one embodiment, the update module is also used to determine the transaction pool availability of the target node according to the transaction cache capacity and transaction pool configuration capacity of the target node when the transaction pool usage rate exceeds the preset usage rate; obtain the transaction cache capacity and transaction pool configuration capacity of the remaining nodes, the remaining nodes are nodes in the blockchain network other than the target node; determine the transaction pool availability of the remaining nodes according to the transaction cache capacity and transaction pool configuration capacity of the remaining nodes; update the configured distribution strategy according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes.
[0024] In one embodiment, the update module is also used to determine the remaining capacity of the transaction pool of the target node based on the difference between the transaction pool configuration capacity of the target node and the transaction cache amount of the target node; and determine the transaction pool availability of the target node based on the ratio of the remaining capacity of the transaction pool of the target node to the transaction pool configuration capacity of the target node.
[0025] In one embodiment, the update module is further used to determine the remaining capacity of the transaction pool of the remaining nodes based on the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes; and determine the transaction pool availability of the remaining nodes based on the ratio of the remaining capacity of the transaction pool of the remaining nodes to the transaction pool configuration capacity of the remaining nodes.
[0026] In one embodiment, the update module is also used to determine an updated node from the target node and the remaining nodes based on the transaction pool availability of the target node and the transaction pool availability of the remaining nodes; determine the frequency of sending transaction data to the updated node to obtain an updated distribution strategy obtained by updating the configured distribution strategy, and the determined frequency is positively correlated with the transaction pool availability of the updated node.
[0027] In a third aspect, the present application provides a computer device 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 in the method embodiments of the present application are implemented.
[0028] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the method embodiments of the present application.
[0029] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps in the method embodiments of the present application when the computer program is executed by a processor.
[0030] The above-mentioned blockchain-based data processing method, device, equipment, medium and computer program product, by receiving transaction data to be stored in the blockchain network, obtains the configured distribution strategy, selects the target node from the nodes of the blockchain network according to the configured distribution strategy, and sends the transaction data to the target node, and the transaction data is used to instruct the target node to store the transaction data in the blockchain network. The transaction cache volume and transaction pool configuration capacity of the target node are obtained, and the transaction pool usage rate of the target node is determined based on the transaction cache volume and the transaction pool configuration capacity. When the transaction pool usage rate exceeds the preset usage rate, the configured distribution strategy is updated, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy. Compared with traditional data processing methods, the present application calculates the real-time transaction pool usage rate of the target node by obtaining the transaction cache amount and transaction pool configuration capacity of the target node from the blockchain network. When the real-time calculated transaction pool usage rate exceeds the preset usage rate, it means that the number of transaction data cached in the transaction pool of the target node has almost reached the transaction pool capacity of the target node. At this time, by timely updating the configured distribution strategy, the frequency of sending transaction data to the target node is reduced, and the frequency of sending transaction data to other nodes in the blockchain network except the target node is increased, thereby achieving node load balancing and avoiding the loss of transaction data. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 This is an application environment diagram of a data processing method based on blockchain in one embodiment;
[0032] Figure 2 A flowchart of a data processing method based on blockchain in one embodiment;
[0033] Figure 3 Schematic diagram of the process of generating and uploading a new block in one embodiment;
[0034] Figure 4 A schematic diagram of the structure of a block in a blockchain network in one embodiment;
[0035] Figure 5 A schematic diagram of collecting information from a blockchain network in one embodiment;
[0036] Figure 6 A schematic diagram of dynamically adjusting node parameters in a blockchain network in one embodiment;
[0037] Figure 7 A schematic diagram of the load balancing principle of transaction data in one embodiment;
[0038] Figure 8 is a schematic diagram of the architecture of a data processing system in one embodiment;
[0039] Fig. 9 A schematic diagram of triggering parameter adjustment and load balancing based on collected information in one embodiment;
[0040] Fig.10 A schematic diagram of a data processing flow based on a data processing system in one embodiment;
[0041] Fig.11 A flowchart of a data processing method based on blockchain in another embodiment;
[0042] Fig.12 It is a structural block diagram of a data processing device based on blockchain in one embodiment;
[0043] Fig.13 It is a structural block diagram of a data processing device based on blockchain in another embodiment;
[0044] Fig.14 is an internal structure diagram of a computer device in one embodiment;
[0045] Fig.15 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0047] The data processing method based on blockchain provided in this application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can be set up separately and can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other servers. Among them, the terminal 102 can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, vehicle-mounted terminals, intelligent voice interaction devices, aircraft, smart home appliances and portable wearable devices. Smart home appliances can be smart speakers, smart TVs and smart air conditioners. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, cloud security, host security and other network security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 102 and the server 104 can be directly or indirectly connected by wired or wireless communication, and this application is not limited here.
[0048] The terminal 102 may send the transaction data to be stored in the blockchain network to the server 104. The server 104 may receive the transaction data to be stored in the blockchain network, obtain the configured distribution strategy, select the target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node. The transaction data is used to instruct the target node to store the transaction data in the blockchain network. The server 104 obtains the transaction cache volume and the transaction pool configuration capacity of the target node, and determines the transaction pool usage rate of the target node based on the transaction cache volume and the transaction pool configuration capacity. When the transaction pool usage rate exceeds the preset usage rate, the server 104 updates the configured distribution strategy, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy.
[0049] In one embodiment, Figure 2 As shown, a data processing method based on blockchain is provided, which can be applied to a computer device, which can be a terminal or a server, that is, the method can be executed by the terminal or the server alone, or can be implemented through interaction between the terminal and the server. This embodiment takes the method applied to a computer device as an example for explanation, and includes the following steps:
[0050] Step 202, receiving transaction data to be stored in the blockchain network.
[0051] Among them, the blockchain network is a distributed database. The blockchain network includes multiple nodes, which jointly maintain and update the data status through the collaboration of multiple nodes. The main characteristics of the blockchain network include decentralization, high security, high reliability, high transparency and high efficiency. Decentralization means that the blockchain storage is decentralized, and the data is stored on each node in the entire network, rather than concentrated on a central server. This means that the data will not be lost due to the failure of a single node, and it is more difficult to be attacked and tampered with. High security means that the blockchain storage uses cryptography and distributed protocols, and the information security in the data encryption and verification process is very high, and cannot be modified or tampered with, which can ensure the security of the data. High reliability means that the blockchain storage uses data replication and data verification mechanisms to ensure the reliability and integrity of the data. Even if some nodes fail or the data is destroyed, the data can be restored through other nodes. Transparency means that all data in the blockchain storage is publicly visible, and anyone can view and verify the data in it, which can ensure the transparency and fairness of the data. Efficiency means that the blockchain storage uses a distributed data storage and processing method, which can quickly process and store large amounts of data with high efficiency. Transaction data refers to digital transaction records transmitted and stored in the network, and is an important part of the blockchain. Each transaction data contains a lot of information, such as the sender, receiver, transaction amount, transaction type and timestamp, etc. This information is packaged into transaction data and transmitted in the network.
[0052] Specifically, the client can obtain the transaction data to be stored in the blockchain network and send the transaction data to the computer device. The computer device can receive the transaction data to be stored in the blockchain network sent by the client.
[0053] Step 204, obtain the configured distribution strategy, select a target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node, where the transaction data is used to instruct the target node to store the transaction data in the blockchain network.
[0054] The distribution strategy is a scheme for distributing transaction data to nodes in the blockchain network. It is understood that the distribution strategy specifies the nodes to which the transaction data is distributed and the frequency of data transmission for the nodes to which the transaction data is distributed. The target node is the node to which the transaction data is distributed specified in the distribution strategy. It is understood that the number of target nodes is at least one.
[0055] Specifically, the computer device can obtain the configured distribution strategy, and select at least one target node specified by the configured distribution strategy from the nodes of the blockchain network. For each target node, the transaction data is sent to the target node according to the data sending frequency for the target node specified by the configured distribution strategy. After receiving the transaction data, the target node can verify the legitimacy of the transaction data, and generate a block based on the transaction data after the legitimacy verification is passed. It can be understood that the block includes the transaction data. Furthermore, the target node can broadcast the block to the blockchain network for consensus, and add the block to the blockchain network for storage after the consensus is passed.
[0056] In one embodiment, Figure 3 As shown, the process of generating a new block can be described as follows: the computer device can receive the transaction data sent by the client. For each target node, the computer device can send the transaction data to the target node according to the data sending frequency for the target node specified by the configured distribution strategy. The target node can receive the transaction data and cache the transaction data in the transaction pool. The computer device can verify the legitimacy of the transaction data in the transaction pool, and package the transaction data into blocks after the legitimacy verification is passed. It can be understood that the block includes transaction data. Furthermore, the target node can broadcast the block to other nodes in the blockchain network except the target node for consensus, and add the block to the blockchain network for storage after other consensuses are passed.
[0057] In one embodiment, Figure 4 As shown, it is a schematic diagram of the block structure in the blockchain network. Each block includes the transaction data stored in this block and the hash value of the transaction data, that is, the hash of this block, and the hash value of the transaction data in the previous block, that is, the hash of the previous block. Taking block 2 as an example, block 2 includes the transaction data stored in block 2 and the hash value of the transaction data, that is, the hash of this block, and the hash value of the transaction data in block 1, that is, the hash of the previous block. Taking block 3 as an example, block 3 includes the transaction data stored in block 3 and the hash value of the transaction data, that is, the hash of this block, and the hash value of the transaction data in block 2, that is, the hash of the previous block. Each block is connected by a hash value to form a blockchain. It can be understood that the block can also include information such as the timestamp when the block is generated.
[0058] In one embodiment, for each target node, the computer device may obtain the network address of the target node, and send the transaction data to the target node according to the network address of the target node.
[0059] In one embodiment, the computer device may obtain the operating status of each node in the blockchain network, and the operating status may include normal and abnormal. Furthermore, the computer device may select a target node with a normal operating status from the nodes of the blockchain network according to the configured distribution strategy. It is understood that a node with an abnormal operating status may have a fault or be offline.
[0060] Step 206, obtaining the transaction cache volume and transaction pool configuration capacity of the target node, and determining the transaction pool utilization rate of the target node according to the transaction cache volume and transaction pool configuration capacity.
[0061] The transaction cache volume is the amount of transaction data cached in the node's transaction pool. The transaction pool configuration capacity is the maximum amount of transaction data cached for the node's transaction pool configuration.
[0062] Specifically, for each target node, the computer device can obtain the transaction cache volume and transaction pool configuration capacity of the target node from the blockchain network, and determine the transaction pool utilization rate of the target node based on the ratio of the transaction cache volume to the transaction pool configuration capacity.
[0063] In one embodiment, for each target node, the computer device may directly use the ratio of the transaction cache volume to the transaction pool configuration capacity as the transaction pool usage rate of the target node.
[0064] In one embodiment, for each target node, the computer device may obtain a weighting coefficient, and determine the transaction pool usage rate of the target node based on the weighting coefficient and the ratio of the transaction cache volume to the transaction pool configuration capacity.
[0065] In one embodiment, for each target node, the computer device may obtain the transaction cache capacity of the target node from the software development kit provided by the blockchain network. Also, the computer device may obtain the node configuration file of the target node, and read the transaction pool configuration capacity of the target node from the node configuration file of the target node.
[0066] Step 208, when the transaction pool usage rate exceeds the preset usage rate, the configured distribution strategy is updated, wherein the updated distribution strategy indicates a frequency of sending transaction data to the target node, which is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy.
[0067] Specifically, for each target node, the computer device can obtain a preset usage rate for the target node, and when the transaction pool usage rate of the target node exceeds the preset usage rate, the configured distribution strategy is updated. Among them, the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy before the update. It can be understood that if the updated distribution strategy also specifies the distribution of transaction data to the target node, the frequency of data sending to the target node by the updated distribution strategy is lower than the frequency of data sending to the target node by the configured distribution strategy before the update. If the updated distribution strategy no longer specifies the distribution of transaction data to the target node, the updated distribution strategy indicates that transaction data is no longer distributed to the target node, that is, the frequency of data sending to the target node by the updated distribution strategy is zero.
[0068] In one embodiment, for each target node, when the transaction pool usage rate of the target node exceeds the preset usage rate, the computer device can obtain the transaction cache volume and transaction pool configuration capacity of each node in the blockchain network, and update the configured distribution strategy according to the transaction cache volume and transaction pool configuration capacity of each node in the blockchain network. It can be understood that each node in the blockchain network includes the target node and the remaining nodes in the blockchain network except the target node.
[0069] In one embodiment, the computer device may determine the transaction pool usage of each node according to the transaction cache volume and transaction pool configuration capacity of each node in the blockchain network, and update the configured distribution strategy based on the transaction pool usage of each node in the blockchain network.
[0070] In the above-mentioned blockchain-based data processing method, by receiving transaction data to be stored in the blockchain network, a configured distribution strategy is obtained, and according to the configured distribution strategy, a target node is selected from the nodes of the blockchain network, and the transaction data is sent to the target node, and the transaction data is used to instruct the target node to store the transaction data in the blockchain network. The transaction cache volume and transaction pool configuration capacity of the target node are obtained, and the transaction pool utilization rate of the target node is determined based on the transaction cache volume and the transaction pool configuration capacity. When the transaction pool utilization rate exceeds the preset utilization rate, the configured distribution strategy is updated, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy. Compared with traditional data processing methods, the present application calculates the real-time transaction pool usage rate of the target node by obtaining the transaction cache amount and transaction pool configuration capacity of the target node from the blockchain network. When the real-time calculated transaction pool usage rate exceeds the preset usage rate, it means that the number of transaction data cached in the transaction pool of the target node has almost reached the transaction pool capacity of the target node. At this time, by timely updating the configured distribution strategy, the frequency of sending transaction data to the target node is reduced, and the frequency of sending transaction data to other nodes in the blockchain network except the target node is increased, thereby achieving node load balancing and avoiding the loss of transaction data.
[0071] In one embodiment, the method further includes: obtaining the block interval, block capacity and transaction validity period of the target node; determining the standard capacity of the transaction pool of the target node based on the block interval, block capacity and transaction validity period; obtaining the transaction pool configuration capacity of the target node; when the transaction pool configuration capacity does not match the transaction pool standard capacity, adjusting at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period of the target node.
[0072] Among them, the block interval is the interval between nodes generating blocks. It can be understood that the block interval is the time it takes for a node to generate a block. Block capacity is the amount of transaction data that can be accommodated in a block. Transaction validity period is the validity period of transaction data. The transaction pool standard capacity is the optimal capacity of the node's transaction pool. It can be understood that if the transaction pool capacity is greater than the transaction pool standard capacity, the transaction data cached in the transaction pool is likely to become invalid due to exceeding the transaction validity period. If the transaction pool capacity is less than the transaction pool standard capacity, it will lead to a waste of node processing power.
[0073] Specifically, the computer device can obtain the block interval duration, block capacity and transaction validity duration of the target node from the blockchain network, and calculate the target node's transaction pool standard capacity based on the target node's block interval duration, block capacity and transaction validity duration. Furthermore, the computer device can obtain the target node's transaction pool configuration capacity, and compare the target node's transaction pool configuration capacity with the transaction pool standard capacity. When the transaction pool configuration capacity does not match the transaction pool standard capacity, the computer device can adjust at least one of the target node's transaction pool configuration capacity, block interval duration, block capacity or transaction validity duration.
[0074] In one embodiment, the transaction pool configuration capacity does not match the transaction pool standard capacity, which may be that the transaction pool configuration capacity is not equal to the transaction pool standard capacity.
[0075] In one embodiment, the computer device may determine the standard capacity range based on the standard capacity of the trading pool. The mismatch between the configured capacity of the trading pool and the standard capacity of the trading pool may be that the configured capacity of the trading pool does not fall within the standard capacity range.
[0076] In one embodiment, the computer device may obtain the transaction pool configuration capacity, block interval duration, block capacity, and transaction validity duration from the node configuration file of the target node.
[0077] In the above embodiment, the target node's transaction pool standard capacity is determined by obtaining the block interval, block capacity and transaction validity period of the target node, and based on the block interval, block capacity and transaction validity period. When the transaction pool configuration capacity does not match the transaction pool standard capacity, it means that the current configuration for the target node is not optimal and there is still room for optimization. At this time, by adjusting at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period of the target node, compared with the traditional data processing method in which the transaction pool capacity and its related configuration parameters are fixed, this embodiment can optimize the configuration for the target node, thereby further avoiding the loss of transaction data.
[0078] In one embodiment, based on the block interval, block capacity and transaction validity period, the standard capacity of the transaction pool of the target node is determined, including: determining the transaction consumption speed of the target node according to the product of the block capacity and the block interval; determining the standard capacity of the transaction pool of the target node according to the product of the transaction validity period and the transaction consumption speed.
[0079] Among them, the transaction consumption speed is the speed at which the node processes transaction data.
[0080] In one embodiment, the computer device can determine the transaction consumption speed of the target node based on the product of the block capacity and the block interval, and directly use the product of the transaction validity period and the transaction consumption speed as the standard capacity of the transaction pool of the target node.
[0081] In one embodiment, the computer device may directly use the product of the block capacity and the block interval as the transaction consumption speed of the target node, and determine the standard capacity of the transaction pool of the target node based on the product of the transaction validity period and the transaction consumption speed.
[0082] In one embodiment, the computer device may directly use the product of the block capacity and the block interval as the transaction consumption speed of the target node, and directly use the product of the transaction validity period and the transaction consumption speed as the standard capacity of the transaction pool of the target node.
[0083] In one embodiment, the target node's transaction pool standard capacity can be calculated using the following formula:
[0084] consume_speed=block_capacity×block_interval
[0085] best_tx_capacity=tx_timeout×consume_speed
[0086] Among them, block_capacity represents the block capacity of the target node, block_interval represents the block interval of the target node, consume_speed represents the transaction consumption speed of the target node, tx_timeout represents the transaction validity period of the transaction data, and best_tx_capacity represents the standard capacity of the transaction pool of the target node.
[0087] In one embodiment, the computer device may obtain a first weighting coefficient, and determine the transaction consumption speed of the target node based on the first weighting coefficient and the product of the block capacity and the block interval time. Furthermore, the computer device may obtain a second weighting coefficient, and determine the standard capacity of the transaction pool of the target node based on the second weighting coefficient and the product of the transaction validity time and the transaction consumption speed.
[0088] In the above embodiment, the transaction consumption speed of the target node is determined by multiplying the block capacity by the block interval, and the standard capacity of the transaction pool of the target node is determined by multiplying the transaction validity period by the transaction consumption speed. This can improve the accuracy of the standard capacity of the transaction pool, so as to better optimize the configuration of the target node, thereby further avoiding the loss of transaction data.
[0089] In one embodiment, the standard capacity of the transaction pool of the target node is determined according to the product of the transaction validity period and the transaction consumption speed, including: determining the initial standard capacity of the transaction pool of the target node according to the product of the transaction validity period and the transaction consumption speed; obtaining the node memory capacity of the target node and the memory occupancy of each transaction data; determining the maximum capacity of the transaction pool according to the ratio of the node memory capacity to the memory occupancy; and determining the smaller one of the initial standard capacity of the transaction pool and the maximum capacity of the transaction pool as the standard capacity of the transaction pool of the target node.
[0090] Among them, memory usage is the amount of memory occupied by a transaction data. The maximum capacity of the transaction pool is the maximum amount of transaction data that the node's transaction pool can accommodate.
[0091] Specifically, the computer device can determine the initial transaction pool standard capacity of the target node based on the product of the transaction validity period and the transaction consumption speed. It can be understood that the initial transaction pool standard capacity is not the transaction pool standard capacity finally determined by the target node. The memory usage of each transaction data is the same. The computer device can obtain the node memory capacity of the target node and the memory usage of each transaction data, and determine the ratio of the node memory capacity to the memory usage. The computer device can determine the maximum capacity of the transaction pool based on the ratio of the node memory capacity to the memory usage. Furthermore, the computer device can compare the initial transaction pool standard capacity with the maximum capacity of the transaction pool, and determine the smaller of the initial transaction pool standard capacity and the maximum capacity of the transaction pool as the transaction pool standard capacity of the target node.
[0092] In one embodiment, the computer device may directly use the product of the effective duration of the transaction and the transaction consumption speed as the initial transaction pool standard capacity of the target node. The computer device may obtain the node memory capacity of the target node and the memory usage of each transaction data, and determine the ratio of the node memory capacity to the memory usage. The computer device may directly use the ratio of the node memory capacity to the memory usage as the maximum capacity of the transaction pool. Furthermore, the computer device may compare the initial transaction pool standard capacity with the maximum capacity of the transaction pool, and determine the smaller of the initial transaction pool standard capacity and the maximum capacity of the transaction pool as the target node's transaction pool standard capacity.
[0093] In one embodiment, the maximum capacity of the transaction pool of the target node can be calculated by the following formula:
[0094] max_tx_capacity = node memory capacity / memory usage of a transaction data
[0095] Among them, max_tx_capacity represents the maximum capacity of the transaction pool of the target node.
[0096] In one embodiment, the computer device may obtain the node memory capacity from the memory information file of the target node, and obtain the memory usage of each transaction data from the software development kit provided by the blockchain network.
[0097] In the above embodiment, the initial transaction pool standard capacity of the target node is determined by multiplying the transaction validity period and the transaction consumption speed, and the maximum transaction pool capacity is determined according to the ratio of the node memory capacity to the memory usage. Furthermore, by determining the smaller of the initial transaction pool standard capacity and the transaction pool maximum capacity as the transaction pool standard capacity of the target node, it is possible to avoid the transaction pool standard capacity exceeding the transaction pool maximum capacity, and further improve the accuracy of the transaction pool standard capacity, so as to better optimize the configuration for the target node, thereby further avoiding the loss of transaction data.
[0098] In one embodiment, the transaction pool configuration capacity, block interval, block capacity and transaction validity period are obtained from the node configuration file of the target node, the node memory capacity is obtained from the memory information file of the target node, and the transaction cache capacity and memory usage are obtained from the software development kit provided by the blockchain network.
[0099] The node configuration file is a file used to configure the functions supported by the node. The memory information file is a file that stores the memory information of the node.
[0100] Specifically, the computer device may receive transaction data to be stored in the blockchain network, obtain the configured distribution strategy, select the target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node, and the transaction data is used to indicate that the target node stores the transaction data in the blockchain network. The computer device may obtain the transaction cache volume of the target node from the software development kit provided by the blockchain network. The computer device may obtain the transaction pool configuration capacity from the node configuration file of the target node, and determine the transaction pool usage rate of the target node according to the transaction cache volume and the transaction pool configuration capacity. When the transaction pool usage rate exceeds the preset usage rate, the computer device may update the configured distribution strategy, wherein the updated distribution strategy indicates the frequency of sending transaction data to the target node, which is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy. The computer device may obtain the block interval duration, block capacity and transaction validity duration of the target node from the node configuration file of the target node, determine the transaction consumption speed of the target node according to the product of the block capacity and the block interval duration, and determine the initial transaction pool standard capacity of the target node according to the product of the transaction validity duration and the transaction consumption speed. The computer device may obtain the node memory capacity of the target node from the memory information file of the target node. The computer device may also obtain the memory usage of each transaction data from the software development kit provided by the blockchain network, determine the maximum capacity of the transaction pool according to the ratio of the node memory capacity to the memory usage, and determine the smaller of the initial transaction pool standard capacity and the transaction pool maximum capacity as the transaction pool standard capacity of the target node. When the transaction pool configuration capacity does not match the transaction pool standard capacity, the computer device may adjust at least one of the transaction pool configuration capacity, block interval duration, block capacity or transaction validity duration of the target node.
[0101] In the above embodiment, the transaction pool configuration capacity, block interval, block capacity and transaction validity period are obtained from the node configuration file of the target node. The node memory capacity is obtained from the memory information file of the target node. And, the transaction cache amount and memory usage are obtained from the software development kit provided by the blockchain network, which can improve the efficiency of obtaining the transaction pool configuration capacity, block interval, block capacity, transaction validity period, node memory capacity, transaction cache amount and memory usage.
[0102] In one embodiment, the transaction pool configuration capacity, block interval, block capacity, transaction validity period, node memory capacity, transaction cache capacity and memory usage are obtained periodically through scheduled tasks during the operation of the blockchain network.
[0103] In one embodiment, a computer device may receive transaction data to be stored in a blockchain network, obtain a configured distribution strategy, select a target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node, where the transaction data is used to instruct the target node to store the transaction data in the blockchain network. Furthermore, the computer device may collect information from the blockchain network at preset intervals through a scheduled task during the operation of the blockchain network. Specifically, the computer device may obtain the transaction pool configuration capacity, block interval duration, block capacity, and transaction validity duration from the node configuration file of the target node at preset intervals through a scheduled task during the operation of the blockchain network, obtain the node memory capacity from the memory information file of the target node, and obtain the transaction cache amount and memory occupancy from the software development kit provided by the blockchain network. The computer device may determine the transaction pool usage rate of the target node based on the transaction cache amount and the transaction pool configuration capacity. When the transaction pool usage rate exceeds the preset usage rate, the computer device may update the configured distribution strategy, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy. The computer device can determine the transaction consumption speed of the target node based on the product of the block capacity and the block interval time, and determine the initial transaction pool standard capacity of the target node based on the product of the transaction validity time and the transaction consumption speed. The computer device can determine the maximum capacity of the transaction pool based on the ratio of the node memory capacity to the memory usage, and determine the smaller of the initial transaction pool standard capacity and the transaction pool maximum capacity as the transaction pool standard capacity of the target node. When the transaction pool configuration capacity does not match the transaction pool standard capacity, the computer device can dynamically adjust at least one of the transaction pool configuration capacity, block interval time, block capacity or transaction validity time of the target node.
[0104] In one embodiment, Figure 5 As shown, the blockchain network includes multiple nodes, namely, node 1, node 2, node 3, node 4, ..., node n, where n is a positive integer. If the target nodes indicated by the configured distribution strategy are node 2 and node 3, the computer device can obtain the transaction pool configuration capacity, block interval duration, block capacity and transaction validity duration from the node configuration files corresponding to node 2 and node 3 respectively through a scheduled task at preset intervals during the operation of the blockchain network, obtain the node memory capacity from the memory information files corresponding to node 2 and node 3 respectively, and obtain the transaction cache amount and memory usage from the software development kit provided by the blockchain network.
[0105] In the above embodiment, during the operation of the blockchain network, the transaction pool configuration capacity, block interval, block capacity, transaction validity period, node memory capacity, transaction cache capacity and memory usage are regularly obtained through scheduled tasks, which does not interfere with the normal operation of the blockchain network, thereby improving data processing efficiency and saving hardware resources used to support data processing.
[0106] In one embodiment, when the transaction pool configuration capacity does not match the transaction pool standard capacity, at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period is adjusted for the target node, including: when the transaction pool configuration capacity is greater than the transaction pool standard capacity, at least one of the transaction pool configuration capacity is reduced, the block interval is extended, the block capacity is increased or the transaction validity period is extended is adjusted for the target node.
[0107] Specifically, the transaction pool configuration capacity does not match the transaction pool standard capacity, including the transaction pool configuration capacity is greater than the transaction pool standard capacity. When the transaction pool configuration capacity is greater than the transaction pool standard capacity, the computer device can adjust the target node by reducing the transaction pool configuration capacity, extending the block interval, increasing the block capacity, or extending the transaction validity period, so as to optimize the configuration of the target node, thereby further avoiding the loss of transaction data.
[0108] In the above embodiment, when the transaction pool configuration capacity is greater than the transaction pool standard capacity, the configuration of the target node can be effectively optimized by adjusting at least one of reducing the transaction pool configuration capacity, extending the block interval, increasing the block capacity, or extending the transaction validity period, thereby further avoiding the loss of transaction data.
[0109] In one embodiment, when the transaction pool configuration capacity does not match the transaction pool standard capacity, at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period is adjusted for the target node, including: when the transaction pool configuration capacity is less than the transaction pool standard capacity, at least one of the transaction pool configuration capacity is increased, the block interval is shortened, the block capacity is reduced or the transaction validity period is shortened.
[0110] Specifically, the transaction pool configuration capacity does not match the transaction pool standard capacity, including the transaction pool configuration capacity is less than the transaction pool standard capacity. When the transaction pool configuration capacity is less than the transaction pool standard capacity, the computer device can adjust the target node by increasing the transaction pool configuration capacity, shortening the block interval, reducing the block capacity, or shortening the transaction validity period, so as to optimize the configuration of the target node, thereby further avoiding the loss of transaction data.
[0111] In the above embodiment, when the transaction pool configuration capacity is less than the transaction pool standard capacity, the configuration of the target node can be effectively optimized by increasing the transaction pool configuration capacity, shortening the block interval, reducing the block capacity, or shortening the transaction validity period, thereby further avoiding the loss of transaction data.
[0112] In one embodiment, Figure 6 As shown, the computer device can determine whether the transaction pool configuration capacity matches the transaction pool standard capacity through scheduling and computing services. When the transaction pool configuration capacity does not match the transaction pool standard capacity, the computer device can optimize the configuration for the target node by adjusting the relevant configuration parameters of the target node. Specifically, it can be understood that the transaction pool configuration capacity does not match the transaction pool standard capacity, including that the transaction pool configuration capacity is greater than the transaction pool standard capacity, and that the transaction pool configuration capacity is less than the transaction pool standard capacity. When the transaction pool configuration capacity is greater than the transaction pool standard capacity, the computer device can automatically adjust the target node to reduce the transaction pool configuration capacity, extend the block interval, increase the block capacity, or extend the transaction validity period through the software development kit provided by the blockchain network. At least one of the following adjustments. In addition, the target node can also be adjusted to reduce the transaction pool configuration capacity, extend the block interval, increase the block capacity, or extend the transaction validity period by manually editing the configuration file of the target node. When the transaction pool configuration capacity is less than the transaction pool standard capacity, the computer device can automatically increase the transaction pool configuration capacity, shorten the block interval, reduce the block capacity, or shorten the transaction validity period of the target node through the software development kit provided by the blockchain network, so as to optimize the configuration of the target node, thereby further avoiding the loss of transaction data. In addition, the target node can also be adjusted to increase the transaction pool configuration capacity, shorten the block interval, reduce the block capacity, or shorten the transaction validity period by manually editing the configuration file of the target node. It can be understood that the computer device will take effect after refreshing the target node to optimize the configuration of the target node, thereby further avoiding the loss of transaction data.
[0113] In one embodiment, when the transaction pool usage rate exceeds the preset usage rate, the configured distribution strategy is updated, including: when the transaction pool usage rate exceeds the preset usage rate, the transaction pool availability of the target node is determined according to the transaction cache volume and transaction pool configuration capacity of the target node; the transaction cache volume and transaction pool configuration capacity of the remaining nodes are obtained, and the remaining nodes are nodes other than the target node in the blockchain network; the transaction pool availability of the remaining nodes is determined according to the transaction cache volume and transaction pool configuration capacity of the remaining nodes; and the configured distribution strategy is updated according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes.
[0114] Among them, the transaction pool availability of the target node is the availability of the transaction pool of the target node. The transaction pool availability of the remaining nodes is the availability of the transaction pool of the remaining nodes.
[0115] Specifically, for each target node, when the transaction pool usage rate of the target node exceeds the preset usage rate of the target node, the computer device may determine the transaction pool availability of the target node according to the transaction cache volume and transaction pool configuration capacity of the target node. The computer device may determine the nodes other than the target node in the blockchain network as remaining nodes, and the computer device may obtain the transaction cache volume and transaction pool configuration capacity of each remaining node. For each remaining node, the computer device may determine the transaction pool availability of the remaining node according to the transaction cache volume and transaction pool configuration capacity of the remaining node. Furthermore, the computer device may update the configured distribution strategy according to the transaction pool availability of the target node and the transaction pool availability corresponding to each remaining node.
[0116] In one embodiment, the computer device may calculate the target node's transaction pool remaining capacity based on the target node's transaction pool configuration capacity and the target node's transaction cache volume. Furthermore, the computer device may calculate the target node's transaction pool availability rate based on the target node's transaction pool remaining capacity and the target node's transaction pool configuration capacity. The target node's transaction pool remaining capacity is the target node's transaction pool remaining capacity.
[0117] In one embodiment, the computer device may calculate the remaining capacity of the transaction pool of the remaining nodes according to the transaction pool configuration capacity of the remaining nodes and the transaction cache volume of the remaining nodes. Furthermore, the computer device may calculate the transaction pool availability of the remaining nodes according to the transaction pool remaining capacity of the remaining nodes and the transaction pool configuration capacity of the remaining nodes. The remaining capacity of the transaction pool of the remaining nodes is the remaining capacity of the transaction pool of the remaining nodes.
[0118] In one embodiment, the computer device may determine an updated node from the target node and the remaining nodes according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes, so as to obtain an updated distribution strategy obtained by updating the configured distribution strategy. It can be understood that the updated distribution strategy is used to indicate that the transaction data is sent to the determined update node.
[0119] In the above embodiment, the transaction pool availability of the target node is determined by the transaction cache capacity and transaction pool configuration capacity of the target node, and the transaction pool availability of the remaining nodes is determined by the transaction cache capacity and transaction pool configuration capacity of the remaining nodes. Then, according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes, the configured distribution strategy is updated, which can improve the accuracy of the updated distribution strategy and further improve the rationality of load balancing, thereby further avoiding the loss of transaction data.
[0120] In one embodiment, the transaction pool availability of the target node is determined based on the transaction cache capacity and transaction pool configuration capacity of the target node, including: determining the remaining capacity of the transaction pool of the target node based on the difference between the transaction pool configuration capacity of the target node and the transaction cache capacity of the target node; determining the transaction pool availability of the target node based on the ratio of the remaining capacity of the transaction pool of the target node to the transaction pool configuration capacity of the target node.
[0121] Specifically, the computer device may determine the difference between the transaction pool configuration capacity of the target node and the transaction cache volume of the target node, and calculate the target node's transaction pool remaining capacity based on the difference between the target node's transaction pool configuration capacity and the target node's transaction cache volume. Further, the computer device may determine the ratio of the target node's transaction pool remaining capacity to the target node's transaction pool configuration capacity, and calculate the target node's transaction pool availability based on the ratio of the target node's transaction pool remaining capacity to the target node's transaction pool configuration capacity.
[0122] In one embodiment, the computer device may directly use the difference between the transaction pool configuration capacity of the target node and the transaction cache capacity of the target node as the target node's transaction pool remaining capacity. Furthermore, the computer device may calculate the target node's transaction pool availability rate based on the ratio of the target node's transaction pool remaining capacity to the target node's transaction pool configuration capacity.
[0123] In one embodiment, the computer device may calculate the target node's transaction pool remaining capacity based on the difference between the target node's transaction pool configuration capacity and the target node's transaction cache capacity. Furthermore, the computer device may directly use the ratio of the target node's transaction pool remaining capacity to the target node's transaction pool configuration capacity as the target node's transaction pool availability.
[0124] In one embodiment, the computer device may directly use the difference between the transaction pool configuration capacity of the target node and the transaction cache capacity of the target node as the target node's transaction pool remaining capacity. Furthermore, the computer device may directly use the ratio of the target node's transaction pool remaining capacity to the target node's transaction pool configuration capacity as the target node's transaction pool availability.
[0125] In the above embodiment, the remaining capacity of the transaction pool of the target node is determined by the difference between the transaction pool configuration capacity of the target node and the transaction cache amount of the target node, and then the transaction pool availability of the target node is determined by the ratio of the remaining capacity of the transaction pool of the target node to the transaction pool configuration capacity of the target node. The accuracy of the transaction pool availability of the target node can be improved, the accuracy of the updated distribution strategy can be further improved, and the loss of transaction data can be further avoided.
[0126] In one embodiment, the transaction pool availability of the remaining nodes is determined based on the transaction cache capacity of the remaining nodes and the transaction pool configuration capacity, including: determining the transaction pool remaining capacity of the remaining nodes based on the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes; determining the transaction pool availability of the remaining nodes based on the ratio of the transaction pool remaining capacity of the remaining nodes to the transaction pool configuration capacity of the remaining nodes.
[0127] Specifically, the computer device may determine the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes, and calculate the transaction pool remaining capacity of the remaining nodes according to the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes. Furthermore, the computer device may determine the ratio of the transaction pool remaining capacity of the remaining nodes to the transaction pool configuration capacity of the remaining nodes, and calculate the transaction pool availability of the remaining nodes according to the ratio of the transaction pool remaining capacity of the remaining nodes to the transaction pool configuration capacity of the remaining nodes.
[0128] In one embodiment, the computer device may directly use the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes as the transaction pool remaining capacity of the remaining nodes. Furthermore, the computer device may calculate the transaction pool availability of the remaining nodes according to the ratio of the transaction pool remaining capacity of the remaining nodes to the transaction pool configuration capacity of the remaining nodes.
[0129] In one embodiment, the computer device may calculate the remaining capacity of the transaction pool of the remaining nodes according to the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes. Furthermore, the computer device may directly use the ratio of the remaining capacity of the transaction pool of the remaining nodes to the transaction pool configuration capacity of the remaining nodes as the transaction pool availability of the remaining nodes.
[0130] In one embodiment, the computer device may directly use the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes as the transaction pool remaining capacity of the remaining nodes. Furthermore, the computer device may directly use the ratio of the transaction pool remaining capacity of the remaining nodes to the transaction pool configuration capacity of the remaining nodes as the transaction pool availability of the remaining nodes.
[0131] In the above embodiment, the remaining capacity of the transaction pool of the remaining nodes is determined by the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes, and then the transaction pool availability of the remaining nodes is determined by the ratio of the remaining capacity of the transaction pool of the remaining nodes to the transaction pool configuration capacity of the remaining nodes. The accuracy of the transaction pool availability of the remaining nodes can be improved, thereby further improving the accuracy of the updated distribution strategy and further avoiding the loss of transaction data.
[0132] In one embodiment, the nodes in the blockchain network include the target node and the remaining nodes. The transaction pool availability of the nodes in the blockchain network can be calculated by the following formula:
[0133] use_percent=(tx_capacity-tx_number) / tx_capacity×100%
[0134] Among them, tx_capacity represents the transaction pool configuration capacity of the node, tx_number represents the transaction cache capacity of the node, (tx_capacity-tx_number) represents the remaining capacity of the node's transaction pool, and use_percent represents the transaction pool availability of the node.
[0135] In one embodiment, the configured distribution strategy is updated according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes, including: determining an updated node from the target node and the remaining nodes according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes; determining a frequency of sending transaction data to the updated node to obtain an updated distribution strategy obtained by updating the configured distribution strategy, the determined frequency being positively correlated with the transaction pool availability of the updated node.
[0136] Specifically, the computer device may determine the updated node from the target node and the remaining nodes according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes. Also, the computer device may determine the frequency of sending transaction data to the updated node according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes, so as to obtain an updated distribution strategy obtained by updating the configured distribution strategy, wherein the determined frequency is positively correlated with the transaction pool availability of the updated node.
[0137] In one embodiment, the computer device may determine the updated node from the target node and the remaining nodes according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes, wherein the probability of the target node and the remaining nodes being determined as the updated node is positively correlated with the corresponding transaction pool availability.
[0138] In one embodiment, the computer device may sort the target node and the remaining nodes from high to low according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes, and obtain the node with the highest transaction pool availability from the sorting result as the updated node.
[0139] In one embodiment, Figure 7As shown, node 1 in the blockchain network is taken as the target node, and node 2 and node 3 are taken as the remaining nodes. The client can send the transaction data to be stored in the blockchain network to the computer device, and the computer device can receive the transaction data and obtain the configured distribution strategy. According to the configured distribution strategy, node 1 is selected from the nodes of the blockchain network, and the transaction data is sent to node 1 according to the frequency a1. The computer device can obtain the transaction cache volume and transaction pool configuration capacity of node 1, and calculate the transaction pool utilization rate of node 1 according to the transaction cache volume and transaction pool configuration capacity through the scheduling and calculation service in the computer device. When the transaction pool utilization rate exceeds the preset utilization rate, the computer device can calculate the transaction pool availability rate of node 1 according to the transaction cache volume and transaction pool configuration capacity of node 1 through the scheduling and calculation service in the computer device. The computer device can obtain the transaction cache volume and transaction pool configuration capacity of node 2 and node 3, and determine the transaction pool availability rates of node 2 and node 3 respectively according to the transaction cache volume and transaction pool configuration capacity of node 2 and node 3 through the scheduling and calculation service in the computer device. The computer device may update the configured distribution strategy according to the transaction pool availability of node 1 and the transaction pool availability of nodes 2 and 3. The updated distribution strategy indicates that the frequency a11 of sending transaction data to node 1 is lower than the frequency a1 of sending transaction data to node 1 indicated by the configured distribution strategy. It can be understood that for nodes 2 and 3, the updated distribution strategy indicates that the frequency a22 of sending transaction data to node 2 is higher than the frequency a2 of sending transaction data to node 2 indicated by the configured distribution strategy. The updated distribution strategy indicates that the frequency a33 of sending transaction data to node 3 is higher than the frequency a3 of sending transaction data to node 3 indicated by the configured distribution strategy, so as to achieve load balancing of transaction data.
[0140] In the above embodiment, the updated node is determined from the target node and the remaining nodes through the transaction pool availability of the target node and the transaction pool availability of the remaining nodes, so that the accuracy of the updated node can be improved. Furthermore, by determining the frequency of sending transaction data to the updated node to obtain the updated distribution strategy obtained by updating the configured distribution strategy, and by limiting the determined frequency to be positively correlated with the transaction pool availability of the updated node, the accuracy of the updated distribution strategy can be further improved, thereby further avoiding the loss of transaction data.
[0141] In one embodiment, Figure 8As shown, the system responsible for data processing in this application includes a blockchain network, an information collection service, a scheduling and computing service, a load balancing service, and a dynamic adjustment service. Specifically, the computer device can receive transaction data to be stored in the blockchain network, obtain the configured distribution strategy, select the target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node. The computer device can obtain the transaction cache volume and the transaction pool configuration capacity of the target node through the information collection service, and determine the transaction pool utilization rate of the target node according to the transaction cache volume and the transaction pool configuration capacity through the scheduling and computing service. When the transaction pool utilization rate exceeds the preset utilization rate, the computer device can update the configured distribution strategy through the load balancing service, wherein the updated distribution strategy indicates the frequency of sending transaction data to the target node, which is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy. In addition, the computer device can also obtain the block interval duration, block capacity, and transaction validity duration of the target node through the information collection service, and determine the standard capacity of the transaction pool of the target node based on the block interval duration, block capacity, and transaction validity duration through the scheduling and computing service. The computer device can also obtain the transaction pool configuration capacity of the target node through the information service. When the transaction pool configuration capacity does not match the transaction pool standard capacity, the computer device can adjust at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period of the target node through the dynamic adjustment service.
[0142] In one embodiment, Fig. 9As shown, the computer device can receive transaction data to be stored in the blockchain network, obtain the configured distribution strategy, select the target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node. The computer device can also collect the block interval duration, block capacity and transaction validity duration of the target node through the information collection service during the operation of the blockchain network, and determine the standard capacity of the transaction pool of the target node based on the block interval duration, block capacity and transaction validity duration through the scheduling and calculation service. The computer device can also collect the transaction pool configuration capacity of the target node through the information service. When the transaction pool configuration capacity does not match the transaction pool standard capacity, the computer device can adjust at least one of the transaction pool configuration capacity, block interval duration, block capacity or transaction validity duration of the target node through the dynamic adjustment service. In addition, the computer device can collect the transaction cache volume and transaction pool configuration capacity of the target node through the information collection service during the operation of the blockchain network, and determine the transaction pool utilization rate of the target node based on the transaction cache volume and transaction pool configuration capacity through the scheduling and calculation service. When the transaction pool usage rate exceeds the preset usage rate, the computer device can update the configured distribution strategy through the load balancing service, wherein the updated distribution strategy indicates a frequency of sending transaction data to the target node, which is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy.
[0143] In one embodiment, Fig.10As shown, the client can send transaction data to be stored in the blockchain network to the computer device, and the computer device can receive the transaction data, obtain the configured distribution strategy, select the target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node. The computer device can trigger the information collection service through the scheduling and computing service, so that the transaction cache volume and transaction pool configuration capacity of the target node can be obtained regularly through the information collection service during the operation of the blockchain network, and the transaction pool usage rate of the target node can be determined according to the transaction cache volume and transaction pool configuration capacity through the scheduling and computing service. When the transaction pool usage rate exceeds the preset usage rate, the computer device can trigger the load balancing service, and update the configured distribution strategy through the load balancing service, and distribute the transaction data through the updated distribution strategy. Among them, the updated distribution strategy indicates the frequency of sending transaction data to the target node, which is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy, so that the loss of transaction data can be avoided. In addition, the computer device may also trigger the information collection service through the scheduling and computing service, so as to obtain the block interval duration, block capacity and transaction validity duration of the target node regularly through the information collection service during the operation of the blockchain network, and determine the standard capacity of the transaction pool of the target node based on the block interval duration, block capacity and transaction validity duration through the scheduling and computing service. The computer device may also trigger the information collection service through the scheduling and computing service, so as to obtain the transaction pool configuration capacity of the target node regularly through the information collection service during the operation of the blockchain network. When the transaction pool configuration capacity does not match the transaction pool standard capacity, the computer device may trigger the dynamic adjustment service, and adjust at least one of the transaction pool configuration capacity, block interval duration, block capacity or transaction validity duration of the target node through the dynamic adjustment service, and refresh the target node after the adjustment to update the configuration for the target node, thereby further avoiding the loss of transaction data.
[0144] like Fig.11 As shown, in one embodiment, a data processing method based on blockchain is provided, which can be applied to a computer device, which can be a terminal or a server, that is, the method can be executed by the terminal or the server alone, or can be implemented through interaction between the terminal and the server. This embodiment is described by taking the method applied to a computer device as an example, and the method specifically includes the following steps:
[0145] Step 1102, receiving transaction data to be stored in the blockchain network, obtaining the configured distribution strategy, selecting a target node from the nodes of the blockchain network according to the configured distribution strategy, and sending the transaction data to the target node.
[0146] Among them, the transaction data is used to instruct the target node to store the transaction data in the blockchain network.
[0147] Step 1104, obtaining the transaction cache volume and transaction pool configuration capacity of the target node, and determining the transaction pool utilization rate of the target node according to the transaction cache volume and transaction pool configuration capacity.
[0148] Step 1106, when the transaction pool usage rate exceeds the preset usage rate, the remaining capacity of the transaction pool of the target node is determined according to the difference between the transaction pool configuration capacity of the target node and the transaction cache capacity of the target node.
[0149] Step 1108, determining the transaction pool availability of the target node according to the ratio of the remaining capacity of the transaction pool of the target node to the configured capacity of the transaction pool of the target node.
[0150] Step 1110, obtaining the transaction cache capacity and transaction pool configuration capacity of the remaining nodes, the remaining nodes are the nodes in the blockchain network except the target node.
[0151] Step 1112, determining the remaining capacity of the transaction pool of the remaining nodes according to the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes.
[0152] Step 1114, determining the transaction pool availability of the remaining nodes according to the ratio of the remaining capacity of the transaction pool of the remaining nodes to the configured capacity of the transaction pool of the remaining nodes.
[0153] Step 1116, determining an updated node from the target node and the remaining nodes according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes.
[0154] Step 1118, determining the frequency of sending transaction data to the updated node to obtain an updated distribution strategy updated for the configured distribution strategy.
[0155] The determined frequency is positively correlated with the transaction pool availability of the updated node. The frequency at which the updated distribution strategy indicates that the transaction data is sent to the target node is lower than the frequency at which the configured distribution strategy indicates that the transaction data is sent to the target node.
[0156] Step 1120, obtain the block interval, block capacity and transaction validity period of the target node, and determine the transaction consumption speed of the target node according to the product of the block capacity and the block interval.
[0157] Step 1122, determine the initial transaction pool standard capacity of the target node according to the product of the transaction validity period and the transaction consumption speed.
[0158] Step 1124, obtain the node memory capacity of the target node and the memory usage of each transaction data, and determine the maximum capacity of the transaction pool according to the ratio of the node memory capacity to the memory usage.
[0159] Step 1126: The smaller one of the initial transaction pool standard capacity and the transaction pool maximum capacity is determined as the transaction pool standard capacity of the target node.
[0160] Step 1128, obtaining the transaction pool configuration capacity of the target node. When the transaction pool configuration capacity is greater than the transaction pool standard capacity, the target node is adjusted by at least one of reducing the transaction pool configuration capacity, extending the block interval, increasing the block capacity, or extending the transaction validity period.
[0161] Step 1130, when the transaction pool configuration capacity is less than the transaction pool standard capacity, at least one of increasing the transaction pool configuration capacity, shortening the block interval, reducing the block capacity, or shortening the transaction validity period is adjusted for the target node.
[0162] The present application also provides an application scenario, which applies the above-mentioned blockchain-based data processing method. Specifically, the blockchain-based data processing method can be applied to the transaction data processing scenario in the payment field. It can be understood that the transaction data includes payment transaction data, and the payment transaction data includes payment information such as the payer, the recipient, the payment amount, the payment type and the timestamp in the payment field. Specifically, the computer device can receive the payment transaction data to be stored in the blockchain network; obtain the configured distribution strategy, select the target node from the nodes of the blockchain network according to the configured distribution strategy, and send the payment transaction data to the target node, and the payment transaction data is used to indicate that the target node stores the payment transaction data in the blockchain network; obtain the transaction cache amount and the transaction pool configuration capacity of the target node, and determine the transaction pool utilization rate of the target node according to the transaction cache amount and the transaction pool configuration capacity; when the transaction pool utilization rate exceeds the preset utilization rate, the remaining capacity of the transaction pool of the target node is determined according to the difference between the transaction pool configuration capacity of the target node and the transaction cache amount of the target node; according to the ratio of the remaining capacity of the transaction pool of the target node to the transaction pool configuration capacity of the target node, the transaction pool availability of the target node is determined.
[0163] The computer device can obtain the transaction cache volume and transaction pool configuration capacity of the remaining nodes, and the remaining nodes are nodes other than the target node in the blockchain network; the remaining capacity of the transaction pool of the remaining nodes is determined according to the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache volume of the remaining nodes; the transaction pool availability of the remaining nodes is determined according to the ratio of the remaining capacity of the transaction pool of the remaining nodes to the transaction pool configuration capacity of the remaining nodes. According to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes, the updated node is determined from the target node and the remaining nodes; the frequency of sending payment transaction data to the updated node is determined to obtain the updated distribution strategy obtained by updating the configured distribution strategy, and the determined frequency is positively correlated with the transaction pool availability of the updated node. Among them, the frequency of sending payment transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending payment transaction data to the target node indicated by the configured distribution strategy.
[0164] The computer device can obtain the block interval, block capacity and transaction validity period of the target node; determine the transaction consumption speed of the target node according to the product of the block capacity and the block interval; determine the initial transaction pool standard capacity of the target node according to the product of the transaction validity period and the transaction consumption speed; obtain the node memory capacity of the target node and the memory usage of each payment transaction data; determine the maximum capacity of the transaction pool according to the ratio of the node memory capacity to the memory usage; determine the smaller of the initial transaction pool standard capacity and the transaction pool maximum capacity as the transaction pool standard capacity of the target node. Obtain the transaction pool configuration capacity of the target node; when the transaction pool configuration capacity is greater than the transaction pool standard capacity, adjust the target node to reduce the transaction pool configuration capacity, extend the block interval, increase the block capacity or extend the transaction validity period. When the transaction pool configuration capacity is less than the transaction pool standard capacity, adjust the target node to increase the transaction pool configuration capacity, shorten the block interval, reduce the block capacity or shorten the transaction validity period.
[0165] It can be understood that the present application calculates the real-time transaction pool usage rate of the target node by obtaining the transaction cache amount and transaction pool configuration capacity of the target node from the blockchain network. When the transaction pool usage rate calculated in real time exceeds the preset usage rate, it means that the number of payment transaction data cached by the transaction pool of the target node has almost reached the transaction pool capacity of the target node. At this time, by timely updating the configured distribution strategy, the frequency of sending payment transaction data to the target node is reduced, and the frequency of sending payment transaction data to other nodes in the blockchain network except the target node is increased, thereby achieving node load balancing and avoiding the loss of payment transaction data.
[0166] The present application also provides an application scenario, which applies the above-mentioned blockchain-based data processing method. Specifically, the blockchain-based data processing method can be applied to transaction data processing scenarios in the financial field. It can be understood that transaction data includes financial transaction data, and financial transaction data includes financial transaction information such as the initiator, the receiver, the transaction amount, the transaction type and the timestamp in the financial field. The present application calculates the real-time transaction pool usage rate of the target node by obtaining the transaction cache amount and the transaction pool configuration capacity of the target node from the blockchain network. When the transaction pool usage rate calculated in real time exceeds the preset usage rate, it means that the amount of financial transaction data cached by the transaction pool of the target node has almost reached the transaction pool capacity of the target node. At this time, by timely updating the configured distribution strategy, the frequency of sending financial transaction data to the target node is reduced, and the frequency of sending financial transaction data to other nodes in the blockchain network except the target node is increased, so as to achieve node load balancing, thereby avoiding the loss of financial transaction data.
[0167] It should be understood that, although each step in the flow chart of the above-mentioned embodiments is shown in order, these steps are not necessarily performed in order. Unless there is a clear explanation in this article, the execution of these steps does not have strict order restrictions, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned embodiments may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in order, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0168] In one embodiment, Fig.12 As shown, a data processing device 1200 based on blockchain is provided, and the device specifically includes:
[0169] A receiving module 1202, used to receive transaction data to be stored in the blockchain network;
[0170] The distribution module 1204 is used to obtain the configured distribution strategy, select a target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node, where the transaction data is used to instruct the target node to store the transaction data in the blockchain network;
[0171] The determination module 1206 is used to obtain the transaction cache amount and the transaction pool configuration capacity of the target node, and determine the transaction pool usage rate of the target node according to the transaction cache amount and the transaction pool configuration capacity;
[0172] The updating module 1208 is used to update the configured distribution strategy when the transaction pool usage rate exceeds the preset usage rate, wherein the updated distribution strategy indicates a frequency of sending transaction data to the target node, which is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy.
[0173] In one embodiment, Fig.13 As shown, the blockchain-based data processing device 1200 also includes:
[0174] The adjustment module 1210 is used to obtain the block interval, block capacity and transaction validity period of the target node; determine the standard capacity of the transaction pool of the target node based on the block interval, block capacity and transaction validity period; obtain the transaction pool configuration capacity of the target node; when the transaction pool configuration capacity does not match the transaction pool standard capacity, adjust at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period of the target node.
[0175] In one embodiment, the adjustment module 1210 is also used to determine the transaction consumption speed of the target node based on the product of the block capacity and the block interval time; and determine the standard capacity of the transaction pool of the target node based on the product of the transaction validity time and the transaction consumption speed.
[0176] In one embodiment, the adjustment module 1210 is also used to determine the initial transaction pool standard capacity of the target node based on the product of the transaction validity period and the transaction consumption speed; obtain the node memory capacity of the target node and the memory occupancy of each transaction data; determine the maximum capacity of the transaction pool based on the ratio of the node memory capacity to the memory occupancy; and determine the smaller of the initial transaction pool standard capacity and the transaction pool maximum capacity as the transaction pool standard capacity of the target node.
[0177] In one embodiment, the transaction pool configuration capacity, block interval, block capacity and transaction validity period are obtained from the node configuration file of the target node, the node memory capacity is obtained from the memory information file of the target node, and the transaction cache capacity and memory usage are obtained from the software development kit provided by the blockchain network.
[0178] In one embodiment, the transaction pool configuration capacity, block interval, block capacity, transaction validity period, node memory capacity, transaction cache capacity and memory usage are obtained periodically through scheduled tasks during the operation of the blockchain network.
[0179] In one embodiment, the adjustment module 1210 is also used to adjust the target node by at least reducing the transaction pool configuration capacity, extending the block interval, increasing the block capacity, or extending the transaction validity period when the transaction pool configuration capacity is greater than the transaction pool standard capacity.
[0180] In one embodiment, the adjustment module 1210 is also used to increase the transaction pool configuration capacity, shorten the block interval, reduce the block capacity, or shorten the transaction validity period when the transaction pool configuration capacity is less than the transaction pool standard capacity.
[0181] In one embodiment, the update module 1208 is also used to determine the transaction pool availability of the target node based on the transaction cache capacity and transaction pool configuration capacity of the target node when the transaction pool usage rate exceeds the preset usage rate; obtain the transaction cache capacity and transaction pool configuration capacity of the remaining nodes, the remaining nodes are nodes other than the target node in the blockchain network; determine the transaction pool availability of the remaining nodes based on the transaction cache capacity and transaction pool configuration capacity of the remaining nodes; and update the configured distribution strategy based on the transaction pool availability of the target node and the transaction pool availability of the remaining nodes.
[0182] In one embodiment, the update module 1208 is also used to determine the remaining capacity of the target node's transaction pool based on the difference between the target node's transaction pool configuration capacity and the target node's transaction cache capacity; and determine the target node's transaction pool availability based on the ratio of the target node's transaction pool remaining capacity to the target node's transaction pool configuration capacity.
[0183] In one embodiment, the update module 1208 is also used to determine the remaining capacity of the transaction pool of the remaining nodes based on the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes; and determine the transaction pool availability of the remaining nodes based on the ratio of the remaining capacity of the transaction pool of the remaining nodes to the transaction pool configuration capacity of the remaining nodes.
[0184] In one embodiment, the update module 1208 is also used to determine the updated node from the target node and the remaining nodes based on the transaction pool availability of the target node and the transaction pool availability of the remaining nodes; determine the frequency of sending transaction data to the updated node to obtain an updated distribution strategy obtained by updating the configured distribution strategy, and the determined frequency is positively correlated with the transaction pool availability of the updated node.
[0185] The above-mentioned blockchain-based data processing device receives transaction data to be stored in the blockchain network, obtains the configured distribution strategy, selects the target node from the nodes of the blockchain network according to the configured distribution strategy, and sends the transaction data to the target node, and the transaction data is used to instruct the target node to store the transaction data in the blockchain network. The transaction cache volume and transaction pool configuration capacity of the target node are obtained, and the transaction pool utilization rate of the target node is determined based on the transaction cache volume and transaction pool configuration capacity. When the transaction pool utilization rate exceeds the preset utilization rate, the configured distribution strategy is updated, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy. Compared with traditional data processing methods, the present application calculates the real-time transaction pool usage rate of the target node by obtaining the transaction cache amount and transaction pool configuration capacity of the target node from the blockchain network. When the real-time calculated transaction pool usage rate exceeds the preset usage rate, it means that the number of transaction data cached in the transaction pool of the target node has almost reached the transaction pool capacity of the target node. At this time, by timely updating the configured distribution strategy, the frequency of sending transaction data to the target node is reduced, and the frequency of sending transaction data to other nodes in the blockchain network except the target node is increased, thereby achieving node load balancing and avoiding the loss of transaction data.
[0186] Each module in the above-mentioned blockchain-based data processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0187] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.14 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an 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 operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data processing method based on blockchain is implemented.
[0188] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.15 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless method can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a data processing method based on blockchain is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0189] Those skilled in the art will understand that Fig.14 and Fig.15 The structure shown in the figure is only a block diagram of a part 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 those shown in the figure, or combine certain components, or have a different arrangement of components.
[0190] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0191] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0192] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0193] 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 relevant laws, regulations and standards of relevant countries and regions.
[0194] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed 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, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0195] The technical features of the above embodiments may 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.
[0196] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A data processing method based on blockchain, characterized in that: The method comprises: Receive transaction data to be stored in the blockchain network; Obtaining a configured distribution strategy, selecting a target node from the nodes of the blockchain network according to the configured distribution strategy, and sending the transaction data to the target node, wherein the transaction data is used to instruct the target node to store the transaction data in the blockchain network; Acquire the transaction cache amount and transaction pool configuration capacity of the target node, and determine the transaction pool utilization rate of the target node according to the transaction cache amount and the transaction pool configuration capacity; When the transaction pool usage rate exceeds a preset usage rate, the configured distribution strategy is updated, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy.
2. The method according to claim 1, characterized in that: The method further comprises: Obtain the block interval, block capacity and transaction validity period of the target node; Determine the standard capacity of the transaction pool of the target node based on the block interval, the block capacity and the transaction validity period; Obtaining the transaction pool configuration capacity of the target node; When the transaction pool configuration capacity does not match the transaction pool standard capacity, at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period is adjusted for the target node.
3. The method according to claim 2, characterized in that The determining the standard capacity of the transaction pool of the target node based on the block interval, the block capacity and the transaction validity period includes: Determine the transaction consumption speed of the target node according to the product of the block capacity and the block interval time; The standard capacity of the transaction pool of the target node is determined according to the product of the transaction validity period and the transaction consumption speed.
4. The method according to claim 3, characterized in that Determining the standard capacity of the transaction pool of the target node according to the product of the transaction validity period and the transaction consumption speed includes: Determining the initial transaction pool standard capacity of the target node according to the product of the transaction validity period and the transaction consumption speed; Obtaining the node memory capacity of the target node and the memory usage of each transaction data; Determining the maximum capacity of the transaction pool according to the ratio of the node memory capacity to the memory usage; The smaller one of the initial transaction pool standard capacity and the transaction pool maximum capacity is determined as the transaction pool standard capacity of the target node.
5. The method according to claim 4, characterized in that The transaction pool configuration capacity, the block interval, the block capacity and the transaction validity period are obtained from the node configuration file of the target node, the node memory capacity is obtained from the memory information file of the target node, and the transaction cache amount and the memory occupancy are obtained from the software development kit provided by the blockchain network.
6. The method according to claim 4, characterized in that The transaction pool configuration capacity, the block interval duration, the block capacity, the transaction validity duration, the node memory capacity, the transaction cache capacity and the memory occupancy are obtained periodically through scheduled tasks during the operation of the blockchain network.
7. The method according to claim 2, characterized in that: When the transaction pool configuration capacity does not match the transaction pool standard capacity, adjusting at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period for the target node includes: When the transaction pool configuration capacity is greater than the transaction pool standard capacity, at least one of the following adjustments is made to the target node: reducing the transaction pool configuration capacity, extending the block interval, increasing the block capacity, or extending the transaction validity period.
8. The method according to claim 2, characterized in that: When the transaction pool configuration capacity does not match the transaction pool standard capacity, adjusting at least one of the transaction pool configuration capacity, block interval, block capacity or transaction validity period for the target node includes: When the transaction pool configuration capacity is less than the transaction pool standard capacity, at least one of the following adjustments is made to the target node: increasing the transaction pool configuration capacity, shortening the block interval, reducing the block capacity, or shortening the transaction validity period.
9. The method according to any one of claims 1 to 8, characterized in that When the usage rate of the transaction pool exceeds the preset usage rate, updating the configured distribution strategy includes: When the transaction pool usage rate exceeds the preset usage rate, determining the transaction pool availability rate of the target node according to the transaction cache volume of the target node and the transaction pool configuration capacity; Obtaining the transaction cache capacity and transaction pool configuration capacity of the remaining nodes, wherein the remaining nodes are nodes in the blockchain network other than the target node; Determining the transaction pool availability of the remaining nodes according to the transaction cache volume and transaction pool configuration capacity of the remaining nodes; The configured distribution strategy is updated according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes.
10. The method according to claim 9, characterized in that Determining the transaction pool availability of the target node according to the transaction cache amount and transaction pool configuration capacity of the target node includes: Determining the remaining capacity of the transaction pool of the target node according to the difference between the transaction pool configuration capacity of the target node and the transaction cache capacity of the target node; The transaction pool availability of the target node is determined according to the ratio of the remaining capacity of the transaction pool of the target node to the configured capacity of the transaction pool of the target node.
11. The method according to claim 9, characterized in that The determining the transaction pool availability of the remaining nodes according to the transaction cache amount and the transaction pool configuration capacity of the remaining nodes includes: Determining the remaining capacity of the transaction pool of the remaining nodes according to the difference between the transaction pool configuration capacity of the remaining nodes and the transaction cache capacity of the remaining nodes; The transaction pool availability of the remaining nodes is determined according to the ratio of the remaining capacity of the transaction pool of the remaining nodes to the configured capacity of the transaction pool of the remaining nodes.
12. The method according to claim 9, characterized in that The updating of the configured distribution strategy according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes includes: Determining an updated node from the target node and the remaining nodes according to the transaction pool availability of the target node and the transaction pool availability of the remaining nodes; A frequency of sending transaction data to the updated node is determined to obtain an updated distribution strategy updated for the configured distribution strategy, wherein the determined frequency is positively correlated with a transaction pool availability of the updated node.
13. A data processing device based on blockchain, characterized in that: The device comprises: A receiving module, used to receive transaction data to be stored in the blockchain network; A distribution module, used to obtain a configured distribution strategy, select a target node from the nodes of the blockchain network according to the configured distribution strategy, and send the transaction data to the target node, wherein the transaction data is used to instruct the target node to store the transaction data in the blockchain network; A determination module, used to obtain the transaction cache amount and transaction pool configuration capacity of the target node, and determine the transaction pool usage rate of the target node according to the transaction cache amount and the transaction pool configuration capacity; An updating module is used to update the configured distribution strategy when the usage rate of the transaction pool exceeds a preset usage rate, wherein the frequency of sending transaction data to the target node indicated by the updated distribution strategy is lower than the frequency of sending transaction data to the target node indicated by the configured distribution strategy.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.