CN114254374A - Data tracing method and system - Google Patents

Data tracing method and system Download PDF

Info

Publication number
CN114254374A
CN114254374A CN202210189506.6A CN202210189506A CN114254374A CN 114254374 A CN114254374 A CN 114254374A CN 202210189506 A CN202210189506 A CN 202210189506A CN 114254374 A CN114254374 A CN 114254374A
Authority
CN
China
Prior art keywords
tracing
chain
data
traceability
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210189506.6A
Other languages
Chinese (zh)
Other versions
CN114254374B (en
Inventor
孙传恒
罗潜
罗娜
徐大明
邢斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Research Center of Information Technology of Beijing Academy of Agriculture and Forestry Sciences
Original Assignee
Research Center of Information Technology of Beijing Academy of Agriculture and Forestry Sciences
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Research Center of Information Technology of Beijing Academy of Agriculture and Forestry Sciences filed Critical Research Center of Information Technology of Beijing Academy of Agriculture and Forestry Sciences
Priority to CN202210189506.6A priority Critical patent/CN114254374B/en
Publication of CN114254374A publication Critical patent/CN114254374A/en
Application granted granted Critical
Publication of CN114254374B publication Critical patent/CN114254374B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/018Certifying business or products
    • G06Q30/0185Product, service or business identity fraud
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The invention provides a data tracing method and a system, wherein the method comprises the following steps: based on the traceability codes of all stages of the agricultural products acquired by consumers, inquiring a federation chain to acquire public traceability information of all stages of the agricultural products; and inquiring the alliance chain to acquire the public traceability information and inquiring the private chain to acquire the private privacy information of each stage of the agricultural product based on the Key value updated on the supervision chain acquired by the supervisor. The system performs the method. The invention realizes multi-chain data storage through the alliance chain technology, organically combines a traceability system and data supervision, realizes the public sharing of traceability data, the acquisition of private data and the real-time supervision, takes traceability codes as indexes and unique identifiers, realizes consumption traceability and supervision traceability and ensures barrier-free information interaction among consumers, supervisors and enterprises.

Description

Data tracing method and system
Technical Field
The invention relates to the technical field of data processing, in particular to a data tracing method and system.
Background
The agricultural product supply and demand network relates to a plurality of stages of production, storage, processing, transportation, sale, eating and the like, the agricultural product supply and demand network is planted from a production source to the eating of a final consumer, the agricultural product supply and demand network has the characteristics of long and complicated supply chain, more and scattered main bodies and wide and extensive region span, and the broken chain of any link can cause information disjointing, so that the difficulty of responsibility pursuit and government supervision is increased. The block chain is a chain type storage structure which is commonly maintained by multiple parties, the safety of transmission and access is guaranteed through cryptography, the block chain has the characteristics of difficulty in data tampering, openness and transparency of information, forward consistent storage, reverse traceability and the like, the block chain technology is embedded into an agricultural product supply and demand network, the bottom layer technical advantages of the block chain and the organization structure advantages of a supply chain can be fully exerted, and a comprehensive, multi-dimensional and high-transparency traceability mechanism from farmland to dining tables is realized.
The block chain technology realizes landing application in many fields, and achieves certain effect in the exploration of agricultural product traceability systems. However, the coding method, the tracing system and the data supervision in the existing tracing system often run independently, enterprises fight each other, information intercommunication interconnection is lacked, coding is inconsistent, and data is opaque, so that the tracing system is not standard, upstream and downstream data are incompatible, and an 'information island' is formed, which causes tracing difficulty. Once an enterprise joins the tracing network, a supervision system is difficult to realize fine-grained management and control, data on a chain cannot be effectively supervised, once a safety responsibility accident occurs, responsibility accurate positioning and product accurate tracing are difficult to perform, a problem product is recalled in time, and real-time supervision on a supply network cannot be achieved. Therefore, breaking the information barrier and making the various modules of the supply network form a good interaction is urgent. The existing research on the information intercommunication and interconnection is relatively deficient, and the tracing information control mainly comprises the following two schemes:
one scheme is that source data is stored in a down-link mode, a plaintext information abstract chain is stored in a certificate, authenticity of data is verified through cooperation of the up-link and the down-link, storage capacity is increased, however, if the down-link data is tampered, the data is difficult to recover, the risk of real data loss exists, on the other hand, all product information is uploaded to a block chain by an enterprise, and privacy information is easy to leak; the code and the data storage run independently, and illegal modification, cracking or batch counterfeiting of the tracing code inside or outside can cause chain breakage between upstream and downstream enterprises.
The other scheme is that the plaintext of public data is uploaded to a public traceability chain, private data is uploaded to an enterprise private chain in an encrypted mode and authorized to be shared, so that the capacity of a block chain can be increased, the data on the chain cannot be tampered, when a safety liability accident occurs to a product, a supervision department can determine a problem link through traceability private data, but cannot achieve penetrating whole-course supervision, and real-time full-coverage monitoring is achieved.
Disclosure of Invention
The data tracing method and system provided by the invention are used for solving at least one problem in the prior art, multi-chain data storage is realized through a alliance chain technology, a tracing system and data supervision are organically combined, public sharing of tracing data, private data acquisition and real-time supervision are realized, a tracing code is used as an index and a unique identifier, consumption tracing and supervision tracing are realized, and barrier-free information interaction among consumers, supervisors and enterprises is realized.
The invention provides a data tracing method, which comprises the following steps:
based on the traceability codes of all stages of the agricultural products acquired by consumers, inquiring a federation chain to acquire public traceability information of all stages of the agricultural products;
inquiring the alliance chain to acquire the public traceability information and inquiring the private chain to acquire the private privacy information of each stage of the agricultural product based on the Key value updated on the supervision chain acquired by the supervisor;
wherein the Key value is determined by writing the traceable code to the chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
According to the data tracing method provided by the invention, the federation chain is inquired to obtain the public tracing information based on the tracing code of each stage of the agricultural product obtained by the consumer, and the method comprises the following steps:
acquiring the tracing code based on the two-dimension code scanned by the consumer;
calling a tracing contract based on the tracing code, and querying the alliance chain to obtain the public tracing information;
and the two-dimensional code is generated according to the tracing code.
According to the data tracing method provided by the invention, the querying the federation chain to obtain the public tracing information and the querying the private chain to obtain the private privacy information of each stage of the agricultural product based on the Key value updated on the supervision chain obtained by the supervisor comprises the following steps:
acquiring the tracing code based on the Key value;
calling a tracing contract based on the tracing code, and querying the alliance chain to obtain the public tracing information;
and calling a cross-link contract based on the tracing code, and inquiring the private chain to obtain the private privacy information.
According to the data tracing method provided by the invention, the tracing code is obtained by the following method:
and coding the public traceability information and the private privacy information according to a global trade item code to obtain the traceability codes.
The data tracing method provided by the invention further comprises the following steps:
judging whether the data content and the format of the enterprise traceability data meet the chaining requirement or not through a data normalization intelligent contract;
writing the public traceability information in the enterprise traceability data meeting the uplink requirement into the alliance chain;
writing the private privacy information in the enterprise tracing data meeting the uplink requirement into the private chain.
According to a data tracing method provided by the present invention, the writing of the private privacy information in the enterprise tracing data satisfying the uplink requirement into the private chain includes:
and after encrypting the private privacy information in the enterprise tracing data meeting the uplink requirement, writing the private privacy information into the private chain.
According to the data tracing method provided by the invention, each stage of the agricultural product at least comprises the following steps:
production, processing, storage, transportation, and distribution.
The invention also provides a data tracing system, comprising: the source tracing system comprises a first source tracing module and a second source tracing module;
the first traceability module is used for inquiring a alliance chain to obtain public traceability information of each stage of the agricultural product based on traceability codes of each stage of the agricultural product obtained by a consumer;
the second traceability module is used for inquiring the alliance chain to obtain the public traceability information and inquiring the private chain to obtain the private privacy information of each stage of the agricultural product based on the Key value updated on the supervision chain obtained by the supervisor;
wherein the Key value is determined by writing the traceable code to the chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein when the processor executes the program, the data tracing method is realized according to any one of the above methods.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a data tracing method as described in any of the above.
The data tracing method and the system realize multi-chain data storage through the alliance chain technology, organically combine a tracing system and data supervision, realize the public sharing of tracing data, the acquisition of private data and the real-time supervision, use tracing codes as indexes and unique identifiers, realize consumption tracing and supervision tracing, and enable barrier-free information interaction among consumers, supervisors and enterprises.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a data tracing method provided by the present invention;
FIG. 2 is a schematic diagram of a multi-chain model provided by the present invention;
FIG. 3 is a schematic diagram of a code chain fusion tracing process provided by the present invention;
FIG. 4 is a schematic diagram of a traceability model of agricultural products provided by the present invention;
FIG. 5 is a schematic structural diagram of a data tracing system provided by the present invention;
fig. 6 is a schematic physical structure diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow chart of a data tracing method provided by the present invention, and as shown in fig. 1, the method includes:
s1, inquiring the alliance chain to obtain the public traceability information of each stage of the agricultural product based on the traceability codes obtained by the consumers;
s2, inquiring the alliance chain to obtain public traceability information and inquiring the private chain to obtain private privacy information of each stage of the agricultural product based on the Key value updated on the supervision chain obtained by the supervisor;
the Key value is determined by writing tracing codes into a chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
Further, in one embodiment, the stages of the agricultural product include at least:
production, processing, storage, transportation, and distribution.
It should be noted that the execution subject of the method may be a computer device.
Optionally, in order to solve the problem of block chain data storage pressure caused by massive data and privacy disclosure caused by uploading all product information to a block chain network in the conventional traceability system, the present invention uses multiple chains as a system model, as shown in fig. 2. The method comprises the steps of establishing a private chain for each stage of agricultural products for the five supply chain stages of agricultural product production, processing, storage, transportation and distribution, wherein the private chain is used for storing private privacy information in enterprise traceability data; an enterprise tracing node, a supervision node and a consumer node establish a alliance chain for storing public tracing information of each stage of agricultural products; the public traceability information can be determined according to enterprise traceability data provided by enterprises involved in various stages of agricultural products.
For example, the enterprise traceability data may specifically include production data provided by a production enterprise, processing data provided by a processing enterprise, warehousing data provided by a warehousing enterprise, logistics data provided by a transportation enterprise, and distribution data provided by a distribution enterprise.
After the production data passes the examination of the production data by the contract before the production data chain, calling a production data chaining contract, storing public traceability information in the production data into a alliance chain, and storing private privacy information in the production data into a private chain (such as a production chain) built for the production stage of agricultural products; after the processed data passes the examination of the processed data through a contract before the processed data chain, calling a processed data chaining contract, storing public traceability information in the processed data into a alliance chain, and storing private privacy information in the processed data into a private chain (such as a processing chain) set up for the agricultural product processing stage; after the warehousing data passes the examination of the pre-warehousing data chain contract, calling a warehousing data chaining contract, storing public traceability information in the warehousing data into a alliance chain, and storing private privacy information in the warehousing data into a private chain (such as a warehousing chain) built for the production stage of agricultural products; after the logistics data passes the check of the logistics data pre-chain contract, calling a logistics data chaining contract, storing public traceability information in the logistics data into a alliance chain, and storing private privacy information in the logistics data into a private chain (such as a logistics chain) built for an agricultural product transportation stage; and after the distribution data passes the examination of the distribution data through a pre-distribution data chain contract, calling a distribution data chaining contract, storing the public traceability information in the distribution data into a alliance chain, and storing the private privacy information in the distribution data into a private chain (such as a distribution chain) built for the agricultural product production stage.
Obtaining a traceability code according to the public traceability information and the private privacy information, and then inquiring the alliance chain based on the traceability code obtained by the consumer to obtain the public traceability information of each stage of the agricultural product stored on the alliance chain;
inquiring a alliance chain to acquire public traceability information based on a Key value updated on a supervision chain acquired by a supervisor, and inquiring a private chain (comprising a production chain, a processing chain, a storage chain, a logistics chain and a distribution chain) of each stage of the agricultural product to acquire private privacy information of each stage of the agricultural product.
Tracing codes are used as tracing Key values of Key value pairs on alliance chains at each stage, each node updates a state index database in a Key value pair (Key-value) mode, establishes and writes a supervision chain (namely, the Key values are used as indexes of public tracing information and private privacy information for storage), and meanwhile, returned transaction hash and block height are stored in the state index database, and the tracing data are inquired through the block height or transaction hash index to further reduce the inquiry time; the encoding method, the tracing system and the data supervision are organically combined, public sharing of public tracing information is achieved, private privacy information is authorized to be obtained, penetrating type, full coverage and real-time supervision are achieved, the tracing code serves as an index and a unique identifier, and consumption tracing and supervision tracing are achieved.
The data tracing method provided by the invention realizes multi-chain data storage through the alliance chain technology, organically combines a tracing system and data supervision, realizes the public sharing of tracing data, the acquisition of private data and real-time supervision, uses a tracing code as an index and a unique identifier, realizes consumption tracing and supervision tracing, and enables barrier-free information interaction among consumers, supervisors and enterprises.
Further, in an embodiment, the step S1 may specifically include:
s11, obtaining a source tracing code based on the two-dimension code scanned by the consumer;
s12, calling a tracing contract based on the tracing code, and inquiring a alliance chain to obtain public tracing information;
the two-dimensional code is generated according to the tracing code.
Further, in one embodiment, the tracing code is obtained by:
and coding the public traceability information and the private privacy information according to the global trade item code to obtain the traceability codes.
Optionally, as shown in table 1, the tracing information is distributed in different stages of the agricultural product, the consumer scans the final two-dimensional code to obtain the tracing code of each stage of the agricultural product, the tracing code of each different stage is established for production, processing, warehousing, transportation and distribution based on batches, and in order to achieve the universality of the tracing code of each stage of the agricultural product, the coding design is performed on each different stage of the agricultural product based on a 14-bit global trade item code (GTIN-14) issued by GS1 (Globe standard 1).
TABLE 1
Figure 606450DEST_PATH_IMAGE001
Taking the production stage code as an example, as shown in table 2, the production stage tracing code = AI (01) + stage identifier + manufacturer identifier + item code + check digit + AI (10) + field number + planting date + harvest date + AI (99) + responsible person code; in the planting process, agricultural products are numbered in batches according to field units. For example, the seeds are sown in the 006 field 2021 at 2-25 months, harvested at 10-12 months, and taken by human 056, the production stage code is (01) 169902591101029 (10) 006210225211012 (91) 056.
TABLE 2
Figure 327893DEST_PATH_IMAGE002
Such as the agricultural product code structure above. The detailed description is as follows:
AI (01): an application identifier, indicating a 14-bit GTIN following;
n1 (1-5): for identifying a stage of the agricultural product. (1 for the production phase, 5 for the distribution phase);
N2-N4 (690-695): a prefix code assigned by the International Commission for goods;
N5-N8 (vendor identification code): the article coding center is responsible for distributing manufacturer identification codes;
N9-N13 (commercial item code): identifying an item, for example a mini cucumber item with 01101;
n14 (9): checking a bit;
AI (10): an application identifier indicating a certain batch of products to follow;
A1-A15 (different agricultural products): the different states of the agricultural products in the same stage are distinguished. For example, product at the production stage is distinguished by field number + planting date + receiving date; the container number, the product split number and the shelf-loading time are used for distinguishing different agricultural products of the same type in the distribution stage;
AI (91): the application identifier 91-99 represents coding information inside an enterprise, and 91 is uniformly used as a responsible person;
A16-A18 (056): the number of the responsible person can be specifically positioned to the responsible person for a certain agricultural product.
The traceability code is used as a core and a foundation of agricultural product traceability and has a critical effect on the construction of an agricultural product traceability system. The agricultural product code chain fusion traceability model based on the block chain multi-chain can solve the problem of multiple traceability:
1. and (6) forward tracing. The supervisor keeps track of the origin, direction and progress of each batch of products from the beginning of production.
2. And (6) performing reverse tracing. All the way from production to consumption is traced and is implemented to a specific responsible person.
3. One object for one code. Each product has a unique traceability code from a farmland to a dining table, and a consumer can obtain the whole production process of the product by scanning the code.
4. Tracing and anti-counterfeiting. The final tracing code is used as a unique identifier and an index, tracing codes of 5 stages of agricultural products are obtained by scanning the two-dimensional code, the state of the tracing codes on the supervision chain is updated due to the change of the tracing codes of any stage, and the modification, the forgery and the cracking of the tracing codes can be effectively prevented.
According to the obtained traceability codes of all stages of the agricultural products, the traceability codes of all stages of the agricultural products are integrated to obtain the final two-dimensional code, a consumer can determine the traceability codes of all stages of the agricultural products by scanning the two-dimensional code, then the traceability codes of five stages of the agricultural products are obtained based on the consumer scanning the two-dimensional code, and a traceability contract is called through the traceability codes to inquire an alliance chain ledger so as to obtain the public traceability information.
The data tracing method provided by the invention is based on the designed tracing code of each stage of the agricultural product, so that a consumer can trace the public tracing information of each stage of the agricultural product, and can accurately position a responsible person when an agricultural product safety responsibility accident occurs, thereby solving the problem of long tracing arbitration period.
Further, in an embodiment, the step S2 may specifically include:
s21, obtaining a tracing code based on the Key value;
s22, calling a tracing contract based on the tracing code, and inquiring a alliance chain to obtain public tracing information;
and S23, calling a cross-link contract based on the source tracing code, and inquiring the private chain to obtain private privacy information.
Optionally, the traceable code is used as a Key value, an enterprise creates a state index database Key value index in a Key-value Key value pair mode, traditional traversal query is replaced, query speed is improved, the coded Key value is written into a supervision chain, and a supervision node queries the latest state of a Key value through the world state index, so that real-time monitoring is achieved.
On one hand, real-time monitoring realizes pre-link data supervision through a data-structured intelligent contract, and on the other hand, safe and reliable chaining of data is ensured through content and format of audit data; on the other hand, the latest state Key value written in the chain of supervision is used for forward tracking and backward tracing of the whole process of the agricultural product, once the agricultural product has a safety liability accident, the link where the product is located can be immediately positioned, and the agricultural product can be recalled in time; through tracing back source code, pinpoint responsible person, solve the problem that the arbitration cycle of tracing back is long.
In the data storage, large data in a fluid form, video pictures and the like are stored in a distributed mode under a chain through an Interplanetary file system (IPFS), and public traceability information and private privacy information are stored in a key-value pair mode by selecting a CouchDB state index database providing rich query.
As shown in fig. 3, the traceability codes corresponding to five stages of production, processing, storage, transportation and distribution of the agricultural product are similar to a tree structure of the final two-dimensional code, the traceability codes of each stage of the agricultural product are branches, and the final two-dimensional code is a root; data (including public traceability information and private privacy information) corresponding to traceability code Key values of all stages of agricultural products are stored in a alliance chain and a private chain (a production chain, a processing chain, a storage chain, a logistics chain and a branch chain) to serve as tree branches, and the Key values update world states on a supervision chain to serve as tree roots. Public traceability information of each stage of the agricultural product is directly linked into a chain for storing certificates, and meanwhile, the latest state of the traceability coding certificates on the supervision chain is updated; after the private privacy information is encrypted through the encrypted intelligent contract submitted by the node, the ciphertext cochain is carried out, and the safety and privacy of the private privacy information are guaranteed. The query life cycle of the federation chain public traceability information comprises the following steps: the consumer scans the two-dimensional code to obtain five-stage traceability codes of the agricultural products, and calls the traceability contracts to inquire the alliance chain ledger book through the traceability codes to obtain the public traceability information. The query lifecycle of private chain stored private privacy information includes: a supervisor monitors the dynamic state of an agricultural product in real time through an updated Key value on a supervision chain, obtains public traceability information through a certified Key value through a traceability contract, and obtains private privacy information through cross-chain contract authorization decryption.
According to the data tracing method provided by the invention, the tracing code is stored on the supervision chain, a supervisor acquires forward production records and reverse tracing data of a certain batch of products in real time, the supervision chain updates the Key value of an agricultural product in real time, and auditing, inquiring and tracing the book, so that the data is subjected to penetrating whole-course supervision.
Further, in an embodiment, the method may further specifically include:
step 1, judging whether the data content and the format of the enterprise tracing data meet the uplink requirement or not through a data normalization intelligent contract;
step 2, writing the public traceability information in the enterprise traceability data meeting the uplink requirement into a alliance chain;
and 3, writing the private privacy information in the enterprise tracing data meeting the uplink requirement into a private chain.
Further, in an embodiment, step 3 may specifically include:
and 31, encrypting the private privacy information in the enterprise tracing data meeting the uplink requirement, and writing the private privacy information into the private chain.
Optionally, as shown in fig. 4, firstly, the enterprise tracing data passes through a data-structured intelligent contract (including a plaintext data cochain contract and a ciphertext data cochain contract), determines whether the data content and format meet the cochain requirement, and rejects if not, uploads the data content and format to the block chain through the cochain contract (including a production data cochain contract, a processing data cochain contract, a storage data cochain contract, a logistics data cochain contract, and a distribution data cochain contract) for the enterprise tracing data meeting the requirement, and generates a unique traceability code, for the public tracing information in the enterprise tracing data, after passing through the data-structured intelligent contract, the public tracing information can be written into the block chain, for the private privacy information in the enterprise tracing data, after passing through the data intelligent contract, the encrypted private information is encrypted through the encrypted intelligent contract submitted by the node, and then the ciphertext is written into the private chain of each stage, to ensure the safety and privacy of private privacy information.
The tracing code is used as a Key value, an enterprise creates a state index database Key value index in a Key-value Key value pair mode to replace the traditional traversal query, the query speed is improved, the code Key value is written into a supervision chain, and a supervision node queries the latest state of a Key value through the world state index so as to achieve real-time monitoring. In the data storage, large data in a fluid form, video pictures and the like are stored in a distributed mode under a chain by using an Interplanetary file system (IPFS), and source tracing data are stored in a key value pair mode by using a CouchDB state index database providing rich query.
The traceability information of each stage of the agricultural product takes traceability codes as Key values, the product information is value values, and the traceability information is stored in a CouchDB state index database providing rich query in a Key-value Key value pair mode. And the consumers scan the final tracing two-dimension code to obtain the tracing code Key value of the product at each stage, so that the product information is quickly obtained.
When the data volume is increased, the query time is linearly increased. Therefore, the interplanetary file system is used as the down-chain distributed storage to store large data, video pictures and the like in a fluid form, and therefore the block chain capacity is expanded.
The data traceability method provided by the invention is based on the agricultural product code chain fusion traceability architecture with block chain and multi-chain, and can solve the problems of untimely supervision, easy tampering of codes, incompatible upstream and downstream enterprise data, information chain breakage and the like caused by the fact that traceability systems, coding methods and data supervision in traceability systems are in war; the three modules are organically integrated, the traceability codes are stored in the chain of supervision, a supervisor acquires forward production records and reverse traceability data of a certain batch of products in real time, two-dimensional codes finally obtained by a consumer are integrated of the traceability codes in five stages, the traceability codes in any one stage are tampered, conflict can be generated with the storage certificate in the chain of supervision, so that traceability failure is caused, the problem of information chain scission caused by incompatibility of upstream and downstream enterprise data is solved through separate chaining of private privacy information and public traceability information of an enterprise through a data regulation intelligent contract, and reference are provided for agricultural product traceability system research.
The data tracing system provided by the present invention is described below, and the data tracing system described below and the data tracing method described above may be referred to each other correspondingly.
Fig. 5 is a schematic structural diagram of the data tracing system provided in the present invention, as shown in fig. 5, including:
a first tracing module 510 and a second tracing module 511;
the first traceability module 510 is configured to query the federation chain to obtain public traceability information of each stage of the agricultural product based on traceability codes of each stage of the agricultural product obtained by a consumer;
the second traceability module 511 is configured to query the federation chain to obtain public traceability information and query the private chain to obtain private privacy information of each stage of the agricultural product based on the Key value updated on the chain of custody obtained by the supervisor;
the Key value is determined by writing tracing codes into a chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
The data traceability system provided by the invention realizes multi-chain data storage through the alliance chain technology, organically combines a traceability system and data supervision, realizes the public sharing of traceability data, the acquisition of private data and real-time supervision, takes traceability codes as indexes and unique identifiers, realizes consumption traceability and supervision traceability, and enables barrier-free information interaction among consumers, supervisors and enterprises.
Fig. 6 is a schematic physical structure diagram of an electronic device provided in the present invention, and as shown in fig. 6, the electronic device may include: a processor (processor) 610, a communication interface (communication interface) 611, a memory (memory) 612 and a bus (bus) 613, wherein the processor 610, the communication interface 611 and the memory 612 communicate with each other via the bus 613. The processor 610 may call logic instructions in the memory 612 to perform the following method:
based on the traceability codes of all stages of the agricultural products acquired by the consumers, inquiring the alliance chain to acquire the public traceability information of all stages of the agricultural products;
inquiring the alliance chain to acquire public traceability information and inquiring the private chain to acquire private privacy information of each stage of the agricultural product based on an updated Key value on the supervision chain acquired by a supervisor;
the Key value is determined by writing tracing codes into a chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
In addition, the logic instructions in the memory may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention or a part thereof, which essentially contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer power screen (which may be a personal computer, a server, or a network power screen, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like.
Further, the present invention discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions, which when executed by a computer, the computer is capable of executing the data tracing method provided by the above-mentioned method embodiments, for example, the method comprises:
based on the traceability codes of all stages of the agricultural products acquired by the consumers, inquiring the alliance chain to acquire the public traceability information of all stages of the agricultural products;
inquiring the alliance chain to acquire public traceability information and inquiring the private chain to acquire private privacy information of each stage of the agricultural product based on an updated Key value on the supervision chain acquired by a supervisor;
the Key value is determined by writing tracing codes into a chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
In another aspect, the present invention further provides a non-transitory computer readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the data tracing method provided in the foregoing embodiments when executed by a processor, for example, the method includes:
based on the traceability codes of all stages of the agricultural products acquired by the consumers, inquiring the alliance chain to acquire the public traceability information of all stages of the agricultural products;
inquiring the alliance chain to acquire public traceability information and inquiring the private chain to acquire private privacy information of each stage of the agricultural product based on an updated Key value on the supervision chain acquired by a supervisor;
the Key value is determined by writing tracing codes into a chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
The above-described system embodiments are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. Based on such understanding, the above technical solutions may be essentially or partially implemented in the form of software products, which may be stored in computer readable storage media, such as ROM/RAM, magnetic disk, optical disk, etc., and include instructions for causing a computer power supply screen (which may be a personal computer, a server, or a network power supply screen, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A data tracing method is characterized by comprising the following steps:
based on the traceability codes of all stages of the agricultural products acquired by consumers, inquiring a federation chain to acquire public traceability information of all stages of the agricultural products;
inquiring the alliance chain to acquire the public traceability information and inquiring the private chain to acquire the private privacy information of each stage of the agricultural product based on the Key value updated on the supervision chain acquired by the supervisor;
wherein the Key value is determined by writing the traceable code to the chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
2. The data tracing method of claim 1, wherein the querying a federation chain for public tracing information based on a consumer obtaining tracing code for each stage of the agricultural product comprises:
acquiring the tracing code based on the two-dimension code scanned by the consumer;
calling a tracing contract based on the tracing code, and querying the alliance chain to obtain the public tracing information;
and the two-dimensional code is generated according to the tracing code.
3. The data tracing method of claim 1, wherein the querying the federation chain to obtain the public tracing information and querying the private chain to obtain the private privacy information of each stage of the agricultural product based on the Key value updated on the chain of custody obtained by the supervisor comprises:
acquiring the tracing code based on the Key value;
calling a tracing contract based on the tracing code, and querying the alliance chain to obtain the public tracing information;
and calling a cross-link contract based on the tracing code, and inquiring the private chain to obtain the private privacy information.
4. The data tracing method of claim 2, wherein said tracing code is obtained by:
and coding the public traceability information and the private privacy information according to a global trade item code to obtain the traceability codes.
5. The data tracing method of claim 1, further comprising:
judging whether the data content and the format of the enterprise traceability data meet the chaining requirement or not through a data normalization intelligent contract;
writing the public traceability information in the enterprise traceability data meeting the uplink requirement into the alliance chain;
writing the private privacy information in the enterprise tracing data meeting the uplink requirement into the private chain.
6. The method of claim 5, wherein the writing the private privacy information in the enterprise tracing data satisfying the uplink requirement into the private chain comprises:
and after encrypting the private privacy information in the enterprise tracing data meeting the uplink requirement, writing the private privacy information into the private chain.
7. The data tracing method of any one of claims 1-6, wherein each stage of the agricultural product comprises at least:
production, processing, storage, transportation, and distribution.
8. A data tracing system, comprising: the source tracing system comprises a first source tracing module and a second source tracing module;
the first traceability module is used for inquiring a alliance chain to obtain public traceability information of each stage of the agricultural product based on traceability codes of each stage of the agricultural product obtained by a consumer;
the second traceability module is used for inquiring the alliance chain to obtain the public traceability information and inquiring the private chain to obtain the private privacy information of each stage of the agricultural product based on the Key value updated on the supervision chain obtained by the supervisor;
wherein the Key value is determined by writing the traceable code to the chain of custody;
the public traceability information and the private privacy information are determined according to enterprise traceability data of each stage of the agricultural product.
9. An electronic device comprising a processor and a memory storing a computer program, wherein the processor implements the data tracing method according to any one of claims 1 to 7 when executing the computer program.
10. A non-transitory computer readable storage medium having a computer program stored thereon, wherein the computer program when executed by a processor implements the data tracing method according to any one of claims 1 to 7.
CN202210189506.6A 2022-03-01 2022-03-01 Data tracing method and system Active CN114254374B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210189506.6A CN114254374B (en) 2022-03-01 2022-03-01 Data tracing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210189506.6A CN114254374B (en) 2022-03-01 2022-03-01 Data tracing method and system

Publications (2)

Publication Number Publication Date
CN114254374A true CN114254374A (en) 2022-03-29
CN114254374B CN114254374B (en) 2022-07-01

Family

ID=80800093

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210189506.6A Active CN114254374B (en) 2022-03-01 2022-03-01 Data tracing method and system

Country Status (1)

Country Link
CN (1) CN114254374B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115759893A (en) * 2023-01-06 2023-03-07 北京市农林科学院信息技术研究中心 Cross-chain logistics business management method and device and electronic equipment
CN115983726A (en) * 2023-03-21 2023-04-18 厦门微亚智能科技有限公司 Enterprise product quality closed-loop tracing management system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107274136A (en) * 2017-07-11 2017-10-20 西安工业大学 A kind of product is traced to the source information protecting method
CN111062731A (en) * 2019-12-20 2020-04-24 江苏荣泽信息科技股份有限公司 Block chain-based food safety tracing system and method
CN111429162A (en) * 2020-04-16 2020-07-17 汪金小 Energized block chain agricultural product quality credible traceability system based on nondestructive detection technology
CN111681015A (en) * 2020-06-10 2020-09-18 复旦大学 Product tracing method, system and equipment based on alliance chain
CN111859446A (en) * 2020-06-16 2020-10-30 北京农业信息技术研究中心 Agricultural product traceability information sharing-privacy protection method and system
US20210049715A1 (en) * 2018-09-30 2021-02-18 Advanced New Technologies Co., Ltd. Blockchain-based data procesing method, apparatus, and electronic device
CN112487480A (en) * 2020-12-08 2021-03-12 上海点融信息科技有限责任公司 Block chain tracing method and device for protecting data privacy and readable storage medium
CN113706171A (en) * 2021-08-27 2021-11-26 广西卡西亚科技有限公司 Block chain agricultural product tracing method based on Beidou grid code
CN114037580A (en) * 2021-09-30 2022-02-11 长视科技股份有限公司 Water environment pollution tracing method and system based on alliance chain

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107274136A (en) * 2017-07-11 2017-10-20 西安工业大学 A kind of product is traced to the source information protecting method
US20210049715A1 (en) * 2018-09-30 2021-02-18 Advanced New Technologies Co., Ltd. Blockchain-based data procesing method, apparatus, and electronic device
CN111062731A (en) * 2019-12-20 2020-04-24 江苏荣泽信息科技股份有限公司 Block chain-based food safety tracing system and method
CN111429162A (en) * 2020-04-16 2020-07-17 汪金小 Energized block chain agricultural product quality credible traceability system based on nondestructive detection technology
CN111681015A (en) * 2020-06-10 2020-09-18 复旦大学 Product tracing method, system and equipment based on alliance chain
CN111859446A (en) * 2020-06-16 2020-10-30 北京农业信息技术研究中心 Agricultural product traceability information sharing-privacy protection method and system
CN112487480A (en) * 2020-12-08 2021-03-12 上海点融信息科技有限责任公司 Block chain tracing method and device for protecting data privacy and readable storage medium
CN113706171A (en) * 2021-08-27 2021-11-26 广西卡西亚科技有限公司 Block chain agricultural product tracing method based on Beidou grid code
CN114037580A (en) * 2021-09-30 2022-02-11 长视科技股份有限公司 Water environment pollution tracing method and system based on alliance chain

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘如意等: "区块链在农产品流通中的应用模式与实施", 《中国流通经济》 *
杨信廷 等: "基于区块链的农产品追溯系统信息存储模型与查询方法", 《农业工程学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115759893A (en) * 2023-01-06 2023-03-07 北京市农林科学院信息技术研究中心 Cross-chain logistics business management method and device and electronic equipment
CN115983726A (en) * 2023-03-21 2023-04-18 厦门微亚智能科技有限公司 Enterprise product quality closed-loop tracing management system

Also Published As

Publication number Publication date
CN114254374B (en) 2022-07-01

Similar Documents

Publication Publication Date Title
CN114254374B (en) Data tracing method and system
Lin et al. Blockchain technology in current agricultural systems: from techniques to applications
CN111445272A (en) Agricultural product traceability information processing system and method based on block chain
CN111369267A (en) Fruit and vegetable agricultural product tracing method, device and system based on block chain and storage medium
EP3540662A1 (en) Computer implemented method for supply chain management and provenance in a data processing network
WO2005106718A3 (en) Method and system for private data networks for sharing agricultural item attribute and event data across multiple enterprises and multiple stages of production transformation
CN104798052A (en) Method and apparatus for matching consumers
CN104574242A (en) Intelligent drug tracing system
KR102085140B1 (en) Indexing block chain system for electronic transactions
CN108550003A (en) The data processing method and device traced to the source based on agricultural product
CN111694837A (en) Shared data storage method and device based on service data block chain
CN113506117A (en) Aquatic product block chain traceability optimization system and method
CN110570323A (en) method and device for recording plant supply chain
Li et al. An exploratory study on the design and management model of traditional chinese medicine quality safety traceability system based on blockchain technology
CN113392144A (en) Museum service data storage and query method and system based on block chain
CN111143881A (en) Traceability data storage system and method based on alliance block chain and computer storage medium
CN111464658A (en) Tea leaf credible tracing system based on block chain and use method thereof
CN113570384A (en) Agricultural product tracing method and system based on block chain
CN115423490A (en) Give birth to bright cold chain logistics traceability system based on block chain
CN113706171B (en) Block chain agricultural product tracing method based on Beidou grid codes
Yang et al. Data management system based on blockchain technology for agricultural supply chain
CN109359997A (en) A kind of anti-tamper system for tracing and managing of medicine information based on block chain
CN112396379A (en) Cross-border logistics block chain management method
Patel et al. Blockchain in food supply chain
Kannan et al. Managing the supply chain for the crops directed from agricultural fields using blockchains

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant