| Nowadays,as an emerging technology,the Internet of Things is developing rapidly,and its concept of "Internet of Everything" makes it widely used in different fields,such as agriculture,medical care,transportation and so on.Also,blockchain technology is emerging rapidly these years.The development of blockchain technology has made data security problem caused by centralized storage easily to solve.It is a decentralized storage solution.All nodes on the chain are peer-to-peer,which can avoid the centralization of power to third-party users,and once the data is stored on the chain,it cannot be tampered with,effectively ensuring the security of the data.The combination of blockchain and the Internet of Things can ensure the authenticity and credibility of the data source at the data output side,which further improves the security and authenticity of the data.However,due to limited storage and insufficient computing power,Io T devices’ s access to blockchain network is difficult to realize.Thus,this paper mainly focuses on these two aspects,and designs a blockchain storage model suitable for storing farming information of agricultural machinery and equipment in the agricultural Internet of Things.First of all,in view of the problem of limited storage space,a dual-blockchain model in which the main chain and the My SQL database are used for storage,in which the main chain is deployed on the cloud server side,has sufficient storage space and is used as a full backup of the stored data.At the same time,the settlement of farming remuneration is carried out through the main chain contract to reduce conflicts about money;the subchain is connected to the Internet of Things equipment,which is used to store the verification information of the main chain blocks,and the Merkel Mountain Range is used as the storage structure for verification information.Compared with the traditional SPV verification scheme,the storage space required by the experimental comparison is smaller,and the MySQL database is used to store the farming information,which has met the possible real-time query requirements.On the other hand,in view of the insufficient computing power of Io T devices to run the consensus algorithm,the PBFT consensus,which does not require high computing power,is selected as the basis,and the optimization is carried out to solve the problem of high communication cost in the operation of the PBFT algorithm.Introduce the node upgrade and upgrade system,and reduce the probability of the malicious node serving as the primary node through the reward and punishment of reputation points,so as to reduce the communication cost caused by the switching of the primary node.At the same time,the algorithm will switch back to the initial PBFT consensus when a Byzantine error occurs on the primary node to ensure the fault tolerance of the algorithm.Finally,through multiple sets of experiments,it is proved that when most of the nodes in the network are honest nodes,the improved algorithm has better performance in terms of transaction throughput,consensus time and communication cost. |