Agricultural product tracing method and system based on Internet of Things

By collecting, encrypting, and recording agricultural product information using IoT and blockchain technologies, the problems of information opacity and tampering in traditional traceability methods have been solved, achieving reliable traceability of agricultural products throughout the entire process and improving data transparency.

CN120975801APending Publication Date: 2025-11-18NANJING MILIN JUNIOR AGRICULTURAL PRODUCTS CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511105255.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-07
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Traditional agricultural product traceability methods rely on centralized databases, which suffer from problems such as opaque information, susceptibility to tampering, and difficulty in traceability, making it difficult to meet modern consumers' demands for food safety and trust.

Method used

The system uses IoT technology to collect information from all stages of agricultural product production, employs SHA256 encryption algorithm to prevent tampering, and utilizes blockchain technology to form a decentralized distributed ledger, achieving immutability and traceability of information. Consumers can trace the product by querying blockchain information through QR codes.

Benefits of technology

To ensure the comprehensiveness and accuracy of data, prevent information tampering, improve the transparency and trust of the supply chain, and achieve full traceability of agricultural products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120975801A_ABST
    Figure CN120975801A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to an agricultural product tracing method and system based on the Internet of Things, and the method comprises the steps: collecting the information of each link of an agricultural product through the Internet of Things technology; hash processing is performed on the information of each link of the agricultural product through an SHA256 encryption algorithm so as to prevent information tampering; through a block chain technology, packaging the information of each link of the agricultural product after hash processing into blocks, and linking the blocks in sequence according to a time sequence to form a complete block chain; receiving a query request sent by a consumer terminal; and querying the block chain according to the agricultural product identifier, and pushing information of each link of the corresponding agricultural product to a consumer terminal to realize agricultural product traceability. According to the invention, full-chain information tracing of agricultural products from production to transportation can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and in particular to a method and system for tracing agricultural products based on the Internet of Things. BACKGROUND

[0002] Under the current global background, the complexity of the production link of agricultural products and the uncertainty of the supply chain have caused frequent food safety problems, which have seriously threatened the health of consumers. In order to solve this problem, the agricultural product traceability technology has emerged as the times require and has become one of the important guarantees for food safety. Through the whole process monitoring and recording of each link in the production process, once a safety problem occurs, the problem can be quickly located and appropriate measures can be taken to deal with it in time to avoid damage to consumers caused by safety incidents.

[0003] However, the traditional agricultural product traceability method often relies on centralized databases or paper records, which has problems such as information opacity, easy tampering, and difficulty in tracing, and is difficult to meet the needs of modern consumers for food safety and trust. Therefore, a more reliable, efficient and trustworthy traceability solution is urgently needed. SUMMARY

[0004] Therefore, it is necessary to provide a method and system for tracing agricultural products based on the Internet of Things, which can realize the whole-chain information tracing of agricultural products from production to transportation.

[0005] In a first aspect, the present application provides a method for tracing agricultural products based on the Internet of Things, which comprises: Collecting information of each link of agricultural products through Internet of Things technology, wherein the information of each link of agricultural products includes information of production, processing and transportation links of agricultural products; Hash processing the information of each link of agricultural products through SHA256 encryption algorithm to prevent information tampering; Packing the hash-processed information of each link of agricultural products into blocks through blockchain technology, and linking the blocks in time sequence to form a complete blockchain, wherein the blockchain technology adopts a decentralized distributed ledger so that all participants of the links can query the information on the blockchain; Receiving a query request sent by a consumer terminal, wherein the query request carries an agricultural product identifier, and the agricultural product identifier is sent by the consumer terminal after identifying the two-dimensional code information on the agricultural product; According to the agricultural product identifier, querying the blockchain and pushing the corresponding information of each link of agricultural products to the consumer terminal to realize the traceability of agricultural products.

[0006] In one embodiment, the collecting information of each link of agricultural products through Internet of Things technology comprises: In the production of agricultural products, the growth environment information of agricultural products is collected through sensors; In the processing of agricultural products, the processing equipment parameters and hygiene condition information are recorded to form a digital certificate of the processing link; In the transportation of agricultural products, the position and trajectory of the agricultural product transport vehicle are monitored in real time through GPS positioning.

