A Transaction Data Transmission Method and Device for a Blockchain

By splitting transaction data fragments between blockchain nodes and transmitting them successively, the problem of low efficiency in transaction data transmission between blockchain nodes is solved, the transmission success rate is improved, and the efficient business needs of financial institutions are met.

CN112667647BActive Publication Date: 2025-07-25WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011456673.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-11
Publication Date
2025-07-25
Estimated Expiration
2040-12-11

AI Technical Summary

Technical Problem

The transmission efficiency of transaction data between blockchain nodes is low, which can easily lead to full bandwidth of transmission channels and failed transaction data transmission, which cannot meet the efficient operation needs of financial institutions.

Method used

By obtaining the transaction data to be transmitted and determining the real-time transmission bandwidth value with the target blockchain node, transaction data larger than the real-time bandwidth is split into multiple segments and transmitted to the target node one after another, ensuring that each segment is smaller than the real-time bandwidth value and avoiding direct transmission of data beyond the bandwidth.

Benefits of technology

It improves the efficiency of transaction data transmission between blockchain nodes, avoids transmission failure, and meets the efficient business operation needs of financial institutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112667647B_ABST
    Figure CN112667647B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and apparatus for transmitting transaction data of a blockchain. The method is as follows: a first blockchain node obtains transaction data to be transmitted; the first blockchain node determines a real-time transmission bandwidth value of a transmission channel between the first blockchain node and a second blockchain node; if the transaction data to be transmitted is greater than the real-time transmission bandwidth value, the first blockchain node splits the transaction data to be transmitted into multiple transaction data segments according to a first preset sharding strategy; any one of the multiple transaction data segments is less than the real-time transmission bandwidth value; the first blockchain node transmits the multiple transaction data segments to the second blockchain node one by one in multiple times. When the above method is applied to financial technology (Fintech), it will not cause transmission failure due to excessive transaction data to be transmitted, and improves the transmission efficiency of transaction data between blockchain nodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain in the field of financial technology (Fintech), and in particular to a transaction data transmission method and device of blockchain. Background Art

[0002] With the development of computer technology, more and more technologies are being applied in the financial field. Traditional finance is gradually transforming to Fintech. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. Fintech is currently closely integrated with blockchain. Transaction data often needs to be transmitted between blockchain nodes for subsequent block generation and consensus generation.

[0003] 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 broadcasted by other blockchain nodes. If nodes are allowed to forward / broadcast received transaction data, it is easy to cause the bandwidth of the transmission channel between blockchain nodes to be occupied, and then cause large-scale transaction data transmission failure. Moreover, the network status of the transmission channel is not stable. If nodes are allowed to forward / broadcast received transaction data, a large amount of transaction data will be lost or sent. This will lead to low transmission efficiency of transaction data between blockchain nodes. Summary of the invention

[0004] The present invention provides a method and device for transmitting transaction data of a blockchain, which solves the problem of low transmission efficiency of transaction data between blockchain nodes in the prior art.

[0005] In a first aspect, the present invention provides a transaction data transmission method of a blockchain, comprising:

[0006] The first blockchain node obtains the transaction data to be transmitted;

[0007] The first blockchain node determines a real-time transmission bandwidth value of a transmission channel between the first blockchain node and the second blockchain node;

[0008] If the transaction data to be transmitted is larger than the real-time transmission bandwidth value, the first blockchain node splits the transaction data to be transmitted into multiple transaction data fragments according to a first preset fragmentation strategy; any transaction data fragment among the multiple transaction data fragments is smaller than the real-time transmission bandwidth value;

[0009] The first blockchain node transmits the multiple transaction data fragments to the second blockchain node one by one in multiple times.

[0010] In the above manner, after the first blockchain node obtains the transaction data to be transmitted, it does not directly transmit the transaction data to be transmitted to the second blockchain node. Instead, it first determines the real-time transmission bandwidth value of the transmission channel between it and the second blockchain node. When the transaction data to be transmitted is greater than the real-time transmission bandwidth value, it splits the transaction data to be transmitted into multiple transaction data segments according to the first preset sharding strategy, and then transmits the multiple transaction data segments to the second blockchain node in batches. Any transaction data segment is less than the real-time transmission bandwidth value, thus avoiding directly sending the transaction data to be transmitted that is greater than the real-time transmission bandwidth value, preventing transmission failure due to overly large transaction data to be transmitted, and improving the transmission efficiency of transaction data between blockchain nodes.

[0011] Optionally, the first blockchain node determines the real-time transmission bandwidth value of the transmission channel between it and the second blockchain node, including:

