| With the gradual expansion of the scale of Internet of Things(IoT),the number of terminal devices has increased,and a large amount of transaction data has been generated,which caused a series of security issues,such as,plaintext transmission and uncontrollable flow of data.Blockchain technology is proposed to improve the credibility and credibility of IoT data in security and trust.Blockchain technology has the characteristics of decentralized computing and storage,which improves storage security and multi-party trust in data transactions.However,terminal devices have the characteristics of weak computing power and limited storage space.In order to make the blockchain suitable for the IoT,based on the traditional consensus algorithm,the lightweight consensus mechanism performs optimizations such as reduction process and network layering.However,the current lightweight consensus mechanism has problems such as a wide range of consensus nodes,the time-consuming consensus increases with the increase of the network size,and additional memory consumption.Therefore,the paper conducts research on the consensus mechanism for lightweight blockchain,abandons the concept of traditional consensus mechanism for full-node consensus.We propose a lightweight consensus algorithm based on IoT node partitioning to achieve regional consensus by partitioning IoT nodes,reduce resource consumption of IoT nodes,and improve data transmission rates between consensus nodes.This paper proposes a consensus node data batch replication algorithm based on the sliding window mechanism to improve the data transmission rate between consensus nodes,and combines the two algorithms to design and implement an energy data synchronization sharing network system based on partition consensus.The main work of the thesis is as follows.1)We propose a lightweight consensus algorithm based on IoT node partitioning.We design and implement a lightweight consensus algorithm model for node partitioning to solve the problem that IoT consensus throughput drops significantly and it is difficult to achieve rapid consensus.First,we define IoT node attributes and quantify attribute values.The nodes are clustered and partitioned by the K-means clustering algorithm.We propose a node partition check algorithm.The clustering and partitioning results are verified by using technical points such as node attribute difference value,node similarity,and node similarity based on connected objects.We calculate the comprehensive strength value according to the node attributes,and elect regional decision-making nodes.We have completed relevant indicators and comparative experiments.Through the comparison experiments with TreeChain and PoBT lightweight algorithms.It is concluded that the transaction and query time of this algorithm is lower than the other two algorithms,and the memory usage and CPU usage are also less,which verifies the The feasibility and efficiency of the algorithm.2)We propose a consensus node data batch replication algorithm based on the sliding window mechanism.The consensus mechanism is a process in which several nodes reach an agreement on data,and the data transmission method between consensus nodes is reflected in the form of logs.For the current consensus node data transmission is carried out one by one or a single time.When the data scale becomes larger,the timeconsuming of a single data synchronization mode is serious.It is difficult to solve the problem of high-speed data transmission in the case of largescale consensus data volume.We design a consensus node data batch replication model based on the sliding window mechanism.We changed the synchronous single log replication mode to asynchronous batch,and at the same time added the replication result status information of each log index item,and applied it to the node partition consensus algorithm.It is verified by experiments that in the case of large data volume,the asynchronous batch replication of logs is faster than the synchronous replication strategy.3)We design and implement a light-weight consensus-based energy data synchronization and sharing network system.The data of various energy agencies centered on the State Grid has the shortcomings of slow data consensus,untimely data sharing among agencies and difficult to manage.The network system combines the partition consensus algorithm and the consensus node data batch replication algorithm.The system realizes the functions of node addition and deletion,node partition function,data synchronization consensus and display function,fixed-point data transmission function,data classification and summary function,and data upload and query functions.We use Postman to perform functional unit testing on functional modules.We carried out node clustering load experiment test,system throughput test,data synchronization time comparison experiment of different consensus algorithms,and comparison experiment of different data replication modes of consensus nodes.It is verified that the system can achieve the purpose of rapid data sharing among various energy agencies,and solve the problems of slow data consensus and difficult management.In conclusion,the proposed lightweight consensus algorithm based on IoT node partition has been verified by experiments,which verifies the lightweight of the algorithm and its applicability in IoT scenarios.The optimized log replication strategy has also been verified.We compared with other consensus algorithm,the synchronization data rate of the consensus algorithm has been improved to a certain extent. |