Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more apparent, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person skilled in the art without making any inventive step based on the embodiments in the description belong to the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 illustrates an exemplary architecture 100 to which an embodiment of the block chain based raw and fresh product tracing method of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 101, 102, 103 interact with a server 105 via a network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a video application, an instant messenger, a mailbox client, a traffic information application, a reading application, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal apparatuses 101, 102, 103 are hardware, various electronic apparatuses having a display screen and supporting communication with a server may be used. When the terminal apparatuses 101, 102, and 103 are software, they may be software clients installed in the electronic apparatuses. It may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server providing various services, such as a background server providing support for browsing pages on the terminal devices 101, 102, 103. The background server can analyze and process the obtained fresh product information and feed back the information processing result to the terminal equipment.
The server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as multiple pieces of software or software modules (e.g., software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be noted that the fresh product tracing method based on the block chain provided by the embodiments of the present disclosure is generally executed by a server, and accordingly, the fresh product tracing apparatus based on the block chain is generally disposed in the server.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of one embodiment of a blockchain based fresh product tracing method according to the present application is illustrated. The fresh product tracing method based on the block chain is applied to a server. As shown in fig. 2, the fresh product tracing method based on the block chain includes the following steps:
step 201, respectively setting a breeding enterprise, a detection mechanism and a circulation enterprise of fresh products as nodes of a block chain.
The blockchain is used as a decentralized distributed storage technology and has the characteristics of credibility, difficulty in tampering, safety and confidentiality and the like. These characteristics can solve the problem of detecting the authenticity of the certificate well.
In this embodiment, an execution subject (for example, the server 105 shown in fig. 1) of the traceability method of fresh products based on a block chain may deploy a block chain platform based on a block chain frame, then, a breeding enterprise, a detection mechanism, and a circulation enterprise of the fresh products are respectively used as different nodes on the block chain, links from breeding or planting to detection and circulation of the fresh products are all represented on the nodes, data generated by each node may be synchronized to other nodes, and the method has the characteristic of distributed accounting, data tampering of a single node may not actually take effect, and meanwhile, data of each node is guaranteed to be true and reliable, and related data may be traced back through related approaches, thereby protecting reliability and accuracy of data.
Step 202, respectively deploying an intelligent contract at each node of the block chain.
In this embodiment, if the breeding enterprise, the detection mechanism, and the distribution enterprise of the fresh product are respectively set as nodes of the block chain, the execution main body may respectively deploy an intelligent contract at each node of the block chain.
The intelligent contract of the block chain is public, and the intelligent contract is deployed at each node, so that each node can execute the obtained operation instructions through the intelligent contract. Because the intelligent contract can only be changed in an upgrading mode, all the nodes need to be synchronously deployed. Once deployed, the intelligent contracts can be executed only through programs without interference of human factors, and reliability of data is enhanced.
Step 203, obtaining product information of the fresh product, and associating the product information with the intelligent contract.
In this embodiment, the execution main body may obtain the product information of the fresh product in a wired or wireless manner. Specifically, the manufacturer of each link may send information about the fresh product to the execution body from the initial production to the final production to the consumer.
After the execution main body acquires the product information of the fresh product, the product information can be associated with the intelligent contract, so that when each node needs to upload information and link, each node can know through the intelligent contract, and the effect of mutual supervision of each node is achieved.
Here, the product information includes, but is not limited to, quality information, circulation information.
For example, fresh produce may include meat, fruits and vegetables, seafood, and the like. The quality information may include, but is not limited to, cultivation enterprise information of the fresh product, cultivation environment information of the fresh product, and detection information of the fresh product. The information of the breeding enterprises, the breeding environment information and the detection information of the fresh products can be uploaded to the block chain for storage, so that each node and a user can call the nodes and the user in the subsequent inquiry process conveniently.
The distribution information may include, but is not limited to, the production location information of the fresh produce, the logistics enterprise information of the fresh produce, the distribution time information of the fresh produce, and the terminal store information of the fresh produce. These messages can be uploaded to the blockchain for storage, to facilitate subsequent query calls by each node and user.
In some optional implementation manners of this embodiment, the execution main body may further synchronize the product information to each node of the block chain, for example, the product information may be synchronized in a broadcast manner, which is not limited in this embodiment.
And step 204, issuing a quality code matched with the fresh product.
In this embodiment, the execution agent may issue a quality code matching the fresh product. And the product information may be presented by a quality code. The quality code may generally be a character string having uniqueness within a specified range, and for the convenience of user interaction, the quality code may further have a corresponding unique identifier of the digital object, specifically, for example, a two-dimensional code, a barcode, etc., and the user may interact by scanning the code. Taking the two-dimensional code as an example, the user can access the data associated with the two-dimensional code by scanning the two-dimensional code, for example, access a part of product quality data and introduction data associated with the two-dimensional code, or access a web page where the introduction data is located or a web page for registering the product quality data and the introduction data. It should be noted that the quality code may also be information other than a character string, such as a link, an image identification code, and the like.
Step 205, obtaining the traceability information of the fresh product according to the quality code and each node of the block chain.
In this embodiment, the execution body may obtain the traceability information of the fresh product according to the quality code and each node of the block chain.
Specifically, the quality code is usually associated with the fresh product, for example, when a user wants to know information of a fresh product, the quality code may be scanned by a client, and after the execution main body obtains the quality code information, the execution main body may call the product information stored in association from each node in the block chain platform, so as to obtain the traceability information of the fresh product.
For example, the fresh product of the present embodiment is a shrimp product placed in a supermarket, and the package of the fresh product is adhered with a quality code. When the consumer purchases the shrimps, the quality code can be directly scanned by the client or other terminal equipment. After the execution main body obtains the quality code of the shrimp product, the execution main body sends information such as a webpage presenting information of the shrimp product to the client or the terminal equipment, so that a consumer can visually see the information of the whole process from cultivation to detection to sale of the shrimp product, such as information of a cultivation enterprise, a cultivation standard, a logistics company, distribution time, a wholesaler, a terminal shop and the like of the shrimp product, and then whether the shrimp product is purchased or not is determined.
The execution main body can acquire the quality code of the seafood product from a camera or other third-party equipment.
Specifically, in some optional implementation manners of this embodiment, if an inquiry request sent by scanning the quality code is received, the execution main body may inquire, through the intelligent contract, the traceability information of the fresh product matching the quality code from each node of the blockchain.
That is, when a user scans the quality code through a client or other terminal device to send an inquiry request to the execution main body, the execution main body needs to inquire from each node of the block chain through an intelligent contract when calling the product information associated with the quality code.
Compared with the prior art that a consumer can only know the product information of the product through the text information on the product package, so that the authenticity of the information cannot be distinguished, and the safety of the fresh product cannot be guaranteed, the fresh product tracing method based on the block chain can fully collect information about the fresh product in multiple ways, match and clean the information to obtain more reliable fresh product information, is beneficial to obtaining the fresh product information with as many elements as possible and even all elements, is beneficial to realizing the real and objective description of the fresh product, and further provides more reliable information tracing service for the consumer or other demand parties; the fresh product information on the block chain is difficult to tamper, the traceability is strong, and the credibility of the fresh product information is facilitated to be guaranteed, so that consumers or other demand parties can learn the traceability information of the fresh product only through the quality code of the fresh product, for example, the cultivation information, the circulation information and the like of the fresh product, and the fresh product is subjected to whole-network supervision.
With further reference to fig. 3, a flow 300 of another embodiment of a blockchain-based fresh product tracing method is illustrated. The process 300 of the fresh product tracing method based on the block chain is applied to a server and comprises the following steps:
and 301, respectively setting a breeding enterprise, a detection mechanism and a circulation enterprise of the fresh products as nodes of the block chain.
Step 302, respectively deploying an intelligent contract at each node of the block chain.
Step 303, obtaining product information of the fresh product, and associating the product information with the intelligent contract.
Step 304, issuing a quality code matched with the fresh product.
Step 305, obtaining the traceability information of the fresh product according to the quality code and each node of the block chain.
In this embodiment, step 301, step 302, step 303, step 304, and step 305 may be performed in a manner similar to that of step 201, step 202, step 203, step 204, and step 205 in the foregoing embodiment, and the above description about step 201, step 202, step 203, step 204, and step 205 also applies to step 301, step 302, step 303, step 304, and step 305, and is not repeated here.
Step 306, in response to acquiring the change request representing to change the product information, sending the change request to each node of the block chain.
In this embodiment, if a change request indicating that the product information is changed is obtained, the execution main body may send the change request to each node of the blockchain.
When a merchant behind one of the nodes wants to change information, it needs to send a change request to the intelligent contract of the blockchain, and at this time, each node of the blockchain can know the change request, and each node can respond to the change request, for example, send response information indicating whether to accept to receive the change request, and the like.
Step 307, determining whether to receive the change request according to the response information of each node.
In this embodiment, after sending the change request to each node, the execution agent receives response information of each node, and if the response information of half or more nodes indicates that the change request is approved to be received, it indicates that the nodes achieve consensus, that is, a consensus mechanism, at this time, the execution agent may receive the change request, so that the block chain executes information processing corresponding to the change request through the intelligent contract.
Therefore, any node can be prevented from tampering the uplink information arbitrarily, the true reliability of the information is ensured, and the fairness of the block chain platform is also ensured.
In some optional implementation manners of this embodiment, the main execution body of the fresh product tracing method based on the blockchain may obtain feedback information that is uploaded by the user and matches with the fresh product, and then may synchronize the feedback information to each node of the blockchain and associate the feedback information with the intelligent contract. Specifically, for example, for a certain fresh product, after purchasing and consuming the fresh product, the user may upload feedback information such as consumption experience of the fresh product to the blockchain associated with the execution main body, for example, the blockchain may synchronize the feedback information in a spreading manner, or in other manners, which is not limited in this embodiment. Meanwhile, the execution main body can associate the feedback information with the intelligent contract so as to facilitate information calling.
After synchronizing the feedback information to each node of the blockchain, each node can invoke a query for the feedback information. For example, when other third-party users need to know the product information, only the quality code of the fresh product needs to be provided, and each node can call the feedback information of the user who has purchased the fresh product from the block chain to be provided for the third-party users to view so as to provide reference for the third-party users.
Due to the fact that the data of the block chain has public transparency, a consumer can clearly see real detection information provided by the detection mechanism, feedback information of other consumers and the like, and therefore purchasing power of the consumer is stimulated, and safety of the consumer is improved. Moreover, the data of the block chain has non-tamper property, and for information stored in the uplink, such as producers of fresh products, eating experience and the like, the feedback information of the user can improve the integrity of the information.
According to the fresh product tracing method based on the block chain, when any node wants to change information, the execution main body needs to determine whether the information can be changed or not according to the response information of each node, so that the phenomenon that any node arbitrarily tampers the uplink information can be avoided, the true reliability of the information is guaranteed, and the fairness of a block chain platform is also guaranteed.
Referring now to fig. 4, and referring now to fig. 4, a block chain based perishable product sourcing device (e.g., server of fig. 1) 400 suitable for use in implementing embodiments of the present disclosure is illustrated. The processing device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, processing device 400 may include a processing means (e.g., central processing unit, graphics processor, etc.) 401 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage means 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the electronic apparatus 400 are also stored. The processing device 401, the ROM402, and the RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, or the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate wirelessly or by wire with other devices to exchange data. While fig. 4 illustrates an electronic device 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 4 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program, when executed by the processing apparatus 401, performs the above-described functions defined in the methods of embodiments of the present disclosure.
It should be noted that the computer readable medium described in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately and not be assembled into the server. The computer readable medium carries one or more programs which, when executed by the server, cause the server to: respectively setting a breeding enterprise, a detection mechanism and a circulation enterprise of fresh products as nodes of a block chain; respectively deploying intelligent contracts at each node of the block chain; acquiring product information of a fresh product, and associating the product information with an intelligent contract, wherein the product information comprises quality information and circulation information; issuing a quality code matched with the fresh product; and obtaining the traceability information of the fresh product according to the quality code and each node of the block chain.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.