A blockchain sharding method based on node performance scoring mechanism

Through the blockchain sharding method based on the node performance scoring mechanism, the problems of insufficient throughput and unbalanced load in the blockchain sharding system are solved, and more efficient transaction processing and more balanced load distribution are achieved.

CN118842570BActive Publication Date: 2025-05-09NANJING UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410934223.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2025-05-09
Estimated Expiration
2044-07-11

AI Technical Summary

Technical Problem

The problems of insufficient throughput and unbalanced loads of each shard in the existing blockchain shard system.

Method used

The blockchain sharding method based on the node performance scoring mechanism is adopted to verify and score the nodes through smart contracts, dynamically monitor node performance, allocate tokens to ensure that the nodes remain in an effective state, and optimize the sharding scheme through a double-constrained label propagation algorithm to ensure load balancing of each shard.

Benefits of technology

It improves the throughput of the blockchain system, reduces transaction confirmation delay, ensures load balancing of each shard, reduces the number of cross-shash transactions and verification blockage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118842570B_ABST
    Figure CN118842570B_ABST
Patent Text Reader

Abstract

The present invention discloses a blockchain sharding method based on a node performance scoring mechanism, belonging to the technical field of blockchain. The method uses a smart contract to score node performance and then allocates each node to each shard and then allocates each account to each shard, so that while reducing cross-shard transactions, the number of transactions required to be processed by each shard is positively correlated with the performance score of the shard, so that the entire blockchain system achieves load balancing; scoring the performance of nodes through smart contracts can ensure fairness, non-tamperability and decentralization, and reduce the risk of relying on a third party; the blockchain sharding method based on a node performance scoring mechanism provided by the present invention establishes a blockchain system with high throughput and load balancing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of blockchain, and in particular to a blockchain sharding method based on a node performance scoring mechanism. Background Art

[0002] With the rapid development of blockchain technology, the lack of scalability of blockchain systems has become the main performance bottleneck of blockchain development. In order to solve the problem of insufficient scalability, more and more technologies have been proposed. The core concept of sharding technology originates from the database field. After research, it is found that sharding technology is considered to be the most likely way to solve the current bottleneck of blockchain. Blockchain sharding methods are divided into network sharding, transaction sharding and state sharding. Sharding is to divide the nodes of the blockchain network into different shards, which can maximize the transaction processing capacity of the system. In the sharding scheme, blockchain nodes are allocated to different shards, and each shard is also a small blockchain network. Compared with before sharding, there are fewer nodes in the blockchain network after sharding, thereby reducing the consensus time of each node and the block confirmation time. However, after sharding, the proportion of cross-shard transactions increases, and the transaction volume of each shard transaction verification is uneven. There are hot and cold shards. The shards with a large number of transactions to be verified are called hot shards, and the shards with fewer transactions to be verified are called cold shards. Therefore, there is a delay in the block time of different shards. To this end, in a sharded network, it is necessary to reduce the number of transactions across shards and make each shard tend to be equal in the time spent on processing transactions. Therefore, the network partitioning mechanism and the performance evaluation of each node in the network are very important. Currently existing sharding solutions including Elastio, Monoxide, OmniLedger, etc. do not consider the processing capacity of each shard. Although the cross-shard transaction volume is reduced to a certain extent and the system throughput is increased, the workload of each shard is seriously unbalanced, which will cause some shards to be idle while other shards are busy. Based on this problem, the present invention proposes a blockchain sharding method based on a node performance scoring mechanism. Summary of the invention

[0003] The purpose of the present invention is to provide a blockchain sharding method based on a node performance scoring mechanism to solve the problems of insufficient throughput and unbalanced load of each shard in the blockchain sharding system existing in the prior art.

[0004] To achieve the above object, the present invention provides a blockchain sharding method based on a node performance scoring mechanism, comprising the following steps:

[0005] Step 1: Allocate a license certificate to each node. After the node obtains the license certificate to join the blockchain network, it applies to join the blockchain network with the license certificate;

[0006] Step 2: Use smart contracts to verify the newly added nodes’ permission to join. After verification, send the performance verification task and record the task sending time t send ,The performance verification tasks include computationally intensive tasks and data processing tasks;

[0007] Step 3: After receiving the task issued by the smart contract, the node performs calculation and data processing and submits the result of the task to the smart contract;

