Method and blockchain system for dynamically improving blockchain performance based on network trust model

By using pre-trained network trust models in the blockchain to identify and filter malicious transactions and adjust mining difficulty, the problem of taking into account both blockchain performance and security is solved, and efficient and secure blockchain operation is achieved.

CN115643267BActive Publication Date: 2024-11-12HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211246873.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2024-11-12
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

The existing technology cannot take into account both the performance and security of blockchains. Consensus algorithms often sacrifice security when improving throughput, or perform poorly when ensuring security.

Method used

Using a pre-trained machine learning-based network trust model to classify transactions in the blockchain, identify malicious transactions and honest transactions, obtain the hash address of the node that creates a malicious transaction, filter malicious nodes before the node participates in consensus, and according to the node's Adjust the mining difficulty by honesty.

Benefits of technology

By dynamically adjusting the mining difficulty, the performance of the blockchain is improved. At the same time, by screening malicious nodes, the security of the blockchain is ensured and the block interval time and the orphan rate are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115643267B_ABST
    Figure CN115643267B_ABST
Patent Text Reader

Abstract

The present invention provides a method and a blockchain system for dynamically improving blockchain performance based on a network trust model, and relates to the field of blockchain technology. The present invention first pre-trains a network trust model based on machine learning in the blockchain, and then uses the network trust model to classify transactions in the blockchain to identify malicious transactions and honest transactions; obtains the hash address of the node that creates the malicious transaction, and filters the malicious node before the node participates in the consensus; calculates the honesty value of the node participating in the consensus, and uses the honesty value to adjust the mining difficulty of each node. The present invention dynamically changes the mining difficulty of the node according to the different honesty values, reduces the block interval time, and thus improves the blockchain performance. At the same time, since the nodes that generate malicious transactions are screened and filtered, the malicious behavior of the malicious node is stopped in advance, thereby ensuring the security of the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a method for dynamically improving blockchain performance based on a network trust model and a blockchain system. Background Art

[0002] Since its birth in 2008, blockchain has received great attention from academia and various industries. The decentralized and tamper-proof characteristics of blockchain itself have enabled many traditional industries, such as education, medical care, social welfare and high-tech such as the Internet of Things and artificial intelligence, to combine with blockchain to carry out a new round of technological innovation. Blockchain technology plays a pivotal role in different fields. Researching blockchain technology is a general trend and has theoretical and practical significance. Blockchain is a technology that combines cryptography, consensus algorithms, distributed mechanisms, smart contracts and network security.

[0003] The blockchain structure itself is a distributed structure. In a distributed system, there is a famous CAP theorem: a distributed system cannot ensure consistency, availability, and partition tolerance at the same time, and a certain feature needs to be weakened in the design. The CAP theorem believes that a distributed system can only guarantee two of the three features at most; for blockchain, it also has the "impossible triangle" problem, namely decentralization, security, and high performance. In order to improve the performance of blockchain, various consensus algorithm mechanisms have emerged in an endless stream. Among them, the consensus algorithm based on proof of work of PoW has been greatly guaranteed in terms of decentralization and security, but the performance is very low. Other consensus algorithms, although they have improved throughput, still sacrifice a certain degree of security.

[0004] From the above description, it can be seen that the existing methods cannot take into account both the performance and security of blockchain. Summary of the invention

[0005] 1. Technical issues to be resolved

[0006] In view of the deficiencies in the prior art, the present invention provides a method and a blockchain for dynamically improving blockchain performance based on a network trust model, which solves the technical problem that the prior methods cannot take into account both the performance and security of the blockchain.

[0007] (II) Technical solution

