A chain network collaborative distributed consensus method based on a DAG blockchain

Through the chain network collaborative distributed consensus method, the node computing resources and communication layer routing bandwidth allocation are dynamically adjusted, which solves the problems of excessive computing resource consumption and increased transaction delays in the DAG blockchain system and improves the system's throughput and performance.

CN119892340BActive Publication Date: 2025-10-17UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510048444.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-10-17
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

The existing DAG blockchain architecture suffers from excessive computing resource consumption and increased transaction latency when processing large-scale business, and does not fully consider the limitations of the underlying communication network, resulting in reduced system throughput and network congestion.

Method used

A chain network collaborative distributed consensus method is adopted to dynamically adjust the node computing resource allocation and communication layer routing bandwidth allocation. The resource allocation strategy is optimized through multi-agent reinforcement learning. Combined with the optimization models of the consensus layer and the communication layer, the average transaction latency is reduced.

Benefits of technology

Under the premise of meeting the constraints of business delay and system resource limit, the throughput of the DAG blockchain system is improved, the average transaction on-chain delay is reduced, and the scalability and performance of the system are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892340B_ABST
    Figure CN119892340B_ABST
Patent Text Reader

Abstract

The application discloses a chain network cooperative distributed consensus method based on a DAG block chain, first divides a block chain system into a consensus layer and a communication layer, then proposes a scheme of base multi-agent and reinforcement learning technology, dynamically jointly optimizes the calculation resource division of the consensus layer node, the communication layer routing and the bandwidth resource according to the real-time business demand and the real-time use state of the communication network resource, and iteratively outputs an optimal resource allocation strategy. The method dynamically adjusts the calculation resource of the node, under the premise of meeting the business calculation delay demand, allocates part of the calculation resource for approving and verifying other transactions, improves the priority of the own transaction, reduces the average on-chain delay of the transaction, and improves the overall performance of the DAG block chain system, and simultaneously considers the optimization of the underlying communication network supporting the message transmission in the consensus process, applies the multi-agent reinforcement learning technology to learn the routing and bandwidth allocation scheme, so that the average on-chain delay of the transaction is as low as possible.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of data management and evidence storage and mobile network application, and particularly relates to a chain network cooperative distributed consensus method based on a DAG blockchain. BACKGROUND

[0002] As a decentralized, transparent and secure distributed ledger technology, blockchain has been widely used in the fields of finance, supply chain and Internet of Things. However, with the continuous increase of business traffic, the existing global consensus mechanism becomes inefficient under the pressure of processing large-scale business, which limits the scalability of the system. At the same time, the existing blockchain consensus methods, such as PoW or PoS, essentially compete for computing power or rights, which consumes too much computing resources. In addition, due to the inherent linear chain structure of the unchangeable time sequence, the existing blockchain consensus method causes the increase of the delay of transaction chaining confirmation in the system, the decrease of the system throughput and the network congestion.

[0003] In order to improve the scalability of the blockchain system and reduce the average delay of transaction chaining, in recent years, a distributed ledger technology based on directed acyclic graph (DAG) has been proposed. This DAG blockchain architecture has the advantages of higher transaction throughput, lower resource consumption and zero transaction fee, which can better overcome the performance limitations of traditional blockchain. The principle of DAG blockchain is to add new transactions in topological order. Without using resource-intensive computing to reach consensus, a node can issue a new transaction as long as it approves and verifies two or more previous transactions through a transaction selection algorithm. In the DAG blockchain, each transaction has a cumulative weight, which represents the number of times the transaction has been approved and verified. Generally speaking, the cumulative weight is an indicator of transaction credibility, and the credibility of the transaction is positively correlated with the cumulative weight. When the cumulative weight of a transaction reaches a confirmation threshold, the transaction is considered to have been confirmed in the DAG, and the transaction is officially chained.

[0004] “The Tangle”, 2018. Version 1.4.3 analyzes the mathematical foundation of IOTA, first proposes to use directed acyclic graph (DAG) to store transactions, and analyzes the working principle of DAG blockchain, latency performance, and performance under possible attack scenarios. The paper “Z. Chen, X. Chen and Y. Li, "Performance and Security Analysis of Distributed Ledger Under the Internet of Things Environments With Network Instability," in IEEE Internet of Things Journal, 2023” analyzes the performance and security of DAG blockchain in the Internet of Things with network instability, and analyzes the transaction propagation delay in the underlying network under different transaction generation rates, different average uplink bandwidths of nodes, and different numbers of neighbor nodes. The paper “W. Yang, L. Shi, H. Liang and W. Zhang, "Trusted Mobile Edge Computing: DAG Blockchain-Aided Trust Management and Resource Allocation," in IEEE Transactions on Wireless Communications, May” proposes to implement the execution of computationally intensive and delay-sensitive tasks in Internet of Things applications, and proposes to jointly optimize bandwidth and computing resources based on the DAG blockchain structure to minimize system latency. The paper “J. Xie, K. Zhang, Y. Lu and Y. Zhang, "Resource-Efficient DAG Blockchain with Sharding for 6G Networks," in IEEE Network, 2022” proposes a blockchain scaling solution combining directed acyclic graph and sharding, and proposes a high-computing-efficiency consensus algorithm that uses the computing power of nodes to improve resource utilization efficiency. However, the above research works still have the following problems:

[0005] (1) Most existing research based on DAG blockchain architecture selects a fixed number of other transactions for approval and verification based on random selection, reputation value, or generation time, and few consider combining computing resources with contribution value or proof of work selection strategies, which can further improve the performance of DAG blockchain and reduce the average on-chain latency of transactions.

[0006] (1) The existing DAG blockchain architecture mainly focuses on the transaction selection strategy of the consensus layer and the consensus delay calculation problem, and ignores the limitations of the underlying communication network. Most existing research assumes that the network environment is stable and reliable and that communication resources are sufficient. However, in real blockchain system scenarios, the topology of the communication network, the routing selection between devices, and the bandwidth allocation of the transmission channel have a significant impact on the performance of the blockchain system.

[0007] Therefore, the prior art lacks an effective DAG blockchain consensus scheme that takes into account the optimization of the underlying network, thereby improving the throughput of the DAG blockchain system and reducing the average on-chain delay of transactions under limited communication resources and computing resources. SUMMARY

[0008] To solve the above technical problems, the present application provides a chain network collaborative distributed consensus method based on DAG blockchain, which dynamically adjusts the allocation strategy of node computing resources according to the real-time business requirements, and maps the routing and bandwidth allocation of message transmission in the communication layer from the upper consensus process. While meeting the business delay and system resource upper limit constraints, the optimal average on-chain delay is achieved.

[0009] The technical scheme adopted by the present application is as follows: a chain network collaborative distributed consensus method based on DAG blockchain, the specific steps are as follows:

[0010] S1, divide the DAG blockchain system into a consensus layer and a communication layer;

[0011] The consensus layer is a DAG blockchain network, including all nodes in the network, and the communication layer is an underlying communication network that supports the diffusion of transactions by nodes in the consensus phase. The nodes are mapped to terminal devices in the communication layer, and the underlying communication network includes terminal devices and physical links between devices.

[0012] Among them, it is assumed that the blockchain system contains N nodes, and the nodes are mapped to network terminal devices in the communication layer, that is, the communication layer contains N terminal devices. And in the communication layer, the underlying network topology composed of network terminal devices and physical links is predetermined.

