A blockchain-based agricultural product traceability method

By comparing traceability information across multiple nodes in the blockchain network, the problem of misleading agricultural product traceability caused by forged traceability codes is solved, ensuring that users obtain authentic traceability information and improving traceability reliability.

CN115664671BActive Publication Date: 2026-05-19XIAMEN JIHUIYUAN AGRICULTURAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIAMEN JIHUIYUAN AGRICULTURAL TECHNOLOGY CO LTD
Filing Date
2022-10-14
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

When the traceability codes on agricultural product packaging are forged by unscrupulous merchants, users can scan the forged traceability codes with their mobile devices to access the forged traceability information, leading users to mistakenly believe that the agricultural products they are buying are genuine.

Method used

By comparing traceability information with multiple nodes in the blockchain network, the consistency of the returned traceability information is ensured. If they are consistent, the agricultural product is confirmed to be genuine; otherwise, it is indicated as counterfeit.

Benefits of technology

To ensure users obtain authentic agricultural product traceability information, prevent fraudulent activities involving counterfeit traceability codes, and improve the reliability of agricultural product traceability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115664671B_ABST
    Figure CN115664671B_ABST
Patent Text Reader

Abstract

The application discloses a kind of blockchain-based agricultural product traceability methods, belong to blockchain field, in response to scanning to traceability code, broadcast query request to the blockchain network corresponding to traceability code;Query request is used to query the traceability information of agricultural product identified by traceability code;Each node in blockchain network corresponds to one agricultural product flow, and transaction is carried out between every two nodes based on the smart contract corresponding between the two nodes;In the case where the traceability information returned by each of the plurality of nodes in the blockchain network is received, the traceability information returned by each of the plurality of nodes is compared;Each node in the plurality of nodes returns the traceability information requested by the query request in response to receiving the query request;In the case where the comparison result is that the traceability information returned by any two nodes in the plurality of nodes is the same. The method comprises: outputting the traceability information of the agricultural product and prompting the prompt information that the agricultural product is genuine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of blockchain, specifically involving a blockchain-based method for tracing agricultural products. Background Technology

[0002] With the development of science and technology, blockchain technology has been widely applied in daily life. For example, it has been used for agricultural product traceability. This involves building a distributed network where each node corresponds to a specific entity involved in the flow of agricultural products (production, processing, logistics, and sales). Blockchain technology records the flow information of agricultural products within this network. After purchasing agricultural products, users can scan the traceability code on the packaging with their mobile devices to access information on the blockchain, thus tracing the product's origin. However, if the traceability code on the packaging is counterfeited by unscrupulous merchants, scanning it will redirect users to access forged traceability information created to accompany the counterfeit code, misleading them into believing they have purchased genuine agricultural products. Summary of the Invention

[0003] The purpose of this application is to provide a blockchain-based method, device, electronic device, medium, chip, and computer program product for tracing agricultural products. This solution addresses the problem that if the traceability code on agricultural product packaging is forged by illegal merchants, users' mobile terminals can access forged traceability information set up by these merchants to accompany the forged traceability code after scanning it.

[0004] In a first aspect, embodiments of this application provide a blockchain-based method for tracing agricultural products. The method includes: in response to scanning a traceability code, broadcasting a query request to the blockchain network corresponding to the traceability code; the query request is used to query the traceability information of the agricultural product identified by the traceability code; each node in the blockchain network corresponds to an agricultural product distributor, and transactions are conducted between every two nodes based on a smart contract corresponding to the two nodes, the smart contract being generated based on an agricultural product transaction contract signed between the agricultural product distributors corresponding to the two nodes; upon receiving traceability information returned by multiple nodes in the blockchain network, comparing the traceability information returned by the multiple nodes; each of the multiple nodes returns the traceability information requested by the query request in response to receiving the query request; if the comparison result shows that the traceability information returned by any two of the multiple nodes is the same, outputting the traceability information of the agricultural product and a prompt indicating that the agricultural product is genuine.

