A blockchain anti-counterfeiting traceability method, device, equipment and storage medium

By constructing a blockchain network and using dual-layer QR code technology, the problems of easily forged data source locations, lack of full-process supervision, and copyability of traceability codes in the traceability system have been solved. This has achieved the unforgeability of product locations and the anti-copying properties of traceability codes, ensuring the credibility and integrity of the traceability process.

CN116883016BActive Publication Date: 2026-06-05GUIZHOU UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUIZHOU UNIV
Filing Date
2023-07-17
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing traceability systems suffer from problems such as easily falsified data source locations, lack of end-to-end supervision, and the ability to copy traceability codes.

Method used

A blockchain network with three camp nodes is constructed. The national cryptographic SM2 and location signature algorithms are used to verify the product location information. The consensus is achieved through the PBFT algorithm and the chain is recorded. A unique QR code is generated using two-layer QR code technology for traceability.

Benefits of technology

It achieves the non-forgeability of product location, full-process supervision, and anti-copying of traceability codes, ensuring the credibility and integrity of the traceability process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116883016B_ABST
    Figure CN116883016B_ABST
Patent Text Reader

Abstract

The application discloses a blockchain anti-counterfeiting traceability method and device, equipment and a storage medium, a lightweight signature algorithm is designed based on the national secret SM2 and a position signature algorithm, the unforgeability of the position of a system participating entity is realized, traceability information is chained through a consensus algorithm of an improved PBFT algorithm, clear responsibility whole-process supervision is realized, and double-layer two-dimensional code technology is adopted to ensure that a traceability code is resistant to copying, so that the technical problems of easy forgery of a data source position of an existing traceability system, lack of whole-process supervision and copyability of a traceability code are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain traceability technology, and in particular to a blockchain anti-counterfeiting traceability method, device, equipment and storage medium. Background Technology

[0002] In recent years, with consumers placing greater emphasis on product safety and quality, and the frequent occurrence of product safety incidents, the establishment and application of product traceability systems have received increasing attention. Therefore, applying emerging big data technologies such as the Internet of Things (IoT), blockchain, and artificial intelligence to product traceability systems, through the establishment of multi-dimensional data models and intelligent algorithms, optimizes and improves the product circulation process, enhances product quality and safety, optimizes supply chain management, protects consumer health and rights, and promotes harmonious social development. Traditional traceability systems store product-related data in a centralized system, allowing system maintainers to modify traceability data at any time, resulting in poor data credibility. Blockchain technology, with its unique attributes of decentralization, immutability, and transparency, enables end-to-end traceability and immutability of the product lifecycle when applied to product traceability systems. Meanwhile, internet companies such as Huawei, Alibaba, JD.com, and 360 have provided numerous blockchain-based traceability services, promoting the application and development of blockchain traceability services.

[0003] While blockchain-based traceability systems offer advantages in providing traceability and data credibility, several security issues and risks remain, including:

[0004] 1) Data source location is easily forged: In a traceability system, the accuracy and reliability of the data source are crucial. However, hackers or malicious actors may forge data source location information to tamper with the source of traceability data, thereby undermining the credibility of the entire traceability process.

[0005] 2) Lack of end-to-end oversight: The security of a traceability system relies on the monitoring and control of the entire process. However, due to the complexity and fragmentation of the supply chain, comprehensive oversight of the entire process is difficult to achieve. This provides opportunities for criminals to potentially tamper with data or cover up violations at some point.

[0006] 3) Traceability codes can be copied: The core of a traceability system is the traceability code, which is used to identify and track the origin and flow of goods. However, the problem of copying and forging traceability codes still exists. Legitimate traceability codes can be copied and used on illegal products, thereby interfering with the normal operation of the traceability system.

[0007] Therefore, there is an urgent need for those skilled in the art to provide a blockchain-based anti-counterfeiting and traceability method to solve the aforementioned technical problems. Summary of the Invention

[0008] This application provides a blockchain anti-counterfeiting and traceability method, device, equipment, and storage medium, which solves the technical problems of existing traceability systems, such as the ease of forging data source locations, lack of full-process supervision, and the possibility of copying traceability codes.

[0009] In view of the above, the first aspect of this application provides a blockchain anti-counterfeiting and traceability method, the method comprising:

[0010] S1. Construct a blockchain network containing three camp nodes, which correspond to the participating entities in the production, circulation, and sales processes, respectively.

[0011] S2. The location information generated by the participating entities at different stages of the product is verified for authenticity based on the national cryptographic SM2 and location signature algorithm. If the verification is successful, the location information and certificate of the participating entities are uploaded to the blockchain network.

[0012] S3. When the product is in different stages, the corresponding camp nodes of the participating entities will put the corresponding stage information on the chain through the PBFT algorithm consensus.

[0013] S4. By using dual-layer QR code technology, the address of the traceability page generated based on the location information of the participating entities and the corresponding process information is embedded in the underlying QR code to generate a unique QR code, enabling users to achieve full-process traceability of the product by scanning the unique QR code.