[0013] S2, divide the system time into continuous fixed time slots, one time slot length T s , and one time slot is divided into two parts, the first part is the calculation time slot T cal , and the second part is the diffusion time slot T tr ;

[0014] The computing time slot completes the computing and verifying task, each node in the network as a MEC server uses its own computing resource to provide computing service for the computing-intensive task offloaded to itself by the user, and simultaneously as a verifying node completes the approval and verification of the transaction generated by other nodes; after the computation is completed, the nodes form a new transaction of this round, and one transaction includes three parts: the task computing result, the verified other transaction information and the node's own signature.

[0015] The diffusion time slot completes the transaction diffusion task, each node diffuses the transaction generated by itself to other nodes in the network according to the calculated routing information and using the bandwidth allocated to itself by the system.

[0016] S3, based on step S2, constructing a computing resource allocation strategy of each node at the consensus layer;

[0017] S4, based on step S2, constructing a routing and bandwidth allocation strategy of each node at the communication layer;

[0018] S5, constructing a DAG block chain consensus delay calculation model, i.e. a cumulative weight growth model;

[0019] S6, based on the model constructed in step S5, constructing a resource allocation model in a chain network fusion scenario, using a fixed branch method to solve the computing resource allocation strategy and the routing and bandwidth allocation strategy constructed in steps S3 and S4, and outputting the optimal resource allocation strategy through iteration.

[0020] Further, the step S3 is specifically as follows:

[0021] The total number of computing resources, i.e. CPU resources, possessed by each node in the network is set as f, and the size of the computing-intensive task designed for the user offloaded computing-intensive task is set as D. The node allocates its computing resources, a part of the computing resources f cal is used to compute the user offloaded computing-intensive task, i.e. the user computing task itself, another part of the computing resources f ver is used to approve and verify the transaction generated by other nodes.

[0022] wherein, f cal +f ver ≤f. The time required for the computing task is T cal =D / f cal , a transaction is set as B, and the total number of transactions approved and verified by the node using the computing resources allocated for verifying transactions during the computing time slot T cal is represented as n ver =f ver ·T cal / B.

[0023] Then a transaction verification selection method is designed, and the verification queue priority is set according to the number k of transactions verified by a transaction, and the to-be-verified transaction queue is organized in the order of priority size. When a transaction is broadcast to other nodes, it enters the to-be-verified transaction queue of the corresponding node. Each node calculates the number k of other transactions that can be verified in the current round according to the calculation time slot length T cal and the allocation of computing resources, and selects the top k transactions with the highest priority from the to-be-verified transaction queue of the node to approve and verify. The number k of other transactions verified by a transaction a is positively correlated with the probability of the transaction a being directly verified by other consensus nodes.

[0024] Further, the step S4 is specifically as follows:

[0025] In the communication layer, the underlying network topology is abstracted as an undirected graph G(V, E). Let C represent the upper limit of the bandwidth that each physical link can carry.

[0026] Wherein, V represents the point set of the undirected graph, that is, the set of all nodes in the network, and E represents the edge set of the undirected graph, that is, the set of physical links between terminal devices; e u,v ∈E represents a one-hop direct physical link between any device nodes u and v. Since the graph is undirected, e u,v = e v,u .

[0027] For each transaction generated by a node in the network, determine the route of the transaction spreading to other nodes in the network, and allocate bandwidth on the physical link in its path. Let the source node of the generated transaction be x. For the source node x of the generated transaction a, the communication layer finds a spanning tree in the network topology with x as the root node, obtains the path between the source node x and any node y, and allocates bandwidth to each physical link e in the spanning tree. The routing information is represented as

[0028] Wherein, represents the physical link e passed through in the routing information of the node x. Let C x represent the bandwidth allocated by the communication layer to the node x.

[0029] Then each node calculates the number n of other nodes in the spreading range of its own transaction according to the diffusion time slot length T tr of the current round, the routing and bandwidth allocation, and the number n of other nodes in the spreading range of the transaction a is positively correlated with the number of the transaction a being directly verified by other consensus nodes.

[0030] In the consensus process, the size of each transaction is B, the bandwidth of the node x is C x , and the one-hop transmission delay is represented as T one-hop=B / C x , the maximum communication hop number of the transmission link is denoted as tr The number of transactions that node x spreads to other nodes within the transaction diffusion task time slot is

[0031] where N represents the number of nodes in the network, h x,i (g x ) represents the hop function between node x and node i, when the hop number is less than the maximum communication hop number, then h x,i (g x ) = 1.

[0032] Further, the step S5 is specifically as follows:

[0033] In the consensus layer, a DAG blockchain consensus delay calculation model is constructed. In the DAG blockchain system, the initial weight of a transaction a generated at the time is 1, and the transaction a can be directly verified by other transactions. When these transactions are directly verified by subsequent new transactions, the transaction a is indirectly verified, and the cumulative weight is the weight and of the transaction after being directly or indirectly verified. The growth process of the cumulative weight of a transaction a is modeled as two stages: an adaptation stage and a linear growth stage. The expression of the final on-chain delay of a transaction is as follows:

[0034] T d = T a + T l

[0035] where T a represents the delay of the cumulative weight in the adaptation stage, and T l represents the delay of the linear growth stage of the cumulative weight. The number k of transactions verified by the transaction a and the number n of diffusion nodes are negatively related to the final on-chain delay of the transaction a.

[0036] The consensus delay calculation method in the DAG blockchain consensus delay calculation model is specifically as follows:

[0037] (1) The consensus delay calculation based on the number k of transactions verified by other transactions;

[0038] In the calculation time slot, a node allocates part of its own computing resources for approving the verification of transactions generated by other nodes and then diffused to itself. Therefore, there is a priority queue of transactions to be verified at each node, and the queue is prioritized according to the number of transactions verified by each transaction.

[0039] The more transactions a transaction approves to verify, the earlier the transaction is in the queue after being diffused to other nodes, and the higher the probability of being selected for verification, thereby reducing the on-chain delay. ​

[0040] (2) Consensus delay calculation based on the number of transaction diffusion nodes n;

[0041] In the diffusion time slot, the node diffuses the transaction generated by itself to other nodes according to the calculated routing information using the bandwidth allocated by the system. The more nodes that can be diffused, the more times the transaction is directly verified in the consensus phase, and finally the transaction final on-chain delay is reduced.

[0042] The cumulative weight growth model of a new transaction is expressed as follows: in the adaptive phase, the weight is increased by .

[0043] Where t represents time, W(t) represents the expected cumulative weight of a transaction as a function of time, h represents the average disclosure time of a transaction, i.e. the length of a time slot T s ; F ver represents the verification factor; represents the diffusion factor.

[0044] After the adaptive phase, enter the linear growth phase, and the cumulative weight increases linearly at a rate of λ, and λ is expressed as follows:

[0045]

[0046] Where T a represents the length of the adaptive phase, and the expression of T a is as follows:

[0047]

[0048] The expression of the cumulative weight at the end of the adaptive phase is as follows:

[0049]

[0050] The cumulative weight expression at different times is as follows:

[0051]

[0052] Set the cumulative weight threshold for a transaction to be officially on-chain as w, then the time T l in the linear growth phase is expressed as follows:

[0053]

[0054] Further, the step S6 is specifically as follows:

[0055] S61, construct a resource allocation model in a chain network fusion scenario, and determine the objective function;