[0005] In some embodiments, the method further includes: outputting a prompt message indicating that the agricultural product is counterfeit when one of the following situations exists; the situations include: when no traceability information is received; when only traceability information returned by one node is received; when traceability information returned by multiple nodes is received, but the comparison result shows that the traceability information returned by the multiple nodes is not completely the same.

[0006] In some embodiments, after broadcasting a query request to the blockchain network corresponding to the traceability code in response to scanning the traceability code, the method further includes: sending identity authentication information to the node that sent the identity authentication request when receiving an identity authentication request initiated by any node in the blockchain network in response to receiving the query request; the step of comparing the traceability information returned by the multiple nodes in the blockchain network when receiving traceability information returned by the multiple nodes in the blockchain network includes: comparing the traceability information returned by the multiple nodes in the blockchain network after receiving traceability information returned by the multiple nodes after successful authentication based on the identity authentication information.

[0007] In some embodiments, after broadcasting a query request to the blockchain network corresponding to the traceability code in response to scanning the traceability code, the method further includes: performing a liveness detection upon receiving a liveness verification request initiated by any node in the blockchain network in response to receiving the query request; sending the detected information to the node that initiated the liveness verification request upon receiving the detected information; and comparing the traceability information returned by multiple nodes in the blockchain network upon receiving traceability information returned by each node, including: comparing the traceability information returned by multiple nodes in the blockchain network after detecting a liveness based on the detected information.

[0008] In some embodiments, the blockchain network further includes nodes corresponding to supervisory institutions; the step of comparing the traceability information returned by multiple nodes in the blockchain network upon receiving traceability information from each node includes: comparing the second traceability information with the first traceability information upon receiving first traceability information returned by at least one node in the blockchain network and second traceability information returned by the node corresponding to the supervisory institution; the step of outputting the traceability information of the agricultural product and a prompt indicating that the agricultural product is genuine when the comparison result is that the traceability information returned by any two nodes in the multiple nodes is the same includes: outputting the traceability information of the agricultural product and a prompt indicating that the agricultural product is genuine when the comparison result is that the first traceability information and the second traceability information are the same.

[0009] In some embodiments, the method further includes: if no second traceability information is received, or if the second traceability information is received but the comparison result is different between the first traceability information and the second traceability information, outputting a prompt message indicating that the agricultural product is a counterfeit.

[0010] Secondly, embodiments of this application provide a blockchain-based agricultural product traceability device, the device comprising: a first sending module, configured to broadcast a query request to the blockchain network corresponding to the traceability code in response to scanning the traceability code; the query request is used to query the traceability information of the agricultural product identified by the traceability code; each node in the blockchain network corresponds to an agricultural product flow party, and transactions are conducted between every two nodes based on the smart contract corresponding to the two nodes, the smart contract corresponding to the two nodes being generated based on the agricultural product transaction contract signed between the agricultural product flow parties corresponding to the two nodes; a first comparison module, configured to compare the traceability information returned by multiple nodes in the blockchain network when receiving traceability information returned by multiple nodes; each of the multiple nodes returns the traceability information requested by the query request in response to receiving the query request; and a first output module, configured to output the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine when the comparison result is that the traceability information returned by any two of the multiple nodes is the same.

[0011] In some embodiments, the device further includes: a second output module, configured to output a prompt message indicating that the agricultural product is counterfeit when one of the following situations exists: when no traceability information is received; when only traceability information returned by one node is received; when traceability information returned by multiple nodes is received, but the comparison result shows that the traceability information returned by the multiple nodes is not completely the same.

[0012] In some embodiments, the apparatus further includes: a second sending module, configured to send identity authentication information to the node that sent the identity authentication request when receiving an identity authentication request initiated by any node in the blockchain network in response to receiving the query request; and a first comparison module, comprising: a first comparison submodule, configured to compare the traceability information returned by the multiple nodes in the blockchain network after receiving traceability information returned by the multiple nodes respectively after the identity authentication information has been successfully verified.