[0008] Step 4: After receiving the task results submitted by the node, the smart contract scores the results based on their accuracy and processing time, and records the time t when the results were received. rec , and calculate the task time t cost And the score of node task completion done ;

[0009] Step 5: Score the accuracy of the task results based on the amount of accurate data, including the single task score s and the total score S;

[0010] Step 6. After the smart contract calculates the score, if the performance of the node meets the predetermined standard, the smart contract issues a token with a validity period of 2 hours to the node and records the issuance time of the token. The node then carries this token to participate in blockchain network activities. When the token expires, performance verification needs to be performed again to obtain a new token. The purpose of this mechanism is to dynamically monitor node performance and prevent malicious nodes from existing for a long time;

[0011] Step 7: The blockchain system performs network sharding for each node, assigning each node to different shards, and using [Q] to represent the shard set, [Q] = {0, 1, 2...k}, Q i = k, indicating that node i is allocated to shard k. The sharding adopts a random sharding algorithm. The weight of each shard is the sum of the scores of all nodes in the shard, recorded as w i ;

[0012] Step 8: The monitoring node injects transaction data into the blockchain system. Each transaction consists of two accounts and a transaction amount. The graph structure G(V, E) is used to represent the transaction network result. V is the account vertex set, expressed as [V] = {V 1 , V 2 , V 3 , V 4 , V 5 ...v n}, E is the transaction set, expressed as [E] = {e 1,2 , e 2,3 ...e i,j},e i,jrepresents the number of transactions between account i and account j, where each element of G is defined as (e i,j , c), indicating that there are c transactions between accounts i and j. If there is no transaction between accounts i and j, then e i,j =0;

[0013] Step 9: Initialize the shards. Shard according to the account address hash. The hash value is assigned to each shard through modulo operation to obtain the initial label, that is, the shard to which it belongs. For example, the account hash value is modulo the total number of shards to obtain a shard number, which is the shard to which each account belongs.

[0014] Step 10: Use the double-constrained label propagation algorithm to iteratively update each account to obtain the optimal sharding solution.

[0015] Preferably, the task in step 4 takes time t cost And the score of node task completion done The calculation expression is as follows:

[0016] Task time t cost :t cost =t rec -t send

[0017] Node task completion score done :

[0018] Preferably, the calculation expressions of the single task score s and the total score S in step 5 are as follows:

[0019] Single task score: s = ω 1 score done +ω 2 score accuracy

[0020]

[0021] R=A+E

[0022]

[0023] Overall rating: S = αs 1 +(1-α)s 2

[0024] In the formula, ω 1 represents the weight of task completion time, ω 2 Indicates the result accuracy weight, score accuracyrepresents the accuracy score of the submitted task result dataset, R represents the total amount of data in the submitted task result dataset, E represents the amount of wrong data in the submitted task result dataset, A represents the amount of data with correct answers to the task result, δ is the state function of the accuracy of the dataset, when RE exceeds the standard amount of data, the result of the state function is 0, otherwise the result of the state function is 1, s 1 represents the score of computationally intensive tasks, s 2 It represents the score of data processing tasks, α represents the penalty factor of computation-intensive tasks. The larger α is, the more computation-intensive the system tasks are, and the smaller α is, the more data processing the system tasks are.

[0025] Preferably, step 10 uses a double-constrained label propagation algorithm to iteratively update each account, and the specific process of obtaining the optimal sharding solution is as follows:

[0026] S101. Calculate the transaction volume tx of each shard k_intra And cross-shard transaction volume tx k_cross ;

[0027] S102: Based on the intra-chip transaction volume tx obtained in S101 k_intra And cross-shard transaction volume tx k_cross Calculate the total transaction volume tx k ;

[0028] S103. Calculate the workload factor a of each shard k , the expression is as follows:

[0029]

[0030] In the formula, w k Indicates the weight of each shard;

[0031] S104. According to the target requirements, the number of cross-shard transactions needs to be reduced and the blockchain workload needs to be reduced, and obtaining the optimal sharding solution is converted into an NP-hard problem;

[0032] S105. Solve the NP-hard problem in S104 to obtain the optimal sharding solution.

[0033] Preferably, in S101, the intra-shard transaction volume tx of each shard is calculated k_intra And cross-shard transaction volume tx k_cross The calculation expression is as follows:

