An intelligent consensus method and device integrating blockchain and directed acyclic graph network
By integrating blockchain with directed acyclic graph networks and dynamically switching network modes, the problem of low consensus efficiency of blockchain networks in high transaction volume scenarios is solved, and data security in low transaction volume and efficient consensus in high transaction volume are achieved.
Patent Information
- Application Number
- CN202510039704.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-01-10
AI Technical Summary
The consensus rate of blockchain networks is slow in high transaction volume scenarios, resulting in low consensus efficiency.
Through the integration of blockchain and directed acyclic graph network, the network mode is dynamically switched. The blockchain network mode is used to ensure security at low transaction volumes, and the directed acyclic graph network mode is used to improve consensus efficiency at high transaction volumes. The network load index is determined by comprehensively considering the number of transactions, delay information and node computing costs to switch modes.
It ensures data security at low transaction volumes and improves consensus efficiency at high transaction volumes, achieving a balance between consensus efficiency and security.
Smart Images

Figure CN119865302B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to computer technology, and in particular to an intelligent consensus method and device for integrating blockchain with a directed acyclic graph network. Background Art
[0002] A blockchain network is a distributed ledger network, which can also be viewed as a data structure that stores data in chronological order. Consensus mechanisms enable transactions to be verified and confirmed quickly through voting by specific nodes within the blockchain network. For example, if several nodes with unrelated interests can reach consensus on a transaction, it can be assumed that the entire network has reached consensus. The consensus mechanism within a blockchain network ensures data immutability and consistency. However, in implementing the present invention, the inventors discovered that the existing technology suffers from at least the following problems:
[0003] Although the consensus method in the blockchain network can ensure data security, due to the linear processing characteristics of the blockchain network, it has limitations in scalability, resulting in a slower consensus rate in high transaction volume scenarios and reduced consensus efficiency. Summary of the Invention
[0004] The embodiments of the present invention provide an intelligent consensus method and device that integrates blockchain and directed acyclic graph networks to achieve dynamic switching between blockchain network modes and directed acyclic graph network modes, thereby utilizing a more appropriate consensus method for transaction consensus and effectively balancing consensus efficiency and security.
[0005] In a first aspect, an embodiment of the present invention provides an intelligent consensus method for integrating blockchain with a directed acyclic graph network, including:
[0006] Determine the current network load index based on the total number of transactions generated in the current time period, the latency information and transaction weight of each transaction, and the computational cost of each node in the current network during the current time period, where the current time period is a time period with a preset duration starting at the current moment and ending at the current moment;
[0007] Comparing the current network load index with a preset load index, and determining a target network mode based on the comparison result, wherein the target network mode includes: a blockchain network mode or a directed acyclic graph network mode;
[0008] If the current network mode is different from the target network mode, switching the current network mode to the target network mode;
[0009] In response to the target network mode being a blockchain network mode, performing consensus processing on target transactions generated after the current moment according to a preset blockchain consensus method corresponding to the blockchain network mode;
[0010] In response to the target network mode being a directed acyclic graph network mode, consensus-driven parallel processing is performed on target transactions generated after the current moment according to a weighted confirmation consensus method corresponding to the directed acyclic graph network mode;
[0011] The current network load index is determined according to the following formula:
[0012]
[0013] Where T is the current network load index; N t is the total number of transactions generated in the current time period; d i is the delay information of the i-th transaction; f(d i ) is a function used to characterize the delay between the i-th transaction and other transactions; w i is the transaction weight of the i-th transaction; N is the number of nodes in the current network in the current time period; p i is the computational cost of the i-th node; α, β, γ, δ, and φ are weight coefficients; λ is a scaling factor used to adjust the sensitivity of the sigmoid function.
[0014] In a second aspect, an embodiment of the present invention further provides an intelligent consensus device integrating a blockchain and a directed acyclic graph network, comprising:
[0015] a current network load index determination module, configured to determine the current network load index based on the total number of transactions generated in a current time period, the latency information and transaction weight of each transaction, and the computational cost of each node in the current network during the current time period, wherein the current time period is a time period with a preset duration and ending at the current moment;
[0016] a target network mode determination module, configured to compare the current network load index with a preset load index and determine a target network mode based on the comparison result, wherein the target network mode includes: a blockchain network mode or a directed acyclic graph network mode;
[0017] A network mode switching module, configured to switch the current network mode to the target network mode if the current network mode is different from the target network mode;
[0018] a blockchain consensus module, configured to, in response to the target network mode being the blockchain network mode, perform consensus processing on target transactions generated after the current moment according to a preset blockchain consensus method corresponding to the blockchain network mode;
[0019] A directed acyclic graph consensus module, configured to, in response to the target network mode being a directed acyclic graph network mode, perform consensus and parallel processing on target transactions generated after the current moment according to a weighted confirmation consensus method corresponding to the directed acyclic graph network mode;
[0020] The current network load index determination module determines the current network load index according to the following formula:
[0021]
[0022] Where T is the current network load index corresponding to the current time period; N t is the total number of transactions generated in the current time period; d i is the delay information of the i-th transaction; w i is the transaction weight of the i-th transaction; N is the number of nodes in the current network in the current time period; p i is the computational cost of the i-th node; α, β, γ, δ, and φ are weight coefficients; λ is a scaling factor used to adjust the sensitivity of the sigmoid function.
[0023] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising:
[0024] one or more processors;
[0025] a memory for storing one or more programs;
[0026] When the one or more programs are executed by the one or more processors, the one or more processors implement the intelligent consensus method for integrating blockchain and directed acyclic graph network as provided in any embodiment of the present invention.
[0027] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements an intelligent consensus method for integrating blockchain and directed acyclic graph network as provided in any embodiment of the present invention.
[0028] In a fifth aspect, an embodiment of the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements an intelligent consensus method for integrating blockchain and directed acyclic graph networks as provided in any embodiment of the present invention.
[0029] One embodiment of the above invention has the following advantages or beneficial effects:
[0030] By comprehensively considering the total number of transactions generated in the current time period, the latency information and transaction weight of each transaction, and the computational cost of each node in the current network during the current time period, the current network load index can be accurately determined in real time. The current network load index is then compared with the preset load index, and the appropriate target network mode can be determined in real time based on the comparison result. If the current network mode is different from the target network mode, the current network mode is switched to the target network mode. If the target network mode is a blockchain network mode, consensus processing is performed on target transactions generated after the current moment according to the preset blockchain consensus method corresponding to the blockchain network mode, thereby ensuring data security in low transaction volume conditions. If the target network mode is a directed acyclic graph network mode, consensus processing is performed on target transactions generated after the current moment according to the weighted confirmation consensus method corresponding to the directed acyclic graph network mode, thereby improving consensus efficiency in high transaction volume conditions. By dynamically switching between the blockchain network mode and the directed acyclic graph network mode based on the current network load index, a more appropriate consensus method can be used for transaction consensus processing, effectively balancing consensus efficiency and security. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0032] Figure 1 This is a flowchart of an intelligent consensus method for integrating blockchain and directed acyclic graph network provided by one embodiment of the present invention;
[0033] Figure 2 This is a flowchart of another intelligent consensus method for integrating blockchain and directed acyclic graph network provided by one embodiment of the present invention;
[0034] Figure 3 This is a schematic diagram of the structure of an intelligent consensus device that integrates blockchain and directed acyclic graph network, provided by one embodiment of the present invention;
[0035] Figure 4 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It will be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all structures.
[0037] Figure 1 This is a flowchart of an intelligent consensus method for integrating blockchain and directed acyclic graph networks, provided by one embodiment of the present invention. This embodiment is applicable to the case of intelligent consensus on transactions in a distributed ledger network. The method can be executed by an intelligent consensus device integrating blockchain and directed acyclic graph networks, which can be implemented by software and / or hardware and integrated into electronic devices. Figure 1 As shown, the method specifically includes the following steps:
[0038] S110. Determine a current network load index based on the total number of transactions generated in the current time period, the delay information and transaction weight of each transaction, and the computational cost of each node in the current network in the current time period, where the current time period is a time period with a preset duration and ending at the current moment.
[0039] The current time period refers to the historical time period closest to the current moment and having a preset duration. For example, the current time period can refer to the last second, the last minute, or the last hour. The end time of the current time period is the current moment, and the start time is the historical moment obtained by subtracting the preset duration from the current moment. The current time period changes dynamically over time, enabling real-time determination of the network load index. The current network load index can be used to reflect the workload and pressure of the current network during the current time period. A larger current network load index indicates a greater transaction volume that the network needs to process.
[0040] The latency information for each transaction generated during the current time period is used to describe the time interval between transactions or the depth of dependencies. Transaction weight refers to the weight assigned to each transaction, which can be determined based on the importance or priority of the transaction. The more important or higher-priority the transaction, the greater the weight assigned. Transaction weights can be obtained through training using deep learning AI algorithms and production data. Continuous optimization can be performed using subsequent production data to improve the rationality and accuracy of transaction weight assignments.
[0041] The current network during the current time period can refer to either a blockchain network or a directed acyclic graph (DAG) network. A blockchain network is a linear structure, starting with a so-called "genesis block" and continuing through each new block in the chain. Each block contains many transactions and references the previous block via a hash value. Therefore, all blocks in a blockchain network can be traced back to the first block, and the data within the block cannot be modified, providing a secure and permanent record. A DAG network is a distributed ledger network structure that differs from a blockchain network. A DAG network allows multiple connections between units and does not have the concept of blocks. Each unit records the transactions of a single user. This structure enables DAG networks to asynchronously and concurrently write a large number of transactions, greatly improving the system's scalability. For example, a DAG is a directed graph without cycles; that is, it has no loops. Each transaction has a direction and cannot form a closed loop. In a DAG, each transaction must verify the previous transaction. This verification mechanism allows new transactions to be added to the network asynchronously and concurrently, thereby improving the system's processing speed and scalability. The distributed ledger network in this embodiment is a heterogeneous network that integrates the blockchain network model and the directed acyclic graph network model to optimize the overall transaction processing capabilities of the system.
[0042] When the current network is a blockchain, a node can refer to a block in the blockchain network. When the current network is a directed acyclic graph (DAG), a node can refer to a unit or transaction in the DAG network. The computational cost of each node in the current network can be used to represent each node's processing power and computing resources. Nodes in the network can participate in transaction verification in either the DAG or blockchain model, confirming transaction authenticity and preventing double spending. The transaction data generated for each transaction can include the transacting parties, transaction amount, transaction time, transaction hash, DAG model verification, and blockchain-anchored metadata, thus supporting intelligent adaptation of the two models.
[0043] Specifically, the system collects in real time the total number of transactions generated during the current time period, the latency information and transaction weight of each transaction, and the computational cost of each node in the current network during the current time period. The system then performs a comprehensive weighted analysis of the total number of transactions, latency information and transaction weight of each transaction, and the computational cost of each node in the current network to obtain the current network load index. Because the current network load index comprehensively considers both current transaction information and current network information during the current time period, it can be intelligently and dynamically adjusted based on real-time network conditions, enabling efficient mode switching.
[0044] Exemplarily, the current network load index is determined according to the following formula:
[0045]
[0046] Where T is the current network load index; N t is the total number of transactions generated in the current time period; d i is the delay information of the i-th transaction; f(d i ) is a function used to characterize the delay between the i-th transaction and other transactions; w i is the transaction weight of the i-th transaction; N is the number of nodes in the current network in the current time period; p i is the computational cost of the i-th node; α, β, γ, δ, and φ are weight coefficients; λ is a scaling factor used to adjust the sensitivity of the sigmoid function.
[0047] For example, f(d i ) is an exponential function used to measure transaction propagation time or dependency depth. For example, The delay information d of each transaction generated in the current time period i Substitute into f(d i ), get each transaction d i Transaction delay change information f(d i ), the transaction delay change information can measure the transaction propagation time or the depth of dependence between transactions. According to the transaction weight of each transaction, the transaction delay change information of each transaction is weighted and summed to obtain the total transaction delay change information corresponding to the current time period, that is, Add up the computational cost of each node in the current network during the current time period to obtain the total computational cost corresponding to the current time period, that is,
[0048] Among them, α, β, γ, δ and φ can be obtained by training and learning from a large amount of production practice data through deep learning artificial intelligence algorithms, and can be continuously optimized in subsequent calculations. ) and a logarithmic function (i.e., the ln function) to calculate the current network load index, enabling nonlinear scaling, allowing the system to smoothly transition between blockchain and directed acyclic graph network modes based on real-time data. Utilizing this formula allows for more precise and accurate determination of the current network load index, enabling comprehensive load calculations and ensuring smoother mode transitions, improving overall system performance.
[0049] S120. Compare the current network load index with a preset load index, and determine a target network mode based on the comparison result. The target network mode includes: a blockchain network mode or a directed acyclic graph network mode.
[0050] The target network mode may refer to the network consensus mode that best suits the current network load. The blockchain network mode refers to a mode that utilizes a blockchain network for consensus processing. The directed acyclic graph network mode refers to a mode that utilizes a directed acyclic graph network for consensus processing. The preset load index may be a pre-set network load index threshold for switching network modes. For example, the preset load index may include a first preset load index and a second preset load index, where the first preset load index refers to the network load index threshold for switching to the directed acyclic graph network mode. The second preset load index refers to the network load index threshold for switching to the blockchain network mode. The first preset load index may be equal to the second preset load index, so that only one preset load index is used to make mode switching decisions. Alternatively, the first preset load index may be greater than the second preset load index, so that two different preset load indices are used to make mode switching decisions, thereby meeting personalized service needs.
[0051] Specifically, when there is only one preset load index, that is, when the first preset load index is equal to the second preset load index, the current network load index is compared with the preset load index. If the current network load index is greater than the preset load index, the directed acyclic graph network mode is determined as the target network mode. Therefore, in the case of high transaction volume, transactions are processed in the directed acyclic graph network mode to achieve rapid consensus verification and improve consensus efficiency. If the current network load index is less than the preset load index, the blockchain network mode is determined as the target network mode. Therefore, in the case of low transaction volume, transactions are processed in the blockchain network mode to improve security.
[0052] Exemplarily, step S120 may include: if the current network load index is greater than a first preset load index, determining the directed acyclic graph network mode as the target network mode; if the current network load index is less than a second preset load index, determining the blockchain network mode as the target network mode.
[0053] Specifically, if there are two different preset load indices, where the first preset load index is greater than the second preset load index, if the current network load index is greater than the first preset load index, the target network mode is determined to be a directed acyclic graph network mode. If the current network load index is less than the second preset load index, the target network mode is determined to be a blockchain network mode. If the current network load index is less than or equal to the first preset load index and greater than or equal to the second preset load index, it indicates that the current transaction volume is moderate. At this time, there is no need to switch network modes, and consensus processing can continue based on the current network mode, further effectively balancing consensus efficiency and security.
[0054] S130: If the current network mode is different from the target network mode, switch the current network mode to the target network mode.
[0055] The current network mode refers to the current network mode, i.e., the network mode corresponding to the current network. Different network modes correspond to different consensus methods. The target network mode is the network consensus mode that best suits the current network load.
[0056] Specifically, when the current network mode is different from the target network mode, the current network mode is switched to the most suitable target network mode, so that the most suitable target network mode can be used to perform consensus processing on target transactions generated after the current moment.
[0057] For example, when the current network mode is a blockchain network mode and the target network mode is a directed acyclic graph network mode, it indicates that the current network load index has increased. At this time, by switching the network from the blockchain network mode to the directed acyclic graph network mode, parallel consensus processing of transactions in the directed acyclic graph network mode can be performed, thereby providing scalability and thereby improving throughput and consensus efficiency. When the current network mode is a directed acyclic graph network mode and the target network mode is a blockchain network mode, it indicates that the current network load index has decreased. At this time, by switching the network from the directed acyclic graph network mode to the blockchain network mode, transaction consensus processing can be performed in the blockchain network mode, thereby prioritizing security and sequence verification, thereby strengthening data security. By utilizing a heterogeneous network that integrates the blockchain network mode and the directed acyclic graph network mode, speed, throughput, and security can be effectively balanced, thereby realizing high-frequency transaction demand applications such as cross-border payments, financial transactions, and the Internet of Things.
[0058] It should be noted that if the current network mode is the target network mode, there is no need to switch network modes at this time. Consensus processing for target transactions generated after the current moment can continue according to the target consensus method corresponding to the current network mode. By utilizing the current network load index calculated in real time, intelligent switching of network modes can be achieved, ensuring smoother and more reliable mode switching and improving overall system performance.
[0059] S140: In response to the target network mode being the blockchain network mode, consensus processing is performed on the target transaction generated after the current moment according to a preset blockchain consensus method corresponding to the blockchain network mode.
[0060] The preset blockchain consensus method corresponding to the blockchain network model can be any pre-set blockchain consensus algorithm, i.e., a consensus algorithm that enhances security. For example, the preset blockchain consensus method can be, but is not limited to, the PBFT (Practical Byzantine Fault Tolerance) algorithm. The target transaction refers to a new transaction generated after the current time.
[0061] Specifically, when the target network mode is a blockchain network mode, consensus processing is performed on target transactions generated after the current moment according to the preset blockchain consensus method corresponding to the blockchain network mode, thereby ensuring the security of the transaction.
[0062] S150: In response to the target network mode being a directed acyclic graph network mode, consensus and parallel processing are performed on target transactions generated after the current moment according to a weighted confirmation consensus method corresponding to the directed acyclic graph network mode.
[0063] The weighted confirmation consensus method corresponding to the directed acyclic graph (DAG) network model can be a consensus algorithm that verifies and confirms transactions based on the weighted graph structure within the DAG network. Transactions within the DAG network model are verified based on the cumulative weight of the confirming nodes. For example, each transaction has a cumulative weight determined based on its confirmation score. When the cumulative weight exceeds a threshold, the transaction is considered confirmed, meaning it has been successfully verified. The target transaction refers to a new transaction generated after the current time.
[0064] Specifically, when the target network mode is a directed acyclic graph network mode, according to the weighted confirmation consensus method corresponding to the directed acyclic graph network mode, consensus and parallel processing of target transactions generated after the current moment can be allowed, thereby having scalability and improving consensus efficiency.
[0065] By utilizing an intelligent consensus mechanism that integrates weighted confirmation consensus and preset blockchain consensus, it can intelligently and dynamically switch between blockchain network mode and directed acyclic graph network mode according to real-time network conditions, thereby intelligently balancing security and scalability in the distributed ledger network to adapt to broader and more massive application needs.
[0066] Exemplarily, the method may further include anchoring a transaction hash value corresponding to a target transaction stored in the directed acyclic graph network to the blockchain network. The target transaction stored in the directed acyclic graph network refers to a transaction that has been confirmed and successfully verified. Specifically, the target transaction stored in the directed acyclic graph network may be periodically and asynchronously anchored to the blockchain network, or converted to a blockchain block, thereby preventing tampering with the target transaction data and improving the security of the target transaction.
[0067] The technical solution of this embodiment comprehensively considers the total number of transactions generated in the current time period, the delay information and transaction weight of each transaction, and the computational cost of each node in the current network in the current time period, and can accurately determine the current network load index in real time, and compare the current network load index with the preset load index. According to the comparison result, the current appropriate target network mode can be determined in real time; if the current network mode is different from the target network mode, the current network mode is switched to the target network mode. If the target network mode is a blockchain network mode, the target transactions generated after the current moment are processed according to the preset blockchain consensus method corresponding to the blockchain network mode, thereby ensuring data security in low transaction volume conditions; if the target network mode is a directed acyclic graph network mode, the target transactions generated after the current moment are processed according to the weighted confirmation consensus method corresponding to the directed acyclic graph network mode, thereby improving consensus efficiency in high transaction volume conditions. By dynamically switching between the blockchain network mode and the directed acyclic graph network mode according to the current network load index, a more appropriate consensus method can be used for transaction consensus processing, thereby effectively balancing consensus efficiency and security.
[0068] Figure 2 This is a flowchart of another intelligent consensus method for integrating blockchain and a directed acyclic graph network, provided by one embodiment of the present invention. This embodiment, based on the above embodiments, optimizes the step of "performing consensus and parallel processing of target transactions generated after the current moment based on the weighted confirmation consensus method corresponding to the directed acyclic graph network model." Explanations of terms that are identical or corresponding to those in the above embodiments are omitted here.
[0069] See also Figure 2 Another intelligent consensus method for integrating blockchain and directed acyclic graph network provided in this embodiment specifically includes the following steps:
[0070] S210. Determine a current network load index based on the total number of transactions generated in the current time period, the delay information and transaction weight of each transaction, and the computational cost of each node in the current network in the current time period, wherein the current time period is a time period with a preset duration and ending at the current moment.
[0071] S220. Compare the current network load index with the preset load index, and determine a target network mode based on the comparison result. The target network mode includes: a blockchain network mode or a directed acyclic graph network mode.
[0072] S230: If the current network mode is different from the target network mode, switch the current network mode to the target network mode.
[0073] S240: In response to the target network mode being the blockchain network mode, consensus processing is performed on the target transaction generated after the current moment according to a preset blockchain consensus method corresponding to the blockchain network mode.
[0074] S250: In response to the target network mode being a directed acyclic graph network mode, determining a confirmation score corresponding to each target transaction generated after the current moment according to a weighted graph structure in the directed acyclic graph network.
[0075] Among them, in the directed acyclic graph network, the nodes represent transactions or blocks, and each node is an independent data record, such as a transaction or block, containing information about the transaction, timestamps, and verification information. The dependency relationship between nodes expresses the order and confirmation method between transactions. Edges represent dependency or reference relationships. Edges usually point from one transaction (occurring first) to another transaction, and subsequent transactions depend on previous transactions. This dependency can be understood as the confirmation of previous transactions when adding new transactions. Edges can also have weights to measure the strength of the dependency or determine the influence of the dependency in the final calculation of the confirmation score. In the directed acyclic graph network mode, a weighted graph structure is used to verify transactions. G = (V, E) is a directed acyclic graph, where the vertex set V represents all transactions and the edge set E represents all verification and dependency directions. In the directed acyclic graph, from transaction T i Pointing to transaction T j The edge represents T j Depends on T i , thus T j The confirmation score can be based on the point T j All nodes T i By utilizing the weighted graph structure of a directed acyclic graph network, the confirmation score corresponding to each target transaction generated after the current moment can be more accurately determined. The confirmation score can be used to prioritize transactions; the higher the confirmation score, the higher the priority it receives to prevent delays.
[0076] Exemplarily, step S250 may include: for each target transaction generated after the current moment, determining the target edge set of the target node corresponding to the target transaction in the directed acyclic graph network, and the edge weight and node distance corresponding to each target edge in the target edge set according to the weighted graph structure in the directed acyclic graph network, wherein each target edge in the target edge set is an edge pointing to the target node; and determining the confirmation score corresponding to the target transaction according to the edge weight and node distance corresponding to each target edge in the target edge set.
[0077] Specifically, for each target transaction generated after the current moment, the target node T corresponding to the target transaction is determined according to the weighted graph structure in the directed acyclic graph network. jThe target edge set E in the DAG network j , and the target edge set E j Each target edge (T i , T j ) corresponds to the edge weight w ij The distance d from the node ij . Among them, each target edge (T i , T j ) are all from T i Pointing to T j The edge of T i Happened before, T j Occurs after T j Depends on T i , T j At the time of establishment, T i The preceding state, T j Confirm T i . Edge weight w ij It is from T i to T j The edge weight, node distance d ij It is from T i to T j It should be noted that the target edge can include an edge that directly points to the target node, or an edge that indirectly points to the target node. ij You can use T i to T j The number of edges passed is determined. The edge weight w ij You can use T i to T j The weight of each edge is determined. For example, if T i Directly pointing to T through an edge j , then determine the target edge (T i , T j ) corresponds to the node distance d ij is 1, determining the edge weight w ij is the weight of the edge. i Directed indirectly to T via at least two edges j , then the number of passing edges is determined as the target edge (T i , T j ) corresponds to the node distance d ij , the sum of the weights of all edges is determined as the target edge (T i , T j ) corresponds to the edge weight w ij .
[0078] Exemplarily, the confirmation score corresponding to the target transaction is determined according to the following formula:
[0079]
[0080] Among them, C(T j ) is the target node T corresponding to the target transaction j Corresponding confirmation score; E j is the target node T j The corresponding target edge set; (T i ,T j ) refers to a target edge set from T i Pointing to T j The target edge of w ij It refers to the target edge (T i ,T j ) corresponding edge weight; d ij It refers to the target edge (T i ,T j ) corresponds to the node distance; f(d ij ) is about d ij The decay function of .
[0081] Specifically, using the decay function f(d ij ), such as the inverse proportional function 1 / d ij , perform attenuation processing on the node distance corresponding to each target edge to obtain the attenuated distance of each target edge. The attenuation function can be used to represent that as the node distance increases, the dependency effect gradually decreases. According to the edge weight w corresponding to each target edge ij , the distance f(d ij ) is weighted and summed, and the summed result is determined as the confirmation score C(T j ).
[0082] S260: Determine the cumulative weight corresponding to each target transaction according to the confirmation score corresponding to each target transaction, and perform confirmation verification on each target transaction according to the cumulative weight corresponding to each target transaction to obtain target transactions that have passed the verification.
[0083] Specifically, the confirmation score for each target transaction is multiplied by a preset coefficient, and the resulting product is used as the cumulative weight for each target transaction. The cumulative weight for each target transaction is then compared with the preset weight, and any target transaction with a cumulative weight greater than the preset weight is determined to have passed verification. By utilizing cumulative weights for parallel verification of transactions, consensus efficiency is improved.
[0084] S270 : Determine a processing order corresponding to the verified target transactions according to the confirmation scores corresponding to the verified target transactions, and add the verified target transactions to the directed acyclic graph network according to the processing order.
[0085] Specifically, all verified target transactions are sorted according to the confirmation scores corresponding to the verified target transactions, and a target transaction processing order with decreasing confirmation scores is obtained. According to this processing order, the verified target transactions are added to the directed acyclic graph network in sequence. For example, a new node corresponding to each verified target transaction is created, the new node is added to the directed acyclic graph network, and the new node is connected to the existing nodes on which the new node depends, thereby completing the transaction consensus processing in the directed acyclic graph network. By utilizing the weighted graph structure in the directed acyclic graph network to verify and confirm transactions, the efficiency of transaction consensus can be improved to adapt to fast, massive and secure transaction applications.
[0086] The technical solution of this embodiment determines the confirmation score corresponding to each target transaction generated after the current moment based on the weighted graph structure in the directed acyclic graph network; determines the cumulative weight corresponding to each target transaction based on the confirmation score corresponding to each target transaction, and confirms and verifies each target transaction based on the cumulative weight corresponding to each target transaction to obtain verified target transactions; determines the processing order corresponding to the verified target transactions based on the confirmation scores corresponding to the verified target transactions, and adds the verified target transactions to the directed acyclic graph network according to the processing order, thereby quickly verifying and confirming the transactions and improving the efficiency of transaction consensus.
[0087] The following is an embodiment of an intelligent consensus device for integrating blockchain and directed acyclic graph networks provided by an embodiment of the present invention. This device and the intelligent consensus method for integrating blockchain and directed acyclic graph networks in the above-mentioned embodiments belong to the same inventive concept. For details not fully described in the embodiment of the intelligent consensus device for integrating blockchain and directed acyclic graph networks, reference can be made to the embodiment of the intelligent consensus method for integrating blockchain and directed acyclic graph networks described above.
[0088] Figure 3 This is a schematic diagram of the structure of an intelligent consensus device that integrates blockchain and directed acyclic graph network provided by an embodiment of the present invention. This embodiment is applicable to the case of intelligent consensus on transactions in a distributed ledger network. Figure 3 As shown, the device specifically includes: a current network load index determination module 310, a target network mode determination module 320, a network mode switching module 330, a blockchain consensus module 340 and a directed acyclic graph consensus module 350.
[0089] Among them, the current network load index determination module 310 is used to determine the current network load index based on the total number of transactions generated in the current time period, the delay information and transaction weight of each transaction, and the computational cost of each node in the current network in the current time period, wherein the current time period is a time period with the current moment as the end moment and a preset duration; the target network mode determination module 320 is used to compare the current network load index with the preset load index and determine the target network mode based on the comparison result, wherein the target network mode includes: a blockchain network mode or a directed acyclic graph network mode; the network mode switching module 330 is used to switch the current network mode to the target network mode if the current network mode is different from the target network mode; the blockchain consensus module 340 is used to, in response to the target network mode being the blockchain network mode, perform consensus processing on the target transactions generated after the current moment according to the preset blockchain consensus method corresponding to the blockchain network mode; the directed acyclic graph consensus module 350 is used to, in response to the target network mode being the directed acyclic graph network mode, perform consensus and parallel processing on the target transactions generated after the current moment according to the weighted confirmation consensus method corresponding to the directed acyclic graph network mode;
[0090] The current network load index determination module determines the current network load index according to the following formula:
[0091]
[0092] Where T is the current network load index corresponding to the current time period; N t is the total number of transactions generated in the current time period; d i is the delay information of the i-th transaction; w i is the transaction weight of the i-th transaction; N is the number of nodes in the current network in the current time period; p i is the computational cost of the i-th node; α, β, γ, δ, and φ are weight coefficients; λ is a scaling factor used to adjust the sensitivity of the sigmoid function.
[0093] The technical solution of this embodiment comprehensively considers the total number of transactions generated in the current time period, the delay information and transaction weight of each transaction, and the computational cost of each node in the current network in the current time period, and can accurately determine the current network load index in real time, and compare the current network load index with the preset load index. According to the comparison result, the current appropriate target network mode can be determined in real time; if the current network mode is different from the target network mode, the current network mode is switched to the target network mode. If the target network mode is a blockchain network mode, the target transactions generated after the current moment are processed according to the preset blockchain consensus method corresponding to the blockchain network mode, thereby ensuring data security in low transaction volume conditions; if the target network mode is a directed acyclic graph network mode, the target transactions generated after the current moment are processed according to the weighted confirmation consensus method corresponding to the directed acyclic graph network mode, thereby improving consensus efficiency in high transaction volume conditions. By dynamically switching between the blockchain network mode and the directed acyclic graph network mode according to the current network load index, a more appropriate consensus method can be used for transaction consensus processing, thereby effectively balancing consensus efficiency and security.
[0094] Optionally, f(d i ) is an exponential function used to measure transaction propagation time or dependency depth.
[0095] Optionally, the target network mode determination module 320 is specifically configured to:
[0096] If the current network load index is greater than the first preset load index, the directed acyclic graph network mode is determined as the target network mode; if the current network load index is less than the second preset load index, the blockchain network mode is determined as the target network mode; wherein, the first preset load index is greater than or equal to the second preset load index.
[0097] Optionally, the directed acyclic graph consensus module 350 includes:
[0098] A confirmation score determination unit, configured to determine a confirmation score corresponding to each target transaction generated after the current moment based on a weighted graph structure in a directed acyclic graph network;
[0099] A confirmation and verification unit is used to determine the cumulative weight corresponding to each target transaction based on the confirmation score corresponding to each target transaction, and to confirm and verify each target transaction based on the cumulative weight corresponding to each target transaction to obtain the target transaction that has passed the verification;
[0100] The transaction adding unit is used to determine the processing order corresponding to the verified target transaction according to the confirmation score corresponding to the verified target transaction, and add the verified target transaction to the directed acyclic graph network according to the processing order.
[0101] Optionally, the confirmation score determination unit is specifically configured to:
[0102] For each target transaction generated after the current moment, the target edge set of the target node corresponding to the target transaction in the directed acyclic graph network, as well as the edge weight and node distance corresponding to each target edge in the target edge set are determined according to the weighted graph structure in the directed acyclic graph network, wherein each target edge in the target edge set is an edge pointing to the target node; based on the edge weight and node distance corresponding to each target edge in the target edge set, the confirmation score corresponding to the target transaction is determined.
[0103] Optionally, the confirmation score determining unit determines the confirmation score corresponding to the target transaction according to the following formula:
[0104]
[0105] Among them, C(T j ) is the target node T corresponding to the target transaction j Corresponding confirmation score; E j is the target node T j The corresponding target edge set; (T i ,T j ) refers to a target edge set from T i Pointing to T j The target edge of w ij It refers to the target edge (T i ,T j ) corresponding edge weight; d ij It refers to the target edge (T i ,T j ) corresponds to the node distance; f(d ij ) is about d ij The decay function of .
[0106] The intelligent consensus device for integrating blockchain and directed acyclic graph network provided in an embodiment of the present invention can execute the intelligent consensus method for integrating blockchain and directed acyclic graph network provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the intelligent consensus method for integrating blockchain and directed acyclic graph network.
[0107] It is worth noting that in the embodiment of the intelligent consensus device integrating the blockchain and the directed acyclic graph network, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other and are not used to limit the scope of protection of the present invention.
[0108] Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. Figure 4 A block diagram of an exemplary electronic device 12 suitable for implementing embodiments of the present invention is shown. Figure 4 The electronic device 12 shown is only an example and should not limit the functionality and scope of use of the embodiments of the present invention.
[0109] like Figure 4 As shown, electronic device 12 is implemented as a general-purpose computing device. Components of electronic device 12 may include, but are not limited to, one or more processors or processing units 16, system memory 28, and a bus 18 that connects various system components (including system memory 28 and processing unit 16).
[0110] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. Examples of these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0111] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0112] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory 30 (RAM) and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be configured to read and write non-removable, non-volatile magnetic media ( Figure 4 Not shown, often called a "hard drive"). Although Figure 4Not shown, a magnetic disk drive for reading and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various embodiments of the present invention.
[0113] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0114] The electronic device 12 can also communicate with one or more external devices 14 (e.g., a keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the electronic device 12, and / or any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication can occur via an input / output (I / O) interface 22. Furthermore, the electronic device 12 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown, other hardware and / or software modules can be used in conjunction with the electronic device 12, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0115] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the steps of an intelligent consensus method for integrating a blockchain and a directed acyclic graph network provided in any embodiment of the present invention.
[0116] Of course, those skilled in the art will understand that the processor can also implement the technical solution of the intelligent consensus method for integrating blockchain and directed acyclic graph network provided by any embodiment of the present invention.
[0117] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the program implements the steps of the intelligent consensus method for integrating blockchain and directed acyclic graph network as provided in any embodiment of the present invention.
[0118] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.
[0119] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0120] Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0121] An embodiment of the present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the intelligent consensus method for integrating blockchain and directed acyclic graph network as provided in any embodiment of the present invention.
[0122] The computer program product may be implemented by writing computer program code for performing the operations of the present invention in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0123] Those skilled in the art will appreciate that the modules or steps of the present invention described above can be implemented using a general-purpose computing device. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computer device, which can then be stored in a storage device and executed by the computing device. Alternatively, they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
[0124] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.
Claims
1. An intelligent consensus method integrating blockchain and directed acyclic graph network, characterized in that: include: Determine the current network load index based on the total number of transactions generated in the current time period, the latency information and transaction weight of each transaction, and the computational cost of each node in the current network during the current time period, where the current time period is a time period with a preset duration starting at the current moment and ending at the current moment; Comparing the current network load index with a preset load index, and determining a target network mode based on the comparison result, wherein the target network mode includes: a blockchain network mode or a directed acyclic graph network mode; If the current network mode is different from the target network mode, switching the current network mode to the target network mode; In response to the target network mode being a blockchain network mode, performing consensus processing on target transactions generated after the current moment according to a preset blockchain consensus method corresponding to the blockchain network mode; In response to the target network mode being a directed acyclic graph network mode, consensus-driven parallel processing is performed on target transactions generated after the current moment according to a weighted confirmation consensus method corresponding to the directed acyclic graph network mode; The current network load index is determined according to the following formula: Where T is the current network load index; N t is the total number of transactions generated in the current time period; d i is the delay information of the i-th transaction; f(d i ) is a function used to characterize the delay between the i-th transaction and other transactions; w i is the transaction weight of the i-th transaction; N is the number of nodes in the current network in the current time period; p i is the computational cost of the i-th node; α, β, γ, δ, and φ are weight coefficients; λ is a scaling factor used to adjust the sensitivity of the sigmoid function.
2. The method according to claim 1, characterized in that f(d i ) is an exponential function used to measure transaction propagation time or dependency depth.
3. The method according to claim 1, characterized in that Comparing the current network load index with a preset load index, and determining a target network mode according to the comparison result, including: If the current network load index is greater than a first preset load index, determining the directed acyclic graph network mode as the target network mode; If the current network load index is less than a second preset load index, determining the blockchain network mode as the target network mode; Wherein, the first preset load index is greater than or equal to the second preset load index.
4. The method according to claim 1, wherein According to the weighted confirmation consensus method corresponding to the directed acyclic graph network model, consensus and parallel processing are performed on target transactions generated after the current moment, including: Based on the weighted graph structure in the directed acyclic graph network, determine the confirmation score corresponding to each target transaction generated after the current moment; Determine the cumulative weight of each target transaction based on the confirmation score of each target transaction, and verify each target transaction based on the cumulative weight of each target transaction to obtain the verified target transaction; According to the confirmation scores corresponding to the verified target transactions, a processing order corresponding to the verified target transactions is determined, and the verified target transactions are added to the directed acyclic graph network according to the processing order.
5. The method according to claim 4, characterized in that Based on the weighted graph structure in the directed acyclic graph network, the confirmation score corresponding to each target transaction generated after the current moment is determined, including: For each target transaction generated after the current moment, determine, based on the weighted graph structure in the directed acyclic graph network, a target edge set of the target node corresponding to the target transaction in the directed acyclic graph network, as well as the edge weight and node distance corresponding to each target edge in the target edge set, wherein each target edge in the target edge set is an edge pointing to the target node; A confirmation score corresponding to the target transaction is determined according to the edge weight and node distance corresponding to each target edge in the target edge set.
6. The method according to claim 5, characterized in that The confirmation score corresponding to the target transaction is determined according to the following formula: Among them, C(T j ) is the target node T corresponding to the target transaction j Corresponding confirmation score; E j is the target node T j The corresponding target edge set; (T i ,T j ) refers to a target edge set from T i Pointing to T j The target edge of w ij It refers to the target edge (T i ,T j ) corresponding edge weight; d ij It refers to the target edge (T i ,T j ) corresponds to the node distance; f(d ij ) is about d ij The decay function of .
7. An intelligent consensus device integrating blockchain and directed acyclic graph network, characterized in that: include: a current network load index determination module, configured to determine the current network load index based on the total number of transactions generated in a current time period, the latency information and transaction weight of each transaction, and the computational cost of each node in the current network during the current time period, wherein the current time period is a time period with a preset duration and ending at the current moment; a target network mode determination module, configured to compare the current network load index with a preset load index and determine a target network mode based on the comparison result, wherein the target network mode includes: a blockchain network mode or a directed acyclic graph network mode; A network mode switching module, configured to switch the current network mode to the target network mode if the current network mode is different from the target network mode; a blockchain consensus module, configured to, in response to the target network mode being the blockchain network mode, perform consensus processing on target transactions generated after the current moment according to a preset blockchain consensus method corresponding to the blockchain network mode; A directed acyclic graph consensus module, configured to, in response to the target network mode being a directed acyclic graph network mode, perform consensus and parallel processing on target transactions generated after the current moment according to a weighted confirmation consensus method corresponding to the directed acyclic graph network mode; The current network load index determination module determines the current network load index according to the following formula: Where T is the current network load index corresponding to the current time period; N t is the total number of transactions generated in the current time period; d i is the delay information of the i-th transaction; w i is the transaction weight of the i-th transaction; N is the number of nodes in the current network in the current time period; p i is the computational cost of the i-th node; α, β, γ, δ, and φ are weight coefficients; λ is a scaling factor used to adjust the sensitivity of the sigmoid function.
8. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the intelligent consensus method for integrating the blockchain and the directed acyclic graph network as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, an intelligent consensus method for integrating a blockchain with a directed acyclic graph network as described in any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, characterized in that When executed by a processor, the computer program implements an intelligent consensus method for integrating a blockchain with a directed acyclic graph network as described in any one of claims 1 to 6.
Citation Information
Patent Citations
A high performance FAAS system based on block chain
CN109508432A
Self-adaptive extensible consensus method based on block chain and directed acyclic graph
CN119071304A