CN116074330A - Data processing method and device based on blockchain network and related equipment - Google Patents

Data processing method and device based on blockchain network and related equipment Download PDF

Info

Publication number
CN116074330A
CN116074330A CN202111269353.8A CN202111269353A CN116074330A CN 116074330 A CN116074330 A CN 116074330A CN 202111269353 A CN202111269353 A CN 202111269353A CN 116074330 A CN116074330 A CN 116074330A
Authority
CN
China
Prior art keywords
data
network
node
data node
service node
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
Application number
CN202111269353.8A
Other languages
Chinese (zh)
Inventor
刘攀
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202111269353.8A priority Critical patent/CN116074330A/en
Publication of CN116074330A publication Critical patent/CN116074330A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0852Delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level
    • H04L43/0894Packet rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic 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/3247Cryptographic 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 involving digital signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Environmental & Geological Engineering (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application provides a data processing method, a device and related equipment based on a block chain network, wherein the method comprises the following steps: acquiring network state data of the blockchain network, wherein the network state data comprises one or two of a first network state recorded by a first service node and a second network state recorded by a second service node, the first network state comprises a network state parameter of each data node connected with the first service node, and the second network state comprises a network state parameter of each data node connected with the second service node; determining a network quality score for each data node connected to the first service node based on the network status data; and determining a target data node with network quality meeting the condition from each data node connected with the first service node, wherein the target data node is used for providing block data, so that the network quality of the data node can be accurately estimated, the network resources of the block chain network are fully utilized, and the synchronization efficiency of the block data is effectively improved.

Description

Data processing method and device based on blockchain network and related equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data processing method and apparatus based on a blockchain network, and related devices.
Background
With the progress of science and technology and the development of society, the application of blockchain technology is becoming wider and wider. The blockchain is a distributed account book, and a reliable database is maintained in a collective mode of decentralization and trust removal, and particularly can be commonly maintained by a plurality of nodes in the blockchain network. Based on this, efficient synchronization of data such as blocks between nodes of a blockchain network becomes particularly important.
At present, when data synchronization is performed between nodes in a blockchain network, a proper node is usually selected for data synchronization according to the traffic load of the node, or the node is selected for data synchronization in a random mode, however, in practice, it is found that when the node is selected for data synchronization according to the traffic load of the node or in a random selection mode, the resources of the blockchain network are difficult to comprehensively utilize, and the synchronization efficiency of the block data is low. Therefore, how to effectively improve the synchronization efficiency of data in a blockchain network has become a problem to be solved.
Disclosure of Invention
The embodiment of the application provides a data processing method, a device and related equipment based on a block chain network, which can accurately evaluate the network quality of a data node and fully utilize the network resources of the block chain network, thereby effectively improving the synchronization efficiency of block data.
In a first aspect, an embodiment of the present application provides a data processing method based on a blockchain network, applied to a first service node of the blockchain network, where the method includes:
acquiring network state data of the blockchain network, wherein the network state data comprises one or two of a first network state recorded by the first service node and a second network state recorded by a second service node of the blockchain network, the first network state comprises a network state parameter of each data node connected with the first service node in the blockchain network, the second network state comprises a network state parameter of each data node connected with the second service node in the blockchain network, and the network state parameter comprises one or two of network delay time and historical transmission speed;
determining a network quality score for each data node connected to the first service node based on the network status data;
And determining a target data node with the network quality score meeting a preset condition from each data node connected with the first service node, wherein the target data node is used for providing block data to be synchronized.
In a second aspect, embodiments of the present application provide a data processing apparatus, the apparatus including:
an acquisition module configured to acquire network state data of a blockchain network, where the network state data includes one or two of a first network state recorded by a first service node of the blockchain network and a second network state recorded by a second service node of the blockchain network, the first network state includes a network state parameter of each data node connected to the first service node in the blockchain network, the second network state includes a network state parameter of each data node connected to the second service node in the blockchain network, and the network state parameter includes one or two of a network delay time and a historical transmission speed;
a determining module, configured to determine a network quality score of each data node connected to the first service node according to the network status data;
The determining module is further configured to determine, from each data node connected to the first service node, a target data node whose network quality score meets a preset condition, where the target data node is used to provide block data to be synchronized.
In a third aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor, a network interface, and a storage device, where the processor, the network interface, and the storage device are connected to each other, where the network interface is controlled by the processor to send and receive data, and the storage device is used to store a computer program, where the computer program includes program instructions, and the processor is configured to invoke the program instructions to perform the data processing method according to the first aspect.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program comprising program instructions for execution by a processor to perform the data processing method according to the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program, characterized in that the computer program, when executed by a computer processor, implements the data processing method according to the first aspect.
In this embodiment, the first service node of the blockchain network may acquire network state data of the blockchain network, where the network state data includes one or two of a first network state recorded by the first service node and a second network state recorded by a second service node of the blockchain network, where the first network state includes a network state parameter of each data node connected to the first service node in the blockchain network, and the second network state includes a network state parameter of each data node connected to the second service node in the blockchain network, where the first service node may determine a network quality score of each data node connected to the first service node according to the network state data, determine a target data node whose network quality score meets a preset condition from each data node connected to the first service node, and the target data node may be used to provide block data to be synchronized.
Drawings
In order to more clearly illustrate the embodiments of the present 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 below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1a is a schematic diagram of a data processing system according to an embodiment of the present application;
FIG. 1b is a block chain architecture diagram according to one embodiment of the present application;
FIG. 1c is a schematic diagram of a process for generating a new block according to an embodiment of the present application;
FIG. 2 is a flowchart of a data processing method based on a blockchain network according to an embodiment of the present disclosure;
FIG. 3 is a flowchart of another data processing method based on a blockchain network according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a data processing apparatus according to an embodiment of the present application;
fig. 5 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 fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Referring to fig. 1a, a schematic architecture diagram of a data processing system according to an embodiment of the present application is provided, where the data processing system includes a blockchain network 10 and a terminal device 20, and the steps include:
the blockchain network 10 may specifically be a hierarchical structure including a traffic network 101, a data network 102, and a core network 103. The core network 103 is composed of a plurality of consensus nodes 1030, and the core network 103 is responsible for the consensus of the whole network, packages transactions into blocks and performs consensus accounting; the data network 102 is composed of a plurality of data nodes 1020, and the data network 102 is responsible for synchronizing the account information of the core network 103, that is, synchronizing the latest block data, and providing read services to the service network 101; the service network 101 is made up of a plurality of service nodes 1010, the service network 101 being responsible for synchronizing the block data of the service itself from the data network 102 and for data isolation by the data network 102. The hierarchical structure can be infinitely extended each time, and especially the service network 101, the data network 102 and the core network 103 can be limited to a certain size range under the premise of ensuring the high performance and high availability of the whole network during extension.
The service network 101, the data network 102 and the core network 103 may each comprise a plurality of nodes, for example, the service node 1010 comprised by the service network 101, the data node 1020 comprised by the data network 102 and the consensus node 1030 comprised by the core network 103 may each be a plurality. In order To ensure information intercommunication in a blockchain network, information connection can exist between nodes in the same network (for example, the data network 102), and point-To-point (P2P) communication can be realized between any two nodes, specifically, P2P communication can be performed through a wired communication link or a wireless communication link.
The terminal device 20 may access the blockchain network 10 and may communicate with nodes in the blockchain network 10, e.g., may submit data (e.g., transaction data, data query requests, etc.) to a service node 1010 in the service network 101, query data from the service node 1010, etc. The terminal device 20 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, an on-vehicle smart terminal, etc., which is not limited in this embodiment.
It should be noted that the number of various types of nodes, such as the service node 1010, the data node 1020, the consensus node 1030, and the like, shown in fig. 1a is merely illustrative, and any number of nodes may be deployed according to actual needs.
Wherein each node in the blockchain network 10 stores one and the same blockchain. The blockchain is composed of a plurality of blocks, see fig. 1b, the blockchain is composed of a plurality of blocks, the starting block comprises a block head and a block main body, the block head stores an input information characteristic value, a version number, a time stamp and a difficulty value, and the block main 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 main 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.
When each block in the blockchain is generated, referring to fig. 1c, when the node where the blockchain is located receives input information, checking the input information, after the checking is completed, storing the input information into a memory pool, and updating a hash tree used for recording the input information; then, updating the update time stamp to the time of receiving the input information, trying different random numbers, and calculating the characteristic value for a plurality of times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
wherein SHA256 is a eigenvalue algorithm used to calculate eigenvalues; version (version number) is version information of the related block protocol in the block chain; the prev_hash is the block header characteristic value of the parent block of the current block; the merkle_root is a characteristic value of input information; ntime is the update time of the update timestamp; the nbits is the current difficulty, is a fixed value in a period of time, and is determined again after exceeding a fixed period of time; x is a random number; TARGET is a eigenvalue threshold that can be determined from nbits.
Thus, when the random number meeting the formula is calculated, the information can be correspondingly stored to generate the block head and the block main body, and the current block is obtained. And then, the node where the blockchain is located sends the newly generated blocks to other nodes in the blockchain network where the newly generated blocks are located according to the node identifications of other nodes in the blockchain network, the other nodes verify the newly generated blocks, and the newly generated blocks are added into the blockchain stored in the newly generated blocks after the verification is completed.
The intelligent contract is a code implementation for executing when a certain condition is met, a developer can define contract logic through a programming language, issue the contract logic to a blockchain (intelligent contract registration), call a key or trigger execution according to the logic of contract clauses to complete the contract logic, and simultaneously provide functions of upgrading and logging off the intelligent contract.
In some possible embodiments, each service node 1010 in the service network 101 may establish a connection with one or more data nodes 1020 in the data network 102, for example, a first service node in the service network 101 may be any one of the service nodes, the first service node may acquire network state data of the blockchain network, the network state data includes one or two of a first network state recorded by the first service node and a second network state recorded by a second service node of the blockchain network, where the first network state refers to a network state parameter of each data node connected to the first service node in the blockchain network, the second network state refers to a network state parameter of each data node connected to the second service node in the blockchain network, the network state parameter includes one or two of a network delay time and a historical transmission speed, the first service node may determine a network quality score of each data node connected to the first service node according to the network state data, and may meet a preset target data quality condition from the connected data nodes, and may provide a network state score for the data block to be sufficiently providing a network state, and the network state score can be sufficiently evaluated by using the data of the network state, and the network state can be sufficiently used for providing a network state of a network state.
The implementation details of the technical solutions of the embodiments of the present application are described in detail below:
referring to fig. 2, a flowchart of a data processing method based on a blockchain network provided by the data processing system shown in fig. 1a according to an embodiment of the present application is mainly described from a first service node side in the blockchain network, and the data processing method includes the following steps:
201. network state data of a blockchain network is obtained, wherein the network state data comprises one or two of a first network state recorded by a first service node and a second network state recorded by a second service node of the blockchain network.
Each service node may establish a communication connection with one or more data nodes at the same time, where the same data node may be connected with one or more service nodes at the same time, that is, the same data node may exist in the data nodes respectively connected with different service nodes, where the data nodes are used to provide a synchronization service of block data to the connected service nodes, and each service node may record a network state of each data node with which a communication connection is established, where the network state may specifically be one or two of network state parameters, such as a network delay time and a historical transmission speed. The first service node may be any service node in a service network of the blockchain network, the network state data may specifically include one or two of a first network state recorded by the first service node and a second network state recorded by a second service node of the blockchain network, and the second service node may specifically include one or more service nodes in the service network of the blockchain network except the first service node. Wherein the first network state comprises a network state parameter of each data node in the blockchain network that is connected to the first service node and the second network state comprises a network state parameter of each data node in the blockchain network that is connected to the second service node.
Specifically, for each data node establishing a connection, the first service node may first obtain network state data of the blockchain network, then determine, according to one or both of a first network state recorded by the first service node and a second network state recorded by the second service node included in the network state data, a network state parameter of each data node connected to the first service node, that is, the first service node may determine, by using the first network state recorded by itself, a network state parameter of each data node connected to the first service node, may also determine, by using the second network state recorded by the second service node, a network state parameter of each data node connected to the first service node, and may also determine, by integrating the first network state recorded by itself and the second network state recorded by the second service node, a network state parameter of each data node connected to the first service node.
The network state parameters can be used for counting the network condition of the data node from one or two dimensions of the network delay time and the historical transmission speed, and the network condition of the data node can be accurately evaluated by utilizing the dimensions of the network delay time, the historical transmission speed and the like, so that an accurate basis is provided for the selection of the data node.
In some possible embodiments, if the first service node determines the network state parameter of each data node connected to the first service node by using the first network state recorded by the first service node, since the first network state includes the network state parameter of each data node connected to the first service node in the blockchain network, the network state parameter of each data node connected to the first service node can be directly determined according to the first network state.
In some possible embodiments, if the first service node determines the network state parameter of each data node connected to the first service node by using the second network state recorded by the second service node, the first service node may first acquire each data node connected to the second service node, then find out the data node also connected to the first service node from the data node, which may be denoted as a commonly connected data node, for which the first service node may acquire the network state parameter of the commonly connected data node from the second network state recorded by the second service node, and for which the first service node may acquire the network state parameter of other data nodes than the commonly connected data node from the first network state recorded by itself. Of course, for the commonly connected data nodes, the first node may also comprehensively determine the network state parameter of the commonly connected data node according to the network state parameter of the commonly connected data node included in the first network state and the network state parameter of the commonly connected data node included in the second network state, for example, the network state parameter of the commonly connected data node included in the first network state and the network state parameter of the commonly connected data node included in the second network state may be averaged, and then the average value is used as the determined network state parameter of the commonly connected data node, and by comprehensively evaluating the network condition of the data node in combination with the network states recorded by other service nodes in the service network of the blockchain network, the occurrence of the situation that the network state evaluation is inaccurate due to the poor network condition between the single service node and the connected data node can be effectively avoided, and the accuracy of the network quality evaluation can be improved.
In some possible embodiments, the specific manner in which the first service node obtains the second network state recorded by the second service node included in the network state data may be:
the first service node sends a network state acquisition request to a second service node of the blockchain network, receives a response data packet sent by the second service node in response to the network state acquisition request, wherein the response data packet carries signature information of the second service node and a second network state recorded by the second service node; and the first service node acquires the second network state from the response data packet after the signature information is verified.
Specifically, the first service node may request the other service nodes (such as the second service node) in the blockchain network for the network state recorded by the other party, after the second service node receives the request, the second service node may send the second network state recorded by itself to the first service node, in order to ensure the reliability of the data, the second service node may send the signature information of itself (such as the digital signature generated by using the private key of itself) to the first service node at the same time, for example, send the second network state and the signature information as a response data packet to the first service node, after receiving the response data packet, the first service node may verify the signature information in the response data packet, for example, the first service node may obtain the public key of the second service node, verify the signature information by using the public key, and if the verification is passed, the first service node obtains the second network state from the response data packet, thereby obtaining the network state recorded by the other service nodes that are safe and reliable.
In some possible embodiments, each service node may write the network state recorded by itself into the blockchain, and record the storage position (such as the blockheight information) of the network state in the blockchain, for example, the first service node writes the first network state recorded by itself into the blockchain, the height of the block where the first service node is located is the first blockheight, the second service node writes the second network state recorded by itself into the blockchain, the height of the block where the second service node is located is the second blockheight, and when the first service node acquires the second network state recorded by the second service node, the first service node may first request to the second service node to acquire the storage position (such as the second blockheight) of the second network state in the blockchain, and the second service node returns the storage position (such as the second blockheight) of the second network state in the blockchain to the first service node.
In some possible embodiments, after each service node writes its own recorded network state into the blockchain, the height of the block in which the service node is located may be broadcasted in the service network, so that each service node may record the storage location of the network state of each other service node in the blockchain. For example, after the first service node writes the first network state recorded by itself into the blockchain, broadcasting the height of the block (such as the first block height) to other service nodes in the service network, where the other service nodes may record the first network state recorded by the first service node at a storage location (such as the first block height) in the blockchain; similarly, after the second service node writes the second network state recorded by itself into the blockchain, the height of the block where the second service node is located (e.g., the second block height) is broadcasted to other service nodes in the service network, and the other service nodes can record the storage position (e.g., the second block height) of the second network state recorded by the second service node in the blockchain. When the first service node needs to acquire the second network state recorded by the second service node, the first service node can query the second block height corresponding to the second network state according to the record, and then the first service node can acquire the second network state recorded by the second service node from the block chain according to the second block height, so that the efficiency of acquiring the network states of other service nodes is further improved, the efficiency of evaluating the network quality is further improved, and the efficiency of block synchronization is finally improved.
202. And determining a network quality score of each data node connected with the first service node according to the network state data.
Specifically, the first service node may quantitatively represent the network condition of the data node through a scoring mechanism, may set scoring rules for network state parameters, may set different scoring rules for network state parameters of different dimensions, for example, may set one scoring rule for network delay time, may set another scoring rule for historical transmission speed, may increase or decrease the weight of each scoring rule according to the emphasis point when scoring, may set a scoring mode with a higher score for the scoring rule of the network delay time if scoring is mainly performed according to the network delay time, and may set a scoring mode with a higher score for the scoring rule of the historical transmission speed if scoring is mainly performed according to the historical transmission speed. The first service node may calculate a network quality score for each data node using one or both of the network delay time and the historical transmission speed and the corresponding scoring rule, where the network quality score is used to indicate a network condition of the data node, such as a network resource utilization rate, a data transmission performance, and the like.
203. And determining a target data node with the network quality score meeting a preset condition from each data node connected with the first service node, wherein the target data node is used for providing block data to be synchronized.
Specifically, after the first service node obtains the network quality score of each connected data node, it may determine whether the network quality score of each data node meets a preset condition, where the preset condition may be that the network quality score is the smallest, or the network quality score is smaller than or equal to a preset score threshold, so as to find out a target data node in one or more connected data nodes, where the network quality score of the target data node meets the preset condition, and because the network quality score of the target data node meets the preset condition, it means that the network condition of the target data node is better, and the target data node has advantages of low network delay, fast transmission speed, and the like, that is, the data node with the best comprehensive performance of network delay and packet loss, and the target data node may be used to provide the block data to be synchronized to the first service node.
It should be noted that, when other scoring rules are adopted, the preset condition may be that the network quality score is the largest, or the network quality score is greater than or equal to a preset scoring threshold, which is not limited in the embodiment of the present application.
In some possible embodiments, after determining the target data node, the first service node may send a block data synchronization request to the target data node, where the block data synchronization request carries a target block height, the target block height indicates block data to be synchronized, after receiving the block data synchronization request, the target data node may query corresponding block data from the block chain according to the target block height, and send the block data corresponding to the target block height to the first service node, and the first service node receives the block data corresponding to the target block height sent by the target data node, thereby completing efficient synchronization of the block data, fully utilizing network resources of the target data node, and improving operation efficiency of the block chain network.
In this embodiment, the first service node of the blockchain network may acquire network state data of the blockchain network, where the network state data includes one or two of a first network state recorded by the first service node and a second network state recorded by a second service node of the blockchain network, where the first network state includes a network state parameter of each data node connected to the first service node in the blockchain network, and the second network state includes a network state parameter of each data node connected to the second service node in the blockchain network, where the first service node may determine a network quality score of each data node connected to the first service node according to the network state data, determine a target data node whose network quality score meets a preset condition from each data node connected to the first service node, and the target data node may be used to provide block data to be synchronized.
Referring to fig. 3, a flowchart of another data processing method based on a blockchain network provided by the data processing system shown in fig. 1a according to an embodiment of the present application is mainly described from a service node side in the blockchain network, and the data processing method includes the following steps:
301. and determining the network delay time of each data node according to the round-trip delay of the data packet of each data node connected with the first service node in the block chain network.
The first service node can evaluate the network condition of the data node through two dimensions of network delay time and historical transmission speed.
Specifically, when the first service node obtains the network delay Time of each data node in one or more connected data nodes, the data packet Round Trip delay of each data node may be obtained first, where the data packet Round Trip delay includes a current heartbeat packet Round Trip delay and a first packet Round Trip reference delay, where the current heartbeat packet Round Trip delay may be recorded as a heartbeat packet RTT (Round-Trip Time), a network delay of the first service node and the data node when the first service node interacts with the heartbeat packet may be recorded as a first packet RTT (Round-Trip Time), and a network delay of the first service node and the data node in a first block data synchronization process when the first service node and the data node perform block data synchronization in a latest period or a latest preset number of times may be recorded, and the network delay Time of each data node may be determined according to the current heartbeat packet Round Trip delay and the first packet Round Trip reference delay of each data node.
In some possible embodiments, the specific manner of the first service node obtaining the round trip delay of the data packet of each data node connected may include:
the first service node may periodically send a heartbeat packet to each connected data node, for example, once every 2 seconds, and determine the current round trip delay (i.e. the heartbeat packet RTT) of the heartbeat packet of each data node according to the sending time of the last heartbeat packet and the response time of each data node to the heartbeat packet; the first service node may obtain a first packet round trip history delay of each data node, for example, a network delay in a first block data synchronization process when performing block data synchronization in a last period of time or a last preset number of times, where the network delay may be a time difference from when the block data synchronization request is initiated to when the first block data is received, and determine a first packet round trip reference delay of each data node according to the first packet round trip history delay, for example, a result obtained by averaging the first packet round trip history delay recorded in the last 10 minutes or the first packet round trip history delay recorded in the last 30 times may be used as a currently used first packet round trip reference delay.
In some possible embodiments, the network delay Time of the data node may be denoted as a Smoothed Round Trip Time (SRTT), where the SRTT is calculated by combining the heartbeat packet RTT and the first packet RTT. The specific implementation manner of the first service node to determine the network delay time of each data node according to the heartbeat packet round trip current delay and the first packet round trip reference delay of each data node may include: acquiring a first weight corresponding to the current round trip time delay of a heartbeat packet and a second weight corresponding to the round trip reference time delay of a first packet; and determining the network delay time of each data node according to the current round trip delay of the heartbeat packet of each data node, the first weight, the round trip reference delay of the first packet of each data node and the second weight. The following formula can be used:
Wherein srtt= (α×heartbeat RTT) + (1- α) ×first packet RTT), where α may have a value range of [0,1], and the default value may be 0.5, or may be another value between 0 and 1, and α corresponds to the first weight and (1- α) corresponds to the second weight.
302. And determining the historical transmission speed of each data node according to the data transmission record between each data node and the data node.
Specifically, when the first service node obtains the historical transmission speed of each data node in the one or more connected data nodes, the first service node may obtain a data transmission record between the first service node and each data node, where the data transmission record includes a transmitted block data amount and a transmission time, and determine the historical transmission speed of each data node according to the transmitted block data amount and the transmission time, for example, a ratio between the transmitted block data amount and the transmission time may be used as the historical transmission speed.
In some possible embodiments, the first service node may obtain the block data amount and the transmission time of the transmission with each data node in the last period of time or the last preset number of times, calculate the transmission speed of each data transmission, and take the average transmission speed obtained by averaging the multiple transmission speeds as the historical transmission speed of each data node.
In some possible embodiments, before obtaining the network quality score of the data node and determining the target data node, it may be determined whether the service node has a requirement of a synchronization block. Specifically, after the consensus node of the core network packages the transaction into the block to perform consensus accounting, the data node of the data network may acquire the latest packaged block data from the core network and store the latest packaged block data, and then notify the connected service node that a new block is generated, specifically, may notify the first service node of the block height of the new block (denoted as the target block height), then the first service node may receive the target block height sent by the data node and determine whether the block data corresponding to the target block height is locally stored, that is, whether the synchronization of the block data corresponding to the target block height is already completed, if not, it is indicated that the synchronization of the block data corresponding to the target block height is not yet completed, and the first service node needs to acquire the network quality score of each data node and determine the target data node to perform the synchronization of the block data, that is, steps 303 to 308 are executed; if the block data corresponding to the target block height is already stored locally, it indicates that the latest block data has completed synchronization, and steps 303 to 308 may not be executed at this time, but only the network delay time and the historical transmission speed of each data node need to be recorded, and the data is used when the subsequent block data synchronization is needed.
303. And acquiring a first scoring rule corresponding to the network delay and a second scoring rule corresponding to the transmission speed.
304. And determining a network delay score according to the first scoring rule and the network delay time of each data node connected with the first service node.
305. And determining a transmission speed score according to the second scoring rule and the historical transmission speed of each data node.
Specifically, the first service node may quantitatively represent the network condition of each connected data node through a scoring mechanism, a scoring rule may be set for a network state parameter, different scoring rules may be set for network state parameters of different dimensions, for example, a network delay may correspond to the first scoring rule, and a transmission speed may correspond to the second scoring rule. After the first service node obtains the network delay time and the historical transmission speed of each data node, a network delay score can be determined according to the first scoring rule and the network delay time of each data node, and a transmission speed score can be determined according to the second scoring rule and the historical transmission speed of each data node, so that the network conditions of the data nodes are quantitatively represented in two dimensions of the network delay and the transmission speed respectively.
In some possible embodiments, the first scoring rule corresponding to the network delay may include a plurality of time intervals and a scoring algorithm corresponding to each time interval, and the specific implementation of determining the network delay score by the first service node may include: and acquiring a target time interval corresponding to the network delay time of each data node connected with the first service node in the first scoring rule, and determining the network delay score of each data node according to a scoring algorithm corresponding to the target time interval and the network delay time.
For example, the multiple time intervals included in the first scoring rule and the scoring algorithm corresponding to each time interval may be as shown in table 1, where the higher the network delay time SRTT, the larger the corresponding integral value is, which is specifically as follows:
Figure BDA0003327577880000131
/>
Figure BDA0003327577880000141
TABLE 1
Wherein the first scoring rule may specify the following:
according to the current network feedback, the network delay time SRTT of 80% is 0-40 ms, the network delay time SRTT of 10% is 40-100 ms, the network delay is low, meanwhile, the integral value design difference of the part is not large, and the scoring algorithms corresponding to the time intervals of 0-40 ms, 40 ms-70 ms and 70-100 ms are respectively constant 1 minute, 2 minutes and 3 minutes;
SRTT >100ms, which means that the network condition is worse, and the integral value design difference of this part is larger, for example, when 100ms < = SRTT <140ms, the corresponding scoring algorithms are respectively constant 6 points, and when 140ms < = SRTT, the corresponding scoring algorithms are respectively constant 9 points, that is, the larger the integral is, the higher the network delay is, the worse the network condition is.
In some possible embodiments, the second scoring rule corresponding to the transmission speed may include a plurality of speed ratio intervals and a scoring algorithm corresponding to each speed ratio interval, and the specific implementation manner of determining the transmission speed score by the first service node may include: acquiring a target speed ratio between the historical transmission speed of each data node and a target expected transmission speed; obtaining a target speed ratio interval corresponding to the target speed ratio in a second scoring rule; and determining the transmission speed score of each data node according to the scoring algorithm corresponding to the target speed ratio interval and the target speed ratio.
For the calculation of the transmission speed score, the following design concept may be adopted:
if the historical transmission speed is particularly poor, the scoring of the speed is improved, punishment is given, and the scheduling weight of the data node is reduced;
If the historical transmission speed is general, the score of the speed can default to 0 at the moment, and the scheduling of the data node mainly looks at the score of the network delay time SRTT;
if the historical transmission speed is particularly high, the speed score is reduced, rewards are given, and the scheduling weight of the data node is improved.
Meanwhile, the service node may introduce a target expected transmission speed target as a measurement standard, where the target expected transmission speed target may be, for example, 1Mps, so that a speed ratio may be calculated, where ratio= (historical transmission speed/target expected transmission speed target) ×100. Here, the historical transmission speed is classified into the following cases according to the result of the ratio:
(1) ratio < ratio1, i.e. the historical transmission speed is particularly poor, the scoring of the speed is improved, punishment is given, the scheduling weight of the data node is reduced, and the corresponding scoring algorithm is as follows: (100-ratio) Score1;
(2) ratio1< = ratio < = ratio2, i.e. the historical transmission speed is generally, the corresponding scoring algorithm is: ratio Score2;
(3) ratio > ratio2, namely the historical transmission speed is very fast, the grading of the speed is reduced at this time, the scheduling weight of the data nodes is improved, and the corresponding grading algorithm is as follows: -1 x ratio x score3;
Default values for the above parameters may be as follows: the target expected transmission speed target is 1mps, ratio1 is 75, ratio2 is 100, scen 1 is 5, scen 2 is 0, scen 3 is 2. For example, when the historical transmission speed of a certain data node is 1.5Mbps, the corresponding target speed ratio is (1.5 Mbps/1 Mps) ×100=150, and since 150 is greater than ratio2 (i.e. 100), the transmission speed score is-1×ratio×score 3= -1×150×2= -300 minutes; for another example, if the historical transmission speed of a certain data node is 800Kbps, the corresponding target speed ratio is (800 Kbps/1 Mps) ×100=80, and since 150 is greater than ratio1 (i.e. 75) and less than ratio2 (i.e. 100), the transmission speed Score is ratio×score 2=80×0=0 Score; for another example, if the historical transmission speed of a certain data node is 400Kbps, the corresponding target speed ratio is (400 Kbps/1 Mps) ×100=40, and since 40 is smaller than ratio1 (i.e. 75), the transmission speed Score is (100-ratio) ×score 1= (100-40) ×5=300 points; it can be seen that the faster the historical transmission speed, the lower the transmission speed score, and the slower the historical transmission speed, the higher the transmission speed score.
In some possible embodiments, the historical transmission speed of the data node is more general, for example, the corresponding speed ratio is between the first speed ratio (such as ratio 1) and the second speed ratio (such as ratio 2), the transmission speed score may be 0, where the network quality score of the data node is equal to the network delay score, that is, when the historical transmission speeds of the plurality of data nodes are all general, the data node may be selected for block data synchronization according to the network delay only, for example, the data node with the shortest network delay is preferentially selected.
In some possible embodiments, the opposite design may be used, i.e. the faster the historical transmission speed, the higher the transmission speed score, the slower the historical transmission speed, and the lower the transmission speed score; accordingly, the longer the network delay time SRTT, the lower the network delay score, the shorter the network delay time SRTT, and the higher the network delay score, the corresponding preset condition may be adjusted to have the maximum network quality score, or the network quality score is greater than or equal to the preset score threshold.
306. And determining a network quality score of each data node according to the network delay score and the transmission speed score.
Specifically, the first service node may obtain a third weight corresponding to the network delay and a fourth weight corresponding to the transmission speed, and determine a network quality score of each data node according to the network delay score of each data node, the third weight, the transmission speed score of each data node, and the fourth weight.
In some possible embodiments, the third weight and the fourth weight may be equal, and both are 0.5, and then the service node may average the network delay score and the transmission speed score, and the final network quality score= (network delay score+transmission speed score)/2.
In some possible embodiments, the fourth weight may be greater than the third weight, that is, the weight of the transmission speed score in the network quality score is increased, so that the influence of the historical transmission speed on the selection of the data node is increased to ensure the speed priority.
307. And determining a plurality of candidate data nodes with the network quality scores meeting preset conditions from each data node connected with the first service node.
308. And acquiring the service load state of each candidate data node in the plurality of candidate data nodes, and determining a target data node from the plurality of candidate data nodes according to the service load state.
Specifically, if the network quality scores of a plurality of data nodes in the data nodes connected with the first service node meet a preset condition, or the network quality scores of a plurality of data nodes are equal, the first service node can further determine the most suitable target data node by combining with the service load state of the data nodes. The service load status of the data node may include the number of connections of the data node that currently provides the synchronization service, the consumption of hardware resources of the data node, and the like, so that after the data node with better network conditions is screened out according to network performance, a relatively idle data node may be selected according to the current load situation of the data node, for example, a candidate data node with the smallest current service load among a plurality of candidate data nodes is used as a target data node, thereby further improving the synchronization efficiency of block data, improving the utilization rate of various resources of the block chain network, and also avoiding access overload of a single data node.
It can be understood that the service node establishes a scoring mechanism of network quality through two dimensions of the network delay time SRTT and the historical transmission speed, can accurately reflect the network condition of the blockchain, and can remove inaccurate packet loss rate through the historical transmission speed, so as to more accurately evaluate the transmission speed of the data node. In the speed representation and network delay, the block data transmission speed can be directly represented by the quality of the block chain data nodes, and the feedback is needed as soon as possible in the final network quality score, so that in the network delay integration and transmission speed integration calculation, the transmission speed integration weight is larger, the transmission speed integration weight belongs to the speed priority type, if the speed is high, the data nodes with high transmission speed are preferentially scheduled, and if the speed is normal, the data nodes with the minimum network delay are preferentially scheduled at the moment; if the speed and the network delay performance are poor, the priority scheduling network quality score is the smallest at the moment, so that network resources and the computing resources of the nodes are fully utilized, and the transaction processing speed and the block synchronization speed can be improved to a certain extent.
In the embodiment of the application, the first service node of the blockchain network can determine the network delay time of each data node according to the round trip delay of the data packet of each connected data node, determine the historical transmission speed of each data node according to the data transmission record between each data node, determine the network delay score by utilizing the first scoring rule corresponding to the network delay and the network delay time of each data node, determine the transmission speed score by utilizing the second scoring rule corresponding to the transmission speed and the historical transmission speed of each data node, and determine the network quality score of each data node according to the network delay score and the transmission speed score, so that the network condition of the data node in the blockchain can be accurately reflected by utilizing the two dimensions of the network delay and the transmission speed, and the inaccurate packet loss rate can be removed by utilizing the historical transmission speed, thereby more accurately evaluating the transmission speed of the data node; then, the first service node can determine a plurality of candidate data nodes with the network quality scores meeting the preset conditions from the connected data nodes, and then determine the target data node according to the service load state of each candidate data node.
Referring to fig. 4, a schematic structural diagram of a data processing apparatus according to an embodiment of the present application, where the data processing apparatus according to an embodiment of the present application may be applied to the service node described above, the apparatus includes:
an obtaining module 401, configured to obtain network state data of the blockchain network, where the network state data includes one or two of a first network state recorded by the first service node and a second network state recorded by a second service node of the blockchain network, the first network state includes a network state parameter of each data node connected to the first service node in the blockchain network, the second network state includes a network state parameter of each data node connected to the second service node in the blockchain network, and the network state parameter includes one or two of a network delay time and a historical transmission speed.
A determining module 402, configured to determine a network quality score of each data node connected to the first service node according to the network status data.
The determining module 402 is further configured to determine, from each data node connected to the first service node, a target data node, where the network quality score meets a preset condition, and the target data node is used to provide block data to be synchronized.
Optionally, the network status parameters include a network delay time and a historical transmission speed, and the obtaining module 401 is specifically configured to:
and determining the network delay time of each data node according to the round-trip delay of the data packet of each data node connected with the first service node in the blockchain network.
And determining the historical transmission speed of each data node according to the data transmission record between each data node and the data node.
Optionally, the obtaining module 401 is specifically further configured to:
a network state acquisition request is sent to a second service node of the blockchain network, the second service node including one or more service nodes in the blockchain network other than the first service node.
And receiving a response data packet sent by the second service node in response to the network state acquisition request, wherein the response data packet carries signature information of the second service node and a second network state recorded by the second service node.
And after the signature information passes the verification, acquiring the second network state from the response data packet.
Optionally, the obtaining module 401 is specifically further configured to:
And sending a block height acquisition request to a second service node of the block chain network.
And receiving block height information sent by the second service node in response to the block height acquisition request, wherein the block height information is used for indicating a storage position of the second network state in a block chain.
And acquiring the second network state from the blockchain by using the blockheight information.
Optionally, the obtaining module 401 is specifically configured to:
and acquiring the data packet round trip delay of each data node connected with the first service node in the blockchain network, wherein the data packet round trip delay comprises the current round trip delay of a heartbeat packet and the round trip reference delay of a first packet.
And determining the network delay time of each data node according to the current round trip delay of the heartbeat packet of each data node and the round trip reference delay of the first packet.
Optionally, the obtaining module 401 is specifically configured to:
and sending a heartbeat packet to each data node connected with the first service node in the blockchain network.
And determining the current round trip delay of the heartbeat packet of each data node according to the sending time of the heartbeat packet and the response time of each data node for the heartbeat packet.
And acquiring the first packet round trip history time delay of each data node, and determining the first packet round trip reference time delay of each data node according to the first packet round trip history time delay.
Optionally, the obtaining module 401 is specifically configured to:
and acquiring a first weight corresponding to the current round trip time delay of the heartbeat packet and a second weight corresponding to the round trip reference time delay of the first packet.
And determining the network delay time of each data node according to the current round trip delay of the heartbeat packet of each data node, the first weight, the first packet round trip reference delay of each data node and the second weight.
Optionally, the obtaining module 401 is specifically configured to:
and acquiring a data transmission record between each data node, wherein the data transmission record comprises the transmitted block data quantity and the transmission time.
And determining the historical transmission speed of each data node according to the transmitted block data quantity and the transmission time.
Optionally, the determining module 402 is specifically configured to:
and acquiring a first scoring rule corresponding to the network delay and a second scoring rule corresponding to the transmission speed.
And determining a network delay score according to the first scoring rule and the network delay time of each data node connected with the first service node.
And determining a transmission speed score according to the second scoring rule and the historical transmission speed of each data node.
And determining a network quality score of each data node according to the network delay score and the transmission speed score.
Optionally, the determining module 402 is specifically configured to:
and acquiring a third weight corresponding to the network delay and a fourth weight corresponding to the transmission speed.
And determining the network quality score of each data node according to the network delay score of each data node, the third weight, the transmission speed score of each data node and the fourth weight.
Optionally, the first scoring rule includes a plurality of time intervals and a scoring algorithm corresponding to each time interval, and the determining module 402 is specifically configured to:
and acquiring a target time interval corresponding to the network delay time of each data node connected with the first service node in the first scoring rule.
And determining the network delay score of each data node according to the scoring algorithm corresponding to the target time interval and the network delay time.
Optionally, the second scoring rule includes a plurality of speed ratio intervals and a scoring algorithm corresponding to each speed ratio interval, and the determining module 402 is specifically configured to:
And obtaining a target speed ratio between the historical transmission speed of each data node and a target expected transmission speed.
And acquiring a target speed ratio interval corresponding to the target speed ratio in the second scoring rule.
And determining the transmission speed score of each data node according to a scoring algorithm corresponding to the target speed ratio interval and the target speed ratio.
Optionally, the determining module 402 is specifically configured to:
and determining a plurality of candidate data nodes with the network quality scores meeting preset conditions from each data node connected with the first service node.
And acquiring the service load state of each candidate data node in the plurality of candidate data nodes.
And determining a target data node from the plurality of candidate data nodes according to the service load state.
Optionally, the apparatus further comprises a receiving module 403, wherein:
the receiving module 403 is configured to receive a target block height sent by any data node connected to the first service node.
The determining module 402 is further configured to determine whether block data corresponding to the target block height is stored; and if not, determining the network quality score of each data node connected with the first service node according to the network state data.
Optionally, the apparatus further includes a sending module 404, where:
the sending module 404 is configured to send a block data synchronization request to the target data node, where the block data synchronization request carries a target block height.
The receiving module 403 is further configured to receive block data corresponding to the target block height, where the block data is sent by the target data node in response to the block data synchronization request.
It should be noted that, the functions of each functional module of the data processing apparatus in the embodiments of the present application may be specifically implemented according to the method in the embodiments of the method, and the specific implementation process may refer to the related description of the embodiments of the method, which is not repeated herein.
Referring to fig. 5, a schematic structural diagram of a computer device according to an embodiment of the present application includes a power supply module and other structures, and includes a processor 501, a storage device 502, and a network interface 503. Data may be interacted between the processor 501, the storage 502, and the network interface 503.
The storage 502 may include volatile memory (RAM), such as random-access memory (RAM); the storage 502 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a Solid State Drive (SSD), etc.; the storage 502 may also include a combination of the types of memory described above.
The processor 501 may be a central processing unit (central processing unit, CPU). In one embodiment, the processor 501 may also be a graphics processor (Graphics Processing Unit, GPU). The processor 501 may also be a combination of a CPU and a GPU. In one embodiment, the storage 502 is configured to store program instructions, and the processor 501 may call the program instructions to perform the following operations:
network state data of the blockchain network is obtained, the network state data comprises one or two of a first network state recorded by the first service node and a second network state recorded by a second service node of the blockchain network, the first network state comprises a network state parameter of each data node connected with the first service node in the blockchain network, the second network state comprises a network state parameter of each data node connected with the second service node in the blockchain network, and the network state parameter comprises one or two of network delay time and historical transmission speed.
And determining a network quality score of each data node connected with the first service node according to the network state data.
And determining a target data node with the network quality score meeting a preset condition from each data node connected with the first service node, wherein the target data node is used for providing block data to be synchronized.
Optionally, the network status parameters include a network delay time and a historical transmission speed, and the processor 501 is specifically configured to:
and determining the network delay time of each data node according to the round-trip delay of the data packet of each data node connected with the first service node in the blockchain network.
And determining the historical transmission speed of each data node according to the data transmission record between each data node and the data node.
Optionally, the processor 501 is specifically further configured to:
invoking the network interface 503 to send a network state acquisition request to a second service node of the blockchain network, the second service node including one or more service nodes in the blockchain network other than the first service node.
And calling the network interface 503 to receive a response data packet sent by the second service node in response to the network state acquisition request, where the response data packet carries signature information of the second service node and a second network state recorded by the second service node.
And after the signature information passes the verification, acquiring the second network state from the response data packet.
Optionally, the processor 501 is specifically further configured to:
the network interface 503 is invoked to send a block height acquisition request to a second service node of the blockchain network.
Invoking the network interface 503 to receive the block height information sent by the second service node in response to the block height acquisition request, where the block height information is used to indicate a storage location of the second network state in a blockchain.
And acquiring the second network state from the blockchain by using the blockheight information.
Optionally, the processor 501 is specifically configured to:
and acquiring the data packet round trip delay of each data node connected with the first service node in the blockchain network, wherein the data packet round trip delay comprises the current round trip delay of a heartbeat packet and the round trip reference delay of a first packet.
And determining the network delay time of each data node according to the current round trip delay of the heartbeat packet of each data node and the round trip reference delay of the first packet.
Optionally, the processor 501 is specifically configured to:
the network interface 503 is invoked to send heartbeat packets to each data node in the blockchain network that is connected to the first service node.
And determining the current round trip delay of the heartbeat packet of each data node according to the sending time of the heartbeat packet and the response time of each data node for the heartbeat packet.
And acquiring the first packet round trip history time delay of each data node, and determining the first packet round trip reference time delay of each data node according to the first packet round trip history time delay.
Optionally, the processor 501 is specifically configured to:
and acquiring a first weight corresponding to the current round trip time delay of the heartbeat packet and a second weight corresponding to the round trip reference time delay of the first packet.
And determining the network delay time of each data node according to the current round trip delay of the heartbeat packet of each data node, the first weight, the first packet round trip reference delay of each data node and the second weight.
Optionally, the processor 501 is specifically configured to:
and acquiring a data transmission record between each data node, wherein the data transmission record comprises the transmitted block data quantity and the transmission time.
And determining the historical transmission speed of each data node according to the transmitted block data quantity and the transmission time.
Optionally, the processor 501 is specifically configured to:
And acquiring a first scoring rule corresponding to the network delay and a second scoring rule corresponding to the transmission speed.
And determining a network delay score according to the first scoring rule and the network delay time of each data node connected with the first service node.
And determining a transmission speed score according to the second scoring rule and the historical transmission speed of each data node.
And determining a network quality score of each data node according to the network delay score and the transmission speed score.
Optionally, the processor 501 is specifically configured to:
and acquiring a third weight corresponding to the network delay and a fourth weight corresponding to the transmission speed.
And determining the network quality score of each data node according to the network delay score of each data node, the third weight, the transmission speed score of each data node and the fourth weight.
Optionally, the first scoring rule includes a plurality of time intervals and a scoring algorithm corresponding to each time interval, and the processor 501 is specifically configured to:
and acquiring a target time interval corresponding to the network delay time of each data node connected with the first service node in the first scoring rule.
And determining the network delay score of each data node according to the scoring algorithm corresponding to the target time interval and the network delay time.
Optionally, the second scoring rule includes a plurality of speed ratio intervals and a scoring algorithm corresponding to each speed ratio interval, and the processor 501 is specifically configured to:
and obtaining a target speed ratio between the historical transmission speed of each data node and a target expected transmission speed.
And acquiring a target speed ratio interval corresponding to the target speed ratio in the second scoring rule.
And determining the transmission speed score of each data node according to a scoring algorithm corresponding to the target speed ratio interval and the target speed ratio.
Optionally, the processor 501 is specifically configured to:
and determining a plurality of candidate data nodes with the network quality scores meeting preset conditions from each data node connected with the first service node.
And acquiring the service load state of each candidate data node in the plurality of candidate data nodes.
And determining a target data node from the plurality of candidate data nodes according to the service load state.
Optionally, the processor 501 is further configured to:
And calling the network interface 503 to receive the target block height sent by any data node connected with the first service node.
Determining whether block data corresponding to the target block height is stored; and if not, determining the network quality score of each data node connected with the first service node according to the network state data.
Optionally, the processor 501 is further configured to:
the network interface 503 is invoked to send a block data synchronization request to the target data node, where the block data synchronization request carries a target block height.
The network interface 503 is invoked to receive the block data corresponding to the target block height, which is sent by the target data node in response to the block data synchronization request.
In specific implementation, the processor 501, the storage device 502 and the network interface 503 described in the embodiments of the present application may perform the implementation described in the related embodiments of the method provided in fig. 2 to 3 of the embodiments of the present application, and may also perform the implementation described in the related embodiments of the apparatus provided in fig. 4 of the embodiments of the present application, which are not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments. The technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc., and may be a processor in the computer device in particular) to execute all or part of the steps of the above-described method of the embodiments of the present application. Wherein the aforementioned storage medium may comprise: a U-disk, a removable hard disk, a magnetic disk, an optical disk, a Read-Only Memory (abbreviated as ROM), a random access Memory (abbreviated as Random Access Memory, RAM), or the like.
The above embodiments are merely for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (19)

1. A data processing method based on a blockchain network, characterized by being applied to a first service node of the blockchain network, the method comprising:
acquiring network state data of the blockchain network, wherein the network state data comprises one or two of a first network state recorded by the first service node and a second network state recorded by a second service node of the blockchain network, the first network state comprises a network state parameter of each data node connected with the first service node in the blockchain network, the second network state comprises a network state parameter of each data node connected with the second service node in the blockchain network, and the network state parameter comprises one or two of network delay time and historical transmission speed;
Determining a network quality score for each data node connected to the first service node based on the network status data;
and determining a target data node with the network quality score meeting a preset condition from each data node connected with the first service node, wherein the target data node is used for providing block data to be synchronized.
2. The method of claim 1, wherein the network state parameters include a network delay time and a historical transmission speed, and wherein the obtaining network state data for the blockchain network comprises:
determining the network delay time of each data node according to the round-trip delay of the data packet of each data node connected with the first service node in the blockchain network;
and determining the historical transmission speed of each data node according to the data transmission record between each data node and the data node.
3. The method of claim 2, wherein the obtaining network state data of the blockchain network further comprises:
transmitting a network state acquisition request to a second service node of the blockchain network, the second service node including one or more service nodes in the blockchain network other than the first service node;
Receiving a response data packet sent by the second service node in response to the network state acquisition request, wherein the response data packet carries signature information of the second service node and a second network state recorded by the second service node;
and after the signature information passes the verification, acquiring the second network state from the response data packet.
4. The method of claim 2, wherein the second network state recorded by the second service node is stored in a blockchain, and wherein the obtaining network state data of the blockchain network further comprises:
sending a block height acquisition request to a second service node of the block chain network;
receiving block height information sent by the second service node in response to the block height acquisition request, wherein the block height information is used for indicating a storage position of the second network state in a block chain;
and acquiring the second network state from the blockchain by using the blockheight information.
5. The method of claim 2, wherein said determining the network delay time of each data node in the blockchain network according to the packet round trip delay of said each data node connected to the first service node comprises:
Acquiring the round-trip delay of a data packet of each data node connected with the first service node in the blockchain network, wherein the round-trip delay of the data packet comprises the current round-trip delay of a heartbeat packet and the round-trip reference delay of a first packet;
and determining the network delay time of each data node according to the current round trip delay of the heartbeat packet of each data node and the round trip reference delay of the first packet.
6. The method of claim 4, wherein said obtaining a packet round trip delay for each data node in said blockchain network connected to said first service node comprises:
sending a heartbeat packet to each data node connected with the first service node in the blockchain network;
determining the current round trip delay of the heartbeat packet of each data node according to the sending time of the heartbeat packet and the response time of each data node for the heartbeat packet;
and acquiring the first packet round trip history time delay of each data node, and determining the first packet round trip reference time delay of each data node according to the first packet round trip history time delay.
7. The method according to claim 5 or 6, wherein said determining the network delay time of each data node based on the current round trip delay of the heartbeat packet and the reference round trip delay of the first packet for each data node comprises:
Acquiring a first weight corresponding to the current round trip time delay of the heartbeat packet and a second weight corresponding to the round trip reference time delay of the first packet;
and determining the network delay time of each data node according to the current round trip delay of the heartbeat packet of each data node, the first weight, the first packet round trip reference delay of each data node and the second weight.
8. The method of claim 2, wherein said determining a historical transmission speed for each of said data nodes based on a data transmission record with said each data node comprises:
acquiring a data transmission record between each data node, wherein the data transmission record comprises the transmitted block data quantity and transmission time;
and determining the historical transmission speed of each data node according to the transmitted block data quantity and the transmission time.
9. The method according to any of claims 1-7, wherein said determining a network quality score for each data node connected to said first service node based on said network status data comprises:
acquiring a first scoring rule corresponding to network delay and a second scoring rule corresponding to transmission speed;
Determining a network delay score according to the first scoring rule and the network delay time of each data node connected with the first service node;
determining a transmission speed score according to the second scoring rule and the historical transmission speed of each data node;
and determining a network quality score of each data node according to the network delay score and the transmission speed score.
10. The method of claim 9, wherein said determining a network quality score for each of said data nodes based on said network delay score and said transmission speed score comprises:
acquiring a third weight corresponding to network delay and a fourth weight corresponding to transmission speed;
and determining the network quality score of each data node according to the network delay score of each data node, the third weight, the transmission speed score of each data node and the fourth weight.
11. The method of claim 9, wherein the first scoring rule comprises a plurality of time intervals and a scoring algorithm corresponding to each time interval, wherein determining a network delay score based on the first scoring rule and the network delay time of each data node connected to the first traffic node comprises:
Acquiring a target time interval corresponding to the network delay time of each data node connected with the first service node in the first scoring rule;
and determining the network delay score of each data node according to the scoring algorithm corresponding to the target time interval and the network delay time.
12. The method of claim 9, wherein the second scoring rule includes a plurality of speed ratio intervals and a scoring algorithm corresponding to each speed ratio interval, and wherein determining the transmission speed score based on the second scoring rule and the historical transmission speed of each data node comprises:
acquiring a target speed ratio between the historical transmission speed of each data node and a target expected transmission speed;
acquiring a target speed ratio interval corresponding to the target speed ratio in the second scoring rule;
and determining the transmission speed score of each data node according to a scoring algorithm corresponding to the target speed ratio interval and the target speed ratio.
13. The method according to any of claims 1-7, wherein said determining a target data node from said each data node connected to said first service node for which said network quality score meets a preset condition comprises:
Determining a plurality of candidate data nodes with the network quality scores meeting preset conditions from each data node connected with the first service node;
acquiring the service load state of each candidate data node in the plurality of candidate data nodes;
and determining a target data node from the plurality of candidate data nodes according to the service load state.
14. The method of claim 1, wherein prior to said determining a network quality score for each data node connected to said first service node based on said network status data, said method further comprises:
receiving the height of a target block sent by any data node connected with the first service node;
determining whether block data corresponding to the target block height is stored;
and if not, executing the step of determining the network quality score of each data node connected with the first service node according to the network state data.
15. The method according to claim 1 or 14, wherein after said determining, from each data node connected to said first service node, a target data node for which said network quality score meets a preset condition, the method further comprises:
Sending a block data synchronization request to the target data node, wherein the block data synchronization request carries a target block height;
and receiving the block data which is sent by the target data node in response to the block data synchronization request and corresponds to the target block height.
16. A data processing apparatus, the apparatus comprising:
an acquisition module configured to acquire network state data of a blockchain network, where the network state data includes one or two of a first network state recorded by a first service node of the blockchain network and a second network state recorded by a second service node of the blockchain network, the first network state includes a network state parameter of each data node connected to the first service node in the blockchain network, the second network state includes a network state parameter of each data node connected to the second service node in the blockchain network, and the network state parameter includes one or two of a network delay time and a historical transmission speed;
a determining module, configured to determine a network quality score of each data node connected to the first service node according to the network status data;
The determining module is further configured to determine, from each data node connected to the first service node, a target data node whose network quality score meets a preset condition, where the target data node is used to provide block data to be synchronized.
17. A computer device, characterized in that it comprises a processor, a network interface and storage means, said processor, said network interface and said storage means being interconnected, wherein said network interface is controlled by said processor for transceiving data, said storage means being arranged for storing a computer program comprising program instructions, said processor being arranged for invoking said program instructions for performing the data processing method according to any of claims 1-15.
18. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions for execution by a processor for performing the data processing method of any one of claims 1 to 15.
19. A computer program product comprising a computer program, characterized in that the computer program, when executed by a computer processor, implements the data processing method of any of claims 1-15.
CN202111269353.8A 2021-10-29 2021-10-29 Data processing method and device based on blockchain network and related equipment Pending CN116074330A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111269353.8A CN116074330A (en) 2021-10-29 2021-10-29 Data processing method and device based on blockchain network and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111269353.8A CN116074330A (en) 2021-10-29 2021-10-29 Data processing method and device based on blockchain network and related equipment

