Methods, apparatus, equipment, storage media, and program products for broadcasting transaction data
By setting up n-level intermediate nodes for consensus nodes in the blockchain network and determining the transmission path, the problem of low efficiency in blockchain broadcasting is solved, achieving more efficient transaction data transmission and reducing the risk of broadcast storms.
Patent Information
- Application Number
- CN202411995995.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Broadcasting in blockchain networks is inefficient and prone to creating broadcast storms, leading to network congestion and reducing the overall efficiency of the blockchain.
Set up n-level intermediate nodes for the consensus nodes in the blockchain, determine the transmission path of the target block based on the consensus nodes and n-level intermediate nodes, and broadcast the target block through the transmission path.
It improves the broadcast efficiency of the blockchain, reduces the risk of broadcast storms, and ensures network stability and efficient transmission.
Smart Images

Figure CN119788263B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to a method, apparatus, device, storage medium, and program product for broadcasting transaction data. Background Technology
[0002] Blockchain is a distributed, shared ledger and database characterized by decentralization, immutability, full traceability, accountability, collective maintenance, and transparency. In practice, a blockchain typically has multiple nodes. When a node receives transaction data, it usually caches the data in its corresponding transaction pool before packaging the transactions in the pool to generate blocks. To ensure that all nodes on the same blockchain have the same and complete ledger, a node receiving transaction data typically broadcasts the received data to other nodes on the same blockchain.
[0003] In related technologies, after any participating node in a blockchain network generates transaction data, it needs to broadcast the transaction data to the other participating nodes in the blockchain network so that each participating node can receive and record the transaction data, thereby forming an effective supervision mechanism to prevent cheating among participating nodes. However, this method suffers from low blockchain broadcasting efficiency in some scenarios. Summary of the Invention
[0004] This application provides a transaction data broadcasting method, apparatus, device, storage medium, and program product to solve the problem of low efficiency in blockchain broadcasting in some scenarios in related technologies.
[0005] In a first aspect, this application provides a transaction data broadcasting method, comprising: acquiring target transaction data; packaging the target transaction data into blocks to generate a target block; determining an n-level intermediate node of the consensus node in the blockchain based on the participating nodes in the blockchain; determining the transmission path of the target block based on the consensus node and the n-level intermediate node, and broadcasting the target block through the transmission path.
[0006] Secondly, this application provides a transaction data broadcasting system, which is deployed on each node in a blockchain system. The node includes: a consensus node and participating nodes; the consensus node is used to implement the transaction data broadcasting method provided in the first aspect; the participating nodes are used to send transaction data to the consensus node after generating transaction data, and as an n-level intermediate node of the consensus node, it is used to broadcast the target block generated by the consensus node.
[0007] Thirdly, this application provides a transaction data broadcasting device, comprising:
[0008] The acquisition module is used to acquire target transaction data;
[0009] The generation module is used to package the target transaction data into blocks and generate the target block.
[0010] The first determining module is used to determine the nth-level intermediate node of the consensus node in the blockchain based on the participating nodes in the blockchain;
[0011] The second determining module is used to determine the transmission path of the target block based on the consensus node and the n-level intermediate nodes, and to broadcast the target block through the transmission path.
[0012] Fourthly, this application provides an electronic device, including a processor and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the transaction data broadcasting method provided in the first aspect above.
[0013] Fifthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the transaction data broadcasting method provided in the first aspect above.
[0014] In a sixth aspect, this application provides a computer program product, including a computer program that, when executed by a processor, implements the transaction data broadcasting method as described in the first aspect above.
[0015] The transaction data broadcasting method, apparatus, device, storage medium, and program product provided in this application acquire target transaction data, package the target transaction data into blocks to generate target blocks, and determine n-level intermediate nodes of the consensus nodes in the blockchain based on the participating nodes. Furthermore, based on the consensus nodes and the n-level intermediate nodes, the transmission path of the target block is determined, and the target block is broadcast through the transmission path. This application, by setting n-level intermediate nodes for the consensus nodes in the blockchain and determining the transmission path for the target block based on the n-level intermediate nodes corresponding to the consensus nodes, ensures that each participating node in the blockchain only receives and broadcasts a limited number of transaction data from participating nodes, thereby improving the broadcasting efficiency of the blockchain and reducing the risk of broadcast storms. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0017] Figure 1 This is a schematic diagram of the structure of the transaction data broadcasting system provided in the embodiments of this application;
[0018] Figure 2 Flowchart of the transaction data broadcasting method provided in the embodiments of this application Figure 1 ;
[0019] Figure 3 Flowchart of the transaction data broadcasting method provided in the embodiments of this application Figure 2 ;
[0020] Figure 4 A schematic diagram of the transmission path provided in the embodiments of this application;
[0021] Figure 5 This is a schematic diagram of the structure of the transaction data broadcasting device provided in the embodiments of this application;
[0022] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0023] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0024] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0025] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of the relevant data all comply with the relevant laws, regulations, and standards of the relevant countries and regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation access points for users to choose to authorize or refuse.
[0026] Furthermore, the technical solution involved in this application, which involves big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.) and the use of artificial intelligence technology for automated decision-making, and makes decisions that have a significant impact on personal rights based on the results of automated decision-making, provides users with corresponding operation entry points for users to choose to agree to or reject the results of automated decision-making; if the user chooses to reject, the process will proceed to the expert decision-making process.
[0027] It should be noted that the trading portfolio recommendation method, apparatus, equipment, storage medium and product provided in this application can be used in the fintech field, or in any field other than fintech. This application does not limit the application field of the trading portfolio recommendation method, apparatus, equipment, storage medium and product.
[0028] The following section will first explain the technical terms used in the embodiments of this application.
[0029] Broadcast storm: A broadcast occurs when a data packet or frame is transmitted to every node on a local network segment (defined by the broadcast domain). The sheer number of broadcast frames on the network increases dramatically due to forwarding, leading to abnormal network communication. Broadcast storms consume a considerable amount of network bandwidth, preventing normal data packets from functioning correctly. When broadcast data floods the network, becoming unprocessable and consuming excessive bandwidth, causing normal services to malfunction, a broadcast storm has occurred. Broadcast storms can paralyze a portion or the entire local area network.
[0030] Blockchain node: Any computer connected to a blockchain network is called a node. Direct data transmission between nodes is possible in a blockchain network.
[0031] Consensus node: A node that participates in consensus voting, transaction execution, block verification, and accounting in a blockchain network.
[0032] In related technologies, after any participating node in a blockchain network generates transaction information, it needs to broadcast this information to the other participating nodes in the network so that each node can receive and record it, thus forming an effective monitoring mechanism to prevent cheating among participating nodes. However, when the number of participating nodes in the blockchain network is large, if each node needs to broadcast its transaction data to the network after generating it, a broadcast storm can easily form, leading to network congestion and reducing the broadcast efficiency of the blockchain.
[0033] Based on the technical problems existing in related technologies, the embodiments of this application set up n-level intermediate nodes for the consensus nodes in the blockchain, and determined the transmission path for transmitting the target block according to the n-level intermediate nodes corresponding to the consensus nodes. This enables each participating node in the blockchain to receive and broadcast only a quantitative and small amount of transaction data from participating nodes, which can improve the broadcast efficiency of the blockchain and reduce the risk of broadcast storms.
[0034] The application scenarios of the embodiments of this application will be described in detail below.
[0035] The transaction data broadcasting method, apparatus, device, storage medium, and program product provided in this application embodiment can be applied to a scenario where transaction data broadcasting occurs in a blockchain network containing a large number of participating nodes.
[0036] It is understood that the above is only one application scenario applicable to the embodiments of this application. The embodiments of this application do not limit the specific application scenario, and the specific application scenario can be determined according to the actual application needs.
[0037] Figure 1 This is a schematic diagram of the structure of a transaction data broadcasting system provided in an embodiment of this application. Figure 1 As shown, the transaction data broadcasting system is deployed on each node in the blockchain system, which includes consensus nodes and participating nodes;
[0038] The consensus node is used to implement the transaction data broadcasting method provided in the embodiments of this application.
[0039] Participating nodes are used to send transaction data to the consensus node after generating transaction data, and as n-level intermediate nodes of the consensus node, they are used to receive the target block generated by the consensus node and / or broadcast the target block generated by the consensus node.
[0040] It is understandable that when the participating node is the endpoint node, there is no need to broadcast the target block generated by the consensus node.
[0041] For example, this application embodiment does not limit the number of consensus nodes and participating nodes in the blockchain; the specific number can be determined according to the actual application requirements.
[0042] The transaction data broadcasting method provided in this application aims to solve the above-mentioned technical problems of the prior art.
[0043] The following is based on the above. Figure 1The consensus node shown is the execution entity. The technical solution of this application and how it solves the aforementioned technical problems will be described in detail with reference to specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0044] Figure 2 Flowchart of the transaction data broadcasting method provided in the embodiments of this application Figure 1 .like Figure 2 As shown, the specific implementation of this transaction data broadcasting method may include the following steps:
[0045] S201, Obtain target transaction data.
[0046] For example, the target transaction data can be transaction data generated by participating nodes in the blockchain.
[0047] For example, the target transaction data may include transaction identifiers, transaction input information, transaction output information, and timestamps.
[0048] For example, the target transaction data may contain one transaction or multiple transaction data. This application does not limit the specific number of transaction data in the target transaction data; it can be determined according to the actual application requirements.
[0049] In one possible implementation, the target transaction data can be the transaction data sent from participating nodes in the blockchain to the consensus node within a preset time period.
[0050] For example, the preset time period can be 30 seconds or 1 minute, etc. This application does not limit this; the specific time period can be determined according to the actual application requirements.
[0051] S202, package the target transaction data into blocks to generate the target block.
[0052] In this step, one possible implementation is that when the target transaction data contains only one transaction, the target transaction data is packaged into a block to generate the target block; when the target transaction data contains multiple transaction data, the multiple transaction data in the target transaction data are sorted according to the chronological order of the timestamps corresponding to each transaction data, and the sorted transaction data is packaged into a block to obtain the target block.
[0053] For example, one possible implementation of packaging the sorted transaction data into blocks to obtain the target block is to package each transaction data into a block, that is, the target block contains multiple different blocks; another possible implementation is to package a preset number of transaction data into a block, for example, the preset number can be 3, 5, etc.; in one possible implementation, multiple transaction data in the target transaction data can be packaged into a block, that is, the target block.
[0054] It should be noted that when the target transaction data contains multiple transaction data, this application does not limit the number of blocks in the generated target block; the specific number can be determined according to the actual application requirements.
[0055] S203, based on the participating nodes in the blockchain, determine the nth-level intermediate node of the consensus node in the blockchain.
[0056] For example, participating nodes can be the remaining nodes in the blockchain other than the consensus node.
[0057] For example, n can be any positive integer greater than 1.
[0058] For example, an n-level intermediate node is used to receive the target block generated by the consensus node, and / or broadcast the target block generated by the consensus node.
[0059] For example, the n-level intermediate nodes include at least one participating node, which is used to receive the target block generated by the consensus node and / or broadcast the target block generated by the consensus node.
[0060] For example, when n is 3, the level 2 intermediate node is used to receive the target block sent by the level 1 intermediate node and broadcast the target block to the level 3 intermediate node, and then broadcast the target block to all participating nodes in the blockchain.
[0061] S204: Based on the consensus node and the n-level intermediate node, determine the transmission path of the target block and broadcast the target block through the transmission path.
[0062] For example, the starting node of the transmission path can be a consensus node in the blockchain.
[0063] For example, the transmission path can be a tree structure.
[0064] For example, when there are 5 participating nodes in the blockchain and n is 3, if the first-level intermediate nodes of the consensus node are Node 1 and Node 2, and the second-level intermediate node corresponding to Node 1 in the first-level intermediate node is Node 4, and the second-level intermediate nodes corresponding to Node 2 in the first-level intermediate node are Node 3 and Node 5, then the transmission path can be that the consensus node transmits to Node 1 and Node 2 respectively, Node 1 transmits to Node 4, and Node 2 transmits to Node 3 and Node 5 respectively. Specifically, the transmission path can include a transmission path consisting of the consensus node, Node 1, and Node 4; a transmission path consisting of the consensus node, Node 2, and Node 3; and a transmission path consisting of the consensus node, Node 2, and Node 5.
[0065] In this embodiment, target transaction data is acquired, packaged, and processed to generate a target block. Based on the participating nodes in the blockchain, an n-level intermediate node is determined for the consensus nodes. Furthermore, based on the consensus nodes and the n-level intermediate nodes, a transmission path for the target block is determined, and the target block is broadcast through this path. This embodiment, by setting an n-level intermediate node for the consensus nodes in the blockchain and determining the transmission path for the target block based on the n-level intermediate nodes corresponding to the consensus nodes, ensures that each participating node in the blockchain only receives and broadcasts a limited number of transaction data from other participating nodes. This improves the broadcast efficiency of the blockchain and reduces the risk of broadcast storms.
[0066] Optionally, step S203, which determines the nth-level intermediate node of the consensus node in the blockchain based on the participating nodes in the blockchain, can be implemented by determining the nth-level intermediate node of the consensus node based on the participating nodes and the n-1th-level intermediate nodes of the consensus node in the blockchain.
[0067] For example, if there are multiple participating nodes among the n-1 level intermediate nodes, then each participating node can correspond to an n-level intermediate node, except when the participating node is the endpoint node.
[0068] It is understandable that the nth level intermediate node of a consensus node is also the nth level intermediate node of the (n-1)th level intermediate node in a consensus node.
[0069] In this embodiment, intermediate nodes of consensus nodes are determined in a hierarchical manner, and the transmission path of the target block is determined based on the hierarchical intermediate nodes and consensus nodes. This enables each participating node in the blockchain to receive and broadcast only a quantitative and small number of transaction data from participating nodes, thereby improving the broadcast efficiency of the blockchain and reducing the risk of broadcast storms.
[0070] The following is combined Figure 3This paper provides a detailed explanation of the specific implementation method for determining the nth-level intermediate node of the consensus node based on the n-1 level intermediate nodes of the participating nodes and consensus nodes in the blockchain.
[0071] Figure 3 Flowchart of the transaction data broadcasting method provided in the embodiments of this application Figure 2 .like Figure 3 As shown, the specific implementation of determining the nth-level intermediate node of the consensus node based on the participating nodes and the (n-1)th-level intermediate nodes of the consensus node in the blockchain may include the following steps:
[0072] S301, determine that the participating node in the blockchain that is less than the distance to the n-1 level intermediate node and is currently in the spatial state and does not belong to the intermediate node is a selectable node of the n level intermediate node.
[0073] In one possible implementation, the distance between each participating node in the n-1 level intermediate nodes and other participating nodes in the blockchain that are not intermediate nodes is calculated, and the participating nodes whose distance is less than a preset threshold are determined as target participating nodes. Furthermore, among the target participating nodes, the target participating nodes that are currently in an idle state are selected as optional nodes of the n-level intermediate nodes.
[0074] For example, the distance between nodes can be measured by network hop count or bandwidth consumption, or by network latency, or by the physical distance between node pairs. In the transaction data broadcasting method provided in this application embodiment, the method of measuring the distance between nodes is not limited; it can be determined according to the actual application requirements.
[0075] For example, the target participating node that is currently in an idle state can be a participating node that has not yet received a relevant broadcast.
[0076] S302, for each optional node in the n-level intermediate nodes, estimate the score of the optional node based on the node information corresponding to the optional node.
[0077] For example, node information can include central processing unit (CPU) utilization, network bandwidth response time, and transactions per second (TPS) or similar metrics.
[0078] Understandably, the lower the CPU utilization of an optional node, the more processing power it has available; the shorter the network bandwidth response time of an optional node, the faster its network connection; and the higher its TPS (transactions per second), the more transaction data it can process.
[0079] Assuming CPU utilization ranges from 0% to 100%, network bandwidth response time ranges from 0 to maximum latency, and TPS ranges from 0 to maximum TPS, one possible implementation is to use the difference between 100% and the current CPU utilization as the CPU utilization score, the difference between the maximum latency and the current latency as the network bandwidth response time score, and the current TPS as the TPS score. Furthermore, weighting coefficients are assigned to each node based on the specific application scenario, and the score for each selectable node is calculated using a weighted average.
[0080] S303: Sort the optional nodes in the n-level intermediate nodes according to the score corresponding to each optional node, in descending order of score, and select the top m. n Each optional node is an n-level intermediate node.
[0081] For example, m is a positive integer greater than 1.
[0082] For example, when m is 2 and n is 2, the corresponding level 2 intermediate node contains 4 optional nodes.
[0083] It is understandable that the optional nodes included in the n-level intermediate nodes are the participating nodes in the blockchain.
[0084] For example, the value of m can be determined based on the number of participating nodes in the blockchain.
[0085] It should be noted that the specific size of m in the transaction data broadcasting method provided in this application embodiment is not limited, and can be determined according to the actual application requirements.
[0086] Optionally, if the number of optional nodes of any n-level intermediate node is no greater than m and is not 0, then all optional nodes in the n-level intermediate node are treated as n-level intermediate nodes.
[0087] In this embodiment, participating nodes in the blockchain that are less than a preset threshold in distance from level n-1 intermediate nodes, are currently idle, and are not intermediate nodes are considered as potential nodes for level n intermediate nodes. For each potential node in level n intermediate nodes, a score is estimated based on the node information. Furthermore, the potential nodes in level n intermediate nodes are sorted according to their scores from highest to lowest, and the top m nodes are selected. n The selectable nodes are n-level intermediate nodes. In this embodiment, by determining the n-level intermediate nodes based on the node distance and node information among the participating nodes in the blockchain, the effective selection and configuration of intermediate nodes in the blockchain can be achieved, thereby improving the broadcast efficiency of the blockchain.
[0088] Understandably, compared to related technologies where a participating node broadcasts transaction data to all other participating nodes in the blockchain, the transaction data broadcasting method provided in this application embodiment involves the consensus node broadcasting the target block to the first intermediate node, and then the first intermediate node broadcasting the target block to the second intermediate node, and so on, until the target block is broadcast to the endpoint node, thereby reducing the risk of broadcast storms from the source.
[0089] Optionally, in the transaction data broadcasting method provided in this application embodiment, the first-level intermediate nodes of the consensus node are determined in the following way: determining the participating nodes in the blockchain that are less than a preset threshold distance from the consensus node and are currently in a spatial state as optional nodes of the first-level intermediate nodes; for each optional node in the first-level intermediate nodes, estimating the score of the optional node based on the node information corresponding to the optional node; sorting the optional nodes in the first-level intermediate nodes according to the score corresponding to each optional node in descending order of score, and selecting the first m optional nodes as first-level intermediate nodes.
[0090] The method for determining the distance between participating nodes and consensus nodes in a blockchain is similar to that described above, and will not be repeated here.
[0091] The estimation method for the scores of optional nodes is similar to that described above, and will not be repeated here.
[0092] In this embodiment, the first-level intermediate node of the consensus node is determined by the participating nodes and consensus nodes in the blockchain, and then the nth-level intermediate node of the consensus node is determined sequentially based on the first-level intermediate node, so as to realize the effective selection and configuration of intermediate nodes in the blockchain, thereby improving the broadcast efficiency of the blockchain.
[0093] Optionally, if the number of selectable nodes for an n-level intermediate node is 0, then the n-level intermediate node is determined as the endpoint node of the intermediate nodes, and the endpoint node does not issue a broadcast.
[0094] For example, the endpoint node may contain at least one participating node.
[0095] It is understandable that the participating nodes in the endpoint node can be the last node in the blockchain to receive the target block, that is, in response to the endpoint node receiving the target block, every participating node in the blockchain has received the target block.
[0096] It is understood that in the transaction data broadcasting method provided in this application embodiment, apart from the consensus node, all other participating nodes in the blockchain can be n-level intermediate nodes or endpoint nodes.
[0097] In this embodiment, the target block is broadcast to the blockchain network by determining the n-level intermediate node, which has no selectable nodes, as the endpoint node, thereby determining the intermediate node in a hierarchical manner.
[0098] Optionally, for any optional node among the intermediate nodes of any n-level node, if in the sequence obtained after sorting based on the scores of the optional nodes, the m-th node... n If an optional node has the same score as several adjacent optional nodes, then one of these optional nodes is randomly selected as the intermediate node of level n.
[0099] For example, suppose the sequence of possible nodes in the n-level intermediate nodes, sorted from highest to lowest score, is node 1, node 2, node 3, node 4, node 5, and node 6. When m and n are both 2, there are 4 possible nodes in the n-level intermediate nodes. In this scenario, if nodes 2, 3, 4, 5, and 6 have the same score, then the possible nodes in the n-level intermediate nodes can be node 1, 2, 3, and 4; or node 1, 3, 4, and 5; or node 1, 2, 4, and 6, etc.
[0100] In this embodiment of the application, in the sequence obtained after sorting based on the scores of optional nodes, the m-th node... n When an optional node has the same score as several adjacent optional nodes, one of these optional nodes can be randomly selected as an n-level intermediate node. This allows for flexibility in selecting n-level intermediate nodes and also ensures the effective selection and configuration of intermediate nodes in the blockchain.
[0101] Optionally, one possible implementation of determining the transmission path of the target block based on the consensus node and the n-level intermediate nodes in step S204 is as follows: set up a routing table based on the consensus node and the n-level intermediate nodes; and determine the transmission path of the target block based on the routing table.
[0102] For example, a first route is set based on the consensus node and the first-level intermediate node, a second route is set based on the first route and the second-level intermediate node, and so on, to obtain a routing table containing multiple routes such as the first route and the second route. The consensus node is used as the starting node of the transmission path, and the first route and the second route in the routing table are connected in sequence to obtain the corresponding transmission path.
[0103] In this embodiment, a routing table is set up based on consensus nodes and n-level intermediate nodes, and then the transmission path of the target block is determined based on the routing table, thereby improving the broadcast efficiency and reliability of the blockchain.
[0104] Based on the transaction data broadcasting method provided in the above embodiments, the following examples illustrate the determination of the n-level intermediate nodes of the consensus node and the transmission path.
[0105] Assume the nodes in the blockchain include node 1, node 2, node 3, node 4, node 5, node 6, node 7, node 8, node 9, and node 10. Among them, node 1 is the consensus node, and nodes 2 to 10 are participating nodes, with m taking the value of 2.
[0106] First, determine the consensus node, i.e., the first-level intermediate node of node 1: If the distance to the consensus node is less than a preset threshold, and the participating nodes currently in an idle state include nodes 2 and 3, then the number of selectable nodes for the first-level intermediate node is no greater than m and is not 0, and nodes 2 and 3 are determined as the first-level intermediate nodes of the consensus node.
[0107] Determine the second-level intermediate nodes of the consensus node, i.e., the second-level intermediate nodes of the first-level intermediate nodes: For node 2, a first-level intermediate node, if the distance to node 2 is less than a preset threshold, and it is not currently an intermediate node, and the participating nodes currently in an idle state include node 4, then node 4 is selected as a potential node for node 2, the number of potential nodes for node 2 is no greater than m and is not 0, and node 4 is determined as a second-level intermediate node for node 2; For node 3, a first-level intermediate node, if the distance to node 3 is less than a preset threshold, and it is not currently an intermediate node, and the participating nodes currently in an idle state include nodes 5 and 6, then nodes 5 and 6 are selected as potential nodes for node 3, a first-level intermediate node, the number of potential nodes for node 1 is no greater than m and is not 0, and nodes 5 and 6 are determined as second-level intermediate nodes for node 3;
[0108] The third-level intermediate nodes of the consensus node are determined, i.e., the third-level intermediate nodes of the second-level intermediate nodes: For node 4, a second-level intermediate node, if the distance to node 4 is less than a preset threshold, and it is not currently an intermediate node, and there are no currently idle participating nodes, then node 4 is determined as the endpoint node of the transmission path from the consensus node to node 2 and then to node 4, and node 4 does not need to broadcast; For node 5, a second-level intermediate node, if the distance to node 5 is less than a preset threshold, and it is not currently an intermediate node, and the currently idle participating nodes include nodes 7, 8, and 9, then nodes 7, 8, and 9 are selected as potential nodes for node 5, a second-level intermediate node. If the number of potential nodes for node 2 is greater than m, then nodes 7, 8, and 9 are further selected. The scores corresponding to nodes 8 and 9 are determined as follows: if the scores are arranged in descending order as nodes 7, 8, and 9, then nodes 7 and 8 are determined as level 3 intermediate nodes of node 5; if the scores are arranged in descending order as nodes 7, 8, and 9, then nodes 7 and 8 are determined as level 3 intermediate nodes of node 5, or nodes 7 and 9 are determined as level 3 intermediate nodes of node 5. For node 6, a level 2 intermediate node, if the distance to node 6 is less than a preset threshold and it is not an intermediate node, and the currently idle participating nodes include node 10, then node 10 is determined as a possible node of node 6. The number of possible nodes of node 6 is not greater than m and is not 0. Therefore, node 10 is determined as a level 3 intermediate node of node 6.
[0109] It is understood that in the embodiments of this application, nodes 7, 8, 9 and 10 are also endpoint nodes.
[0110] The transmission path obtained based on the above consensus nodes and intermediate nodes can be as follows: Figure 4 As shown.
[0111] Figure 4 This is a schematic diagram of the transmission path provided in an embodiment of this application. (For example...) Figure 4 As shown, the transmission path includes a first transmission path consisting of consensus node, node 2 and node 4, a second transmission path consisting of consensus node, node 3, node 5 and node 7, a third transmission path consisting of consensus node, node 3, node 5 and node 8, and a fourth transmission path consisting of consensus node, node 3, node 6 and node 10.
[0112] It is understandable that when the third-level intermediate nodes of node 5 are nodes 7 and 9, the corresponding transmission path can also be a fifth transmission path consisting of the consensus node, node 3, node 5, and node 9. Figure 4 (Not shown in the image).
[0113] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0114] Figure 5 This is a schematic diagram of the transaction data broadcasting device provided in an embodiment of this application. Figure 5 As shown, the transaction data broadcasting device 50 includes an acquisition module 510, a generation module 520, a first determination module 530, and a second determination module 540.
[0115] Among them, the acquisition module 510 is used to acquire target transaction data;
[0116] The generation module 520 is used to package the target transaction data into blocks and generate the target block;
[0117] The first determining module 530 is used to determine the n-level intermediate node of the consensus node in the blockchain based on the participating nodes in the blockchain.
[0118] The second determining module 540 is used to determine the transmission path of the target block based on the consensus node and the n-level intermediate node, and broadcast the target block through the transmission path.
[0119] In one possible implementation, the first determining module 530 is specifically used to: determine the nth-level intermediate node of the consensus node based on the participating nodes and the n-1th-level intermediate nodes of the consensus node in the blockchain.
[0120] In one possible implementation, the first determining module 530 is further configured to: determine participating nodes in the blockchain whose distance to the (n-1)th level intermediate nodes is less than a preset threshold, are currently idle, and are not intermediate nodes, as optional nodes for the nth level intermediate nodes; for each optional node in the nth level intermediate nodes, estimate the score of the optional node based on the node information corresponding to the optional node; sort the optional nodes in the nth level intermediate nodes according to the score corresponding to each optional node, in descending order of score, and select the top m n Each optional node is an n-level intermediate node.
[0121] In one possible implementation, the Level 1 intermediate nodes of the consensus node are determined as follows: Participating nodes in the blockchain that are less than a preset threshold distance from the consensus node and are currently in a spatial state are identified as potential Level 1 intermediate nodes; for each potential node in the Level 1 intermediate nodes, the score of the potential node is estimated based on the node information corresponding to the potential node; the potential nodes in the Level 1 intermediate nodes are sorted according to their scores from highest to lowest, and the first m potential nodes are selected as Level 1 intermediate nodes.
[0122] In one possible implementation, if the number of selectable nodes for an n-level intermediate node is 0, then the n-level intermediate node is determined to be the endpoint node of the intermediate nodes, and the endpoint node does not issue a broadcast.
[0123] In one possible implementation, for any optional node among the intermediate nodes of level n, if in the sequence obtained after sorting based on the scores of the optional nodes, the m-th node... n If an optional node has the same score as several adjacent optional nodes, then one of these optional nodes is randomly selected as the intermediate node of level n.
[0124] In one possible implementation, the second determining module 50 is specifically used to: set a routing table based on the consensus node and the n-level intermediate nodes; and determine the transmission path of the target block based on the routing table.
[0125] The transaction data broadcasting device provided in this embodiment can be used to execute the method steps of the above method embodiment. The specific implementation and technical effects are similar, and will not be described again here.
[0126] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device 60 includes at least one processor 610, a memory 620, a communication interface 630, and a system bus 640. The memory 620 and the communication interface 630 are connected to the processor 610 via the system bus 640 and communicate with each other. The memory 620 stores instructions, the communication interface 630 communicates with other devices, and the processor 610 calls the instructions in the memory to execute the method steps provided in the above method embodiments. The specific implementation and technical effects are similar and will not be described again here.
[0127] Should Figure 6 The system bus 640 mentioned can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This system bus 640 can be divided into address bus, data bus, control bus, etc. For ease of representation, it is represented by only one thick line in the diagram, but this does not indicate that there is only one bus or one type of bus.
[0128] The communication interface 630 is used to enable communication between the database access device and other devices (such as clients, read-write databases, and read-only databases).
[0129] The memory 620 may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0130] The processor 610 can be a general-purpose processor, including a central processing unit, a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0131] This application also provides a computer-readable storage medium storing computer-executable instructions. When executed by a processor, the computer-executable instructions are used to implement the method steps as described in the above method embodiments. The specific implementation methods and technical effects are similar and will not be repeated here.
[0132] This application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the method steps as described in the above method embodiments. The specific implementation and technical effects are similar, and will not be repeated here.
[0133] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0134] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0135] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0136] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0137] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0138] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, 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. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0139] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0140] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0141] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for broadcasting transaction data, characterized in that, include: Obtain target transaction data; The target transaction data is packaged into blocks to generate the target block; Based on the participating nodes in the blockchain, determine the nth-level intermediate node of the consensus node in the blockchain; Based on the consensus node and the n-level intermediate node, the transmission path of the target block is determined, and the target block is broadcast through the transmission path; The step of determining the nth-level intermediate node of the consensus node in the blockchain based on the participating nodes in the blockchain includes: Based on the participating nodes in the blockchain and the n-1 level intermediate nodes of the consensus node, determine the n-level intermediate node of the consensus node; The step of determining the nth-level intermediate node of the consensus node based on the participating nodes in the blockchain and the n-1 level intermediate nodes of the consensus node includes: The participating nodes in the blockchain that are less than a preset threshold distance from the n-1 level intermediate nodes, are currently in an idle state and are not intermediate nodes are selected as the n-level intermediate nodes; For each optional node in the n-level intermediate nodes, the score of the optional node is estimated based on the node information corresponding to the optional node; The optional nodes in the n-level intermediate nodes are sorted in descending order of their corresponding scores, and the top m nodes are selected. n Each optional node is an intermediate node of the nth level.
2. The transaction data broadcasting method according to claim 1, characterized in that, The first-level intermediate nodes of the consensus node are determined in the following way: The participating nodes in the blockchain that are less than a preset threshold distance from the consensus node and are currently in a spatial state are identified as optional nodes for the Level 1 intermediate node. For each optional node in the first-level intermediate nodes, the score of the optional node is estimated based on the node information corresponding to the optional node; The optional nodes in the first-level intermediate nodes are sorted according to the score corresponding to each optional node, and the first m optional nodes are selected as the first-level intermediate nodes.
3. The transaction data broadcasting method according to claim 1 or 2, characterized in that, If the number of selectable nodes for the nth-level intermediate node is 0, then the nth-level intermediate node is determined to be the endpoint node of the intermediate node, and the endpoint node does not issue a broadcast.
4. The transaction data broadcasting method according to claim 1 or 2, characterized in that, For any optional node in any n-level intermediate node, if in the sequence obtained after sorting based on the scores of the optional nodes, the m-th node... n If an optional node has the same score as several adjacent optional nodes, then one of these optional nodes is randomly selected as the intermediate node of level n.
5. The transaction data broadcasting method according to claim 1 or 2, characterized in that, Determining the transmission path of the target block based on the consensus node and the n-level intermediate nodes includes: Based on the consensus node and the n-level intermediate node, set up the routing table; The transmission path of the target block is determined based on the routing table.
6. A transaction data broadcasting system, characterized in that, The transaction data broadcasting system is deployed on each node of the blockchain system, and the nodes include: consensus nodes and participating nodes; The consensus node is used to implement the transaction data broadcasting method as described in any one of claims 1 to 5; The participating node is configured to send the transaction data to the consensus node after generating the transaction data, and as an n-level intermediate node of the consensus node, to receive the target block generated by the consensus node, and / or to broadcast the target block generated by the consensus node.
7. A transaction data broadcasting device, characterized in that, include: The acquisition module is used to acquire target transaction data; The generation module is used to package the target transaction data into blocks to generate the target block; The first determining module is used to determine the nth-level intermediate node of the consensus node in the blockchain based on the participating nodes in the blockchain; The second determining module is used to determine the transmission path of the target block based on the consensus node and the n-level intermediate node, so as to broadcast the target block through the transmission path; The first determining module is further configured to determine the nth-level intermediate node of the consensus node based on the participating nodes in the blockchain and the n-1-level intermediate nodes of the consensus node. The first determining module is further configured to: determine participating nodes in the blockchain whose distance from the (n-1)th level intermediate nodes is less than a preset threshold, are currently idle, and are not intermediate nodes as selectable nodes for the nth level intermediate nodes; for each selectable node in the nth level intermediate nodes, estimate the score of the selectable node based on the node information corresponding to the selectable node; sort the selectable nodes in the nth level intermediate nodes according to the score corresponding to each selectable node, in descending order of score, and select the top m n Each optional node is an intermediate node of the nth level.
8. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 5.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Method and system for reducing repeated broadcast of transaction group, equipment and storage medium
CN110443610A
Block chain fast consensus method and device, computer device and storage medium
CN110598060A