Driven by targeted poverty alleviation and rural revitalization of our country,the individual small-scale peasant economy has gradually developed into a new type of cooperative economy that cooperates with enterprises and farmers.In this way,a five-in-one supply chain business model integrating planting,breeding,processing,distribution,sales,and supervision has been gradually formed.In order to effectively track product information,ensure product safety and quality,and thereby ensure consumer safety,research on advanced traceability technologies and systems has important research value for ensuring the quality and safety of agricultural products.The supply chain traceability system currently studied has many problems,e.g.,easy data tampering,missing processing data,difficult information sharing,and low credibility.Therefore,use WSNs technology to intelligently collect growth environment data,combine Ontology and GA-CBR technology to restore lost and tampered processing data;then upload the optimized and accurate data to the blockchain,and save the information and data flowing into and out of the blockchain to the system While the hash value of the data is stored in the smart contract,the attributes and functions of the alliance chain smart contract are designed and implemented,and the PBFT is improved to select high-reputation nodes to participate in the consensus.The specific research content and methods are as follows:(1)Based on the network characteristics of large-scale WSNs and the transmission capacity of big data,a new type of network model suitable is presented which combined the advantages of Star model and Mesh model.More importantly,the deployment environment of sensor nodes is a spatial network.The data collected and transmitted by large-scale WSNs is very large.The deployment of sensor nodes in space can ensure that the big data collected and transmitted are true and effective.This research proposes the space density first(SDF)algorithm,which improves the neighbor density first(NDF)algorithm with the space node deployment and the density-optimized SDF algorithm.The SDF algorithm saves network energy and extends the life of the network.Experimental results show that large-scale WSNs built with a new networking model and SDF algorithm can collect and transmit big data stably and reliably,which saves network energy and improves the accuracy of big data.(2)During the traceability of applying CBR to product processing,we can solves the problem to establish an accurate and complete mathematical model between the processing information and product quality defects by finding the target record through a large number of historical data.The traceability model of ontology and CBR uses OWL-DL for case representation in order to simplify CBR framework for big data,classifies processes data and standardizing the information storage.A joint optimization algorithm based on GA and CBR was proposed to establish the optimization model of process traceability,which was applied to case retrieval and reuse.This algorithm optimizes the genetic operator by combining the optimal preservation strategy and roulette selection method,and uses the exponential scale transformation method to stretch the fitness function.Experiments show that the optimized traceability model can infer the information of garbled codes,wrong codes and missing message,so as to quickly find out the problem products,thus effectively improving the traceability accuracy of the product processing process.(3)Based on the analysis of the working principle and consensus mechanism of PBFT,this study proposed an algorithm to improve PBFT: feature grouping and credit optimization Byzantine Fault Tolerance(FCBFT).In this algorithm,a feature grouping model is proposed to optimize the node structure of large-scale consortium chain,which divides large-scale network nodes into different institutions to form independent consensus groups by feature grouping.On this basis,a reputation score reward mechanism is proposed to improve the consensus efficiency of large-scale consortium chains.It introduces a reputation score calculation formula to select high-reputation master nodes.At the same time,a replacement cycle is established to replace high-reputation nodes with low-reputation nodes,so as to optimize the consensus efficiency of the consortium chain.The experimental results show that FCBFT has shorter delay and higher throughput(TPS)than PBFT,which becomes more obvious as the number of nodes increases.After the number of nodes exceeds the threshold,the TPS of PBFT drops rapidly,while FCBFT can maintain high efficiency and stability.FCBFT’s block generation speed is higher than PBFT,and its relative growth rate has steadily increased.(4)With the FISCO alliance chain as the underlying platform,the trusted traceability system is designed into five institutions to form the traceability chain of all levels of node traceability events.After the establishment of farm nodes,processing nodes,distribution nodes,sales nodes and supervision nodes,the data of each link of the agricultural product supply chain will be put on the chain.In addition,the key attributes and functions of smart contracts and the relationship between institutions and smart contracts are designed.Its work flow is that the node activates the smart contract function by passing parameters through the execution function,and triggers the event to notify the relevant nodes of the participating institutions to conduct transactions.The implementation process of the three main smart contracts of farm-processing,processing-distribution,and distribution-sales is realized. |