Publications (1)

Publication Number Publication Date
CN116074330A true CN116074330A (en) 2023-05-05

Family

ID=86175379

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111269353.8A Pending CN116074330A (en) 2021-10-29 2021-10-29 Data processing method and device based on blockchain network and related equipment

Country Status (1)

Country Link
CN (1) CN116074330A (en)

Similar Documents

Publication Publication Date Title
TWI433502B (en) Analyzing and generating network traffic using an improved markov modulated poisson process model with one bursty state and a plurality of idle states
US20230273912A1 (en) Data processing method and apparatus for blockchain network, computer device, and computer-readable storage medium
CN110417650A (en) Multilink data distribution method, device and electronic equipment
US20170048161A1 (en) Adaptive data synchronization
US10848366B2 (en) Network function management method, management unit, and system
US9331925B2 (en) Multiple test site bandwidth limit measurement
CN114357495B (en) Prediction machine under-chain aggregation method, device, equipment and medium based on block chain
WO2013097151A1 (en) Resource scheduling method and device
CN114390578A (en) Network performance testing method and device, electronic equipment and medium
CN111200821B (en) Capacity planning method and device
CN115189908B (en) Random attack survivability evaluation method based on network digital twin
CN115189910B (en) Intentional attack survivability evaluation method based on network digital twin
CN114866790B (en) Live stream scheduling method and device
CN112653635A (en) Congestion control algorithm improvement method, device, equipment and storage medium
CN116320011A (en) Request processing method and device
CN113328906B (en) Flow real-time monitoring method and device, storage medium and electronic equipment
CN116074330A (en) Data processing method and device based on blockchain network and related equipment
WO2022127386A1 (en) State transition method, network device and storage medium
TWI766387B (en) Reverse proxy method and storage device with delay sensing and load balancing
CN116074331A (en) Block data synchronization method and related product
CN113747506A (en) Resource scheduling method, device and network system
US20140237136A1 (en) Communication system, communication controller, communication control method, and medium
CN111245874A (en) Information pushing method and device, server and storage medium
CN112492005B (en) Migration method, device and system of edge equipment
CN115118769B (en) Method and device for configuring parameters of service system and executing micro-service

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: 40088375

Country of ref document: HK