[0014] Optionally, step S2 specifically includes:

[0015] Given a security parameter λ, using the basic parameters of the SM2 elliptic curve public-key cryptography algorithm, generate parameters (seed, a, b), where seed is a random number seed of not less than 192 bits, and 4a... 3 +27b 2 =0 (mod p), It is a prime number field, base point q is the order of the base point G. yes The set of all rational points on the elliptic curve E, where H is the SM3 hash algorithm, a collision-resistant hash function. The system common parameters are

[0016] Participating entity A randomly selects a number sk as its private key, where sk∈{1,2,…,q-1}, and its public key is pk=sk·G, with {pk,sk} serving as a partial key of A.

[0017] Another part requires participation from entity A and physical equipment unit DU. j ,j=1,2,3,4 The secure location protocol is executed to generate the key for the location, DU j{SK1,SK2,SK3,SK4,SK5,SK6} are shared via private channels, where DU j To verify the physical equipment located within a certain geographical range δ of participating entity A, SK i It is by DU j Randomly generated key X i ∈{0,1} n It is a random string with high minimum entropy, PRG:{0,1} n ×{0,1} m →{0,1} t It is a (ε,ψ)-safe BSM pseudo-random generator;

[0018] DU1 broadcasts M1 = {SK1, X4, SK'5} at time T-t1, DU2 broadcasts M2 = {X1, X4, SK'2, SK'6} at time T-t2, DU3 broadcasts M1 = {X3, SK'3} at time T-t3, and DU4 broadcasts M1 = {X3, SK'4} at time T-t4, where t j Indicates DU j Spread M j Time required to reach position δ;

[0019] At time T, participating entity A, located at position δ, simultaneously receives {M1, M2, M3, M4} and calculates using PRG. If A is located at position δ, the correct position key SK”6=SK6 can be calculated; otherwise, the position of A at δ is false.

[0020] Participating entity A will display its identity identifier (id) A Send to DU1, DU1 calculates. W = wG, k = H0(K6,W), V A =kG+W, h1=H(V) A ,id A ), Output (v) A ,W) and encrypt Send to A, and generate a certificate at the same time.

[0021] Participating entities A and DU j After location verification, SK'6 is generated. If SK'6 = SK6, it means that there is no location spoofing in participating entity A, and participating entity A calculates V'. A =H0(SK'6,W)G+W, if Participating entity A accepts a partial location private key v generated by DU1 A ;

[0022] Participating entity A is based on public-private key pairs (pk A ,sk A ), partial location public-private key pair (V' A ,v A Generate complete location public / private key pair

[0023] Entity A calculates Z sequentially. A =H(ENTL) A ||id A ||a||b||x G ||y G ||x A ||y A ), Generate random numbers C1 = k1·G, Output signature The message is sent to system B, which verifies the existence of the certificate sent by DU1 and decrypts it to extract V. A Decryption Extract V' A Verify V' A =V A If they are equal, proceed; otherwise, halt the protocol. If they are equal, continue calculating P'. A =V' A +pk A +h'1·pk DU , k' = (r' + s') mod q, R = (e' + x'1) mod q, and if R = r', then the verification passes.

[0024] Optionally, step S3 specifically includes:

[0025] Send by participating entities to the corresponding master nodes of the blockchain network<Request,c,o,t> A request is defined as follows: `c` represents the participant identifier, `t` represents the timestamp appended to the request, and `o` represents the request operation type. The request contains a message `m` and a message digest `d(m)`, where message `m` is specifically defined as `m < p`. id ,l o ,l a ,p s ,Cert>, where l o Indicates the longitude of the participating entities, l a p represents the dimension of the participating entity. s The product status is indicated by Cert, which indicates the location of the signing certificate of the participating entity.

[0026] The corresponding faction master node verifies whether the participant identifier 'c' in the request belongs to the corresponding participant. If it is an invalid request, it is discarded; otherwise, a number 'msg' is assigned to the request. i Sort and then broadcast. The message is sent to other replica nodes. The master node number is d, where d represents the message digest and m represents the message content.

[0027] Replica Node Upon receiving the master node After the broadcast Pre-prepare message, the signature verification of the Pre-prepare message by the master node and whether the current replica node received the message from the same master node are performed sequentially. The following number is msg i Furthermore, the message verification for d and the consistency verification between the digest values ​​of m and d are performed. If both are valid requests, then replica node n... i Send to other nodes Message and sign;

[0028] Master node and replica nodes Upon receiving the Prepare message, the signature verification of the Prepare message on the replica node is performed sequentially, as well as whether the current replica node received the message from the same master node. The following number is msg i Message verification, and l o l a Cert, whether the summary d matches the received Pre-prepare. o l a If the 'Cert' and 'Digest' are identical, and all are valid, the request is correct, and the replica node... If Nf verified Prepare messages are received, then send them to other nodes, including the master node. Message and sign;