[0012] The first blockchain node probes the transmission channel to determine the real-time probing bandwidth value of the transmission channel;

[0013] The first blockchain node determines the real-time transmission bandwidth value at least based on the real-time probing bandwidth value.

[0014] In the above method, the first blockchain node determines the real-time transmission bandwidth value by real-time probing the transmission channel, thereby obtaining the real-time transmission bandwidth value, and then dynamically determining the upper limit for splitting multiple transaction data segments, making the transmission success rate of the multiple transaction data segments to be transmitted higher and improving the transmission efficiency of transaction data between blockchain nodes.

[0015] Optionally, the first blockchain node probes the transmission channel to determine the real-time probing bandwidth value of the transmission channel, including:

[0016] If the target dynamic interval does not meet the probing termination condition, execute:

[0017] The first blockchain node sends a probing message of a target length to the second blockchain node; the target length is within the target dynamic interval;

[0018] If the first blockchain node does not receive the probing success response message for the probing message, it updates the upper limit value of the target dynamic interval according to the target length, making the upper limit value not greater than the target length; return to the step where the first blockchain node sends a probing message of a target length to the second blockchain node.

[0019] If the first blockchain node receives a probe success response message for the probe message, it updates the lower limit value of the target dynamic range according to the target length, so that the lower limit value is not less than the target length; returns the step of the first blockchain node sending a probe message with the target length to the second blockchain node.

[0020] When the target dynamic range meets the probe termination condition, the first blockchain node uses the target length as the real-time probe bandwidth value.

[0021] In the above method, the first blockchain node sends a probe message with the target length to the second blockchain node and continuously adjusts the target dynamic range, so as to maximize the target length on the premise of successful detection, that is, to maximize the real-time probe bandwidth value. Therefore, more transaction data can be transmitted on the basis of a higher transmission success rate.

[0022] Optionally, the target length is the median value of the target dynamic range;

[0023] The updating of the upper limit value of the target dynamic range according to the target length so that the upper limit value is not greater than the target length includes:

[0024] According to the target length, using the target length as the upper limit value of the updated target dynamic range;

[0025] The updating of the lower limit value of the target dynamic range according to the target length so that the lower limit value is not less than the target length includes:

[0026] According to the target length, using the target length as the lower limit value of the updated target dynamic range.

[0027] In the above manner, each obtained target length is the median value of the target dynamic range, and it is adjusted with the target length as the upper limit value or the lower limit value according to the detection situation, so as to more quickly determine the real-time probe bandwidth value.

[0028] Optionally, the first blockchain node determines the real-time transmission bandwidth value at least according to the real-time probe bandwidth value, including:

[0029] If there is at least one historical transmission bandwidth value of the transmission channel, the first blockchain node determines the real-time transmission bandwidth value according to the at least one historical transmission bandwidth value and the real-time probe bandwidth value.

[0030] In the above manner, if there is at least one historical transmission bandwidth value of the transmission channel, the historical transmission bandwidth value and the real-time detection bandwidth value can be jointly referred to, so as to avoid inaccurate real-time transmission bandwidth value caused by incorrect detection of the real-time detection bandwidth value.

[0031] Optionally, the first blockchain node determines the real-time transmission bandwidth value according to the at least one historical transmission bandwidth value and the real-time detection bandwidth value, including:

[0032] The first blockchain node determines the first mean value of the at least one historical transmission bandwidth value; the first blockchain node uses the first mean value and the second mean value of the real-time detection bandwidth value as the real-time transmission bandwidth value.

[0033] In the above manner, through the first mean value and the second mean value of the real-time detection bandwidth value, the historical average transmission bandwidth value is referred to, making the real-time transmission bandwidth value more accurate.

[0034] Optionally, the first blockchain node determines a plurality of block data to be obtained from the second blockchain node;

[0035] The first blockchain node splits the plurality of block data into multiple segments of block data according to a second preset sharding strategy; any segment of the multiple segments of block data is less than the real-time transmission bandwidth value;

[0036] The first blockchain node obtains the multiple segments of block data from the second blockchain node in multiple times and segment by segment.

[0037] In the above manner, when the first blockchain node needs to obtain a plurality of block data from the second blockchain node, it is also split into multiple segments of block data according to the second preset sharding strategy, so that it is not necessary to obtain block data individually, but to obtain the multiple segments of block data from the second blockchain node in multiple times and segment by segment, increasing the transmission efficiency.