[0034]

[0035]

[0036] Wherein, ρ(i, j, k) is an indicator function of the shard to which an account belongs, ρ(i, j, k) = 1 means that accounts i and j both belong to shard k, otherwise ρ(i, j, k) = 0, η means that the cost of cross-shard transactions is η times the cost of intra-shard transactions, σ(i, j, k) is an indicator function of the relationship between accounts and shards, indicating whether accounts i and j satisfy that there is only one account belonging to shard k. If so, σ(i, j, k) = 1, otherwise σ(i, j, k) = 0.

[0037] Preferably, the total transaction volume tx in S102 k The calculation expression is as follows:

[0038] tx k =tx k_intra +ηtx k_cross .

[0039] Preferably, the specific expression of the NP-hard problem in S104 is as follows:

[0040]

[0041] st

[0042] ρ(i,j,x)=1,i,j∈[N],i≠j

[0043] σ(i,j,x)=1,i,j∈[N],i≠j

[0044] ω∈[0,1]

[0045] In the formula, tx x represents all transaction volumes of shard x, including intra-shard transactions and cross-shard transactions, ω represents the penalty factor for transaction volume, the larger the ω, the greater the impact of transaction volume on the result, μ(x) represents the load factor of the entire blockchain system when the account is transferred to shard x, ρ(i,j,x) represents whether accounts i and j belong to shard x together, if yes, ρ(i,j,x)=1, otherwise ρ(i,j,x)=0, σ(i,j,x) represents whether accounts i and j have one and only one account belonging to shard x, if yes, σ(i,j,x)=1, otherwise σ(i,j,x)=0, and N represents the set of all accounts.

[0046] Preferably, in S105, the NP-hard problem in S104 is solved to obtain the specific expression of the optimal sharding solution as follows:

[0047]

[0048] In the formula, s(i, k) represents the score of the entire system when account i is transferred to shard k, δ(l(j), k) is a state function. When the label of account j is k, the function value is 1, otherwise it is 0; NB(i) is all neighboring nodes of account i, e i,j represents the number of transactions between account i and account j, ∑ h∈NB(i) e i,h Represented as all out-degrees of vertex i; min h∈[K] E h Indicates the number of transactions in the partition with the least edges among all partitions; E k Indicates the total number of transactions in the partition of the current k label, including both within the shard and across shards; β is the penalty factor for load balancing between shards, and the change in the number of transactions in each partition is related to β; len [K] Indicates the number of partitions. is the stability when the label of the current account i is updated to k, γ is the penalty factor for partition load balancing, a t It represents the load balancing factor of shard t when account i is transferred to shard k. The larger the γ, the smaller the load balancing has a smaller impact on the overall score, and the smaller the γ, the greater the impact of load balancing. The value of ω is set according to the target scenario. In the present invention, the larger the s(i, k), the higher the throughput, the lower the transaction confirmation delay, and the more balanced the system load. In order to prevent a vertex from frequently moving between two partitions during iteration, the maximum number of iterations τ and the maximum number of updates for each node ρ are used. After τ iterations, the execution is terminated.

[0049] Therefore, the present invention adopts the above-mentioned blockchain sharding method based on the node performance scoring mechanism, which has the following beneficial effects:

[0050] (1) Use smart contracts to score the performance of newly added nodes, reduce human intervention, and ensure the efficiency and fairness of the scoring results;

[0051] (2) Introducing a token mechanism, a token with a validity period of 2 hours is returned when each node is scored. The node needs to carry this token when participating in network activities so that the blockchain system can verify the validity of the node. After the token expires, performance scoring is performed. This can achieve near real-time evaluation of node performance and ensure that the node maintains a continuous and accurate performance status, preventing malicious nodes from occupying resources for a long time.

[0052] (3) A dual-constrained label propagation algorithm is used, which takes into account the association relationship between accounts between nodes and the weight of shards. This allows the sharding results to not only effectively reduce cross-shard transactions, but also balance the workload of each shard.

[0053] (4) Under the premise of reducing the overall number of cross-shards, the performance of each shard is fully utilized, reducing the occurrence of transaction propagation, verification blocking, cross-shard verification delays, etc., making the overall load of the blockchain system more balanced, thereby increasing the throughput of the shard system and reducing transaction confirmation delays.