[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:

[0009] In a first aspect, the present invention provides a method for dynamically improving blockchain performance based on a network trust model, wherein a network trust model based on machine learning is pre-trained in the blockchain, and the method comprises:

[0010] S1. Use the network trust model to classify transactions in the blockchain and identify malicious transactions and honest transactions;

[0011] S2. Obtain the hash address of the node that created the malicious transaction and filter out the malicious nodes before the node participates in the consensus;

[0012] S3. Calculate the honesty value of the nodes participating in the consensus, and use the honesty value to adjust the mining difficulty of each node.

[0013] Preferably, the network trust model based on machine learning is pre-trained in the blockchain, including:

[0014] Step a, obtaining data samples;

[0015] Step b: preprocess the data samples by clustering, and divide the data samples into a training set and a test set;

[0016] Step c: using principal component analysis to reduce the dimensions of multiple features in the training set and the test set;

[0017] Step d: Train the supervised model using the dimension-reduced training set to obtain an initial network trust model;

[0018] Step e: Test and optimize the initial network trust model using the test set after dimensionality reduction to obtain a network trust model.

[0019] Preferably, S2 includes:

[0020] If there is a malicious transaction in the transaction data packaged by the node, the hash address of the node that generated the malicious transaction is saved locally; the hash address is used to filter out the malicious blocks generated by the malicious node. If the address of the sender of the block received by the node belongs to someone who has sent a malicious transaction, no consensus will be reached on the block generated by the node.

[0021] Preferably, S3 includes:

[0022] S301. The node obtains the evaluation result T of the total transaction by the neighboring nodes related to it. r =N trust / (N malicious +N trust ), where N malicious represents malicious nodes, N trust Represents an honest node. Since the result is not unique, the average value is calculated: n represents the number of neighboring nodes;

[0023] S302: Obtain the hash addresses of malicious nodes sent by neighboring nodes, determine whether the transactions packaged by the node belong to these nodes based on the addresses, and record them;

[0024] S302a, receiving the broadcast result, and storing the filtering result of malicious nodes of the nodes received by the broadcast;

[0025] S302b, compare the node address of the malicious transaction detected by the network trust model with the malicious node address received by broadcast, use two variables is_in and not_in to record whether the address is included in the comparison and filtering results, if it is included, is_in adds 1, if not, not_in adds 1, is_in means that the record of the malicious node is saved but the transaction is still packaged to the malicious node, which is an irresistible factor and has a relatively small proportion; not_in means that the malicious node is not filtered, which means that the node's contribution is insufficient and has a large proportion; the result calculated in this step is t con =0.2*is_in+0.8*not_in;

[0026] S303. Obtain the ratio between the number of valid blocks generated by the node on the longest chain and the number of all blocks on the longest chain where n v Indicates the number of valid blocks generated by the node on the longest chain, n l Indicates the number of all blocks on the longest chain;

[0027] S304. Based on the above calculated values, without considering the dynamic changes of the blockchain, calculate the honesty value t r :

[0028]

[0029] S305. Use the honesty value to adjust the mining difficulty of each node. The honesty value is inversely proportional to the mining difficulty.

[0030] Preferably, the S304 further includes:

[0031] Assign each value in the calculation of the honesty value its own weight.

[0032]

[0033] Among them, a, b, and c represent the weights of each value.

[0034] Preferably, the S304 further includes:

[0035] When calculating the honesty value, the dynamic changes of the blockchain are taken into account and the time parameter t is added. t ;

[0036] Record the time t when the node joins the blockchain s , and the current time t c , then the calculation time parameters are:

[0037]

[0038] Calculate the node honesty of the dynamic blockchain network:

[0039]

[0040] Preferably, the method further comprises:

[0041] S4. When there are multiple blocks, before the block is put on the chain, the honesty value of the node that generates the block is compared. The block generated by the node with a higher honesty value is put on the chain and broadcast to other nodes.

[0042] Preferably, the S4 specifically includes:

[0043] S401, each node maintains a buffer pool for receiving blocks, and the buffer pool contains blocks broadcasted to the node by its neighboring nodes;

[0044] S402. Determine whether there is more than one block in the buffer pool. If there is more than one, compare the node honesty values ​​of the blocks in it, select the block generated by the node with the highest honesty value to be put on the chain, and after being put on the chain, clear the buffer pool.

[0045] In a second aspect, the present invention provides a blockchain system, wherein the hierarchical structure of the blockchain has a total of six hierarchical structures from bottom to top, namely, data layer, network layer, consensus layer, incentive layer, contract layer, and application layer;

[0046] in,

[0047] Obtain transaction data from the data layer and classify the transaction data using the KNN algorithm;

[0048] Calculate the honesty value of each parameter consensus node at the network layer;

[0049] Using different honesty values ​​at the consensus layer to dynamically change the mining difficulty of nodes;

[0050] In terms of the incentive layer, the reduction in mining difficulty is used as a reward for nodes, encouraging them to comply with mining rules, generate transactions, and package legal transactions.

[0051] (III) Beneficial effects

[0052] The present invention provides a method and a blockchain system for dynamically improving blockchain performance based on a network trust model. Compared with the prior art, it has the following beneficial effects:

[0053] The present invention first pre-trains a network trust model based on machine learning in the blockchain, and then uses the network trust model to classify transactions in the blockchain to identify malicious transactions and honest transactions; obtains the hash address of the node that creates the malicious transaction, and filters the malicious node before the node participates in the consensus; calculates the honesty value of the node participating in the consensus, and uses the honesty value to adjust the mining difficulty of each node. The present invention dynamically changes the mining difficulty of the node according to the different honesty values, reduces the block interval time, and thus improves the performance of the blockchain. At the same time, since the nodes that generate malicious transactions are screened and filtered, the malicious behavior of the malicious node is stopped in advance, thereby ensuring the security of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0055] Figure 1 A block diagram of a method for dynamically improving blockchain performance based on a network trust model according to an embodiment of the present invention;

