Transaction data broadcasting method and device, equipment, storage medium and program product
By setting n-level intermediate nodes for the consensus nodes of the blockchain and determining the transmission path, the problem of low blockchain broadcasting efficiency is solved, and more efficient transaction data broadcasting is achieved and the risk of broadcast storms is reduced.
Patent Information
- Application Number
- CN202411995995.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In blockchain networks, transaction data broadcast efficiency is low, which is easy to form broadcast storms, resulting in network congestion and reduced broadcast efficiency.
Set up n-level intermediate nodes for consensus nodes in the blockchain, and determine the transmission path of the target block based on the consensus node and n-level intermediate nodes, and broadcast the target block through this path.
This improves the broadcast efficiency of blockchain and reduces the risk of broadcast storms, so that each participating node only needs to receive and broadcast a small amount of transaction data.
Smart Images

Figure CN119788263A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a transaction data broadcasting method, device, equipment, storage medium and program product. Background Art
[0002] Blockchain is a distributed shared ledger and database with the characteristics of decentralization, immutability, full traceability, traceability, collective maintenance, and openness and transparency. In practice, a blockchain usually has multiple nodes. When each node receives transaction data, it can usually put the transaction data into the transaction pool corresponding to the node for cache, and then package the transaction data in the transaction pool to generate blocks. In order to ensure that each node in the same blockchain has the same and complete ledger, a node in the blockchain usually broadcasts the received transaction data to other nodes on the same blockchain after receiving the transaction data.
[0003] In the related art, after any of the multiple participating nodes in the blockchain network generates transaction data, it is necessary to broadcast the transaction data to other participating nodes in the blockchain network so that each participating node in the blockchain network receives and records the transaction data, thereby forming an effective supervision mechanism to avoid cheating between participating nodes. However, this method has the problem of low blockchain broadcast efficiency in some scenarios. Summary of the invention
[0004] The present application provides a transaction data broadcasting method, apparatus, device, storage medium and program product to solve the problem of low blockchain broadcasting efficiency in some scenarios in the related art.
[0005] In a first aspect, the present application provides a transaction data broadcasting method, comprising: obtaining target transaction data; packaging and processing the target transaction data to generate a target block; determining n-level intermediate nodes of the consensus node in the blockchain based on the participating nodes in the blockchain; determining a transmission path of the target block based on the consensus node and the n-level intermediate nodes, and broadcasting the target block through the transmission path.
[0006] In a second aspect, the present application provides a transaction data broadcasting system, which is deployed on each node in the blockchain system, and the node includes: a consensus node and a participating node; the consensus node is used to implement the transaction data broadcasting method provided in the first aspect; the participating node is used to send transaction data to the consensus node after generating transaction data, and the n-level intermediate node as the consensus node is used to broadcast the target block generated by the consensus node.
[0007] In a third aspect, the present application provides a transaction data broadcasting device, comprising:
[0008] An acquisition module, used to acquire target transaction data;
[0009] The generation module is used to package and block the target transaction data and generate the target block;
[0010] The first determination module is used to determine the n-level intermediate nodes of the consensus node in the blockchain according to the participating nodes in the blockchain;
[0011] The second determination module is used to determine the transmission path of the target block according to the consensus node and the n-level intermediate nodes, and broadcast the target block through the transmission path.
[0012] In a fourth aspect, the present application provides an electronic device comprising a processor and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the transaction data broadcasting method provided in the first aspect above.
[0013] In a fifth aspect, the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When the computer execution instructions are executed by a processor, they are used to implement the transaction data broadcasting method provided in the first aspect above.
[0014] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the transaction data broadcasting method provided in the first aspect above.
[0015] The transaction data broadcasting method, device, equipment, storage medium and program product provided by the present application obtain the target transaction data, package and block the target transaction data, generate the target block, and determine the n-level intermediate nodes of the consensus node in the blockchain according to the participating nodes in the blockchain, and further determine the transmission path of the target block according to the consensus node and the n-level intermediate nodes, and broadcast the target block through the transmission path. The present application sets n-level intermediate nodes for the consensus nodes in the blockchain, and determines the transmission path for transmitting the target block according to the n-level intermediate nodes corresponding to the consensus nodes, so that each participating node in the blockchain only receives and broadcasts a quantitative and small amount of transaction data of the participating nodes, which can improve the broadcast efficiency of the blockchain and reduce the risk of broadcast storms. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0017] Figure 1 A schematic diagram of the structure of a transaction data broadcasting system provided in an embodiment of the present application;
[0018] Figure 2 Schematic diagram of the process of the transaction data broadcasting method provided in the embodiment of the present application Figure 1 ;
[0019] Figure 3 Schematic diagram of the process of the transaction data broadcasting method provided in the embodiment of the present application Figure 2 ;
[0020] Figure 4 A schematic diagram of a transmission path provided in an embodiment of the present application;
[0021] Figure 5 A schematic diagram of the structure of a transaction data broadcasting device provided in an embodiment of the present application;
[0022] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0023] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0024] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present 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, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0026] In addition, this application involves conducting 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 using artificial intelligence technology to make automated decisions, and making technical solutions that have a significant impact on personal rights and interests based on the results of automated decisions. The application provides users with corresponding operation entrances for them to choose to agree or reject the results of automated decisions; if the user chooses to reject, the expert decision-making process will be entered.
[0027] It should be noted that the transaction combination recommendation method, device, equipment, storage medium and product provided in this application can be used in the field of financial technology, and can also be used in any field other than the field of financial technology. The application does not limit the application field of the transaction combination recommendation method, device, equipment, storage medium and product.
[0028] The following first explains the professional terms involved in the embodiments of the present application.
[0029] Broadcast storm: A data packet or data frame is transmitted to each node on the local network segment (defined by the broadcast domain). The number of broadcast frames on the network increases sharply due to forwarding, resulting in abnormal phenomenon that normal network communication cannot be performed. Broadcast storms will occupy a considerable amount of network bandwidth, causing normal data packets to be unable to operate normally. When broadcast data floods the network and cannot be processed and occupies a large amount of network bandwidth, causing normal business to be unable to operate, it means that a broadcast storm has occurred. Broadcast storms will cause partial or entire LAN network paralysis.
[0030] Blockchain node: Any computer connected to a blockchain network is called a node. Data can be directly transmitted between nodes in the blockchain network.
[0031] Consensus node: A node that participates in consensus voting, transaction execution, block verification, and bookkeeping in a blockchain network.
[0032] In the related art, after any of the multiple participating nodes in the blockchain network generates transaction information, it is necessary to broadcast the transaction information to other participating nodes in the blockchain network so that each participating node in the blockchain network receives and records the transaction information, thereby forming an effective supervision mechanism to avoid cheating between participating nodes. However, when the number of participating nodes included in the blockchain network is large, if each participating node needs to broadcast the transaction data to the blockchain network after generating the transaction data, it is easy to form a broadcast storm, causing network congestion and reducing the broadcast efficiency of the blockchain.
[0033] Based on the technical problems existing in the related technologies, the embodiment of the present application sets n-level intermediate nodes for the consensus nodes in the blockchain, and determines the transmission path for transmitting the target block according to the n-level intermediate nodes corresponding to the consensus nodes, so that each participating node in the blockchain only receives and broadcasts a quantitative and small amount of transaction data of the participating nodes, thereby improving the broadcast efficiency of the blockchain and reducing the risk of broadcast storms.
[0034] The following first describes in detail the application scenarios of the embodiments of the present application.
[0035] An applicable scenario of the transaction data broadcasting method, apparatus, device, storage medium, and program product provided in the embodiments of the present application may be a transaction data broadcasting scenario for a blockchain network that includes a large number of participating nodes.
[0036] It can be understood that the above is only an application scenario applicable to the embodiment of the present application. The embodiment of the present application does not limit the specific application scenario, which can be determined according to actual application requirements.
[0037] Figure 1 This is a schematic diagram of the structure of the transaction data broadcasting system provided in the embodiment of the present application. Figure 1 As shown, the transaction data broadcasting system is deployed on each node in the blockchain system, which includes: a consensus node and a participating node;
[0038] Among them, the consensus node is used to implement the transaction data broadcasting method provided in the embodiment of the present application;
[0039] The participating nodes are used to send transaction data to the consensus nodes after generating transaction data, and the n-level intermediate nodes as consensus nodes are used to receive the target blocks generated by the consensus nodes and / or broadcast the target blocks generated by the consensus nodes.
[0040] It is understandable that when the participating node is the end node, there is no need to broadcast the target block generated by the consensus node.
[0041] For example, the embodiments of the present application do not limit the number of consensus nodes and the number of participating nodes in the blockchain, which can be determined according to actual application requirements.
[0042] The transaction data broadcasting method provided in this application is intended to solve the above technical problems in the prior art.
[0043] The following is the above Figure 1The consensus node shown in is the execution subject, and the technical solution of the present application and how the technical solution of the present application solves the above technical problems are described in detail in combination with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in combination with the accompanying drawings.
[0044] Figure 2 Schematic diagram of the process of the transaction data broadcasting method provided in the embodiment of the present application Figure 1 .like Figure 2 As shown, the specific implementation of the transaction data broadcasting method may include the following steps:
[0045] S201, obtaining target transaction data.
[0046] Exemplarily, the target transaction data may be transaction data generated by a participating node in the blockchain.
[0047] Exemplarily, the target transaction data may include a transaction identifier, transaction input information, transaction output information, and a timestamp, etc.
[0048] Exemplarily, the target transaction data may include one transaction data or multiple transaction data. The present application does not limit the number of specific transaction data in the target transaction data, which may be determined according to actual application requirements.
[0049] In one possible implementation, the target transaction data may be transaction data sent by participating nodes in the blockchain to the consensus node within a preset period of time.
[0050] Exemplarily, the preset time period may be 30 seconds, or 1 minute, etc. This application does not limit this, and it can be determined according to actual application requirements.
[0051] S202, packaging and block processing are performed on the target transaction data to generate a target block.
[0052] In this step, in a possible implementation method, when the target transaction data contains only one transaction data, the target transaction data is packaged and processed into blocks to generate a 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 order of the timestamps corresponding to each transaction data, and the sorted transaction data are packaged and processed into blocks to obtain the target block.
[0053] Exemplarily, the sorted transaction data is packaged and processed into blocks. One possible implementation method to obtain the target block may be: each transaction data is packaged into a block, that is, the target block contains multiple different blocks; in another possible implementation method, a preset number of transaction data is packaged into a block, and exemplary, the preset number may be 3, 5, etc.; in a possible implementation method, multiple transaction data in the target transaction data may be packaged into one block, namely, 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, which can be determined based on actual application requirements.
[0055] S203, determining n-level intermediate nodes of the consensus nodes in the blockchain according to the participating nodes in the blockchain.
[0056] Exemplarily, the participating nodes may be other remaining nodes in the blockchain except the consensus nodes.
[0057] Exemplarily, n can be any positive integer greater than 1.
[0058] Exemplarily, the n-level intermediate nodes are used to receive the target block generated by the consensus node, and / or broadcast the target block generated by the consensus node.
[0059] Exemplarily, 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] Exemplarily, 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 finally broadcast the target block to all participating nodes in the blockchain.
[0061] S204: Determine the transmission path of the target block based on the consensus node and the n-level intermediate nodes, and broadcast the target block through the transmission path.
[0062] Exemplarily, the starting node of the transmission path may be a consensus node in the blockchain.
[0063] Exemplarily, the transmission path may be a tree structure.
[0064] Exemplarily, when the number of participating nodes in the blockchain is 5 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 may include a transmission path consisting of a consensus node, node 1, and node 4, a transmission path consisting of a consensus node, node 2, and node 3, and a transmission path consisting of a consensus node, node 2, and node 5.
[0065] In the embodiment of the present application, by acquiring the target transaction data, the target transaction data is packaged and processed to generate a target block, and according to the participating nodes in the blockchain, the n-level intermediate nodes of the consensus node in the blockchain are determined, and further according to the consensus node 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. In the embodiment of the present application, by setting n-level intermediate nodes for the consensus nodes in the blockchain, and determining the transmission path for transmitting the target block according to the n-level intermediate nodes corresponding to the consensus nodes, each participating node in the blockchain only receives and broadcasts a quantitative and small amount of transaction data of the participating nodes, which can improve the broadcast efficiency of the blockchain and reduce the risk of broadcast storms.
[0066] Optionally, a possible implementation method of step S203 determining the n-level intermediate nodes of the consensus node in the blockchain according to the participating nodes in the blockchain may be: determining the n-level intermediate nodes of the consensus node according to the participating nodes in the blockchain and the n-1-level intermediate nodes of the consensus node.
[0067] For example, if the n-1 level intermediate node includes multiple participating nodes, each participating node may correspond to an n-level intermediate node, except when the participating node is a terminal node.
[0068] It can be understood that the n-level intermediate node of the consensus node is also the n-level intermediate node of the n-1-level intermediate node in the consensus node.
[0069] In the embodiment of the present application, the intermediate nodes of the consensus nodes are determined by grading, and the transmission path of the target block is determined based on the graded intermediate nodes and consensus nodes, so that each participating node in the blockchain only receives and broadcasts a quantitative and small amount of transaction data of the participating nodes, which can improve the broadcast efficiency of the blockchain and reduce the risk of broadcast storms.
[0070] Combine the following Figure 3A detailed description is given of a specific implementation method for determining n-level intermediate nodes of consensus nodes based on participating nodes and n-1-level intermediate nodes of consensus nodes in a blockchain.
[0071] Figure 3 Schematic diagram of the process of the transaction data broadcasting method provided in the embodiment of the present application Figure 2 .like Figure 3 As shown, according to the participating nodes and the n-1 level intermediate nodes of the consensus node in the blockchain, the specific implementation method of determining the n level intermediate nodes of the consensus node may include the following steps:
[0072] S301, determining that the distance between the n-1 level intermediate node and the participating node in the blockchain is less than a preset threshold, and the participating node that is currently in the space state and does not belong to the intermediate node is an optional node of the n level intermediate node.
[0073] In one possible implementation, the distance between each participating node included in the n-1 level intermediate node 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. Further, 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] Exemplarily, the distance between nodes can be measured by network hop count or bandwidth consumption, or by network delay, or by the physical distance between pairs of nodes. In the transaction data broadcasting method provided in the embodiment of the present application, there is no limitation on the measurement method of the distance between nodes, which can be determined according to actual application requirements.
[0075] Exemplarily, the target participating node currently in the idle state may be a participating node that has not currently received the relevant broadcast.
[0076] S302 : for each optional node in the n-level intermediate nodes, estimate the score of the optional node according to the node information corresponding to the optional node.
[0077] Exemplarily, the node information may include a central processing unit (CPU) utilization rate, a network bandwidth response time, and a level of transactions per second (TPS).
[0078] It can be understood that the lower the CPU utilization of the optional node, the more processing power is available for the optional node; the shorter the network bandwidth response time of the optional node, the faster the network connection of the optional node; the higher the TPS level of the optional node, the more transaction data the optional node can process.
[0079] Assuming that the CPU utilization ranges from 0% to 100%, the network bandwidth response time ranges from 0 to the maximum delay, and the TPS level ranges from 0 to the maximum TPS, in a possible implementation, for any optional node, the difference between 100% and the current CPU utilization is used as the CPU utilization score, the difference between the maximum delay and the current delay is used as the network bandwidth response time score, the current TPS is used as the TPS level score, and a weight coefficient is configured for each node information according to the specific application scenario, and the score of each optional node is calculated by weighted average.
[0080] S303, sort the optional nodes in the n-level intermediate nodes in descending order according to the scores corresponding to each optional node, and select the top m nodes. n The optional nodes are n-level intermediate nodes.
[0081] Exemplarily, m is a positive integer greater than 1.
[0082] Exemplarily, when m is 2 and n is 2, the number of optional nodes included in the corresponding level 2 intermediate node is 4.
[0083] It can be understood that the optional nodes included in the n-level intermediate nodes are the participating nodes in the blockchain.
[0084] Exemplarily, the value of m can be determined according to the number of participating nodes in the blockchain.
[0085] It should be noted that the transaction data broadcasting method provided in the embodiment of the present application does not limit the specific size of m, which can be determined according to actual application requirements.
[0086] Optionally, when the number of optional nodes of any n-level intermediate node is not greater than m and is not 0, all the optional nodes in the n-level intermediate node are used as the n-level intermediate nodes.
[0087] In the embodiment of the present application, by determining that the participating nodes in the blockchain whose distance to the n-1 level intermediate nodes is less than a preset threshold, and which are currently in an idle state and do not belong to the intermediate nodes, are optional nodes of the n-1 level intermediate nodes, and for each optional node in the n-1 level intermediate nodes, according to the node information corresponding to the optional node, the score of the optional node is estimated, and the optional nodes in the n-1 level intermediate nodes are further sorted in descending order according to the score corresponding to each optional node, and the top m nodes are selected. n The optional nodes are n-level intermediate nodes. In the embodiment of the present application, by determining n-level intermediate nodes based on the node distance and node information between the participating nodes in the blockchain, the effective selection and configuration of the intermediate nodes in the blockchain can be achieved, thereby improving the broadcast efficiency of the blockchain.
[0088] It can be understood that, compared with the related art, in which transaction data is broadcasted from one participating node to the other participating nodes in the blockchain, the transaction data broadcasting method provided in the embodiment of the present application is that the consensus node broadcasts the target block to the 1st intermediate node, and then the 1st intermediate node broadcasts the target block to the 2nd intermediate node, and so on, broadcasts the target block to the terminal node, thereby reducing the risk of broadcast storms from the source.
[0089] Optionally, in the transaction data broadcasting method provided in the embodiment of the present application, the level 1 intermediate node of the consensus node is determined in the following manner: determine that the participating nodes in the blockchain whose distance from the consensus node is less than a preset threshold and are currently in a spatial state are optional nodes of the level 1 intermediate node; for each optional node in the level 1 intermediate node, estimate the score of the optional node based on the node information corresponding to the optional node; sort the optional nodes in the level 1 intermediate node in order from high to low according to the score corresponding to each optional node, and select the first m optional nodes as the level 1 intermediate nodes.
[0090] The method for determining the distance between participating nodes and consensus nodes in the blockchain is similar to the above and will not be repeated here.
[0091] The scoring of the optional nodes is estimated in a similar manner as described above and will not be described in detail here.
[0092] In the embodiment of the present application, the first-level intermediate node of the consensus node is determined through the participating nodes and consensus nodes in the blockchain, and then the n-level intermediate nodes of the consensus node are determined in sequence based on the first-level intermediate node, thereby realizing the effective selection and configuration of the intermediate nodes in the blockchain, thereby improving the broadcast efficiency of the blockchain.
[0093] Optionally, if the number of optional nodes of the n-level intermediate node is 0, the n-level intermediate node is determined to be the terminal node of the intermediate node, and the terminal node does not send out a broadcast.
[0094] Exemplarily, the end node may include at least one participating node.
[0095] It is understandable that the participating node in the end node can be the last node in the blockchain to receive the target block, that is, in response to the end node receiving the target block, each participating node in the blockchain has received the target block.
[0096] It can be understood that in the transaction data broadcasting method provided in the embodiment of the present application, except for the consensus nodes, the other participating nodes in the blockchain can all be n-level intermediate nodes or terminal nodes.
[0097] In the embodiment of the present application, an n-level intermediate node without optional nodes is determined as the terminal node, and the target block is broadcast to the blockchain network by determining the intermediate nodes in a hierarchical manner.
[0098] Optionally, for any optional node in the n-level intermediate nodes, if the sequence obtained after sorting based on the scores of the optional nodes is the mth n If the score of an optional node is the same as that of several adjacent optional nodes, then one of the optional nodes is randomly selected as the n-level intermediate node.
[0099] For example, assuming that the optional nodes of the n-level intermediate nodes are sorted from high to low by score, the sequence is node 1, node 2, node 3, node 4, node 5 and node 6, when m is 2 and n is 2, the number of optional nodes in the n-level intermediate nodes is 4. In this scenario, if the scores of node 2, node 3, node 4, node 5 and node 6 are the same, the optional nodes in the n-level intermediate nodes can be node 1, node 2, node 3, node 4, or node 1, node 3, node 4, node 5, or node 1, node 2, node 4, node 6, etc.
[0100] In the embodiment of the present application, in the sequence obtained after sorting based on the scores of the optional nodes, the mth n When an optional node has the same score as several adjacent optional nodes, one of the optional nodes can be randomly selected as the n-level intermediate node, achieving flexibility in the selection of n-level intermediate nodes. At the same time, it can also ensure the effective selection and configuration of intermediate nodes in the blockchain.
[0101] Optionally, a possible implementation method of determining the transmission path of the target block according to the consensus nodes and the n-level intermediate nodes in step S204 may be: setting a routing table according to the consensus nodes and the n-level intermediate nodes; and determining the transmission path of the target block according to the routing table.
[0102] Exemplarily, a first route is set according to a consensus node and a level 1 intermediate node, a second route is set according to the first route and a level 2 intermediate node, and so on, to obtain a routing table including 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 the embodiment of the present application, a routing table is set according to the consensus nodes and n-level intermediate nodes, and then the transmission path of the target block is determined according to the routing table, thereby improving the broadcast efficiency and reliability of the blockchain.
[0104] In summary, the transaction data broadcasting method provided in the above embodiment is described below with reference to specific examples of n-level intermediate nodes of the consensus node and the method for determining the transmission path.
[0105] Assume that 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 a consensus node, nodes 2 to 10 are participating nodes, and the value of m is 2.
[0106] First, determine the consensus node, i.e., the level 1 intermediate node of node 1: if the distance to the consensus node is less than the preset threshold, and the currently idle participating nodes include nodes 2 and 3, then the number of optional nodes of the level 1 intermediate node is not greater than m and is not 0, and nodes 2 and 3 are determined to be the level 1 intermediate nodes of the consensus node;
[0107] Determine the second-level intermediate node of the consensus node, that is, the second-level intermediate node of the first-level intermediate node: for node 2, the first-level intermediate node, if the distance with node 2 is less than the preset threshold and it is not used as an intermediate node, and the participating nodes currently in the idle state include node 4, then node 4 is used as an optional node for node 2, the first-level intermediate node, and the number of optional nodes of node 2 is not greater than m and is not 0, and node 4 is determined to be the second-level intermediate node of node 2; for node 3, the first-level intermediate node, if the distance with node 3 is less than the preset threshold and it is not used as an intermediate node, and the participating nodes currently in the idle state include nodes 5 and 6, then nodes 5 and 6 are used as optional nodes for node 3, the first-level intermediate node, and the number of optional nodes of node 1 is not greater than m and is not 0, and nodes 5 and 6 are determined to be the second-level intermediate nodes of node 3;
[0108] Determine the third-level intermediate node of the consensus node, that is, the third-level intermediate node of the second-level intermediate node: for node 4, the second-level intermediate node, if the distance to node 4 is less than the preset threshold, and it is not used as an intermediate node, and there is no participating node currently in an idle state, then node 4 is determined as the end node of the transmission path from the consensus node to node 2 to node 4, and node 4 does not need to send a broadcast; for node 5, the second-level intermediate node, if the distance to node 5 is less than the preset threshold, and it is not used as an intermediate node, and the participating nodes currently in an idle state include node 7, node 8 and node 9, then node 7, node 8 and node 9 are selected as optional nodes for node 5, the second-level intermediate node, and the number of optional nodes of node 2 is greater than m, then nodes 7, node 8 and node 9 are further determined. The scores corresponding to point 8 and node 9 respectively, if the scores are arranged in order from high to low as node 7, node 8, node 9, then node 7 and node 8 are determined to be the third-level intermediate nodes of node 5, if the scores are arranged in order from high to low as node 7, node 8=node 9, then node 7 and node 8 are determined to be the third-level intermediate nodes of node 5, or node 7 and node 9 are determined to be the third-level intermediate nodes of node 5; for node 6, a second-level intermediate node, if the distance with node 6 is less than the preset threshold and it is not an intermediate node, the participating nodes currently in the idle state include node 10, node 10 is used as an optional node of node 6, the number of optional nodes of node 6 is not greater than m and is not 0, and node 10 is determined to be the third-level intermediate node of node 6.
[0109] It can be understood that in the embodiment of the present application, node 7, node 8, node 9 and node 10 are also terminal nodes.
[0110] The transmission path obtained based on the above consensus nodes and intermediate nodes can be as follows Figure 4 shown.
[0111] Figure 4 A schematic diagram of a transmission path provided in an embodiment of the present application. Figure 4 As shown, the transmission path includes a first transmission path consisting of a consensus node, node 2 and node 4, a second transmission path consisting of a consensus node, node 3, node 5 and node 7, a third transmission path consisting of a consensus node, node 3, node 5 and node 8, and a fourth transmission path consisting of a consensus node, node 3, node 6 and node 10.
[0112] It can be understood 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).
[0113] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0114] Figure 5 This is a schematic diagram of the structure of the transaction data broadcasting device provided in the embodiment of the present 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] Wherein, the acquisition module 510 is used to acquire target transaction data;
[0116] A generation module 520 is used to package and block target transaction data to generate a target block;
[0117] A first determination module 530 is used to determine n-level intermediate nodes of the consensus node in the blockchain according to the participating nodes in the blockchain;
[0118] The second determination module 540 is used to determine the transmission path of the target block according to the consensus node and the n-level intermediate nodes, and broadcast the target block through the transmission path.
[0119] In a possible implementation, the first determination module 530 is specifically used to determine the n-level intermediate nodes of the consensus node according to the participating nodes and the n-1-level intermediate nodes of the consensus node in the blockchain.
[0120] In a possible implementation, the first determination module 530 is further used to: determine that the participating nodes in the blockchain whose distance to the n-1 level intermediate node is less than a preset threshold, are currently in an idle state and are not intermediate nodes, are optional nodes of the n-1 level intermediate nodes; for each optional node in the n-1 level intermediate nodes, estimate the score of the optional node according to the node information corresponding to the optional node; sort the optional nodes in the n-1 level intermediate nodes in order from high to low according to the score corresponding to each optional node, and select the top m nodes. n The optional nodes are n-level intermediate nodes.
[0121] In a possible implementation, the level 1 intermediate node of the consensus node is determined in the following manner: determine the participating nodes in the blockchain whose distance from the consensus node is less than a preset threshold and which are currently in a spatial state as optional nodes of the level 1 intermediate node; for each optional node in the level 1 intermediate node, estimate the score of the optional node according to the node information corresponding to the optional node; sort the optional nodes in the level 1 intermediate node in descending order according to the score corresponding to each optional node, and select the first m optional nodes as the level 1 intermediate nodes.
[0122] In a possible implementation, if the number of selectable nodes of the n-level intermediate node is 0, the n-level intermediate node is determined to be the terminal node of the intermediate node, and the terminal node does not send out a broadcast.
[0123] In a possible implementation, for any optional node in the n-level intermediate node, if the mth node in the sequence obtained after sorting based on the scores of the optional nodes n If the score of an optional node is the same as that of several adjacent optional nodes, then one of the optional nodes is randomly selected as the n-level intermediate node.
[0124] In a possible implementation, the second determination module 50 is specifically used to: set a routing table according to the consensus nodes and the n-level intermediate nodes; and determine a transmission path of the target block according to 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 method and technical effect are similar and will not be repeated here.
[0126] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present 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 through the system bus 640 and communicate with each other. The memory 620 is used to store instructions, the communication interface 630 is used to communicate with other devices, and the processor 610 is used to call the instructions in the memory to execute the method steps provided in the above method embodiment. The specific implementation methods and technical effects are similar and will not be repeated here.
[0127] Should Figure 6 The system bus 640 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus 640 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0128] The communication interface 630 is used to implement communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries).
[0129] The memory 620 may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0130] The processor 610 may 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, and discrete hardware components.
[0131] The embodiment of the present application also provides a computer-readable storage medium, in which computer execution instructions are stored. When the computer execution instructions are executed by a processor, they are used to implement the method steps in the above method embodiment. The specific implementation method and technical effect are similar and will not be repeated here.
[0132] The embodiment of the present 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 in the above method embodiment. The specific implementation method and technical effect are similar and will not be repeated here.
[0133] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0134] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0135] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0136] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0137] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless otherwise specified, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.
[0138] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, 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. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0139] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0140] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0141] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A transaction data broadcasting method, characterized in that: include: Obtain target transaction data; Packing and processing the target transaction data into blocks to generate a target block; Determine n-level intermediate nodes of the consensus nodes in the blockchain according to the participating nodes in the blockchain; According to the consensus node and the n-level intermediate nodes, a transmission path of the target block is determined, and the target block is broadcasted through the transmission path.
2. The transaction data broadcasting method according to claim 1, characterized in that: The step of determining, according to the participating nodes in the blockchain, the n-level intermediate nodes of the consensus nodes in the blockchain comprises: According to the participating nodes in the blockchain and the n-1 level intermediate nodes of the consensus node, the n level intermediate nodes of the consensus node are determined.
3. The transaction data broadcasting method according to claim 2, characterized in that: The step of determining the n-level intermediate nodes of the consensus node according to the participating nodes in the blockchain and the n-1-level intermediate nodes of the consensus node comprises: Determine that a participating node in the blockchain whose distance to the n-1 level intermediate node is less than a preset threshold and is currently in an idle state and does not belong to an intermediate node is an optional node of the n level intermediate node; For each optional node in the n-level intermediate nodes, estimating the score of the optional node according to the node information corresponding to the optional node; The optional nodes in the n-level intermediate nodes are sorted in descending order according to the scores corresponding to each optional node, and the top m nodes are selected. n The optional nodes are the n-level intermediate nodes.
4. The transaction data broadcasting method according to claim 3, characterized in that: The level 1 intermediate node of the consensus node is determined in the following way: Determine that the participating node in the blockchain whose distance from the consensus node is less than a preset threshold and which is currently in a spatial state is an optional node of the first-level intermediate node; For each optional node in the first-level intermediate node, estimating the score of the optional node according to the node information corresponding to the optional node; The optional nodes in the first-level intermediate nodes are sorted in descending order according to the score corresponding to each optional node, and the first m optional nodes are selected as the first-level intermediate nodes.
5. The transaction data broadcasting method according to any one of claims 1 to 4, characterized in that: If the number of selectable nodes of the n-level intermediate node is 0, the n-level intermediate node is determined to be the terminal node of the intermediate node, and the terminal node does not send out a broadcast.
6. The transaction data broadcasting method according to any one of claims 1 to 4, characterized in that: For any optional node in the n-level intermediate node, if the mth node in the sequence obtained by sorting the scores of the optional nodes is n If the score of an optional node is the same as that of several adjacent optional nodes, then one of the optional nodes is randomly selected as the n-level intermediate node.
7. The transaction data broadcasting method according to any one of claims 1 to 4, characterized in that: Determining the transmission path of the target block according to the consensus node and the n-level intermediate nodes includes: According to the consensus node and the n-level intermediate nodes, a routing table is set; According to the routing table, a transmission path of the target block is determined.
8. A transaction data broadcasting system, characterized in that: The transaction data broadcasting system is deployed on each node in the blockchain system, and the nodes include: consensus nodes and participating nodes; The consensus node is used to implement the transaction data broadcasting method according to any one of claims 1 to 7; The participating node is used to send the transaction data to the consensus node after generating the transaction data, and the n-level intermediate node as the consensus node is used to receive the target block generated by the consensus node, and / or broadcast the target block generated by the consensus node.
9. A transaction data broadcasting device, characterized in that: include: An acquisition module, used to acquire target transaction data; A generation module, used to package and block the target transaction data to generate a target block; A first determination module is used to determine n-level intermediate nodes of the consensus node in the blockchain according to the participating nodes in the blockchain; The second determination module is used to determine the transmission path of the target block according to the consensus node and the n-level intermediate nodes, so as to broadcast the target block through the transmission path.
10. An electronic device, characterized in that: include: 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 method according to any one of claims 1 to 7.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
12. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.
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
Communication optimization system, registration method and message forwarding method of block chain network
CN111817967A
Blockchain message broadcasting method based on DHT, electronic equipment and storage medium
CN113300851A
Network transmission optimization device for graph-type blockchain and method thereof
US20230130074A1