Blockchain-based product data traceability method and device, storage medium and node
By using a blockchain-based product data traceability method, which generates ID bitmaps using short text matching models and hash functions, the problem of product data traceability in complex environments with multiple systems in the industrial internet is solved. This enables refined querying and data traceability, while reducing the storage pressure on the blockchain network.
Patent Information
- Application Number
- CN202210878597.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-25
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-07-25
AI Technical Summary
In the field of industrial internet, how to design a multi-level, reliable product traceability solution applicable to multiple systems to solve the data traceability problem caused by the wide variety of industrial products and the complexity of processing links?
A blockchain-based product data traceability method is adopted. Through nodes in the blockchain network, an ID bitmap is generated using a short text matching model and a hash function to achieve refined traceability query of the product data structure. It is compatible with different identity systems and data storage methods, ensuring the traceability and immutability of the data.
It enables more refined product data traceability and query, meeting users' precise needs, while avoiding the storage pressure of large data volumes on the blockchain network and reducing network load.
Smart Images

Figure CN115330405B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of blockchain technology, and in particular to a product data traceability method, device, storage medium and node based on blockchain. Background Technology
[0002] Product data traceability refers to using identification technology to query the data status of a product at any stage throughout its entire lifecycle. The product lifecycle includes, but is not limited to, stages such as raw material / component procurement, manufacturing / assembly, warehousing, distribution, logistics, market inspection, resale, use, recycling, and disposal. The purpose of product data traceability is to comprehensively record product information data, promote effective information sharing between internal enterprise information systems, between enterprises, and between enterprises and users, and improve the enterprise's networking and intelligent capabilities.
[0003] However, in the field of Industrial Internet (i.e., new infrastructure, application models and industrial ecosystems that deeply integrate the next generation of information and communication technologies with the industrial economy), due to the wide variety of industrial products and the complexity of processing links, how to design a multi-level, multi-system, and application-specific reliable traceability solution is a major challenge facing the development of product traceability systems in the Industrial Internet field. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this disclosure provides a product data traceability method, device, storage medium and node based on blockchain.
[0005] According to a first aspect of the present disclosure, a product data traceability method based on blockchain is provided. The method is applied to any node in a blockchain network, wherein the node stores a product data structure uploaded by a data provider. The method includes:
[0006] In response to receiving a product traceability query request initiated by a data query party for a first product, the corresponding first product data structure is determined based on the first ID in the product traceability query request.
[0007] Based on the second ID in the forward correlation data field of the first product data structure, determine the forward traceability product data structure that corresponds to the second ID and represents the product data structure related to the first product data structure.
[0008] Based on the search conditions in the product traceability query request, the target forward traceability product data structure is selected from the forward traceability product data structure;
[0009] At least based on the target forward traceability product data structure, product traceability query results are generated.
[0010] Optionally, the method further includes:
[0011] Determine that the forward-related data fields include at least one backward-traceable product data structure containing the second ID;
[0012] Based on the search criteria, the target backward traceability product data structure is selected from the backward traceability product data structure;
[0013] The generation of product traceability query results based at least on the target forward traceability product data structure includes:
[0014] The product traceability query results are generated based on the target forward traceability product data structure and the target backward traceability product data structure.
[0015] Optionally, the search criteria include search text input by the data query party to describe the sub-products in the first product, each product data structure includes a product description field, and the step of filtering the target forward traceability product data structure from the forward traceability product data structure based on the search criteria in the product traceability query request includes:
[0016] The target product description field in the forward traceability product data structure is converted into a first product description matrix, and the search text is converted into a first search text matrix.
[0017] Input the first product description matrix and the first search text matrix into the trained short text matching model to obtain the model output result that represents whether the target product description field matches the search text;
[0018] If the model output indicates that the target product description field matches the search text, the forward traceability product data structure is determined as the target forward traceability product data structure.
[0019] Optionally, the trained short text matching model includes, in sequence, an attention interaction layer, a self-attention layer, a first normalization processing layer, a feedforward neural network layer, a second normalization processing layer, a max pooling layer, and a Softmax classification layer.
[0020] The attention interaction layer is used for:
[0021] Calculate the interaction matrix based on the first product description matrix and the first search text matrix;
[0022] For each row of the interaction matrix, perform max pooling to obtain the first weight vector;
[0023] For each column of the interaction matrix, perform max pooling to obtain the second weight vector;
[0024] Calculate the product of the first product description matrix and the first weight vector to obtain the second product description matrix;
[0025] The second retrieval text matrix is obtained by multiplying the first retrieval text matrix and the second weight vector.
[0026] Optionally, the second normalization layer is used for:
[0027] The third product description matrix is normalized to obtain the normalized fourth product description matrix. The third product description matrix is obtained by processing the second product description matrix sequentially through the self-attention layer, the first normalization layer, and the feedforward neural network layer.
[0028] The third search text matrix is normalized to obtain a normalized fourth search text matrix. The third search text matrix is obtained by processing the second search text matrix sequentially through the self-attention layer, the first normalization layer, and the feedforward neural network layer.
[0029] Optionally, the max pooling layer is used to perform max pooling operation on the fourth product description matrix to obtain a product description vector, and to perform max pooling operation on the fourth retrieval text matrix to obtain a retrieval text vector.
[0030] The Softmax classification layer is used to concatenate the product description vector, the search text vector, the sum of the product description vector and the search text vector, and the subtraction between the product description vector and the search text vector to obtain a concatenated vector, and then perform classification mapping based on the concatenated vector to obtain the model output result.
[0031] Optionally, the method further includes:
[0032] Upon receiving the product data structure uploaded by the data provider, an ID bitmap of a preset length is generated based on the ID field in the product data structure and a preset number of hash functions; and
[0033] Determine the set of forward ID bitmaps corresponding to all forward IDs in the forward related data fields of the product data structure, and establish the correspondence between the product data structure and the set of forward ID bitmaps.
[0034] Optionally, the determination of the forward correlation data field including at least one backward traceability product data structure of the second ID includes:
[0035] For each of the second IDs, determine the second ID bitmap corresponding to the second ID;
[0036] In any of the product data structures corresponding to the forward ID bitmap set, if a target forward ID bitmap exists, then the product data structure is determined as the backward traceability product data structure. The target forward ID bitmap refers to the forward ID bitmap obtained by performing a bitwise XOR operation with the second ID bitmap, where each bit in the resulting bitmap is 0.
[0037] Optionally, the method further includes:
[0038] Upon receiving the product data structure uploaded by the data provider, a data provider location map of the preset length is generated based on the data provider field in the product data structure and the preset number of hash functions.
[0039] Determine the set of upstream data provider location maps corresponding to all upstream data providers in the upstream data provider field of the product data structure, and establish the correspondence between the product data structure and the set of upstream data provider location maps.
[0040] Optionally, the determination of the forward correlation data field including at least one backward traceability product data structure of the second ID includes:
[0041] For each of the second IDs, determine the second ID bitmap corresponding to the second ID;
[0042] Determine the second data provider location map corresponding to the data provider field in the second product data structure corresponding to the second ID;
[0043] In any of the product data structures corresponding to the set of forward ID bitmaps, if a target forward ID bitmap exists, the product data structure is determined as a candidate backward traceability product data structure. The target forward ID bitmap refers to the forward ID bitmap obtained by performing a bitwise XOR operation with the second ID bitmap, where each bit in the resulting bitmap is 0.
[0044] If a target upstream data provider location map exists in the set of upstream data provider location maps corresponding to the candidate backward traceability product data structure, then the candidate backward traceability product data structure is determined as the backward traceability product data structure. The target upstream data provider location map refers to the upstream data provider location map in which each bit is 0 in the resulting bit map after performing a bitwise XOR operation with the second data provider location map.
[0045] Optionally, each of the product data structures includes a data entity storage address field, and generating product traceability query results based at least on the target forward traceability product data structure includes:
[0046] The product traceability query result is generated based at least on the data entity storage address field in the target forward traceability product data structure.
[0047] According to a second aspect of the present disclosure, a product data traceability device based on blockchain is provided. The device is applied to any node in a blockchain network, wherein the node stores a product data structure uploaded by a data provider. The device includes:
[0048] The response module is used to respond to a product traceability query request initiated by a data query party for the first product, and to determine the corresponding first product data structure based on the first ID in the product traceability query request.
[0049] The first determining module is used to determine, based on the second ID in the forward related data field of the first product data structure, the forward traceability product data structure corresponding to the second ID that represents the product data structure related to the first product data structure.
[0050] The first filtering module is used to filter out the target forward traceability product data structure from the forward traceability product data structure based on the search conditions in the product traceability query request.
[0051] The first generation module is used to generate product traceability query results based at least on the target forward traceability product data structure.
[0052] Optionally, the device further includes:
[0053] The second determining module is used to determine that the forward related data field includes at least one backward traceability product data structure containing the second ID;
[0054] The second filtering module is used to filter out the target backward traceability product data structure from the backward traceability product data structure based on the search conditions.
[0055] The first generation module includes:
[0056] The first generation submodule generates the product traceability query result based on the target forward traceability product data structure and the target backward traceability product data structure.
[0057] Optionally, the search criteria include search text input by the data querying party to describe the sub-products in the first product, each product data structure includes a product description field, and the first filtering module includes:
[0058] The first conversion submodule is used to convert the target product description field in the forward traceability product data structure into a first product description matrix and the search text into a first search text matrix.
[0059] The input submodule is used to input the first product description matrix and the first search text matrix into the trained short text matching model to obtain the model output result representing whether the target product description field matches the search text;
[0060] The first determining submodule is used to determine the forward traceability product data structure as the target forward traceability product data structure when the model output result indicates that the target product description field matches the search text.
[0061] Optionally, the trained short text matching model includes, in sequence, an attention interaction layer, a self-attention layer, a first normalization processing layer, a feedforward neural network layer, a second normalization processing layer, a max pooling layer, and a Softmax classification layer.
[0062] The attention interaction layer is used for:
[0063] Calculate the interaction matrix based on the first product description matrix and the first search text matrix;
[0064] For each row of the interaction matrix, perform max pooling to obtain the first weight vector;
[0065] For each column of the interaction matrix, perform max pooling to obtain the second weight vector;
[0066] Calculate the product of the first product description matrix and the first weight vector to obtain the second product description matrix;
[0067] The second retrieval text matrix is obtained by multiplying the first retrieval text matrix and the second weight vector.
[0068] Optionally, the second normalization layer is used for:
[0069] The third product description matrix is normalized to obtain the normalized fourth product description matrix. The third product description matrix is obtained by processing the second product description matrix sequentially through the self-attention layer, the first normalization layer, and the feedforward neural network layer.
[0070] The third search text matrix is normalized to obtain a normalized fourth search text matrix. The third search text matrix is obtained by processing the second search text matrix sequentially through the self-attention layer, the first normalization layer, and the feedforward neural network layer.
[0071] Optionally, the max pooling layer is used to perform max pooling operation on the fourth product description matrix to obtain a product description vector, and to perform max pooling operation on the fourth retrieval text matrix to obtain a retrieval text vector.
[0072] The Softmax classification layer is used to concatenate the product description vector, the search text vector, the sum of the product description vector and the search text vector, and the subtraction between the product description vector and the search text vector to obtain a concatenated vector, and then perform classification mapping based on the concatenated vector to obtain the model output result.
[0073] Optionally, the device further includes:
[0074] The second generation module is used to generate an ID bitmap of a preset length based on the ID field in the product data structure and a preset number of hash functions when the product data structure is received from the data provider.
[0075] The first execution module is used to determine the set of forward ID bitmaps corresponding to all forward IDs in the forward related data fields of the product data structure, and to establish the correspondence between the product data structure and the set of forward ID bitmaps.
[0076] Optionally, the second determining module includes:
[0077] The second determining submodule is used to determine the second ID bitmap corresponding to each second ID;
[0078] The third determining submodule is used to determine the product data structure as the backward traceability product data structure if a target forward ID bitmap exists in the forward ID bitmap set corresponding to any of the product data structures. The target forward ID bitmap refers to the forward ID bitmap in the result bitmap where each bit is 0 after performing a bitwise XOR operation with the second ID bitmap.
[0079] Optionally, the device further includes:
[0080] The third generation module is used to generate a data provider orientation map of a preset length based on the data provider field in the product data structure and the preset number of hash functions when the product data structure is received from the data provider.
[0081] The second execution module is used to determine the set of upstream data provider location maps corresponding to all upstream data providers in the upstream data provider field of the product data structure, and to establish the correspondence between the product data structure and the set of upstream data provider location maps.
[0082] Optionally, the second determining module includes:
[0083] The fourth determining submodule is used to determine the second ID bitmap corresponding to each second ID;
[0084] The fifth determining submodule is used to determine the second data provider location map corresponding to the data provider field in the second product data structure corresponding to the second ID;
[0085] The sixth determining submodule is used to determine the product data structure as a candidate backward traceability product data structure if a target forward ID bitmap exists in the forward ID bitmap set corresponding to any of the product data structures. The target forward ID bitmap refers to the forward ID bitmap obtained by performing a bitwise XOR operation with the second ID bitmap, where each bit in the resulting bitmap is 0.
[0086] The seventh determining submodule is used to determine the candidate backward traceability product data structure as the backward traceability product data structure if there is a target upstream data providing location map in the upstream data providing location map set corresponding to the candidate backward traceability product data structure. The target upstream data providing location map refers to the upstream data providing location map in the result bit map where every bit is 0 after performing a bitwise XOR operation with the second data providing location map.
[0087] Optionally, each of the product data structures includes a data entity storage address field, and the first generation module includes:
[0088] The second generation submodule is used to generate the product traceability query result based at least on the data entity storage address field in the target forward traceability product data structure.
[0089] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, having stored thereon computer program instructions that, when executed by a processor, implement the steps of the blockchain-based product data traceability method provided in the first aspect of the present disclosure.
[0090] According to a fourth aspect of the present disclosure, a node is provided, comprising:
[0091] A memory on which computer programs are stored;
[0092] A processor is configured to execute the computer program in the memory to implement the steps of the blockchain-based product data traceability method provided in the first aspect of this disclosure.
[0093] By adopting the above-described technical solution of this disclosure, at least the following beneficial technical effects can be achieved:
[0094] Upon receiving a product traceability query request initiated by a data querying party based on a first product, the node determines the corresponding first product data structure based on the first ID in the product traceability query request. Based on the second ID in the forward-related data field within the first product data structure, it determines all forward-tracing product data structures representing those related to the first product data structure. Based on the search conditions in the product traceability query request, it filters out the target forward-tracing product data structure from all forward-tracing product data structures. It generates product traceability query results based at least on the target forward-tracing product data structure. This disclosed method, based on search conditions, can filter out the target forward-tracing product data structure from a massive amount of forward-tracing product data structures, achieving more refined product data traceability queries and better meeting users' precise query needs.
[0095] Furthermore, the method disclosed herein, in which the data provider stores the product data structure in the blockchain network but does not store the corresponding physical data in the blockchain network, can avoid the problem of large data storage pressure on the blockchain network caused by large amounts of physical data.
[0096] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0097] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0098] Figure 1 This is a schematic diagram of a product data traceability system architecture according to an exemplary embodiment.
[0099] Figure 2 This is a flowchart illustrating a blockchain-based product data traceability method according to an exemplary embodiment.
[0100] Figure 3This is a block diagram illustrating a short text matching model according to an exemplary embodiment.
[0101] Figure 4 This is an ID bitmap illustrated according to an exemplary embodiment.
[0102] Figure 5 This is a set of second ID bitmaps and forward ID bitmaps illustrated according to an exemplary embodiment.
[0103] Figure 6 This is a graph illustrating the relationship between the number of hash functions, the length of the bitmap, and the error rate, according to an exemplary embodiment.
[0104] Figure 7 This is a data provision orientation map illustrated according to an exemplary embodiment.
[0105] Figure 8 This is a schematic diagram illustrating a target forward ID bitmap and a target upstream data providing orientation map according to an exemplary embodiment.
[0106] Figure 9 This is a block diagram illustrating a blockchain-based product data traceability device according to an exemplary embodiment.
[0107] Figure 10 This is a block diagram illustrating a node according to an exemplary embodiment. Detailed Implementation
[0108] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0109] It should be noted that all actions involving the acquisition of signals, information, or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where the application is located, and with the authorization granted by the owner of the relevant device.
[0110] In related technologies, industrial product data traceability methods mainly adopt the traditional centralized data management model with large-scale aggregation. This management model suffers from risks such as centralized failures and data tampering, and also faces challenges in interfacing with different data systems, making it difficult to adapt to various data storage systems. To address these issues, this disclosure proposes a blockchain-based product data traceability system architecture that is compatible with different identity systems and data storage methods, while leveraging the characteristics of blockchain to ensure the traceability and immutability of product data. Based on this product data traceability system architecture, a blockchain-based product data traceability method, device, storage medium, and node are proposed.
[0111] To make the blockchain-based product data traceability method of this disclosure easier for those skilled in the art to understand, the product data traceability system architecture proposed in this disclosure will be briefly introduced below.
[0112] like Figure 1 The product data traceability system architecture shown can ensure the traceability and immutability of product data based on the characteristics of blockchain. Furthermore, it is compatible with different identity systems such as distributed digital identity and CA, and supports different data storage methods such as local storage, cloud storage, and IPFS (Inter-Planetary File System) storage, enabling the rapid and accurate tracing of relevant product data based on product data identifiers (e.g., IDs).
[0113] Figure 1 The blockchain network consists of multiple nodes, each storing the blockchain data. The blockchain contains product data structures uploaded by data providers. A node refers to a computer in the blockchain network, such as a mobile phone, computer, or server.
[0114] A structure is a data type composed of a set of data. Each data / field that makes up a structure is called a member (or field, or element) of the structure, and each field corresponds to a field name.
[0115] In this embodiment of the disclosure, the product data structure refers to structured data after data filling based on a predefined structure. In some implementations, the predefined structure may be as follows:
[0116] struct Evidence{
[0117] string description / / Product description field
[0118] string provider / / Data provider field
[0119] string ID / / ID field
[0120] string preIDs / / Forward related data fields
[0121] string resource / / Data entity storage address field
[0122] string accessRule / / Access rule field for the data entity
[0123] string preProvider / / Upstream data provider field
[0124] string time / / Time when the data was generated
[0125] byte hash; / / hash value
[0126] byte signature / / digital signature
[0127] string account / / Data Manager
[0128] }
[0129] The signature field `signature` in the electronic signature structure represents all fields in the `Evidence` structure except for the `signature` field. The forward-related data field `preIDs` records the set of IDs of the forward-related data of this product data structure (i.e., the set of IDs of the preceding product data structure). For example, the forward-related data of a vehicle may include data information on the various parts used to assemble the vehicle.
[0130] It should be noted that the predefined structure corresponding to the product data structure applicable to the blockchain-based product data traceability method disclosed herein can be modified by deleting or adding some fields based on the Evidence structure in the above example, according to requirements.
[0131] Given the Evidence structure defined above, the following interface can be set up in the blockchain network to allow data providers to upload and modify the product data structure, or to allow data query providers to query the product data structure:
[0132] string setEvidence(ID,hash,account,data,preIDs,signature); represents the product data structure upload interface.
[0133] Evidence getEvidence(Id); represents the interface used to obtain the product data structure.
[0134] string getResources(Id); / / Represents the interface used to retrieve the resources field of the product data structure.
[0135] string getAccessRules(Id); represents the interface used to retrieve the accessRules field of the product data structure.
[0136] The string getIdsWithPreID(provider,preID,time) function represents a multi-field joint query interface.
[0137] It should be noted that other access interfaces similar to the above interfaces can be set up in the blockchain network based on requirements.
[0138] After defining the Evidence structure and the blockchain network interface, each participant (such as data provider and data queryer) can register in the distributed digital identity chain or CA center and store digital identity information / public keys on the blockchain network to ensure that the participants can legally access the blockchain network.
[0139] The data provider can generate a product data structure based on the product's entity data, following the aforementioned Evidence structure. Furthermore, the provider can write the authorized object's digital identity information / public key into the accessRule field of the product data structure to authorize access to the product data structure. Simultaneously, the data provider needs to store the same authorization information as the accessRule field off-chain (e.g., local storage, cloud storage, IPFS storage).
[0140] Data providers can upload product data structures to the blockchain network via the `setEvidence` interface. After the data provider uploads the product data structure, product traceability queries can be performed through other defined interfaces.
[0141] The following provides a detailed description of the implementation examples of the blockchain-based product data traceability method disclosed herein.
[0142] Figure 2 This is a flowchart illustrating a blockchain-based product data traceability method according to an exemplary embodiment. This blockchain-based product data traceability method is applied to any node in a blockchain network, where the node stores a product data structure uploaded by a data provider. Figure 2 As shown, this blockchain-based product data traceability method may include the following steps:
[0143] S11. In response to receiving a product traceability query request initiated by the data query party for the first product, determine the corresponding first product data structure based on the first ID in the product traceability query request.
[0144] If a data queryer wants to query the traceability information of its own primary product or components / ingredients within the primary product, it can initiate a product traceability query request to any node in the blockchain network based on the first ID in the primary product data structure of the primary product. Upon receiving the product traceability query request, the node can determine the corresponding primary product data structure based on the first ID in the product traceability query request.
[0145] It should be noted that the first ID can be obtained by the data querying party from the seller when purchasing the first product. Alternatively, the first ID can be obtained by the data querying party from the product description document accompanying the first product. Or, the first ID can also be obtained by the data querying party from the blockchain network based on the descriptive information of the first product.
[0146] S12. Based on the second ID in the forward correlation data field of the first product data structure, determine the forward traceability product data structure corresponding to the second ID that represents the product data structure related to the first product data structure.
[0147] This disclosure does not specify a particular number of IDs in the forward-related data fields of each product data structure.
[0148] The information recorded in the forward-related data fields of each product data structure is filled by the data provider that provides the product data structure, and the source of the information can be the source of the product corresponding to the product data structure.
[0149] Since the product data structure can include a forward-related data field `string preIDs`, after determining the first product data structure, all second IDs in the forward-related data fields of the first product data structure can be further determined. Based on all the second IDs, the same number of forward-traceable product data structures can be determined. The entity data corresponding to these forward-traceable product data structures were all generated earlier than the entity data corresponding to the first product data structure. The entity data corresponding to these forward-traceable product data structures can be either historical data of the first product (such as production data, sales data, maintenance data, etc.) or historical data of a certain component / ingredient in the first product.
[0150] S13. Based on the retrieval conditions in the product traceability query request, select the target forward traceability product data structure from the forward traceability product data structure.
[0151] When a data queryer wants to retrieve traceability information for a first product within a specific time period, or when a data queryer wants to retrieve traceability information for a specific component / ingredient of the first product, they can input search criteria and include these criteria in the product traceability query request. In this way, after determining the forward traceability product data structure related to the first product data structure, the node can further filter out the target forward traceability product data structure based on the search criteria in the product traceability query request.
[0152] In one implementation, the search criteria can be time information. By comparing the data production time field in the forward traceability product data structure with this time information, the target forward traceability product data structure can be filtered out.
[0153] In another implementation, the search criteria include search text input by the data query party to describe the sub-products in the first product, each product data structure includes a product description field, and the step of filtering the target forward traceability product data structure from the forward traceability product data structure based on the search criteria in the product traceability query request includes:
[0154] The target product description field in the forward traceability product data structure is converted into a first product description matrix, and the search text is converted into a first search text matrix. The first product description matrix and the first search text matrix are input into a trained short text matching model to obtain a model output result that represents whether the target product description field matches the search text. If the model output result indicates that the target product description field matches the search text, the forward traceability product data structure is determined as the target forward traceability product data structure.
[0155] It should be noted that when the search criteria include search text describing sub-products (such as seats) within a first product (such as a vehicle), the similarity between the target product description field in each forward-traceable product data structure and the search text can be determined. The forward-traceable product data structure corresponding to a similarity score greater than a preset similarity threshold is then identified as the target forward-traceable product data structure. In other words, by comparing the similarity between two texts, it can be determined whether the two texts are semantically identical.
[0156] Since the same thing can be described in multiple different texts, this disclosure proposes an implementation method to better determine whether the target product description field in each forward-traceable product data structure matches the search text (semantically identical). First, the target product description field in the forward-traceable product data structure is converted into a first product description matrix, and the search text is converted into a first search text matrix. The conversion method can be any encoding method in related technologies, which will not be elaborated here.
[0157] Next, the first product description matrix and the first search text matrix are input into the trained short text matching model to obtain the model output, which represents whether the target product description field matches the search text. If the model output indicates that the target product description field matches the search text, the forward traceability product data structure is determined as the target forward traceability product data structure.
[0158] The training method of the short text matching model is similar to that of the supervised model in related technologies, and will not be elaborated upon in this disclosure.
[0159] In addition, it should be noted that, in addition to the search text entered by the data queryer to describe the sub-products in the first product, the search criteria may also include search text by the data queryer describing one or more fields defined in the product data structure, such as data generation time and data manager.
[0160] S14. Generate product traceability query results based at least on the target forward traceability product data structure.
[0161] Optionally, each of the product data structures includes a data entity storage address field, and generating product traceability query results based at least on the target forward traceability product data structure includes:
[0162] The product traceability query result is generated based at least on the data entity storage address field in the target forward traceability product data structure.
[0163] For example, after determining the target forward-traceable product data structure, product traceability query results can be generated based on the data entity storage address field in the target forward-traceable product data structure. These product traceability query results can then be fed back to the data requester. The data requester can access the storage address recorded in the data entity storage address field to obtain the data entity corresponding to the target forward-traceable product data structure.
[0164] Using the above method, when a node receives a product traceability query request initiated by a data query party based on a first product, it determines the corresponding first product data structure based on the first ID in the product traceability query request. Based on the second ID in the forward-related data field within the first product data structure, it determines all forward-traceability product data structures corresponding to the second ID and representing those related to the first product data structure. Based on the search conditions in the product traceability query request, it filters out the target forward-traceability product data structure from all forward-traceability product data structures. It generates product traceability query results based at least on the target forward-traceability product data structure. This disclosed method, based on search conditions, can filter out the target forward-traceability product data structure from a massive amount of forward-traceability product data structures, achieving more refined product data traceability queries and better meeting users' precise query needs.
[0165] Furthermore, the method disclosed herein, in which the data provider stores the product data structure in the blockchain network but does not store the corresponding physical data in the blockchain network, can avoid the problem of large data storage pressure on the blockchain network caused by large amounts of physical data.
[0166] Furthermore, by generating product traceability query results based on the data entity storage address field in the target forward traceability product data structure, data requesters can obtain the data entity corresponding to the target forward traceability product data structure off-chain. This approach reduces on-chain data interaction and lowers the load on the blockchain network.
[0167] In the embodiments of this disclosure, not only can upstream data of product data be traced, but also downstream data (such as sales data or resale data) corresponding to the product data can be traced. For example, in some embodiments, the blockchain-based product data tracing method may further include:
[0168] The process involves: identifying a backward traceability product data structure that includes at least one of the second IDs in the forward-related data fields; selecting a target backward traceability product data structure from the backward traceability product data structures based on the search criteria; and generating product traceability query results based at least on the target forward traceability product data structure, which includes generating the product traceability query results based on the target forward traceability product data structure and the target backward traceability product data structure.
[0169] In one implementation, a backward traceability product data structure is determined to include at least one second ID in the forward-related data field. Based on search criteria, such as time information, a target backward traceability product data structure is selected from the backward traceability product data structures. The implementation method for selecting the target backward traceability product data structure based on search criteria is similar to the implementation method of step S13 described above, and will not be repeated here.
[0170] In another implementation, a backward traceability product data structure is identified that includes at least one second ID in the forward correlation data field. Each backward traceability product data structure is then designated as the target backward traceability product data structure.
[0171] After determining the target forward traceability product data structure and the target backward traceability product data structure, product traceability query results can be generated based on the data entity storage address field in the target forward traceability product data structure and the data entity storage address field in the target backward traceability product data structure.
[0172] The short text matching model used in the embodiments of this disclosure will be described below.
[0173] The short text matching model used in this disclosure can be a short text matching model in related technologies. However, short text matching models in related technologies only consider the internal information of the text itself, ignoring the interaction information between two texts, or only perform an interaction after extracting text features, thus only obtaining single-level interaction information and losing multi-level interaction information. Therefore, this disclosure proposes a method such as... Figure 3 The new short text matching model is shown.
[0174] like Figure 3 As shown, the trained short text matching model includes an attention interaction layer, a self-attention layer, a first normalization processing layer, a feedforward neural network layer, a second normalization processing layer, a max pooling layer, and a Softmax classification layer connected in sequence.
[0175] The attention interaction layer is configured to: calculate an interaction matrix based on the first product description matrix and the first search text matrix; perform max pooling on each row of the interaction matrix to obtain a first weight vector; perform max pooling on each column of the interaction matrix to obtain a second weight vector; calculate the product of the first product description matrix and the first weight vector to obtain a second product description matrix; and calculate the product of the first search text matrix and the second weight vector to obtain a second search text matrix.
[0176] For example, the formula for calculating the interaction matrix based on the first product description matrix and the first search text matrix can be M = A * B. T Where M represents the interaction matrix, A represents the first product description matrix, B represents the first search text matrix, and B... T The transpose matrix representing B. In other embodiments, the above calculation formula M = A * B T In this context, A can also represent the first search text matrix, and B can also represent the first product description matrix. T The transpose matrix representing B.
[0177] The following example illustrates how to perform max pooling on each row of the interaction matrix to obtain the first weight vector. Assuming the interaction matrix is an n×m matrix, by determining the maximum value in each row, we can obtain an n×1 first weight vector R. A .
[0178] Furthermore, if we take A to represent the first product description matrix and B to represent the first retrieval text matrix as an example, then we can calculate the first product description matrix A and the first weight vector R. A The product of these two matrices yields the second product description matrix A'.
[0179] Similarly, the second weight vector R of 1×m can be obtained. B And calculate the first search text matrix B and the second weight vector R. B The product of these two elements yields the second retrieval text matrix B'.
[0180] The attention interaction layer outputs a second product description matrix A' and a second retrieval text matrix B'. The attention layer then uses A' and the hyperparameter weight matrix W trained on it. Q W K W V The query matrix Q can be calculated using a preset formula. A’ Key matrix K A’ Sum matrix V A’ And according to the formula Z can be calculated A’ Among them, d k The key matrix K (i.e., K) A’ ) dimension.
[0181] The above-mentioned preset calculation formula can be as follows:
[0182] Q = X × W Q K = X × W K V = X × W V X can take the value A' or B'.
[0183] Similarly, for B', Z can be calculated using the self-attention layer. B’ .
[0184] The output Z of the self-attention layer A’ and Z B’ The first normalization layer targets Z. A’ Calculate Z A’ The sum matrix of +A' is calculated, and the mean and variance of all elements in this sum matrix are calculated. The product of the sum matrix and the mean, divided by the standard deviation, yields Z. A” The standard deviation represents the square root of the variance. Similarly, the first normalization layer is applied to Z. B’ Z can be calculated B” The calculation process for the first normalization layer can be expressed by formula Z. nor =LN(Z+X) is used for characterization.
[0185] The first normalization layer outputs Z. A” and Z B” The feedforward neural network layer will... A” Convert to a third product description matrix A”, and then Z B” "Convert to the third retrieval text matrix B". The data processing principle of the feedforward neural network layer can be found in related technologies, and will not be described in this disclosure.
[0186] The feedforward neural network layer outputs A” and B”. The second normalization layer uses the same processing method as the first normalization layer to process the third product description matrix A” into the fourth product description matrix A”', and the third retrieval text matrix B” into the fourth retrieval text matrix B”'.
[0187] The second normalization layer outputs the fourth product description matrix A”' and the fourth retrieval text matrix B”'. The max-pooling layer performs max-pooling on each row / column of the fourth product description matrix A”' to obtain the product description vector V. A By performing max pooling on each row / column of the fourth search text matrix B", the search text vector V can be obtained. B .
[0188] The max pooling layer outputs a product description vector V. A and retrieve the text vector V B The Softmax classification layer is based on the product description vector V. A Retrieve text vector V B The sum (i.e., dot-matrix) of the product description vector and the search text vector results in V. A +V BThe product description vector and the subtraction result |v1-v2| of the retrieval text vector are concatenated to obtain the concatenated vector Concat(v1;v2;v1+v2;|v1-v2|). Based on this concatenated vector, classification mapping is performed to obtain the model output result y=Softmax(Concat(v1;v2;v1+v2;|v1-v2|)).
[0189] Optionally, the blockchain-based product data traceability method may further include:
[0190] Upon receiving the product data structure uploaded by the data provider, an ID bitmap of a preset length is generated based on the ID field in the product data structure and a preset number of hash functions; and a set of forward ID bitmaps corresponding to all forward IDs in the forward related data fields of the product data structure is determined, and a correspondence between the product data structure and the set of forward ID bitmaps is established.
[0191] For example, upon receiving a product data structure uploaded by the data provider, the node generates an ID bitmap of a preset length based on the ID field in the product data structure and a preset number of hash functions. For example, the ID field is mapped using three different hash functions, resulting in three mapping results. Each mapping result is then modulo 16, yielding three remainders. The bit position corresponding to each remainder is set to 1, and the remaining bits are set to 0, resulting in the following: Figure 4 The ID bitmap shown here. It should be noted that the core idea of the bitmap algorithm is to use a bit array to record two states, 0 and 1, and then map the specific data to a specific position in this bit array. Setting this bit to 0 indicates that the data does not exist, and setting it to 1 indicates that the data exists.
[0192] Since each product data structure corresponds to an ID, and each ID corresponds to an ID bitmap, similarly, each forward ID in the forward-related data field of the product data structure also corresponds to a forward ID bitmap. Based on all the forward IDs in the forward-related data field of the product data structure, the set of forward ID bitmaps corresponding to that product data structure can be determined, and a correspondence between the product data structure and the set of forward ID bitmaps can be established. Furthermore, to avoid consuming the memory of each node in the blockchain network due to storing a large number of bitmaps, this correspondence can be stored in... Figure 1 The index server shown stores the index relationship between the product data structure and its corresponding relationship in the blockchain network. Nodes can query the forward ID bitmap set corresponding to the product data structure through the index relationship.
[0193] Optionally, the determination of the forward correlation data field including at least one backward traceability product data structure of the second ID includes:
[0194] For each of the second IDs, a second ID bitmap corresponding to the second ID is determined; in the set of forward ID bitmaps corresponding to any of the product data structures, if a target forward ID bitmap exists, the product data structure is determined as the backward traceability product data structure. The target forward ID bitmap refers to the forward ID bitmap obtained by performing a bitwise XOR operation with the second ID bitmap, where each bit in the resulting bitmap is 0.
[0195] For example, such as Figure 5 The second ID bitmap and the set of forward ID bitmaps shown are used to perform a bitwise XOR operation between the second ID bitmap and each forward ID bitmap in the set of forward ID bitmaps, resulting in a result bitmap corresponding to each forward ID bitmap. The forward ID bitmap in the result bitmap where every bit is 0 is determined as the target forward ID bitmap, for example... Figure 5 The forward ID bitmap pointed to by the middle arrow is the target forward ID bitmap.
[0196] The bitwise XOR operation between two bitmaps refers to performing an XOR operation on the value of the w-th bit in both bitmaps to obtain the value of the w-th bit in the result bitmap. For example, XORing 1 and 0 results in 1, XORing 1 and 1 results in 0, and XORing 0 and 0 results in 0.
[0197] If a target forward ID bitmap exists in the set of forward ID bitmaps corresponding to any product data structure, then that product data structure is identified as the backward traceability product data structure. The error rate of this bitmap-based method for determining the backward traceability product data structure is related to the number of hash functions and the length of the bitmap, as detailed below. Figure 6 As shown. Based on Figure 6 The relationship shown is preferably such that the preset quantity k is selected as 3, the preset length m is selected as 16, and the error rate n is 0.005.
[0198] The method described above, which uses bitmaps to filter out backward traceability product data structures from massive product data structures, where the forward related data fields include at least one second ID, can minimize the memory overhead of node / index servers while ensuring a high accuracy rate, because each value of the bitmap only occupies 1 bit of memory and each bitmap occupies 16 bits.
[0199] And based on Figure 6It is known that, with a preset quantity of 3 and a preset length of 16, the error rate of the aforementioned bitmap-based backward traceability product data structure is 0.5%. To further reduce the error rate, this disclosure also proposes another implementation method.
[0200] Optionally, the blockchain-based product data traceability method further includes:
[0201] Upon receiving the product data structure uploaded by the data provider, a data provider location map of a preset length is generated based on the data provider field in the product data structure and the preset number of hash functions; a set of upstream data provider location maps corresponding to all upstream data providers in the upstream data provider field of the product data structure is determined, and a correspondence between the product data structure and the set of upstream data provider location maps is established.
[0202] For example, such as Figure 7 The data shown provides a azimuth map.
[0203] Since each data provider can correspond to a data provider location map, correspondingly, the upstream data provider field of each product data structure can correspond to a set of upstream data provider location maps.
[0204] Accordingly, the determination of the forward-related data field including at least one of the second ID in the backward-tracing product data structure includes:
[0205] For each second ID, determine the second ID bitmap corresponding to the second ID; determine the second data provider location map corresponding to the data provider field in the second product data structure corresponding to the second ID; in the set of forward ID bitmaps corresponding to any product data structure, if a target forward ID bitmap exists, then the product data structure is determined as a candidate backward traceability product data structure, wherein the target forward ID bitmap refers to the forward ID bitmap in the result bitmap where each bit is 0 after performing a bitwise XOR operation with the second ID bitmap; if a target upstream data provider location map exists in the set of upstream data provider location maps corresponding to the candidate backward traceability product data structure, then the candidate backward traceability product data structure is determined as the backward traceability product data structure, wherein the target upstream data provider location map refers to the upstream data provider location map in the result bitmap where each bit is 0 after performing a bitwise XOR operation with the second data provider location map.
[0206] For example, such as Figure 8 As shown, in Figure 8If a target forward ID bitmap exists in the forward ID bitmap set corresponding to the product data structure, and a target upstream data provider location map exists in the upstream data provider location map set corresponding to the product data structure, then the product data structure can be identified as the backward traceability product data structure of the second product data structure.
[0207] Using this method, with a preset quantity of 3 and a preset length of 16, in determining whether a product data structure's forward-related data field includes a second ID, if the forward ID bitmap set corresponding to that product data structure contains a target forward ID bitmap, and the upstream data provider location map set corresponding to that product data structure contains a target upstream data provider location map, then the error rate for the second ID existing in the forward-related data field of that product data structure is 0.5%, and the error rate for the data provider corresponding to the second ID existing in the upstream data provider field of that product data structure is also 0.5%. Therefore, this method of determining whether a product data structure's forward-related data field includes a second ID has an error rate of 0.5 squared, which is a further reduction compared to the previous method of determining whether a product data structure's forward-related data field includes a second ID with an error rate of 0.5%.
[0208] It should also be noted that the core principle of the two bitmap-based methods for filtering backward traceability product data structures from massive product data structures, where the forward related data fields include at least one second ID, is similar to that of Bloom filters.
[0209] Based on the same inventive concept, this disclosure also provides a blockchain-based product data traceability device, such as... Figure 9 As shown, the device 900 is applied to any node in a blockchain network, where the node stores a product data structure uploaded by a data provider. The device 900 includes:
[0210] The response module 910 is used to respond to a product traceability query request initiated by the data query party for the first product, and to determine the corresponding first product data structure according to the first ID in the product traceability query request.
[0211] The first determining module 920 is used to determine, based on the second ID in the forward related data field of the first product data structure, a forward traceability product data structure that represents the product data structure related to the first product data structure and corresponds to the second ID.
[0212] The first filtering module 930 is used to filter out the target forward traceability product data structure from the forward traceability product data structure based on the search conditions in the product traceability query request.
[0213] The first generation module 940 is used to generate product traceability query results based at least on the target forward traceability product data structure.
[0214] Using this device, when a node receives a product traceability query request initiated by a data query party based on a first product, it determines the corresponding first product data structure based on the first ID in the product traceability query request. Based on the second ID in the forward correlation data field within the first product data structure, it determines all forward traceability product data structures corresponding to the second ID and representing those related to the first product data structure. Based on the search conditions in the product traceability query request, it filters out the target forward traceability product data structure from all forward traceability product data structures. It generates product traceability query results based at least on the target forward traceability product data structure. This disclosed method, based on search conditions, can filter out the target forward traceability product data structure from a massive amount of forward traceability product data structures, achieving more refined product data traceability queries and better meeting the user's precise query needs.
[0215] Furthermore, the method disclosed herein, in which the data provider stores the product data structure in the blockchain network but does not store the corresponding physical data in the blockchain network, can avoid the problem of large data storage pressure on the blockchain network caused by large amounts of physical data.
[0216] Optionally, the device 900 further includes:
[0217] The second determining module is used to determine that the forward related data field includes at least one backward traceability product data structure containing the second ID;
[0218] The second filtering module is used to filter out the target backward traceability product data structure from the backward traceability product data structure based on the search conditions.
[0219] The first generation module includes:
[0220] The first generation submodule generates the product traceability query result based on the target forward traceability product data structure and the target backward traceability product data structure.
[0221] Optionally, the search criteria include search text input by the data querying party to describe the sub-products in the first product, each product data structure includes a product description field, and the first filtering module 930 includes:
[0222] The first conversion submodule is used to convert the target product description field in the forward traceability product data structure into a first product description matrix and the search text into a first search text matrix.
[0223] The input submodule is used to input the first product description matrix and the first search text matrix into the trained short text matching model to obtain the model output result representing whether the target product description field matches the search text;
[0224] The first determining submodule is used to determine the forward traceability product data structure as the target forward traceability product data structure when the model output result indicates that the target product description field matches the search text.
[0225] Optionally, the trained short text matching model includes, in sequence, an attention interaction layer, a self-attention layer, a first normalization processing layer, a feedforward neural network layer, a second normalization processing layer, a max pooling layer, and a Softmax classification layer.
[0226] The attention interaction layer is used for:
[0227] Calculate the interaction matrix based on the first product description matrix and the first search text matrix;
[0228] For each row of the interaction matrix, perform max pooling to obtain the first weight vector;
[0229] For each column of the interaction matrix, perform max pooling to obtain the second weight vector;
[0230] Calculate the product of the first product description matrix and the first weight vector to obtain the second product description matrix;
[0231] The second retrieval text matrix is obtained by multiplying the first retrieval text matrix and the second weight vector.
[0232] Optionally, the second normalization layer is used for:
[0233] The third product description matrix is normalized to obtain the normalized fourth product description matrix. The third product description matrix is obtained by processing the second product description matrix sequentially through the self-attention layer, the first normalization layer, and the feedforward neural network layer.
[0234] The third search text matrix is normalized to obtain a normalized fourth search text matrix. The third search text matrix is obtained by processing the second search text matrix sequentially through the self-attention layer, the first normalization layer, and the feedforward neural network layer.
[0235] Optionally, the max pooling layer is used to perform max pooling operation on the fourth product description matrix to obtain a product description vector, and to perform max pooling operation on the fourth retrieval text matrix to obtain a retrieval text vector.
[0236] The Softmax classification layer is used to concatenate the product description vector, the search text vector, the sum of the product description vector and the search text vector, and the subtraction between the product description vector and the search text vector to obtain a concatenated vector, and then perform classification mapping based on the concatenated vector to obtain the model output result.
[0237] Optionally, the device 900 further includes:
[0238] The second generation module is used to generate an ID bitmap of a preset length based on the ID field in the product data structure and a preset number of hash functions when the product data structure is received from the data provider.
[0239] The first execution module is used to determine the set of forward ID bitmaps corresponding to all forward IDs in the forward related data fields of the product data structure, and to establish the correspondence between the product data structure and the set of forward ID bitmaps.
[0240] Optionally, the second determining module includes:
[0241] The second determining submodule is used to determine the second ID bitmap corresponding to each second ID;
[0242] The third determining submodule is used to determine the product data structure as the backward traceability product data structure if a target forward ID bitmap exists in the forward ID bitmap set corresponding to any of the product data structures. The target forward ID bitmap refers to the forward ID bitmap in the result bitmap where each bit is 0 after performing a bitwise XOR operation with the second ID bitmap.
[0243] Optionally, the device 900 further includes:
[0244] The third generation module is used to generate a data provider orientation map of a preset length based on the data provider field in the product data structure and the preset number of hash functions when the product data structure is received from the data provider.
[0245] The second execution module is used to determine the set of upstream data provider location maps corresponding to all upstream data providers in the upstream data provider field of the product data structure, and to establish the correspondence between the product data structure and the set of upstream data provider location maps.
[0246] Optionally, the second determining module includes:
[0247] The fourth determining submodule is used to determine the second ID bitmap corresponding to each second ID;
[0248] The fifth determining submodule is used to determine the second data provider location map corresponding to the data provider field in the second product data structure corresponding to the second ID;
[0249] The sixth determining submodule is used to determine the product data structure as a candidate backward traceability product data structure if a target forward ID bitmap exists in the forward ID bitmap set corresponding to any of the product data structures. The target forward ID bitmap refers to the forward ID bitmap obtained by performing a bitwise XOR operation with the second ID bitmap, where each bit in the resulting bitmap is 0.
[0250] The seventh determining submodule is used to determine the candidate backward traceability product data structure as the backward traceability product data structure if there is a target upstream data providing location map in the upstream data providing location map set corresponding to the candidate backward traceability product data structure. The target upstream data providing location map refers to the upstream data providing location map in the result bit map where every bit is 0 after performing a bitwise XOR operation with the second data providing location map.
[0251] Optionally, each of the product data structures includes a data entity storage address field, and the first generation module 940 includes:
[0252] The second generation submodule is used to generate the product traceability query result based at least on the data entity storage address field in the target forward traceability product data structure.
[0253] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0254] This disclosure also provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the steps of the blockchain-based product data traceability method provided in this disclosure.
[0255] Figure 10 This is a block diagram illustrating a node 800 according to an exemplary embodiment. For example, node 800 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc.
[0256] Reference Figure 10 Node 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 810, input / output interface 812, sensor component 814, and communication component 816.
[0257] Processing component 802 typically controls the overall operation of node 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the blockchain-based product data traceability method described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0258] Memory 804 is configured to store various types of data to support operation on node 800. Examples of this data include instructions for any application or method operating on node 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0259] Power supply component 806 provides power to various components of node 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to node 800.
[0260] The multimedia component 808 includes a screen that provides an output interface between the node 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the node 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0261] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when node 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0262] Input / output interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0263] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of node 800. For example, sensor assembly 814 may detect the on / off state of node 800, the relative positioning of components such as the display and keypad of node 800, changes in the position of node 800 or one of its components, the presence or absence of user contact with node 800, the orientation or acceleration / deceleration of node 800, and temperature changes of node 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0264] Communication component 816 is configured to facilitate wired or wireless communication between node 800 and other devices. Node 800 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0265] In an exemplary embodiment, node 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-described blockchain-based product data traceability method.
[0266] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by the processor 820 of node 800 to complete the aforementioned blockchain-based product data traceability method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0267] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing the above-described blockchain-based product data traceability method when executed by the programmable device.
[0268] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of this disclosure. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0269] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A blockchain-based product data traceability method, characterized in that, The method is applied to any node in a blockchain network, wherein a product data structure uploaded by a data provider is stored in the node, and the product data structure includes a data entity storage address field, and the method comprises: In response to receiving a product traceability query request initiated by a data query party for a first product, determining a corresponding first product data structure according to a first ID in the product traceability query request; According to a plurality of second IDs in the forward correlation data field in the first product data structure, determining a forward traceability product data structure corresponding to each of the second IDs, which represents a product related to the first product data structure; Based on the search condition in the product traceability query request, filtering out a target forward traceability product data structure from the plurality of forward traceability product data structures; Generating a product traceability query result based on at least the target forward traceability product data structure.
2. The method of claim 1, wherein, The method further comprises: Determining a backward traceability product data structure including at least one of the second IDs in the forward correlation data field; Based on the search condition, filtering out a target backward traceability product data structure from the backward traceability product data structure; The at least generating a product traceability query result based on the target forward traceability product data structure comprises: Generating the product traceability query result according to the target forward traceability product data structure and the target backward traceability product data structure.
3. The method according to claim 1 or 2, characterized in that, The search condition includes search text input by the data query party to describe a sub-product in the first product, and each product data structure includes a product description field, and the filtering out a target forward traceability product data structure from the forward traceability product data structure based on the search condition in the product traceability query request comprises: Converting a target product description field in the forward traceability product data structure into a first product description matrix, and converting the search text into a first search text matrix; Inputting the first product description matrix and the first search text matrix into a trained short text matching model to obtain a model output result representing whether the target product description field matches the search text; In the case where the model output result represents that the target product description field matches the search text, determining the forward traceability product data structure as the target forward traceability product data structure.
4. The method of claim 3, wherein, The trained short text matching model comprises an attention interaction layer, a self-attention layer, a first normalization processing layer, a feedforward neural network layer, a second normalization processing layer, a max-pooling layer, and a Softmax classification layer connected in sequence; The attention interaction layer is configured to: Calculate an interaction matrix according to the first product description matrix and the first search text matrix; Perform a max-pooling operation on each row of the interaction matrix to obtain a first weight vector; Perform a max-pooling operation on each column of the interaction matrix to obtain a second weight vector; Calculate the product of the first product description matrix and the first weight vector to obtain a second product description matrix; The product description matrix is normalized to obtain a third product description matrix.
5. The method of claim 4, wherein, The second normalization processing layer is configured to: The third product description matrix is normalized to obtain a fourth product description matrix, wherein the third product description matrix is obtained by sequentially processing the second product description matrix through the self-attention layer, the first normalization processing layer, and the feedforward neural network layer. The third search text matrix is normalized to obtain a fourth search text matrix, wherein the third search text matrix is obtained by sequentially processing the second search text matrix through the self-attention layer, the first normalization processing layer, and the feedforward neural network layer.
6. The method of claim 5, wherein, The max-pooling layer is configured to perform a max-pooling operation on the fourth product description matrix to obtain a product description vector, and perform a max-pooling operation on the fourth search text matrix to obtain a search text vector. The Softmax classification layer is configured to splice the product description vector, the search text vector, an addition result of the product description vector and the search text vector, and a subtraction result of the product description vector and the search text vector to obtain a spliced vector, and perform classification mapping based on the spliced vector to obtain the model output result.
7. The method of claim 2, wherein, The method further comprises: In a case where the product data structure uploaded by the data provider is received, an ID bitmap of a preset length is generated according to an ID field in the product data structure and a preset number of hash functions; and A forward ID bitmap set corresponding to all forward IDs in a forward related data field of the product data structure is determined, and a corresponding relationship between the product data structure and the forward ID bitmap set is established.
8. The method of claim 7, wherein, The backward-tracing product data structure including at least one second ID in the forward related data field comprises: For each second ID, a second ID bitmap corresponding to the second ID is determined. In the forward ID bitmap set corresponding to any product data structure, if a target forward ID bitmap exists, the product data structure is determined as the backward-tracing product data structure, the target forward ID bitmap being a forward ID bitmap in which each bit is 0 in a result bitmap obtained by performing a bitwise XOR operation on the second ID bitmap.
9. The method of claim 7, wherein, The method further comprises: In a case where the product data structure uploaded by the data provider is received, a data provider bitmap of a preset length is generated according to a data provider field in the product data structure and the preset number of hash functions; A upstream data provider bitmap set corresponding to all upstream data providers in a upstream data provider field of the product data structure is determined, and a corresponding relationship between the product data structure and the upstream data provider bitmap set is established.
10. The method of claim 9, wherein, The backward-tracing product data structure including at least one second ID in the forward related data field comprises: For each of the second IDs, determine a second ID bitmap corresponding to the second ID; Determine a second data provider bitmap corresponding to a data provider field in a second product data structure corresponding to the second ID; In any of the sets of forward ID bitmaps corresponding to the product data structures, if there is a target forward ID bitmap, determine the product data structure as a candidate backward tracing product data structure, the target forward ID bitmap being a forward ID bitmap in which each bit is 0 in a result bitmap obtained by performing an XOR operation on the second ID bitmap; If there is a target upstream data provider bitmap in the set of upstream data provider bitmaps corresponding to the candidate backward tracing product data structure, determine the candidate backward tracing product data structure as the backward tracing product data structure, wherein the target upstream data provider bitmap is an upstream data provider bitmap in which each bit is 0 in a result bitmap obtained by performing an XOR operation on the second data provider bitmap.
11. The method of claim 1, wherein, The at least generating a product traceability query result based on the target forward tracing product data structure includes: At least generating the product traceability query result according to the data entity storage address field in the target forward tracing product data structure. 12.A blockchain-based product data traceability apparatus, characterized by, The device is applied to any node in a blockchain network, and the node stores product data structures uploaded by data providers, the product data structures including a data entity storage address field, and the device includes: A response module configured to, in response to receiving a product traceability query request initiated by a data query party for a first product, determine a first product data structure corresponding to a first ID in the product traceability query request according to the first ID; A first determination module configured to determine, according to a plurality of second IDs in a forward related data field in the first product data structure, a forward tracing product data structure corresponding to each of the second IDs and representing a relationship with the first product data structure; A first screening module configured to, based on a search condition in the product traceability query request, screen a target forward tracing product data structure from the plurality of forward tracing product data structures; A first generation module configured to at least generate a product traceability query result based on the target forward tracing product data structure.
13. A computer-readable storage medium having stored thereon computer program instructions, wherein, The program instructions are executed by the processor to implement the steps of the method of any one of claims 1-11.
14. A node, characterized by The device includes: A memory having computer programs stored thereon; A processor configured to execute the computer programs in the memory to implement the steps of the method of any one of claims 1-11.
Citation Information
Patent Citations
A food quick traceability system and method based on a multi-chain interconnected block chain network
CN109377244A
Traceability information processing method and device
CN112685436A