CN112329030A - Agricultural product tracing method and system based on edge calculation - Google Patents

Agricultural product tracing method and system based on edge calculation Download PDF

Info

Publication number
CN112329030A
CN112329030A CN202011119260.2A CN202011119260A CN112329030A CN 112329030 A CN112329030 A CN 112329030A CN 202011119260 A CN202011119260 A CN 202011119260A CN 112329030 A CN112329030 A CN 112329030A
Authority
CN
China
Prior art keywords
data
server
edge
agricultural product
cloud
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.)
Pending
Application number
CN202011119260.2A
Other languages
Chinese (zh)
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.)
Anhui Wangmeng Technology Development Co Ltd
Original Assignee
Anhui Wangmeng Technology Development Co Ltd
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 Anhui Wangmeng Technology Development Co Ltd filed Critical Anhui Wangmeng Technology Development Co Ltd
Priority to CN202011119260.2A priority Critical patent/CN112329030A/en
Publication of CN112329030A publication Critical patent/CN112329030A/en
Pending legal-status Critical Current

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
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2477Temporal data queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • 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
    • 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
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/02Agriculture; Fishing; Forestry; Mining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2151Time stamp

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Bioethics (AREA)
  • Computer Hardware Design (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Data Mining & Analysis (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Mathematical Physics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computing Systems (AREA)
  • Development Economics (AREA)
  • Accounting & Taxation (AREA)
  • Fuzzy Systems (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computational Linguistics (AREA)
  • Finance (AREA)
  • Agronomy & Crop Science (AREA)
  • Animal Husbandry (AREA)
  • Marine Sciences & Fisheries (AREA)
  • Mining & Mineral Resources (AREA)
  • Human Resources & Organizations (AREA)
  • Primary Health Care (AREA)
  • Tourism & Hospitality (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention designs an agricultural product traceability method and system based on edge calculation, wherein the method comprises the steps that a bottom sensor collects agricultural product information data, and agricultural product traceability data are generated and transmitted to an edge terminal; the edge terminal receives and stores agricultural product traceability data, periodically generates first agricultural product data and uploads the first agricultural product data to the edge server; the edge server receives first data of agricultural products, generates first data of the server, periodically packages the first data to generate second data of the server, and uploads the second data to the cloud platform; the cloud platform receives the second data of the server, generates new first cloud data, and periodically stores the first cloud data. The invention solves the problem of difficult data redundancy storage under the block chain background by using the storage and reading mode of edge calculation, realizes node type writing and storage by using the idea of the block chain, saves the storage space, and simultaneously can realize the function of preventing data from being tampered.

Description

Agricultural product tracing method and system based on edge calculation
Technical Field
The invention belongs to the field of data tracing, and particularly relates to an agricultural product tracing method and system based on edge calculation.
Background
Agricultural farming is a special, complex, independent and, at the same time, the most important work, which is related to human health and the overall ecological cycle. Along with the improvement of the awareness of people on food safety, the demands of more and more consumers at different levels on the awareness of safety, health and quality guarantee of agricultural products are continuously increased. Food safety based on national detection standards has not been able to meet the needs of people; the third party authentication is only the authentication of the process and cannot supervise the production field all the time; consumers feel angry in enterprise kidnapping market behavior; in the context of the lack of credit, people are also not confident in social control. This all forces people to seek a method for solving food safety with higher safety level. One of the ways to solve the food safety at a higher level of safety includes agricultural product traceability.
Most of the existing tracing methods consider the blockchain technology, but the blockchain technology has higher system computing requirements and storage requirements, and in the agricultural product tracing process, a large amount of data is generated every day, so that the computing and storage requirements on a server are high. Agricultural product tracing using blockchain technology increases server hardware costs significantly.
Disclosure of Invention
In order to solve the above problems, the present invention provides an agricultural product tracing method based on edge calculation, wherein the method includes:
the method comprises the steps that a bottom layer sensor collects agricultural product information data, agricultural product traceability data are generated, and the agricultural product traceability data are transmitted to an edge terminal;
the edge terminal receives a plurality of agricultural product tracing data transmitted by a plurality of bottom sensors, stores the agricultural product tracing data, periodically packages and encrypts the agricultural product tracing data to generate first agricultural product data, and uploads the first agricultural product data to an edge server;
the method comprises the steps that an edge terminal receives first server data transmitted by an edge server, and if the first server data do not include the first agricultural product data, the first agricultural product data are uploaded to the edge server again;
if there is no server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, generates first data of the server, and sends the first data of the server to an edge terminal managed by the edge server;
if there is server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, combines the first data of the server and the first data of the agricultural product to generate new first data of the server, and sends the new first data of the server to an edge terminal governed by the edge server;
the edge server periodically packages and encrypts the first server data to generate second server data, and uploads the second server data to the cloud platform;
the method comprises the steps that an edge server receives first cloud data transmitted by a cloud platform, and if the first cloud data do not comprise the first server data, second server data are uploaded to the cloud platform again;
if there is no cloud first data in the cloud platform,
the cloud platform receives second data of a server, decrypts the second data of the server to generate first cloud data, and sends the first cloud data to an edge server governed by the cloud platform;
if the cloud first data exists in the cloud platform,
the cloud platform receives server second data, decrypts the server second data, combines the server second data and the server second data to generate new cloud first data, and sends the new cloud first data to an edge server governed by the cloud platform;
the cloud platform periodically saves the cloud first data.
Further, the agricultural product traceability data comprises a sensor id, agricultural product information data and a mark code;
the agricultural product information data comprises agricultural product planting, processing, warehousing, transportation and sale data.
Further, the edge terminal packaging and encrypting the agricultural product traceability data comprises:
the edge terminal processes the edge terminal id by using an RSA algorithm to generate a private key of the edge terminal and a public key of the edge terminal;
the edge termination packing includes: generating an edge terminal packet header by using an edge terminal id, a current timestamp, a plurality of agricultural product traceability information data and a random number;
the agricultural product traceability information data comprises a sensor id and a mark code;
the edge terminal encrypting the agricultural product traceability data comprises encrypting the edge terminal packaging head by using an encryption algorithm, wherein a secret key is a private key of the edge terminal.
Further, the edge server packaging and encrypting the server first data comprises:
the edge server processes the edge server id by using an RSA algorithm to generate a private key of the edge server and a public key of the edge server;
the edge server packaging comprises: generating an edge server packet header by using an edge server id, a current timestamp, first data of a plurality of agricultural products and a random number;
the edge server encrypting the server first data comprises encrypting the edge server packing header using an encryption algorithm, wherein a secret key is a private key of the edge server.
Further, the encryption algorithm is the SHA256 algorithm.
The invention also provides an agricultural product traceability system based on edge calculation, which comprises:
the bottom sensor is used for collecting agricultural product traceability data and transmitting the agricultural product traceability data to the edge terminal;
an edge termination for:
receiving a plurality of agricultural product traceability data transmitted by a plurality of bottom sensors, storing the agricultural product traceability data, periodically packaging and encrypting the agricultural product traceability data to generate first agricultural product data, and uploading the first agricultural product data to an edge server;
the method comprises the steps that an edge terminal receives first server data transmitted by an edge server, and if the first server data do not include the first agricultural product data, the first agricultural product data are uploaded to the edge server again;
an edge server, the edge server to:
if there is no server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, generates first data of the server, and sends the first data of the server to an edge terminal managed by the edge server;
if there is server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, combines the first data of the server and the first data of the agricultural product to generate new first data of the server, and sends the new first data of the server to an edge terminal governed by the edge server;
the edge server periodically packages and encrypts the first server data to generate second server data, and uploads the second server data to the cloud platform;
the method comprises the steps that an edge server receives first cloud data transmitted by a cloud platform, and if the first cloud data do not comprise the first server data, second server data are uploaded to the cloud platform again;
a cloud platform, the cloud platform to:
if there is no cloud first data in the cloud platform,
the cloud platform receives second data of a server, decrypts the second data of the server to generate first cloud data, and sends the first cloud data to an edge server governed by the cloud platform;
if the cloud first data exists in the cloud platform,
the cloud platform receives server second data, decrypts the server second data, combines the server second data and the server second data to generate new cloud first data, and sends the new cloud first data to an edge server governed by the cloud platform;
the cloud platform periodically saves the cloud first data.
Further, the agricultural product traceability data comprises a sensor id number and agricultural product information data;
the agricultural product information data comprises agricultural product planting, processing, warehousing, transportation and sale data.
Further, the edge terminal packaging and encrypting the agricultural product traceability data comprises:
the edge terminal processes the edge terminal id by using an RSA algorithm to generate a private key of the edge terminal and a public key of the edge terminal;
the edge termination packing includes: generating an edge terminal packet header by using an edge terminal id, a current timestamp, a plurality of agricultural product traceability information data and a random number;
the agricultural product traceability information data comprises a sensor id and a mark code;
the edge terminal encrypting the agricultural product traceability data comprises encrypting the edge terminal packaging head by using an encryption algorithm, wherein a secret key is a private key of the edge terminal.
Further, the edge server packaging and encrypting the server first data comprises:
the edge server processes the edge server id by using an RSA algorithm to generate a private key of the edge server and a public key of the edge server;
the edge server packaging comprises: generating an edge server packet header by using an edge server id, a current timestamp, first data of a plurality of agricultural products and a random number;
the edge server encrypting the server first data comprises encrypting the edge server packing header using an encryption algorithm, wherein a secret key is a private key of the edge server.
Further, the encryption algorithm is the SHA256 algorithm.
The invention solves the problem of difficult data redundancy storage under the block chain background by using the storage and reading mode of edge calculation, realizes node type writing and storage by using the idea of the block chain, saves the storage space, and simultaneously can realize the function of preventing data from being tampered.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in 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 flowchart illustrating an agricultural product tracing method based on edge calculation according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, 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.
An embodiment of the present invention provides an agricultural product tracing method based on edge calculation, as shown in fig. 1, the method includes: the bottom layer sensor collects agricultural product information data, agricultural product traceability data are generated, and the agricultural product traceability data are transmitted to the edge terminal. The agricultural product tracing data comprises a sensor id number, agricultural product information data and a mark code; the agricultural product information data comprises agricultural product planting, processing, warehousing, transportation and sale data. The edge terminal receives a plurality of agricultural product tracing data transmitted by a plurality of bottom sensors, stores the agricultural product tracing data, periodically packages and encrypts the agricultural product tracing data to generate first agricultural product data, and uploads the first agricultural product data to an edge server; the edge terminal receives first server data transmitted by an edge server, and if the first server data does not include the first agricultural product data, the first agricultural product data is uploaded to the edge server again. If the edge server does not have the first server data, the edge server receives the first agricultural product data, decrypts the first agricultural product data, generates first server data and sends the first server data to an edge terminal managed by the edge server; if server first data exists in the edge server, the edge server receives agricultural product first data, decrypts the agricultural product first data, combines the server first data and the agricultural product first data to generate new server first data, and sends the new server first data to an edge terminal governed by the edge server; the edge server periodically packages and encrypts the first server data to generate second server data, and uploads the second server data to the cloud platform; the method comprises the steps that an edge server receives first cloud data transmitted by a cloud platform, and if the first cloud data do not comprise the first server data, second server data are uploaded to the cloud platform again; if the cloud platform does not have the cloud first data, the cloud platform receives server second data, decrypts the server second data to generate cloud first data, and sends the cloud first data to an edge server governed by the cloud platform; if the cloud first data exists in the cloud platform, the cloud platform receives server second data, decrypts the server second data, combines the server second data and the server second data to generate new cloud first data, and sends the new cloud first data to an edge server governed by the cloud platform; the cloud platform periodically saves the cloud first data.
Specifically, agricultural product traceability data are generated by using agricultural product information data of a bottom sensor, and are transmitted to an edge terminal.
For example, most of the prior traceability consider the blockchain technology, but the blockchain technology has higher system computing requirements and storage requirements, and is not suitable for agricultural product traceability platforms under large data volume scenes. Therefore, the invention provides an edge computing framework, and computing and storing tasks are effectively shared by a multi-edge server. According to the agricultural product data updating method, data of different stages of agricultural products are written into a traceability system, basic data and stage transaction data are stored according to stages, the basic data of the agricultural products are uniformly stored by a cloud platform, and the basic data of the agricultural products need to be updated to the cloud platform every time the basic data of the agricultural products change. The tracing system comprises a bottom sensor, an edge terminal, an edge server and a cloud platform, wherein the edge terminal and the bottom sensor are in a one-to-many relationship; the edge server and the edge terminal are in one-to-many relationship; the cloud platform is arranged on the uppermost layer, and the cloud platform and the edge server are in one-to-many relationship. The agricultural product has a plurality of data from production to final sale, and the data is agricultural product information data, including agricultural product planting, processing, warehousing, transportation and sale data; for example, corn processing data can be generated during corn processing; transportation of rice from one location to another will generate transportation data. When the agricultural product information data is processed, the mark code is generated at the same time, the mark code has uniqueness, and the mark code corresponds to the agricultural product information data one by one. The mark code may only contain key data, and the main content of the agricultural product information data, such as "third batch of corn transaction", may be obtained through the key data, and it may be known through the mark code that the corresponding agricultural product information data is the third batch of corn transaction information, and the agricultural product information data includes specific information of the transaction, such as what time the transaction was made, which merchants made the transaction, and so on. The mark code may be designed in other ways as long as the function is realized. The invention uses the mark code and the agricultural product information data, the mark code realizes the basic data, and the agricultural product information data realizes the stage transaction data. The edge terminal stores the mark codes and the agricultural product information data, and the edge server and the cloud platform only store the mark codes, so that a large amount of data is effectively prevented from being stored on the edge server and the cloud platform.
Agricultural product information data is collected by different underlying sensors. Each hardware device has its own hardware id, and the hardware id has uniqueness, and the corresponding hardware can be found according to the hardware id. The bottom layer sensor collects agricultural product information data, the agricultural product information data is added with the sensor id and the mark code of the bottom layer sensor, agricultural product traceability data is generated, and the agricultural product traceability data is transmitted to the edge terminal.
Specifically, the edge terminal receives a plurality of agricultural product traceability data transmitted by a plurality of bottom sensors, stores the agricultural product traceability data, periodically packages and encrypts the agricultural product traceability data to generate first agricultural product data, and uploads the first agricultural product data to the edge server. The edge terminal packaging and encrypting the agricultural product traceability data comprises the following steps: the edge terminal processes the edge terminal id by using an RSA algorithm to generate a private key of the edge terminal and a public key of the edge terminal; the edge termination packing includes: generating an edge terminal packet header by using an edge terminal id, a current timestamp, a plurality of agricultural product traceability information data and a random number; the agricultural product traceability information data comprises a sensor id and a mark code; the edge terminal encrypting the agricultural product traceability data comprises encrypting the edge terminal packaging head by using an encryption algorithm, wherein a secret key is a private key of the edge terminal. The encryption algorithm is the SHA256 algorithm.
Illustratively, the edge terminals are close to the underlying sensors, collecting the underlying sensor data, and are able to save and make certain calculations. Each edge termination corresponds to a number of underlying sensors. And the edge terminal receives a plurality of agricultural product traceability data transmitted by a plurality of bottom sensors and stores the agricultural product traceability data. The method comprises the steps that an edge terminal processes an edge terminal id by using an RSA algorithm to generate a private key of the edge terminal and a public key of the edge terminal, the edge terminal generates an edge terminal packet header by using the edge terminal id, a current timestamp, a plurality of agricultural product traceability information data and a random number, and the agricultural product traceability information data comprise a sensor id and a mark code; if the packet header of the edge terminal a is "edge terminal idA + current timestamp + (sensor id1+ tag code 1) + (sensor id2+ tag code 2) + random number", and the packet header of the edge terminal B is "edge terminal idB + current timestamp + (sensor id3+ tag code 3) + (sensor id4+ tag code 4) + random number". The random number is automatically generated by the edge terminal. The edge terminal encrypts the edge terminal packaging head by using a SHA256(Secure HashAlgorithm) algorithm, wherein a secret key is a private key of the edge terminal. After the first data of the agricultural products are encrypted, the first data of the agricultural products are generated, and the edge terminal uploads the first data of the agricultural products to an edge server.
Specifically, if the edge server does not have server first data, the edge server receives agricultural product first data, decrypts the agricultural product first data, generates server first data, and sends the server first data to an edge terminal managed by the edge server; if server first data exists in the edge server, the edge server receives agricultural product first data, decrypts the agricultural product first data, combines the server first data and the agricultural product first data to generate new server first data, and sends the new server first data to an edge terminal governed by the edge server; and the edge server periodically packages and encrypts the first data of the server to generate second data of the server, and uploads the second data of the server to the cloud platform. The edge server processes the edge server id by using an RSA algorithm to generate a private key of the edge server and a public key of the edge server; the edge server packaging comprises: generating an edge server packet header by using an edge server id, a current timestamp, first data of a plurality of agricultural products and a random number; the edge server encrypting the server first data comprises encrypting the edge server packing header using an encryption algorithm, wherein a secret key is a private key of the edge server. The encryption algorithm is the SHA256 algorithm. The edge terminal receives first server data transmitted by an edge server, and if the first server data does not include the first agricultural product data, the first agricultural product data is uploaded to the edge server again.
Illustratively, the edge server is close to the edge terminal, and can collect and store data of the edge terminal and make certain limit calculation. The edge server and the edge terminal are in a one-to-many relationship. In the edge server, the server first data may or may not exist. If the first data of the server does not exist in the edge server, the edge server receives the first data of the agricultural product, the public key of the edge terminal corresponding to the first data of the agricultural product is used for decrypting the first data of the agricultural product, if the decryption is successful, the first data of the agricultural product is sent by the corresponding edge terminal, and if the decryption is unsuccessful, the first data of the agricultural product is discarded. And after the decryption is successful, generating first data of the server. For example, the edge server has no server first data, and after receiving the agricultural product first data sent by the edge terminal a, the generated server first data includes "edge terminal idA + current timestamp + (sensor id1+ tag code 1) + (sensor id2+ tag code 2)". In another design, the generated server first data includes "edge terminal idA + edge server current timestamp + edge terminal current timestamp + (sensor id1+ tag code 1) + (sensor id2+ tag code 2)", that is, the generated server first data includes the edge server current timestamp and also includes the edge terminal current timestamp in the edge terminal packet header. The following examples are all exemplified by only including the current hardware timestamp, and do not include the timestamp transmitted from the previous layer, and those skilled in the art can easily deduce the scheme including the timestamp transmitted from the previous layer. Since each server first data includes a time stamp, it is easy to find that a certain data is tampered with by comparing the last modification time of the data with the corresponding time stamp of the data in the different server first data.
If the first server data already exist in the edge server, after receiving the first agricultural product data, decrypting the first agricultural product data, combining the first server data and the first agricultural product data, and generating new first server data. For example, the edge server already has server first data, receives the first data of the agricultural product sent by the edge terminal B, decrypts and combines the server first data to generate new server first data, which includes "edge terminal idA + current timestamp + (sensor id1+ tag code 1) + (sensor id2+ tag code 2) + edge terminal idB + (sensor id3+ tag code 3) + (sensor id4+ tag code 4)". When the edge server generates the first server data or regenerates new first server data, the edge server sends the first server data to the edge terminal governed by the edge server.
The edge terminal receives first data of the server transmitted by the edge server, and if the first data of the agricultural products uploaded by the edge terminal is included in the first data of the server, the first data of the agricultural products uploaded by the edge terminal is added into the first data of the server. The edge terminal continuously receives a plurality of agricultural product tracing data transmitted by a plurality of bottom sensors, and regenerates new first agricultural product data which does not contain the previous first agricultural product data content. If the first data of the agricultural products uploaded by the edge terminal is not included in the first data of the server, the first data of the agricultural products uploaded by the edge terminal is not added into the first data of the server, and the edge terminal uploads the first data of the agricultural products again until the first data of the agricultural products uploaded by the edge terminal is included in the first data of the server. And the edge terminal continuously receives a plurality of agricultural product traceability data transmitted by a plurality of bottom sensors at the same time, regenerates the new agricultural product traceability data into new agricultural product first data and uploads the new agricultural product first data to the edge server according to the period. When the set uploading cycle time interval is larger, such as 1 hour, the phenomenon that the old first data of the agricultural products are not added into the first data of the server and the new first data of the agricultural products are uploaded can not occur.
After receiving the first data of the new agricultural product, the edge server adds corresponding content to the first data of the server, so that the first data of the server grows along with the increase of time. And the edge server periodically packages and encrypts the first data of the server to generate second data of the server, and uploads the second data of the server to the cloud platform. The edge server processes the edge server id by using an RSA algorithm to generate a private key of the edge server and a public key of the edge server; the edge server packaging comprises: generating an edge server packet header by using an edge server id, a current timestamp, first data of a plurality of agricultural products and a random number; the edge server encrypting the server first data comprises encrypting the edge server packing header using an encryption algorithm, wherein a secret key is a private key of the edge server. The encryption algorithm is the SHA256 algorithm. If the packet header of the edge server a is "edge server idA + current timestamp + edge terminal idA + (sensor id1+ tag code 1) + (sensor id2+ tag code 2) + edge terminal Bid + (sensor id3+ tag code 3) + (sensor id4+ tag code 4) + random number". And the edge server A encrypts the edge packing head by using SHA256, wherein the secret key is the private key of the edge server A. And after encryption is completed, generating second server data, and uploading the second server data to the cloud platform by the edge server A.
Specifically, if the cloud platform does not have the cloud first data, the cloud platform receives a server second data, decrypts the server second data, generates the cloud first data, and sends the cloud first data to an edge server governed by the cloud platform; if the cloud first data exists in the cloud platform, the cloud platform receives server second data, decrypts the server second data, combines the server second data and the server second data to generate new cloud first data, and sends the new cloud first data to an edge server governed by the cloud platform; the cloud platform periodically saves the cloud first data. The edge server receives first cloud data transmitted by the cloud platform, and if the first cloud data does not include the first server data, second server data is uploaded to the cloud platform again.
Illustratively, the cloud platform is close to the edge server, belongs to the uppermost layer, can collect and store data of the edge server, and can perform a large amount of computation. The cloud platform and the edge server are in a one-to-many relationship. In the cloud platform, cloud first data may or may not exist. If the cloud platform does not have the first cloud data, the cloud platform receives second server data, the public key of the edge server corresponding to the second server data is used for decrypting the second server data, if the decryption is successful, the second server data is sent for the corresponding edge server, and if the decryption is unsuccessful, the second server data is discarded. And after the decryption is successful, generating cloud first data. For example, after the cloud platform does not have cloud first data and receives server second data transmitted from the edge server a, the generated cloud first data includes "edge server idA + current timestamp + edge terminal idA + (sensor id1+ marker code 1) + (sensor id2+ marker code 2) + edge terminal idB + (sensor id3+ marker code 3) + (sensor id4+ marker code 4)". If the cloud first data already exists in the cloud platform, after receiving the server second data, decrypting the server second data, combining the cloud first data and the server second data, and generating new cloud first data. The method for generating the new cloud first data is the same as the method for generating the new server first data by the edge server, and a person skilled in the art can obtain how to generate the new cloud first data from the edge server generating the new server first data. After the cloud platform generates the first cloud data or regenerates new first cloud data, the cloud platform sends the first cloud data to all the edge servers.
The edge server receives first cloud data transmitted by the cloud platform, and if the first cloud data comprise second server data uploaded by the edge server, the second server data uploaded by the edge server are added into the first cloud data. The edge server continuously receives a plurality of agricultural product first data transmitted by a plurality of edge terminals, and regenerates new server second data, wherein the new server second data does not contain the previous agricultural product first data content.
And if the second server data uploaded by the edge server is not included in the first cloud data, the second server data uploaded by the edge server is not added into the first cloud data. The edge server uploads the second data of the original server again, and meanwhile receives the first data of the agricultural products transmitted by the edge terminal to generate new second data of the server.
When a user needs to trace the source of the agricultural product, the user can inquire at an edge terminal, an edge server or a cloud platform. The query method at the edge terminal is the same as that at the edge server, and the following description will be made by performing query at the edge terminal, from which a person skilled in the art can deduce the query method at the edge server. The user queries the data of agricultural product a at edge terminal a. If the relevant data of the agricultural product A is already stored in the edge terminal A, namely the first data of the server stored by the edge terminal A contains the relevant data of the agricultural product A, the edge terminal A directly returns the query result to the user. If the relevant data of the agricultural product A is not stored in the edge terminal A, namely the first data of the server stored by the edge terminal A does not contain the relevant data of the agricultural product A, namely the edge terminal A sends a query request to the corresponding edge server A, and the edge server A sends the query request to the cloud platform. The cloud platform queries the first cloud data stored by the cloud platform. The cloud platform stores basic data, if the cloud first data do not contain related data of agricultural products A, the fact that the agricultural products A do not exist in the whole platform is represented, and the cloud platform sends no information to a client through an edge server A-an edge terminal A; if the cloud first data contain relevant data of the agricultural product A, assuming that the agricultural product data are stored in an edge terminal B under an edge server B, the cloud platform sends a query request to the edge terminal B through the edge server B, the edge terminal B transmits the agricultural product information data to the cloud platform, and the cloud platform sends corresponding information to a client through the edge server A and the edge terminal A. The cloud platform can also directly reply the data of the edge terminal A to the edge terminal B, and the edge terminal A directly queries the edge terminal B. If the user inquires on the cloud platform, the cloud platform inquires in the first cloud data stored in the cloud platform, and if the first cloud data does not contain related data of the agricultural product A, the agricultural product A information does not exist in the cloud platform, and the cloud platform replies to the client that the information does not exist; and if the cloud first data contain the relevant data of the agricultural product A, the cloud platform sends a request to the corresponding edge terminal, and the cloud platform replies corresponding information to the client after obtaining the specific data.
The embodiment of the invention also provides an agricultural product traceability system based on edge calculation, which comprises:
the bottom sensor is used for collecting agricultural product traceability data and transmitting the agricultural product traceability data to the edge terminal;
an edge termination for:
receiving a plurality of agricultural product traceability data transmitted by a plurality of bottom sensors, storing the agricultural product traceability data, periodically packaging and encrypting the agricultural product traceability data to generate first agricultural product data, and uploading the first agricultural product data to an edge server;
the method comprises the steps that an edge terminal receives first server data transmitted by an edge server, and if the first server data do not include the first agricultural product data, the first agricultural product data are uploaded to the edge server again;
an edge server, the edge server to:
if there is no server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, generates first data of the server, and sends the first data of the server to an edge terminal managed by the edge server;
if there is server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, combines the first data of the server and the first data of the agricultural product to generate new first data of the server, and sends the new first data of the server to an edge terminal governed by the edge server;
the edge server periodically packages and encrypts the first server data to generate second server data, and uploads the second server data to the cloud platform;
the method comprises the steps that an edge server receives first cloud data transmitted by a cloud platform, and if the first cloud data do not comprise the first server data, second server data are uploaded to the cloud platform again;
a cloud platform, the cloud platform to:
if there is no cloud first data in the cloud platform,
the cloud platform receives second data of a server, decrypts the second data of the server to generate first cloud data, and sends the first cloud data to an edge server governed by the cloud platform;
if the cloud first data exists in the cloud platform,
the cloud platform receives server second data, decrypts the server second data, combines the server second data and the server second data to generate new cloud first data, and sends the new cloud first data to an edge server governed by the cloud platform;
the cloud platform periodically saves the cloud first data.
The agricultural product tracing data comprises a sensor id number and agricultural product information data;
the agricultural product information data comprises agricultural product planting, processing, warehousing, transportation and sale data.
Wherein the edge terminal packaging and encrypting the agricultural product tracing data comprises:
the edge terminal processes the edge terminal id by using an RSA algorithm to generate a private key of the edge terminal and a public key of the edge terminal;
the edge termination packing includes: generating an edge terminal packet header by using an edge terminal id, a current timestamp, a plurality of agricultural product traceability information data and a random number;
the agricultural product traceability information data comprises a sensor id and a mark code;
the edge terminal encrypting the agricultural product traceability data comprises encrypting the edge terminal packaging head by using an encryption algorithm, wherein a secret key is a private key of the edge terminal.
Wherein the edge server packaging and encrypting the server first data comprises:
the edge server processes the edge server id by using an RSA algorithm to generate a private key of the edge server and a public key of the edge server;
the edge server packaging comprises: generating an edge server packet header by using an edge server id, a current timestamp, first data of a plurality of agricultural products and a random number;
the edge server encrypting the server first data comprises encrypting the edge server packing header using an encryption algorithm, wherein a secret key is a private key of the edge server.
Wherein, the encryption algorithm is SHA256 algorithm.
The invention solves the problem of difficult data redundancy storage under the block chain background by using the storage and reading mode of edge calculation, realizes node type writing and storage by using the idea of the block chain, saves the storage space, and simultaneously can realize the function of preventing data from being tampered.
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. An agricultural product tracing method based on edge calculation is characterized in that,
the method comprises the following steps:
the method comprises the steps that a bottom layer sensor collects agricultural product information data, agricultural product traceability data are generated, and the agricultural product traceability data are transmitted to an edge terminal;
the edge terminal receives a plurality of agricultural product tracing data transmitted by a plurality of bottom sensors, stores the agricultural product tracing data, periodically packages and encrypts the agricultural product tracing data to generate first agricultural product data, and uploads the first agricultural product data to an edge server;
the method comprises the steps that an edge terminal receives first server data transmitted by an edge server, and if the first server data do not include the first agricultural product data, the first agricultural product data are uploaded to the edge server again;
if there is no server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, generates first data of the server, and sends the first data of the server to an edge terminal managed by the edge server;
if there is server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, combines the first data of the server and the first data of the agricultural product to generate new first data of the server, and sends the new first data of the server to an edge terminal governed by the edge server;
the edge server periodically packages and encrypts the first server data to generate second server data, and uploads the second server data to the cloud platform;
the method comprises the steps that an edge server receives first cloud data transmitted by a cloud platform, and if the first cloud data do not comprise the first server data, second server data are uploaded to the cloud platform again;
if there is no cloud first data in the cloud platform,
the cloud platform receives second data of a server, decrypts the second data of the server to generate first cloud data, and sends the first cloud data to an edge server governed by the cloud platform;
if the cloud first data exists in the cloud platform,
the cloud platform receives server second data, decrypts the server second data, combines the server second data and the server second data to generate new cloud first data, and sends the new cloud first data to an edge server governed by the cloud platform;
the cloud platform periodically saves the cloud first data.
2. The tracing method of claim 1,
the agricultural product tracing data comprises a sensor id, agricultural product information data and a mark code;
the agricultural product information data comprises agricultural product planting, processing, warehousing, transportation and sale data.
3. The tracing method of claim 1,
the edge terminal packaging and encrypting the agricultural product traceability data comprises the following steps:
the edge terminal processes the edge terminal id by using an RSA algorithm to generate a private key of the edge terminal and a public key of the edge terminal;
the edge termination packing includes: generating an edge terminal packet header by using an edge terminal id, a current timestamp, a plurality of agricultural product traceability information data and a random number;
the agricultural product traceability information data comprises a sensor id and a mark code;
the edge terminal encrypting the agricultural product traceability data comprises encrypting the edge terminal packaging head by using an encryption algorithm, wherein a secret key is a private key of the edge terminal.
4. The tracing method of claim 1,
the edge server packaging and encrypting the server first data comprises:
the edge server processes the edge server id by using an RSA algorithm to generate a private key of the edge server and a public key of the edge server;
the edge server packaging comprises: generating an edge server packet header by using an edge server id, a current timestamp, first data of a plurality of agricultural products and a random number;
the edge server encrypting the server first data comprises encrypting the edge server packing header using an encryption algorithm, wherein a secret key is a private key of the edge server.
5. The tracing method of claim 3 or 4,
the encryption algorithm is the SHA256 algorithm.
6. An agricultural product traceability system based on edge calculation is characterized in that,
the system comprises:
the bottom sensor is used for collecting agricultural product traceability data and transmitting the agricultural product traceability data to the edge terminal;
an edge termination for:
receiving a plurality of agricultural product traceability data transmitted by a plurality of bottom sensors, storing the agricultural product traceability data, periodically packaging and encrypting the agricultural product traceability data to generate first agricultural product data, and uploading the first agricultural product data to an edge server;
the method comprises the steps that an edge terminal receives first server data transmitted by an edge server, and if the first server data do not include the first agricultural product data, the first agricultural product data are uploaded to the edge server again;
an edge server, the edge server to:
if there is no server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, generates first data of the server, and sends the first data of the server to an edge terminal managed by the edge server;
if there is server first data in the edge server,
the method comprises the steps that an edge server receives first data of an agricultural product, decrypts the first data of the agricultural product, combines the first data of the server and the first data of the agricultural product to generate new first data of the server, and sends the new first data of the server to an edge terminal governed by the edge server;
the edge server periodically packages and encrypts the first server data to generate second server data, and uploads the second server data to the cloud platform;
the method comprises the steps that an edge server receives first cloud data transmitted by a cloud platform, and if the first cloud data do not comprise the first server data, second server data are uploaded to the cloud platform again;
a cloud platform, the cloud platform to:
if there is no cloud first data in the cloud platform,
the cloud platform receives second data of a server, decrypts the second data of the server to generate first cloud data, and sends the first cloud data to an edge server governed by the cloud platform;
if the cloud first data exists in the cloud platform,
the cloud platform receives server second data, decrypts the server second data, combines the server second data and the server second data to generate new cloud first data, and sends the new cloud first data to an edge server governed by the cloud platform;
the cloud platform periodically saves the cloud first data.
7. The traceability system of claim 6,
the agricultural product tracing data comprises a sensor id number and agricultural product information data;
the agricultural product information data comprises agricultural product planting, processing, warehousing, transportation and sale data.
8. The traceability system of claim 6,
the edge terminal packaging and encrypting the agricultural product traceability data comprises the following steps:
the edge terminal processes the edge terminal id by using an RSA algorithm to generate a private key of the edge terminal and a public key of the edge terminal;
the edge termination packing includes: generating an edge terminal packet header by using an edge terminal id, a current timestamp, a plurality of agricultural product traceability information data and a random number;
the agricultural product traceability information data comprises a sensor id and a mark code;
the edge terminal encrypting the agricultural product traceability data comprises encrypting the edge terminal packaging head by using an encryption algorithm, wherein a secret key is a private key of the edge terminal.
9. The traceability system of claim 6,
the edge server packaging and encrypting the server first data comprises:
the edge server processes the edge server id by using an RSA algorithm to generate a private key of the edge server and a public key of the edge server;
the edge server packaging comprises: generating an edge server packet header by using an edge server id, a current timestamp, first data of a plurality of agricultural products and a random number;
the edge server encrypting the server first data comprises encrypting the edge server packing header using an encryption algorithm, wherein a secret key is a private key of the edge server.
10. The traceability system of claim 8 or 9,
the encryption algorithm is the SHA256 algorithm.
CN202011119260.2A 2020-10-19 2020-10-19 Agricultural product tracing method and system based on edge calculation Pending CN112329030A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011119260.2A CN112329030A (en) 2020-10-19 2020-10-19 Agricultural product tracing method and system based on edge calculation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011119260.2A CN112329030A (en) 2020-10-19 2020-10-19 Agricultural product tracing method and system based on edge calculation

Publications (1)

Publication Number Publication Date
CN112329030A true CN112329030A (en) 2021-02-05

Family

ID=74313195

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011119260.2A Pending CN112329030A (en) 2020-10-19 2020-10-19 Agricultural product tracing method and system based on edge calculation

Country Status (1)

Country Link
CN (1) CN112329030A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113406929A (en) * 2021-05-02 2021-09-17 华中农业大学 Food safety big data intelligent acquisition and application system
CN114331480A (en) * 2022-03-15 2022-04-12 北京市农林科学院信息技术研究中心 Agricultural product traceability data processing method and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113406929A (en) * 2021-05-02 2021-09-17 华中农业大学 Food safety big data intelligent acquisition and application system
CN113406929B (en) * 2021-05-02 2023-03-10 华中农业大学 Food safety big data intelligent acquisition and application system
CN114331480A (en) * 2022-03-15 2022-04-12 北京市农林科学院信息技术研究中心 Agricultural product traceability data processing method and system

Similar Documents

Publication Publication Date Title
US20200184489A1 (en) Methods, systems and apparatus to track a provenance of goods
CN108769154B (en) Data storage method based on directed acyclic graph and distributed account book
CN111445272A (en) Agricultural product traceability information processing system and method based on block chain
US11088834B2 (en) System for privacy-preserving monetization of big data and method for using the same
CN109597822B (en) User data storage and query method and user data processing device
CN108595980B (en) Method and device for protecting commodity traceability information
CN105190595A (en) Uniquely identifying a network-connected entity
WO2015099661A1 (en) Techniques and architecture for anonymizing user data
CN111507709A (en) Data traceability system
CN112329030A (en) Agricultural product tracing method and system based on edge calculation
CN112202554B (en) Information processing method, device and equipment for generating key based on attribute of information
US11093565B2 (en) Methods and systems for identifying multiple devices belonging to a single user by merging deterministic and probabilistic data to generate a cross device data structure
CN111753324B (en) Private data processing method, private data computing method and applicable equipment
CN113760958B (en) Information query method, device, equipment and storage medium
EP1011223A1 (en) Method and system for creating and managing at least one cryptographic key
CN112199697A (en) Information processing method, device, equipment and medium based on shared root key
CN110008725B (en) User structured data processing system
CN116777476A (en) Medicine credible tracing method based on public key searchable encryption
CN114511265A (en) Tea production circulation tracing method and system based on logistics Internet of things and block chain
CN113792317A (en) Image encryption method and device
CN110245965B (en) Safety method for ice cream stick data processing system and ice cream stick with two-dimensional code
CN113239401A (en) Big data analysis system and method based on power Internet of things and computer storage medium
CN107229743B (en) Big data classification utilization method and system for business management
CN111143629A (en) Data storage, processing and acquisition method based on identification recognition and related device thereof
CN114422105A (en) Joint modeling method and device, electronic equipment and storage medium

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