[0054] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a system architecture diagram of a blockchain sharding method based on a node performance scoring mechanism of the present invention;

[0056] Figure 2 This is a diagram of a node performance scoring architecture according to an embodiment of the present invention;

[0057] Figure 3 This is a flowchart of node performance scoring according to an embodiment of the present invention;

[0058] Figure 4 The results of the method adopted by the present invention are compared with other sharding methods, wherein (a) is a comparison chart of the reduction ratio of cross-shard transactions between the method of the present invention and other sharding methods, and (b) is a comparison chart of the blockchain system load factor between the method of the present invention and other sharding methods. DETAILED DESCRIPTION

[0059] The following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0060] See also Figure 1-4 , a blockchain sharding method based on a node performance scoring mechanism, comprising the following steps:

[0061] Step 1: Allocate a license certificate to each node. After the node obtains the license certificate to join the blockchain network, it applies to join the blockchain network with the license certificate;

[0062] Step 2: Use smart contracts to verify the newly added nodes’ permission to join. After verification, send the performance verification task and record the task sending time t send ,The performance verification tasks include computationally intensive tasks and data processing tasks;

[0063] Step 3: After receiving the task issued by the smart contract, the node performs calculation and data processing and submits the result of the task to the smart contract;

[0064] Step 4: After receiving the task results submitted by the node, the smart contract scores the results based on their accuracy and processing time, and records the time t when the results were received. rec , and calculate the task time t cost And the score of node task completion done ; The specific expression is as follows:

[0065] Task time t cost :t cost =t rec -t send

[0066] Node task completion score done :

[0067] Step 5: Score the accuracy of the task results based on the amount of accurate data, including the single task score s and the total score S; the calculation expressions of the single task score s and the total score S are as follows:

[0068] Single task score: s = ω 1 score done +ω 2 score accuracy

[0069]

[0070] R=A+E

[0071]

[0072] Overall rating: S = αs 1 +(1-α)s 2

[0073] In the formula, ω 1 represents the weight of task completion time, ω 2 Indicates the result accuracy weight, score accuracy represents the accuracy score of the submitted task result dataset, R represents the total amount of data in the submitted task result dataset, E represents the amount of wrong data in the submitted task result dataset, A represents the amount of data with correct answers to the task result, δ is the state function of the accuracy of the dataset, when RE exceeds the standard amount of data, the result of the state function is 0, otherwise the result of the state function is 1, s 1 represents the score of computationally intensive tasks, s 2 represents the score of data processing tasks, α represents the penalty factor of computation-intensive tasks. The larger the α, the more computation-intensive the system tasks are, and the smaller the α, the more data processing the system tasks are.

[0074] Step 6. After the smart contract calculates the score, if the performance of the node meets the predetermined standard, the smart contract issues a token with a validity period of 2 hours to the node and records the issuance time of the token. The node then carries this token to participate in blockchain network activities. When the token expires, performance verification needs to be performed again to obtain a new token. The purpose of this mechanism is to dynamically monitor node performance and prevent malicious nodes from existing for a long time;

[0075] Step 7: The blockchain system performs network sharding for each node, assigning each node to different shards, and using [Q] to represent the shard set, [Q] = {0, 1, 2...k}, Q i = k, indicating that node i is allocated to shard k. The sharding adopts a random sharding algorithm. The weight of each shard is the sum of the scores of all nodes in the shard, recorded as w i ;

[0076] Step 8: The monitoring node injects transaction data into the blockchain system. Each transaction consists of two accounts and a transaction amount. The graph structure G(V, E) is used to represent the transaction network result. V is the account vertex set, expressed as [V] = {v 1 , v 2 , v 3 , v 4 , v 5 ...v n}, E is the transaction set, expressed as [E] = {e 1,2 , e 2,3 ...e i,j},e i,j represents the number of transactions between account i and account j, where each element of G is defined as (e i,j , c), indicating that there are c transactions between accounts i and j. If there is no transaction between accounts i and j, then e i,j =0;

[0077] Step 9: Initialize the shards. Shard according to the account address hash. The hash value is assigned to each shard through modulo operation to obtain the initial label, that is, the shard to which it belongs. For example, the account hash value is modulo the total number of shards to obtain a shard number, which is the shard to which each account belongs.

