Blockchain network data synchronization method and electronic device
By dynamically adjusting the shard size of the blockchain network, the problems of node overload and bandwidth saturation are solved, and the efficiency and stability of block synchronization are improved.
Patent Information
- Application Number
- CN202411662857.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The transmission of transaction data between blockchain nodes can easily lead to excessive load, node downtime, and bandwidth saturation, resulting in large-scale transmission failures. In addition, existing sharding technology cannot dynamically adjust the shard size to adapt to network and load changes.
By obtaining information about the block synchronization data that has been transmitted, the shard size is calculated and updated, and the shard size is adjusted according to the shard synchronization delay to adapt to the dynamic changes in the node network and load.
It improves the efficiency of block synchronization, avoids node overload and bandwidth saturation, and ensures the stability and efficiency of data transmission.
Smart Images

Figure CN119520544B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a data synchronization method and electronic device for a blockchain network. Background Art
[0002] Because transaction data is often transmitted between blockchain nodes via broadcast, such as directly broadcasting transaction data or forwarding transaction data broadcast by other blockchain nodes, allowing nodes to forward or broadcast transaction data can easily lead to excessive load on blockchain nodes, causing node downtime or even partial unavailability. The bandwidth of the inter-node transmission channel can be fully utilized, resulting in widespread transaction data transmission failures.
[0003] In related technologies, sharding is used for data transmission and synchronization. However, the shard size is fixed. Once the sharding rule is determined, nodes synchronize block data using the same shard size, making it impossible to dynamically adjust the shard size based on network and load fluctuations. Summary of the Invention
[0004] The main purpose of the embodiments of the present application is to propose a data synchronization method and electronic device for a blockchain network, which aims to calculate and update the shard size based on the block transmission information corresponding to the block synchronization data that has been transmitted. At the same time, the shard size is dynamically adjusted according to the shard synchronization delay, so that the shard size can adapt to the dynamic changes of the node network and load, thereby improving the block synchronization efficiency.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application proposes a data synchronization method for a blockchain network, the method comprising:
[0006] Obtain and record the block transmission information corresponding to the block synchronization data that has been transmitted by the current data sending node, and calculate and update the fragment size corresponding to the current data transmission based on the block transmission information, wherein the block transmission information includes the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate, and the average transmission delay;
[0007] Slice the block synchronization data to be transmitted according to the slicing size to obtain a plurality of slicing data, wherein the slicing sizes of the slicing data are the same;
[0008] Transmit the fragmented data to the data receiving node in sequence, and obtain and record the transmission delay corresponding to the fragmented data that has been transmitted;
[0009] During the shard transmission process, the shard size of the shard data to be transmitted is adjusted according to the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission, until all shard data of the block synchronization data to be transmitted are completely transmitted.
[0010] In one embodiment of the present application, calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information includes:
[0011] When the number of block synchronization data that has been transmitted by the current data sending node is 0, the set value is used as the shard size corresponding to the current data transmission;
[0012] When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 1 but less than or equal to 3, the shard size corresponding to the current data transmission is calculated and updated based on the shard size corresponding to the last data transmission, the average transmission delay corresponding to the last transmitted block synchronization data, and the average of the average transmission delays corresponding to all the transmitted block synchronization data.
[0013] In one embodiment of the present application, calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information includes:
[0014] When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4, the influence coefficient corresponding to the current data transmission is calculated based on the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the fragment size corresponding to the latest 4 block synchronization data. The influence coefficient includes a first influence coefficient affected by the load of the data receiving node, a second influence coefficient affected by the downlink network bandwidth, a third influence coefficient affected by the transmission rate, and a fourth influence coefficient affected by the transmission delay;
[0015] The fragment size corresponding to the current data transmission is calculated and updated based on the block transmission information corresponding to the block synchronization data that was transmitted last time and the influence coefficient.
[0016] In one embodiment of the present application, calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information includes:
[0017] When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4 and less than or equal to 5, the influence coefficient corresponding to the current data transmission is calculated based on the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the fragment size corresponding to the latest 4 block synchronization data. The influence coefficient includes a first influence coefficient affected by the load of the data receiving node, a second influence coefficient affected by the downlink network bandwidth, a third influence coefficient affected by the transmission rate, and a fourth influence coefficient affected by the transmission delay;
[0018] Calculate and update the shard size corresponding to the current data transmission based on the block transmission information corresponding to the block synchronization data completed last time and the influence coefficient;
[0019] When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 6, the influence coefficient corresponding to the current data transmission is updated based on the influence coefficient used in the latest two calculations of the shard size and the block transmission information corresponding to the latest four block synchronization data that have been transmitted;
[0020] The fragment size corresponding to the current data transmission is calculated and updated according to the block transmission information corresponding to the block synchronization data transmitted last time and the updated influence coefficient.
[0021] In one embodiment of the present application, the influence coefficient corresponding to the current data transmission is updated based on the influence coefficients used in the latest two calculations of the shard size and the block transmission information corresponding to the latest four block synchronization data that have been transmitted, including:
[0022] The first influence coefficient corresponding to the current data transmission is updated based on the first influence coefficient used in the latest two calculations of the shard size and the average load of the data receiving nodes corresponding to the latest four block synchronization data that have been transmitted.
[0023] The second impact coefficient corresponding to the current data transmission is updated based on the second impact coefficient used in the latest two calculations of the shard size and the average downlink network bandwidth corresponding to the latest four block synchronization data that have been transmitted.
[0024] The third influence coefficient corresponding to the current data transmission is updated based on the third influence coefficient used in the latest two calculations of the shard size and the average transmission rate corresponding to the latest four block synchronization data that have been transmitted.
[0025] The fourth impact coefficient corresponding to the current data transmission is updated based on the fourth impact coefficient used in the latest two calculations of the shard size and the average transmission delay corresponding to the latest four block synchronization data that have been transmitted.
[0026] In one embodiment of the present application, adjusting the fragment size of the fragment data to be transmitted currently according to the transmission delay corresponding to the previous fragment data and the average transmission delay corresponding to the block synchronization data of the last completed transmission includes:
[0027] Compare the absolute value of the delay difference between the transmission delay corresponding to the last shard data and the average transmission delay corresponding to the last completed block synchronization data to see if it is greater than the delay threshold;
[0028] If the absolute value of the delay difference is greater than the delay threshold, calculating a first ratio of the average transmission delay corresponding to the block synchronization data transmitted last time divided by the transmission delay corresponding to the previous fragment data;
[0029] Adjusting the fragment size of the fragment data to be transmitted based on the first ratio;
[0030] If the absolute value of the delay difference is less than or equal to the delay threshold, the fragment size of the fragment data to be transmitted is not adjusted.
[0031] In one embodiment of the present application, before adjusting the fragment size of the fragment data to be transmitted based on the transmission delay corresponding to the previous fragment data and the average transmission delay corresponding to the block synchronization data of the last completed transmission, the method includes:
[0032] When the number of block synchronization data that has been transmitted by the current data sending node is less than 4, the delay threshold is calculated and updated according to the average transmission delay corresponding to all block synchronization data that has been transmitted by the current data sending node;
[0033] When the number of block synchronization data that the current data sending node has completed transmitting is greater than or equal to 4, obtain the average transmission delay corresponding to the latest 4 block synchronization data that the current data sending node has completed transmitting;
[0034] The delay threshold is calculated and updated according to the average transmission delays corresponding to the latest four block synchronization data that have been transmitted by the current data sending node.
[0035] To achieve the above objectives, a second aspect of an embodiment of the present application proposes a data synchronization method for a blockchain network, the method comprising:
[0036] Receive each shard data sent by the data sending node, and return the transmission delay corresponding to each shard data one by one in the order of receipt, wherein the shard size of the shard data is calculated and updated by the data sending node based on the block transmission information corresponding to the block synchronization data that has been transmitted, and the shard size of the shard data is also adjusted based on the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data that has been transmitted;
[0037] After receiving all the shard data of the block synchronization data, assemble each of the shard data to obtain the block synchronization data, and return the block transmission information corresponding to the block synchronization data. The block transmission information includes the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate and the average transmission delay.
[0038] In one embodiment of the present application, after receiving each fragment data sent by the data sending node, the method further includes:
[0039] Record the transmission rate, transmission delay, load of the data receiving node and downlink network bandwidth corresponding to each shard data transmission, so that after receiving all the shard data of the block synchronization data, calculate the average transmission rate, average transmission delay, average load of the data receiving node and average downlink network bandwidth corresponding to the block synchronization data based on the transmission rate, transmission delay, load of the data receiving node and downlink network bandwidth corresponding to each shard data transmission.
[0040] To achieve the above-mentioned purpose, the third aspect of the embodiments of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and the processor implements the method described in any embodiment of the present application when executing the computer program.
[0041] In the technical solution provided in one embodiment of the present application, the data sending node can calculate and update the shard size corresponding to the current data transmission based on the block transmission information corresponding to the block synchronization data that has been transmitted, so that the block synchronization data to be transmitted can be sharded according to the shard size to obtain multiple shard data with the same shard size. That is, the shard size in each data transmission process can be dynamically updated according to the block transmission information corresponding to the block synchronization data that has been transmitted. Then, each shard data is transmitted to the data receiving node in sequence, and during the shard transmission process, the shard size of the shard data to be transmitted is adjusted according to the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data that was transmitted last time, so that the shard size of each shard data can adapt to the dynamic changes of the node network and load, thereby improving the block synchronization efficiency of the entire blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a flowchart of a data synchronization method for a blockchain network performed by a data sending node according to an embodiment of the present application;
[0043] Figure 2 This is a flowchart of the first step of calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information provided by an embodiment of the present application;
[0044] Figure 3 This is a flowchart of the second step of calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information provided by an embodiment of the present application;
[0045] Figure 4 This is a flowchart of the third step of calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information provided by an embodiment of the present application;
[0046] Figure 5 This is a flowchart of the steps for updating the influence coefficient corresponding to the current data transmission based on the influence coefficient used in the latest two calculations of the shard size and the block transmission information corresponding to the latest four block synchronization data that have been transmitted, provided by an embodiment of the present application;
[0047] Figure 6 This is a flowchart of the steps for adjusting the fragment size of the fragment data to be transmitted based on the transmission delay corresponding to the previous fragment data and the average transmission delay corresponding to the block synchronization data of the last completed transmission, provided by an embodiment of the present application;
[0048] Figure 7 This is a flowchart of the steps for updating the delay threshold provided in an embodiment of the present application;
[0049] Figure 8 This is a flowchart of a data synchronization method for a blockchain network performed by a data receiving node according to an embodiment of the present application;
[0050] Figure 9 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0052] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0054] Explanation of terms:
[0055] Block Synchronization: Block Synchronization refers to the transmission and update of block data between different nodes in the blockchain network so that all nodes maintain a consistent blockchain state.
[0056] Message broadcasting: Blockchain message broadcasting refers to the process of transmitting messages or data to other nodes in a blockchain network. When a node generates a new transaction, block, or other important event, it broadcasts the message to other nodes in the network so that they can be informed and act accordingly.
[0057] Fragmented transmission: Fragmented transmission is a technology that breaks data into smaller segments for transmission. When transferring large amounts of data, fragmenting the data into smaller segments can improve transmission efficiency. If an error occurs during transmission, only the affected segments need to be retransmitted, rather than the entire data. This is suitable for situations with low network bandwidth, long transmission distances, and large file sizes.
[0058] Transmission delay: refers to the time from when data is sent to when the receiver completely receives the data.
[0059] Blockchain is a novel application model for computer technologies, including distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. In a blockchain system, data blocks are linked sequentially in chronological order to form a chain-like data structure, cryptographically guaranteeing an unalterable and unforgeable distributed ledger. Due to its decentralized, tamper-proof, and autonomous nature, blockchain is gaining increasing attention and application.
[0060] In related technologies, sharding is used for data transmission and synchronization. However, the shard size is fixed. Once the sharding rule is determined, nodes synchronize block data using the same shard size, making it impossible to dynamically adjust the shard size based on network and load fluctuations.
[0061] Based on this, an embodiment of the present application proposes a data synchronization method for a blockchain network, which calculates and updates the shard size based on the block transmission information corresponding to the block synchronization data that has been transmitted. At the same time, the shard size is dynamically adjusted according to the shard synchronization delay, so that the shard size can adapt to the dynamic changes of the node network and load, thereby improving the block synchronization efficiency.
[0062] Reference Figure 1 , Figure 1 This is a flowchart of a data synchronization method for a blockchain network performed by a data sending node provided by an embodiment of the present application, including but not limited to steps S110 to S150.
[0063] Step S110, obtain and record the block transmission information corresponding to the block synchronization data that has been transmitted by the current data sending node, and calculate and update the fragment size corresponding to the current data transmission based on the block transmission information, wherein the block transmission information includes the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate and the average transmission delay.
[0064] In an embodiment of the present application, a data sending node receives and records block transmission information corresponding to completed block synchronization data, so that during the current data transmission, the data sending node can calculate and update the corresponding fragment size of the current data transmission based on the block transmission information corresponding to the completed block synchronization data. The block transmission information includes the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate, and the average transmission delay.
[0065] Specifically, after completing the proof-of-work calculation, the data-sending node needs to broadcast the calculation results to other nodes. For example, the data-sending node needs to send the calculation results, namely the new block synchronization data, to the data-receiving node. The data-sending node first constructs the block synchronization data and then calculates and updates the shard size corresponding to the current data transmission based on the average load of the data-receiving node corresponding to the transmitted block synchronization data, the average downlink network bandwidth, the average transmission rate, and the average transmission delay.
[0066] Reference Figure 2 , Figure 2 This is a flowchart of the first step of calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information provided by an embodiment of the present application, including but not limited to steps S210 to S220.
[0067] In step S210 , when the number of block synchronization data that has been transmitted by the current data sending node is 0, the set value is used as the fragment size corresponding to the current data transmission.
[0068] In step S220, when the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 1 but less than or equal to 3, the shard size corresponding to the current data transmission is calculated and updated based on the shard size corresponding to the last data transmission, the average transmission delay corresponding to the last transmitted block synchronization data, and the average of the average transmission delays corresponding to all the transmitted block synchronization data.
[0069] In an embodiment of the present application, for the case where the data sending node sends block synchronization data for the first time, that is, when the number of block synchronization data that the data sending node has completed transmitting is 0, a pre-set set value can be used as the shard size corresponding to the current data transmission. The set value can be a pre-set fixed value. The set value can also be the block size of the block synchronization data to be transmitted. When the set value is the block size of the block synchronization data to be transmitted, it indicates that the first transmission of the block synchronization data will not be processed by sharding. When the number of block synchronization data that the current data sending node has completed transmitting is greater than or equal to 1 but less than or equal to 3, the shard size corresponding to the current data transmission is calculated and updated based on the shard size corresponding to the last data transmission, the average transmission delay corresponding to the block synchronization data that was completed last transmission, and the average value of the average transmission delay corresponding to all the block synchronization data that have been transmitted. That is, when the number of block synchronization data that the data sending node has completed transmitting is less than or equal to 3, the shard size corresponding to each data transmission can be calculated and updated by the following formula 1, which is as follows:
[0070]
[0071] In formula 1, Tss i Indicates the fragment size corresponding to the current data transmission, Tss0 indicates the set value, Tss i-1 Indicates the size of the fragment corresponding to the last data transmission, Dt i-1 Indicates the average transmission delay corresponding to the block synchronization data of the last completed transmission, Dt avg It represents the average value of the average transmission delay corresponding to all the block synchronization data that have been transmitted. N represents the number of block synchronization data that have been transmitted by the data sending node. α is the smoothing factor, which can be 0.8.
[0072] According to formula 1, when the number of block synchronization data that the data sending node has completed transmitting is 0, the shard size corresponding to the current data transmission is the set value Tss0. When the number of block synchronization data that the data sending node has completed transmitting is greater than or equal to 1 but less than or equal to 3, the shard size corresponding to the current data transmission is Specifically, when the number of block synchronization data that the data sending node has completed transmitting is equal to 0, that is, when the data sending node transmits block synchronization data for the first time, its corresponding fragment size Tss1 = Tss0. When the number of block synchronization data that the data sending node has completed transmitting is equal to 1, that is, when the data sending node transmits block synchronization data for the second time, its corresponding fragment size Among them, Tss1 represents the fragment size corresponding to the first transmission of block synchronization data, Dt1 represents the average transmission delay corresponding to the block synchronization data transmitted by the data sending node for the first time, and Dt avg Indicates the average value of the average transmission delay corresponding to all the block synchronization data that have been transmitted, that is, the average transmission delay corresponding to the block synchronization data that has been transmitted for the first time. When the number of block synchronization data that the data sending node has transmitted is equal to 2, that is, when the data sending node transmits block synchronization data for the third time, the corresponding fragment size Among them, Tss2 represents the fragment size corresponding to the second transmission block synchronization data, Dt2 represents the average transmission delay corresponding to the block synchronization data completed by the data sending node for the second transmission, and Dt avg Indicates the average value of the average transmission delay corresponding to all the block synchronization data that have been transmitted, that is, the average value of the average transmission delay corresponding to the block synchronization data that has been transmitted for the first time and the average transmission delay corresponding to the block synchronization data that has been transmitted for the second time. When the number of block synchronization data that the data sending node has transmitted is equal to 3, that is, when the data sending node transmits block synchronization data for the fourth time, the corresponding fragment size Among them, Tss3 represents the fragment size corresponding to the third transmission block synchronization data, Dt3 represents the average transmission delay corresponding to the block synchronization data completed by the data sending node for the third transmission, and Dt avg Indicates the average value of the average transmission delays corresponding to all the block synchronization data that have been transmitted, that is, the average value of the average transmission delay corresponding to the block synchronization data that has been transmitted for the first time, the average transmission delay corresponding to the block synchronization data that has been transmitted for the second time, and the average transmission delay corresponding to the block synchronization data that has been transmitted for the third time.
[0073] Reference Figure 3 , Figure 3 This is a flowchart of the second step of calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information provided by an embodiment of the present application, including but not limited to steps S310 to S320.
[0074] In step S310, when the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4, the influence coefficient corresponding to the current data transmission is calculated based on the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the fragment size corresponding to the latest 4 block synchronization data. The influence coefficient includes a first influence coefficient affected by the load of the data receiving node, a second influence coefficient affected by the downlink network bandwidth, a third influence coefficient affected by the transmission rate, and a fourth influence coefficient affected by the transmission delay.
[0075] Step S320 , calculating and updating the slice size corresponding to the current data transmission based on the block transmission information and the influence coefficient corresponding to the block synchronization data transmitted last time.
[0076] In an embodiment of the present application, when the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4, at this time, the influence coefficient corresponding to the current data transmission can be calculated based on the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the fragment size corresponding to the latest 4 block synchronization data, and then the fragment size corresponding to the current data transmission is calculated and updated based on the block transmission information and influence coefficient corresponding to the block synchronization data that was transmitted last time. Among them, the influence coefficient includes a first influence coefficient affected by the load of the data receiving node, a second influence coefficient affected by the downlink network bandwidth, a third influence coefficient affected by the transmission rate, and a fourth influence coefficient affected by the transmission delay. Specifically, when the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4, the first influence coefficient affected by the load of the data receiving node, the second influence coefficient affected by the downlink network bandwidth, the third influence coefficient affected by the transmission rate, and the fourth influence coefficient affected by the transmission delay can be calculated by the following formula 2. Formula 2 is as follows:
[0077]
[0078] In formula 2, i represents the number of data transmissions, Tss i-1 Indicates the size of the shard corresponding to the i-1th block synchronization data that has been transmitted, L i-1 represents the load of the data receiving node corresponding to the i-1th block synchronization data that has been transmitted, a represents the first influence coefficient affected by the load of the data receiving node, B i-1 represents the average downlink network bandwidth corresponding to the i-1th block synchronization data that has been transmitted, b represents the second impact coefficient affected by the downlink network bandwidth, V i-1 represents the average transmission rate corresponding to the i-1th block synchronization data that has been transmitted, c represents the third influence coefficient affected by the transmission rate, Dt i-1represents the average transmission delay corresponding to the i-1th block synchronization data that has been transmitted, and d represents the fourth impact coefficient affected by the transmission delay.
[0079] Using Equation 2, we can calculate the first impact coefficient a affected by the load of the data receiving node, the second impact coefficient b affected by the downlink network bandwidth, the third impact coefficient c affected by the transmission rate, and the fourth impact coefficient d affected by the transmission delay. This allows us to further calculate and update the shard size corresponding to the current data transmission based on the block transmission information and impact coefficients corresponding to the last completed block synchronization data transmission. Specifically, the shard size corresponding to the current data transmission can be calculated using Equation 3, which is as follows:
[0080] Tss i =a i *L i-1 +b i *B i-1 +c i *V i-1 +d i *Dt i-1 (Formula 3);
[0081] In formula 3, Tss i Indicates the fragment size corresponding to the current data transmission, a i Indicates the first impact coefficient of the load of the data receiving node corresponding to the current data transmission, L i-1 Indicates the load of the data receiving node corresponding to the block synchronization data completed in the last transmission, b i Indicates the second impact coefficient of the current data transmission affected by the downlink network bandwidth, B i-1 Indicates the average downlink network bandwidth corresponding to the last completed block synchronization data, c i Indicates the third influence coefficient of the current data transmission affected by the transmission rate, V i-1 Indicates the average transmission rate of the block synchronization data completed in the last transmission, d i Indicates the fourth impact coefficient of the current data transmission affected by the transmission delay, Dt i-1 The average transmission delay corresponding to the block synchronization data that was transmitted last time.
[0082] For example, when the number of block synchronization data that the data sending node has completed transmitting equals 4, meaning that four block synchronization data transmissions have been completed, the fifth block synchronization data transmission is to be performed. The fragment sizes corresponding to the first four block synchronization data transmissions can be calculated based on the above formula 1. The average load of the data receiving node, the average downlink network bandwidth, the average transmission rate, and the average transmission delay corresponding to the first four block synchronization data transmissions can be recorded by the data sending node each time the block synchronization data transmission is completed. Thus, based on the fragment sizes and block transmission information corresponding to the four completed block synchronization data transmissions, the first influence coefficient a affected by the load of the data receiving node, the second influence coefficient b affected by the downlink network bandwidth, the third influence coefficient c affected by the transmission rate, and the fourth influence coefficient d affected by the transmission delay corresponding to the current data transmission can be calculated using the above formula 2. Then, based on the block transmission information corresponding to the last (i.e., fourth) completed block synchronization data transmission and the four influence coefficients, the fragment size corresponding to the current data transmission (i.e., the fifth transmission of block synchronization data) can be calculated and updated using the above formula 3. The shard size corresponding to the fifth data transmission can be expressed as Tss5 = a5*L4 + b5*B4 + c5*V4 + d5*Dt4. Similarly, when the number of block synchronization data that the data sending node has completed transmitting is equal to 5, that is, 5 block synchronization data transmissions have been completed, the sixth block synchronization data transmission is to be performed. The latest 4 completed block synchronization data transmissions include the block synchronization data of the 5th transmission, the block synchronization data of the 4th transmission, the block synchronization data of the 3rd transmission, and the block synchronization data of the 2nd transmission. The shard size corresponding to the block synchronization data of the 5th transmission is Tss5, which can be calculated according to the above formula 3. The shard size corresponding to the block synchronization data of the 4th transmission is Tss4, which can be calculated according to the above formula 1. The shard size corresponding to the block synchronization data of the 3rd transmission is Tss3, which can be calculated according to the above formula 1. The fragment size corresponding to the block synchronization data transmitted for the second time is Tss2, which can be calculated according to the above formula 1. Therefore, based on the fragment sizes and block transmission information corresponding to the latest four block synchronization data that have been transmitted, the first impact coefficient a affected by the load of the data receiving node, the second impact coefficient b affected by the downlink network bandwidth, the third impact coefficient c affected by the transmission rate, and the fourth impact coefficient d affected by the transmission delay corresponding to the current data transmission can be calculated by the above formula 2. Based on the block transmission information and the four impact coefficients corresponding to the block synchronization data transmitted for the last time (that is, the fifth time), the fragment size corresponding to the current data transmission (that is, the sixth transmission of block synchronization data) can be calculated and updated by the above formula 3. Among them, the fragment size corresponding to the sixth data transmission can be expressed as Tss6 = a6*L5+b6*B5+c6*V5+d6*Dt5.
[0083] In some embodiments, reference Figure 4 , Figure 4 This is a flowchart of the third step of calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information provided by an embodiment of the present application, including but not limited to steps S410 to S440.
[0084] Step S410: When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4 and less than or equal to 5, the influence coefficient corresponding to the current data transmission is calculated based on the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the fragment size corresponding to the latest 4 block synchronization data. The influence coefficient includes a first influence coefficient affected by the load of the data receiving node, a second influence coefficient affected by the downlink network bandwidth, a third influence coefficient affected by the transmission rate, and a fourth influence coefficient affected by the transmission delay.
[0085] Step S420: Calculate and update the shard size corresponding to the current data transmission based on the block transmission information and influence coefficient corresponding to the block synchronization data that was transmitted last time;
[0086] Step S430: When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 6, the influence coefficient corresponding to the current data transmission is updated based on the influence coefficient used in the latest two calculations of the shard size and the block transmission information corresponding to the latest four transmitted block synchronization data;
[0087] Step S440 , calculating and updating the fragment size corresponding to the current data transmission based on the block transmission information corresponding to the block synchronization data transmitted last time and the updated influence coefficient.
[0088] In an embodiment of the present application, when the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4 and less than or equal to 5, the influence coefficient corresponding to the current data transmission can be calculated based on the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the fragment size corresponding to the latest 4 block synchronization data. That is, according to the above formula 2, the first influence coefficient a affected by the load of the data receiving node, the second influence coefficient b affected by the downlink network bandwidth, the third influence coefficient c affected by the transmission rate, and the fourth influence coefficient d affected by the transmission delay corresponding to the current data transmission can be calculated and updated. That is, according to the above formula 3, the fragment size corresponding to the current data transmission can be calculated and updated based on the block transmission information and influence coefficient corresponding to the block synchronization data that was transmitted last. When the number of block synchronization data that the current data sending node has completed transmitting is greater than or equal to 6, the fragmentation rule shown in the above formula 3 already exists, so the fragmentation rule can continue to be used. To ensure the accuracy of the fragmentation, the influence coefficient corresponding to the current data transmission needs to be updated, that is, the first influence coefficient a affected by the load of the data receiving node, the second influence coefficient b affected by the downlink network bandwidth, the third influence coefficient c affected by the transmission rate, and the fourth influence coefficient d affected by the transmission delay corresponding to the current data transmission need to be updated to update the fragment size corresponding to the current data transmission, so that the updated fragment size can be adaptively adjusted with changes in the load of the data receiving node, the downlink network bandwidth, the transmission rate, and the transmission delay. Specifically, updating the influence coefficient corresponding to the current data transmission includes updating the influence coefficient based on the influence coefficient used in the latest two calculations of the fragment size and the block transmission information corresponding to the latest four block synchronization data that have been transmitted. After the influence coefficient corresponding to the current data transmission is updated, the updated influence coefficient and the block transmission information corresponding to the block synchronization data completed in the last transmission can be used to calculate and update the fragment size corresponding to the current data transmission through the above formula 3.
[0089] In some embodiments, reference Figure 5 , Figure 5This is a flowchart of the steps provided by an embodiment of the present application for updating the influence coefficient corresponding to the current data transmission based on the influence coefficient used in the latest two calculations of the shard size and the block transmission information corresponding to the latest four block synchronization data that have been transmitted, including but not limited to steps S510 to S540.
[0090] Step S510: Update the first influence coefficient corresponding to the current data transmission based on the first influence coefficient used in the two most recent calculations of the shard size and the average load of the data receiving node corresponding to the four most recent block synchronization data that have been transmitted.
[0091] Step S520: Update the second influence coefficient corresponding to the current data transmission based on the second influence coefficient used in the two latest calculations of the fragment size and the average downlink network bandwidth corresponding to the four latest block synchronization data that have been transmitted.
[0092] Step S530 , updating the third influence coefficient corresponding to the current data transmission based on the third influence coefficient used in the two most recent calculations of the shard size and the average transmission rates corresponding to the four most recent block synchronization data that have been transmitted;
[0093] Step S540 : updating and obtaining the fourth influence coefficient corresponding to the current data transmission based on the fourth influence coefficient used in the two latest calculations of the fragment size and the average transmission delays corresponding to the four latest block synchronization data that have been transmitted.
[0094] In the embodiment of the present application, the influence coefficient corresponding to the current data transmission can be updated based on the influence coefficient used in the latest two calculations of the fragment size and the block transmission information corresponding to the latest four block synchronization data that have been transmitted. Specifically, the first influence coefficient affected by the load of the data receiving node, the second influence coefficient affected by the downlink network bandwidth, the third influence coefficient affected by the transmission rate, and the fourth influence coefficient affected by the transmission delay corresponding to the current data transmission can be updated using the following formula 4. Formula 4 is as follows:
[0095]
[0096] In formula 4, i represents the number of data transmissions, a i represents the first impact coefficient of the load of the data receiving node corresponding to the i-th transmission block synchronization data, b i represents the second impact coefficient of the i-th transmission block synchronization data affected by the downlink network bandwidth, c i The third influence coefficient of the transmission rate corresponding to the i-th transmission block synchronization data, d i L represents the fourth impact coefficient affected by the transmission delay corresponding to the i-th transmission block synchronization data, i-1represents the average load of the data receiving node corresponding to the i-1th transmission block synchronization data, B i-1 V represents the average downlink network bandwidth corresponding to the i-1th transmission block synchronization data, i-1 Denotes the average transmission rate corresponding to the i-1th transmission block synchronization data, Dt i-1 Indicates the average transmission delay corresponding to the i-1th transmission of block synchronization data.
[0097] According to Equation 4, the influence coefficients for the current data transmission are updated based on the influence coefficients used in the two most recent shard size calculations and the block transmission information corresponding to the four most recent block synchronization data transmissions. For example, when transmitting block synchronization data for the seventh time, the influence coefficients used in the two most recent shard size calculations are a6, b6, c6, and d6 used in the sixth shard size calculation, and a5, b5, c5, and d5 used in the fifth shard size calculation. The block transmission information corresponding to the latest four completed block synchronization data includes the average load L6, average downlink network bandwidth B6, average transmission rate V6, and average transmission delay Dt6 of the data receiving node corresponding to the sixth transmitted block synchronization data; the average load L5, average downlink network bandwidth B5, average transmission rate V5, and average transmission delay Dt5 of the data receiving node corresponding to the fifth transmitted block synchronization data; the average load L4, average downlink network bandwidth B4, average transmission rate V4, and average transmission delay Dt4 of the data receiving node corresponding to the fourth transmitted block synchronization data; and the average load L3, average downlink network bandwidth B3, average transmission rate V3, and average transmission delay Dt3 of the data receiving node corresponding to the third transmitted block synchronization data. Substituting these data into the above formula 4 yields:
[0098]
[0099] Thus, the first influence coefficient a7 affected by the load of the data receiving node, the second influence coefficient b7 affected by the downlink network bandwidth, the third influence coefficient c7 affected by the transmission rate, and the fourth influence coefficient d7 affected by the transmission delay, corresponding to the seventh transmission block synchronization data, can be calculated. Then, based on the block transmission information corresponding to the sixth transmission block synchronization data, the fragment size corresponding to the current data transmission (i.e., the seventh transmission block synchronization data) can be calculated and updated using Equation 3 above. The fragment size corresponding to the seventh data transmission can be expressed as Tss7 = a7*L6 + b7*B6 + c7*V6 + d7*Dt6.
[0100] Step S120 , fragmenting the block synchronization data to be transmitted according to the fragment size to obtain a plurality of fragment data, wherein the fragment sizes of the fragment data are the same.
[0101] In an embodiment of the present application, after the data sending node calculates and updates the shard size corresponding to the current data transmission based on the block transmission information corresponding to the block synchronization data that has been transmitted, the data sending node can shard the block synchronization data to be transmitted according to the shard size to obtain multiple shard data with the same shard size.
[0102] Step S130: Transmit the fragmented data to the data receiving node in sequence, and obtain and record the transmission delay corresponding to the fragmented data that has been transmitted.
[0103] In an embodiment of the present application, after the block synchronization data to be transmitted is fragmented according to the fragment size to obtain multiple fragments of the same size, the fragments can be transmitted to the data receiving node in sequence. After receiving each fragment, the data receiving node will record the transmission rate, transmission delay, load of the data receiving node, and downlink network bandwidth corresponding to the fragment, and return the transmission delay corresponding to the fragment to the data sending node. After the data receiving node receives all the fragments corresponding to the block synchronization data, it will assemble the fragments to obtain the block synchronization data and return the block transmission information corresponding to the block synchronization data, that is, the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate, and the average transmission delay corresponding to the block synchronization data. Thus, the data sending node can obtain the transmission delay corresponding to the fragmented data that has been transmitted and the average load, the average downlink network bandwidth, the average transmission rate, and the average transmission delay of the data receiving node corresponding to the block synchronization data that has been transmitted.
[0104] It should be noted that after receiving the sharded data, the data receiving node will verify the sharded data. If the verification is successful, it will record the transmission delay, transmission rate, data receiving node load, and downlink network bandwidth data corresponding to this sharded transmission (i.e., corresponding to the sharded data), and return the transmission delay corresponding to this sharded transmission to the data sending node. After receiving all the sharded data, the data receiving node will assemble the individual sharded data into block synchronization data and verify the legitimacy of the block. After verifying the legitimacy of the block, it will return the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate, and the average transmission delay corresponding to the block synchronization data transmitted this time.
[0105] Step S140, during the shard transmission process, the shard size of the shard data to be transmitted is adjusted according to the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission, until all the shard data of the block synchronization data to be transmitted are completely transmitted.
[0106] In the embodiment of the present application, taking into account that the load of the data receiving node and the downlink network bandwidth may change in real time, in order to allow the shard size corresponding to the shard data to adapt to the dynamic changes of the node network and load and improve the efficiency of block synchronization, during the shard transmission process, the data sending node also adjusts the shard size of the shard data to be transmitted based on the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission. For example, after the block synchronization data is divided into 5 shard data according to the shard size, these 5 shard data will be sent to the data receiving node in sequence. After receiving the first shard data, the data receiving node will return the transmission delay corresponding to the first shard data. After the data sending node obtains the transmission delay corresponding to the first shard data, it can compare the transmission delay with the average transmission delay corresponding to the block synchronization data completed in the last transmission. If the difference between the two is significant, it indicates a change in the load on the data receiving node or the downlink network bandwidth. Therefore, the size of the next shard (i.e., the second shard) needs to be adjusted based on the transmission latency of the first shard and the average transmission latency of the previously transmitted block synchronization data. This process continues until all five shards have been transmitted.
[0107] It should be noted that when transmitting the first shard data, since there is no transmission delay corresponding to the previous shard data as a reference, the shard size of the first shard data is not adjusted. That is, after the block synchronization data is sharded according to the shard size to obtain multiple shard data with the same shard size, the shard size of the first shard data remains unchanged and is sent to the data receiving node. Starting from the second shard data, the shard size of the shard data to be transmitted must be adjusted according to the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission, until all shard data of the block synchronization data to be transmitted are fully transmitted.
[0108] Reference Figure 6 , Figure 6 This is a flowchart of the steps provided by an embodiment of the present application for adjusting the fragment size of the fragment data to be transmitted currently based on the transmission delay corresponding to the previous fragment data and the average transmission delay corresponding to the block synchronization data completed in the last transmission, including but not limited to steps S610 to S640.
[0109] Step S610: compare the absolute value of the delay difference between the transmission delay corresponding to the last slice data and the average transmission delay corresponding to the last transmitted block synchronization data to determine whether it is greater than a delay threshold;
[0110] Step S620: If the absolute value of the delay difference is greater than the delay threshold, a first ratio of the average transmission delay corresponding to the last transmitted block synchronization data divided by the transmission delay corresponding to the last fragment data is calculated;
[0111] Step S630: adjusting the fragment size of the fragment data to be transmitted based on the first ratio;
[0112] Step S640: If the absolute value of the delay difference is less than or equal to the delay threshold, the fragment size of the fragment data to be transmitted is not adjusted.
[0113] In an embodiment of the present application, during the shard transmission process, the data sending node will compare the transmission delay corresponding to the previous shard data with the average transmission delay corresponding to the block synchronization data of the previous transmission. If the absolute value of the delay difference between the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data of the previous transmission is greater than the delay threshold, it means that the difference between the two is large, and the load or downlink network bandwidth of the data receiving node has changed. At this time, it is necessary to adjust the shard size of the shard data to be transmitted according to the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data of the previous transmission. Specifically, first calculate the first ratio of the average transmission delay corresponding to the block synchronization data of the previous transmission to the transmission delay corresponding to the previous shard data, and then adjust the shard size of the shard data to be transmitted based on the first ratio. Specifically, the shard size of the shard data to be transmitted can be adjusted by Formula 5, which is as follows:
[0114]
[0115] In formula 5, Indicates the updated fragment size of the kth fragment data to be transmitted. Indicates the size of the kth fragment data to be transmitted before the update, Dt i-1 Indicates the average transmission delay corresponding to the last completed block synchronization data. Indicates the transmission delay corresponding to the k-1th fragment data.
[0116] In an embodiment of the present application, if the absolute value of the delay difference between the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission is less than or equal to the delay threshold, it means that the difference between the two is small, and the load of the data receiving node or the downlink network bandwidth has not changed. At this time, there is no need to adjust the shard size of the shard data to be transmitted.
[0117] It should be noted that the delay threshold may be a preset fixed value, and the delay threshold may also be dynamically updated based on the average transmission delay corresponding to the block synchronization data that has been transmitted.
[0118] Reference Figure 7 , Figure 7 This is a flowchart of the steps for updating the delay threshold provided in an embodiment of the present application, including but not limited to steps S710 to S730.
[0119] Step S710: When the number of block synchronization data that has been transmitted by the current data sending node is less than 4, the delay threshold is calculated and updated according to the average transmission delay corresponding to all block synchronization data that has been transmitted by the current data sending node;
[0120] Step S720: When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4, obtain the average transmission delay corresponding to the latest 4 block synchronization data that have been transmitted by the current data sending node;
[0121] Step S730 , calculating and updating the delay threshold according to the average transmission delays corresponding to the latest four block synchronization data transmitted by the current data sending node.
[0122] In an embodiment of the present application, before adjusting the fragment size of the fragment data to be transmitted based on the transmission delay corresponding to the previous fragment data and the average transmission delay corresponding to the block synchronization data that was transmitted last time, the data sending node may also update the delay threshold based on the average transmission delay corresponding to the block synchronization data that has been transmitted. Specifically, when the number of block synchronization data that the current data sending node has transmitted is less than 4, the delay threshold is calculated and updated based on the average transmission delay corresponding to all block synchronization data that the current data sending node has transmitted. Specifically, the average value of the average transmission delay corresponding to all block synchronization data that the current data sending node has transmitted can be calculated and then multiplied by the delay threshold parameter to obtain the delay threshold. It should be noted that since the data sending node does not have any completed block synchronization data when it sends block synchronization data for the first time (i.e., the first time), that is, there is no block synchronization data that has been transmitted last time, there is no need to adjust the fragment data after the first fragmentation, that is, there is no need to calculate the delay threshold corresponding to the first fragment transmission. When the data sending node sends the block synchronization data for the second time, there is block synchronization data that has been transmitted, so the delay threshold corresponding to the second shard transmission can be calculated, where the delay threshold corresponding to the second shard transmission is Wherein, δ represents the delay threshold parameter, and Dt1 represents the average transmission delay corresponding to the block synchronization data that has been transmitted, that is, the average transmission delay corresponding to the block synchronization data transmitted for the first time. When the data sending node sends the block synchronization data for the third time, there is block synchronization data that has been transmitted (including the block synchronization data that has been transmitted for the first time and the second time), so the delay threshold corresponding to the third shard transmission can be calculated, where the delay threshold corresponding to the third shard transmission is Wherein, δ represents the delay threshold parameter, Dt1 represents the average transmission delay corresponding to the first transmission of block synchronization data, and Dt2 represents the average transmission delay corresponding to the second transmission of block synchronization data. When the data sending node sends block synchronization data for the fourth time, there is block synchronization data that has been transmitted (including block synchronization data that has been transmitted for the first time, the second time, and the third time), so the delay threshold corresponding to the fourth shard transmission can be calculated, where the delay threshold corresponding to the fourth shard transmission is Among them, δ represents the delay threshold parameter, Dt1 represents the average transmission delay corresponding to the first transmission of block synchronization data, Dt2 represents the average transmission delay corresponding to the second transmission of block synchronization data, and Dt3 represents the average transmission delay corresponding to the third transmission of block synchronization data. When the number of block synchronization data that the current data sending node has completed transmitting is greater than or equal to 4, the average transmission delays corresponding to the latest 4 block synchronization data that the current data sending node has completed transmitting are obtained, and the delay threshold is calculated and updated based on the average transmission delays corresponding to the latest 4 block synchronization data that the current data sending node has completed transmitting. Specifically, the average value of the average transmission delays corresponding to the latest 4 block synchronization data that the current data sending node has completed transmitting can be calculated and then multiplied by the delay threshold parameter to obtain the delay threshold. That is, when the number of block synchronization data that the current data sending node has completed transmitting is greater than or equal to 4, the delay threshold can be calculated and updated by Formula 6, which is as follows:
[0123]
[0124] In formula 6, represents the delay threshold corresponding to the i-th data transmission, δ represents the delay threshold parameter, Dt i-1 Dt represents the average transmission delay corresponding to the block synchronization data completed for the i-1th transmission. i-2 The average transmission delay of the block synchronization data completed for the i-2th transmission, Dt i-3 The average transmission delay corresponding to the block synchronization data completed for the i-3th transmission, Dt i-4 Indicates the average transmission delay corresponding to the block synchronization data transmitted for the i-4th time.
[0125] Reference Figure 8 , Figure 8 This is a flowchart of a data synchronization method for a blockchain network performed by a data receiving node provided by an embodiment of the present application, including but not limited to steps S810 to S820.
[0126] Step S810: Receive each shard data sent by the data sending node, and return the transmission delay corresponding to each shard data one by one in the order of receipt. The shard size of the shard data is calculated and updated by the data sending node based on the block transmission information corresponding to the block synchronization data that has been transmitted. The shard size of the shard data is also adjusted based on the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data that has been transmitted.
[0127] Step S820: After receiving all the shard data of the block synchronization data, assemble the shard data to obtain the block synchronization data, and return the block transmission information corresponding to the block synchronization data. The block transmission information includes the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate, and the average transmission delay.
[0128] In an embodiment of the present application, after the data sending module calculates and updates the fragment size corresponding to the current data transmission based on the block transmission information corresponding to the block synchronization data that has been transmitted, it can fragment the block synchronization data to be transmitted according to the fragment size to obtain multiple fragment data of the same fragment size, and send them to the data receiving node in sequence. The data receiving node can receive each fragment data sent by the data sending node, and after receiving all the fragment data of the block synchronization data, assemble each fragment data to obtain the block synchronization data, and return the block transmission information corresponding to the block synchronization data. The block transmission information includes the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate, and the average transmission delay. This enables the data sending module to calculate and update the fragment size corresponding to the current data transmission based on the block transmission information corresponding to the block synchronization data that has been transmitted. At the same time, after receiving each shard data sent by the data sending node, the data receiving node will return the transmission delay corresponding to each shard data one by one in the order of receipt, so that the data sending node can adjust the shard size of the shard data to be transmitted based on the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission, so that the shard size can adapt to the dynamic changes of the node network and load, thereby improving the efficiency of block synchronization. After receiving each shard data sent by the data sending node, the data receiving node will also record the transmission rate, transmission delay, load of the data receiving node, and downlink network bandwidth corresponding to each shard data transmission. After receiving all the shard data of the block synchronization data, based on the transmission rate, transmission delay, load of the data receiving node, and downlink network bandwidth corresponding to each shard data transmission, the data receiving node can calculate the average transmission rate, average transmission delay, average load of the data receiving node, and average downlink network bandwidth corresponding to the block synchronization data. Therefore, after receiving all the shard data of the block synchronization data, the data receiving node can return the average transmission rate, average transmission delay, average load of the data receiving node and average downlink network bandwidth (that is, block transmission information) corresponding to the block synchronization data to the data sending node.
[0129] The present application also provides an electronic device comprising a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned blockchain network data synchronization method. The electronic device can be any smart terminal, including a tablet computer and an in-vehicle computer.
[0130] See also Figure 9 , Figure 9 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application. The electronic device includes:
[0131] The processor 901 can be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0132] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the data synchronization method of the blockchain network in the embodiments of this application;
[0133] Input / output interface 903, used to implement information input and output;
[0134] Communication interface 904, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0135] Bus 905 , which transmits information between various components of the device (e.g., processor 901 , memory 902 , input / output interface 903 , and communication interface 904 );
[0136] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0137] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in one embodiment of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in one embodiment of this application are also applicable to similar technical problems.
[0138] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0139] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0140] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0141] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0142] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0143] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0144] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0145] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0146] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store programs.
[0147] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the present invention should be within the scope of the present invention.
Claims
1. A data synchronization method for a blockchain network, characterized in that: The method comprises: Obtain and record the block transmission information corresponding to the block synchronization data that has been transmitted by the current data sending node, and calculate and update the fragment size corresponding to the current data transmission based on the block transmission information, wherein the block transmission information includes the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate, and the average transmission delay; Slice the block synchronization data to be transmitted according to the slicing size to obtain a plurality of slicing data, wherein the slicing sizes of the slicing data are the same; Transmit the fragmented data to the data receiving node in sequence, and obtain and record the transmission delay corresponding to the fragmented data that has been transmitted; During the shard transmission process, the shard size of the shard data to be transmitted is adjusted according to the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission, until all shard data of the block synchronization data to be transmitted are completely transmitted.
2. The method according to claim 1, characterized in that Calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information includes: When the number of block synchronization data that has been transmitted by the current data sending node is 0, the set value is used as the shard size corresponding to the current data transmission; When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 1 but less than or equal to 3, the shard size corresponding to the current data transmission is calculated and updated based on the shard size corresponding to the last data transmission, the average transmission delay corresponding to the last transmitted block synchronization data, and the average of the average transmission delays corresponding to all the transmitted block synchronization data.
3. The method according to claim 1, characterized in that Calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information includes: When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4, the influence coefficient corresponding to the current data transmission is calculated based on the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the fragment size corresponding to the latest 4 block synchronization data. The influence coefficient includes a first influence coefficient affected by the load of the data receiving node, a second influence coefficient affected by the downlink network bandwidth, a third influence coefficient affected by the transmission rate, and a fourth influence coefficient affected by the transmission delay; The fragment size corresponding to the current data transmission is calculated and updated based on the block transmission information corresponding to the block synchronization data that was transmitted last time and the influence coefficient.
4. The method according to claim 1, wherein Calculating and updating the fragment size corresponding to the current data transmission according to the block transmission information includes: When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 4 and less than or equal to 5, the influence coefficient corresponding to the current data transmission is calculated based on the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the fragment size corresponding to the latest 4 block synchronization data. The influence coefficient includes a first influence coefficient affected by the load of the data receiving node, a second influence coefficient affected by the downlink network bandwidth, a third influence coefficient affected by the transmission rate, and a fourth influence coefficient affected by the transmission delay; Calculate and update the shard size corresponding to the current data transmission based on the block transmission information corresponding to the block synchronization data completed last time and the influence coefficient; When the number of block synchronization data that has been transmitted by the current data sending node is greater than or equal to 6, the influence coefficient corresponding to the current data transmission is updated based on the influence coefficient used in the latest two calculations of the shard size and the block transmission information corresponding to the latest four block synchronization data that have been transmitted; The fragment size corresponding to the current data transmission is calculated and updated according to the block transmission information corresponding to the block synchronization data transmitted last time and the updated influence coefficient.
5. The method according to claim 4, characterized in that Based on the impact coefficients used in the latest two calculations of the shard size and the block transmission information corresponding to the latest four completed block synchronization data, the impact coefficient corresponding to the current data transmission is updated, including: The first influence coefficient corresponding to the current data transmission is updated based on the first influence coefficient used in the latest two calculations of the shard size and the average load of the data receiving nodes corresponding to the latest four block synchronization data that have been transmitted. The second impact coefficient corresponding to the current data transmission is updated based on the second impact coefficient used in the latest two calculations of the shard size and the average downlink network bandwidth corresponding to the latest four block synchronization data that have been transmitted. The third influence coefficient corresponding to the current data transmission is updated based on the third influence coefficient used in the latest two calculations of the shard size and the average transmission rate corresponding to the latest four block synchronization data that have been transmitted. The fourth impact coefficient corresponding to the current data transmission is updated based on the fourth impact coefficient used in the latest two calculations of the shard size and the average transmission delay corresponding to the latest four block synchronization data that have been transmitted.
6. The method according to claim 1, characterized in that Adjust the shard size of the shard data to be transmitted based on the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data of the last completed transmission, including: Compare the absolute value of the delay difference between the transmission delay corresponding to the last shard data and the average transmission delay corresponding to the last completed block synchronization data to see if it is greater than the delay threshold; If the absolute value of the delay difference is greater than the delay threshold, calculating a first ratio of the average transmission delay corresponding to the block synchronization data transmitted last time to the transmission delay corresponding to the previous fragment data; Adjusting the fragment size of the fragment data to be transmitted based on the first ratio; If the absolute value of the delay difference is less than or equal to the delay threshold, the fragment size of the fragment data to be transmitted is not adjusted.
7. The method according to claim 6, characterized in that Before adjusting the fragment size of the fragment data to be transmitted based on the transmission delay corresponding to the previous fragment data and the average transmission delay corresponding to the block synchronization data transmitted last time, the method includes: When the number of block synchronization data that has been transmitted by the current data sending node is less than 4, the delay threshold is calculated and updated according to the average transmission delay corresponding to all block synchronization data that has been transmitted by the current data sending node; When the number of block synchronization data that the current data sending node has completed transmitting is greater than or equal to 4, obtain the average transmission delay corresponding to the latest 4 block synchronization data that the current data sending node has completed transmitting; The delay threshold is calculated and updated according to the average transmission delays corresponding to the latest four block synchronization data that have been transmitted by the current data sending node.
8. A data synchronization method for a blockchain network, characterized in that: The method comprises: Receive each shard data sent by the data sending node, and return the transmission delay corresponding to each shard data one by one in the order of receipt, wherein the shard size of the shard data is calculated and updated by the data sending node based on the block transmission information corresponding to the block synchronization data that has been transmitted, and the shard size of the shard data is also adjusted based on the transmission delay corresponding to the previous shard data and the average transmission delay corresponding to the block synchronization data that has been transmitted; After receiving all the shard data of the block synchronization data, assemble each of the shard data to obtain the block synchronization data, and return the block transmission information corresponding to the block synchronization data. The block transmission information includes the average load of the data receiving node, the average downlink network bandwidth, the average transmission rate and the average transmission delay.
9. The method according to claim 8, characterized in that After receiving each fragment data sent by the data sending node, the method further includes: Record the transmission rate, transmission delay, load of the data receiving node and downlink network bandwidth corresponding to each shard data transmission, so that after receiving all the shard data of the block synchronization data, calculate the average transmission rate, average transmission delay, average load of the data receiving node and average downlink network bandwidth corresponding to the block synchronization data based on the transmission rate, transmission delay, load of the data receiving node and downlink network bandwidth corresponding to each shard data transmission.
10. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 9 when executing the computer program.
Citation Information
Patent Citations
Network time delay determination method, device, equipment and medium
CN117319259A
Data fragmentation method and device, electronic equipment and readable storage medium
CN117354303A