[0007] In one embodiment, the growth environment information of agricultural products collected by sensors includes: Sensor nodes are set up in the growth environment of each agricultural product, and each sensor node attempts to establish a connection with the server side to form a connected node set and an unconnected node set; According to the connected node set and the unconnected node set, a near-coupling rule network model is constructed, and a small-world network model is constructed for unconnected nodes through multiple local reconnection operations; Through the small-world network model, the sensor nodes stably send the growth environment information of agricultural products to the server side, thereby realizing all-round monitoring of the growth environment of agricultural products.

[0008] In one embodiment, the real-time monitoring of the position and trajectory of the agricultural product transport vehicle through GPS positioning includes: Receive GPS positioning data and integrate the received GPS positioning data set into a map service; Display the position information of the agricultural product transport vehicle on the map by calling the map API; The position information is updated in real time through a timer or an event triggering mechanism to monitor the position and trajectory of the agricultural product transport vehicle in real time.

[0009] In one embodiment, the hash processing of the information of each link of the agricultural products through the SHA256 encryption algorithm to prevent information tampering includes: The information of each link of the agricultural products is converted into a binary string through the SHA256 encryption algorithm; The binary string is padded to make the length of the binary string meet the preset length; The padded information of each link of the agricultural products is divided into blocks, and a fixed constant and a logical function are used to iterate each block to generate a hash value for each block.

[0010] In one embodiment, before the information of each link of the agricultural products is converted into a binary string through the SHA256 encryption algorithm, it further includes: Integrate different link information through a standardized interface to achieve unified standardization of information.

[0011] In one embodiment, after collecting the information of each link of the agricultural products by the Internet of Things technology, the method further comprises: obtaining environmental variables and historical yield data of the agricultural products, and performing feature selection by a random forest according to the environmental variables and the historical yield data of the agricultural products to screen out the most important features for the prediction task; combining a principal component analysis method to reduce the number of features and obtain final features; predicting the yield of the agricultural products according to the final features.

[0012] In a second aspect, the present application also provides an agricultural product traceability device based on the Internet of Things. The device comprises: an information collection module configured to collect information of each link of the agricultural products by the Internet of Things technology, wherein the information of each link of the agricultural products comprises information of production, processing and transportation links of the agricultural products; an information encryption module configured to perform hash processing on the information of each link of the agricultural products by a SHA256 encryption algorithm to prevent information tampering; a block chain generation module configured to package the hash-processed information of each link of the agricultural products into blocks by a block chain technology, and link the blocks in time sequence to form a complete block chain, wherein the block chain technology adopts a decentralized distributed ledger so that participants of all links can query information on the block chain; a query request receiving module configured to receive a query request sent by a consumer terminal, wherein the query request carries an agricultural product identifier, and the agricultural product identifier is sent by the consumer terminal after identifying two-dimensional code information on the agricultural products; an information pushing module configured to query the block chain according to the agricultural product identifier, and push corresponding information of each link of the agricultural products to the consumer terminal to realize agricultural product traceability.

[0013] In a third aspect, the present application also provides a computer device. The computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the following steps when executing the computer program: collecting information of each link of the agricultural products by the Internet of Things technology, wherein the information of each link of the agricultural products comprises information of production, processing and transportation links of the agricultural products; performing hash processing on the information of each link of the agricultural products by a SHA256 encryption algorithm to prevent information tampering; The information of each link of the agricultural products after the hash processing is packaged into a block by the blockchain technology, and the blocks are sequentially linked in time sequence to form a complete blockchain, wherein the blockchain technology adopts a decentralized distributed ledger, so that all participants of each link can query the information on the blockchain. The query request sent by the consumer terminal is received, and the query request carries an agricultural product identifier, which is sent by the consumer terminal after identifying the two-dimensional code information on the agricultural products. According to the agricultural product identifier, the blockchain is queried, and the corresponding agricultural product information of each link is pushed to the consumer terminal to realize agricultural product traceability.