[0056] Figure 2 This is the structure of the blockchain system of an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. 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.

[0058] The embodiment of the present application provides a method for dynamically improving the performance of blockchain based on a network trust model, thereby solving the technical problem that the existing methods cannot take into account both the performance and security of blockchain, thereby achieving efficient and secure operation while improving the performance of blockchain.

[0059] It should be noted that the "mining" in the embodiments of the present invention is limited to legal use.

[0060] The technical solution in the embodiment of the present application is to solve the above technical problems, and the overall idea is as follows:

[0061] The consensus mechanism of blockchain is committed to solving the consistency problem faced by the development of blockchain in the process of distributed storage, namely the "Byzantine Generals" problem; based on the differences in data read and write permissions and management permissions, blockchain is divided into public chain, private chain and alliance chain. Public chain has no centralized management agency, nodes in the network can be connected at will, and trust on the blockchain can be checked at will; typical consensus algorithms include proof of work POW, proof of authority POA and proof of equity PoS. POW is a common consensus mechanism in blockchain, however, the POW consensus algorithm still has many shortcomings, such as the waste of computing power resources caused by computing power competition.

[0062] Therefore, the main problem in improving the performance of blockchain is to deal with various attacks, such as double-spending attacks and witch attacks. Double-spending attacks take advantage of the bifurcation problem that occurs during mining; witch attacks are when a single node has multiple identity consensuses, and control most of the system's nodes to weaken the role of redundant backup.

[0063] In terms of transaction security, digital currency transactions have the advantages of convenience, encryption, and anonymity. For the entire transaction system, the transaction process is highly secure. After the transaction is formed, it can never be arbitrarily changed or forged. Each link and step has a detailed and strict record, so it has received widespread attention and recognition; however, the transaction entity (the producer and regulator of the transaction) and the security and legality of the transaction itself cannot be guaranteed, because all data or digital assets created by external entities are transparent to the blockchain, and illegal transactions cannot be filtered. In addition, in the blockchain structure, transactions are difficult to roll back. The blocks generated by the nodes, as the carrier of the transaction, have a certain correlation with the transaction; transactions generated by malicious nodes are not easy to detect.