[0056] Based on steps S3, S4, a resource allocation model in a chain network fusion scenario is constructed, by dynamically adjusting the computing resource allocation of each node in the network and by designing the routing and bandwidth allocation strategy of the communication layer, with the objective of minimizing the average per-node transaction uplink delay, then the objective function expression is as follows:

[0057]

[0058] f i,ver +f i,cal ≤f i

[0059] T i,cal +T i,tr ≤T s

[0060] T i,cal ≤T cal,m

[0061] Wherein, C=[C1,C2,…,C N ] represents the bandwidth allocation in the system, f=[f 1, f2,…,f N ] represents the computing resource allocation of each node, R=[R1,R2,…,R N ] represents the routing information of each node, the decision variable of the objective function is the node computing resource allocation f i,ver , f i,cal and routing and bandwidth allocation R i , C i , f i,cal represents the computing resource allocated by node i for computing-intensive tasks, f i,ver represents the computing resource allocated by node i for verifying other transactions; C i represents the bandwidth allocated by the system for node i in the communication layer, R i represents the routing information of node i in the communication layer. The first constraint condition represents that the bandwidth resource allocated on any physical link should not exceed the bandwidth upper limit of the physical link, the second constraint condition is that the sum of the computing and verification computing resources of any node should not exceed the upper limit of the computing resources of the node, the third constraint condition is that the computing time slot of any node should not exceed the time slot length T s , and the fourth constraint condition is that the length of the computing time slot should not exceed the tolerance upper limit.

[0062] S62, model the routing and bandwidth allocation strategy of the communication layer as a multi-item network flow problem, and solve the routing and bandwidth allocation strategy by using the multi-agent reinforcement learning (MARL) method;

[0063] The computing resource allocation result of each node is known, i.e., the amount of computing resources f allocated by each node for a computing task is known i,cal The computing time slot length T of each node is calculated i,cal The diffusion time slot length T of each node is obtained i,tr And the amount of computing resources f allocated by each node for verifying other transactions i,ver Replace the computing resource-related variables with a constant M, and C i And R i are decision variables, then the routing and bandwidth allocation strategy problem is expressed as follows:

[0064]

[0065] t i ≤T i,tr

[0066] That is, under the condition of known computing resource allocation, under the premise of determining the diffusion time slot of each node, the routing and bandwidth allocation strategy of each node is dynamically adjusted to make the average on-chain latency shortest. The problem is solved by using multi-agent reinforcement learning. In the MARL model, three key parts are defined, which are: state space, action space and reward function, as follows:

[0067] 1) State space;

[0068] The state space contains all possible network configurations or conditions, and each state represents a specific arrangement of network elements, including: routing information combination of each node, traffic load state of the link, and bandwidth allocation state of each link. Define the transaction generated by node i as a i , the number of transactions flowing through link j as n j , and the set of transactions flowing through link j as l j ={a i ,…,a k}, define L={l1,l2,…,l E} as the state information of each communication link; define f i,j ={C i,j ,t i,j} as the state information of transaction generated by node i at link j, C i,j represents the bandwidth allocated to node i by link j, and t i,j represents the total communication delay of transaction a i from the source node to link j, if t i,j >T i,tr , i.e., the communication delay is greater than the diffusion time slot length of node i, then C i,j =0, F={f 1,1 ,f 1,2..., f N,j} represents the state information of each node on each link. The state space is denoted as S, and the state s t ∈ S at round t is denoted as s t ={L, F}.

[0069] 2) Action space;

[0070] Routing needs to generate a spanning tree for each node as a source node as a communication path to other nodes. Based on the above consideration of the state space, the action space of the current round needs to give the routing information of each node in the next round of the DAG blockchain system, that is, the spanning tree with each node as the root node. The routing information of node i is denoted as wherein Ri represents the routing information of node i passing through physical link e, and R={R1,..., R N} represents the routing state information of each node, and the action space expression of round t is as follows:

[0071] a t ={R}

[0072] 3) Reward function;

[0073] At round t, the reinforcement learning agent selects an action under the state s t , and obtains the immediate reward r t from the environment, and then updates to the state s t+1 .

[0074] In the routing and bandwidth allocation strategy problem, the average uplink delay is used to represent the performance of the routing algorithm under the same network topology and link bandwidth constraint, and the diffusion time slot length of each node and the bandwidth limit of each physical link are used as constraints, and the reward function of round t is defined as r t (s t ,a t ) = T, wherein F i,tr in T is determined by the routing and bandwidth allocation scheme solved by the communication layer. The expression of the bandwidth constraint of the physical link of the system is as follows:

[0075]

[0076] The expression of the diffusion time slot length constraint of each node is as follows:

[0077] t i ≤ T i,tr

[0078] When the routing and bandwidth allocation strategy meets the two constraints, the average uplink latency is used as a single-step reward to guide the reinforcement learning model to update parameters; when the routing and bandwidth allocation strategy does not meet the two constraints, the reward is set to 0 to make the model realize the irrationality of the decision.

[0079] S63, in the computing resource allocation of the consensus layer, the gradient descent method and the Ipopt solver are applied to solve the computing resource allocation strategy;

[0080] The routing and bandwidth allocation strategy is known, that is, the system knows the bandwidth C allocated to each node i , and the spanning tree with each node as the root as the node routing information R i , the routing and bandwidth allocation related variables are replaced by a constant A, and f i,ver and f i,cal are used as decision variables, and the computing resource allocation strategy problem expression is as follows:

[0081]

[0082] s.t.f i,ver +f i,cal ≤f i

[0083] T i,cal +T i,tr ≤T s

[0084] T i,cal ≤T cal,m

[0085] That is, in the case of known routing and bandwidth allocation, the computing resource allocation strategy of each node is dynamically adjusted, expressed as f={f 1,cal ,f 2,cal ,…,f N,cal}, where f i,cal represents the computing resource allocated to node i for computing tasks, and the optimization goal is to make the average uplink latency shortest. Gradient descent method and Ipopt solver are used to solve the problem. The solving steps are as follows:

[0086] 1) Select the initial point, select the minimum computing resource allocated to each node for computing tasks to meet the constraint that the computing time slot does not exceed the upper limit of tolerance, and set the learning rate, that is, the step length of each parameter update;

[0087] 2) Calculate the gradient of the objective function at the current parameter point. In the computing resource allocation strategy problem, the objective function is a multivariate function involving the computing resource allocation of each node, and the gradient expression is as follows:

[0088]

[0089] 3) Update parameters, update parameters according to gradient and learning rate, and the update formula is as follows:

[0090]

[0091] Wherein, alpha represents learning rate, and determines the step length of each update.

[0092] 4) Check convergence, judge whether the current parameters meet the convergence condition, and set the maximum iteration number and the threshold value of the gradient norm, if the convergence condition is not met, repeat steps 2)-4) and update the parameters until the convergence condition is met;

[0093] 5) The parameters at the final convergence are taken as the output, and the calculation resources f i,ver And f i,cal allocation results corresponding to each node under the solution are generated.

[0094] S64, based on steps S61-S63, the optimal resource allocation strategy is output by iteration, and the optimal average on-chain delay of the DAG blockchain system is achieved.

[0095] The beneficial effects of the present application: the method of the present application first divides the blockchain system into a consensus layer and a communication layer, the consensus layer adopts a DAG blockchain architecture, and the communication layer is a bottom network supporting the propagation of transaction information of nodes in the consensus stage, then a scheme of base multi-agent and reinforcement learning technology is proposed, according to the real-time business demand and the real-time use state of the communication network resources, the calculation resources of the consensus layer nodes, the communication layer routing and the bandwidth resources are dynamically jointly optimized, so as to achieve the optimal average on-chain delay of the DAG blockchain system while meeting the business delay and system resource upper limit constraints. The method of the present application dynamically adjusts the calculation resources of the nodes, under the premise of meeting the business calculation delay demand, allocates part of the calculation resources for approving and verifying other transactions, improves the priority of its own transaction, reduces the average on-chain delay of the transaction, and improves the overall performance of the DAG blockchain system. The method of the present application not only considers the calculation resource allocation problem of the nodes in the network, but also considers the optimization of the underlying communication network supporting the message transmission in the consensus process, based on the underlying communication network topology and the node communication demand, applies the multi-agent reinforcement learning technology to learn the routing and bandwidth allocation scheme, so as to reduce the average on-chain delay of the transaction as much as possible, and can cope with the scalability and delay performance challenges brought by large-scale blockchain application systems. BRIEF DESCRIPTION OF DRAWINGS

[0096] Figure 1 A flowchart of a DAG blockchain-based chain network cooperative distributed consensus method of the present application.

[0097] Figure 2 A DAG blockchain system scene schematic diagram in an embodiment of the present application. DETAILED DESCRIPTION

[0098] The method of the present application is further described below in conjunction with the accompanying drawings and examples.

[0099] As shown in the flow chart of a DAG blockchain-based chain network collaborative distributed consensus method of the present application, the specific steps are as follows: Figure 1

[0100] S1, divide the DAG blockchain system into a consensus layer and a communication layer;

[0101] The present embodiment proposes a mobile edge computing (MEC) scenario driven by a DAG blockchain architecture. As shown in the blockchain system scenario of the application, Figure 2 the blockchain system is required to face large-scale computing-intensive business flows, and each verification node in the system is required to first serve as an MEC server to perform calculation on tasks, and after the calculation is completed, the results are stored as new transactions in the DAG blockchain.

[0102] The consensus layer is a DAG blockchain network, including all nodes in the network, and the communication layer is an underlying communication network supporting the diffusion of transactions by nodes in the consensus phase. The nodes are mapped to terminal devices in the communication layer, and the underlying communication network includes terminal devices and physical links between devices.

[0103] Among them, it is assumed that the blockchain system contains N nodes, and the nodes are mapped to network terminal devices in the communication layer, i.e., the communication layer contains N terminal devices; and in the communication layer, the underlying network topology composed of network terminal devices and physical links is predetermined.

[0104] S2, divide the system time into consecutive fixed time slots, one time slot length T s , and one time slot is divided into two parts, the former part is the calculation time slot T cal , and the latter part is the diffusion time slot T tr ;

[0105] The calculation time slot completes the calculation and verification tasks. Each node in the network serves as an MEC server to provide calculation services for the computing-intensive tasks offloaded to itself by users using its own computing resources, and as a verification node to complete the approval and verification of transactions generated by other nodes. After the calculation is completed, the nodes form a new transaction for this round, and one transaction includes three parts: task calculation results, verified other transaction information, and node self-signature.

[0106] The diffusion time slot completes the transaction diffusion task. Each node diffuses the transaction generated by itself to other nodes in the network according to the calculated routing information using the bandwidth allocated by the system to itself.

[0107] ​The embodiment also considers multiple factors affecting the performance of the DAG blockchain system, as follows:

[0108] First, during the calculation time slot, each node needs to complete the approval verification of other transactions while completing the calculation task, both of which consume the node's own computing resources. In the case of limited node computing resources, the computing resources of the calculation task and the verification task need to be allocated. In the existing DAG blockchain, each transaction only needs to verify two other transactions. However, when a transaction approves and verifies multiple other transactions, it can improve its priority for being selected for verification, thereby reducing its on-chain delay, improving the performance of the blockchain system, and reducing the average on-chain delay.

[0109] Second, some existing DAG blockchain solutions pay less attention to the optimization of the underlying communication network, which is usually set to be stable and reliable, and the communication resources are sufficient. However, in the real blockchain system scenario, as the communication network supporting message transmission in the consensus network, factors such as the topology of the communication network, the routing selection between devices, and the bandwidth allocation of the transmission channel have a significant impact on the performance of the blockchain system.

[0110] S3, based on step S2, constructing a computing resource allocation strategy for each node at the consensus layer;

[0111] S4, based on step S2, constructing a routing and bandwidth allocation strategy for each node at the communication layer;

[0112] S5, constructing a DAG blockchain consensus delay calculation model, i.e., a cumulative weight growth model;

[0113] S6, based on the model constructed in step S5, constructing a resource allocation model in a chain-network fusion scenario, using a fixed branch method to solve the computing resource allocation strategy and the routing and bandwidth allocation strategy constructed in steps S3 and S4, and outputting the optimal resource allocation strategy through iteration.

[0114] In the embodiment, the step S3 is as follows:

[0115] The total number of CPU resources possessed by each node in the network is set to f. For the user-unloaded computing-intensive task, the size of the computing-intensive task is designed as D. The node allocates its computing resources, a part of which f cal is used to calculate the user-unloaded computing-intensive task, i.e., the user's calculation task itself, and another part of the computing resources f ver is used to approve and verify the transactions generated by other nodes.

[0116] wherein f cal +f ver≤f. The time required for the computing task is T cal =D / f cal , set the size of a transaction as B, during the time slot T cal , the node uses the computing resources allocated for verifying transactions to approve the total number of verified transactions, denoted as n ver =f ver ·T cal / B.

[0117] Then a transaction verification selection method is designed, which sets the verification queue priority according to the number k of transactions verified by a transaction, and organizes the waiting transaction queue according to the priority size in order. When a transaction is broadcast to other nodes, it enters the waiting transaction queue of the corresponding node. According to the length of the computing time slot T cal of the current round and the allocation of computing resources, the number k of other transactions that can be verified in this round is calculated, and the k transactions with the highest priority in the waiting transaction queue of the node are selected for verification. The number k of other transactions verified by transaction a is positively correlated with the probability of transaction a being directly verified by other consensus nodes.

[0118] In this embodiment, the step S4 is specifically as follows:

[0119] In the communication layer, the underlying network topology is abstracted as an undirected graph G(V, E). Set C represents the upper limit of the bandwidth that each physical link can carry.

[0120] Among them, V represents the point set of the undirected graph, that is, the set of all nodes in the network, E represents the edge set of the undirected graph, that is, the set of physical links between terminal devices; e u,v ∈E represents that there is a one-hop direct physical link between any device nodes u and v. Since the graph is undirected, e u,v =e v,u .

[0121] Due to the need for consensus, for each transaction generated by each node in the network, the route of the transaction spreading to other nodes in the network is determined, and the bandwidth is allocated on the physical link in its path. Set the source node of the generated transaction as x. For the source node x of the generated transaction a, the communication layer finds a spanning tree in the network topology with x as the root node to obtain the path between the source node x and any node y. The communication layer allocates bandwidth for each physical link e in the spanning tree, and the routing information is represented as

[0122] Among them, represents the physical link e in the routing information of node x. Set C x represents the bandwidth allocated by the communication layer for node x.