[0029] Master node and replica nodes Upon receiving the Commit message, the following steps are performed sequentially: verifying the Commit message signature, and checking whether the current node has received the message from the same master node. The following message msg i The message verification, and the consistency verification between the Commit message digest d and m, are performed. If both are valid, the request is correct, and the node... The node receives N-2f verified commit messages. Execute the request operation o, upload the request information to the blockchain, and return. For the participating entity, r represents the return value of the requested operation;

[0030] If a participating entity receives f+1 identical Reply messages, the request has achieved network-wide consensus; otherwise, it resends the request to the master node.

[0031] Optionally, step S3 further includes:

[0032] Master node Data block b A After signing, you get s A , will s A Send it to synchronization node D, and at the same time package Nf Commit messages from different nodes and send them to D;

[0033] Synchronization node D receives s A Post-validation is The signature is checked, and it is verified whether Nf different nodes' Commit messages are satisfied. If successful, then s is processed. A Store in cache after signing;

[0034] Synchronization node D sorts the data blocks according to the block timestamps at preset intervals, packages and signs the data blocks within the preset time period, and sends them to the other two camp master nodes. The other two camp master nodes verify the signature and then sign and send it to their respective camp's replica nodes.

[0035] After receiving the message from the corresponding faction's master node, the other two faction replica nodes verify whether it is signed by the corresponding faction's master node. If the verification is successful, they receive the block set and upload the blocks in the set to the blockchain.

[0036] Optionally, step S4 specifically includes:

[0037] Based on the location information of the participating entity (the manufacturer) and the production process information, a traceability page is generated. The link address of the traceability page is embedded in the underlying QR code to generate a unique QR code, enabling users to achieve full-process traceability of the product by scanning the unique QR code.

[0038] Optionally, step S4 further includes:

[0039] The traceability page is updated based on the location information of the participating entities, which are either transporters or sellers, as well as information on the transportation or sales processes.

[0040] A second aspect of this application provides a blockchain anti-counterfeiting and traceability device, the device comprising:

[0041] The building unit is used to construct a blockchain network containing three camp nodes, which correspond to the participating entities in the production, circulation and sales processes, respectively.

[0042] The location verification unit is used to verify the authenticity of the location information generated by the participating entities at different stages of the product based on the national cryptographic SM2 and location signature algorithm. If the verification is successful, the location information and certificate of the participating entities are uploaded to the blockchain network.

[0043] The consensus-on-chain unit is used to ensure that participating entities and corresponding faction nodes upload relevant information to the blockchain through the PBFT algorithm at different stages of the product process.

[0044] The QR code traceability unit uses dual-layer QR code technology to embed the address of the traceability page generated based on the location information of the participating entities and the corresponding process information into the underlying QR code, generating a unique QR code that allows users to achieve full-process traceability of the product by scanning the unique QR code.

[0045] A third aspect of this application provides a blockchain anti-counterfeiting and traceability device, the device comprising a processor and a memory:

[0046] The memory is used to store program code and transmit the program code to the processor;

[0047] The processor is configured to execute the steps of the blockchain anti-counterfeiting and traceability method as described in the first aspect above, according to the instructions in the program code.

[0048] A fourth aspect of this application provides a computer-readable storage medium for storing program code for performing the steps of the blockchain anti-counterfeiting and traceability method described in the first aspect.

[0049] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0050] This application provides a blockchain anti-counterfeiting and traceability method, device, equipment, and storage medium. A lightweight signature algorithm is designed based on the national cryptographic SM2 and location signature algorithm to achieve the unforgeability of the location of the entities participating in the system. The traceability information is uploaded to the blockchain through an improved PBFT algorithm consensus, realizing full-process supervision with clear responsibilities. A double-layer QR code technology is used to ensure the traceability code is resistant to copying. This solves the technical problems of existing traceability systems, such as the ease of forging the data source location, the lack of full-process supervision, and the copyability of the traceability code. Attached Figure Description

[0051] Figure 1 This is a flowchart of the blockchain anti-counterfeiting and traceability method in the embodiments of this application;

[0052] Figure 2 This is a schematic diagram of the structure of the blockchain anti-counterfeiting and traceability device in the embodiments of this application;

[0053] Figure 3This is a schematic diagram of the structure of the blockchain anti-counterfeiting and traceability device in the embodiments of this application. Detailed Implementation

[0054] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0055] This application designs a blockchain anti-counterfeiting and traceability method, device, equipment, and storage medium, which solves the technical problems of existing traceability systems, such as the ease of forging data source locations, lack of full-process supervision, and the possibility of copying traceability codes.

[0056] For easier understanding, please refer to Figure 1 , Figure 1 This is a flowchart of the blockchain anti-counterfeiting and traceability method in the embodiments of this application, such as... Figure 1 As shown, specifically:

[0057] S1. Construct a blockchain network containing three camp nodes, which correspond to the participating entities in the production, circulation, and sales processes, respectively.

[0058] S2. The location information generated by the participating entities at different stages of the product is verified for authenticity based on the national cryptographic SM2 and location signature algorithm. If the verification is successful, the location information and certificate of the participating entities are uploaded to the blockchain network.