[0038] In a second aspect, the present invention provides a transaction data transmission device for a blockchain, including:

[0039] An acquisition module, configured to acquire transaction data to be transmitted;

[0040] A determination module, configured to determine the real-time transmission bandwidth value of the transmission channel with the second blockchain node;

[0041] A processing module, configured to, if the to-be-transmitted transaction data is greater than the real-time transmission bandwidth value, split the to-be-transmitted transaction data into multiple transaction data segments according to a first preset fragmentation strategy; any one of the multiple transaction data segments is less than the real-time transmission bandwidth value; and transmit the multiple transaction data segments to the second blockchain node one by one in multiple times.

[0042] Optionally, the determining module is specifically configured to:

[0043] Detect the transmission channel and determine the real-time detection bandwidth value of the transmission channel;

[0044] Determine the real-time transmission bandwidth value at least based on the real-time detection bandwidth value.

[0045] Optionally, the determining module is specifically configured to:

[0046] If the target dynamic range does not meet the detection termination condition, execute:

[0047] Send a detection message of a target length to the second blockchain node; the target length is within the target dynamic range;

[0048] If the detection success response message of the detection message is not received, update the upper limit value of the target dynamic range according to the target length, so that the upper limit value is not greater than the target length; return to the step of sending a detection message of a target length to the second blockchain node;

[0049] If the detection success response message of the detection message is received, update the lower limit value of the target dynamic range according to the target length, so that the lower limit value is not less than the target length; return to the step of sending a detection message of a target length to the second blockchain node;

[0050] When the target dynamic range meets the detection termination condition, use the target length as the real-time detection bandwidth value.

[0051] Optionally, the target length is the median of the target dynamic range; the determining module is specifically configured to: use the target length as the updated upper limit value of the target dynamic range according to the target length; use the target length as the updated lower limit value of the target dynamic range according to the target length.

[0052] Optionally, the determining module is specifically configured to: if there is at least one historical transmission bandwidth value of the transmission channel, determine the real-time transmission bandwidth value according to the at least one historical transmission bandwidth value and the real-time detection bandwidth value.

[0053] Optionally, the determining module is specifically configured to: determine a first average value of the at least one historical transmission bandwidth value; use the first average value and a second average value of the real-time detection bandwidth value as the real-time transmission bandwidth value.

[0054] Optionally, the determining module is further configured to: determine a plurality of block data to be obtained from the second blockchain node;

[0055] The processing module is further configured to:

[0056] split the plurality of block data into multiple segments of block data according to a second preset sharding strategy; any segment of the multiple segments of block data is less than the real-time transmission bandwidth value; obtain the multiple segments of block data from the second blockchain node in multiple times and segment by segment.

[0057] For the beneficial effects of the second aspect and each optional device of the second aspect, reference may be made to the beneficial effects of the first aspect and each optional method of the first aspect, which will not be elaborated here.

[0058] In a third aspect, the present invention provides a computer device, including a program or instruction, which when executed, is used to execute the first aspect and each optional method of the first aspect.

[0059] In a fourth aspect, the present invention provides a storage medium, including a program or instruction, which when executed, is used to execute the first aspect and each optional method of the first aspect.

[0060] These aspects or other aspects of the present invention will be more clearly understood in the following description of the embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.

[0062] Figure 1 It is a schematic flowchart corresponding to a method for transmitting transaction data of a blockchain provided by an embodiment of the present invention;

[0063] Figure 2 It is a schematic structural diagram of a device for transmitting transaction data of a blockchain provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0064] To make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0065] Transaction avalanche: If each node forwards / broadcasts the received transactions without limitation, the bandwidth will be occupied, and then the forwarding / broadcasting of transactions will fail on a large scale. This phenomenon is called transaction avalanche.

[0066] Business SDK: Code packages of various developed transaction middleware, such as WeEvent and WeID. They interact with the blockchain at the backend and receive user call requests at the frontend.

[0067] Maximum bandwidth: A transmission path from a sender to a receiver is called a transmission channel. The maximum bandwidth MB (Max bandwidth) of a transmission channel depends on the maximum uplink bandwidth MBSender of the sender and the maximum downlink bandwidth MBReveicer of the receiver. MB = Min(MBSender, MBReveicer). The theoretical maximum bandwidth of this node is the maximum bandwidth allocated by the cloud service provider or ISP.

[0068] Blockchain state synchronization: State synchronization is to keep the states of blockchain nodes up to date. The newness or oldness of the blockchain state refers to the newness or oldness of the data currently held by the blockchain nodes, that is, the height of the current block held by the nodes. If the block height of a node is the highest block height of the blockchain, then this node has the latest state of the blockchain. Only nodes with the latest state can participate in the consensus to conduct the consensus of the next new block.