[0064] In order to regulate digital currency and ensure its legitimacy and security, many foreign researchers have conducted research, which can basically be summarized as network layer traceability technology and transaction data analysis technology. In the blockchain system, the legitimacy of the transaction itself is crucial, so being able to analyze the legitimacy of the transaction is necessary to maintain the security index of the entire blockchain system.

[0065] The embodiment of the present invention can reasonably analyze and classify transactions, and filter out malicious nodes in advance when participating in consensus, thereby ensuring the security of the blockchain system, and thus providing a safety guarantee for improving mining efficiency. The node honesty introduces the transaction classification ratio, which can better combine the efforts made by the node in filtering malicious nodes with the mining difficulty, effectively reducing the probability of honest nodes being deceived by malicious nodes, and also reducing the waste of computing resources by reducing the mining difficulty at the same time.

[0066] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0067] The embodiment of the present invention provides a method for dynamically improving the performance of a blockchain based on a network trust model, wherein a network trust model based on machine learning is pre-trained in the blockchain, such as Figure 1 As shown, the method includes:

[0068] S1. Use the network trust model to classify transactions in the blockchain and identify malicious transactions and honest transactions;

[0069] S2. Obtain the hash address of the node that created the malicious transaction and filter out the malicious nodes before the node participates in the consensus;

[0070] S3. Calculate the honesty value of the nodes participating in the consensus, and use the honesty value to adjust the mining difficulty of each node.

[0071] The embodiment of the present invention dynamically changes the mining difficulty of the node according to the different honesty values, reduces the block interval time, and thus improves the blockchain performance. At the same time, since the nodes that generate malicious transactions are screened and filtered, the malicious behavior of the malicious nodes is stopped in advance, thereby ensuring the security of the blockchain.

[0072] The following is a detailed description of each step:

[0073] The training process of the network trust model based on machine learning is as follows:

[0074] Step a: Obtain data samples. Specifically including:

[0075] In the embodiment of the present invention, the data set The ELliptic Data Set is used as sample data. The task of this data set is mainly used in the following steps to train and learn the data set to obtain the best network trust model. It should be noted that other data sets are also obtained on the Kaggle platform as sample data. The sample transaction data contains multiple fields with different meanings, such as the input and output of the transaction, the source of the transaction, the transaction amount, and the fields attached to the transaction in different scenarios. These are used as feature vectors in the following steps.

[0076] Step b: pre-process the data samples by clustering, and divide the data samples into training set and test set. Specifically include:

[0077] The sample data is marked with different colors, and points of the same color are gathered together to form a cluster; points outside the cluster are called outliers. After finding the outliers, delete them to avoid the impact of accidental errors. Use clustering to preprocess data and features, and divide the sample data into training sets and test sets.

[0078] Step c: Perform dimensionality reduction on multiple features in the training set and test set, and select more prominent feature values. Specifically, it includes:

[0079] In order to better classify and improve the accuracy of unknown data, there are two main principles: one is to reduce the number of features and reduce the dimension, and the other is to make the model more generalizable and reduce overfitting. Here we use the PCA (Principal Component Analysis) dimensionality reduction method.

[0080] Step d: Train the supervised model using the reduced-dimensional training set to obtain the initial network trust model. Specifically:

[0081] The supervised model in the embodiment of the present invention selects a KNN model. The KNN model is trained by using the data features in the training set after dimensionality reduction to obtain an initial network trust model.

[0082] Step e: Test and optimize the initial network trust model using the test set after dimensionality reduction to obtain a network trust model.

[0083] In step S1, the network trust model is used to detect transactions in the blockchain to identify malicious transactions and honest transactions. The specific implementation process is as follows:

[0084] The blockchain is a peer-to-peer network where each node independently maintains the transaction data of neighboring nodes, and each node uses the network trust model to classify transactions in the associated node blocks.

[0085] After obtaining the transaction data set, the KNN network trust model is used to detect malicious transactions and honest transactions.

[0086] In step S2, the hash address of the node that created the malicious transaction is obtained, and the malicious node is filtered out before the node participates in the consensus. The specific implementation process is as follows:

[0087] If there is a malicious transaction in the transaction data packaged by the node, the node will locally save the hash address of the node that generated the malicious transaction; use the hash address to filter out malicious blocks generated by malicious nodes. If the address of the sender of the block received by the node belongs to someone who has sent a malicious transaction, no consensus will be reached on the block generated by the node, ensuring the security of the chain.

[0088] In step S3, the honesty values ​​of the nodes participating in the consensus are calculated, and the mining difficulty of each node is adjusted using the honesty values. The specific implementation process is as follows:

[0089] S301. The node obtains the evaluation result T of the total transaction by the neighboring nodes related to it. r =N trust / (N malicious +N trust ), where Nmalicious represents malicious nodes, N trust Represents an honest node. Since the result is not unique, the average value is calculated:

[0090] S302: Obtain the hash addresses of malicious nodes sent by neighboring nodes, determine whether the transactions packaged by the node belong to these nodes based on the addresses, and record them.

[0091] S302a, receiving the broadcast result, and storing the filtering result of the malicious nodes of the nodes received by the broadcast, the storage form is:

[0092] {'from_hash_addr':{malicious_addr1,malicious_addr2,malicious_addr3}}.

[0093] S302b, malicious transactions detected by machine learning, obtain the node addresses of these malicious transactions, compare with the malicious node addresses received by broadcast, use two variables is_in and not_in to record and compare whether the address is included in the filtering result, if it is included, is_in increases by 1, if not, not_in increases by 1. is_in means that the record of the malicious node is saved but the transaction is still packaged to the malicious node, which is an irresistible factor and has a relatively small proportion; while not_in means that the malicious node is not filtered, which means that the node has insufficient contribution and has a large proportion; the result calculated in this step is t con =0.2*is_in+0.8*not_in.

[0094] S303. Obtain the ratio between the number of valid blocks generated by the node on the longest chain and the number of all blocks on the longest chain where n v Indicates the number of valid blocks generated by the node on the longest chain, n l Indicates the number of all blocks on the longest chain.

[0095] S304. Based on the above calculated values, without considering the dynamic changes of the blockchain, calculate the honesty value t r :

[0096]

[0097] It should be noted that in the specific implementation process, each value has a certain effect on the honesty value t r There are some differences in the impact. In order to more accurately calculate the honesty value t r , assigning each value its own weight. At this time, Among them, a, b, and c represent their respective weights.

[0098] At the same time, because the blockchain network is developing dynamically, the time parameter t is added t More reasonable. Since the time parameter is related to the time when the node joins the blockchain system, it is necessary to record the time when the node joins the blockchain t s , and the current time t c , then the calculation time parameters are: Then calculate the node honesty of the dynamic blockchain network:

[0099] S305, use the honesty value to adjust the mining difficulty of each node. The honesty value is inversely proportional to the mining difficulty, that is, the larger the honesty value, the smaller the mining difficulty.

[0100] At the same time, as the difficulty of mining decreases, the probability of generating more than one block at the same time will also increase, and the problem of forks not being able to converge may occur due to the block generation rate being greater than the consensus information rate. Therefore, before a block is put on the chain, the honesty value of the sending node of the block needs to be compared. If the honesty value is high, the node will generate a block on the chain, thereby reducing the orphan block rate. For details, see S4.

[0101] S4. When there are multiple blocks, before the block is put on the chain, the honesty value of the node that generates the block is compared. The block generated by the node with a higher honesty value is put on the chain and broadcast to other nodes. Specifically, it includes:

[0102] S401. Each node maintains a buffer pool for receiving blocks, and the buffer pool contains blocks broadcasted to the node by its neighboring nodes.

[0103] S402. Determine whether there is more than one block in the buffer pool. If there is more than one, compare the node honesty values ​​of the blocks in it, select the block generated by the node with the highest honesty value to be chained, and after chaining, clear the buffer pool.