[0059] Specifically, it includes:

[0060] Given a security parameter λ, using the basic parameters of the SM2 elliptic curve public-key cryptography algorithm, generate parameters (seed, a, b), where seed is a random number seed of not less than 192 bits, and 4a... 3 +27b 2 =0 (mod p), It is a prime number field, base point q is the order of the base point G. yes The set of all rational points on the elliptic curve E, where H is the SM3 hash algorithm, a collision-resistant hash function. The system common parameters are

[0061] Participating entity A randomly selects a number sk as its private key, where sk∈{1,2,…,q-1}, and its public key is pk=sk·G, with {pk,sk} serving as a partial key of A.

[0062] Another part requires participation from entity A and physical equipment unit DU. j ,j=1,2,3,4 The secure location protocol is executed to generate the key for the location, DU j {SK1,SK2,SK3,SK4,SK5,SK6} are shared via private channels, where DU j To verify the physical equipment located within a certain geographical range of participating entity A, SK i It is by DU j Randomly generated key X i ∈{0,1} n It is a random string with high minimum entropy, PRG:{0,1} n ×{0,1} m →{0,1} t It is a (ε,ψ)-safe BSM pseudo-random generator;

[0063] DU1 broadcasts M1 = {SK1, X4, SK'5} at time T-t1, DU2 broadcasts M2 = {X1, X4, SK'2, SK'6} at time T-t2, DU3 broadcasts M1 = {X3, SK'3} at time T-t3, and DU4 broadcasts M1 = {X3, SK'4} at time T-t4, where t j Indicates DU j Spread M j Time required to reach position δ;

[0064] At time T, participating entity A, located at position δ, simultaneously receives {M1, M2, M3, M4} and calculates using PRG. If A is located at position δ, the correct position key SK”6=SK6 can be calculated; otherwise, the position of A at δ is false.

[0065] Participating entity A will display its identity identifier (id) A Send to DU1, DU1 calculates. W = wG, k = H0(K6,W), V A =kG+W, h1=H(V) A ,id A ), Output (v) A ,W) and encrypt Send to A, and generate a certificate at the same time.

[0066] Participating entities A and DU jAfter location verification, SK'6 is generated. If SK'6 = SK6, it means that there is no location spoofing in participating entity A, and participating entity A calculates V'. A =H0(SK'6,W)G+W, if Participating entity A accepts a partial location private key v generated by DU1 A ;

[0067] Participating entity A is based on public-private key pairs (pk A ,sk A ), partial location public-private key pair (V' A ,v A Generate complete location public / private key pair

[0068] Entity A calculates Z sequentially. A =H(ENTL) A ||id A ||a||b||x G ||y G ||x A ||y A ), Generate random numbers C1 = k1·G, Output signature The message is sent to system B, which verifies the existence of the certificate sent by DU1 and decrypts it to extract V. A Decryption Extract V' A Verify V' A =V A If they are equal, proceed; otherwise, halt the protocol. If they are equal, continue calculating P'. A =V' A +pk A +h'1·pk DU , k' = (r' + s') mod q, R = (e' + x'1) mod q, and if R = r', then the verification passes.

[0069] S3. When the product is in different stages, the corresponding camp nodes of the participating entities will put the corresponding stage information on the chain through the PBFT algorithm consensus.

[0070] Specifically, it includes:

[0071] The participating entity sends a <Request, c, o, t> request to the corresponding camp master node in the blockchain network, where c represents the identifier of the participating entity, t represents the timestamp to be appended to the request, o represents the type of request operation, Request contains the message m and the message digest d(m), and the message m is specifically m < p id , l o , l a , p s , Cert>, where l o represents the longitude of the participating entity, l a represents the latitude of the participating entity, p s represents the product status, and Cert represents the location signature certificate of the participating entity;

[0072] The corresponding camp master node verifies whether the participating entity identifier c in the request is the corresponding participating entity. If it is an illegal request, it is discarded; otherwise, a number msg is assigned to this request i and sorted, and then broadcast the message to other replica nodes, where is the master node number, d represents the message digest, and m represents the message content;

[0073] Replica node After receiving the Pre-prepare message broadcast by the master node, successively perform signature verification of the master node's Pre-prepare message, whether the current replica node has received the same master node with the number msg and a message verification with a different d, as well as a verification of whether the digest value of m and d is consistent. If all are correct requests, then the replica node n i sends a i message to other nodes and signs it;

[0074] Master node and replica node After receiving the Prepare message, successively perform signature verification of the Prepare message of the replica node, whether the current replica node has received the same master node with the number msg i of the message verification, and whether l o , l a , Cert, and the digest d are the same as those in the received Pre-prepare's l o , l a , Cert, and digest d verification. If all are correct requests, and the replica node has received N - f verified Prepare messages, then send a message to other nodes including the master node and sign it; ​