[0069] During the operation of financial institutions (banking institutions, insurance institutions or securities institutions) in their business operations (such as loan business, deposit business, etc. of banks), transaction data often needs to be transmitted between blockchain nodes for subsequent block generation and consensus. If nodes are allowed to forward / broadcast the received transaction data at will, it is easy to cause the bandwidth of the transmission channels between blockchain nodes to be occupied, thereby resulting in large-scale failure of transaction data transmission. This leads to low transmission efficiency of transaction data between blockchain nodes. This situation does not meet the requirements of financial institutions such as banks and cannot ensure the efficient operation of various businesses of financial institutions. Therefore, as Figure 1 shown, the present application provides a method for transmitting transaction data of a blockchain.

[0070] Step 101: The first blockchain node obtains the transaction data to be transmitted.

[0071] Step 102: The first blockchain node determines the real-time transmission bandwidth value of the transmission channel between it and the second blockchain node.

[0072] Step 103: If the to-be-transmitted transaction data is greater than the real-time transmission bandwidth value, the first blockchain node splits the to-be-transmitted transaction data into multiple transaction data segments according to a first preset sharding strategy.

[0073] Any one of the multiple transaction data segments is less than the real-time transmission bandwidth value.

[0074] Step 104: The first blockchain node transmits the multiple transaction data segments to the second blockchain node one by one in multiple times.

[0075] In the methods of Steps 101 to 104, for example, the first blockchain node receives a broadcast message sent by a business SDK or other nodes, with a size of Smsg. It can first select the target blockchain node of the broadcast message according to a preset broadcast strategy, such as the second blockchain node.

[0076] For each target blockchain node, taking the second blockchain node as an example, the first blockchain node needs to calculate the real-time dynamic bandwidth RDB of the second blockchain node.

[0077] If the broadcast message (to-be-transmitted transaction data) is greater than RDB, the broadcast message is sharded according to the first preset sharding strategy. For example, the size of each sharded message is 0.8RDB, and then each sharded message is sent to the second blockchain node; if the size Smsg of the broadcast message (to-be-transmitted transaction data) is less than RDB, the broadcast message is directly sent to the node to be broadcast.

[0078] For each target blockchain node, the steps of the second blockchain node are followed to complete the broadcast of messages of all blockchain nodes.

[0079] It should be noted that in the specific implementation, it can be in the following manner:

[0080] When each business participant in the blockchain builds the blockchain, a blockchain bandwidth table can be constructed in the blockchain to record the bandwidth sizes of the transmission channels between blockchain nodes. The process of establishing the bandwidth table is as follows:

[0081] All business participants jointly build a blockchain network and establish and maintain the bandwidth table BWT shown in Table 1.

[0082] Taking the example of a blockchain with four nodes Node1, Node2, Node3, and Node4, the up / down bandwidths of the four nodes Node1, Node2, Node3, and Node4 are 1M, 5M, 10M, and 8M respectively. All blockchain nodes in the blockchain obtain the bandwidth information of their own blockchain nodes. For example, Node1 obtains the bandwidth information BW’node1 of its own blockchain node. Each blockchain node in the blockchain queries the bandwidth table in the blockchain.

[0083] When the bandwidth data of the corresponding transmission channel in the bandwidth table is empty, such as the bandwidth data of the transmission channel between Node1 and Node2 is empty. Node1 queries the bandwidth BWnode2 of the peer node Node2 of the transmission channel and updates Min(BW’node1, BWnode2) to the bandwidth table.

[0084] If the transmission channel bandwidth is not empty, the BWT update process is executed at this time.

[0085] The blockchain node queries the BWT in the blockchain and updates the data of all transmission channels of the corresponding node with Min(BW’node1, BWnode1, BWnodex).

[0086] The business SDKs connected to each node in the blockchain network regularly update the BWT to the local.

[0087] The BWT example is as follows:

[0088]

[0089] Table 1

[0090] In the above example, a real-time bandwidth table of the blockchain network can be constructed and maintained by each blockchain node during the establishment of the blockchain, indicating the real-time bandwidth size of data transmission between blockchain nodes.

[0091] In an alternative implementation, step 102 can be specifically as follows:

[0092] Step (1): The first blockchain node detects the transmission channel and determines the real-time detection bandwidth value of the transmission channel.

[0093] Step (2): The first blockchain node determines the real-time transmission bandwidth value at least based on the real-time detection bandwidth value.

[0094] For example, the method of step (1) can be to randomly select k1 times the preset transmission bandwidth value of the transmission channel, where k1 is a positive real number. If the detection is successful, it is used as the real-time detection bandwidth value of the transmission channel.

[0095] The method in step (2) can be that the first blockchain node uses the real-time detected bandwidth value as the real-time transmission bandwidth value, or it can be further processed, such as using the result of multiplying the real-time detected bandwidth value by a coefficient k2 as the real-time transmission bandwidth value.

[0096] Specifically, in an alternative embodiment, step (1) can specifically be:

[0097] If the target dynamic range does not meet the detection termination condition, execute:

[0098] Step (a): The first blockchain node sends a detection message of a target length to the second blockchain node.

[0099] The target length is within the target dynamic range.

[0100] Step (b): If the first blockchain node does not receive the detection success response message of the detection message, update the upper limit value of the target dynamic range according to the target length, so that the upper limit value is not greater than the target length.

[0101] After step (b) is executed, return to step (a).

[0102] Step (c): If the first blockchain node receives the detection success response message of the detection message, update the lower limit value of the target dynamic range according to the target length, so that the lower limit value is not less than the target length.

[0103] After step (c) is executed, return to step (a).

[0104] Step (d): When the target dynamic range meets the detection termination condition, the first blockchain node uses the target length as the real-time detected bandwidth value.

[0105] In steps (a) to (d), the detection termination condition can be: the length of the target dynamic range is greater than a preset length, such as 10KB.

[0106] In an alternative embodiment, the target length is the median value of the target dynamic range; the step of updating the upper limit value of the target dynamic range in step (b) can specifically be:

[0107] According to the target length, use the target length as the updated upper limit value of the target dynamic range.

[0108] The step of updating the lower limit value of the target dynamic range in step (c) can specifically be:

[0109] According to the target length, use the target length as the lower limit value of the updated interval of the target dynamic interval.

[0110] Specifically, RTB (Real-time transmission bandwidth) is the real-time transmission bandwidth value of a blockchain node at a certain moment. The factors affecting RTB can be: the continuous or intermittent bandwidth occupation of MB and other applications. It can be defaulted that RTB < MB. The RTB of a transmission channel can be detected, and the length of the target dynamic interval is determined to be 10KB. The size of the target dynamic interval can be adjusted according to the resource allocation of each blockchain node in the blockchain to achieve the balance of the detection duration of the real-time transmission bandwidth value and the transmission rate.

[0111] The detection process of the real-time detected bandwidth value can be as follows:

[0112] Step (1-1): The first blockchain node Node1 queries BWT to obtain the MB of the second blockchain node Node2.

[0113] Step (1-2): The first blockchain node Node1 prepares a detection shard message, where the target dynamic interval is initially [0, MB], and the preset length is 10KB.

[0114] Step (1-3): The first blockchain node Node1 first sends a detection message with a size of CHUNK1 = (0 + (MB - 0) / 2) and containing a detection identifier to detect the network real-time bandwidth of the transmission channel between Node1 and Node2.

[0115] Step (1-4): After receiving the message with the detection shard, the second blockchain node Node2 sends an empty shard message containing a detection success identifier to the first blockchain node Node1.

[0116] Step (1-5): If the first blockchain node Node1 receives the empty shard message with the detection success identifier, recalculate the detection shard size as CHUNK2 = (CHUNK1 + (MB – CHUNK1) / s), and send a shard message with a size of CHUNK2 and containing a detection identifier to detect the network real-time bandwidth of the channel, where s is a positive real number. For example, s is 2.

[0117] Step (1-6): If the first blockchain node Node1 does not receive the shard message with the detection success identifier, recalculate the size of the detection message CHUNK2 = (0 + (CHUNK1 - 0) / s), and send a shard message with a size of CHUNK2 and containing a detection identifier to detect the network real-time bandwidth of the transmission channel.

[0118] Repeat the process of the above steps (1-3) to (1-6) for detection.

[0119] Step (1-7): When the length of the detection message is less than the preset length of 10KB, that is, when the value of ((CHUNKm - CHUNKn) / s) in calculating the detection shard size using the dichotomy method is less than 10KB, the first blockchain node Node1 stops the detection and obtains the size CHUNKx of the final detection message.

