CN116684098A - Block chain-based data processing method, device, equipment, medium and product - Google Patents
Block chain-based data processing method, device, equipment, medium and product Download PDFInfo
- Publication number
- CN116684098A CN116684098A CN202210169752.5A CN202210169752A CN116684098A CN 116684098 A CN116684098 A CN 116684098A CN 202210169752 A CN202210169752 A CN 202210169752A CN 116684098 A CN116684098 A CN 116684098A
- Authority
- CN
- China
- Prior art keywords
- node
- nodes
- target
- processing
- weight
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 24
- 238000012545 processing Methods 0.000 claims abstract description 340
- 238000000034 method Methods 0.000 claims abstract description 71
- 230000008569 process Effects 0.000 claims abstract description 52
- 230000008859 change Effects 0.000 claims description 97
- 238000001514 detection method Methods 0.000 claims description 56
- 238000004590 computer program Methods 0.000 claims description 16
- 238000012216 screening Methods 0.000 claims description 4
- 230000006870 function Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000003203 everyday effect Effects 0.000 description 3
- 238000012163 sequencing technique Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000006866 deterioration Effects 0.000 description 2
- 239000013585 weight reducing agent Substances 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000004083 survival effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
- H04L9/3239—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2209/00—Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
- H04L2209/56—Financial cryptography, e.g. electronic payment or e-cash
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Computer Security & Cryptography (AREA)
- Finance (AREA)
- Economics (AREA)
- Signal Processing (AREA)
- Development Economics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the application provides a data processing method, a device, equipment, a medium and a product based on a block chain, wherein the data processing method based on the block chain comprises the following steps: when a target transaction request aiming at the blockchain exists, acquiring transaction processing capacity of each node in a blockchain network to which the blockchain belongs, wherein the transaction processing capacity of each node is obtained by dynamic configuration according to capacity configuration information of each node; selecting a processing node of the target transaction request from the nodes according to the transaction processing capacity of the nodes; the target transaction request is sent to the processing node to cause the processing node to process the target transaction request. By adopting the embodiment of the application, the transaction request can be reasonably loaded into the blockchain network for processing, so that the loads of all nodes in the blockchain network are balanced, and the transaction request processing efficiency of the blockchain network is improved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a blockchain-based data processing method, apparatus, device, medium, and product.
Background
The business side loads transaction requests such as the uplink, inquiry and the like of the block chain into the block chain network, and processes the transaction requests by nodes in the block chain network. At present, a polling mode is generally adopted to carry out the load of the transaction request, and the polling mode can ensure that the transaction request is evenly distributed to all nodes in the blockchain network, but the polling mode can cause the problem that all nodes in the blockchain network are unbalanced in load, so that the transaction request processing efficiency of the blockchain network is seriously influenced.
Disclosure of Invention
The embodiment of the application provides a data processing method, device, equipment, medium and product based on a blockchain, which can reasonably load a transaction request into the blockchain network for processing, so that each node in the blockchain network is balanced in load, and the transaction request processing efficiency of the blockchain network is improved.
In one aspect, an embodiment of the present application provides a data processing method based on a blockchain, including:
when a target transaction request aiming at the blockchain exists, acquiring transaction processing capacity of each node in a blockchain network to which the blockchain belongs, wherein the transaction processing capacity of each node is obtained by dynamic configuration according to capacity configuration information of each node; selecting a processing node of the target transaction request from the nodes according to the transaction processing capacity of the nodes; the target transaction request is sent to the processing node to cause the processing node to process the target transaction request.
Accordingly, an embodiment of the present application provides a blockchain-based data processing device, including:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the transaction processing capacity of each node in a blockchain network to which the blockchain belongs when a target transaction request aiming at the blockchain exists, wherein the transaction processing capacity of each node is dynamically configured according to capacity configuration information of each node;
a processing unit, configured to select a processing node of the target transaction request from the nodes according to the transaction processing capability of each node; the target transaction request is sent to the processing node to cause the processing node to process the target transaction request.
In one implementation, the transaction processing capability of each node is obtained from a node capability list of the blockchain network, the transaction processing capability of each node is represented in the node capability list by a weight, and the node capability list comprises node identifications of each node and weights of each node; the processing unit is further used for executing the following steps:
dynamically configuring a node capability list according to the capability configuration information of each node; wherein the capability configuration information of any one node includes at least one of: status change information of the node, performance change information of the node, transaction processing information of the node.
In one implementation, the node capability list is dynamically configured according to state change information of each node; the processing unit is used for executing the following steps when dynamically configuring the node capability list according to the capability configuration information of each node:
acquiring state change information of a target node in a blockchain network; if the state change information indicates that the node state of the target node is changed from the available state to the unavailable state, the weight of the target node is distributed to other nodes except the target node in the blockchain network; the weights of the individual nodes in the node capability list are updated.
In one implementation, the node capability list is dynamically configured according to state change information of each node; the processing unit is used for executing the following steps when dynamically configuring the node capability list according to the capability configuration information of each node:
acquiring state change information of a target node in a blockchain network; if the state change information indicates that the node state of the target node is changed from the unavailable state to the available state, determining weights distributed to the target node by other nodes except the target node in the blockchain network; determining the weight of the target node according to the weights distributed to the target node by other nodes; the weights of the individual nodes in the node capability list are updated.
In one implementation, the node capability list is dynamically configured according to performance change information of each node; the processing unit is used for executing the following steps when dynamically configuring the node capability list according to the capability configuration information of each node:
acquiring performance change information of a target node in a blockchain network; if the performance change information indicates that the performance information of the target node in the current performance detection period is the same as the performance information of the target node in the previous performance detection period of the current performance detection period, the weight of the target node in the node capacity list is kept unchanged; or if the performance change information indicates that the performance information of the target node in the current performance detection period is better than the performance information of the target node in the previous performance detection period of the current performance detection period, increasing the weight of the target node in the node capacity list; or if the performance change information indicates that the performance information of the target node in the current performance detection period is inferior to the performance information of the target node in the previous performance detection period of the current performance detection period, the weight of the target node in the node capacity list is reduced.
In one implementation, the node capability list is dynamically configured according to transaction processing information of each node; the processing unit is used for executing the following steps when dynamically configuring the node capability list according to the capability configuration information of each node:
Acquiring transaction processing information of each node, wherein the transaction processing information is used for indicating the processing condition of the corresponding node on historical transaction requests aiming at the blockchain; sequencing each node according to the transaction processing information of each node; and adjusting the weight of each node in the node capacity list according to the arrangement sequence of each node.
In one implementation, the processing unit is configured to, after dynamically configuring the node capability list according to the capability configuration information of each node, further perform the following steps:
if the weight of the target node in the dynamically configured node capacity list does not meet the transaction processing condition, the weight of the target node is distributed to other nodes except the target node in the blockchain network; and updating the weight of each node in the node capability list.
In one implementation, the transaction processing capabilities of each node are represented by weights; the processing unit is used for selecting the processing node of the target transaction request from the nodes according to the transaction processing capacity of each node, and is specifically used for executing the following steps:
screening one or more candidate nodes with weights meeting transaction processing conditions from the nodes; determining a weight range of one or more candidate nodes according to the weights of the one or more candidate nodes; a processing node for the target transaction request is selected from the one or more candidate nodes based on the target transaction request and a range of weights for the one or more candidate nodes.
In one implementation, the target transaction request carries a transaction hash; the processing unit is used for selecting the processing node of the target transaction request from the one or more candidate nodes according to the target transaction request and the weight range of the one or more candidate nodes, and is specifically used for executing the following steps:
acquiring the total weight of each candidate node; determining node selection information corresponding to the target transaction request according to the transaction hash and the total weight; and determining the weight range to which the node selection information belongs from the weight ranges of one or more candidate nodes, and determining the candidate node corresponding to the weight range to which the node selection information belongs as a processing node.
In one implementation, the weights of the respective nodes are obtained from a node capability list of the blockchain network, the node capability list including node identifications of the respective nodes and the weights of the respective nodes; the number of the candidate nodes is M, node identifiers of the M candidate nodes are arranged in sequence in a node capacity list, any one of the M candidate nodes is represented as an ith candidate node, M is a positive integer, and i is a positive integer smaller than or equal to M;
the processing unit is used for determining the weight range of the one or more candidate nodes according to the weight of the one or more candidate nodes, and is specifically used for executing the following steps:
Determining a first numerical value according to weights of i-1 candidate nodes arranged before the ith candidate node in the node capacity list; determining a second value according to the first value and the weight of the ith candidate node; determining a weight range of the ith candidate node according to the first value and the second value; when the value of i is 1, the first value is the target value.
Accordingly, embodiments of the present application provide a computer device comprising a processor and a computer-readable storage medium; wherein the processor is adapted to implement a computer program, the computer readable storage medium storing a computer program adapted to be loaded by the processor and to perform the blockchain-based data processing method described above.
Accordingly, embodiments of the present application provide a computer-readable storage medium storing a computer program which, when read and executed by a processor of a computer device, causes the computer device to perform the above-described blockchain-based data processing method.
Accordingly, embodiments of the present application provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium and executes the computer instructions to cause the computer device to perform the blockchain-based data processing method described above.
In the embodiment of the application, when the transaction request aiming at the blockchain exists, the processing node of the transaction request can be selected from all nodes according to the transaction processing capability of all nodes in the blockchain network to which the blockchain belongs, so that the transaction request can be sent to the processing node for processing. According to the embodiment of the application, the processing nodes of the transaction request are selected according to the transaction processing capacity of the nodes, and the transaction request can be reasonably loaded into the blockchain network for processing, so that the loads of all nodes in the blockchain network are balanced, and the transaction request processing efficiency of the blockchain network is improved.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings can be obtained according to these drawings without inventive effort for the person skilled in the art.
FIG. 1 is a schematic diagram of a block chain network according to an embodiment of the present application;
FIG. 2 is a block chain architecture diagram according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a data processing system according to an embodiment of the present application;
FIG. 4 is a flowchart of a block chain based data processing method according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating coordinate axes of a weight range according to an embodiment of the present application;
FIG. 6 is a flow chart of another block chain based data processing method according to an embodiment of the present application;
FIG. 7a is a schematic representation of the coordinate axes of another weight range provided by an embodiment of the present application;
FIG. 7b is a schematic representation of the coordinate axes of another weight range provided by an embodiment of the present application;
FIG. 7c is a schematic representation of a coordinate axis representation of another weight range provided by an embodiment of the present application;
FIG. 8 is a block chain based data processing apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by a person of ordinary skill in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
In the process of executing related services on the service side (such as the service execution device, the service application program running in the service execution device, etc.), there may be transaction requests for uplink, inquiry, etc. of the blockchain, and the service side may load the transaction requests into the blockchain network, and the nodes in the blockchain network process the transaction requests, so as to ensure that the services on the service side are executed smoothly.
Where the blockchain network refers to a system for data sharing from node to node, the architecture of the blockchain network may be seen in fig. 1, and a plurality of nodes 101 may be included in the blockchain network 10. Each node may receive input information while operating normally and maintain shared data within the blockchain network based on the received input information. In order to ensure information intercommunication in the blockchain network, information connection can exist between every two nodes in the blockchain network, and information transmission can be carried out between the nodes through the information connection. For example, when any node in the blockchain network receives input information, other nodes in the blockchain network acquire the input information according to a consensus algorithm, and store the input information as data in shared data, so that the data stored on all nodes in the blockchain network are consistent.
For each node in the blockchain network, the node identification corresponding to the node identification is provided, and each node in the blockchain network can store the node identifications of other nodes in the blockchain network so as to broadcast the generated blocks to other nodes in the blockchain network according to the node identifications of the other nodes. Each node can maintain a node identification list shown in the following table, and the node names and the node identifications are correspondingly stored in the node identification list. The node identifier may be an IP (Internet Protocol, protocol of interconnection between networks) address and any other information that can be used to identify the node, as described in table 1 below by taking the example that the node identifier is an IP address:
TABLE 1
Node name | Node identification |
Node 1 | 117.114.151.174 |
Node 2 | 117.116.189.145 |
… | … |
Node N | XXX.XXX.XXX.XXX |
Each node in the blockchain network stores one and the same blockchain. Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. The blockchain is essentially a de-centralized database, which is a series of blocks generated by cryptographic methods, each block containing a batch of information of network transactions for verifying the validity (anti-counterfeiting) of the information and generating the next block. As shown in fig. 2, the blockchain is composed of a plurality of blocks, the starting block comprises a block head and a block body, the block head stores an input information characteristic value, a version number, a time stamp and a difficulty value, and the block body stores input information; the next block of the starting block takes the starting block as a father block, the next block also comprises a block head and a block body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the father block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain are associated with the block data stored in the father block, and the safety of the input information in the block is ensured.
Based on the above description of the blockchain and blockchain network, embodiments of the present application provide a blockchain-based data processing scheme capable of reasonably loading transaction requests on a service side (e.g., a service execution device, a service application running in the service execution device, etc.) to each node in the blockchain network, where the blockchain-based data processing scheme can be specifically described as follows:
the traffic side may dynamically configure the weights of the various nodes in the blockchain network. The dynamic configuration process is specifically as follows: the service side can allocate initial weights to each node in the blockchain network, and then the service side can acquire state change conditions (such as whether the node is available or not) of each node in the blockchain network, performance change conditions (such as whether the performance of the node is optimized or not) of each node, processing conditions (such as success rate of processing the historical transaction request, delay of processing the historical transaction request and number of error codes returned by processing the historical transaction request) of each node and the like at intervals of a period of time, and adjust the weights of each node according to the state change conditions of each node, the performance change conditions of each node, the processing conditions of each node for the historical transaction request and the like; after the weight of a plurality of time periods is adjusted, the weight of the node can more accurately represent the transaction processing capacity of the node, and the node with larger weight has stronger transaction processing capacity and the node with smaller weight has weaker transaction processing capacity.
In the dynamic configuration process, the service side can also select a processing node of the transaction request according to the weight of each node in the blockchain network. Specifically, when there is a transaction request for a blockchain on the service side, the service side may select a processing node for the transaction request from the nodes according to weights of the nodes in the blockchain network, and send the transaction request to the selected processing node, where the processing node processes the transaction request.
Through the data processing scheme based on the blockchain, the transaction requests can be reasonably loaded into the blockchain network, the number of the transaction requests processed by the nodes with stronger transaction processing capacity in the blockchain network is larger, the number of the transaction requests processed by the nodes with weaker transaction processing capacity is smaller, so that the loads of all the nodes in the blockchain network are balanced, and the transaction request processing efficiency of the blockchain network is effectively improved.
A data processing system suitable for implementing the blockchain-based data processing scheme provided by embodiments of the present application is described below in conjunction with FIG. 3. As shown in fig. 3, the data processing system may include a blockchain network 30 and a service execution device 31 accessing the blockchain network 30, the number of service execution devices 31 accessing the blockchain network 30 may be one or more, and the number of nodes 301 included in the blockchain network 30 may be one or more, which is not limited in the embodiment of the present application; the service execution device 31 may be a terminal or a server, the node 30 in the blockchain network 30 may be a terminal or a server, and a communication connection may be established between the service execution device 31 and the node 301 in the blockchain network. The terminal mentioned in the embodiment of the application can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart sound box, a smart watch, a vehicle-mounted terminal, a smart television and the like, but is not limited to the smart phone, the tablet computer, the notebook computer, the desktop computer, the smart sound box, the smart watch, the vehicle-mounted terminal, the smart television and the like; the servers mentioned in the embodiments of the present application may be independent physical servers, may be server clusters or distributed systems formed by a plurality of physical servers, or may be cloud servers that provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (content delivery networks), and basic cloud computing services such as big data. The following describes the service execution device 31 and the node 301 in the data processing system, respectively:
(1) The service execution device 31. The service execution device 31 has a data processing capability, which may specifically be the capability of dynamically configuring the weights of the nodes in the blockchain network and selecting the processing node of the transaction request according to the weights of the nodes in the blockchain network, where the data processing capability may be encapsulated in a data processing toolkit, and the service execution device may obtain the data processing capability by embedding the data processing toolkit. The data processing tool package may specifically refer to a blockchain SDK (Sof tware Development Kit, software development tool package), where the blockchain SDK is a tool package for performing interactive encapsulation between a service side and a blockchain, provides various API (Application Programming Interface, application program interface) functions such as uplink, query, subscription notification, and the like, and establishes a secure and reliable communication channel with the blockchain network.
In particular, one or more service application programs can be run in the service execution device, when the service application programs in the service execution device have the requirement of interacting with the blockchain, the data processing tool package can be embedded into the service application programs, and the service application programs embedded into the data processing tool package can obtain the data processing capability. When a certain business application program in the business execution equipment has the requirement of interacting with the blockchain, a data processing tool package can be embedded into the business application program, so that the business application program obtains the data processing capability; when a plurality of business application programs in the business execution device have the requirement of interacting with the blockchain, the data processing tool packages can be respectively embedded into the business application programs, so that the business application programs all acquire data processing capacity, and the data processing capacities of the business application programs are mutually independent and do not interfere with each other.
(2) Node 301. Each node in the blockchain network may process the transaction request when receiving the transaction request from the service execution device, for example, may upload the transaction data requested to be uplink in the transaction request to the blockchain for storage, may query the blockchain for the transaction data requested to be queried in the transaction request, and return the queried transaction data to the service execution device, and so on.
In the embodiment of the application, the service execution device or the service application program operated by the service execution device is enabled to have data processing capability by embedding the data processing tool kit in the service execution device or the service application program operated by the service execution device, so that the service execution device or the service application program operated by the service execution device can reasonably load transaction requests into the blockchain network, so that each node in the blockchain network is balanced in load, the transaction request processing efficiency of the blockchain network is effectively improved, moreover, a service object using the service execution device can pay no attention to the state of each node in the blockchain network, the state of each node in the blockchain network can be paid attention to by the data processing tool kit embedded in the service execution device, and the service object only needs to pay attention to the services executed by the service execution device.
It will be appreciated that the data processing system and the blockchain network described in the embodiments of the present application are for more clearly describing the technical solutions of the embodiments of the present application, and are not limited to the technical solutions provided by the embodiments of the present application, and as one of ordinary skill in the art can appreciate, with the evolution of the data processing system architecture, the blockchain network architecture, and the appearance of new service scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
Based on the above description of the data processing system, the following describes in more detail the blockchain-based data processing scheme provided by the embodiments of the present application with reference to the accompanying drawings:
the embodiment of the application provides a data processing method based on a block chain, which mainly introduces the content of a processing node for selecting a transaction request according to the weight of each node in a block chain network. The blockchain-based data processing method may be executed by the service execution device 31 in the data processing system, referring to fig. 4, and the blockchain-based data processing method may include the following steps S401 to S403:
s401, when a target transaction request for the blockchain exists, the transaction processing capacity of each node in the blockchain network to which the blockchain belongs is acquired.
When there is a target transaction request for a blockchain, the business execution device may acquire transaction processing capabilities of respective nodes in the blockchain network to which the blockchain belongs. The service execution device can maintain a node capacity list of a blockchain network, and the transaction processing capacity of each node in the blockchain network can be obtained from the node capacity list; the transaction processing capacity of each node can be represented by adopting weights in a node capacity list, wherein the larger the weight of the node is, the stronger the transaction processing capacity of the node is, the smaller the weight of the node is, the weaker the transaction processing capacity of the node is, and when the weight of the node is smaller than or equal to a weight threshold value, the node is not provided with the transaction processing capacity. The node capability list may further include node identifiers of the respective nodes in addition to the weights of the respective nodes, where the node identifiers of the respective nodes and the weights of the respective nodes are in one-to-one correspondence in the node capability list, and table 2 below shows an example of the node capability list:
TABLE 2
Node identification | Weighting of |
XXX.XXX.XXX.XX1 | 110 |
XXX.XXX.XXX.XX2 | 180 |
XXX.XXX.XXX.XX3 | 130 |
XXX.XXX.XXX.XX4 | 80 |
XXX.XXX.XXX.XX5 | 0 |
The node capability list shown in table 2 includes node identifiers and weights of 5 nodes, and the node identifier "xxx.xxx.xxx.xx5" has a weight less than the weight threshold 10, which indicates that the node identifier "xxx.xxx.xxx.xx5" does not have transaction processing capability; the node identified as "xxx.xxx.xxx.xx2" has the greatest weight, meaning that the node identified as "xxx.xxx.xxx.xx2" has the strongest transaction processing capacity, and the node identified as "xxx.xxx.xxx.xx4" has the least weight, meaning that the node identified as "xxx.xxx.xxx.xx4" has the weakest transaction processing capacity.
In addition, the transaction processing capability of each node is dynamically configured according to the capability configuration information of each node, and the capability configuration information of any node may include at least one of the following: status change information of the node, performance change information of the node, transaction processing information of the node, and the like. Wherein the state change information of the node may be used to indicate a state change condition of the node (e.g., whether the node is available), the performance change information of the node may be used to indicate a performance change condition of the node (e.g., whether the performance of the node is optimized), and the transaction processing information of the node may be used to indicate a processing condition of the node on the historical transaction request for the blockchain (e.g., a success rate of the node processing the historical transaction request, a delay of the node processing the historical transaction request, a number of error codes returned by the node processing the historical transaction request, etc.).
S402, selecting processing nodes of target transaction requests from the nodes according to transaction processing capabilities of the nodes.
After acquiring the transaction processing capability of each node in the blockchain network, the service execution device may select a processing node of the target transaction request from each node according to the transaction processing capability of each node. Specifically, one or more candidate nodes with weights meeting the transaction processing conditions can be selected from the nodes, the weights meeting the transaction processing conditions means that the weights are greater than a weight threshold, namely, the nodes with weights smaller than or equal to the weight threshold (namely, the nodes without transaction processing capability) are rejected, the nodes with the transaction processing capability in the nodes are taken as candidate nodes, the nodes with the nodes identified as 'XXX.XXX.XXX.XX5' are taken as examples in the table 2, the weights of the nodes with the nodes identified as 'XXX.XXX.XXX.XX5' are smaller than the weight threshold, the nodes with the nodes identified as 'XXX.XXX.XX5' are rejected, the nodes without participation in the processing node are selected, the weights of the remaining 4 nodes are all greater than the weight threshold, and the nodes with the transaction processing capability can be taken as candidate nodes to participate in the processing node selection; the weight range of the one or more candidate nodes may then be determined based on the weights of the one or more candidate nodes, such that the processing node of the target transaction request may be selected from the one or more candidate nodes based on the target transaction request and the weight range of the one or more candidate nodes.
Wherein, in order to facilitate understanding of the process that the service execution device determines the weight range of one or more candidate nodes according to the weight of the one or more candidate nodes, the number of the candidate nodes may be represented as M, any one of the M candidate nodes may be represented as an i-th candidate node, M is a positive integer, and i is a positive integer less than or equal to M; and, the node identities of the M candidate nodes are ordered in the node capability list. Based on this, taking the ith candidate node as an example, the process of determining, by the service execution device, the weight range of one or more candidate nodes according to the weights of the one or more candidate nodes may include: the first value can be determined according to the weights of the i-1 candidate nodes arranged before the i candidate node in the node capacity list, and then the second value can be determined according to the first value and the weights of the i candidate node, so that the weight range of the i candidate node can be determined according to the first value and the second value; when the value of i is 1, the first value is a target value (for example, may be 0).
Taking the above table 2 as an example, nodes identified as "xxx.xxx.xxx.xx1", "xxx.xxx.xxx.xx2", "xxx.xxx.xxx.xxx.xx3", "xxx.xxx.xxx.xx4" may be candidate nodes. Candidate node 1 (i.e., the first candidate node) with node identification "xxx.xxx.xxx.xx1" has a first value of 0, a second value of 110, and a weight range of [0, 110); candidate node 2 (i.e., the second candidate node) with node identification "xxx.xxx.xxx.xx2" has a first value of 110, a second value of 290, and a weight range of [110, 290); candidate node 3 (i.e., the third candidate node) with node identification "xxx.xxx.xxx.xx3" has a first value of 290, a second value of 420, and a weight range of [290, 420); candidate node 4 (i.e., the fourth candidate node) with node identification "xxx.xxx.xxx.xx4" has a first value of 420, a second value of 500, and a weight range of [420, 500]; summarizing, the weight ranges corresponding to the 4 candidate nodes in the above table 2 can be seen in the following table 3:
TABLE 3 Table 3
The weight ranges in table 3 may also be represented in one-dimensional coordinate axes, and referring to fig. 5, the larger the weight range corresponding to the node with the larger weight, the larger the numerical value interval occupied in the one-dimensional coordinate axes, the smaller the weight range corresponding to the node with the smaller weight, and the smaller the numerical value interval occupied in the one-dimensional coordinate axes. That is, the larger the numerical range occupied by the node having the stronger transaction processing capability in the one-dimensional coordinate axis, the smaller the numerical range occupied by the node having the weaker transaction processing capability in the one-dimensional coordinate axis.
The process that the service execution device selects the processing node of the target transaction request from the one or more candidate nodes according to the weight range of the target transaction request and the one or more candidate nodes may include: firstly, the total weight of each candidate node, namely the sum of the weights of each candidate node, can be obtained; secondly, node selection information corresponding to the target transaction request can be determined according to the transaction hash and the total weight, the node selection information corresponding to the target transaction request can be specifically a remainder obtained by performing residual calculation (mod) on the transaction hash and the total weight, and the node selection information corresponding to the target transaction request can be equal to the remainder of the total weight of the transaction hash mod; then, a weight range to which the node selection information belongs may be determined among the weight ranges of one or more candidate nodes, and a candidate node corresponding to the weight range to which the node selection information belongs may be determined as a processing node. Taking the above table 3 as an example, where the total weight of the 4 candidate nodes is 500, the remainder (i.e., node selection information) of the transaction hash mod total weight 500 of the target transaction request is 256, and the weight range [110, 290 ], it can be determined that the processing node of the target transaction request is the node whose node identifier is "xxx.xxx.xxx.xx2".
S403, the target transaction request is sent to the processing node, so that the processing node processes the target transaction request.
After selecting the processing node of the target transaction request from the nodes according to the transaction processing capability of each node, the service execution device may send the target transaction request to the processing node, so that the processing node processes the target transaction request, for example, the processing node may upload the transaction data requested to be uplink in the target transaction request to the blockchain for storage, the processing node may query the blockchain for the queried transaction data in the target transaction request, and return the queried transaction data to the service execution device, and so on.
In the embodiment of the application, the weight of each node in the blockchain network is dynamically configured, so that the transaction processing capacity of each node in the blockchain network can be accurately represented by adopting the weight, and the node with the larger weight has stronger transaction processing capacity and the node with the smaller weight has weaker transaction processing capacity. The transaction hash carried in the transaction request has randomness, and the node selection information corresponding to the transaction request is determined by adopting the transaction hash with randomness, so that the node selection information corresponding to the transaction request can be ensured to have randomness as well. In addition, the greater the weight is, the greater the corresponding weight range is, so that the greater the possibility that the node selection information corresponding to the transaction request belongs to the greater weight range is, namely the greater the possibility that the processing node of the transaction request is a node with strong transaction processing capability is, so that the greater the number of transaction requests loaded by the node with strong transaction processing capability is; the node with smaller weight has smaller corresponding weight range, so that the probability that the node selection information corresponding to the transaction request belongs to the small weight range is smaller, namely the probability that the processing node of the transaction request is a node with weak transaction processing capability is smaller, and the number of the transaction requests loaded by the node with weak transaction processing capability is smaller. The embodiment of the application can reasonably load the transaction request to each node in the blockchain network for processing, so that each node in the blockchain network is balanced in load, and the transaction request processing efficiency of the blockchain network is effectively improved.
The embodiment of the application provides a data processing method based on a block chain, which mainly introduces the content of dynamically configuring the weights of all nodes in a block chain network. The blockchain-based data processing method may be executed by the service execution device 31 in the data processing system, referring to fig. 6, and the blockchain-based data processing method may include the following steps S601 to S604:
s601, dynamically configuring the transaction processing capacity of each node according to the capacity configuration information of each node in the blockchain network.
From the foregoing, it can be seen that a node capability list of a blockchain network may be maintained in the service execution device, where transaction processing capabilities of each node in the blockchain network may be obtained from the node capability list, and the node capability list may include node identifiers and weights of each node. At the beginning, the service execution device may configure initial weights for each node in the blockchain network, which may be the same, and one example of an initial list of node capabilities is shown in table 4 below:
TABLE 4 Table 4
The initial node capability list shown in table 4 includes node identifiers and initial weights of 5 nodes, and the initial weights of 5 nodes are the same and are all 100. The initial weight ranges corresponding to the 5 nodes determined according to the initial weights of the 5 nodes in table 4 may be represented in one-dimensional coordinate axes, and referring to fig. 7a, the initial weights of the 5 nodes are the same, and the numerical intervals occupied in the one-dimensional coordinate axes are the same.
In the dynamic configuration stage, the service execution node can dynamically configure the node capability list according to the capability configuration information of each node in the blockchain network, namely, dynamically configure the transaction processing capability of each node according to the capability configuration information of each node in the blockchain network, namely, dynamically configure the weight of each node according to the capability configuration information of each node in the blockchain network. It should be noted that when dynamically configuring the weights of the respective nodes, the total weights of the respective nodes need to be constant regardless of the changes of the weights of the respective nodes, i.e., the total weights of the respective nodes are not changed, without changing the total configuration principle (except the case of accessing new nodes in the blockchain network). Wherein the capability configuration information of any one node may include at least one of: status change information of the node, performance change information of the node, transaction processing information of the node, and the like; the state change information of the node may be used to indicate a state change condition of the node (e.g., whether the node is available), the performance change information of the node may be used to indicate a performance change condition of the node (e.g., whether the performance of the node is optimized), and the transaction processing information of the node may be used to indicate a processing condition of the node on the historical transaction request for the blockchain (e.g., a success rate of the node processing the historical transaction request, a delay of the node processing the historical transaction request, a number of error codes returned by the node processing the historical transaction request, etc.). The following describes a process of dynamically configuring a node capability list according to state change information of each node, a process of dynamically configuring a node capability list according to performance change information of each node, and a process of dynamically configuring a node capability list according to transaction processing information of each node, respectively:
(1) The capability configuration information may include state change information, and the node capability list may be dynamically configured according to the state change information of each node. The node capability list may be dynamically configured according to state change information of each node, taking any node in the blockchain network (hereinafter, referred to as a target node) as an example, the process of dynamically configuring the node capability list by the service execution device according to capability configuration information (i.e., state change information) of each node in the blockchain network may include: the state change information of the target node in the blockchain network can be acquired, if the state change information of the target node indicates that the node state of the target node is changed from the available state to the unavailable state, the weight of the target node can be distributed to other nodes except the target node in the blockchain network, and then the weight of each node in the node capacity list can be updated.
Wherein the node state of the target node being an available state may include any of the following cases: port survival of the target node, normal growth of the block height of the blockchain in the target node, etc.; the node state of the target node being an unavailable state may include any of the following: the target node is down, the ports of the target node are deactivated, the block heights of the blockchains in the target node are abnormal (e.g., all nodes in the blockchain network except the target node generate blocks according to certain transaction data, but the target node does not generate blocks according to the transaction data, i.e., the target node does not go out of blocks), and the like.
When the service execution device distributes the weight of the target node to other nodes except the target node in the blockchain network, any one of a random distribution strategy, an average distribution strategy and a proportional distribution strategy can be adopted. The random allocation strategy is to randomly allocate the weight of the target node to other nodes except the target node in the block chain network; an average allocation strategy, namely, the weight of the target node is evenly allocated to other nodes except the target node in the blockchain network, and in this way, the weight increment of the other nodes except the target node in the blockchain network is the same; the weight of the target node can be distributed to other nodes except the target node in the blockchain network according to a proportion by the distribution strategy, and the proportion can be, for example, the ratio of the weight of the other nodes in the total weight of each node in the blockchain network, namely, the weight distributed to the other nodes is the product of the ratio of the weight of the other nodes and the weight of the target node, in this way, the weight increment of the other nodes except the target node in the blockchain network is related to the weight of the other nodes, and the larger the weight increment of the other nodes with larger weight is smaller the weight increment of the other nodes with smaller weight is. Taking the above table 4 as an example, since the weights of the nodes in the above table 4 are the same, the allocation results using the average allocation policy and the proportional allocation policy are the same, and taking the example that the node identified as "xxx.xxx.xxx.xx5" changes from the available state to the unavailable state, the updated node capability list can be seen in the following table 5:
TABLE 5
Node identification | Weighting of |
XXX.XXX.XXX.XX1 | 125 |
XXX.XXX.XXX.XX2 | 125 |
XXX.XXX.XXX.XX3 | 125 |
XXX.XXX.XXX.XX4 | 125 |
XXX.XXX.XXX.XX5 | 0 |
As shown in table 5 above, the weight of the node identified as "xxx.xxx.xxx.xxx 5" is equally assigned to the remaining 4 nodes other than the node identified as "xxx.xxx.xxx.xxx 5", and the weight of the node identified as "xxx.xxx.xxx.xxx 5" becomes 0. The weight ranges corresponding to the 4 nodes determined according to the weights of the 4 nodes with transaction processing capability in table 5 (the node identified as "xxx.xxx.xxx.xx5" does not have transaction processing capability) may be represented in one-dimensional coordinate axes, and the weights of the 4 nodes may be the same, and the numerical intervals occupied in the one-dimensional coordinate axes may be the same, as shown in fig. 7 b.
The above description is of the dynamic configuration process of the node capability list when the node state of a certain node in the blockchain network is changed from the available state to the unavailable state, and the dynamic configuration process of the node capability list when the node state of a certain node in the blockchain network is changed from the unavailable state to the available state will be described below. Taking any node in the blockchain network (hereinafter, referred to as a target node) as an example, the process of dynamically configuring the node capability list by the service execution device according to the capability configuration information of each node in the blockchain network may include: the state change information of the target node in the blockchain network can be acquired, if the state change information of the target node indicates that the node state of the target node is changed from the unavailable state to the available state, the weights distributed to the target node by other nodes except the target node in the blockchain network can be determined, then the weights of the target node can be determined according to the weights distributed to the target node by the other nodes, and the weights of all nodes in the node capacity list can be updated.
Similarly, the service execution device may employ any of a random allocation policy, an average allocation policy, and a proportional allocation policy in determining weights allocated to the target nodes by other nodes in the blockchain network than the target node. The random distribution strategy is that other nodes except the target node in the block chain network randomly distribute partial weights to the target node; an average allocation policy, that is, other nodes except the target node in the blockchain network allocate the same weight to the target node, for example, the other nodes each allocate weight 20 to the target node, in such a way that the weight decrement of the other nodes except the target node in the blockchain network is the same; the weight distributed to the target node by other nodes except the target node in the blockchain network can be determined according to the proportion by the proportion distribution strategy, and the proportion can be, for example, the ratio of the weight of the other nodes in the total weight of each node in the blockchain network, namely, the weight distributed to the target node by the other nodes is the product of the ratio of the other nodes and the weight of the other nodes, in this way, the weight reduction of the other nodes except the target node in the blockchain network is related to the weight of the other nodes, and the weight reduction of the other nodes with larger weight is smaller than that of the other nodes with smaller weight is larger. Taking the above table 5 as an example, if the node identified as "xxx.xxx.xxx.xxx5" changes from the unavailable state to the available state, and an average allocation policy is used to determine the weights allocated to the target node by other nodes except the target node in the blockchain network, and the weights are allocated to the target node by other nodes, the updated node capability list can be seen in the following table 6:
TABLE 6
As shown in table 6 above, the remaining 4 nodes in the blockchain network, except for the node identified as "xxx.xxx.xxx.xx5", are respectively assigned weights 20, the weights of the remaining 4 nodes are updated to 105, and the weights of the node identified as "xxx.xxx.xxx.xx5" are updated to 80. The weight range corresponding to each node determined according to the weights of each node in table 6 may be represented in a one-dimensional coordinate axis, and as can be seen in fig. 7c, the weight of node 5 is smaller than the weight of nodes 1 to 4, and the numerical interval occupied by node 5 in the one-dimensional coordinate axis is smaller than the numerical interval occupied by nodes 1 to 4 in the one-dimensional coordinate axis.
It should be noted that, for the process of dynamically configuring the node capability list according to the state change information of each node, the service execution device may detect the state change condition of each node in the blockchain network once every interval of a period of time (for example, every hour, every day, every week, every half month, etc.), configure the node capability list once according to the detected state change information of each node, and may be referred to as a state detection period in the process of dynamically configuring the node capability list according to the state change information of each node. After the node capacity list is dynamically configured according to the state change information of each node, the weight of the unavailable node is reduced to 0 to become a node without transaction processing capacity, and the available node can be restored to a certain weight, so that the weight of the node can more accurately represent the transaction processing capacity of the node.
(2) The capability configuration information may include performance change information, and the node capability list may be dynamically configured according to the performance change information of each node. Similar to the process of dynamically configuring the node capability list according to the state change information of each node, the service execution device may detect the performance information (e.g., memory information, CPU (Central Processing Unit, central processing unit) information, etc.) of each node in the blockchain network once every interval of a period of time (e.g., every hour, every day, every week, every half month, etc.), if the performance information of the node in the current period of time changes compared to the previous period of time of the current period of time, the weight of each node in the node capability list needs to be configured, and the period of time involved in dynamically configuring the node capability list according to the performance change information of each node may be referred to as a performance detection period.
Specifically, the node capability list may be dynamically configured according to performance change information of each node, taking any node in the blockchain network (hereinafter, referred to as a target node) as an example, the process of dynamically configuring the node capability list by the service execution device according to capability configuration information (i.e., performance change information) of each node in the blockchain network may include:
The performance change information of the target node in the blockchain network can be obtained, and if the performance change information of the target node indicates that the performance information of the target node in the current performance detection period is the same as the performance information of the target node in the previous performance detection period of the current performance detection period, the weight of the target node in the node capacity list can be kept unchanged.
Or if the performance change information of the target node indicates that the performance information of the target node in the current performance detection period is better than the performance information of the target node in the previous performance detection period of the current performance detection period (for example, the memory of the target node is expanded, the target node replaces a CPU with better performance, etc.), the weight of the target node in the node capacity list can be increased; the weight increased by the target node may be that other nodes except the target node in the blockchain network are distributed to the target node, and specifically, the weight distributed to the target node by other nodes except the target node in the blockchain network may be determined according to any one of a random distribution strategy, an average distribution strategy and a proportional distribution strategy, and specifically, the description in the above (1) may be referred to; taking the weight of each node in table 6 as an example, if the performance information of the node identified as "xxx.xxx.xxx.xx3" in the current performance detection period is better than the performance information of the node in the previous performance detection period in the current performance detection period, the weight of each node assigned to the node identified as "xxx.xxx.xxx.xxx.xx3" out of the remaining 4 nodes except for the node identified as "xxx.xxx.xxx.xx3" may be determined according to the average assignment policy (for example, the assignment weight of each node to the node identified as "xxx.xxx.xxx.xxx.xx3" is 1), the weight of the node identified as "xxx.xxx.xxx.xx3" may be increased by 4, and the updated node capability list may be referred to in table 6 as follows:
TABLE 7
Node identification | Weighting of |
XXX.XXX.XXX.XX1 | 104 |
XXX.XXX.XXX.XX2 | 104 |
XXX.XXX.XXX.XX3 | 109 |
XXX.XXX.XXX.XX4 | 104 |
XXX.XXX.XXX.XX5 | 79 |
Or if the performance change information of the target node indicates that the performance information of the target node in the current performance detection period is inferior to the performance information of the target node in the performance detection period previous to the current performance detection period (for example, part of the memory of the target node is damaged, the CPU of the target node is occupied by other irrelevant processes, etc.), the weight of the target node in the node capacity list can be reduced; the weight reduced by the target node can be distributed to other nodes except the target node in the blockchain network, specifically, the weight of the target node can be distributed to other nodes except the target node in the blockchain network according to any one of a random distribution strategy, an average distribution strategy and a proportional distribution strategy, and specifically, the description in the above (1) can be seen; taking the weight of each node in the above table 6 as an example, if the performance information of the node identified as "xxx.xxx.xxx.xx3" in the current performance detection period is inferior to the performance information of the node in the previous performance detection period in the current performance detection period, the weight of the target node is reduced by 8, and the reduced weight 8 may be allocated to the remaining 4 nodes except the node identified as "xxx.xxx.xxx.xx3" according to the average allocation policy, the weight of each node in the remaining 4 nodes is increased by 2, and the updated node capability list on the basis of the table 6 may be as follows in table 8:
TABLE 8
Node identification | Weighting of |
XXX.XXX.XXX.XX1 | 107 |
XXX.XXX.XXX.XX2 | 107 |
XXX.XXX.XXX.XX3 | 97 |
XXX.XXX.XXX.XX4 | 107 |
XXX.XXX.XXX.XX5 | 82 |
After the node capacity list is dynamically configured according to the performance change information of each node, the weight of the node with performance being lower than that of the node with original deterioration is properly reduced, and the weight of the node with performance being higher than that of the node with original deterioration is properly increased, so that the weight of the node can more accurately represent the transaction processing capacity of the node.
(3) The capability configuration information may include transaction processing information, and the node capability list may be dynamically configured according to the transaction processing information of each node. Similar to the process of dynamically configuring the node capability list according to the state change information of each node, the service execution device may count the processing conditions of each node in the blockchain network for the historical transaction request for the blockchain once every interval of a period of time (for example, every hour, every day, every week, every half month, etc.), generate transaction processing information of each node, where the transaction processing information may be used to indicate the processing conditions of each node for the historical transaction request for the blockchain, and then dynamically configure the weights of each node in the node capability list according to the transaction processing information of each node, where the time period involved in dynamically configuring the node capability list according to the transaction processing information of each node may be referred to as a transaction statistics period.
Specifically, the node capability list may be dynamically configured according to transaction processing information of each node, taking any node in the blockchain network (hereinafter, referred to as a target node) as an example, the process of dynamically configuring the node capability list by the service execution device according to capability configuration information (i.e., transaction processing information) of each node in the blockchain network may include: transaction processing information of each node can be obtained, the transaction processing information can be used for indicating the processing condition of the corresponding node on the historical transaction request aiming at the blockchain, and then each node can be ordered according to the transaction processing information of each node, so that the weight of each node in the node capacity list can be adjusted according to the arrangement sequence of each node.
Wherein the transaction processing information of any one node may include at least one of: success rate information of the node, delay information of the node and error code information of the node. The success rate information of the node refers to the success rate of the node for processing the historical transaction requests in the transaction counting period, and is the ratio between the number of the historical transaction requests successfully processed by the node in the transaction counting period and the total number of the historical transaction requests processed by the node in the transaction counting period; the higher the success rate of the node for processing the historical transaction request in the transaction statistics period, the stronger the transaction processing capability of the node, the lower the success rate of the node for processing the historical transaction request in the transaction statistics period, and the weaker the transaction processing capability of the node. The delay information of the node refers to a time difference between a time point when the node receives the historical transaction request and a time point when the node finishes processing the report of the historical transaction request, the delay information of the node may be a total time difference of each historical transaction request in a transaction statistics period, or may be an average time difference of each historical transaction request in the transaction statistics period, which is not limited in the embodiment of the present application; the larger the time difference of the node for processing the historical transaction request in the transaction statistics period is, the weaker the transaction processing capability of the node is, and the smaller the time difference of the node for processing the historical transaction request in the transaction statistics period is, the stronger the transaction processing capability of the node is. The error code information of the node refers to the quantity of error codes returned by the node in a transaction counting period, and the error codes can be generated when the node fails to process a historical transaction request; the more the number of error codes returned by the node in the transaction statistics period, the weaker the transaction processing capability of the node is indicated, and the fewer the number of error codes returned by the node in the transaction statistics period, the stronger the transaction processing capability of the node is indicated.
Taking the example that the transaction processing information of the nodes is success rate information of the nodes, the nodes can be ordered according to the success rate information of each node in the order from small to large or from large to small, and then the process of adjusting the weight of each node in the node capacity list according to the order of each node can comprise: the success rate information can be compared from two nodes positioned at two ends of the ordering, the nodes with low success rate information can be distributed to the nodes with high success rate information, and the nodes with the same success rate information do not need to adjust the weight. Taking the weight of each node in the node capability list shown in the above table 6 as an example, the success rate information of the node identified as "xxx.xxx.xxx.xxx.xx1" is 50%, the success rate information of the nodes identified as "xxx.xxx.xxx.xx2", "xxx.xxx.xxx.xxx.xx3" and "xxx.xxx.xxx.xx4" are all 80%, the success rate information of the node identified as "xxx.xxx.xxx.xxx.xx5" is 100%, and the partial weight of the node identified as "xxx.xxx.xxx.xxx.xx1" may be assigned to the node identified as "xxx.xxx.xxx.xxx.xx5" (for example, the assigned weight is 5), and the success rate information of the nodes identified as "xxx.xxx.xxx.xxx2", "xxx.xxx.xxx.xxx3" and "xxx.xxx.xxx.4" are the same, the weight adjustment is not required, and the weight adjustment may be performed before the weight adjustment is performed on the above table 6, and the comparison information may be adjusted according to the following table 9:
TABLE 9
Node identification | Weight (before adjustment) | Success rate information | Weight (after adjustment) |
XXX.XXX.XXX.XX1 | 105 | 50 | 105-5=100 |
XXX.XXX.XXX.XX2 | 105 | 80 | 105 |
XXX.XXX.XXX.XX3 | 105 | 80 | 105 |
XXX.XXX.XXX.XX4 | 105 | 80 | 105 |
XXX.XXX.XXX.XX5 | 80 | 100 | 80+5=85 |
When the transaction processing information of the node is delay information of the node or error code information of the node, similar to the case that the transaction processing information of the node is success rate information of the node, the description of the success rate information of the node can be referred to, and is not repeated herein. In the actual usage scenario, the weights of the nodes in the node capability list may be dynamically configured according to any two or more of the success rate information of the node, the delay information of the node, or the error code information of the node, and the weights of the nodes in the node capability list are described herein by taking three types of the success rate information of the node, the delay information of the node, and the error code information of the node as examples:
the first sorting of the nodes can be performed according to the success rate information of the nodes, the first adjustment of the weights of the nodes in the node capacity list can be performed according to the sorting sequence of the first sorting of the nodes, the second sorting of the nodes can be performed according to the delay information of the nodes, the second adjustment of the weights of the nodes in the node capacity list adjusted according to the success rate information of the nodes can be performed according to the sorting sequence of the second sorting of the nodes, the third sorting of the nodes can be performed according to the error code information of the nodes, and the third adjustment of the weights of the nodes in the node capacity list adjusted according to the success rate information of the nodes and the delay information can be performed according to the sorting sequence of the third sorting of the nodes. Or, the nodes can be sequenced once according to the success rate information of the nodes, the weights of the nodes in the node capacity list can be adjusted once, if the nodes with the same success rate information are encountered, the nodes with the same success rate information can be sequenced according to the delay information, so that the weights of the nodes with the same success rate information are adjusted, and if the nodes with the same delay information are encountered, the nodes with the same delay information can be sequenced according to the error code information, so that the weights of the nodes with the same delay information are adjusted.
It should be noted that, after the node capability list is dynamically configured according to the capability configuration information of each node according to any one of the modes (1) - (3), the weight of each node in the dynamically configured node capability list may also be checked, taking any node in the blockchain network (i.e., the target node) as an example, if the weight of the target node in the dynamically configured node capability list does not satisfy the transaction processing condition (i.e., the weight of the target node is less than or equal to the weight threshold), the weight of the target node may be allocated to other nodes in the blockchain network except the target node, and the weight of each node in the node capability list may be updated. The weight of the target node may be specifically allocated to other nodes except the target node in the blockchain network according to any one of a random allocation policy, an average allocation policy or a proportional allocation policy, which may be described in (1) above.
In addition, if a new node is accessed in the blockchain network, a node identifier of the new node can be added in the node capacity list, and an initial weight is allocated to the new node. Or if a new node is connected in the blockchain network, adding the identification of the new node in the node capacity list, determining the weight distributed to the new node by each old node in the blockchain network, and determining the weight of the new node according to the weight distributed to the new node by each old node in the blockchain network; the weight of each old node in the blockchain network to be allocated to the new node can be determined according to any one of a random allocation strategy, an average allocation strategy or a proportional allocation strategy, which can be seen from the description in the above (1).
It should be noted that the processes of dynamically configuring the node capability list described in (1) - (3) above are parallel, that is, the processes of dynamically configuring the node capability list described in (1) - (3) above are independent and do not interfere with each other. In addition, the state detection period, the performance detection period, and the transaction statistics period may be the same or different, which is not limited in the embodiment of the present application. After the weights of all nodes in the node capacity list are dynamically configured in a multi-round time period, the weights of all the nodes tend to be stable, the weights of all the nodes can accurately represent the own transaction processing capacity, and all the nodes can be distributed to the weight range of the transaction request which can be born by the nodes, so that the transaction request can be reasonably loaded into all the nodes of the blockchain network, the loads of all the nodes of the blockchain network are balanced, and the transaction request processing efficiency of the blockchain network is improved.
S602, when a target transaction request for the blockchain exists, the transaction processing capacity of each node in the blockchain network to which the blockchain belongs is acquired.
The execution process of step S602 in the embodiment of the present application is the same as the execution process of step S401 in the embodiment of fig. 4, and the specific execution process can be referred to the description of step S401 in the embodiment of fig. 4, which is not repeated here.
S603, selecting processing nodes of the target transaction request from the nodes according to the transaction processing capacity of the nodes.
The execution process of step S603 in the embodiment of the present application is the same as the execution process of step S402 in the embodiment of fig. 4, and the specific execution process can be referred to the description of step S402 in the embodiment of fig. 4, which is not repeated here.
S604, the target transaction request is sent to the processing node, so that the processing node processes the target transaction request.
The execution process of step S604 in the embodiment of the present application is the same as the execution process of step S403 in the embodiment of fig. 3, and the specific execution process can be referred to the description of step S403 in the embodiment of fig. 4, which is not repeated here.
It should be noted that, in the embodiment of the present application, the execution process of step S601 and the execution processes of steps S602-S604 are parallel, that is, the process of dynamically configuring the node capability list and the process of selecting the processing node of the transaction request from the nodes based on the weights of the nodes when the transaction request exists are parallel, and the two processes do not affect each other.
In the embodiment of the application, the weights of all nodes in the node capacity list are dynamically configured through multiple time periods, the weights of all nodes in the blockchain network tend to be stable, the weights of all nodes can accurately represent the transaction processing capacity of the nodes, and all the nodes can be distributed to the weight range of the transaction request which can be born by the nodes, so that the transaction request can be reasonably loaded into all the nodes of the blockchain network, the loads of all the nodes of the blockchain network are balanced, and the transaction request processing efficiency of the blockchain network is improved. In addition, the weight of each node in the node capability list is automatically configured based on the capability configuration information of each node, so that the weight configuration efficiency of each node in the blockchain network is greatly improved, and the transaction request processing efficiency of the blockchain network is further improved.
The foregoing details of the method of embodiments of the present application are provided for the purpose of better implementing the foregoing aspects of embodiments of the present application, and accordingly, the following provides an apparatus of embodiments of the present application.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a blockchain-based data processing device according to an embodiment of the present application, where the blockchain-based data processing device may be disposed in a computer device according to an embodiment of the present application. The blockchain-based data processing device may be a computer program (including program code) running in a computer device, which may be the aforementioned service execution device, which blockchain-based data processing device may be used to perform the respective steps in the method embodiments shown in fig. 4 or 6. Referring to fig. 8, the blockchain-based data processing device may include the following units:
an obtaining unit 801, configured to obtain, when there is a target transaction request for a blockchain, a transaction processing capability of each node in a blockchain network to which the blockchain belongs, where the transaction processing capability of each node is dynamically configured according to capability configuration information of each node;
A processing unit 802, configured to select a processing node of the target transaction request from the nodes according to the transaction processing capability of each node; the target transaction request is sent to the processing node to cause the processing node to process the target transaction request.
In one implementation, the transaction processing capability of each node is obtained from a node capability list of the blockchain network, the transaction processing capability of each node is represented in the node capability list by a weight, and the node capability list comprises node identifications of each node and weights of each node; the processing unit 802 is further configured to perform the following steps:
dynamically configuring a node capability list according to the capability configuration information of each node; wherein the capability configuration information of any one node includes at least one of: status change information of the node, performance change information of the node, transaction processing information of the node.
In one implementation, the node capability list is dynamically configured according to state change information of each node; the processing unit 802 is configured to dynamically configure the node capability list according to the capability configuration information of each node, and specifically is configured to execute the following steps:
Acquiring state change information of a target node in a blockchain network; if the state change information indicates that the node state of the target node is changed from the available state to the unavailable state, the weight of the target node is distributed to other nodes except the target node in the blockchain network; the weights of the individual nodes in the node capability list are updated.
In one implementation, the node capability list is dynamically configured according to state change information of each node; the processing unit 802 is configured to dynamically configure the node capability list according to the capability configuration information of each node, and specifically is configured to execute the following steps:
acquiring state change information of a target node in a blockchain network; if the state change information indicates that the node state of the target node is changed from the unavailable state to the available state, determining weights distributed to the target node by other nodes except the target node in the blockchain network; determining the weight of the target node according to the weights distributed to the target node by other nodes; the weights of the individual nodes in the node capability list are updated.
In one implementation, the node capability list is dynamically configured according to performance change information of each node; the processing unit 802 is configured to dynamically configure the node capability list according to the capability configuration information of each node, and specifically is configured to execute the following steps:
Acquiring performance change information of a target node in a blockchain network; if the performance change information indicates that the performance information of the target node in the current performance detection period is the same as the performance information of the target node in the previous performance detection period of the current performance detection period, the weight of the target node in the node capacity list is kept unchanged; or if the performance change information indicates that the performance information of the target node in the current performance detection period is better than the performance information of the target node in the previous performance detection period of the current performance detection period, increasing the weight of the target node in the node capacity list; or if the performance change information indicates that the performance information of the target node in the current performance detection period is inferior to the performance information of the target node in the previous performance detection period of the current performance detection period, the weight of the target node in the node capacity list is reduced.
In one implementation, the node capability list is dynamically configured according to transaction processing information of each node; the processing unit 802 is configured to dynamically configure the node capability list according to the capability configuration information of each node, and specifically is configured to execute the following steps:
acquiring transaction processing information of each node, wherein the transaction processing information is used for indicating the processing condition of the corresponding node on historical transaction requests aiming at the blockchain; sequencing each node according to the transaction processing information of each node; and adjusting the weight of each node in the node capacity list according to the arrangement sequence of each node.
In one implementation, the processing unit 802 is configured to perform the following steps after dynamically configuring the node capability list according to the capability configuration information of each node:
if the weight of the target node in the dynamically configured node capacity list does not meet the transaction processing condition, the weight of the target node is distributed to other nodes except the target node in the blockchain network; and updating the weight of each node in the node capability list.
In one implementation, the transaction processing capabilities of each node are represented by weights; the processing unit 802 is configured to, when selecting a processing node of the target transaction request from the nodes according to the transaction processing capability of each node, specifically perform the following steps:
screening one or more candidate nodes with weights meeting transaction processing conditions from the nodes; determining a weight range of one or more candidate nodes according to the weights of the one or more candidate nodes; a processing node for the target transaction request is selected from the one or more candidate nodes based on the target transaction request and a range of weights for the one or more candidate nodes.
In one implementation, the target transaction request carries a transaction hash; the processing unit 802 is configured to, when selecting a processing node of the target transaction request from one or more candidate nodes according to the target transaction request and the weight ranges of the one or more candidate nodes, specifically perform the following steps:
Acquiring the total weight of each candidate node; determining node selection information corresponding to the target transaction request according to the transaction hash and the total weight; and determining the weight range to which the node selection information belongs from the weight ranges of one or more candidate nodes, and determining the candidate node corresponding to the weight range to which the node selection information belongs as a processing node.
In one implementation, the weights of the respective nodes are obtained from a node capability list of the blockchain network, the node capability list including node identifications of the respective nodes and the weights of the respective nodes; the number of the candidate nodes is M, node identifiers of the M candidate nodes are arranged in sequence in a node capacity list, any one of the M candidate nodes is represented as an ith candidate node, M is a positive integer, and i is a positive integer smaller than or equal to M;
the processing unit 802 is configured to determine a weight range of one or more candidate nodes according to weights of the one or more candidate nodes, and specifically is configured to perform the following steps:
determining a first numerical value according to weights of i-1 candidate nodes arranged before the ith candidate node in the node capacity list; determining a second value according to the first value and the weight of the ith candidate node; determining a weight range of the ith candidate node according to the first value and the second value; when the value of i is 1, the first value is the target value.
According to another embodiment of the present application, each unit in the blockchain-based data processing apparatus shown in fig. 8 may be separately or completely combined into one or several additional units, or some unit(s) thereof may be further split into a plurality of units with smaller functions, which may achieve the same operation without affecting the implementation of the technical effects of the embodiments of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the application, the data processing apparatus may also comprise other units, and in practical applications, these functions may also be realized with the assistance of other units, and may be realized by cooperation of a plurality of units.
According to another embodiment of the present application, a blockchain-based data processing apparatus as shown in fig. 8 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 4 or 6 on a general-purpose computing device such as a computer including a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), etc., processing elements and storage elements, and implementing the blockchain-based data processing method of the embodiments of the present application. The computer program may be recorded on, for example, a computer-readable storage medium, and loaded into and executed by the computing device described above.
In the embodiment of the application, when the transaction request aiming at the blockchain exists, the processing node of the transaction request can be selected from all nodes according to the transaction processing capability of all nodes in the blockchain network to which the blockchain belongs, so that the transaction request can be sent to the processing node for processing. According to the embodiment of the application, the processing nodes of the transaction request are selected according to the transaction processing capacity of the nodes, and the transaction request can be reasonably loaded into the blockchain network for processing, so that the loads of all nodes in the blockchain network are balanced, and the transaction request processing efficiency of the blockchain network is improved.
Based on the above method and apparatus embodiments, an embodiment of the present application provides a computer device, please refer to fig. 9, and fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application. The computer device shown in fig. 9 includes at least a processor 901, an input interface 902, an output interface 903, and a computer readable storage medium 904. Wherein the processor 901, the input interface 902, the output interface 903, and the computer readable storage medium 904 may be connected by a bus or other means.
The input interface 902 may be used to obtain transaction processing capabilities of each node in the blockchain network, obtain capability configuration information of each node in the blockchain network, and the like; the output interface 903 may be used to send the target transaction request to a processing node of the target transaction request, or the like.
The computer readable storage medium 904 may be stored in a memory of a computer device, the computer readable storage medium 904 for storing a computer program comprising computer instructions, and the processor 901 for executing the program instructions stored by the computer readable storage medium 904. The processor 901 (or CPU (Central Processing Unit, central processing unit)) is a computing core and a control core of a computer device, which is adapted to implement one or more computer instructions, in particular to load and execute one or more computer instructions to implement a corresponding method flow or a corresponding function.
The embodiment of the application also provides a computer readable storage medium (Memory), which is a Memory device in the computer device and is used for storing programs and data. It is understood that the computer readable storage medium herein may include both built-in storage media in a computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores an operating system of the computer device. Also stored in the memory space are one or more computer instructions, which may be one or more computer programs (including program code), adapted to be loaded and executed by the processor. Note that the computer readable storage medium can be either a high-speed RAM Memory or a Non-Volatile Memory (Non-Volatile Memory), such as at least one magnetic disk Memory; optionally, at least one computer readable storage medium remotely located from the aforementioned processor.
The computer device can be the aforementioned business execution device that can be loaded with and execute one or more computer instructions stored in the computer-readable storage medium 904 by the processor 901 to implement the corresponding steps described above with respect to the blockchain-based data processing method shown in fig. 4 or 6. In particular implementations, computer instructions in the computer readable storage medium 904 are loaded by the processor 901 and perform the steps of:
when a target transaction request aiming at the blockchain exists, acquiring transaction processing capacity of each node in a blockchain network to which the blockchain belongs, wherein the transaction processing capacity of each node is obtained by dynamic configuration according to capacity configuration information of each node; selecting a processing node of the target transaction request from the nodes according to the transaction processing capacity of the nodes; the target transaction request is sent to the processing node to cause the processing node to process the target transaction request.
In one implementation, the transaction processing capability of each node is obtained from a node capability list of the blockchain network, the transaction processing capability of each node is represented in the node capability list by a weight, and the node capability list comprises node identifications of each node and weights of each node; computer instructions in the computer-readable storage medium 904 are loaded by the processor 901 and further for performing the steps of:
Dynamically configuring a node capability list according to the capability configuration information of each node; wherein the capability configuration information of any one node includes at least one of: status change information of the node, performance change information of the node, transaction processing information of the node.
In one implementation, the node capability list is dynamically configured according to state change information of each node; computer instructions in the computer-readable storage medium 904 are loaded and executed by the processor 901 to dynamically configure a node capability list according to capability configuration information of each node, and specifically configured to perform the steps of:
acquiring state change information of a target node in a blockchain network; if the state change information indicates that the node state of the target node is changed from the available state to the unavailable state, the weight of the target node is distributed to other nodes except the target node in the blockchain network; the weights of the individual nodes in the node capability list are updated.
In one implementation, the node capability list is dynamically configured according to state change information of each node; computer instructions in the computer-readable storage medium 904 are loaded and executed by the processor 901 to dynamically configure a node capability list according to capability configuration information of each node, and specifically configured to perform the steps of:
Acquiring state change information of a target node in a blockchain network; if the state change information indicates that the node state of the target node is changed from the unavailable state to the available state, determining weights distributed to the target node by other nodes except the target node in the blockchain network; determining the weight of the target node according to the weights distributed to the target node by other nodes; the weights of the individual nodes in the node capability list are updated.
In one implementation, the node capability list is dynamically configured according to performance change information of each node; computer instructions in the computer-readable storage medium 904 are loaded and executed by the processor 901 to dynamically configure a node capability list according to capability configuration information of each node, and specifically configured to perform the steps of:
acquiring performance change information of a target node in a blockchain network; if the performance change information indicates that the performance information of the target node in the current performance detection period is the same as the performance information of the target node in the previous performance detection period of the current performance detection period, the weight of the target node in the node capacity list is kept unchanged; or if the performance change information indicates that the performance information of the target node in the current performance detection period is better than the performance information of the target node in the previous performance detection period of the current performance detection period, increasing the weight of the target node in the node capacity list; or if the performance change information indicates that the performance information of the target node in the current performance detection period is inferior to the performance information of the target node in the previous performance detection period of the current performance detection period, the weight of the target node in the node capacity list is reduced.
In one implementation, the node capability list is dynamically configured according to transaction processing information of each node; computer instructions in the computer-readable storage medium 904 are loaded and executed by the processor 901 to dynamically configure a node capability list according to capability configuration information of each node, and specifically configured to perform the steps of:
acquiring transaction processing information of each node, wherein the transaction processing information is used for indicating the processing condition of the corresponding node on historical transaction requests aiming at the blockchain; sequencing each node according to the transaction processing information of each node; and adjusting the weight of each node in the node capacity list according to the arrangement sequence of each node.
In one implementation, the computer instructions in the computer readable storage medium 904 are loaded and executed by the processor 901 to dynamically configure the node capability list according to the capability configuration information of each node, and then further configured to perform the following steps:
if the weight of the target node in the dynamically configured node capacity list does not meet the transaction processing condition, the weight of the target node is distributed to other nodes except the target node in the blockchain network; and updating the weight of each node in the node capability list.
In one implementation, the transaction processing capabilities of each node are represented by weights; computer instructions in the computer readable storage medium 904 are loaded by the processor 901 and execute the processing node of the target transaction request from each node according to the transaction processing capability of each node, specifically for executing the following steps:
screening one or more candidate nodes with weights meeting transaction processing conditions from the nodes; determining a weight range of one or more candidate nodes according to the weights of the one or more candidate nodes; a processing node for the target transaction request is selected from the one or more candidate nodes based on the target transaction request and a range of weights for the one or more candidate nodes.
In one implementation, the target transaction request carries a transaction hash; computer instructions in the computer readable storage medium 904 are loaded and executed by the processor 901 to perform the steps of, when selecting a processing node for a target transaction request from one or more candidate nodes based on the target transaction request and a weight range of the one or more candidate nodes:
acquiring the total weight of each candidate node; determining node selection information corresponding to the target transaction request according to the transaction hash and the total weight; and determining the weight range to which the node selection information belongs from the weight ranges of one or more candidate nodes, and determining the candidate node corresponding to the weight range to which the node selection information belongs as a processing node.
In one implementation, the weights of the respective nodes are obtained from a node capability list of the blockchain network, the node capability list including node identifications of the respective nodes and the weights of the respective nodes; the number of the candidate nodes is M, node identifiers of the M candidate nodes are arranged in sequence in a node capacity list, any one of the M candidate nodes is represented as an ith candidate node, M is a positive integer, and i is a positive integer smaller than or equal to M;
computer instructions in the computer-readable storage medium 904 are loaded and executed by the processor 901 to determine a weight range for one or more candidate nodes based on the weights of the one or more candidate nodes, and are specifically configured to perform the steps of:
determining a first numerical value according to weights of i-1 candidate nodes arranged before the ith candidate node in the node capacity list; determining a second value according to the first value and the weight of the ith candidate node; determining a weight range of the ith candidate node according to the first value and the second value; when the value of i is 1, the first value is the target value.
In the embodiment of the application, when the transaction request aiming at the blockchain exists, the processing node of the transaction request can be selected from all nodes according to the transaction processing capability of all nodes in the blockchain network to which the blockchain belongs, so that the transaction request can be sent to the processing node for processing. According to the embodiment of the application, the processing nodes of the transaction request are selected according to the transaction processing capacity of the nodes, and the transaction request can be reasonably loaded into the blockchain network for processing, so that the loads of all nodes in the blockchain network are balanced, and the transaction request processing efficiency of the blockchain network is improved.
It will be appreciated that in the embodiments of the present application, related data such as capability configuration information (i.e., status change information, performance change information, or transaction processing information) of each node in a blockchain network, transaction data stored in a blockchain, etc., when the above embodiments of the present application are applied to specific products or technologies, permission or consent of related objects needs to be obtained, for example, permission or consent of each node in the blockchain network needs to be obtained when the capability configuration information of each node in the blockchain network is obtained, permission or consent of the transaction data stored in the blockchain related to a service execution device needs to be obtained when the transaction data stored in the blockchain related to the service execution device is obtained, and collection, use, and processing of related data need to comply with related laws and regulations and standards of related countries and regions.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium and executes the computer instructions to cause the computer device to perform the blockchain-based data processing method provided in the various alternatives described above.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily appreciate variations or alternatives within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (14)
1. A method of blockchain-based data processing, the method comprising:
when a target transaction request aiming at a blockchain exists, acquiring transaction processing capacity of each node in a blockchain network to which the blockchain belongs, wherein the transaction processing capacity of each node is obtained by dynamic configuration according to capacity configuration information of each node;
selecting a processing node of the target transaction request from the nodes according to the transaction processing capacity of the nodes;
and sending the target transaction request to the processing node so that the processing node processes the target transaction request.
2. The method of claim 1, wherein the transaction processing capabilities of the respective nodes are obtained from a node capability list of the blockchain network, the transaction processing capabilities of the respective nodes being represented in the node capability list by weights, the node capability list including node identifications of the respective nodes and weights of the respective nodes; the method further comprises the steps of:
Dynamically configuring the node capability list according to the capability configuration information of each node;
wherein the capability configuration information of any one node includes at least one of: status change information of the node, performance change information of the node, transaction processing information of the node.
3. The method of claim 2, wherein the list of node capabilities is dynamically configured based on state change information of the respective nodes; the dynamically configuring the node capability list according to the capability configuration information of each node comprises the following steps:
acquiring state change information of a target node in the blockchain network;
if the state change information indicates that the node state of the target node is changed from the available state to the unavailable state, the weight of the target node is distributed to other nodes except the target node in the blockchain network;
and updating the weight of each node in the node capability list.
4. The method of claim 3, wherein the list of node capabilities is dynamically configured based on state change information for the respective node; the dynamically configuring the node capability list according to the capability configuration information of each node comprises the following steps:
Acquiring state change information of a target node in the blockchain network;
if the state change information indicates that the node state of the target node is changed from the unavailable state to the available state, determining weights distributed to the target node by other nodes except the target node in the blockchain network;
determining the weight of the target node according to the weights distributed to the target node by the other nodes;
and updating the weight of each node in the node capability list.
5. The method of claim 2, wherein the list of node capabilities is dynamically configured according to performance change information of the respective nodes; the dynamically configuring the node capability list according to the capability configuration information of each node comprises the following steps:
acquiring performance change information of a target node in the blockchain network;
if the performance change information indicates that the performance information of the target node in the current performance detection period is the same as the performance information of the target node in the previous performance detection period of the current performance detection period, the weight of the target node in the node capacity list is kept unchanged; or,
If the performance change information indicates that the performance information of the target node in the current performance detection period is better than the performance information of the target node in the previous performance detection period of the current performance detection period, increasing the weight of the target node in the node capacity list; or,
and if the performance change information indicates that the performance information of the target node in the current performance detection period is inferior to the performance information of the target node in the performance detection period which is the last performance detection period of the current performance detection period, reducing the weight of the target node in the node capacity list.
6. The method of claim 2, wherein the list of node capabilities is dynamically configured based on transaction processing information for the respective node; the dynamically configuring the node capability list according to the capability configuration information of each node comprises the following steps:
acquiring transaction processing information of each node, wherein the transaction processing information is used for indicating the processing condition of a corresponding node on historical transaction requests aiming at the blockchain;
ordering the nodes according to the transaction processing information of the nodes;
And adjusting the weight of each node in the node capacity list according to the arrangement sequence of each node.
7. The method of claim 2, wherein after dynamically configuring the node capability list according to the capability configuration information of the respective nodes, the method further comprises:
if the weight of the target node in the node capacity list after dynamic configuration does not meet the transaction processing condition, the weight of the target node is distributed to other nodes except the target node in the blockchain network;
and updating the weight of each node in the node capability list.
8. The method of claim 1, wherein the transaction processing capabilities of the respective nodes are represented by weights; the processing node for selecting the target transaction request from the nodes according to the transaction processing capability of the nodes comprises:
screening one or more candidate nodes with weights meeting transaction processing conditions from the nodes;
determining a weight range of the one or more candidate nodes according to the weights of the one or more candidate nodes;
And selecting a processing node of the target transaction request from the one or more candidate nodes according to the target transaction request and the weight range of the one or more candidate nodes.
9. The method of claim 8, wherein the target transaction request carries a transaction hash; the selecting a processing node of the target transaction request from the one or more candidate nodes according to the target transaction request and the weight range of the one or more candidate nodes comprises:
acquiring the total weight of each candidate node;
determining node selection information corresponding to the target transaction request according to the transaction hash and the total weight;
and determining a weight range to which the node selection information belongs from the weight ranges of the one or more candidate nodes, and determining the candidate node corresponding to the weight range to which the node selection information belongs as the processing node.
10. The method of claim 8, wherein the weights for the respective nodes are obtained from a node capability list of the blockchain network, the node capability list including node identifications for the respective nodes and weights for the respective nodes; the number of the candidate nodes is M, node identifiers of the M candidate nodes are arranged in the node capacity list in sequence, any one of the M candidate nodes is represented as an ith candidate node, M is a positive integer, and i is a positive integer smaller than or equal to M;
The determining the weight range of the one or more candidate nodes according to the weights of the one or more candidate nodes comprises:
determining a first numerical value according to weights of i-1 candidate nodes arranged before the ith candidate node in the node capacity list;
determining a second value according to the first value and the weight of the ith candidate node;
determining a weight range of the ith candidate node according to the first numerical value and the second numerical value; when the value of i is 1, the first value is a target value.
11. A blockchain-based data processing device, the device comprising:
an obtaining unit, configured to obtain, when there is a target transaction request for a blockchain, a transaction processing capability of each node in a blockchain network to which the blockchain belongs, where the transaction processing capability of each node is dynamically configured according to capability configuration information of each node;
a processing unit, configured to select a processing node of the target transaction request from the nodes according to the transaction processing capability of the nodes; and sending the target transaction request to the processing node so that the processing node processes the target transaction request.
12. A computer device, the computer device comprising:
a processor adapted to implement a computer program;
a computer readable storage medium storing a computer program adapted to be loaded by the processor and to perform the blockchain-based data processing method of any of claims 1 to 10.
13. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program adapted to be loaded by a processor and to perform the blockchain based data processing method of any of claims 1 to 10.
14. A computer program product comprising computer instructions which, when executed by a processor, implement the blockchain-based data processing method of any of claims 1 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210169752.5A CN116684098A (en) | 2022-02-23 | 2022-02-23 | Block chain-based data processing method, device, equipment, medium and product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210169752.5A CN116684098A (en) | 2022-02-23 | 2022-02-23 | Block chain-based data processing method, device, equipment, medium and product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116684098A true CN116684098A (en) | 2023-09-01 |
Family
ID=87781445
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210169752.5A Pending CN116684098A (en) | 2022-02-23 | 2022-02-23 | Block chain-based data processing method, device, equipment, medium and product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116684098A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117579633A (en) * | 2024-01-17 | 2024-02-20 | 腾讯科技(深圳)有限公司 | Block election method, device, equipment and storage medium |
-
2022
- 2022-02-23 CN CN202210169752.5A patent/CN116684098A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117579633A (en) * | 2024-01-17 | 2024-02-20 | 腾讯科技(深圳)有限公司 | Block election method, device, equipment and storage medium |
CN117579633B (en) * | 2024-01-17 | 2024-04-09 | 腾讯科技(深圳)有限公司 | Block election method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109618002B (en) | Micro-service gateway optimization method, device and storage medium | |
CN109218355A (en) | Load equalizing engine, client, distributed computing system and load-balancing method | |
CN110058940B (en) | Data processing method and device in multi-thread environment | |
EP3293969A1 (en) | Method of terminal-based conference load-balancing, and device and system utilizing same | |
CN111444018B (en) | Request processing method and device | |
CN107105013B (en) | File processing method, server, terminal and system | |
CN110460879B (en) | Video request scheduling method, device, server and storage medium | |
CN109413202B (en) | System and method for sorting block chain transaction information | |
US20190372825A1 (en) | Communication apparatus, communication method, and recording medium | |
CN116684098A (en) | Block chain-based data processing method, device, equipment, medium and product | |
CN110490734B (en) | Transaction group construction and broadcasting method and system, equipment and storage medium | |
CN114490826A (en) | Request response method, data storage method, device, server and storage medium | |
CN110333984B (en) | Interface abnormality detection method, device, server and system | |
CN102316138A (en) | Client end and load balance method | |
CN108200185A (en) | A kind of method and device for realizing load balancing | |
CN111737000A (en) | Method for realizing load balance | |
CN115952003A (en) | Method, device, equipment and storage medium for cluster server load balancing | |
US10193790B2 (en) | Systems and methods for an intelligent, distributed, autonomous, and scalable resource discovery, management, and stitching | |
CN116980281A (en) | Node selection method, node selection device, first node, storage medium and program product | |
CN111064774B (en) | Distributed data storage method and device | |
CN110968409A (en) | Data processing method and device | |
CN110046040B (en) | Distributed task processing method and system and storage medium | |
CN117036038B (en) | Transaction processing method, device, equipment and storage medium based on alliance chain | |
CN115202871B (en) | Collaborative space division method, device, equipment and storage medium | |
CN110166429B (en) | Data packet processing method and device, computer readable storage medium and server |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40091954 Country of ref document: HK |