[0078] Step 10: Use the double-constrained label propagation algorithm to iteratively update each account to obtain the optimal sharding solution; the label here means the shard number, and its core principle is to update the account label to the label that appears most frequently among all its neighbor accounts. After the move, it is necessary to verify whether the overall cross-shard number is reduced and whether the workload factor of the shard is reduced. If so, move and update the label, and iterate multiple times to obtain the optimal sharding solution; the specific process is as follows:

[0079] S101. In order to obtain a better sharding solution, we need to calculate that after each vertex is updated by the algorithm, the new shard must satisfy the following requirements: the sum of intra-shard transactions and cross-shard transactions needs to be reduced under the new sharding, so as to reduce the transaction verification time and increase the throughput of the blockchain system; calculate the intra-shard transaction volume tx of each shard k_intra And cross-shard transaction volume tx k_cross ; The specific calculation expression is as follows:

[0080]

[0081]

[0082] Where ρ(i, j, k) is an indicator function of the shard to which an account belongs. ρ(i, j, k) = 1 means that both accounts i and j belong to shard k, otherwise ρ(i, j, k) = 0. η means that the cost of cross-shard transactions is η times the cost of intra-shard transactions. σ(i, j, k) is an indicator function of the relationship between accounts and shards, indicating whether one and only one account of accounts i and j belongs to shard k. If so, σ(i, j, k) = 1, otherwise σ(i, j, k) = 0. For intra-shard transactions, the transaction cost between two accounts is repeatedly calculated. Transactions, so the total number of transactions needs to be divided by 2. Since the entire blockchain system is processed by multiple shards, changes in intra-shard transactions in a single shard system will cause changes in intra-shard transactions and cross-shard transactions in other allocated shards. Whether the overall performance is better requires calculating all shard transaction data; for cross-shard transactions, for the same intra-shard transactions, the reduction of cross-shard transactions in a single shard is not equivalent to the reduction of cross-shard transactions in the entire blockchain system. Changes in the cross-shard transaction volume of related shards need to be taken into account. Only when the cross-shard transactions of all shards are reduced comprehensively can the system performance be better.

[0083] S102: Based on the intra-chip transaction volume tx obtained in S101 k_intra And cross-shard transaction volume tx k_cross Calculate the total transaction volume tx k ; The specific calculation expression is as follows:

[0084] tx k =tx k_intra +ηtx k_cross .

[0085] S103. Calculate the workload factor a of each shard k , the expression is as follows:

[0086]

[0087] In the formula, w kRepresents the weight of each shard, a of all shards k The closer they are, the more balanced the load of the blockchain sharding system is, and the workload of each shard tends to be consistent;

[0088] S104. According to the target requirements, the number of cross-shard transactions needs to be reduced and the workload of the blockchain needs to be reduced. The optimal sharding solution is converted into an NP-hard problem. The specific expression of the NP-hard problem is as follows:

[0089]

[0090] st

[0091] ρ(i,j,x)=1,i,j∈[N],i≠j

[0092] σ(i,j,x)=1,i,j∈[N],i≠j

[0093] ω∈[0,1]

[0094] In the formula, tx x represents all transaction volumes of shard x, including intra-shard transactions and cross-shard transactions, ω represents the penalty factor for transaction volume, μ(x) represents the load factor of the entire blockchain system when an account is transferred to shard x, ρ(i, j, x) represents whether accounts i and j belong to shard x together, if yes ρ(i, j, x) = 1, otherwise ρ(i, j, x) = 0, σ(i, j, x) represents whether accounts i and j have one and only one account belonging to shard x, if yes σ(i, j, x) = 1, otherwise σ(i, j, x) = 0, and N represents the set of all accounts.

[0095] S105. Solve the NP-hard problem in S104 to obtain the optimal sharding solution. When conducting experimental simulation, define the maximum number of iterations τ and the node update threshold ρ. The partition labels are represented as 0, 1, 2, 3...k, with a total of k+1 partitions. The account allocation results are saved in middle, Traverse all vertices to propagate labels. For each vertex i, traverse other vertices that have transactions with the vertex, denoted as NB(i), and obtain the vertices that appear the most times in NB(i) and are related to For different labels k, the scores are calculated. The higher the score, the better the current label propagation effect. The specific expression is as follows:

[0096]

[0097] In the formula, s(i, k) represents the score of the entire system when account i is transferred to shard k, δ(l(j), k) is a state function. When the label of account j is k, the function value is 1, otherwise it is 0; NB(i) is all neighboring nodes of account i, e i,j represents the number of transactions between account i and account j, ∑ h∈NB(i) e i,h Represented as all out-degrees of vertex i; min h∈[K] E h Indicates the number of transactions in the partition with the least edges among all partitions; E k Indicates the total number of transactions in the partition of the current k label, including both within the shard and across shards; β is the penalty factor for load balancing between shards, and the change in the number of transactions in each partition is related to β; len [K] Indicates the number of partitions. is the stability when the label of the current account i is updated to k, γ is the penalty factor for partition load balancing, a t It represents the load balancing factor of shard t when account i is transferred to shard k. The larger the γ, the smaller the load balancing has a smaller impact on the overall score, and the smaller the γ, the greater the impact of load balancing. The value of ω is set according to the target scenario. In the present invention, the larger the s(i, k), the higher the throughput, the lower the transaction confirmation delay, and the more balanced the system load. In order to prevent a vertex from frequently moving between two partitions during iteration, the maximum number of iterations τ and the maximum number of updates for each node ρ are used. After τ iterations, the execution is terminated.

[0098] Example

[0099] like Figure 4 As shown, compared with other sharding methods, the method of the present invention not only reduces the proportion of cross-shard transactions more effectively, but also makes the blockchain system more stable and the load of each shard more balanced; Figure 4 As shown in (a) and (b), the total transaction volume is 10,000; (a) shows that the reduction in the cross-shard transaction ratio in the present invention is greater than that of other sharding algorithms. When the number of shards increases, the cross-shard transaction ratio increases. Because the more shards there are, the more complicated the transaction allocation is, and the more complicated the association between accounts is, so there is a situation where the number of allocations increases but the reduction in the cross-shard transaction ratio decreases. (b) shows that the horizontal axis is the number of shards and the vertical axis is the load factor of the blockchain system. From (b), it can be found that the load factor of the present invention is lower than that of other sharding algorithms and is relatively stable.

[0100] Therefore, the present invention adopts the above-mentioned blockchain sharding method based on the node performance scoring mechanism, and scores each node by considering the performance issues of the active nodes participating in the blockchain network, so that the load of each shard is more balanced. By considering the correlation between accounts, when performing state sharding, accounts with strong correlation are divided into the same shard to reduce the number of cross-shard transactions, thereby improving the throughput of the system. Each node needs to carry a time-limited token issued by the smart contract during the participation process, which ensures the security of the system while improving efficiency.

