| CPC H04L 9/50 (2022.05) [G06F 17/16 (2013.01); G06F 18/22 (2023.01); G06F 18/23213 (2023.01)] | 6 Claims |

|
1. A blockchain sharding method combining spectral clustering and a reputation value mechanism, comprising:
obtaining, every other account grouping cycle Ta, account transaction data recorded during operation of a blockchain to generate an account transaction graph;
obtaining an adjacency similarity matrix W and a degree matrix D based on the account transaction graph;
generating a Normalized Laplace matrix L based on the adjacency similarity matrix W and the degree matrix D, performing dimension reduction on L to obtain a feature matrix F, and then clustering the feature matrix F with a clustering dimension of k by row through a K-means clustering method; and
dividing blockchain accounts into k groups based on an obtained clustering result, and allocating accounts in the k groups to k blockchain shards;
wherein after the dividing blockchain accounts into k groups based on an obtained clustering result, and allocating accounts in the k groups to k blockchain shards, the blockchain sharding method further comprises:
rating reputations of all nodes in the blockchain based on a reputation value corresponding to each node;
evenly allocating all the nodes in the blockchain to each shard every other node sharding cycle Ts based on a reputation rating of each node; and
selecting a notarization node of a cross-shard transaction (CST) based on the reputation rating of each node;
wherein the rating reputations of all nodes in the blockchain based on a reputation value corresponding to each node comprises:
after p rounds of blockchain transaction processing, rating a reputation of each node in the blockchain based on a reputation value corresponding to the node, rating a node whose reputation value rank in all the nodes in the blockchain is greater than a first preset value as A, rating a node whose reputation value rank in all the nodes in the blockchain is less than a second preset value and greater than a third preset value as B, and rating a node whose reputation value rank in all the nodes in the blockchain is less than a fourth preset value and greater than a fifth preset value as C; and
determining a remaining unrated node in the blockchain as an ordinary node, and rating the ordinary node as D;
wherein the reputation value is γ, and comprises an efficiency score h of the node and an honesty degree score t of the node, wherein
![]() and
before rating the reputation of the node in the blockchain based on the reputation value corresponding to the node, the blockchain sharding method further comprises:
for each node in the blockchain, giving a processing speed score h′new of the node for a current round of transaction processing based on time consumed by the node to complete the current round of transaction processing, and calculating an updated efficiency score
![]() of the node based on a previous-round efficiency score hbf of the node and the processing speed score h′new of the node for the current round of transaction processing;
for each node in the blockchain, if the node correctly completes the current round of transaction processing, increasing the honesty degree score of the node by a score q; or if the node performs a malicious operation in the current round of transaction processing, decreasing the honesty degree score of the node by a score r; and
calculating an updated honesty degree score tnew=tbf+q−r of the node based on a previous-round honesty degree score tbf of the node, as well as the score q and the score r in the current round of transaction processing; wherein
when each node joins a blockchain network, the node is assigned with a basic efficiency score h0 and a basic honesty degree score t0, and when the node is a newly added node, the previous-round efficiency score hbf of the node is h0, and the previous-round honesty degree score tbf of the node is t0;
wherein the selecting a notarization node of a CST based on the reputation rating of each node comprises:
selecting all nodes whose reputation ratings are A as notarization execution nodes, all nodes whose reputation ratings are B as notarization inspection nodes, and all nodes whose reputation ratings are C as candidate nodes, wherein there are two types of notarization nodes: the notarization execution node and the notarization inspection node, which form a notarization window, and one notarization execution node and one notarization inspection node form a notarization node pair;
wherein each node in shards receives an initiated transaction from external request source, and each node verifies and determines the initiated transaction; if the initiated transaction is determined as a CST, the CST is submitted to the notarization window.
|