| In recent years,the Internet of things technology has developed rapidly and attracted more and more attention.The Internet of things has gradually developed from the information interaction mode between people in the traditional Internet to the interconnection between things.At present,Internet of things technology has been applied to transportation,schools,industry and other fields,making human society more convenient.However,when the Internet of things brings so many functions,the development of the Internet of things itself is restricted due to limited resources,high operation cost of central institutions and vulnerability to security attacks.With the continuous development of blockchain technology,the advantages of decentralization,tamperability,traceability and consensus mechanism presented by blockchain can solve the problems faced by the Internet of things,such as high operation cost of central institutions and hidden dangers in security.Consensus mechanism is one of the key technologies of blockchain,which has an important impact on the Internet of things in many aspects.The traditional consensus mechanism can not be applied to the Internet of things scenario because it needs to consume a lot of resources and the processing speed and security need to be improved.Therefore,studying and improving the existing consensus mechanism is of great significance to the combination of Internet of things and blockchain.The research content of this paper is mainly divided into the following two parts:1)Aiming at the problems of node attacks in the consensus mechanism of Delegated Proof of Stake(DPoS)and how to reduce the possibility of malicious nodes becoming representative nodes,an improved consensus algorithm DPoS based on node weight(NW-DPoS)is proposed to for resource constrained Internet of things environment.NW-DPoS uses for reference the advantages of IOTA consensus in security and stability and establishes trust relationships between nodes.NW-DPoS is based on DPoS and improved by using the concept of node weight.Firstly,in the process of selecting block producers,each node needs to select the other two nodes trusted by itself.By calculating the cumulative approval of nodes,select the node with high approval as the representative node;Secondly,according to the behavior of nodes,the malicious nodes are punished by reducing the cumulative approval of nodes;Finally,the simulation experiment and analysis show that NW-DPoS consensus algorithm can significantly reduce the probability of malicious nodes becoming representative nodes,and is more reliable than DPoS consensus mechanism in resisting double spend attack and bribery attack,thus making the system more secure.2)Aiming at the problems of unrepresentative voting nodes and malicious node attacks when DPoS consensus mechanism is applied to the Internet of things,an improved consensus algorithm DPoS based on reputation(R-DPoS)is proposed.Firstly,the interaction relationship between gateway nodes is established,the comprehensive reputation is calculated by the interaction relationship and the block record,and the available nodes with high reputation are selected;Secondly,in the election stage,the consensus node is voted according to the computing capacity,storage capacity and communication capacity of each gateway node.At the same time,the method of reducing the reputation punishment of the malicious nodes is carried out;Finally,the simulation experiment and analysis show that the nodes selected by R-DPoS consensus algorithm are more representative and can effectively resist malicious attacks and ensure the security of the system. |