[0075] Master node and replica nodes Upon receiving the Commit message, the following steps are performed sequentially: verifying the Commit message signature, and checking whether the current node has received the message from the same master node. The following message msg i The message verification, and the consistency verification between the Commit message digest d and the digest of m, are performed. If both are valid, the request is correct, and the node... The node receives N-2f verified commit messages. Execute the request operation o, upload the request information to the blockchain, and return. For the participating entity, r represents the return value of the requested operation;

[0076] If a participating entity receives f+1 identical Reply messages, the request has achieved network-wide consensus; otherwise, it resends the request to the master node.

[0077] Optionally, step S3 further includes:

[0078] Master node Data block b A After signing, you get s A , will s A Send it to synchronization node D, and at the same time package Nf Commit messages from different nodes and send them to D;

[0079] Synchronization node D receives s A Post-validation is The signature is checked, and it is verified whether Nf different nodes' Commit messages are satisfied. If successful, then s is processed. A Store in cache after signing;

[0080] Synchronization node D sorts the data blocks according to the block timestamps at preset intervals, packages and signs the data blocks within the preset time period, and sends them to the other two camp master nodes. The other two camp master nodes verify the signature and then sign and send it to their respective camp's replica nodes.

[0081] After receiving the message from the corresponding faction's master node, the other two faction replica nodes verify whether it is signed by the corresponding faction's master node. If the verification is successful, they receive the block set and upload the blocks in the set to the blockchain.

[0082] It should be noted that, firstly, a multi-node consortium blockchain is built based on open-source platforms such as FISCO BCOS and Ethereum. The blockchain nodes are divided into three camps according to their regulatory status. Then, a master node is selected from each camp to facilitate data exchange between camps. The remaining nodes in each camp serve as replica nodes and jointly maintain a single blockchain. The three camps are abbreviated as Camp A, Camp B, and Camp C. Camps A, B, and C each conduct their own consensus processes. Camp A is responsible for consensus on product production information, Camp B for transportation information, and Camp C for sales information.

[0083] When the product is in transit, faction B is responsible for executing consensus steps similar to those described above to upload the data block to the blockchain. When the product is in the sales phase, faction C completes the consensus and uploads the data to the blockchain. When a user scans the product code for traceability, the system uses the received unique product identifier p... id The system retrieves the block address and returns the product's production and distribution information for traceability. If the product is found to be without issue, the C camp reaches a consensus on the product's status and uploads it to the blockchain. Finally, since each message sent by a camp's master node is signed, this means that if a problem arises at any stage of the product's lifecycle, each camp's master node will conduct a traceability search based on its own camp's storage blocks, examine the product's status at each timestamp, and hold the responsible entity accountable for that stage's parameters.

[0084] S4. By using dual-layer QR code technology, the address of the traceability page generated based on the location information of the participating entities and the corresponding process information is embedded in the bottom layer QR code to generate a unique QR code, enabling users to achieve full-process traceability of the product by scanning the unique QR code.

[0085] Specifically, it includes:

[0086] Based on the location information of the participating entity (the manufacturer) and the production process information, a traceability page is generated. The link address of the traceability page is embedded in the underlying QR code to generate a unique QR code, enabling users to achieve full-process traceability of the product by scanning the unique QR code.

[0087] Optionally, step S4 further includes:

[0088] The traceability page is updated based on the location information of the participating entities, which are either transporters or sellers, as well as information on the transportation or sales processes.

[0089] It should be noted that, firstly, a product details page is generated, which includes the product name, detailed display images, specifications, price, generation location information, sales stores, etc., and the link to this page is embedded in the surface QR code.

[0090] In addition, this system will generate a "bottle-box-carton" QR code that corresponds one-to-one with the product, and the generated QR code has unique identification. When the user scans the code, a request is sent to compare the product identification with the database. If the comparison is successful, detailed product information is returned; if it fails, an error message indicating that the product is counterfeit or substandard is returned. This allows users to obtain relevant product information by scanning the code on their mobile devices and complete the product display.

[0091] Using dual-layer QR code technology, key information from each production stage, including raw materials, production, processing, and packaging, is used to generate an original traceability page. The address of this original traceability page is embedded in the underlying QR code. When the product is in transit, the system obtains the geographical location information of the logistics entity and enters it into the database. The system updates the original traceability page in real time and adds transportation information. When the product is in the sales stage, the system obtains the geographical location information of the sales entity and enters it into the database. The system updates the traceability page in real time and adds sales information.

[0092] The system records QR code scanning records and updates the traceability page. When users scan the QR code with their mobile devices, the system displays the product's full-process traceability information and the number of times the product has been scanned, thus achieving effective anti-counterfeiting and traceability of the product.

[0093] Please see Figure 2 , Figure 2 This is a schematic diagram of the blockchain anti-counterfeiting and traceability device in the embodiments of this application, such as... Figure 2 As shown, specifically:

[0094] Building unit 201 is used to build a blockchain network containing three camp nodes, which correspond to the participating entities in the production, circulation and sales links respectively.