[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. A blockchain sharding method based on a node performance scoring mechanism, characterized in that: The following steps are involved: Step 1: Allocate a license certificate to each node. After the node obtains the license certificate to join the blockchain network, it applies to join the blockchain network with the license certificate; Step 2: Use smart contracts to verify the newly added nodes’ permission to join. After verification, send the performance verification task and record the task sending time. ,The performance verification tasks include computationally intensive tasks and data processing tasks; Step 3: After receiving the task issued by the smart contract, the node performs calculation and data processing and submits the result of the task to the smart contract; Step 4: After receiving the task results submitted by the node, the smart contract scores the results based on their accuracy and processing time, and records the time when the results were received. , and calculate the task duration and the node task completion score ; Step 5: Score the accuracy of the task results based on the amount of accurate data, including individual task scores and total score ; Step 6: After the smart contract calculates the score, if the performance of the node reaches the predetermined standard, the smart contract issues a token with a validity period of 2 hours to the node and records the issuance time of the token. The node then carries this token to participate in blockchain network activities. Step 7: The blockchain system performs network sharding for each node, assigning each node to different shards, and using [Q] to represent the shard set, [Q] = {0, 1, 2...k}, , indicating that node i is allocated to shard k, and the sharding adopts a random sharding algorithm. The weight of each shard is recorded as the sum of the scores of all nodes in the shard, recorded as ; Step 8: The monitoring node injects transaction data into the blockchain system. Each transaction consists of two accounts and transaction amounts. The graph structure G (V, E) is used to represent the transaction network results. V is the account vertex set, which is expressed as , E is the transaction set, expressed as , represents the number of transactions between account i and account j, where each element of G is defined as , means there are c transactions between accounts i and j. If there is no transaction between accounts i and j, then ; Step 9: Initialize the sharding, shard according to the account address hash, and distribute the hash value to each shard through modulo operation to obtain the initial label; Step 10: Use the double-constrained label propagation algorithm to iteratively update each account to obtain the optimal sharding solution; Step 10 uses a dual-constrained label propagation algorithm to iteratively update each account. The specific process of obtaining the optimal sharding solution is as follows: S101. Calculate the transaction volume within each shard and cross-shard transaction volume ; S102: Based on the intra-chip transaction volume obtained in S101 and cross-shard transaction volume Calculate the total transaction volume ; S103. Calculate the workload factor for each shard , the expression is as follows: ; In the formula, Indicates the weight of each shard; S104. According to the target requirements, the number of cross-shard transactions needs to be reduced and the blockchain workload needs to be reduced, and obtaining the optimal sharding solution is converted into an NP-hard problem; S105, solving the NP-hard problem in S104 to obtain the optimal sharding solution; The specific expression of the NP-hard problem in S104 is as follows: ; In the formula, Represents the total transaction volume of shard x, including intra-shard transactions and cross-shard transactions. represents the penalty factor for transaction volume, Indicates the load factor of the entire blockchain system when the account is transferred to shard x, Indicates whether accounts i and j belong to shard x together. If yes, , Indicates whether account i, j has one and only one account belonging to shard x. If yes, , Represents the set of all accounts; In S105, the NP-hard problem in S104 is solved, and the specific expression of the optimal sharding solution is obtained as follows: ; In the formula, The transfer of account i to shard k is the score of the entire system, is a state function. When the tag of account j is k, the function value is 1, otherwise it is 0; are all neighboring nodes of account i, Represents the number of transactions between account i and account j, Represented as all out-degrees of vertex i; Indicates the number of transactions of the partition with the least edges among all partitions; Indicates the number of transactions in the partition of the current k label, including both within the shard and across shards; is the penalty factor for load balancing between shards. The change in the number of transactions in each partition is Related; Indicates the number of partitions. is the stability when the label of the current account i is updated to k, For the penalty factor of partition load balancing, Represents the load balancing factor of shard t when account i is transferred to shard k.

2. According to claim 1, a blockchain sharding method based on a node performance scoring mechanism is characterized in that: Time consuming task in step 4 and the node task completion score The calculation expression is as follows: Task time ; Node task completion score .

3. A blockchain sharding method based on a node performance scoring mechanism according to claim 2, characterized in that: Scoring of individual tasks in step 5 and total score The calculation expression is as follows: Single task rating: ; ; ; ; Overall rating: ; In the formula, represents the weight of task completion time, represents the result accuracy weight, Represents the accuracy score of the submitted task result dataset Indicates the total amount of data in the dataset submitted as a result of the task. Indicates the amount of erroneous data in the dataset of the submitted task result. The amount of data representing the correct answer to the task result, is the state function of the accuracy of the data set. When the RE exceeds the standard amount of data, the result of the state function is 0, otherwise the result of the state function is 1. represents the score of computationally intensive tasks, represents the score of data processing tasks, represents the penalty factor for computationally intensive tasks, The larger the value, the more computationally intensive the system tasks tend to be. The smaller the value, the more data processing-oriented the system task is.

4. A blockchain sharding method based on a node performance scoring mechanism according to claim 3, characterized in that: Calculate the transaction volume within each shard in S101 and cross-shard transaction volume The calculation expression is as follows: ; ; In the formula, is an indicator function of the shard to which an account belongs. Indicates account i j belongs to the shard ,otherwise , Indicates that the cost of cross-shard transactions is twice the cost of intra-shard transactions times, It is an indicator function of the relationship between an account and a shard, indicating whether one and only one account among accounts i and j belongs to shard k. If so, ,otherwise .

5. According to a blockchain sharding method based on a node performance scoring mechanism according to claim 4, it is characterized in that: Total transaction volume in S102 The calculation expression is as follows: 。

Citation Information

Patent Citations

  • Block chain fragmentation method fusing spectral clustering and reputation value mechanism

    CN115378954A

  • Inductive block chain account distribution method and device based on graph neural network

    CN117391858A