[0123] Then each node calculates the number of other nodes in the diffusion range of the transaction according to the length of the diffusion time slot T tr , the routing and bandwidth allocation, and the number of other nodes in the diffusion range of the transaction a, which is positively correlated with the number of the transaction a directly verified by other consensus nodes.

[0124] In the consensus process, the size of each transaction is B, and the bandwidth of node x is C x , the one-hop transmission delay is represented as T one-hop =B / C x , and in the transaction diffusion task time slot T tr , the maximum communication hop count of the transmission link is represented as Therefore, for node x, the number of other nodes to which the transaction of node x is diffused in the transaction diffusion task time slot is

[0125] Where N represents the number of nodes in the network, h x,i (g x ) represents a hop function between node x and node i, and when the hop count is less than the maximum communication hop count, h x,i (g x )=1.

[0126] In this embodiment, the step S5 is specifically as follows:

[0127] In the consensus layer, a DAG block chain consensus delay calculation model is constructed. The transaction on-chain delay refers to the time required for a transaction in the DAG block chain system to increase its cumulative weight to a threshold value from generation.

[0128] In the DAG block chain system, the initial weight of a transaction a when generated is 1, and the transaction a can be directly verified by other transactions. When these transactions are directly verified by subsequent new transactions, the transaction a is indirectly verified, and the cumulative weight refers to the weight sum of the transaction directly or indirectly verified. The growth process of the cumulative weight of a transaction a can be modeled as two stages, an adaptation stage and a linear growth stage. In the adaptation stage, since the transaction a is a newly generated transaction, it can only be directly verified by other node-generated transactions, so the cumulative weight grows slowly. With the continuous generation of new transactions, the cumulative weight of the transaction a will enter the linear growth stage, during which the transaction a is indirectly verified, so that its cumulative weight grows rapidly.

[0129] Therefore, the expression of the final on-chain delay of a transaction is as follows:

[0130] T d =T a +T l

[0131] Among them, T a represents the delay of the cumulative weight in the adaptation phase, T l Denotes the latency during the linear growth phase of cumulative weight. The number of transactions k verified by transaction a and the number of diffusion nodes n are negatively correlated with the final on-chain latency of transaction a.

[0132] The latency of a transaction on the blockchain depends primarily on the number of other transactions it verifies within the computation time slot and the number of nodes it propagates within the propagation time slot. The consensus latency calculation method in the DAG blockchain consensus latency calculation model is as follows:

[0133] (1) Calculation of consensus delay based on transaction verification of other transactions k;

[0134] During a computational time slot, a node allocates part of its own computing resources to approve and verify transactions generated by other nodes and then propagated to itself. In this case, each node has a priority queue of transactions to be verified, and the queue is prioritized according to the number of other transactions each transaction verifies.

[0135] Among them, the more other transactions an exchange approves for verification, the higher the transaction will be in the queue after being spread to other nodes, and the higher the probability of being selected for verification, which reduces its on-chain latency.

[0136] (2) Consensus delay calculation based on the number of transaction diffusion nodes n;

[0137] In the diffusion time slot, nodes use the bandwidth allocated by the system to diffuse their own transactions to other nodes based on the calculated routing information. The more nodes that can be diffused, the more times the transaction can be directly verified during the consensus phase, thereby reducing the final transaction on-chain latency.

[0138] The cumulative weight growth model of a new transaction is expressed as follows: In the adaptation stage, the weight is Increase.

[0139] Where t represents time, W(t) represents the expected cumulative weight of a transaction over time, and h represents the average disclosure time of a transaction, which can be understood as the duration of a time slot in this embodiment. s ; F ver Represents the verification factor, when the transaction approves the verification of other transactions n ver The more it is, the greater the contribution of the transaction to the DAG blockchain. When the transaction is spread to other nodes, the higher the priority of being selected for verification, thus increasing the value of this factor. To avoid the value of this factor being too large, it is normalized. Represents the diffusion factor. The more nodes in the network receive the transaction, the more times the transaction is directly verified, and the faster the weight grows.

[0140] After the adaptation phase, enter the linear growth phase, the cumulative weight linearly increases at the rate of λ, λ is expressed as follows:

[0141]

[0142] Where, T a represents the duration of the adaptation phase, then the expression of T a is as follows:

[0143]

[0144] The expression of the value of the cumulative weight at the end of the adaptation phase is as follows:

[0145]

[0146] The expression of the cumulative weight at different times is as follows:

[0147]

[0148] Set a cumulative weight threshold w for a transaction to be officially chained, then the time T l in the linear growth phase is expressed as follows:

[0149]

[0150] In this embodiment, the step S6 is specifically as follows:

[0151] S61, construct a resource allocation model in a chain network fusion scenario, determine the objective function;

[0152] Based on steps S3, S4, construct a resource allocation model in a chain network fusion scenario, through dynamically adjusting the calculation resource allocation of each node in the network and through designing the routing and bandwidth allocation strategy of the communication layer, try to meet the minimum transaction delay, with the goal of minimizing the average on-chain delay of each node generated transaction, then the expression of the objective function is as follows:

[0153]

[0154] f i,ver +f i,cal ≤f i

[0155] T i,cal +T i,tr ≤T s

[0156] T i,cal ≤T cal,m

[0157] wherein C = [C1, C2, …, C N ] represents the bandwidth allocation in the system, f = [f 1, f2, …, f N ] represents the computing resource allocation of each node, R = [R1, R2, …, R N ] represents the routing information of each node, and the decision variable of the objective function is the computing resource allocation f i,ver , f i,cal and the routing and bandwidth allocation R i , C i , f i,cal represents the computing resource allocated by the node i for the computation-intensive task, f i,ver represents the computing resource allocated by the node i for verifying other transactions; C i represents the bandwidth allocated by the system for the node i in the communication layer, and R i represents the routing information of the node i in the communication layer. The first constraint condition represents that the bandwidth resource allocated on any physical link cannot exceed the bandwidth upper limit of the physical link, the second constraint condition is that the sum of the computing and verification computing resources of any node cannot exceed the upper limit of the computing resources of the node, the third constraint condition is that the computing time slot and the diffusion time slot of any node cannot exceed the time slot length T s , and the fourth constraint condition is that the length of the computing time slot cannot exceed the tolerance upper limit.

[0158] To solve the optimization problem proposed above, the embodiment adopts the fixed branch method to decompose the optimization problem into two sub-problems of routing and bandwidth allocation determination and computing resource allocation. To optimize the average on-chain latency of the entire system, the embodiment iterates the two sub-problems until the optimal solution is output. The routing and bandwidth allocation strategy problem of the communication layer is modeled as a multi-item network flow problem, and a multi-agent reinforcement learning (MARL) method is used to learn the routing and bandwidth allocation strategy. In the computing resource allocation, a gradient descent method and an Ipopt solver are used to solve the computing resource allocation strategy.

[0159] S62, the routing and bandwidth allocation strategy problem of the communication layer is modeled as a multi-item network flow problem, and a multi-agent reinforcement learning (MARL) method is used to solve the routing and bandwidth allocation strategy.

[0160] Given the computing resource allocation results of each node, i.e., given the amount of computing resources f i,cal allocated by each node for computing tasks, the computing time slot length T i,cal of each node is calculated, and then the diffusion time slot length T i,tr of each node is obtained.and the amount of computational resource f each node allocates for verifying other transactions i,ver , replace the computational resource related variables with a constant M, and let C i and R i be the decision variables, then the routing and bandwidth allocation strategy problem can be expressed as follows:

[0161]

[0162] t i ≤T i,tr

[0163] That is, under the condition of known computational resource allocation and the determined diffusion time slot of each node, dynamically adjust the routing and bandwidth allocation strategy of each node to make the average on-chain latency shortest. Utilize multi-agent reinforcement learning to solve the problem, and define three key parts in the MARL model, which are state space, action space and reward function, as follows:

[0164] 1) State space;

[0165] The state space contains all possible network configurations or conditions, and each state represents a specific arrangement of network elements, including: the combination of routing information of each node, the traffic load state of the link and the bandwidth allocation state of each link. Define the transaction generated by node i as a i , the number of transactions flowing through link j as n j , and the set of transactions flowing through link j as l j ={a i ,…,a k}, define L={l1,l2,…,l E} as the state information of each communication link, and define f i,j ={C i,j ,t i,j} as the state information of the transaction generated by node i at link j, C i,j represents the bandwidth allocated to node i by link j, and t i,j represents the total communication delay of transaction a i from the source node to link j. If t i,j >T i,tr , i.e. the communication delay is greater than the diffusion time slot length of node i, then C i,j =0, and F={f 1,1 ,f 1,2 ,…,f N,j} represents the state information of each node on each link. The state space is denoted as S, and the state s t ∈S at round t is denoted as s t ={L,F}.

[0166] 2) Action space;

[0167] Routing needs to generate a spanning tree for each node as a source node as a communication path to other nodes. Based on the above state space considerations, the action space of the current round needs to give the routing information of each node in the next round of DAG blockchain system, that is, the spanning tree with each node as the root node. The routing information of node i is defined as Wherein represents the routing information of node i through physical link e, R={R1,…,R N} represents the routing state information of each node, and the action space expression of round t is as follows:

[0168] a t ={R}

[0169] 3) Reward function;

[0170] At round t, the reinforcement learning agent selects an action under the state s t , obtains the immediate reward r t from the environment, and then updates to the state s t+1 .

[0171] The optimization goal of dynamic adjustment of routing and bandwidth allocation strategy of DAG blockchain system is to minimize the average transaction on-chain delay of the system under the condition of meeting the bandwidth limit requirements of each link, and to realize the optimal system performance under the condition of limited communication resources. In the routing and bandwidth allocation strategy problem, the average on-chain delay is used to represent the performance of the routing algorithm under the same network topology and link bandwidth constraint, and the diffusion time slot length of each node and the bandwidth limit of each physical link are used as constraints, then the reward function of round t is defined as r t (s t ,a t )=T, wherein F i,tr in T is determined by the routing and bandwidth allocation scheme solved by the communication layer. The expression of the bandwidth constraint of the physical link of the system is as follows:

[0172]

[0173] The expression of the diffusion time slot length constraint of each node is as follows:

[0174] t i ≤T i,tr

[0175] When the routing and bandwidth allocation strategy meets the two constraints, the average uplink latency is used as a single-step reward to guide the reinforcement learning model to update the parameters; when the routing and bandwidth allocation strategy does not meet the two constraints, the reward is set to 0 to make the model realize the irrationality of the decision, so as to make it iterate to a better routing and bandwidth allocation strategy.

[0176] S63, in the computing resource allocation of the consensus layer, the gradient descent method and the Ipopt solver are applied to solve the computing resource allocation strategy;

[0177] The known routing and bandwidth allocation strategy, that is, the bandwidth C allocated by the system to each node i and the spanning tree with each node as the root as the node routing information R i , the routing and bandwidth allocation related variables are replaced by a constant A, and f i,ver and f i,cal are calculated as decision variables, and the computing resource allocation strategy problem is expressed as follows:

[0178]

[0179] s.t.f i,ver +f i,cal ≤f i

[0180] T i,cal +T i,tr ≤T s

[0181] T i,cal ≤T cal,m

[0182] That is, in the case of known routing and bandwidth allocation, the computing resource allocation strategy of each node is dynamically adjusted, expressed as f = {f 1,cal ,f 2,cal ,…,f N,cal}, where f i,cal represents the computing resource allocated by node i for computing tasks, and the optimization goal is to make the average uplink latency shortest. Gradient descent method and Ipopt solver are used to solve the problem. The solving steps are as follows:

[0183] 1) Select the initial point, select the minimum computing resource allocated to each node for computing tasks to meet the constraint that the computing time slot does not exceed the upper limit of tolerance, and set the learning rate, that is, the step length of each parameter update;

[0184] 2) Calculate the gradient of the objective function at the current parameter point. In the computing resource allocation strategy problem, the objective function is a multivariate function involving the computing resource allocation of each node, and the gradient expression is as follows:

[0185]

[0186] 3) Update parameters, update parameters according to gradient and learning rate, update formula as follows:

[0187]

[0188] Wherein, alpha indicates learning rate, determines the step length of each update.

[0189] 4) Check convergence, judge whether the current parameters meet the convergence condition, use the maximum iteration number and set the threshold of gradient norm, if the convergence condition is not reached, repeat steps 2)-4) and update parameters until the convergence condition is met;

[0190] 5) The parameters at the final convergence are taken as output, and the calculation resource f i,ver And f i,cal Allocation results.

[0191] S64, based on steps S61-S63, output the optimal resource allocation strategy through iteration, and achieve the optimal average on-chain delay of the DAG blockchain system.

[0192] In summary, the method of the application dynamically adjusts the computing resources of the nodes, under the premise of meeting the business computing delay demand, allocates part of the computing resources for approving and verifying other transactions, improves the priority of its own transaction, reduces the average on-chain delay of the transaction, and improves the overall performance of the DAG blockchain system, and not only considers the computing resource allocation problem of the nodes in the network, but also considers the optimization of the underlying communication network supporting the message transmission in the consensus process, learns the routing and bandwidth allocation scheme based on the underlying communication network topology and node communication demand, applies multi-agent reinforcement learning technology, so as to reduce the average on-chain delay of the transaction as much as possible, and can cope with the performance challenges of scalability and delay brought by large-scale blockchain application systems.

[0193] Those skilled in the art will appreciate that the embodiments described herein are presented to aid the reader in understanding the principles of the application and should not be construed as limiting the scope of the application to such specifically recited embodiments and examples. The application can have various modifications and alterations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the application should be included in the scope of the claims of the application.

Claims

1. A chain network collaborative distributed consensus method based on DAG blockchain, the specific steps are as follows: S1. Divide the DAG blockchain system into the consensus layer and the communication layer; The consensus layer is the DAG blockchain network, including all nodes in the network. The communication layer is the underlying communication network that supports node diffusion transactions in the consensus phase. Nodes are mapped to terminal devices in the communication layer. The underlying communication network includes: End devices and the physical links between them; It is assumed that the blockchain system contains N nodes, and the nodes are mapped to network terminal devices in the communication layer, that is, the corresponding communication layer contains N terminal devices; and in the communication layer, the underlying network topology composed of network terminal devices and physical links is predetermined; S2, divide the system time into continuous fixed time slots, the length of a time slot is T s , and a time slot is divided into two parts, the first part is the calculation time slot T cal , the latter part is the diffusion time slot T tr ; The computation time slot completes the computation and verification tasks. Each node in the network acts as an MEC server, using its own computing resources to provide computing services for the computation-intensive tasks offloaded to it by users. At the same time, it acts as a verification node to approve and verify the transactions generated by other nodes. After the computation is completed, the node forms a new transaction for this round. A transaction consists of three parts: the task computation result, other verified transaction information, and the node's own signature. The diffusion slot completes the transaction diffusion task. Each node uses the calculated routing information and the bandwidth allocated to it by the system to diffuse its own transactions to other nodes in the network. S3. Based on step S2, at the consensus layer, construct a computing resource allocation strategy for each node; S4. Based on step S2, at the communication layer, construct routing and bandwidth allocation strategies for each node; S5. Construct a DAG blockchain consensus delay calculation model, namely the cumulative weight growth model; S6. Based on the model constructed in step S5, a resource allocation model is constructed for the chain-network fusion scenario. The fixed branch method is used to solve the computing resource allocation strategy and the routing and bandwidth allocation strategy constructed in steps S3 and S4, respectively, and the optimal resource allocation strategy is output through iteration. S61. Construct a resource allocation model for the chain-network integration scenario and determine the objective function; S62. Model the routing and bandwidth allocation strategy problem of the communication layer as a multi-item network flow problem, and use the multi-agent reinforcement learning (MARL) method to solve the routing and bandwidth allocation strategy; S63. In the computational resource allocation of the consensus layer, the gradient descent method and the Ipopt solver are applied to solve the computational resource allocation strategy. S64: Based on steps S61-S63, output the optimal resource allocation strategy through iteration to achieve the optimal average on-chain latency of the DAG blockchain system.

2. A chain network collaborative distributed consensus method based on DAG blockchain according to claim 1, characterized in that: The step S3 is specifically as follows: Assume that the total number of computing resources, i.e., CPU resources, owned by each node in the network is f. For the computing-intensive tasks offloaded by users, the size of the designed computing-intensive tasks is D. The nodes allocate their own computing resources, and a part of the computing resources f is used to allocate the computing resources to the nodes. cal It is used to calculate the computation-intensive tasks offloaded by users, that is, the user computing tasks themselves, and the other part of the computing resources f ver Used to approve and verify transactions generated by other nodes; Among them, f cal +f ver ≤f; the time required for the calculation task is T cal =D / f cal , set the size of a transaction to B, and calculate the time slot T cal During this period, the total number of transactions approved and verified by the node using the computing resources allocated to verify transactions is expressed as n ver =f ver ·T cal / B; Then, a transaction verification selection method is designed. The verification queue priority is set according to the number k of other transactions verified by one transaction. The queue of transactions to be verified is organized in order of priority. When a transaction is broadcast to other nodes, it enters the queue of transactions to be verified at the corresponding node. Each node calculates the time slot length T according to the current round. cal Based on the allocation of computing resources, the number k of other transactions that can be verified in this round is calculated, and the k transactions with the highest priority are selected from the queue of transactions to be verified for approval. The number k of other transactions verified by transaction a is positively correlated with the probability that transaction a will be directly verified by other consensus nodes.

3. A chain network collaborative distributed consensus method based on DAG blockchain according to claim 2, characterized in that: The step S4 is specifically as follows: At the communication layer, the underlying network topology is abstracted into an undirected graph G(V,E); C is set to represent the upper limit of the bandwidth that each physical link can carry; Where V represents the point set of the undirected graph, that is, the set of all nodes in the network, and E represents the edge set of the undirected graph, that is, the set of physical links between terminal devices; e u,v ∈E indicates that there is a one-hop direct physical link between any device nodes u and v. Since the graph is an undirected graph, e u,v =e v,u ; For each transaction generated by each node in the network, the route for the transaction to spread to other nodes in the network is determined, and bandwidth is allocated to the physical links along the path. Let the source node of the transaction be x. For the source node x that generates transaction a, the communication layer finds a spanning tree in the network topology with x as the root node, and obtains the path from the source node x to any node y. The communication layer allocates bandwidth to each physical link e in the spanning tree. The routing information is expressed as in, Indicates that the routing information of node x passes through physical link e; set C x represents the bandwidth allocated by the communication layer to node x; Then each node uses its own diffusion time slot length T in the current round. tr , routing and bandwidth allocation, calculate the number of other nodes n within the diffusion range of its own transaction, the diffusion number n of transaction a is positively correlated with the number of transactions a directly verified by other consensus nodes; During the consensus process, the size of each transaction is B and the bandwidth of node x is C x , then the one-hop transmission delay is expressed as T one-hop =B / C x , in the transaction diffusion task time slot T tr The maximum communication hop number of the transmission link is expressed as Then for node x, the number of nodes that will be diffused to other nodes during the transaction diffusion task time slot is Where N represents the number of nodes in the network, h x,i (g x ) represents the hop count function between node x and node i. When the hop count is less than the maximum communication hop count, then h x,i (g x )=1.

4. A chain network collaborative distributed consensus method based on DAG blockchain according to claim 3, characterized in that: The step S5 is specifically as follows: At the consensus layer, a DAG blockchain consensus delay calculation model is constructed. In a DAG blockchain system, the initial weight of a transaction a is 1. Transaction a can be directly verified by other transactions. When these transactions are directly verified by subsequent new transactions, transaction a is said to be indirectly verified. The cumulative weight is the sum of the weights of a transaction after direct and indirect verification. The growth process of the cumulative weight of a transaction a is modeled as two stages: the adaptation stage and the linear growth stage. The delay expression for the final on-chain inclusion of a transaction is as follows: T d =T a +T l Among them, T a represents the delay of the cumulative weight in the adaptation phase, T l Represents the delay of the cumulative weight in the linear growth stage; the number of transactions k verified by transaction a and the number of diffusion nodes n are negatively correlated with the final on-chain delay of transaction a; The consensus delay calculation method in the DAG blockchain consensus delay calculation model is as follows: (1) Calculation of consensus delay based on transaction verification of other transactions k; During a computational time slot, a node allocates part of its own computing resources to approve and verify transactions generated by other nodes and then propagated to itself. Each node has a priority queue of transactions to be verified, and the queue is prioritized according to the number of other transactions each transaction verifies. The more other transactions an exchange approves for verification, the higher the transaction will be in the queue after being spread to other nodes, and the higher the probability of being selected for verification, which reduces the latency of its on-chain upload. (2) Consensus delay calculation based on the number of transaction diffusion nodes n; During the diffusion slot, nodes use the bandwidth allocated by the system to diffuse their own transactions to other nodes based on the calculated routing information. The more nodes a transaction can be diffused to, the more times the transaction can be directly verified during the consensus phase, ultimately reducing the latency of the transaction being uploaded to the blockchain. The cumulative weight growth model of a new transaction is expressed as follows: In the adaptation stage, the weight is Increase; Where t represents time, W(t) represents the expected cumulative weight of a transaction over time, and h represents the average disclosure time of a transaction, that is, the duration of a time slot T. s ; F ver represents the verification factor; represents the diffusion factor; After the adaptation phase, it enters the linear growth phase, and the cumulative weight grows linearly at a rate of λ. The expression of λ is as follows: Among them, T a represents the duration of the adaptation phase, then we can get T a The expression is as follows: The value of the cumulative weight at the end of the adaptation phase is expressed as follows: The cumulative weight expression at different times is as follows: Assuming the cumulative weight threshold for a transaction to be officially on-chain is w, the time in the linear growth stage is T l The expression is as follows:

5. A chain network collaborative distributed consensus method based on DAG blockchain according to claim 4, characterized in that: The step S6 is specifically as follows: S61. Construct a resource allocation model for the chain-network integration scenario and determine the objective function; Based on steps S3 and S4, a resource allocation model is constructed for the chain-network fusion scenario. By dynamically adjusting the computing resource allocation of each node in the network and designing the routing and bandwidth allocation strategy of the communication layer, the goal is to minimize the average on-chain latency of transactions generated by each node. The objective function expression is as follows: f i,ver +f i,cal ≤f i T i,cal +T i,tr ≤T s T i,cal ≤T cal,m Where C=[C1,C2,…,C N ] represents the bandwidth allocation in the system, f=[f 1, f2,…,f N ] represents the computing resource allocation of each node, R=[R1,R2,…,R N ] represents the routing information of each node, and the decision variable of the objective function is the node computing resource f i,ver , f i,cal Distribution and routing R i and bandwidth C i The distribution of f i,cal represents the computing resources allocated to node i for computationally intensive tasks, f i,ver represents the computing resources allocated by node i for verifying other exchanges; C i represents the bandwidth allocated by the system to node i in the communication layer, R i represents the routing information of node i in the communication layer; the first constraint condition indicates that the bandwidth resources allocated on any physical link shall not exceed the bandwidth upper limit of the physical link; the second constraint condition is that the sum of the computing resources used for calculation and verification of any node shall not exceed the computing resource upper limit of the node; the third constraint condition is that the computing time slot and diffusion time slot of any node shall not exceed the time slot length T s The fourth constraint is that the length of the calculated time slot must not exceed the tolerance limit T cal,m ; S62. Model the routing and bandwidth allocation strategy problem of the communication layer as a multi-item network flow problem, and use the multi-agent reinforcement learning (MARL) method to solve the routing and bandwidth allocation strategy; The computing resource allocation results of each node are known, that is, the computing resource amount f allocated to each node for computing-intensive tasks is known. i,cal , then the calculation time slot length T of each node is calculated i,cal , and then get the diffusion time slot length T of each node i,tr , and the amount of computing resources each node allocates to verify other transactions f i,ver , use the constant M to replace the computing resource related variables, and C i and R i As decision variables, the routing and bandwidth allocation strategy problem expression is as follows: t i ≤T i,tr That is, given the known allocation of computing resources and the determined diffusion time slots of each node, the routing and bandwidth allocation strategies of each node are dynamically adjusted to minimize the average link latency. Multi-agent reinforcement learning is used to solve the routing and bandwidth allocation strategy problems. Three key parts are defined in the MARL model: state space, action space, and reward function. The details are as follows: 1) State space; The state space contains all possible network configurations or conditions. Each state represents a specific arrangement of network elements, including: the routing information combination of each node, the traffic load status of the link, and the bandwidth allocation status of each link. The transaction generated by node i is defined as a i , the number of transactions flowing through link j is n j , the set of transactions flowing on link j can be expressed as l j ={a i ,…,a k }, define L={l1,l2,…,l |E| } represents the status information of each communication link; define f i,j ={C i,j ,t i,j } is the status information of the transaction generated by node i at link j, C i,j represents the bandwidth allocated to node i by link j, t i,j Indicates transaction a i The total communication delay from the source node to the link j is i,j >T i,tr , that is, the communication delay is greater than the diffusion time slot length of node i, then C i,j =0, F = {f 1,1 ,f 1,2 ,…,f N,j } represents the state information of each node on each link; the state space is recorded as S, and the state s at round t is t ∈S is represented by s t ={L,F}; 2) Action space; Routing selection requires that each node be used as a source node and a spanning tree be generated as a communication path to other nodes. Based on the above state space considerations, the action space of the current round needs to give the routing information of each node in the next round of the DAG blockchain system, that is, the spanning tree with each node as the root node. The routing information of node i is defined as in Then it means that the routing information of node i passes through physical link e, R={R1,…,R N } represents the routing status information of each node, then the action space expression of round t is as follows: a t ={R} 3) Reward function; At round t, the reinforcement learning agent is in state s t Select an action and get an immediate reward r from the environment t , then update to state s t+1 ; In the routing and bandwidth allocation strategy problem, the average uplink delay is used to represent the performance of the routing algorithm under the same network topology and link bandwidth constraints. At the same time, the diffusion slot length of each node and the bandwidth limit of each physical link are used as constraints. The reward function of round t is defined as r t (s t ,a t )=T, where F in T i,tr The routing and bandwidth allocation schemes solved at the communication layer are determined; the physical link bandwidth constraint expression of the system is as follows: The diffusion slot length constraint expression of each node is as follows: t i ≤T i,tr When the routing and bandwidth allocation strategies meet the two constraints, the average on-chain latency is used as a single-step reward to guide the reinforcement learning model to update parameters. When the routing and bandwidth allocation strategies do not meet the two constraints, the reward is set to 0 to make the model realize the irrationality of the decision. S63. In the computational resource allocation of the consensus layer, the gradient descent method and the Ipopt solver are applied to solve the computational resource allocation strategy. The routing and bandwidth allocation strategy is known, that is, the bandwidth C allocated by the system to each node is known. i And the spanning tree with each node as the root as the node routing information R i , use constant A to replace the routing and bandwidth allocation related variables, and change f i,ver and f i,cal As decision variables, the computational resource allocation strategy problem expression is as follows: s.t.f i,ver +f i,cal ≤f i T i,cal +T i,tr ≤T s T i,cal ≤T cal,m That is, when the routing and bandwidth allocation are known, the computing resource allocation strategy of each node is dynamically adjusted, which is expressed as f = {f 1,cal ,f 2,cal ,…,f N,cal }, where f i,cal represents the computing resources allocated to node i for computationally intensive tasks. The optimization goal is to minimize the average link latency. The problem is solved using the gradient descent method and the Ipopt solver. The specific solution steps are as follows: 1) Select the initial point, select each node to allocate the minimum computing resources for the computing task to meet the constraint that the computing time slot does not exceed the tolerance upper limit, and set the learning rate, that is, the step size for each parameter update; 2) Calculate the gradient of the objective function at the current parameter point. In the problem of computing resource allocation strategy, the objective function is a multivariable function involving the allocation of computing resources to each node. The gradient expression is as follows: 3) Update parameters. Update parameters according to gradient and learning rate. The update formula is as follows: Among them, α represents the learning rate, which determines the step size of each update; 4) Check convergence to determine whether the current parameters meet the convergence conditions. It is intended to use the maximum number of iterations and set the threshold of the gradient norm. If the convergence conditions are not met, repeat steps 2)-4) and update the parameters until the convergence conditions are met. 5) Take the parameters at the final convergence as output and generate the computational resources f corresponding to each node under this solution i,ver and f i,cal Allocation results; S64: Based on steps S61-S63, output the optimal resource allocation strategy through iteration to achieve the optimal average on-chain latency of the DAG blockchain system.

Citation Information

Patent Citations

  • Chain network collaborative distributed consensus fragmentation method based on reinforcement learning technology

    CN117041003A

  • MARL-based block chain Internet of Things cooperative resource allocation optimization method

    CN118540740A