[0095] The location verification unit 202 is used to verify the authenticity of the location information generated by the participating entities at different stages of the product based on the national cryptographic SM2 and the location signature algorithm. If the verification is successful, the location information and certificate of the participating entities are uploaded to the blockchain network.

[0096] Consensus on-chain unit 203 is used to ensure that participating entities and corresponding camp nodes upload the corresponding information to the blockchain through the PBFT algorithm at different stages of the product process.

[0097] The QR code traceability unit 204 is used to embed the address of the traceability page generated based on the location information of the participating entities and the corresponding process information into the underlying QR code through double-layer QR code technology, thereby generating a unique QR code that allows users to achieve full-process traceability of the product by scanning the unique QR code.

[0098] This application also provides another blockchain anti-counterfeiting and traceability device, such as... Figure 3As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. The terminal can be any terminal device including mobile phones, tablets, personal digital assistants (PDAs), point-of-sales terminals (POS), in-vehicle computers, etc. Taking a mobile phone as an example:

[0099] Figure 3 This is a block diagram illustrating a portion of the structure of a mobile phone related to the terminal provided in the embodiments of this application. (Reference) Figure 3 The mobile phone includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090, etc. Those skilled in the art will understand that... Figure 3 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0100] The following is combined Figure 3 A detailed introduction to each component of a mobile phone:

[0101] The RF circuit 1010 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 1080; additionally, it transmits uplink data to the base station. Typically, the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 1010 can also communicate wirelessly with networks and other devices. The aforementioned wireless communications may use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).

[0102] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0103] The input unit 1030 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1031), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1080, and can also receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1031, the input unit 1030 may also include other input devices 1032. Specifically, other input devices 1032 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0104] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1040 may include a display panel 1041, which may optionally be configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 1041. Further, a touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits the information to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides corresponding visual output on the display panel 1041 according to the type of touch event. Although in Figure 3 In this embodiment, the touch panel 1031 and the display panel 1041 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.

[0105] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1041 according to the ambient light level, and the proximity sensor can turn off the display panel 1041 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

[0106] The audio circuit 1060, speaker 1061, and microphone 1062 provide an audio interface between the user and the mobile phone. The audio circuit 1060 converts the received audio data into electrical signals and transmits them to the speaker 1061, where the speaker 1061 converts them into sound signals for output. On the other hand, the microphone 1062 converts the collected sound signals into electrical signals, which are then received by the audio circuit 1060, converted into audio data, and then processed by the processor 1080 before being transmitted via the RF circuit 1010 to, for example, another mobile phone, or the audio data can be output to the memory 1020 for further processing.

[0107] WiFi is a short-range wireless transmission technology. Through the WiFi module 1070, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 3 The WiFi module 1070 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.

[0108] The processor 1080 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 1020 and calls data stored in the memory 1020 to perform various functions and process data, thereby providing overall monitoring of the phone. Optionally, the processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1080.

[0109] The mobile phone also includes a power supply 1090 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1080 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0110] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.

[0111] In this embodiment of the application, the processor 1080 included in the terminal also has the following functions:

[0112] S1. Construct a blockchain network containing three camp nodes, which correspond to the participating entities in the production, circulation, and sales processes, respectively.

[0113] S2. The location information generated by the participating entities at different stages of the product is verified for authenticity based on the national cryptographic SM2 and location signature algorithm. If the verification is successful, the location information and certificate of the participating entities are uploaded to the blockchain network.

[0114] S3. When the product is in different stages, the corresponding camp nodes of the participating entities will put the corresponding stage information on the chain through the PBFT algorithm consensus.

[0115] S4. By using dual-layer QR code technology, the address of the traceability page generated based on the location information of the participating entities and the corresponding process information is embedded in the underlying QR code to generate a unique QR code, enabling users to achieve full-process traceability of the product by scanning the unique QR code.

[0116] This application also provides a computer-readable storage medium for storing program code, which is used to execute any one of the implementation methods of the blockchain anti-counterfeiting and traceability method described in the foregoing embodiments.

[0117] This application provides a blockchain anti-counterfeiting and traceability method, device, equipment, and storage medium. A lightweight signature algorithm is designed based on the national cryptographic SM2 and location signature algorithm to achieve the unforgeability of the location of participating entities in the system. The traceability information is uploaded to the blockchain through an improved PBFT algorithm consensus, realizing full-process supervision with clear responsibilities. A double-layer QR code technology is used to ensure the traceability code is resistant to copying, solving the technical problems of existing traceability systems where the data source location is easily forged, lacks full-process supervision, and the traceability code can be copied.