[0013] In some embodiments, the apparatus further includes: a first detection module, configured to perform liveness detection upon receiving a liveness verification request initiated by any node in the blockchain network in response to receiving the query request; a third sending module, configured to send the detected information to the node that initiated the liveness verification request upon receiving the detected information; the first comparison module further includes: a second comparison submodule, configured to compare the traceability information returned by multiple nodes in the blockchain network after detecting a liveness based on the detected information.

[0014] In some embodiments, the first comparison module includes: a first comparison submodule, configured to compare the second traceability information with the first traceability information when receiving first traceability information returned by at least one node in the blockchain network and second traceability information returned by a node corresponding to the supervisory agency; the first output module includes: a first output submodule, configured to output the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine when the comparison result is the same as the first traceability information and the second traceability information.

[0015] In some embodiments, the device further includes a second output submodule, configured to output a prompt message indicating that the agricultural product is counterfeit if the second traceability information is not received or if the second traceability information is received but the comparison result is different between the first traceability information and the second traceability information.

[0016] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0017] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0018] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0019] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0020] In this embodiment, after scanning the traceability code, the user's mobile terminal broadcasts a query request to the blockchain network. Nodes corresponding to various agricultural product distribution points on the blockchain website may receive this query request and return their locally stored blockchain agricultural product distribution information to the mobile terminal. The blockchain agricultural product distribution information stored by each node (i.e., traceability information, which is constructed based on the blockchain, and the traceability information stored in each node should be completely identical) is used to verify the authenticity of the agricultural product. This mutual verification between the multiple traceability information returned by multiple nodes ensures that the user obtains genuine traceability information for the agricultural product. Attached Figure Description

[0021] Figure 1 A flowchart of a blockchain-based agricultural product traceability method provided in an embodiment of this application is illustrated by way of example;

[0022] Figure 2 An exemplary embodiment of this application illustrates a blockchain-based agricultural product traceability device;

[0023] Figure 3 An embodiment of this application also provides an electronic device, which is illustrated schematically.

[0024] Figure 4 The hardware structure of an electronic device according to an embodiment of this application is illustrated schematically. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0026] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first image can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0027] The image segmentation method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0028] like Figure 1 The diagram illustrates an exemplary flowchart of a blockchain-based agricultural product traceability method provided in an embodiment of this application. Please refer to [link / reference]. Figure 1 The image segmentation method includes the following steps S101-S103:

[0029] S101, in response to scanning the traceability code, broadcast a query request to the blockchain network corresponding to the traceability code.

[0030] The query request is used to query the traceability information of the agricultural product identified by the traceability code; each node in the blockchain network corresponds to an agricultural product flow party, and transactions are conducted between every two nodes based on the smart contract between the two nodes. The smart contract between the two nodes is generated based on the agricultural product transaction contract signed between the agricultural product flow parties corresponding to the two nodes.

[0031] In this embodiment, a blockchain network is pre-constructed, where each node corresponds to an agricultural product flow link. These flow links include at least: agricultural product producers, processors, sellers, logistics providers, and third-party regulators. Transactions between any two nodes are based on a smart contract. For example, when an agricultural product producer delivers its produce, it adds production information to its own node, forming a first data block. This first block is backed up to all nodes in the blockchain network according to a consensus mechanism. When the producer trades the produce to a processor, the processor's corresponding node generates the product's origin information (a second data block) according to the smart contract. This second data block is then connected to the first data block, forming a blockchain. This blockchain is also backed up to all nodes in the blockchain network according to a consensus mechanism. This process continues, adding data blocks at each flow link until the agricultural product finally reaches the user (seller).

[0032] After purchasing agricultural products, users can use a mobile device (such as a smartphone) to scan the traceability code on the product packaging. This allows the mobile device to broadcast a query request to the aforementioned blockchain network. The mobile device itself can send the query request to each node in the blockchain network, achieving the broadcast effect. Alternatively, any node in the blockchain network can receive the query request and send it to its neighboring nodes, which in turn send the request to their adjacent nodes, until the query request has spread throughout the entire blockchain network.