[0014] In a fourth aspect, the application also provides a computer readable storage medium. The computer readable storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement the following steps: The information of each link of the agricultural products is collected by the Internet of Things technology, including the production, processing and transportation information of the agricultural products. The information of each link of the agricultural products is hashed by the SHA256 encryption algorithm to prevent information tampering. The information of each link of the agricultural products after the hash processing is packaged into a block by the blockchain technology, and the blocks are sequentially linked in time sequence to form a complete blockchain, wherein the blockchain technology adopts a decentralized distributed ledger, so that all participants of each link can query the information on the blockchain. The query request sent by the consumer terminal is received, and the query request carries an agricultural product identifier, which is sent by the consumer terminal after identifying the two-dimensional code information on the agricultural products. According to the agricultural product identifier, the blockchain is queried, and the corresponding agricultural product information of each link is pushed to the consumer terminal to realize agricultural product traceability.

[0015] In summary, the application has the following beneficial technical effects: Through the Internet of Things technology, information of agricultural products in each link of production, processing and transportation is collected to ensure the comprehensiveness and accuracy of data, thereby providing a solid data foundation for the whole life cycle management of agricultural products; SHA256 encryption algorithm is used to perform hash processing on the information of agricultural products in each link, and the information of agricultural products in each link after hash processing is packaged into a block to form a decentralized distributed ledger, so that all participants can query the information on the block chain, and information loss and information tampering can be prevented, the authenticity and integrity of information are ensured, and the transparency and trust of the whole supply chain are improved; the information of agricultural products in each link of production, processing and transportation is quickly obtained by receiving the query request sent by the consumer terminal, thereby realizing the whole traceability of agricultural products. BRIEF DESCRIPTION OF DRAWINGS

[0016] Figure 1 a flowchart of a method for tracing agricultural products based on the Internet of Things in an embodiment; Figure 2 a flowchart of a method for tracing agricultural products based on the Internet of Things in another embodiment; Figure 3 a block diagram of a structure of a device for tracing agricultural products based on the Internet of Things in an embodiment; Figure 4 an internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION

[0017] The embodiments of the present application provide a method and system for tracing agricultural products based on the Internet of Things.

[0018] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms, and should not be interpreted as being limited to the embodiments described herein, but rather, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes, and are not intended to limit the scope of protection of the present application.

[0019] In the description of the embodiments of the present application, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e. "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. can refer to different or same objects. Other explicit and implicit definitions can also be included below.

[0020] For the sake of understanding, the specific flow of the embodiments of the present application is described below, please refer to Figure 1An embodiment of the agricultural product traceability method based on the Internet of Things in the embodiment of the application comprises: S100, collecting information of each link of the agricultural product by using the Internet of Things technology.

[0021] The information of each link of the agricultural product comprises information of production, processing and transportation of the agricultural product.

[0022] Specifically, by using the Internet of Things technology such as sensors, RFID tags and GPS positioning, the key information of the agricultural product in each link such as production, processing and transportation can be collected in real time, so as to ensure the comprehensiveness and accuracy of the information. For example, the temperature and humidity sensor monitors the environmental parameters, the RFID and NFC technology is used for product identification and tracking, the GPS records the transportation track, and the video monitoring device records the production process. Then the collected information of each link of the agricultural product is transmitted to the data center or the traceability system platform through the wireless network or the wired network, so as to ensure the real-time nature of the data. Finally, the collected information of each link of the agricultural product is arranged, standardized and processed, the coding rules (such as the GS1 standard), the time format and the data field are unified, so as to ensure the consistency and traceability of the data.

[0023] In the embodiment, by using the Internet of Things technology, the real-time data collection and traceable management of the production, processing and transportation of the agricultural product are realized, which provides technical support for food safety and supply chain optimization.

[0024] S200, performing hash processing on the information of each link of the agricultural product by using the SHA256 encryption algorithm to prevent information tampering.

[0025] Specifically, SHA256 is a cryptographic hash algorithm that can convert input data of any length into a fixed-length 256-bit hash value. This hash value has irreversibility, uniqueness and strong collision resistance. Even if the input data changes slightly, the hash value will be significantly different. This feature enables the hash value to effectively detect any tampering of the data. For example, if the content of a file is modified by one letter, the hash value will be completely different, so the data tampering can be immediately discovered. The information of each link of the agricultural product can generate unique hash values by using the SHA256 encryption algorithm, and these hash values are stored on the blockchain. The decentralized nature of the blockchain makes it difficult to tamper with the data, because once the data is written to the blockchain, it cannot be changed. In addition, by using the digital signature technology, the hash value can be encrypted and verified, further enhancing the security of the data.

