Data synchronization method of block chain network and electronic equipment
Through dynamic calculation and adjustment of the shard size, the problem of excessive load when blockchain nodes transmit data and the shard size cannot adapt to network fluctuations is solved, and the block synchronization efficiency and network stability are improved.
Patent Information
- Application Number
- CN202411662857.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-20
AI Technical Summary
Transaction data transmission between blockchain nodes can easily lead to excessive load of nodes, downtime or even unavailable areas, and shard transmission technology cannot dynamically adjust the shard size to adapt to network and load fluctuations.
By obtaining the block transmission information of the transmitted block synchronization data, the shard size is calculated and updated, and during the shard transmission process, it is adjusted according to the transmission delay of the previous shard data and the average transmission delay of the last block synchronization data to adapt to the dynamic changes of the node network and load.
Improve block synchronization efficiency, avoid excessive node load and transmission failure, and ensure the stability and availability of the blockchain network.
Smart Images

Figure CN119520544A_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] Since transaction data is transmitted between blockchain nodes in many cases by broadcasting, such as blockchain nodes directly broadcasting transaction data, or forwarding transaction data broadcast by other blockchain nodes. If nodes are allowed to forward or broadcast transaction data, it is easy to cause blockchain nodes to be overloaded, resulting in node downtime, or even unavailability in some areas; the bandwidth of the transmission channel between nodes is fully occupied, resulting in large-scale transaction data transmission failure.
[0003] In related technologies, when it comes to data transmission and synchronization, sharding transmission technology is used for transmission. However, the sharding size is fixed. Once the sharding rules are determined, nodes synchronize block data with the same sharding size, and the sharding size cannot be dynamically adjusted according to 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, and at the same time, dynamically adjust the shard size 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-mentioned purpose, 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 according to 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 sliced data to the data receiving node in sequence, and obtain and record the transmission delay corresponding to the sliced 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 the 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 the current data sending node has transmitted 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 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 last completed block synchronization data, and the average of the average transmission delays corresponding to all completed 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 according to the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the shard size corresponding to the latest 4 block synchronization data, and 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] According to the block transmission information corresponding to the block synchronization data that was transmitted last time and the influence coefficient, the fragment size corresponding to the current data transmission is calculated and updated.
[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 according to the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the shard size corresponding to the latest 4 block synchronization data, and 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 according to the block transmission information corresponding to the block synchronization data transmitted 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 2 calculations of the shard size and the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted;
[0020] According to the block transmission information corresponding to the block synchronization data transmitted last time and the updated influence coefficient, the fragment size corresponding to the current data transmission is calculated and updated.
[0021] In one embodiment of the present application, the influence coefficient corresponding to the current data transmission is updated according to 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:
[0022] According to 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 first influence coefficient corresponding to the current data transmission is updated;
[0023] According to 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 second impact coefficient corresponding to the current data transmission is updated;
[0024] According to the third influence coefficient used in the latest two calculations of the shard size and the average transmission rates corresponding to the latest four block synchronization data that have been transmitted, the third influence coefficient corresponding to the current data transmission is updated;
[0025] According to the fourth impact coefficient used in the latest two calculations of the shard size and the average transmission delays corresponding to the latest four block synchronization data that have been transmitted, the fourth impact coefficient corresponding to the current data transmission is updated.
[0026] In one embodiment of the present application, the shard size of the shard data to be transmitted is adjusted according to the transmission delay corresponding to the last shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission, including:
[0027] Compare whether 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 is greater than the delay threshold;
[0028] 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 block synchronization data transmitted last time divided by the transmission delay corresponding to the last fragment data is calculated;
[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 according to the transmission delay corresponding to the last fragment data and the average transmission delay corresponding to the block synchronization data completed in the last 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, the average transmission delay corresponding to the latest 4 block synchronization data that the current data sending node has completed transmitting is obtained;
[0034] The delay threshold is calculated and updated according to the average transmission delays respectively corresponding to the latest 4 block synchronization data that have been transmitted by the current data sending node.
[0035] To achieve the above-mentioned purpose, 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 receiving, wherein the shard size of the shard data is calculated and updated by the data sending node according to 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 last time;
[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, 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.
[0038] In one embodiment of the present application, after receiving each fragment data sent by the data sending node, the method further includes:
[0039] The transmission rate, transmission delay, load of the data receiving node and downlink network bandwidth corresponding to each shard data transmission are recorded, so that after receiving all the shard data of the block synchronization data, the average transmission rate, average transmission delay, average load of the data receiving node and average downlink network bandwidth corresponding to each shard data transmission are calculated.
[0040] To achieve the above-mentioned purpose, the third aspect of an embodiment 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 according to 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 current 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, and improve the block synchronization efficiency of the entire blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a flowchart of a data synchronization method of a blockchain network performed by a data sending node provided by an embodiment of the present application;
[0043] Figure 2 This is a flowchart of the first step of calculating and updating the slice 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 A flowchart of the steps of updating the influence coefficient corresponding to the current data transmission according to 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 It is a flowchart of the steps of adjusting the fragment size of the fragment data to be transmitted currently according to the transmission delay corresponding to the last fragment data and the average transmission delay corresponding to the block synchronization data transmitted last time, provided by an embodiment of the present application;
[0048] Figure 7 is a flowchart of the steps for updating the delay threshold provided in an embodiment of the present application;
[0049] Figure 8 It is a flowchart of a data synchronization method of a blockchain network performed by a data receiving node provided by an embodiment of the present application;
[0050] Fig. 9 It 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 solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0052] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0054] Terminology explanation:
[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 broadcast: Blockchain message broadcast refers to the process of spreading messages or data to other nodes in the blockchain network. When a node generates a new transaction, block or other important event, it will send the message to other nodes in the network through broadcast so that they can know and process it accordingly.
[0057] Fragmented transmission: Fragmented transmission is a technology that divides data into smaller fragments for transmission. When the amount of data to be transmitted is large, dividing the data into smaller fragments can improve the transmission efficiency; if an error occurs during the transmission process, only the affected fragments need to be retransmitted instead of the entire data, which is suitable for situations with low network bandwidth, long transmission distance and large transmission files.
[0058] Transmission delay: refers to the time from when data is sent to when the receiver completely receives the data.
[0059] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. In the blockchain system, data blocks are combined into a chain data structure in a sequential manner according to time sequence, and a distributed ledger that cannot be tampered with or forged is guaranteed by cryptography. Due to the characteristics of blockchain such as decentralization, information cannot be tampered with, and autonomy, blockchain has also received more and more attention and application.
[0060] In related technologies, when it comes to data transmission and synchronization, sharding transmission technology is used for transmission. However, the sharding size is fixed. Once the sharding rules are determined, nodes synchronize block data with the same sharding size, and the sharding size cannot be dynamically adjusted according to 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 It is a flowchart of a data synchronization method of 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 the embodiment of the present application, the data sending node receives and records the block transmission information corresponding to the block synchronization data that has been transmitted, so that in the current data transmission, the block transmission information corresponding to the block synchronization data that has been transmitted can be calculated and updated to obtain the shard size corresponding to the current data transmission. 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 the data sending node completes the proof-of-work calculation, it needs to broadcast the calculation results to other nodes. For example, the data sending node needs to send the calculation results, i.e., 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 completed block synchronization data, the average downlink network bandwidth, the average transmission rate, and the average transmission delay.
[0066] Reference Figure 2 , Figure 2 It 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] Step S220, 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 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 preset set value can be used as the shard size corresponding to the current data transmission. Among them, the set value can be a preset 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 is not fragmented. 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 has 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, and formula 1 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 completed last time, 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 transmitted 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 transmitted is equal to 1, that is, when the data sending node transmits block synchronization data for the second time, its corresponding fragment size is Tss1 represents the shard size corresponding to the first transmission of block synchronization data, Dt1 represents the average transmission delay corresponding to the block synchronization data completed 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, its corresponding fragment size Tss2 represents the fragment size corresponding to the second transmission of 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, its corresponding fragment size Tss3 represents the fragment size corresponding to the third transmission of 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 It represents 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 It is a second step flowchart 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] 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 according to 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 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, according to the block transmission information and influence coefficient corresponding to the block synchronization data transmitted last time, calculate and update the slice size corresponding to the current data transmission.
[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] Through 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 can be calculated, so that the fragment size corresponding to the current data transmission can be further calculated and updated according to the block transmission information and influence coefficient corresponding to the block synchronization data completed in the last transmission. Specifically, the fragment size corresponding to the current data transmission can be calculated according to the following formula 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 influence 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 that was transmitted last time, 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 The fourth influence coefficient Dt corresponding to the current data transmission affected by the transmission delay is i-1 The average transmission delay of the block synchronization data that was transmitted last time.
[0082] Exemplarily, when the number of block synchronization data that has been transmitted by the data sending node is equal to 4, that is, the transmission of block synchronization data has been completed 4 times, and then the 5th block synchronization data transmission is to be performed. Among them, the shard size corresponding to the first 4 times of block synchronization data can be calculated based on the above formula 1, and the average load of the data receiving node, the average value of the downlink network bandwidth, the average transmission rate and the average transmission delay corresponding to the first 4 times of block synchronization data can be recorded by the data sending node each time the block synchronization data is sent. Therefore, based on the shard size and block transmission information corresponding to the 4 times of block synchronization data that have been transmitted, 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 by the above formula 2. Then, according to the block transmission information and 4 influence coefficients corresponding to the block synchronization data that was transmitted last time (that is, the fourth time), the shard size corresponding to the current data transmission (that is, the 5th transmission of block synchronization data) can be calculated and updated by the above formula 3. Among them, the shard size corresponding to the 5th 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, the transmission of 5 block synchronization data has been completed, and then the 6th block synchronization data transmission is to be performed. Among them, the latest 4 block synchronization data that have been transmitted 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. Among them, 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 shard 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 shard sizes and block transmission information corresponding to the latest 4 block synchronization data that have been transmitted, 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 by the above formula 2. Based on the block transmission information and the four influence coefficients corresponding to the block synchronization data transmitted for the last time (that is, the fifth time), the shard size corresponding to the current data transmission (that is, the 6th transmission of block synchronization data) can be calculated and updated by the above formula 3. Among them, the shard size corresponding to the 6th data transmission can be expressed as Tss6=a6*L5+b6*B5+c6*V5+d6*Dt5.
[0083] In some embodiments, reference Figure 4 , Figure 4 It 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 according to the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the shard 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, calculating and updating the shard size corresponding to the current data transmission according to the block transmission information and influence coefficient corresponding to the block synchronization data 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 according to 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;
[0087] Step S440, according to the block transmission information corresponding to the block synchronization data transmitted last time and the updated influence coefficient, the fragment size corresponding to the current data transmission is calculated and updated.
[0088] In the 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, 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 according to the above formula 2. Furthermore, the fragment size corresponding to the current data transmission can be calculated and updated according to the block transmission information and influence coefficient corresponding to the block synchronization data that was transmitted last time. That is, according to the first influence coefficient a affected by the load of the data receiving node corresponding to the current data transmission, 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, and the average load of the data receiving node corresponding to the block synchronization data that was transmitted last time, the average value of the downlink network bandwidth, the average transmission rate, and the average transmission delay, the above formula 3 is used to calculate and update the fragment size corresponding to the current data transmission. When the number of block synchronization data that the current data sending node has completed transmitting is greater than or equal to 6, at this time, there is already a fragmentation rule as shown in the above formula 3, 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 fragmentation size corresponding to the current data transmission, so that the updated fragmentation size can be adaptively adjusted with the 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 according to the influence coefficient used in the latest two calculations of the fragmentation 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 slice size corresponding to the current data transmission through the above formula 3.
[0089] In some embodiments, reference Figure 5 , Figure 5It is a flowchart of the steps of updating the influence coefficient corresponding to the current data transmission according to the influence coefficient used for 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, including but not limited to steps S510 to S540.
[0090] Step S510, updating and obtaining the first influence coefficient corresponding to the current data transmission according to the first influence coefficient used in the latest two calculations of the shard size and the average load of the data receiving node corresponding to the latest four block synchronization data that have been transmitted;
[0091] Step S520, updating and obtaining the second influence coefficient corresponding to the current data transmission according to the second influence coefficient used in the latest two calculations of the fragment size and the average value of the downlink network bandwidth corresponding to the latest four block synchronization data that have been transmitted;
[0092] Step S530, updating and obtaining the third influence coefficient corresponding to the current data transmission according to the third influence coefficient used in the latest two calculations of the slice size and the average transmission rates corresponding to the latest four block synchronization data that have been transmitted;
[0093] Step S540, updating and obtaining the fourth influence coefficient corresponding to the current data transmission according to the fourth influence coefficient used in the latest two calculations of the slice size and the average transmission delays corresponding to the latest four 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 according to 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. 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 by 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 represents the fourth impact coefficient affected by the transmission delay corresponding to the i-th transmission block synchronization data, L i-1represents the average load of the data receiving node corresponding to the i-1th transmission block synchronization data, B i-1 represents the average downlink network bandwidth corresponding to the i-1th transmission block synchronization data, V i-1 represents the average transmission rate corresponding to the i-1th transmission block synchronization data, Dt i-1 It represents the average transmission delay corresponding to the i-1th transmission block synchronization data.
[0097] According to Formula 4, 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. For example, when the block synchronization data is transmitted for the 7th time, the influence coefficient used in the latest two calculations of the shard size is a6, b6, c6, d6 used in the 6th calculation of the shard size, and a5, b5, c5, d5 used in the 5th calculation of the shard size. The block transmission information corresponding to the latest 4 block synchronization data that have been transmitted includes the average load L6, the average value B6 of the downlink network bandwidth, the average transmission rate V6 and the average transmission delay Dt6 of the data receiving node corresponding to the 6th transmitted block synchronization data, the average load L5, the average value B5 of the downlink network bandwidth, the average transmission rate V5 and the average transmission delay Dt5 of the data receiving node corresponding to the 5th transmitted block synchronization data, the average load L4, the average value B4 of the downlink network bandwidth, the average transmission rate V4 and the average transmission delay Dt4 of the data receiving node corresponding to the 4th transmitted block synchronization data, and the average load L3, the average value B3 of the downlink network bandwidth, the average transmission rate V3 and the average transmission delay Dt3 of the data receiving node corresponding to the 3rd transmitted block synchronization data. Substituting these data into the above formula 4, we can get:
[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 7th transmission block synchronization data can be calculated. Then, according to the block transmission information corresponding to the 6th transmission block synchronization data, the fragment size corresponding to the current data transmission (that is, the 7th transmission block synchronization data) can be calculated and updated through the above formula 3. Among them, the fragment size corresponding to the 7th 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 then 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, transmitting the sliced data to the data receiving node in sequence, and obtaining and recording the transmission delay corresponding to the sliced data that has been transmitted.
[0103] In an embodiment of the present application, after the block synchronization data to be transmitted is sliced according to the slice size to obtain multiple slice data of the same slice size, the slice data can be transmitted to the data receiving node in sequence. After each slice data is received by the data receiving node, the transmission rate, transmission delay, load of the data receiving node and downlink network bandwidth corresponding to the slice data will be recorded, and the transmission delay corresponding to the slice data will be returned to the data sending node. After the data receiving node receives all the slice data corresponding to the block synchronization data, it will assemble each slice data to obtain the block synchronization data, and return the block transmission information corresponding to the block synchronization data, that is, return the average load of the data receiving node corresponding to the block synchronization data, the average value of the downlink network bandwidth, the average transmission rate and the average transmission delay. Thus, the data sending node can obtain the transmission delay corresponding to the slice data that has been transmitted and the average load, the average value of the 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 shard data, the data receiving node will verify the shard data. After successful verification, it will record the transmission delay, transmission rate, load of the data receiving node and downlink network bandwidth data corresponding to this shard transmission (i.e., corresponding to the shard data), and return the transmission delay corresponding to this shard transmission to the data sending node. After receiving all the shard data, the data receiving node will assemble each shard data into block synchronization data and verify the legitimacy of the block. After verifying the legitimacy of the block, 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 are returned.
[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 that was transmitted last time, until all the shard data of the block synchronization data to be transmitted are completely transmitted.
[0106] In the embodiment of the present application, considering 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 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. 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 large, it indicates that the load of the data receiving node or the downlink network bandwidth has changed. Therefore, the size of the next shard data (i.e., the second shard data) needs to be adjusted according to the transmission delay corresponding to the first shard data and the average transmission delay corresponding to the last completed block synchronization data. And so on, until all 5 shard data are 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 that was transmitted last time, until all the shard data of the block synchronization data to be transmitted are fully transmitted.
[0108] Reference Figure 6 , Figure 6 It is a flowchart of the steps for 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 completed in the last transmission, provided by an embodiment of the present application, including but not limited to steps S610 to S640.
[0109] Step S610, comparing whether 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 block synchronization data transmitted last time is greater than the 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 block synchronization data transmitted last time 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 last shard data with the average transmission delay corresponding to the block synchronization data of the last transmission. If 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 block synchronization data of the last 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 last shard data and the average transmission delay corresponding to the block synchronization data of the last transmission. Specifically, first calculate the first ratio of the average transmission delay corresponding to the block synchronization data of the last transmission to the transmission delay corresponding to the last 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 shard data to be transmitted before updating, Dt i-1 Indicates the average transmission delay corresponding to the block synchronization data that was transmitted last time. 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 previous 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 It 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 delays corresponding to the latest 4 block synchronization data that have been transmitted by the current data sending node;
[0121] Step S730, calculate and update the delay threshold according to the average transmission delays corresponding to the latest four block synchronization data that have been transmitted by the current data sending node.
[0122] In an embodiment of the present application, before adjusting the shard size of the shard data to be transmitted according to the transmission delay corresponding to the last shard 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 according to the average transmission delay corresponding to the block synchronization data that has been transmitted. Specifically, 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. Specifically, the average value of the average transmission delay corresponding to all block synchronization data that has been transmitted by the current data sending node can be calculated and multiplied by the delay threshold parameter to obtain the delay threshold. It should be noted that, since the data sending node does not have the completed block synchronization data when sending block synchronization data for the first time (i.e., the first time), that is, there is no completed block synchronization data, that is, there is no completed block synchronization data for the last transmission, and there is no need to adjust the shard data after the first sharding, that is, there is no need to calculate the delay threshold corresponding to the first shard 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 block synchronization data transmitted for the first time, Dt2 represents the average transmission delay corresponding to the block synchronization data transmitted for the second time, and Dt3 represents the average transmission delay corresponding to the block synchronization data transmitted for the third time. 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 according to 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 The average transmission delay corresponding to the block synchronization data completed for the i-1th transmission, Dt i-2 The average transmission delay corresponding to 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 that has been transmitted for the i-4th time.
[0125] Reference Figure 8 , Figure 8 It is a flowchart of a data synchronization method of 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, receiving each shard data sent by the data sending node, and returning the transmission delay corresponding to each shard data one by one in the order of receiving, wherein the shard size of the shard data is calculated and updated by the data sending node according to 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 last time;
[0127] Step S820, after receiving all the shard data of the block synchronization data, assemble each 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 shard size corresponding to the current data transmission according to the block transmission information corresponding to the block synchronization data that has been transmitted, the block synchronization data to be transmitted can be fragmented according to the fragment size to obtain multiple fragment data with the same fragment size, and sent 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 value of the downstream network bandwidth, the average transmission rate and the average transmission delay. Thereby, the data sending module can calculate and update the shard size corresponding to the current data transmission according to 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 reception, 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, and improve 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, so as to calculate the average transmission rate, average transmission delay, average load of the data receiving node and downlink network bandwidth corresponding to the block synchronization data after receiving all the shard data of the block synchronization data according to the transmission rate, transmission delay, load of the data receiving node and downlink network bandwidth corresponding to each shard data transmission. 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 embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the data synchronization method of the above blockchain network when executing the computer program. The electronic device can be any smart terminal including a tablet computer, a car computer, etc.
[0130] See also Fig. 9 , Fig. 9 : is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application, the electronic device includes:
[0131] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (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 applications. When the technical solution provided in the embodiment of this specification is 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 embodiment of this application;
[0133] Input / output interface 903, used to implement information input and output;
[0134] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0135] A bus 905 that transmits information between the various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the 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 the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present 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 the embodiments of the present application are also applicable to similar technical problems.
[0138] Those skilled in the art will appreciate 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, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0140] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination 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 sequence. 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 of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising 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 the present 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 objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single 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 the present 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 only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, 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 separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0145] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of 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 to enable 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 (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as 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 the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and substance of the present invention should be within the scope of the rights 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 according to 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 sliced data to the data receiving node in sequence, and obtain and record the transmission delay corresponding to the sliced 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 the shard data of the block synchronization data to be transmitted are completely transmitted.
2. The method according to claim 1, characterized in that The shard size corresponding to the current data transmission is calculated and updated according to the block transmission information, including: When the number of block synchronization data that the current data sending node has transmitted 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 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 last completed block synchronization data, and the average of the average transmission delays corresponding to all completed block synchronization data.
3. The method according to claim 1, characterized in that The shard size corresponding to the current data transmission is calculated and updated according to the block transmission information, including: 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 according to the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the shard size corresponding to the latest 4 block synchronization data, and 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; According to the block transmission information corresponding to the block synchronization data transmitted last time and the influence coefficient, the fragment size corresponding to the current data transmission is calculated and updated.
4. The method according to claim 1, characterized in that: The shard size corresponding to the current data transmission is calculated and updated according to the block transmission information, including: 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 according to the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted and the shard size corresponding to the latest 4 block synchronization data, and 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 according to the block transmission information corresponding to the block synchronization data transmitted 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 2 calculations of the shard size and the block transmission information corresponding to the latest 4 block synchronization data that have been transmitted; According to the block transmission information corresponding to the block synchronization data transmitted last time and the updated influence coefficient, the fragment size corresponding to the current data transmission is calculated and updated.
5. The method according to claim 4, characterized in that According to 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, the influence coefficient corresponding to the current data transmission is updated, including: According to 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 first influence coefficient corresponding to the current data transmission is updated; According to 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 second impact coefficient corresponding to the current data transmission is updated; According to the third influence coefficient used in the latest two calculations of the shard size and the average transmission rates corresponding to the latest four block synchronization data that have been transmitted, the third influence coefficient corresponding to the current data transmission is updated; According to the fourth impact coefficient used in the latest two calculations of the shard size and the average transmission delays corresponding to the latest four block synchronization data that have been transmitted, the fourth impact coefficient corresponding to the current data transmission is updated.
6. The method according to claim 1, characterized in that According to the transmission delay corresponding to the last shard data and the average transmission delay corresponding to the block synchronization data completed in the last transmission, the shard size of the shard data to be transmitted is adjusted, including: Compare whether 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 is greater than the delay threshold; 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 block synchronization data transmitted last time divided by the transmission delay corresponding to the last fragment data is calculated; 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 currently according to the transmission delay corresponding to the last 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, the average transmission delay corresponding to the latest 4 block synchronization data that the current data sending node has completed transmitting is obtained; The delay threshold is calculated and updated according to the average transmission delays respectively corresponding to the latest 4 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 receiving, wherein the shard size of the shard data is calculated and updated by the data sending node according to 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 last time; 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, 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.
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: The transmission rate, transmission delay, load of the data receiving node and downlink network bandwidth corresponding to each shard data transmission are recorded, so that after receiving all the shard data of the block synchronization data, the average transmission rate, average transmission delay, average load of the data receiving node and average downlink network bandwidth corresponding to each shard data transmission are calculated.
10. An electronic device, characterized in that: The electronic device comprises 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
Traffic shaping method, device and electronic equipment
CN113573062A
File transmission method and device, electronic equipment and storage medium
CN114221954A
Network time delay determination method, device, equipment and medium
CN117319259A
Data fragmentation method and device, electronic equipment and readable storage medium
CN117354303A
Decentralized data storage method and system based on block chain
CN118631832A