[0033] S102, upon receiving traceability information returned by multiple nodes in the blockchain network, the traceability information returned by the multiple nodes is compared; each of the multiple nodes returns the traceability information requested by the query request in response to receiving the query request.

[0034] All nodes in the blockchain network that receive a query request return the traceability information stored locally in blockchain form to the mobile terminal.

[0035] S103, if the comparison result shows that the traceability information returned by any two nodes among the plurality of nodes is the same, output the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine.

[0036] In this embodiment, after scanning the traceability code, the user's mobile terminal broadcasts a query request to the blockchain network. Nodes corresponding to various agricultural product distribution points on the blockchain website may receive this query request and return their locally stored blockchain agricultural product distribution information to the mobile terminal. The blockchain agricultural product distribution information stored by each node (i.e., traceability information, which is constructed based on the blockchain, and the traceability information stored in each node should be completely identical) is used to verify the authenticity of the agricultural product. This mutual verification between the multiple traceability information returned by multiple nodes ensures that the user obtains genuine traceability information for the agricultural product.

[0037] In some optional implementations, the method further includes:

[0038] The agricultural product is identified as counterfeit if any of the following conditions are met:

[0039] In the absence of traceability information;

[0040] In the case where only one node returns the source information;

[0041] The system receives traceability information returned by multiple nodes, but the comparison results show that the traceability information returned by the multiple nodes is not completely the same.

[0042] If a mobile terminal scans a traceability code but does not receive traceability information, or only receives traceability information returned by one node, or receives traceability information returned by multiple nodes but the comparison results show that the traceability information returned by the multiple nodes is not completely the same, it indicates that the traceability code scanned by the user's mobile terminal is likely a counterfeit traceability code by an illegal merchant. Either the user cannot access the traceability information correctly, or the user is redirected to access counterfeit traceability information on an illegal network. Illegal merchants usually do not have a complete blockchain network (i.e., a blockchain network with an overall architecture built on the entire industrial chain of agricultural product circulation), making it difficult to back up the same traceability information on multiple nodes.

[0043] In some optional implementations, after broadcasting a query request to the blockchain network corresponding to the traceability code in response to scanning the traceability code, the method further includes: sending identity authentication information to the node that sent the identity authentication request when receiving an identity authentication request initiated by any node in the blockchain network in response to receiving the query request; the step of comparing the traceability information returned by multiple nodes in the blockchain network when receiving traceability information returned by multiple nodes in the blockchain network includes: comparing the traceability information returned by multiple nodes in the blockchain network after they have been authenticated successfully based on the identity authentication information.

[0044] In this embodiment, after the mobile terminal scans the traceability code, it initiates a query request to a node in the blockchain network. Any node in the blockchain website responds to the query request and initiates an identity verification process to the mobile terminal. After the user passes the identity verification, the traceability information is returned to the mobile terminal, thereby preventing unscrupulous merchants from launching attacks on the blockchain network using the traceability code.

[0045] In some optional implementations, after broadcasting a query request to the blockchain network corresponding to the traceability code in response to scanning the traceability code, the method further includes: performing a liveness detection upon receiving a liveness verification request initiated by any node in the blockchain network in response to receiving the query request; sending the detected information to the node that initiated the liveness verification request upon receiving the detected information; and comparing the traceability information returned by multiple nodes in the blockchain network upon receiving traceability information from each node, including: comparing the traceability information returned by multiple nodes in the blockchain network after detecting a liveness based on the detected information.

[0046] In this embodiment, after the mobile terminal scans the traceability code, it initiates a query request to a node in the blockchain network. Any node in the blockchain website responds to the query request and initiates a liveness detection process to the mobile terminal. After the user passes the liveness detection, the traceability information is returned to the mobile terminal, thereby preventing criminals from launching web crawler attacks on the blockchain network using the traceability code.

[0047] Based on the above embodiments, the blockchain network may further include nodes corresponding to supervisory agencies. Therefore, this application provides a blockchain-based method for tracing agricultural products, which further includes the following steps:

[0048] Upon receiving first traceability information returned by at least one node in the blockchain network and second traceability information returned by the node corresponding to the supervisory body, the second traceability information is compared with the first traceability information;

[0049] If the comparison result is the same for the first traceability information and the second traceability information, the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine are output.

[0050] If no second traceability information is received, or if the second traceability information is received but the comparison result is different from the first traceability information and the second traceability information, a prompt message indicating that the agricultural product is a counterfeit will be output.

[0051] The supervisory body can be a third-party market regulatory agency independent of users and agricultural product producers and processors (i.e., agricultural product distributors). This agency oversees the agricultural product distributors to ensure the quality of their production and processing. When agricultural product distributors engage in production and processing, and transactions with upstream and downstream nodes, they need to synchronize agricultural product production and processing information to the supervisory body. This means that the supervisory body's corresponding node also stores the blockchain traceability information for the agricultural product.

[0052] When consumers (users) purchase agricultural products, they scan the traceability code with their mobile devices and request the blockchain network to return traceability information. If they receive first traceability information from at least one node corresponding to the agricultural product's origin and second traceability information from a node corresponding to a supervisory agency within the blockchain network, they compare the second traceability information with the first. If the comparison result shows that the first and second traceability information are the same, the traceability information of the agricultural product is output along with a message indicating that the agricultural product is genuine. If no second traceability information is received, or if the second traceability information is received but the comparison result shows that the first and second traceability information are different, a message indicating that the agricultural product is counterfeit is output. By introducing further verification from traceability information from a third-party supervisory agency, the authenticity of agricultural product traceability information is further improved.

[0053] The blockchain-based agricultural product traceability method provided in this application can be implemented by a blockchain-based agricultural product traceability device. This application uses an example of a blockchain-based agricultural product traceability device executing the blockchain-based agricultural product traceability method to illustrate the device provided in this application.

[0054] like Figure 2 As shown, an embodiment of this application schematically illustrates a blockchain-based agricultural product traceability system 200, comprising:

[0055] The first sending module 201 is used to broadcast a query request to the blockchain network corresponding to the traceability code in response to scanning the traceability code; the query request is used to query the traceability information of the agricultural product identified by the traceability code; each node in the blockchain network corresponds to an agricultural product flow party, and transactions are conducted between every two nodes based on the smart contract corresponding to the two nodes, and the smart contract corresponding to the two nodes is generated based on the agricultural product transaction contract signed between the agricultural product flow parties corresponding to the two nodes respectively;

[0056] The first comparison module 202 is used to compare the traceability information returned by each of the multiple nodes in the blockchain network when receiving traceability information returned by each of the multiple nodes; each of the multiple nodes returns the traceability information requested by the query request in response to receiving the query request.

[0057] The first output module 203 is used to output the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine when the comparison result is that the traceability information returned by any two nodes among the plurality of nodes is the same.

[0058] In some alternative embodiments, the apparatus further includes:

[0059] The second output module is used to output a prompt message indicating that the agricultural product is counterfeit if one of the following conditions exists;

[0060] The situations mentioned include:

[0061] In the absence of traceability information;

[0062] In the case where only one node returns the source information;

[0063] The system receives traceability information returned by multiple nodes, but the comparison results show that the traceability information returned by the multiple nodes is not completely the same.

[0064] In some alternative embodiments, the apparatus further includes:

[0065] The second sending module is used to send identity authentication information to the node that sent the identity authentication request when it receives an identity authentication request initiated by any node in the blockchain network in response to receiving the query request.

[0066] The first comparison module includes:

[0067] The first comparison submodule is used to compare the traceability information returned by multiple nodes in the blockchain network after they have been authenticated based on the identity authentication information.

[0068] In some alternative embodiments, the apparatus further includes:

[0069] The first detection module is used to perform liveness detection when it receives a liveness verification request initiated by any node in the blockchain network in response to receiving the query request.

[0070] The third sending module is used to send the tested information to the node that initiated the liveness verification request after receiving the tested information;

[0071] The first comparison module further includes:

[0072] The second comparison submodule is used to compare the traceability information returned by multiple nodes in the blockchain network after they have detected the subject as a live entity based on the inspected information.

[0073] In some optional implementations, the first comparison module includes:

[0074] The first comparison submodule is used to compare the second traceability information with the first traceability information when it receives first traceability information returned by at least one node in the blockchain network and second traceability information returned by the node corresponding to the supervisory agency.

[0075] The first output module includes:

[0076] The first output submodule is used to output the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine when the comparison result is the same as the first traceability information and the second traceability information.

[0077] In some alternative embodiments, the apparatus further includes:

[0078] The second output submodule is used to output a prompt message indicating that the agricultural product is counterfeit if the second traceability information is not received or if the second traceability information is received but the comparison result is different between the first traceability information and the second traceability information.

[0079] The blockchain-based agricultural product traceability device in this application embodiment can be an electronic device or a component of an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0080] The image segmentation device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.

[0081] The blockchain-based agricultural product traceability device provided in this application embodiment can achieve... Figure 1 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0082] Optionally, such as Figure 3 As shown, this application embodiment also provides an electronic device 300, including a processor 301 and a memory 302. The memory 302 stores a program or instructions that can run on the processor 301. When the program or instructions are executed by the processor 301, they implement the various steps of the above-described image segmentation method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0083] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0084] Figure 4 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0085] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.

[0086] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. 4 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0087] The processor 110 is used to execute the following steps of the method:

[0088] In response to scanning a traceability code, a query request is broadcast to the blockchain network corresponding to the traceability code; the query request is used to query the traceability information of the agricultural product identified by the traceability code; each node in the blockchain network corresponds to an agricultural product flow party, and transactions are conducted between every two nodes based on the smart contract corresponding to the two nodes, and the smart contract corresponding to the two nodes is generated based on the agricultural product transaction contract signed between the agricultural product flow parties corresponding to the two nodes respectively;

[0089] Upon receiving traceability information returned by multiple nodes in the blockchain network, the traceability information returned by the multiple nodes is compared; each of the multiple nodes returns the traceability information requested by the query request in response to receiving the query request.

[0090] If the comparison result shows that the traceability information returned by any two nodes among the multiple nodes is the same, the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine will be output.

[0091] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0092] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or it may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0093] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.

[0094] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image segmentation method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0095] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0096] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image segmentation method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0097] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0098] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the image segmentation method embodiments described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0099] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0100] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0101] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A blockchain-based method for tracing the origin of agricultural products, characterized in that, The method includes: In response to scanning a traceability code, a query request is broadcast to the blockchain network corresponding to the traceability code; the query request is used to query the traceability information of the agricultural product identified by the traceability code; each node in the blockchain network corresponds to an agricultural product flow party, and transactions are conducted between every two nodes based on the smart contract corresponding to the two nodes, and the smart contract corresponding to the two nodes is generated based on the agricultural product transaction contract signed between the agricultural product flow parties corresponding to the two nodes respectively; Upon receiving traceability information returned by multiple nodes in the blockchain network, the traceability information returned by the multiple nodes is compared; each of the multiple nodes returns the traceability information requested by the query request in response to receiving the query request. If the comparison result shows that the traceability information returned by any two nodes among the multiple nodes is the same, the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine will be output.

2. The method according to claim 1, characterized in that, The method further includes: If any of the following conditions exist, output a message indicating that the agricultural product is counterfeit; The situations mentioned include: In the absence of traceability information; In the case where only one node returns the source information; The system receives traceability information returned by multiple nodes, but the comparison results show that the traceability information returned by the multiple nodes is not completely the same.

3. The method according to claim 1, characterized in that, After responding to the scanning of the traceability code and broadcasting a query request to the blockchain network corresponding to the traceability code, the method further includes: Upon receiving an identity authentication request initiated by any node in the blockchain network in response to receiving the query request, identity authentication information is sent to the node that sent the identity authentication request; Upon receiving traceability information returned by multiple nodes in the blockchain network, the step of comparing the traceability information returned by each of the multiple nodes includes: Upon receiving traceability information returned by multiple nodes in the blockchain network after successful authentication based on the identity authentication information, the traceability information returned by each of the multiple nodes is compared.