[0026] In the embodiment, by using the SHA256 encryption algorithm to perform hash processing on the information of each link of the agricultural product, not only can the information tampering be effectively prevented, but also the credibility and transparency of the data can be improved, which provides strong support for food safety and quality control of the agricultural product supply chain.

[0027] S300, through the blockchain technology, the information of each link of the agricultural products after the hash processing is packaged into a block, and the blocks are sequentially linked according to time sequence to form a complete blockchain.

[0028] Specifically, the blockchain packages the information of each link of the agricultural products such as production, processing and transportation into a block, and sequentially links them according to time sequence to form a complete blockchain. Once the data is recorded on the blockchain, it cannot be tampered with maliciously. The blockchain technology adopts a decentralized distributed ledger, so that all participants (such as farms, processing enterprises, logistics companies, and sellers) can record and query data on the same platform. This structure makes data no longer dependent on a single control center, but is maintained by multiple nodes, each of which has a complete data copy. Therefore, to tamper with data, an attacker must control more than 50% of the nodes in the blockchain to modify the data. However, as the blockchain network expands, the number of nodes increases, and it is almost impossible to control more than 50% of the nodes in practice. Each block on the blockchain contains the hash value of the previous block, forming an unchangeable chain. If someone tries to tamper with the data of a block, the hash value of the block will change, thereby destroying the consistency of the entire chain. Since all nodes have the same hash chain, any tampering will be identified and rejected by other nodes.

[0029] In this embodiment, the blockchain technology provides a solid technical guarantee for agricultural product traceability data through its characteristics of decentralization, tamper resistance, traceability, etc., ensuring the authenticity and credibility of the information.

[0030] S400, receiving the query request sent by the consumer terminal.

[0031] Specifically, the consumer scans the two-dimensional code on the agricultural product to obtain the identification information (such as the traceability code) of the agricultural product. Then, the identification information is sent to the traceability system platform (server side) as part of the query request through the terminal device (such as mobile phone, computer, etc.), and the traceability system platform is responsible for processing these query requests and returning detailed information related to the agricultural product.

[0032] S500, according to the agricultural product identification, querying the blockchain, and pushing the corresponding information of each link of the agricultural product to the consumer terminal to realize agricultural product traceability.

[0033] Specifically, after the production of each agricultural product is completed, a unique identifier is generated, which is bound to the block information on the blockchain, ensuring the uniqueness and traceability of each agricultural product. Consumers can obtain the agricultural product identifier by scanning the two-dimensional code on the packaging of the agricultural product, and generate a query request and send it to the traceability system platform; the system will query the corresponding block information on the blockchain according to the agricultural product identifier, obtain the information of each link of agricultural product production, processing and transportation, and then feed back the queried information to the consumer terminal. For example, after completing the receipt, the consumer can query the data information and photos of the whole process of the agricultural product, such as production, packaging, logistics, and location information of the production place, to realize comprehensive product traceability. In addition, the system will also provide a visual chart to show the current product information and the information collected by external devices, including time, location, user volume, user evaluation and feedback, etc., to ensure the traceability of product quality problems.

[0034] In one embodiment, as shown in Figure 2 S100 includes: S120, in the agricultural product production link, the growth environment information of the agricultural product is collected by a sensor; S140, in the agricultural product processing link, the processing equipment parameters and hygiene condition information are recorded to form a digital certificate of the processing link; S160, in the agricultural product transportation link, the position and trajectory of the agricultural product transportation vehicle are monitored in real time by GPS positioning.