[0104] The embodiment of the present invention also provides a blockchain system, such as Figure 2 As shown, the hierarchical structure of the blockchain is the same as the prior art, with a total of six hierarchical structures. These six hierarchical structures have a total of six hierarchical structures from bottom to top, namely, data layer, network layer, consensus layer, incentive layer, contract layer, and application layer. The blockchain system of the embodiment of the present invention is improved on the existing blockchain, and the improvements include:

[0105] Obtain transaction data from the data layer and classify the transaction data using the KNN algorithm;

[0106] Calculate the honesty value of each parameter consensus node at the network layer;

[0107] Using different honesty values ​​at the consensus layer to dynamically change the mining difficulty of nodes;

[0108] In terms of the incentive layer, the reduction in mining difficulty is used as a reward for nodes, encouraging them to comply with mining rules, generate transactions, and package legal transactions.

[0109] In summary, compared with the prior art, the present invention has the following beneficial effects:

[0110] 1. The embodiment of the present invention dynamically changes the mining difficulty of the node according to the different honesty values, reduces the block interval time, and thus improves the blockchain performance. At the same time, since the nodes that generate malicious transactions are screened and filtered, the malicious behavior of the malicious nodes is stopped in advance, thereby ensuring the security of the blockchain.

[0111] 2. In the embodiment of the present invention, before a block is put on the chain, it is necessary to compare the honesty values ​​of the sending nodes of the block. If the honesty value is high, the node will generate a block for the chain, thereby reducing the orphan block rate.

[0112] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0113] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for dynamically improving blockchain performance based on a network trust model, characterized in that: A network trust model based on machine learning is pre-trained in the blockchain, and the method includes: S1. Use the network trust model to classify transactions in the blockchain and identify malicious transactions and honest transactions; S2. Obtain the hash address of the node that created the malicious transaction and filter out the malicious nodes before the node participates in the consensus; S3. Calculate the honesty value of the nodes participating in the consensus and use the honesty value to adjust the mining difficulty of each node, including: S301. The node obtains the evaluation result T of the total transaction by the neighboring nodes related to it. r =N trust / (N malicious +N trust ), where N malicious represents malicious nodes, N trust Represents an honest node. Since the result is not unique, the average value is calculated: n represents the number of neighboring nodes; S302: Obtain the hash addresses of malicious nodes sent by neighboring nodes, determine whether the transactions packaged by the node belong to these nodes based on the addresses, and record them; S302a, receiving the broadcast result, and storing the filtering result of malicious nodes of the nodes received by the broadcast; S302b, compare the node address of the malicious transaction detected by the network trust model with the malicious node address received by broadcast, use two variables is_in and not_in to record whether the address is included in the comparison and filtering results, if it is included, is_in adds 1, if not, not_in adds 1, is_in means that the record of the malicious node is saved but the transaction is still packaged to the malicious node, which is an irresistible factor and has a relatively small proportion; not_in means that the malicious node is not filtered, which means that the node's contribution is insufficient and has a large proportion; the result calculated in this step is t con =0.2*is_in+0.8*not_in; S303. Obtain the ratio between the number of valid blocks generated by the node on the longest chain and the number of all blocks on the longest chain where n v Indicates the number of valid blocks generated by the node on the longest chain, n l Indicates the number of all blocks on the longest chain; S304. Based on the above calculated values, without considering the dynamic changes of the blockchain, calculate the honesty value t r : S305. Use the honesty value to adjust the mining difficulty of each node. The honesty value is inversely proportional to the mining difficulty.

2. The method for dynamically improving blockchain performance based on a network trust model as claimed in claim 1, characterized in that: The network trust model based on machine learning is pre-trained in the blockchain, including: Step a, obtaining data samples; Step b: preprocess the data samples by clustering, and divide the data samples into a training set and a test set; Step c: using principal component analysis to reduce the dimensions of multiple features in the training set and the test set; Step d: Train the supervised model using the dimension-reduced training set to obtain an initial network trust model; Step e: Test and optimize the initial network trust model using the test set after dimensionality reduction to obtain a network trust model.