[0120] In the above manner, the real-time transmission bandwidth of a transmission channel is detected by sending detection messages with sizes between zero and the maximum transmission bandwidth. Then, in combination with the historical transmission bandwidth value of the transmission channel, the real-time transmission bandwidth value of a transmission channel is calculated. When it is necessary to broadcast a message on the blockchain or perform block download synchronization of the blockchain, the number of shards of the broadcast message and the block to be downloaded is determined according to the real-time transmission bandwidth value, and then the broadcast message or the block data to be synchronized for download is sent in a loop to improve the efficiency of blockchain message broadcasting and blockchain synchronization.

[0121] A specific implementation manner of step (2) may be:

[0122] If there is at least one historical transmission bandwidth value of the transmission channel, the first blockchain node determines the real-time transmission bandwidth value according to the at least one historical transmission bandwidth value and the real-time detection bandwidth value.

[0123] For example, the first blockchain node determines the real-time transmission bandwidth value according to the weighted average of the at least one historical transmission bandwidth value and the real-time detection bandwidth value.

[0124] More specifically, the above implementation manner may be:

[0125] The first blockchain node determines the first mean value of the at least one historical transmission bandwidth value.

[0126] The first blockchain node uses the first mean value and the second mean value of the real-time detection bandwidth value as the real-time transmission bandwidth value.

[0127] The specific implementation process may be as follows:

[0128] There is a strong correlation between the real-time bandwidth of data transmission among blockchain nodes in the blockchain and the bandwidth occupancy of other applications of this blockchain node. A historical transmission bandwidth (HTB) table can be established locally on the blockchain node to record the actual bandwidth data when this blockchain node transmits data to each blockchain node. The HTB records the transmission bandwidth data for the recent N times. After a successful data transmission, the actual bandwidth corresponding to the current transmission rate is updated to the HTB.

[0129] Table 2 is an example of the HTB table of Node1. Node1 historical transmission bandwidth table:

[0130]

[0131] Table 2

[0132] The specific way for the first blockchain node to determine the real-time transmission bandwidth value based on the at least one historical transmission bandwidth value and the real-time detected bandwidth value can be:

[0133] Real-time dynamic bandwidth (RDB) is the bandwidth size determined in real time when a node needs to send a large file or data. The sender determines the size of data shards through RDB when sending data, so as to obtain the optimal transmission efficiency.

[0134] The value of RDB depends on the values of RTB and HTB. When the value of HTB is zero, that is, when sending data for the first time, the real-time detected bandwidth data is used as the value of RDB at this time; when HTB is not zero, we use the average of the two numbers of RTB and the average of HTB to improve the bandwidth predictability of RDB and quickly respond to network changes. The RDB calculation example is as follows:

[0135] When the first blockchain node Node1 needs to send data to other blockchain nodes (such as the second blockchain node), the RDB is calculated through the following formula:

[0136]

[0137] It means that the sum of the historical real-time transmission bandwidth values of the first blockchain and the second blockchain is zero, indicating that there is no record of the real-time transmission bandwidth value in history.

[0138] In an alternative implementation, when obtaining blocks, a similar method to steps 101 to 104 can also be adopted. Specifically:

[0139] The first blockchain node determines multiple block data to be obtained from the second blockchain node.

[0140] The first blockchain node splits the multiple block data into multiple segments of block data according to a second preset sharding strategy.

[0141] Any segment of the multiple segments of block data is less than the real-time transmission bandwidth value.

[0142] The first blockchain node obtains the multiple segments of block data from the second blockchain node in multiple times and segment by segment.

[0143] Step (2-1): When the first blockchain node (assuming the block height of the first blockchain node is N) is a new node or a downed node, after the first blockchain node reconnects to the blockchain, it broadcasts a message about its own status to the blockchain.

[0144] Step (2-2): After the first blockchain node receives the statuses of other blockchain nodes in the blockchain, it obtains the block height information (assuming the block height is M) and compares it with its own block height N.

[0145] Step (2-3): If the first blockchain node is a newly added blockchain node, then the difference in block height between the newly added blockchain node and other blockchain nodes in the blockchain is M at this time; if the first blockchain node is a downed blockchain node, the difference in block height from other blockchain nodes in the blockchain is M - N; if M or M - N is not zero, at this time, the process of obtaining blockchain data in the blockchain node is started, and the specific obtaining method can be downloading.

[0146] Step (2-4): The first blockchain node calculates the real-time transmission bandwidth value RTB between the first blockchain node and each other blockchain node in the blockchain by the methods of steps (a) to (d).

[0147] After obtaining the real-time transmission bandwidth value, calculate the range of block heights that need to be read from each blockchain node according to the real-time transmission bandwidth value.