[0035] Specifically, in the agricultural product production link, the growth environment information of the agricultural product is collected by a sensor, which is an important basis for realizing the whole process traceability of agricultural products. In the production process, various sensors such as temperature and humidity sensors, light sensors, soil pH sensors, etc. are deployed in the farmland or breeding farm to collect the growth environment information of the agricultural product in real time, and the growth environment information is uploaded to the traceability system platform through a wireless transmission module to ensure that the growth environment of the agricultural product meets the standards. In the agricultural product processing link, the processing equipment parameters and hygiene condition information are recorded to form a digital certificate of the processing link, which is an important measure to ensure the quality and safety of agricultural products. In the processing process, the processing time, processing location, raw materials and additives used, etc. are recorded to ensure that the processing process meets the food safety standards; at the same time, through bar code, RFID (radio frequency identification) and other technologies, the information of processing raw materials, additive use, processing technology, packaging date, etc. is recorded in detail to ensure that the processing link meets the hygiene standards and quality requirements, and realizes the traceability of the processing process. In the agricultural product transportation link, the position and trajectory of the agricultural product transportation vehicle are monitored in real time by GPS positioning, which is a key means to ensure the safety of agricultural product transportation. The transportation link is one of the key links to ensure the quality of agricultural products. Through GPS (Global Positioning System) technology, the transportation trajectory and transportation vehicle information of agricultural products can be tracked in real time.

[0036] In this embodiment, through the Internet of Things technology such as sensors and GPS, each link of the agricultural products from production to processing and transportation can be monitored and information recorded, thereby building a complete agricultural product quality and safety traceability system.

[0037] In one embodiment, the growth environment information of the agricultural products collected by the sensors includes: In the growth environment of each agricultural product, a sensor node is arranged, each sensor node attempts to establish a connection with the server side, forming a connected node set and an unconnected node set; according to the connected node set and the unconnected node set, a near-coupling rule network model is constructed, and for the unconnected nodes, a small-world network model is constructed through multiple local reconnection operations; through the small-world network model, each sensor node stably sends the growth environment information of the agricultural products to the server side, thereby realizing all-around monitoring of the growth environment of the agricultural products.

[0038] Specifically, in the growth environment of each agricultural product, a sensor node is arranged, each sensor node attempts to establish a connection with the server side, forming a connected node set (successfully connected nodes) and an unconnected node set (nodes that fail to connect), wherein the sensor node serves as a data collection unit, responsible for sensing environmental information and transmitting it to the server side through multi-hop routing. Based on the "total node set" (connected + unconnected nodes), a near-coupling rule network model with degree D is constructed, which defines the initial topology structure through local connection rules between nodes (such as geographical proximity or functional association). For unconnected nodes, multiple local reconnection operations are performed to optimize the network structure by adjusting the connection path (such as disconnecting regular edges and randomly connecting long-distance edges), ensuring that the network has small-world characteristics. Finally, through the small-world network model, each sensor node can stably send the growth environment information of the agricultural products to the server side, thereby realizing all-around monitoring of the growth environment of the agricultural products.

[0039] In this embodiment, through the small-world network model, the sensor nodes can quickly gather monitoring data to the server side, solving the problem of unstable data transmission in traditional traceability systems.

[0040] In one embodiment, the real-time monitoring of the position and trajectory of the agricultural product transportation vehicle through GPS positioning includes: Receiving GPS positioning data and integrating the received GPS positioning data into a map service; displaying the position information of the agricultural product transportation vehicle on the map by calling the map API; updating the position information in real time through a timer or an event triggering mechanism to monitor the position and trajectory of the agricultural product transportation vehicle in real time.

[0041] Specifically, during the transportation of agricultural products, a GPS positioning device such as a Beidou satellite navigation system or a GPS module is usually installed on the transportation vehicle to obtain real-time position data of the vehicle. Since the GPS positioning data is usually transmitted in NMEA standard format, the raw GPS positioning data received needs to be parsed and converted to extract key information such as latitude, longitude, speed, and time. The parsed and converted GPS positioning data is usually integrated into a map service by calling a map API (such as Gaode Map, Baidu Map, Google Maps, etc.) to display the position information of the transportation vehicle on the map and realize functions such as trajectory playback. In addition, through GPS positioning technology, combined with GIS (Geographic Information System) technology, self-positioning and tracking scheduling of the transportation vehicle can be realized, and a reasonable distribution route can be planned to reduce transportation costs. GPS positioning technology can also be combined with Internet of Things technology to realize real-time monitoring of the transportation environment. For example, through vehicle-mounted sensors, the temperature and humidity in the vehicle cabin can be monitored in real time. Once an anomaly occurs, the system will immediately issue an alarm to remind the driver to take appropriate measures, such as adjusting the temperature or humidity in the vehicle, to ensure that the quality of agricultural products is not affected during transportation.