[0118] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0119] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0120] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0121] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0122] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0123] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0124] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0125] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A blockchain-based anti-counterfeiting and traceability method, characterized in that, include: S1. Construct a blockchain network containing three camp nodes, which correspond to the participating entities in the production, circulation, and sales processes, respectively. S2. The location information generated by the participating entities at different stages of the product is verified for authenticity based on the national cryptographic SM2 and location signature algorithm. If the verification is successful, the location information and certificate of the participating entities are uploaded to the blockchain network. Step S2 specifically includes: Given security parameters Using the basic parameters of the SM2 elliptic curve public-key cryptography algorithm (a national standard cryptographic algorithm), parameters are generated. ,in A random number seed of at least 192 bits. , It is a prime number field, base point , It is the base point The rank, yes Upper Elliptic Curve The set of all rational points, for A hash algorithm, a collision-resistant hash function, with the following system public parameters: ; Participating entities Random number selection As a private key, The public key is , As Part of the key; Another part requires participation from entities With physical device unit Execute the secure location protocol to generate the key for the location. Shared via private channel ,in, To verify participating entities Geographical location Physical equipment within a certain range It is by Randomly generated key , , It is a random string with high minimum entropy. yes A secure BSM pseudo-random generator; At any moment broadcast , At any moment broadcast , At any moment broadcast , At any moment broadcast ,in express spread Arrive at the location Time required; exist At any time, in a location Participating entities Received at the same time And calculated using PRG , , , , ,if Located in Then the correct location key can be calculated. ,otherwise Location It is false; Participating entities Identify your identity Send to , calculate , , , , , Output And encrypt Send to At the same time, generate a certificate ; Participating entities and Generate after location verification ,if This indicates the participating entity. There is no location spoofing, and the participating entities calculate ,if Participating entities Accept the generated partial location private key ; Participating entities Based on public-private key pairs Partial location public / private key pairs Generate complete location public / private key pair , , ; Participating entities Calculate in sequence , , Generate random numbers , , , Output signature Send to system ,Depend on Verify existence Send certificate and decrypt to extract Decryption ,extract verify If they are equal, proceed to the next step; otherwise, stop the protocol and continue calculation. , , , , , ,if The verification passed. S3. When the product is in different stages, the corresponding camp nodes of the participating entities will put the corresponding stage information on the chain through the PBFT algorithm consensus. Step S3 specifically includes: Send by participating entities to the corresponding master nodes of the blockchain network Request, in which Indicates the identifier of the participating entity. This indicates a request to append a timestamp. Indicates the type of request operation. Contains messages and message digest ,information Specifically ,in Indicates the longitude of the participating entities. Indicates the dimensions of the participating entities. Indicates product status. Indicates the location of the participating entity's signature certificate; Participating entity identifier in the corresponding faction master node verification request If the request is from the corresponding participating entity, it is discarded if it is invalid; otherwise, a number is assigned to the request and it is sorted before being broadcast. The message is sent to other replica nodes. Master node number, Indicates a message summary. Indicates the message content; Replica Node Upon receiving the master node Broadcast After the message, the master node will proceed sequentially. Message signature verification, whether the current replica node received the message from the same master node. The following number is and Different message validations, and and The digest values ​​are checked for consistency. If both are correct, the replica node... Send to other nodes Message and sign; Master node and replica nodes receive Following the message, the replica nodes will proceed sequentially. Message signature verification, whether the current replica node received the message from the same master node. The following number is Message verification, and , , ,summary Is it consistent with what has already been received? In , , ,summary If all requests are valid and the replica nodes are correct, then the same verification is performed. received One verified The message is then sent to other nodes, including the master node. Message and sign; Master node and replica nodes receive After the message, proceed in sequence. Message signature verification, whether the current node received the message from the same master node. The following message Message verification, and Message Summary and The digests are checked for consistency. If both are valid requests, and the nodes... receive One verified Messages, Nodes Execute the requested operation And upload the requested information to the blockchain, and return it. For the participating entities, Indicates the return value of the requested operation; If the participating entities receive The same The message indicates that the request has achieved network-wide consensus; otherwise, the request will be resent to the master node. ; S4. By using dual-layer QR code technology, the address of the traceability page generated based on the location information of the participating entities and the corresponding process information is embedded in the underlying QR code to generate a unique QR code, enabling users to achieve full-process traceability of the product by scanning the unique QR code.

2. The blockchain anti-counterfeiting and traceability method according to claim 1, characterized in that, Step S3 further includes: Master node data blocks Sign it ,Will Send to synchronization node At the same time Different nodes Send message package ; Synchronization Node receive Post-validation is The signature, and verify whether it satisfies Different nodes If the message is approved, then... Store in cache after signing; Synchronization Node Every preset time interval, data blocks within the preset time period are sorted according to their timestamps, packaged, signed, and sent to the other two master nodes. The other two master nodes verify the signature and then sign and send it to their respective replica nodes. After receiving the message from the corresponding faction's master node, the other two faction replica nodes verify whether it is signed by the corresponding faction's master node. If the verification is successful, they receive the block set and upload the blocks in the set to the blockchain.

3. The blockchain anti-counterfeiting and traceability method according to claim 1, characterized in that, Step S4 specifically includes: Based on the location information of the participating entity (the manufacturer) and the production process information, a traceability page is generated. The link address of the traceability page is embedded in the underlying QR code to generate a unique QR code, enabling users to achieve full-process traceability of the product by scanning the unique QR code.

4. The blockchain anti-counterfeiting and traceability method according to claim 3, characterized in that, Step S4 further includes: The traceability page is updated based on the location information of the participating entities, which are either transporters or sellers, as well as information on the transportation or sales processes.

5. A blockchain anti-counterfeiting and traceability device, characterized in that, include: The building unit is used to construct a blockchain network containing three camp nodes, which correspond to the participating entities in the production, circulation and sales processes, respectively. The location verification unit is used to verify the authenticity of the location information generated by the participating entities at different stages of the product based on the national cryptographic SM2 and location signature algorithm. If the verification is successful, the location information and certificate of the participating entities are uploaded to the blockchain network. The position verification unit is specifically used for: Given security parameters Using the basic parameters of the SM2 elliptic curve public-key cryptography algorithm (a national standard cryptographic algorithm), parameters are generated. ,in A random number seed of at least 192 bits. It is the prime field, the base point , It is the base point The rank, yes Upper Elliptic Curve The set of all rational points, for Hash algorithm, a collision-resistant hash function The system common parameters are ; Participating entities Choose any random number as the private key, where The public key is , As Part of the key; Another part requires participation from entities With physical device unit Execute the secure location protocol to generate the key for the location. Shared via private channel ,in, To verify participating entities Geographical location Physical equipment within a certain range It is by Randomly generated key , , It is a random string with high minimum entropy. yes A secure BSM pseudo-random generator; At any moment broadcast , At any moment broadcast , At any moment broadcast , At any moment broadcast ,in express spread Arrive at the location Time required; exist At any time, in a location Participating entities Received at the same time And calculated using PRG , , , , ,if Located in Then the correct location key can be calculated. ,otherwise Location It is false; Participating entities Identify your identity Send to , calculate , , , , , Output And encrypt Send to At the same time, generate a certificate ; Participating entities and Generate after location verification ,if This indicates the participating entity. There is no location spoofing, and the participating entities calculate ,if Participating entities accept Generated partial location private key ; Participating entities Based on public-private key pairs Partial location public / private key pairs Generate complete location public / private key pair , , ; Participating entities Calculate in sequence , , Generate random numbers , , , Output signature Send to system ,Depend on Verify existence Send certificate and decrypt to extract Decryption ,extract verify If they are equal, proceed to the next step; otherwise, stop the protocol and continue calculation. , , , , , ,if The verification passed. The consensus-on-chain unit is used to ensure that participating entities and corresponding faction nodes upload relevant information to the blockchain through the PBFT algorithm at different stages of the product process. The consensus on-chain unit is specifically used for: Send by participating entities to the corresponding master nodes of the blockchain network Request, in which Indicates the identifier of the participating entity. This indicates a request to append a timestamp. Indicates the type of request operation. Contains messages and message summary ,information Specifically ,in Indicates the longitude of the participating entities. Indicates the dimensions of the participating entities. Indicates product status. Indicates the location of the participating entity's signature certificate; Participating entity identifier in the corresponding faction master node verification request If the request is from the corresponding participating entity, it is discarded if it is invalid; otherwise, a number is assigned to the request. Sort and then broadcast. The message is sent to other replica nodes. Master node number, Indicates a message summary. Indicates the message content; Replica Node Upon receiving the master node Broadcast After the message, the master node will proceed sequentially. Message signature verification, whether the current replica node received the message from the same master node. The following number is and Different message validations, and and The digest values ​​are checked for consistency. If both are correct, the replica node... Send to other nodes Message and sign; Master node and replica nodes receive Following the message, the replica nodes will proceed sequentially. Message signature verification, whether the current replica node received the message from the same master node. The following number is Message verification, and , , ,summary Is it consistent with what has already been received? In , , ,summary If all requests are valid and the replica nodes are correct, then the same verification is performed. received One verified The message is then sent to other nodes, including the master node. Message and sign; Master node and replica nodes receive After the message, proceed in sequence. Message signature verification, whether the current node received the message from the same master node. The following message Message verification, and Message Summary and The digests are checked for consistency. If both are valid requests, and the nodes... receive One verified Messages, Nodes Execute the requested operation And upload the requested information to the blockchain, and return it. For the participating entities, Indicates the return value of the requested operation; If the participating entities receive The same The message indicates that the request has achieved network-wide consensus; otherwise, the request will be resent to the master node. ; The QR code traceability unit uses dual-layer QR code technology to embed the address of the traceability page generated based on the location information of the participating entities and the corresponding process information into the underlying QR code, generating a unique QR code that allows users to achieve full-process traceability of the product by scanning the unique QR code.

6. A blockchain anti-counterfeiting and traceability device, characterized in that, The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the blockchain anti-counterfeiting and traceability method according to any one of claims 1-4 according to the instructions in the program code.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program code, which is used to execute the blockchain anti-counterfeiting and traceability method according to any one of claims 1-4.