[0148] Step (2-6): For each blockchain node, such as the second blockchain node, the first blockchain node needs to request different amounts of block data from the second blockchain node according to the range of block heights between the first blockchain node and the second blockchain node. (Assume that the size of the block data to be obtained from the blockchain node Node2 is Snode2).

[0149] Step (2-7): When Snode2 is larger than the real-time transmission bandwidth value obtained in step (2-4), the multiple block data to be obtained can be fragmented, and each fragmented block data is smaller than the real-time transmission bandwidth value, and the fragmented block data is obtained; when Snode2 is smaller than the real-time transmission bandwidth value obtained in step (2-4), directly request the data of this node Snode2 to complete the synchronization of the block data.

[0150] Repeat step (2-6) and step (2-7) to complete the synchronization of the multiple segments of block data, so as to obtain the multiple segments of block data from the second blockchain node in multiple times and by segments, and complete the synchronization of the multiple segments of block data.

[0151] As Figure 2 shown, the present invention provides a transaction data transmission device for a blockchain, including:

[0152] An acquisition module 201, configured to acquire transaction data to be transmitted;

[0153] A determination module 202, configured to determine the real-time transmission bandwidth value of the transmission channel with the second blockchain node;

[0154] A processing module 203, configured to, if the transaction data to be transmitted is greater than the real-time transmission bandwidth value, split the transaction data to be transmitted into multiple transaction data segments according to a first preset fragmentation strategy; any one of the multiple transaction data segments is smaller than the real-time transmission bandwidth value; transmit the multiple transaction data segments to the second blockchain node one by one in multiple times.

[0155] Optionally, the determination module 202 is specifically configured to:

[0156] Detect the transmission channel and determine the real-time detection bandwidth value of the transmission channel;

[0157] Determine the real-time transmission bandwidth value at least according to the real-time detection bandwidth value.

[0158] Optionally, the determination module 202 is specifically configured to:

[0159] If the target dynamic range does not meet the detection termination condition, execute:

[0160] Send a detection message with a target length to the second blockchain node; the target length is within the target dynamic range;

[0161] If the detection success response message of the detection message is not received, update the upper limit value of the target dynamic range according to the target length, so that the upper limit value of the range is not greater than the target length; return to the step of sending a detection message with a target length to the second blockchain node;

[0162] If a detection success response message for the detected message is received, update the lower limit value of the target dynamic range according to the target length, so that the lower limit value is not less than the target length; return to the step of sending a detection message of the target length to the second blockchain node.

[0163] When the target dynamic range meets the detection termination condition, use the target length as the real-time detection bandwidth value.

[0164] Optionally, the target length is the median of the target dynamic range; the determining module 202 is specifically configured to: use the target length as the upper limit value of the updated target dynamic range according to the target length; use the target length as the lower limit value of the updated target dynamic range according to the target length.

[0165] Optionally, the determining module 202 is specifically configured to: if there is at least one historical transmission bandwidth value of the transmission channel, determine the real-time transmission bandwidth value according to the at least one historical transmission bandwidth value and the real-time detection bandwidth value.

[0166] Optionally, the determining module 202 is specifically configured to: determine the first average value of the at least one historical transmission bandwidth value; use the second average value of the first average value and the real-time detection bandwidth value as the real-time transmission bandwidth value.

[0167] Optionally, the determining module 202 is further configured to: determine a plurality of block data to be obtained from the second blockchain node.

[0168] The processing module 203 is further configured to:

[0169] Split the plurality of block data into multiple segments of block data according to a second preset sharding strategy; any segment of the multiple segments of block data is less than the real-time transmission bandwidth value; obtain the multiple segments of block data from the second blockchain node in multiple times and segment by segment.

[0170] Based on the same inventive concept, an embodiment of the present invention further provides a computer device, including a program or instruction, when the program or instruction is executed, the transaction data transmission method of the blockchain provided by the embodiment of the present invention and any optional method are executed.

[0171] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium, including a program or instruction, when the program or instruction is executed, the transaction data transmission method of the blockchain provided by the embodiment of the present invention and any optional method are executed.

[0172] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.

Claims