4. The method according to claim 1, characterized in that, After responding to the scanning of the traceability code and broadcasting a query request to the blockchain network corresponding to the traceability code, the method further includes: Upon receiving a liveness verification request initiated by any node in the blockchain network in response to the query request, a liveness detection is performed. Upon receiving the inspection information, the inspection information is sent to the node that initiated the liveness verification request; Upon receiving traceability information returned by multiple nodes in the blockchain network, the step of comparing the traceability information returned by each of the multiple nodes includes: Upon receiving traceability information returned by multiple nodes in the blockchain network after detecting a living individual based on the inspected information, the traceability information returned by each of the multiple nodes is compared.

5. The method according to any one of claims 1 to 4, characterized in that, The blockchain network also includes nodes corresponding to supervisory bodies; Upon receiving traceability information returned by multiple nodes in the blockchain network, the step of comparing the traceability information returned by each of the multiple nodes includes: Upon receiving first traceability information returned by at least one node in the blockchain network and second traceability information returned by the node corresponding to the supervisory body, the second traceability information is compared with the first traceability information; When the comparison result shows that the traceability information returned by any two nodes among the plurality of nodes is the same, the traceability information of the agricultural product and a prompt indicating that the agricultural product is genuine are output, including: If the comparison result shows that the first traceability information and the second traceability information are the same, the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine are output.

6. The method according to claim 5, characterized in that, The method further includes: If no second traceability information is received, or if the second traceability information is received but the comparison result is different from the first traceability information and the second traceability information, a prompt message indicating that the agricultural product is a counterfeit will be output.

7. A blockchain-based agricultural product traceability device, characterized in that, The device includes: The first sending module is used to broadcast a query request to the blockchain network corresponding to the traceability code in response to scanning the traceability code; the query request is used to query the traceability information of the agricultural product identified by the traceability code; each node in the blockchain network corresponds to an agricultural product flow party, and transactions are conducted between every two nodes based on the smart contract corresponding to the two nodes, and the smart contract corresponding to the two nodes is generated based on the agricultural product transaction contract signed between the agricultural product flow parties corresponding to the two nodes respectively; The first comparison module is used to compare the traceability information returned by each of the multiple nodes in the blockchain network when receiving traceability information returned by each of the multiple nodes; each of the multiple nodes returns the traceability information requested by the query request in response to receiving the query request. The first output module is used to output the traceability information of the agricultural product and a prompt message indicating that the agricultural product is genuine when the comparison result shows that the traceability information returned by any two nodes among the plurality of nodes is the same.

8. The apparatus according to claim 7, characterized in that, The device further includes: The second output module is used to output a prompt message indicating that the agricultural product is counterfeit if one of the following conditions exists; The situations mentioned include: In the absence of traceability information; In the case where only one node returns the source information; The system receives traceability information returned by multiple nodes, but the comparison results show that the traceability information returned by the multiple nodes is not completely the same.

9. The apparatus according to claim 7, characterized in that, The device further includes: The second sending module is used to send identity authentication information to the node that sent the identity authentication request when it receives an identity authentication request initiated by any node in the blockchain network in response to receiving the query request. The first comparison module includes: The first comparison submodule is used to compare the traceability information returned by multiple nodes in the blockchain network after they have been authenticated based on the identity authentication information.

10. The apparatus according to claim 7, characterized in that, The device further includes: The first detection module is used to perform liveness detection when it receives a liveness verification request initiated by any node in the blockchain network in response to receiving the query request. The third sending module is used to send the tested information to the node that initiated the liveness verification request after receiving the tested information; The first comparison module further includes: The second comparison submodule is used to compare the traceability information returned by multiple nodes in the blockchain network after they have detected the subject as a live entity based on the inspected information.