[0042] In this embodiment, the position and trajectory of the agricultural product transportation vehicle are monitored in real time through GPS positioning, which not only improves transportation efficiency but also effectively guarantees the quality and safety of agricultural products.

[0043] In one embodiment, SHA256 encryption algorithm is used to hash process the information of each link of agricultural products to prevent information tampering, including: The information of each link of agricultural products is converted into a binary string through the SHA256 encryption algorithm. The binary string is padded to make the length of the binary string meet the preset length. The padded information of each link of agricultural products is divided into blocks, and a fixed constant and a logical function are used to iterate each block to generate the hash value of each block.

[0044] Specifically, through the SHA256 encryption algorithm, the information of each link of agricultural products is first converted into a binary string, and then the binary string is padded, i.e., a "1" bit is added at the end of the string, and then enough "0" bits are added to make the total length meet the condition: Where n is the number of "0" bits added to ensure that the total length is a multiple of 512.

[0045] The filled agricultural product information at each link is divided into blocks, specifically, the filled agricultural product information at each link is divided into multiple 512-bit blocks, each block is processed to generate a 256-bit hash value, then each 512-bit block is further divided into 16 32-bit unsigned numbers, and the blocks are iteratively processed for 64 rounds using specific constants and logical functions (such as right shift, XOR, addition, etc.), and finally a 256-bit hash value is generated.

[0046] In one embodiment, before converting the agricultural product information at each link into a binary string, the SHA256 encryption algorithm is used. Different link information is integrated through a standardized interface to achieve unified standardization of information.

[0047] Specifically, the standardized interface refers to establishing a unified communication protocol and data format between different systems to ensure that different systems can seamlessly interface and exchange data. This interface is usually based on open standards such as RESTful API, SOAP, XML, JSON, etc., which enable systems developed in different platforms and languages to interact through a unified interface. Through the standardized interface, link information of different sources and formats can be integrated.

[0048] In one embodiment, after collecting the agricultural product information at each link through the Internet of Things technology, the following steps are included: Obtain environmental variables and historical yield data of agricultural products, and select the most important features for the prediction task based on the environmental variables and historical yield data of agricultural products using random forest; reduce the number of feature selection using principal component analysis method to obtain the final features; and predict the yield of agricultural products based on the final features.

[0049] Specifically, random forest is an ensemble learning method that can select the most important features for the prediction task by calculating the importance of the features. First, use the collected environmental variables and agricultural product yield data to train a random forest model, where the environmental variables include temperature, precipitation, soil pH, light intensity, etc. The random forest model outputs the importance measure of each feature, with a higher value indicating a higher importance of the feature for the prediction task. According to the feature importance measure, select the top k most important features. After selecting the important features, there may still be many features, in order to further reduce the number of features and reduce the computational complexity, principal component analysis (PCA) method can be used to obtain the final features, where PCA is a dimensionality reduction technique that converts the original features into a set of new orthogonal features (principal components) that can explain most of the variance of the data. Finally, based on the final features, the yield of agricultural products is predicted by the prediction model.

[0050] In this embodiment, feature selection and principal component analysis by random forest can effectively screen out the features that have the greatest impact on the yield of agricultural products, reduce the number of features, and improve the prediction ability and computational efficiency of the model.

[0051] In one embodiment, as shown in Figure 3 An agricultural product traceability device based on the Internet of Things is provided, which comprises an information acquisition module 10, an information encryption module 20, a blockchain generation module 30, a query request receiving module 40, and an information pushing module 50. The information acquisition module 10 is configured to acquire information of each link of agricultural products through Internet of Things technology, wherein the information of each link of agricultural products includes information of production, processing, and transportation links of agricultural products. The information encryption module 20 is configured to perform hash processing on the information of each link of agricultural products through an SHA256 encryption algorithm to prevent information tampering. The blockchain generation module 30 is configured to package the hash-processed information of each link of agricultural products into blocks and link the blocks in time sequence to form a complete blockchain, wherein the blockchain technology adopts a decentralized distributed ledger to enable participants of all links to query information on the blockchain. The query request receiving module 40 is configured to receive a query request sent by a consumer terminal, wherein the query request carries an agricultural product identifier, and the agricultural product identifier is sent by the consumer terminal after identifying two-dimensional code information on the agricultural product. The information pushing module 50 is configured to query the blockchain according to the agricultural product identifier and push corresponding information of each link of the agricultural product to the consumer terminal to realize agricultural product traceability.