1. A method for transmitting transaction data of a blockchain, characterized in that, Including: The first blockchain node obtains the transaction data to be transmitted; The first blockchain node determines the real-time transmission bandwidth value of the transmission channel between the first blockchain node and the second blockchain node; If the transaction data to be transmitted is greater than the real-time transmission bandwidth value, the first blockchain node splits the transaction data to be transmitted into multiple transaction data segments according to the first preset sharding strategy; any one of the multiple transaction data segments is less than the real-time transmission bandwidth value; The first blockchain node transmits the multiple transaction data segments to the second blockchain node one by one in multiple times; Among them, the first blockchain node determines the real-time transmission bandwidth value of the transmission channel between the first blockchain node and the second blockchain node, including: If the target dynamic interval does not meet the detection termination condition, and the detection termination condition is that the length of the target dynamic interval is greater than the preset length, then execute: The first blockchain node sends a detection message with a target length to the second blockchain node; the target length is within the target dynamic interval; If the first blockchain node does not receive the detection success response message of the detection message, then according to the target length, update the upper limit value of the target dynamic interval so that the upper limit value is not greater than the target length; return to the step of the first blockchain node sending a detection message with a target length to the second blockchain node; If the first blockchain node receives the detection success response message of the detection message, then according to the target length, update the lower limit value of the target dynamic interval so that the lower limit value is not less than the target length; return to the step of the first blockchain node sending a detection message with a target length to the second blockchain node; When the target dynamic interval meets the detection termination condition, the first blockchain node takes the target length as the real-time detection bandwidth value; The first blockchain node determines the real-time transmission bandwidth value according to the real-time detection bandwidth value.

2. The method according to claim 1, characterized in that, The target length is the median value of the target dynamic interval; The updating the upper limit value of the target dynamic interval according to the target length so that the upper limit value is not greater than the target length includes: According to the target length, taking the target length as the updated upper limit value of the target dynamic interval; The updating the lower limit value of the target dynamic interval according to the target length so that the lower limit value is not less than the target length includes: According to the target length, taking the target length as the updated lower limit value of the target dynamic interval.

3. The method according to claim 1, wherein The first blockchain node determines the real-time transmission bandwidth value according to the real-time detection bandwidth value, including: If there is at least one historical transmission bandwidth value of the transmission channel, the first blockchain node determines the real-time transmission bandwidth value according to the at least one historical transmission bandwidth value and the real-time detection bandwidth value.

4. The method according to claim 3, wherein The first blockchain node determines the real-time transmission bandwidth value according to the at least one historical transmission bandwidth value and the real-time detection bandwidth value, including: The first blockchain node determines the first mean value of the at least one historical transmission bandwidth value; The first blockchain node uses the first mean value and the second mean value of the real-time detection bandwidth value as the real-time transmission bandwidth value.

5. The method according to any one of claims 1 to 4, characterized in that, Further included: The first blockchain node determines a plurality of block data to be obtained from the second blockchain node; The first blockchain node splits the plurality of block data into multiple segments of block data according to a second preset sharding strategy; Any segment of the multiple segments of block data is less than the real-time transmission bandwidth value; The first blockchain node obtains the multiple segments of block data from the second blockchain node in multiple times, segment by segment.

6. A transaction data transmission device for a blockchain, characterized in that, Including: An acquisition module, configured to acquire transaction data to be transmitted; A determination module, configured to determine the real-time transmission bandwidth value of the transmission channel between the first blockchain node and the second blockchain node; A processing module, configured to, if the transaction data to be transmitted is greater than the real-time transmission bandwidth value, split the transaction data to be transmitted into multiple transaction data segments according to a first preset sharding strategy; any transaction data segment of the multiple transaction data segments is less than the real-time transmission bandwidth value; and transmit the multiple transaction data segments to the second blockchain node one by one in multiple times; Wherein, the determination module is specifically configured to: If the target dynamic interval does not meet the detection termination condition, and the detection termination condition is that the length of the target dynamic interval is greater than a preset length, then execute: Send a detection message with a target length to the second blockchain node; the target length is within the target dynamic interval; If a detection success response message of the detection message is not received, then update the upper limit value of the target dynamic interval according to the target length, so that the upper limit value is not greater than the target length; return to the step of sending a detection message with a target length to the second blockchain node; If a detection success response message of the detection message is received, then update the lower limit value of the target dynamic interval according to the target length, so that the lower limit value is not less than the target length; return to the step of sending a detection message with a target length to the second blockchain node; When the target dynamic interval meets the detection termination condition, use the target length as the real-time detection bandwidth value; Determine the real-time transmission bandwidth value according to the real-time detection bandwidth value.

7. A computer-readable storage medium, characterized in that, Including a program or instruction, when the program or instruction is executed, the method according to any one of claims 1 to 5 is executed.

Citation Information

Patent Citations

  • An electronic security system based on block chain

    CN109213452A