3. The method for dynamically improving blockchain performance based on a network trust model as claimed in claim 1, characterized in that: The S2 includes: If there is a malicious transaction in the transaction data packaged by the node, the hash address of the node that generated the malicious transaction is saved locally; the hash address is used to filter out the malicious blocks generated by the malicious node. If the address of the sender of the block received by the node belongs to someone who has sent a malicious transaction, no consensus will be reached on the block generated by the node.

4. The method for dynamically improving blockchain performance based on a network trust model as claimed in claim 1, characterized in that: The S304 further includes: Assign each value in the calculation of the honesty value its own weight. Among them, a, b, and c represent the weights of each value.

5. The method for dynamically improving blockchain performance based on a network trust model as claimed in claim 4, characterized in that: The S304 further includes: When calculating the honesty value, the dynamic changes of the blockchain are taken into account and the time parameter t is added. t ; Record the time t when the node joins the blockchain s , and the current time t c , then the calculation time parameters are: Calculate the node honesty of the dynamic blockchain network:

6. The method for dynamically improving blockchain performance based on a network trust model as described in any one of claims 1 to 5, characterized in that: The method further comprises: S4. When there are multiple blocks, before the block is put on the chain, the honesty value of the node that generates the block is compared. The block generated by the node with a higher honesty value is put on the chain and broadcast to other nodes.

7. The method for dynamically improving blockchain performance based on a network trust model as claimed in claim 6, characterized in that: The S4 specifically includes: S401, each node maintains a buffer pool for receiving blocks, and the buffer pool contains blocks broadcasted to the node by its neighboring nodes; S402. Determine whether there is more than one block in the buffer pool. If there is more than one, compare the node honesty values ​​of the blocks in it, select the block generated by the node with the highest honesty value to be put on the chain, and after being put on the chain, clear the buffer pool.

8. A blockchain system, characterized in that: The hierarchical structure of the blockchain has six layers from bottom to top, namely data layer, network layer, consensus layer, incentive layer, contract layer, and application layer; in, Obtain transaction data from the data layer and classify the transaction data using the KNN algorithm; Calculate the honesty value of each parameter consensus node at the network layer; Different honesty values ​​are used at the consensus layer to dynamically change the mining difficulty of the node. The honesty value is inversely proportional to the mining difficulty. In terms of the incentive layer, the reduction of mining difficulty is used as a reward for nodes, encouraging them to comply with mining rules, generate transactions, and package legal transactions; The specific process of calculating the honesty value of each parameter consensus node includes: S301. The node obtains the evaluation result T of the total transaction by the neighboring nodes related to it. r =N trust / (N malici0us +N trust ), where N malicious represents malicious nodes, N trust Represents an honest node. Since the result is not unique, the average value is calculated: n represents the number of neighboring nodes; S302: Obtain the hash addresses of malicious nodes sent by neighboring nodes, determine whether the transactions packaged by the node belong to these nodes based on the addresses, and record them; S302a, receiving the broadcast result, and storing the filtering result of malicious nodes of the nodes received by the broadcast; S302b, compare the node address of the malicious transaction detected by the network trust model with the malicious node address received by broadcast, use two variables is_in and not_in to record whether the address is included in the comparison and filtering results, if it is included, is_in adds 1, if not, not_in adds 1, is_in means that the record of the malicious node is saved but the transaction is still packaged to the malicious node, which is an irresistible factor and has a relatively small proportion; not_in means that the malicious node is not filtered, which means that the node's contribution is insufficient and has a large proportion; the result calculated in this step is t con =0.2*is_in+0.8*not_in; S303. Obtain the ratio between the number of valid blocks generated by the node on the longest chain and the number of all blocks on the longest chain where n v Indicates the number of valid blocks generated by the node on the longest chain, n l Indicates the number of all blocks on the longest chain; S304. Based on the above calculated values, without considering the dynamic changes of the blockchain, calculate the honesty value t r :