[0052] In one embodiment, the information acquisition module 10 is further configured to acquire growth environment information of agricultural products through sensors in the production link of agricultural products, record processing equipment parameters and hygiene condition information to form digital credentials of the processing link in the processing link of agricultural products, and monitor the positions and trajectories of agricultural product transportation vehicles in real time through GPS positioning in the transportation link of agricultural products.

[0053] In one embodiment, the information acquisition module 10 is further configured to set sensor nodes in the growth environment of each agricultural product, each sensor node attempts to establish a connection with a server end to form a connected node set and an unconnected node set, construct a near-coupling rule network model according to the connected node set and the unconnected node set, and construct a small-world network model through multiple local reconnection operations on unconnected nodes, so that each sensor node stably sends growth environment information of agricultural products to the server end through the small-world network model, thereby realizing all-around monitoring of the growth environment of agricultural products.

[0054] In one embodiment, the information collection module 10 is also configured to receive GPS positioning data and integrate the received GPS positioning data into a map service; display the position information of the agricultural product transport vehicle on a map by calling a map API; and update the position information in real time by a timer or an event triggering mechanism to monitor the position and trajectory of the agricultural product transport vehicle in real time.

[0055] In one embodiment, the information encryption module 20 is also configured to convert the information of each link of the agricultural product into a binary string by using a SHA256 encryption algorithm; perform padding processing on the binary string to make the length of the binary string meet a preset length; divide the padded information of each link of the agricultural product into blocks, and use a fixed constant and a logical function to perform iteration processing on each block to generate a hash value of each block.

[0056] In one embodiment, the agricultural product traceability device based on the Internet of Things further comprises a standardization module configured to integrate information of different links through a standardized interface to realize unified standardization of the information.

[0057] In one embodiment, the agricultural product traceability device based on the Internet of Things further comprises a yield prediction module configured to obtain environmental variables and historical yield data of the agricultural product, and select the most important features for a prediction task by using a random forest according to the environmental variables and the historical yield data of the agricultural product; reduce the number of feature selections by using a principal component analysis method to obtain final features; and predict the yield of the agricultural product according to the final features.

[0058] The above-described various modules of the agricultural product traceability device based on the Internet of Things can be all or part realized by software, hardware, or a combination thereof. The above-described various modules can be embedded in or independent of a processor in a computer device in a hardware form, or can be stored in a memory in a computer device in a software form, so as to be called and executed by a processor to perform the operations corresponding to the above-described various modules.

[0059] In one embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in Figure 4 The computer device comprises a processor, a memory, and a network interface connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is configured to store infrared image data. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement an agricultural product traceability method based on the Internet of Things.

[0060] Those skilled in the art can understand, Figure 4 The structure shown in the above is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0061] The above are preferred embodiments of the present application, and do not limit the protection scope of the present application. Therefore, equivalent changes made on the basis of the structure, shape, principle of the present application should be covered within the protection scope of the present application.

Claims

1. A method for tracing agricultural products based on the Internet of Things, characterized in that, include: The Internet of Things (IoT) technology is used to collect information on all aspects of agricultural products, including information on agricultural production, processing, and transportation. The information of each stage of the agricultural product is hashed using the SHA256 encryption algorithm to prevent information tampering. By using blockchain technology, information about each stage of agricultural products after hash processing is packaged into blocks, and these blocks are linked together in chronological order to form a complete blockchain. The blockchain technology uses a decentralized distributed ledger so that all participants in each stage can query the information on the blockchain. The system receives a query request sent by a consumer terminal, the query request carrying an agricultural product identifier, which is sent by the consumer terminal after recognizing the QR code information on the agricultural product; Based on the agricultural product identifier, the blockchain is queried, and relevant information on each stage of the agricultural product is pushed to the consumer terminal to achieve agricultural product traceability.

2. The method for tracing agricultural products based on the Internet of Things according to claim 1, characterized in that, The collection of information on various stages of agricultural products through Internet of Things (IoT) technology includes: In the agricultural production process, sensors are used to collect information about the growing environment of agricultural products; In the agricultural product processing stage, the parameters of processing equipment and hygiene conditions are recorded to form a digital certificate for the processing stage; In the agricultural product transportation process, GPS positioning is used to monitor the location and trajectory of agricultural product transport vehicles in real time.

3. The method for tracing agricultural products based on the Internet of Things according to claim 2, characterized in that, The collection of agricultural product growth environment information via sensors includes: Sensor nodes are set up in the growth environment of each agricultural product. Each sensor node attempts to establish a connection with the server, forming a set of connected nodes and a set of unconnected nodes. Based on the set of connected nodes and the set of unconnected nodes, a proximity coupling rule network model is constructed, and a small-world network model is constructed for the unconnected nodes through multiple local reconnection operations. Through the small-world network model, each sensor node stably sends agricultural product growth environment information to the server, thereby achieving comprehensive monitoring of the agricultural product growth environment.

4. The method for tracing agricultural products based on the Internet of Things according to claim 2, characterized in that, The real-time monitoring of the location and trajectory of agricultural product transport vehicles via GPS positioning includes: Receive GPS positioning data and integrate the received GPS positioning data into the map service; By calling the map API, the location information of agricultural product transport vehicles can be displayed on the map; The location information is updated in real time through a timer or event triggering mechanism to monitor the location and trajectory of agricultural product transport vehicles.

5. The method for tracing agricultural products based on the Internet of Things according to claim 1, characterized in that, The step of hashing the information at each stage of the agricultural product using the SHA256 encryption algorithm to prevent information tampering includes: The information from each stage of the agricultural product process is converted into a binary string using the SHA256 encryption algorithm. The binary string is padded to ensure that its length meets a preset length. The information of each stage of the agricultural product after filling is divided into blocks, and each block is iteratively processed using fixed constants and logical functions to generate a hash value for each block.

6. The method for tracing agricultural products based on the Internet of Things according to claim 5, characterized in that, Before converting the information from each stage of the agricultural product into a binary string using the SHA256 encryption algorithm, the process also includes: By integrating information from different stages through standardized interfaces, information can be unified and standardized.

7. The method for tracing agricultural products based on the Internet of Things according to claim 1, characterized in that, After collecting information on various stages of agricultural products through Internet of Things (IoT) technology, the process also includes: Obtain environmental variables and historical agricultural product output data, and use random forest to select features based on the environmental variables and historical agricultural product output data to filter out the features most important to the prediction task. By combining principal component analysis, the number of feature selections can be reduced, resulting in the final features. Based on the final characteristics, agricultural output is predicted.

8. An agricultural product traceability device based on the Internet of Things, characterized in that, include: The information collection module is used to collect information on various stages of agricultural products through Internet of Things (IoT) technology, including information on agricultural product production, processing, and transportation. The information encryption module is used to hash the information of the agricultural products at each stage using the SHA256 encryption algorithm to prevent information tampering. The blockchain generation module is used to package the hashed information of agricultural products at each stage into blocks using blockchain technology, and to link the blocks sequentially in chronological order to form a complete blockchain. The blockchain technology uses a decentralized distributed ledger so that all participants at each stage can query the information on the blockchain. The query request receiving module is used to receive query requests sent by consumer terminals. The query request carries an agricultural product identifier, which is sent by the consumer terminal after recognizing the QR code information on the agricultural product. The information push module is used to query the blockchain based on the agricultural product identifier and push the corresponding information of each stage of the agricultural product to the consumer terminal to realize the traceability of agricultural products.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Fruit agricultural product traceability method and system based on small world network

    CN105575091A

  • Blockchain-based agricultural product safe and credible traceability system

    CN113240435A

  • Microalgae growth prediction and optimization method and system based on machine learning

    CN119494085A

  • Agricultural product supply chain information tracing method and system

    CN120297999A