A carbon footprint label generation and traceability authentication method
Patent Information
- Application Number
- CN202611425986.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-15
- Publication Date
- 2026-10-16
AI Technical Summary
[0004]针对现有碳足迹标签生成与溯源认证过程中标签字段整体哈希导致局部更新重算量较大、认证页面无法直接呈现碳足迹等级的问题,提供一种碳足迹标签生成与溯源认证方法,对标签字段进行分段哈希生成溯源认证码,并在认证匹配后按模板渲染包含碳足迹等级的标签页面
[0016]对初始标签数据按产品信息段、排放量段和物料明细段分别进行哈希运算,得到多个标签字段的哈希值;按照段标识符的预设排列顺序将各哈希值依次拼接,并在拼接后的哈希值末尾附加时间戳,形成溯源认证码。由于各标签字段的哈希值独立生成,单个字段内容调整时只需重新计算该字段对应段的哈希值,其他字段的哈希值无需重新生成,字段变更后的认证码更新计算量降低。待验认证码按预设位数划分为多个待验段后,分别与对应哈希值进行逐位比较,单个字段不一致时能够定位到具体标签字段,无需对全部标签数据进行全量重算或传输。标签字段哈希值在认证码中保持预设排列顺序,认证码结构可解析,认证端能够直接提取各段哈希值进行分段校验。时间戳附加在拼接后的哈希值末尾,认证匹配完成后从认证码中提取时间戳,并依据时间戳确定标签展示模板的模板版本号,使认证码与模板版本绑定,认证页面渲染所用模板与认证码数据版本对应。总排放量由各物料节点的物料计量值与排放因子的乘积逐节点累加得到,将总排放量与预设多个排放量区间进行比较,确定碳足迹等级,并将产品标识、总排放量、各物料节点排放量和碳足迹等级写入初始标签数据。碳足迹等级作为离散字段参与认证码的生成,认证通过后依据标签展示模板渲染初始标签数据,页面中直接显示碳足迹等级、总排放量和各节点排放量,终端用户无需根据排放量区间自行换算或执行额外查询。标签展示模板版本号与认证码中的时间戳对应,匹配成功后按照模板版本号确定渲染方式,展示内容由认证码对应的初始标签数据驱动,页面展示的产品排放信息与认证数据保持同一版本。总排放量、各物料节点排放量和碳足迹等级同时参与认证码生成和模板渲染,分级结果、节点排放明细和模板版本在认证码校验链路中保持一致,认证反馈内容对应已校验的标签数据。
Smart Images

Figure CN122928374A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of carbon footprint labeling certification technology, specifically a method for generating and tracing carbon footprint labels. Background Technology
[0002] Carbon footprint labels are used to record greenhouse gas emissions during product manufacturing. End users obtain product carbon emission data and certification results by scanning the label or entering an authentication code. Current carbon footprint label generation processes typically read the consumption of each material from the bill of materials, calculate the emissions at each stage using material emission factors, and then summarize the total product emissions. During traceability certification, the production end performs a hash operation on the label data, which includes product information, emission values, and material details, or adds a digital signature to the overall label data. After the terminal initiates a request, the server compares the overall hash value and returns the preset label content. Some methods only store the total emission value in the label data, and the carbon footprint level is determined by the end user based on the emission range. The certification page displays the label data using a fixed template. In existing technical solutions, the overall hash operation binds all fields of the label data to a single authentication object. When any label field changes, the hash value of the entire label data needs to be regenerated, resulting in a significant computational burden for field updates and authentication code maintenance. The comparison of the overall hash can only determine whether the verification code to be verified is exactly the same as the original verification code. It cannot compare product information, emission data, and material details fields separately. If some fields in the label are modified or the field arrangement is changed, the source of the difference cannot be quickly identified. The existing traceability certification return page is usually fixed text or a preset template. The correspondence between the total emissions, emissions of each material node in the label data, and carbon footprint level is not included in the certification display process. The carbon footprint level is missing or needs to be obtained through additional queries. End users cannot directly obtain the classification result from the certification page. Some verification codes only contain the overall hash value of the product or the product identifier. The verification code itself does not have the ability to verify segmented fields. The label content returned after certification matching lacks a template version or timestamp association with the original label data. The display page format is fixed and cannot be rendered according to the label template version.
[0003] The aforementioned issues result in insufficient computational load and display completeness for carbon footprint labels during field changes, hierarchical display, and traceability certification feedback. It is necessary to address the problems of overall hash certification being sensitive to local field updates and the inability to directly present the carbon footprint level after certification. Summary of the Invention
[0004] To address the issues of large recalculation costs for partial updates and the inability of the certification page to directly display the carbon footprint level during the existing carbon footprint label generation and traceability certification process, a new method for carbon footprint label generation and traceability certification is proposed. This method performs segmented hashing of the label fields to generate traceability certification codes, and renders a label page containing the carbon footprint level according to a template after certification matching.
[0005] To achieve the above objectives, the present invention provides the following technical solution: The present invention provides a carbon footprint label generation and traceability authentication method, comprising: obtaining material identifiers and material measurement values of multiple material nodes in the production process of a target product, and querying a preset material emission coefficient library according to the material identifiers of each material node to obtain the emission factor of each material node; multiplying the material measurement value of each material node by the emission factor as the node emission of each material node, and summing the emission of all nodes as the total emission of the target product; determining the carbon footprint level of the target product according to the total emission of the target product and multiple preset emission ranges, and generating initial label data based on the product identifier, total emission, node emission of each material node and carbon footprint level of the target product; performing segmented hash operation on the initial label data to obtain a hash sequence of multiple label fields, and concatenating the hash sequence into a traceability authentication code according to the preset arrangement order of each label field; when a traceability request is received from a terminal, extracting the authentication code to be verified in the traceability request, and if the authentication code to be verified matches the traceability authentication code, rendering the initial label data according to a preset label display template, generating and feeding back the authentication label page to the terminal. This method can automatically calculate carbon emissions and generate graded labels based on material nodes in the production process, while ensuring the credibility of the label data in the traceability display process through segmented hash authentication.
[0006] As a technical solution of the present invention, obtaining the material identifiers and material measurement values of multiple material nodes in the production process of a target product includes: obtaining a bill of materials for the production process of the target product, wherein the bill of materials records the material codes of multiple material nodes sequentially according to the production time sequence; using each material code in the bill of materials as the material identifier of each material node, and for each material node, reading the corresponding material consumption amount from the production execution system based on the material identifier of that material node; and using the read material consumption amount as the material measurement value of that material node. By directly reading the material consumption amount from the production execution system, carbon footprint accounting can be kept consistent with actual production data, reducing errors caused by manual data entry.
[0007] Preferably, the emission factor for each material node is obtained by querying a pre-defined material emission coefficient database based on the material identifier of each material node. This includes: for each material node, extracting the material category field and material form field from the material identifier of that material node; combining the material category field and material form field into a query key, and searching for a coefficient record matching the query key in the material emission coefficient database; and using the emission coefficient value stored in the coefficient record as the emission factor for that material node. Using both material category and material form to match the emission factor improves the targeting of the emission factor, making the node emission amount closer to the actual emission situation.
[0008] Preferably, the product of the material metering value and the emission factor of each material node is used as the node emission amount of each material node. This includes: for each material node, multiplying the material metering value of the material node by the emission factor of the material node to obtain the initial emission amount of the material node; obtaining the unit of measurement for the material metering value corresponding to the material node, and querying a preset unit conversion table according to the unit of measurement to obtain the unit conversion coefficient; dividing the initial emission amount by the unit conversion coefficient to obtain the node emission amount of the material node. By converting the unit of measurement, the emission amount of different material nodes can be standardized, improving the consistency of total emission calculation.
[0009] Preferably, the total emission of the target product is obtained by summing the emissions from all nodes. This involves: arranging the emissions of all nodes into an emission sequence according to their chronological order in the production process; starting from the first position of the emission sequence, adding the emission of the current node to the cumulative variable and updating the cumulative variable with the sum, until all positions of the emission sequence have been traversed; and using the final value of the cumulative variable as the total emission of the target product. Accumulating emissions according to the production sequence helps in tracking emission contributions and locating anomalies in the corresponding product's production process.
[0010] Preferably, the carbon footprint level of the target product is determined based on its total emissions and multiple preset emission ranges. This includes: obtaining a preset level mapping table, which stores the correspondence between multiple emission ranges and multiple carbon footprint levels, with each emission range having an upper limit and a lower limit; comparing the total emissions of the target product one by one with the upper limit and lower limit of each emission range in the level mapping table; if the total emissions are greater than or equal to the lower limit of the current range and less than the upper limit of the current range, then the carbon footprint level corresponding to the current range is taken as the carbon footprint level of the target product. Determining the level through range mapping makes the carbon footprint assessment results intuitive and easy to display to end users.
[0011] Preferably, initial tag data is generated based on the target product's product identifier, total emissions, node emissions of each material node, and carbon footprint level. This includes: filling the target product's product identifier into the first data field, the total emissions into the second data field, and the carbon footprint level into the third data field according to a preset data structure template; for each material node, combining the material node's material identifier and node emissions into a key-value pair, and then filling the key-value pairs of all material nodes into the fourth data field after lexicographically ordering them according to the material identifier; the data record composed of the first, second, third, and fourth data fields serves as the initial tag data. Using a structured template to generate initial tag data facilitates the stable execution of subsequent segmented hashing, data validation, and page rendering.
[0012] Preferably, the initial label data is subjected to segmented hashing to obtain hash sequences of multiple label fields. These hash sequences are then concatenated into a traceability authentication code according to a preset order of the label fields. This includes: dividing the initial label data into product information, emission, and material details segments based on the type of the label fields, and assigning segment identifiers to each segment; performing a hash operation on the content of the product information segment to obtain a first hash value, on the content of the emission segment to obtain a second hash value, and on the content of the material details segment to obtain a third hash value; and concatenating the first, second, and third hash values sequentially according to the preset order of the segment identifiers, and appending a timestamp to the end of the concatenated hash value to obtain the traceability authentication code. Segmented hashing can generate separate summaries for different fields and combine them with timestamps, enhancing the tamper-proof capability and timeliness of the traceability authentication code.
[0013] Preferably, extracting the authentication code to be verified from the tracing request includes: parsing the data packet header of the tracing request, reading the request type identifier from the data packet header, and determining whether the request type identifier is an authentication type identifier; if the request type identifier is an authentication type identifier, then extracting the encoding field from the data body of the tracing request, and using the string stored in the encoding field as the authentication code to be verified; if the request type identifier is not an authentication type identifier, then rejecting the extraction operation and returning an error message. Request type filtering can reduce the interference of non-authentication requests on the tracing authentication process, improving the security and efficiency of authentication processing.
[0014] As a technical solution of the present invention, if the authentication code to be verified matches the traceability authentication code, the initial label data is rendered according to a preset label display template to generate and feed back an authentication label page to the terminal. This includes: dividing the authentication code to be verified into a first segment, a second segment, and a third segment according to a preset number of bits; comparing each segment bit-by-bit with the first hash value, second hash value, and third hash value in the traceability authentication code; if each segment matches the corresponding hash value in the traceability authentication code, the authentication code to be verified is determined to match the traceability authentication code; during the matching determination, a timestamp is extracted from the traceability authentication code, and the template version number of the label display template is determined based on the timestamp; the initial label data is then rendered according to the label display template corresponding to the template version number to generate the authentication label page. By segmenting and comparing bit-by-bit and selecting the template version corresponding to the timestamp, the accuracy of the authentication judgment can be improved, and the display rules of the authentication label page are kept consistent with those when the authentication code is generated.
[0015] The technical effects and advantages provided by the present invention in the above technical solution are as follows:
[0016] The initial label data is hashed separately for product information, emission, and material details segments to obtain hash values for multiple label fields. These hash values are then concatenated according to a preset order of segment identifiers, and a timestamp is appended to the end of the concatenated hash value to form a traceability authentication code. Since the hash values for each label field are generated independently, adjustments to a single field only require recalculating the hash value of the corresponding segment; hash values for other fields do not need to be regenerated, reducing the computational load for updating the authentication code after field changes. The authentication code to be verified is divided into multiple segments according to a preset number of digits, and each segment is compared bit-by-bit with its corresponding hash value. If a single field is inconsistent, the specific label field can be located without requiring a full recalculation or transmission of all label data. The hash values of the label fields maintain a preset order in the authentication code, the authentication code structure is parsable, and the authentication end can directly extract the hash values of each segment for segmented verification. A timestamp is appended to the end of the concatenated hash value. After authentication matching, the timestamp is extracted from the authentication code, and the template version number of the label display template is determined based on the timestamp, binding the authentication code to the template version. The template used for rendering the authentication page corresponds to the authentication code data version. The total emissions are obtained by summing the product of the material metering value and the emission factor of each material node node. The total emissions are compared with multiple preset emission ranges to determine the carbon footprint level, and the product identifier, total emissions, emissions of each material node, and carbon footprint level are written into the initial label data. The carbon footprint level is used as a discrete field in the generation of the authentication code. After successful authentication, the initial label data is rendered according to the label display template. The page directly displays the carbon footprint level, total emissions, and emissions of each node. End users do not need to convert or perform additional queries based on emission ranges. The label display template version number corresponds to the timestamp in the authentication code. After successful matching, the rendering method is determined according to the template version number. The displayed content is driven by the initial label data corresponding to the authentication code, and the product emission information displayed on the page maintains the same version as the authentication data. Total emissions, emissions at each material node, and carbon footprint level are all involved in the generation of authentication codes and template rendering. The classification results, node emission details, and template versions are kept consistent in the authentication code verification chain, and the authentication feedback content corresponds to the verified tag data. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0018] Figure 1 This is a flowchart of a method for generating and authenticating carbon footprint labels;
[0019] Figure 2This is a flowchart of the traceability authentication code verification and authentication label page generation process;
[0020] Figure 3 It is a bar chart showing the carbon footprint classification and the total emissions distribution of target products;
[0021] Figure 4 It is a graph showing the changes in the hash values and timestamps of the traceability authentication code;
[0022] Figure 5 This is a statistical chart showing the frequency and cumulative percentage of matching segments of the authentication code to be verified. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] See Figure 1 This invention provides a method for generating carbon footprint labels and authenticating traceability. After obtaining the material identifiers and material measurement values of multiple material nodes in the production process of the target product, a preset material emission coefficient library is queried based on the material identifiers of each material node to obtain the emission factor of each material node. The product of the material measurement value and the emission factor of each material node is taken as the node emission of each material node, and the sum of the emission amounts of all nodes is taken as the total emission of the target product. Based on the total emission of the target product and multiple preset emission ranges, the carbon footprint level of the target product is determined, and initial label data is generated based on the product identifier, total emission, node emission of each material node, and carbon footprint level. Segmented hashing is performed on the initial label data to obtain a hash sequence of multiple label fields, and the hash sequence is concatenated into a traceability authentication code according to the preset arrangement order of the label fields. When a traceability request is received from the terminal, the authentication code to be verified in the traceability request is extracted. If the authentication code to be verified matches the traceability authentication code, the initial label data is rendered according to a preset label display template, generating and sending an authentication label page to the terminal.
[0025] In practical implementation, the process of obtaining material identifiers and material measurement values for multiple material nodes in the production process of the target product is as follows: First, obtain the bill of materials (BOM) for the target product's production process. The BOM records the material codes of multiple material nodes sequentially according to the production timeline. The BOM is stored in the target product's product data management system. Each material node in the BOM corresponds to a material input stage in the production process, and the order of the material nodes is consistent with the production timeline. Use each material code in the BOM as the material identifier for each material node. For each material node, read the corresponding material consumption quantity from the production execution system (MES) based on the material identifier. The MES stores the actual material consumption records for each material node. When reading, use the material identifier as the query condition to obtain the material consumption quantity corresponding to the material identifier from the MES. Use the read material consumption quantity as the material measurement value for the material node.
[0026] In some embodiments, the material codes in the bill of materials adopt a unified coding rule. The material code contains a combination of characters used to distinguish different materials, and the material code uniquely identifies a material node in the production process. When reading material consumption from the production execution system, the material identifier is matched against the consumption data table in the production execution system. The consumption data table stores a material consumption field with the material identifier as an index. The value of the matched material consumption field is read as the material measurement value of the material node.
[0027] It can be understood that the material metering value represents the actual quantity of material consumed by the material node during the production process. The unit of measurement for the material metering value is determined by the material consumption record in the production execution system. The material metering value is the numerical value corresponding to the mass unit, volume unit, and quantity unit.
[0028] The process of obtaining the emission factor for each material node by querying the preset material emission coefficient database based on the material identifier of each material node is as follows: For each material node, the material category field and material form field are extracted from the material identifier of the material node. The material identifier consists of multiple fields: the material category field indicates the category to which the material belongs, and the material form field indicates the form of the material when it is put into production. The material category field and the material form field are combined into a query key, and the coefficient record matching the query key is searched in the material emission coefficient database. The material emission coefficient database stores multiple coefficient records, each containing a material category field, a material form field, and an emission coefficient value. When the query key matches both the material category field and the material form field in a coefficient record, the matched coefficient record is used as the coefficient record matching the query key. The emission coefficient value stored in the matched coefficient record is used as the emission factor of the material node.
[0029] Optionally, when the material category field and the material form field are combined as the query key, the two fields are concatenated into a single string according to the field concatenation rules defined in the material emission coefficient database. This concatenated string serves as the query key. The coefficient records in the material emission coefficient database also generate corresponding record indexes according to the same field concatenation rules. During a query, the query key is matched against the record index.
[0030] In practice, the material emission coefficient database is deployed on a separate emission coefficient management server. After receiving a query request, it returns the matched emission coefficient value. The query request includes a material category field and a material form field. The material emission coefficient database searches its local coefficient records for coefficient records that simultaneously meet the matching conditions of the material category field and the material form field, and returns the emission coefficient value from the coefficient record as the response data.
[0031] In practice, the process of using the product of the material metering value and the emission factor of each material node as the node emission amount includes: For each material node, multiplying the material metering value of the material node by the emission factor of the material node to obtain the initial emission amount of the material node. The material metering value is the material consumption amount read from the production execution system, and the emission factor is the emission factor value obtained from the material emission factor database. The initial emission amount is the result of multiplying the material metering value and the emission factor.
[0032] The unit of measurement for the material metering value corresponding to the material node is obtained, and a pre-defined unit conversion table is consulted to obtain the unit conversion factor. The unit of measurement is obtained simultaneously when reading the material consumption from the Production Execution System (MES), and the material consumption stored in the MES includes the corresponding unit of measurement. The pre-defined unit conversion table stores the mapping relationship between different units of measurement and unit conversion factors. When querying the unit conversion table, the unit of measurement of the material metering value is used as the query condition, and the corresponding unit conversion factor is matched from the unit conversion table. The initial emission is divided by the unit conversion factor to obtain the node emission of the material node.
[0033] It is understandable that the unit conversion factor is used to adjust the initial emission value to a uniform emission measurement unit. The unit conversion factor has different values depending on the measurement unit, and the value of the unit conversion factor is directly read from the unit conversion table.
[0034] In practice, the process of summing the emissions from all nodes to obtain the total emissions of the target product includes: arranging the emissions from all nodes into an emission sequence according to the chronological order of each material node in the production process. The chronological order in the production process corresponds to the order in which the material nodes appear in the bill of materials, and the arrangement order of the material nodes in the bill of materials is consistent with the production chronological order. In the resulting emission sequence, each position corresponds to the node emission of one material node.
[0035] Starting from the first position of the emission sequence, the emission of the current node is sequentially added to the cumulative variable, and the result is updated in the cumulative variable, until all positions in the emission sequence have been traversed. The cumulative variable is initialized to zero before the traversal begins. During the traversal, the cumulative variable stores the sum of the node emissions of the material nodes that have been traversed. After traversing all positions in the emission sequence, the cumulative variable stores the sum of the node emissions of all material nodes. The final value of the cumulative variable is used as the total emission of the target product.
[0036] In some embodiments, the total emissions of the target product are calculated using the following formula:
[0037]
[0038] in, This indicates the total emissions of the target product. This indicates the number of material nodes in the production process of the target product. Indicates the first The node emission of each material node This represents the position number of the material node in the emission sequence. The value range is from 1 to Integers. The value of is determined in the following way: The first The material metering value of the first material node multiplied by the first... The emission factor of the material node is obtained from the first material node. The initial emission of the first material node is obtained. The unit of measurement for the material measurement value of the first material node is determined by querying a preset unit conversion table to obtain the unit conversion coefficient. The initial emission of the first material node divided by the unit conversion factor yields the first... The node emission of each material node.
[0039] Optionally, the update process of the accumulated variable corresponds to the accumulation operation in the above formula, and the accumulated variable is updated when it reaches the nth iteration. The value at the first material node is equal to the node emission from the first material node to the second. The value is obtained by summing the node emissions of each material node.
[0040] In practice, the first element of the emission sequence corresponds to the material node that appears first in the production process, and the last element corresponds to the material node that appears last. The traversal starts from the first element and proceeds in ascending order of position.
[0041] In practice, the process of determining the carbon footprint level of the target product based on its total emissions and multiple preset emission ranges is as follows: A preset level mapping table is obtained. This table stores the correspondence between multiple emission ranges and multiple carbon footprint levels. Each emission range has an upper limit and a lower limit. The level mapping table is stored in the carbon footprint level configuration module. Each record in the table contains the lower limit, upper limit, and carbon footprint level of the emission range. The total emissions of the target product are compared sequentially with the upper and lower limits of each emission range in the level mapping table. If the total emissions are greater than or equal to the lower limit and less than the upper limit of the current range, the carbon footprint level corresponding to the current range is taken as the carbon footprint level of the target product.
[0042] In some embodiments, when comparing the total emissions of a target product sequentially with each emission interval in the emission level mapping table, the current emission interval is selected sequentially according to the order of the emission intervals in the mapping table. The current emission interval has a lower limit and an upper limit. The total emissions of the target product are compared with the lower limit of the current emission interval, and then compared with the upper limit of the current emission interval. When the total emissions of the target product meet the condition of being greater than or equal to the lower limit of the current emission interval and less than the upper limit of the current emission interval, the comparison operation is stopped, and the carbon footprint level corresponding to the current emission interval is obtained.
[0043] It is understandable that the multiple emission ranges in the rating mapping table are numerically consecutive and non-overlapping, and the total emissions of the target product will only fall into one emission range. Once the emission range into which the total emissions of the target product fall is determined, the carbon footprint rating corresponding to that emission range is the carbon footprint rating of the target product.
[0044] In practical implementation, the condition for the total emissions of the target product to fall within the emission range is expressed by the following formula:
[0045]
[0046] in, This indicates the total emissions of the target product. The value is the total emission value of the target product obtained by summing the node emissions of all material nodes. Indicates the first in the rank mapping table The lower limit of each emission range. The value is from the first in the rank mapping table. Read the lower limit value field of each emission range; Indicates the first in the rank mapping table The upper limit of each emission range, The value is from the first in the rank mapping table. Read the upper limit value field of each emission range; This indicates the sequential number of the emission range in the emission level mapping table. The value of is an integer ranging from 1 to the total number of emission intervals. When the total emissions of the target product satisfy the above formula, the rank in the rank mapping table will be... The carbon footprint level corresponding to each emission range is used as the carbon footprint level of the target product.
[0047] In practical implementation, the process of generating initial label data based on the target product's product identifier, total emissions, node emissions of each material node, and carbon footprint level is as follows: Following a preset data structure template, the target product's product identifier is entered into the first data field, the target product's total emissions into the second data field, and the target product's carbon footprint level into the third data field. The data structure template defines the field names and field order of the first, second, third, and fourth data fields. The first data field is dedicated to storing the target product's product identifier, the second field to storing the target product's total emissions, and the third field to storing the target product's carbon footprint level. For each material node, the material node's material identifier and node emissions are combined into a key-value pair, and all key-value pairs of all material nodes are arranged in lexicographical order of the material identifiers before being entered into the fourth data field. The data record composed of the first, second, third, and fourth data fields serves as the initial label data.
[0048] In some embodiments, when the material identifier and emission quantity of a material node are combined into a key-value pair, the material identifier of the material node is used as the key, and the emission quantity of the material node is used as the value. When arranging the key-value pairs according to the lexicographical order of the material identifiers, the character codes of the material identifiers of each material node are compared, and all key-value pairs are arranged in ascending order of character code. The arranged key-value pairs are then sequentially filled into the fourth data field.
[0049] Optionally, the first, second, third, and fourth data fields in the data structure template are arranged in a fixed order, separated by a preset delimiter. The product identifier of the target product is written to the first data field, the total emissions of the target product to the second data field, the carbon footprint level of the target product to the third data field, and the key-value pairs of the arranged material nodes to the fourth data field. The resulting data record after writing is the initial tag data.
[0050] It is understandable that the initial label data includes the target product's product identifier, total emissions, carbon footprint level, as well as the material identifier and node emissions of all material nodes. The initial label data is used for subsequent segmented hash operations to generate traceability authentication codes.
[0051] See Figure 3 The figure shows a frequency distribution histogram of the total emissions of the target product, divided into intervals, based on the carbon footprint classification method described in the above embodiment. The horizontal axis represents the total emissions of the target product in a uniform unit of measurement, and the vertical axis represents the frequency (number of products) of the product within the corresponding emission interval. The figure distinguishes four carbon footprint levels with different colors: Carbon Footprint Level 1 (green), Carbon Footprint Level 2 (blue), Carbon Footprint Level 3 (yellow), and Carbon Footprint Level 4 (pink).
[0052] The diagram clearly delineates the boundaries of four emission ranges using multiple vertical dashed lines, corresponding to the lower and upper limits of the preset emission ranges in the emission level mapping table. Specifically, the first dashed line, close to 0, defines the lower limit of Level 1; the second dashed line, at approximately 500, is the boundary between Level 1 and Level 2; the third dashed line, at 1000, is the boundary between Level 2 and Level 3; the fourth dashed line, at 2000, is the boundary between Level 3 and Level 4; and the fifth dashed line, at 5000, is the upper limit of Level 4. As illustrated, the values in each emission range are continuous and non-overlapping, conforming to the definition of the emission level mapping table in the aforementioned embodiment.
[0053] Specifically, Carbon Footprint Level 1 corresponds to total emissions between 0 and 500. Within this range, the number of products is concentrated and the frequency is relatively high, with the most frequent bars reaching over forty, indicating that many products have total emissions in the lower emission range. Carbon Footprint Level 2 corresponds to total emissions between 500 and 1000, with the number of products remaining around twenty to thirty. The overall frequency is slightly lower than Level 1 but still relatively concentrated. Carbon Footprint Level 3 corresponds to emissions between 1000 and 2000, with the number of products showing a gradually decreasing trend, and the frequency ranging from single digits to over twenty, indicating relatively few products in this range. Carbon Footprint Level 4 corresponds to emissions between 2000 and 5000, with a significantly reduced frequency. Most bars have single-digit frequencies, and the frequency distribution is relatively dispersed, reflecting fewer high-emission products.
[0054] In the specific implementation, the initial label data is subjected to segmented hashing to obtain hash sequences of multiple label fields. These hash sequences are then concatenated into a traceability authentication code according to the preset order of the label fields. The initial label data is divided into product information, emission, and material details segments based on the type of the label fields. The initial label data consists of a first data field, a second data field, a third data field, and a fourth data field. The first data field stores the product identifier of the target product, the second data field stores the total emission of the target product, the third data field stores the carbon footprint level of the target product, and the fourth data field stores the key-value pairs of all material nodes. The first and third data fields are combined to form the product information segment, the second data field is used as the emission segment, and the fourth data field is used as the material details segment. Segment identifiers are assigned to the product information segment, emission segment, and material details segment respectively. These segment identifiers are used to distinguish the segments corresponding to different label fields. During the segmented hashing process, the segment identifiers for the product information segment, emission segment, and material details segment are appended to the content of the corresponding segment.
[0055] In some embodiments, the segment identifier for the product information segment is a preset string, the segment identifier for the emission quantity segment is another preset string, and the segment identifier for the material details segment is yet another preset string. The segment identifier for the product information segment is concatenated with the content of the product information segment, and the concatenated string is used as the hashable content for the product information segment. Similarly, the segment identifier for the emission quantity segment is concatenated with the content of the emission quantity segment, and the concatenated string is used as the hashable content for the emission quantity segment. Finally, the segment identifier for the material details segment is concatenated with the content of the material details segment, and the concatenated string is used as the hashable content for the material details segment.
[0056] In specific implementation, a hash operation is performed on the content of the product information segment to obtain a first hash value. The hash algorithm used in this operation is a preset hash algorithm selected from a hash algorithm library, which includes SHA-256 and SM3 algorithms. The product information segment content is used as input to the preset hash algorithm, which outputs a fixed-length hash value, which is then used as the first hash value. A hash operation is then performed on the emission quantity segment content to obtain a second hash value. The emission quantity segment content is used as input to the same preset hash algorithm, which outputs a fixed-length hash value, which is then used as the second hash value. Finally, a hash operation is performed on the material details segment content to obtain a third hash value. The material details segment content is used as input to the same preset hash algorithm, which outputs a fixed-length hash value, which is then used as the third hash value.
[0057] It is understandable that the preset hash algorithm outputs the same hash value for the same input content and different hash values for different input content. The content of the product information section, the emission volume section, and the material details section each contain different initial label data fields. Therefore, the first hash value, the second hash value, and the third hash value obtained after performing hash operations on each section are different from each other.
[0058] In practice, the first, second, and third hash values are concatenated sequentially according to the preset order of the segment identifiers. A timestamp is then appended to the end of the concatenated hash value to obtain the traceability authentication code. The preset order of the segment identifiers is the same as the order of the product information segment, emission segment, and material detail segment identifiers in the initial label data. When concatenating the segment identifiers according to the preset order, the first hash value is used as the beginning of the concatenation result, followed by the second hash value, and then the third hash value. The concatenated hash value is a string composed of the first, second, and third hash values in sequence. When appending a timestamp to the end of the concatenated hash value, the timestamp is the system time when the traceability authentication code was generated. The timestamp uses the Unix timestamp format, and its value is the number of seconds that have elapsed from 00:00:00 on January 1, 1970, to the current time when the traceability authentication code was generated. The timestamp as a string is appended to the end of the concatenated hash value, and the resulting string is used as the traceability authentication code.
[0059] In some embodiments, the generation method of the traceability authentication code is represented by the following formula:
[0060]
[0061] in, This indicates the traceability authentication code. This represents the first hash value obtained by performing a hash operation on the content of the product information segment. This represents the second hash value obtained by performing a hash operation on the content of the emission range. This represents the third hash value obtained by performing a hash operation on the contents of the material details section. This represents the timestamp appended when generating the traceability authentication code. This indicates a string concatenation operation. The acquisition method is as follows: after concatenating the segment identifier of the product information segment with the content of the product information segment, the concatenated string is used as the input of the preset hash algorithm, and the preset hash algorithm outputs the first hash value. The method for obtaining the value is as follows: after concatenating the segment identifier of the emission segment with the content of the emission segment, the concatenated string is used as the input of the preset hash algorithm, and the preset hash algorithm outputs the second hash value. The method of obtaining it is as follows: after concatenating the segment identifier of the material detail segment with the content of the material detail segment, the concatenated string is used as the input of the preset hash algorithm, and the preset hash algorithm outputs the third hash value. The method for obtaining the information is as follows: read the system time when the traceability authentication code was generated, convert the system time into a Unix timestamp format value, and then convert the Unix timestamp format value into a string format. The string is formed by concatenating the first hash value, the second hash value, the third hash value, and the timestamp in sequence, with the concatenation order consistent with the left-to-right order in the formula.
[0062] Optionally, when the default hash algorithm configured in the hash algorithm library is SHA-256, the first, second, and third hash values are all 64-bit hexadecimal strings. When the default hash algorithm configured in the hash algorithm library is SM3, the first, second, and third hash values are all 64-bit hexadecimal strings. Once the default hash algorithm is configured in the hash algorithm library, it remains unchanged throughout the entire segmented hash operation process; the same default hash algorithm is used for hashing the content of the product information segment, the emission amount segment, and the material details segment.
[0063] As can be understood, the timestamp is appended after the third hash value, and the traceability authentication code consists of four parts in sequence: the first hash value, the second hash value, the third hash value, and the timestamp. The traceability authentication code includes a timestamp portion, which can be used to determine the template version number of the label display template during subsequent traceability authentication.
[0064] See Figure 4 In the graph, the horizontal axis represents the traceability authentication code sequence number, and the vertical axis represents the normalized result of the corresponding value, with the unit of the vertical axis being the normalized unit. The four curves in the legend represent the changing trends of the first hash value, the second hash value, the third hash value, and the timestamp, respectively. According to the description of the above embodiment, the first hash value corresponds to the hash value of the product information segment, the second hash value corresponds to the hash value of the emission segment, the third hash value corresponds to the hash value of the material details segment, and the timestamp is the Unix timestamp used when the traceability authentication code was generated.
[0065] As shown in the graph, the first hash value (blue solid line), the second hash value (orange dashed line), and the third hash value (green dotted line) exhibit a relatively stable fluctuation distribution within the range of the traceability authentication code sequence number, with values fluctuating between approximately 1 and 99. This demonstrates the discreteness and unpredictability of the hash values, consistent with the characteristic of hash algorithms that output different fixed-length hash values for different initial tag data segments. The fluctuation trends of the three hash value curves are independent of each other, without obvious synchronous changes, indicating that the hash operation results of each segment have good independence.
[0066] The timestamp curve (red dotted line) shows a linear increasing trend with the traceability authentication code number, starting from a normalized value close to 0 and gradually increasing to close to 100. This reflects the progressive nature of the timestamp with the generation time of the traceability authentication code, which is consistent with the Unix timestamp format of the current system time in the above embodiment, and the characteristic that the timestamp is appended to the end of the traceability authentication code.
[0067] In specific implementation, please refer to Figure 2 The process of extracting the authentication code from the source tracing request is as follows: Parse the header of the source tracing request data packet, read the request type identifier from the header, and determine whether the request type identifier is an authentication type identifier. The header of the source tracing request data packet is located at the beginning of the request. The header contains a request type identifier field and a frame length field. The request type identifier field indicates the purpose and type of the source tracing request. The value of the request type identifier includes an authentication type identifier and a non-authentication type identifier. The authentication type identifier takes the first identifier value, and the non-authentication type identifier takes the second identifier value. The first and second identifier values are different from each other. When reading the request type identifier from the header, according to the structure definition of the header, a fixed-length request type identifier value is read from the starting offset position of the request type identifier field.
[0068] If the request type identifier is an authentication type identifier, the encoded field is extracted from the data body of the origin tracing request, and the string stored in the encoded field is used as the authentication code to be verified. The data body of the origin tracing request is located after the data packet header, and contains the encoded field. The string stored in the encoded field is the authentication code sent by the terminal. If the request type identifier is not an authentication type identifier, the extraction operation is rejected and an error message is returned, which includes a status code indicating an incorrect request type.
[0069] In practical implementation, if the authentication code to be verified matches the traceability authentication code, the initial label data is rendered according to the preset label display template, and the process of generating and feeding back the authentication label page to the terminal is as follows: The authentication code to be verified is divided into a first segment, a second segment, and a third segment according to a preset number of bits, and each segment is compared bit by bit with the first hash value, the second hash value, and the third hash value in the traceability authentication code. The preset number of bits is the length of the first hash value, and the lengths of the first, second, and third hash values are all determined by a preset hash algorithm, which is either the SHA-256 algorithm or the SM3 algorithm. The lengths of the first, second, and third hash values are all 64 hexadecimal characters. The first segment is the first segment, the second segment is the second segment, and the third segment is the third segment. In the traceability authentication code, the first hash value is located at the beginning of the traceability authentication code, the second hash value is located after the first hash value, the third hash value is located after the second hash value, and the timestamp is located after the third hash value.
[0070] During the bit-by-bit comparison, each character in the first segment to be verified is compared with the corresponding character in the first hash value of the traceability authentication code; each character in the second segment to be verified is compared with the corresponding character in the second hash value of the traceability authentication code; and each character in the third segment to be verified is compared with the corresponding character in the third hash value of the traceability authentication code. If the first, second, and third segments all match the corresponding hash values in the traceability authentication code, then the verification authentication code is determined to match the traceability authentication code. The matching condition is expressed by the following formula:
[0071]
[0072] in, Indicates the first segment to be tested. The value is the first string segment extracted from the authentication code to be verified, divided into preset length segments. Indicates the second segment to be tested. The value is the middle segment string divided into preset lengths from the authentication code to be verified; Indicates the third segment to be tested. The value is the last segment of the authentication code to be verified, divided into preset lengths. This represents the first hash value in the traceability authentication code. The value is the first hash value obtained by performing a hash operation on the content of the product information segment when generating the traceability authentication code; This represents the second hash value in the traceability authentication code. The value is the second hash value obtained by performing a hash operation on the content of the emission range when generating the traceability authentication code; This represents the third hash value in the traceability authentication code. The value is the third hash value obtained by performing a hash operation on the contents of the material details section when generating the traceability authentication code; This indicates that the two strings are completely identical; This represents a logical AND operation, requiring three equality conditions to be met simultaneously. When all three equality conditions in the above formula are met, the authentication code to be verified matches the traceability authentication code.
[0073] After a successful match, the timestamp is extracted from the source code, and the template version number of the tag display template is determined based on the timestamp. The initial tag data is then rendered according to the tag display template corresponding to the template version number, generating the certified tag page. When extracting the timestamp from the source code, the timestamp is located after the third hash value, and its length is the preset Unix timestamp string length. The preset length string is truncated from the end of the third hash value of the source code as the timestamp. When determining the template version number of the tag display template based on the timestamp, the template version mapping table is queried. The template version mapping table stores the correspondence between multiple timestamp intervals and multiple template version numbers. The extracted timestamp is compared with each timestamp interval in the template version mapping table. If the timestamp falls into a certain timestamp interval, the template version number of the timestamp falling into the timestamp interval is used as the template version number of the tag display template. When rendering the initial label data according to the label display template corresponding to the template version number, the label display template corresponding to the template version number is read from the template storage module. The label display template contains the layout structure of the label page and the field fill positions. The product identifier, total emissions, carbon footprint level, and material identifier and node emissions of each material node in the initial label data are filled into the corresponding field fill positions in the label display template. After rendering, the certification label page is generated. The certification label page is then fed back to the terminal.
[0074] Optionally, when determining whether a request type identifier is an authentication type identifier, if the value of the request type identifier is equal to the first identifier value, then the request type identifier is an authentication type identifier; if the value of the request type identifier is not equal to the first identifier value, then the request type identifier is not an authentication type identifier. When returning an error message, the error message includes a preset error code, which is used to indicate that the request type is invalid.
[0075] It is understandable that, apart from the first, second, and third segments to be verified, the remaining part of the authentication code to be verified is the timestamp part. However, during the matching process, only the segments corresponding to the three hash values are compared, and the timestamp part is not involved in the hash value comparison.
[0076] See Figure 5 In the graph, the horizontal axis represents the number of matching segments of the authentication code to be verified, divided into four intervals: 0 segments, 1 segment, 2 segments, and 3 segments. The left vertical axis represents the frequency corresponding to each number of matching segments, in "times". The right vertical axis represents the cumulative percentage, in percentage (%). The blue bars in the graph reflect the frequency distribution of different numbers of matching segments, and the red line represents the trend of the cumulative percentage.
[0077] As shown in the graph, the frequency reaches its highest point when there are 0 matching segments, approximately 370 times, accounting for about 72% of the total sample. The frequency gradually decreases as the number of matching segments increases, with approximately 90 times for 1 matching segment, approximately 30 times for 2 matching segments, and the lowest frequency (approximately 8 times) for 3 matching segments. The red cumulative percentage curve shows a monotonically increasing trend, starting at approximately 72%, increasing to approximately 93% after 1 matching segment, reaching approximately 98% after 2 matching segments, and finally approaching 100% with 3 matching segments.
[0078] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for generating and authenticating carbon footprint labels, characterized in that, The method includes: Obtain the material identifiers and material measurement values of multiple material nodes in the production process of the target product, and query the preset material emission coefficient library based on the material identifiers of each material node to obtain the emission factor of each material node. The product of the material metering value and the emission factor at each material node is taken as the node emission of each material node, and the sum of the emission of all nodes is taken as the total emission of the target product. Based on the total emissions of the target product and multiple preset emission ranges, determine the carbon footprint level of the target product, and generate initial label data based on the product identifier, total emissions, node emissions of each material node, and carbon footprint level of the target product. The initial tag data is segmented and hashed to obtain a hash sequence of multiple tag fields. The hash sequences are then concatenated into a traceability authentication code according to the preset order of each tag field. When a tracing request is received from the terminal, the authentication code to be verified is extracted from the tracing request. If the authentication code to be verified matches the tracing authentication code, the initial tag data is rendered according to the preset tag display template, and an authentication tag page is generated and fed back to the terminal.
2. The method for generating and authenticating carbon footprint labels according to claim 1, characterized in that, The acquisition of material identifiers and material measurement values for multiple material nodes in the production process of the target product includes: Obtain the bill of materials for the production process of the target product. The bill of materials contains material codes for multiple material nodes recorded sequentially according to the production timeline. Each material code in the bill of materials is used as the material identifier for each material node. For each material node, the material consumption corresponding to that material node is read from the production execution system based on the material identifier of that material node. The read material consumption amount is used as the material metering value for this material node.
3. The method for generating and authenticating carbon footprint labels according to claim 2, characterized in that, The step of querying a preset material emission coefficient database based on the material identifier of each material node to obtain the emission factor of each material node includes: For each material node, extract the material category field and material form field from the material identifier of that material node; Combine the material category field and the material form field into a query key, and search for coefficient records that match the query key in the material emission coefficient database; The emission coefficient values stored in the coefficient record are used as the emission factors for this material node.
4. The method for generating and authenticating carbon footprint labels according to claim 1, characterized in that, The method of using the product of the material metering value and the emission factor of each material node as the node emission amount of each material node includes: For each material node, the initial emission amount of that material node is obtained by multiplying the material metering value of that material node by the emission factor of that material node. Obtain the unit of measurement for the material measurement value corresponding to the material node, and query the preset unit conversion table based on the unit of measurement to obtain the unit conversion coefficient; Divide the initial emission by the unit conversion factor to obtain the node emission of the material node.
5. The method for generating and authenticating carbon footprint labels according to claim 1, characterized in that, The summation of emissions from all nodes to obtain the total emissions of the target product includes: Arrange the emissions of all nodes into an emission sequence according to the time sequence of each material node in the production process. Starting from the first position of the emission sequence, the emission of the current position node is added to the cumulative variable in turn, and the result of the addition is updated to the cumulative variable, until all positions of the emission sequence have been traversed; The final value of the accumulated variables is taken as the total emissions of the target product.
6. The method for generating and authenticating carbon footprint labels according to claim 1, characterized in that, The process of determining the carbon footprint level of the target product based on its total emissions and multiple preset emission ranges includes: Obtain the preset level mapping table, which stores the correspondence between multiple emission ranges and multiple carbon footprint levels. Each emission range has an upper limit value and a lower limit value. The total emissions of the target product are compared sequentially with the upper and lower limits of each emission interval in the grade mapping table. If the total emissions are greater than or equal to the lower limit of the current interval and less than the upper limit of the current interval, the carbon footprint grade corresponding to the current interval is taken as the carbon footprint grade of the target product.
7. The method for generating and authenticating carbon footprint labels according to claim 1, characterized in that, The initial labeling data is generated based on the target product's product identifier, total emissions, node emissions at each material node, and carbon footprint level, including: According to the preset data structure template, fill in the product identifier of the target product into the first data field, fill in the total emissions into the second data field, and fill in the carbon footprint level into the third data field; For each material node, the material identifier and the node emission quantity of that material node are combined into a key-value pair, and all key-value pairs of material nodes are sorted in lexicographical order of the material identifier and then filled into the fourth data field. The data record consisting of the first data field, the second data field, the third data field, and the fourth data field is used as the initial label data.
8. The method for generating and authenticating carbon footprint labels according to claim 1, characterized in that, The step of performing segmented hashing on the initial tag data to obtain a hash sequence of multiple tag fields, and then concatenating the hash sequences into a traceability authentication code according to a preset arrangement order of the tag fields, includes: The initial label data is divided into product information segment, emission segment and material detail segment according to the type of label field, and segment identifiers are assigned to each of the product information segment, emission segment and material detail segment; Perform a hash operation on the content of the product information segment to obtain the first hash value; perform a hash operation on the content of the emission amount segment to obtain the second hash value; and perform a hash operation on the content of the material details segment to obtain the third hash value. According to the preset arrangement order of the segment identifiers, the first hash value, the second hash value, and the third hash value are concatenated in sequence, and a timestamp is appended to the end of the concatenated hash value to obtain the traceability authentication code.
9. The method for generating and authenticating carbon footprint labels according to claim 1, characterized in that, The extraction of the authentication code to be verified from the source tracing request includes: Parse the header of the source tracing request, read the request type identifier from the header, and determine whether the request type identifier is an authentication type identifier; If the request type identifier is an authentication type identifier, then the encoding field is extracted from the data body of the source tracing request, and the string stored in the encoding field is used as the authentication code to be verified. If the request type identifier is not an authentication type identifier, the retrieval operation will be rejected and an error message will be returned.
10. The method for generating and authenticating carbon footprint labels according to claim 8, characterized in that, If the authentication code to be verified matches the traceability authentication code, the initial label data is rendered according to the preset label display template, and an authentication label page is generated and fed back to the terminal, including: The authentication code to be verified is divided into a first segment, a second segment, and a third segment according to a preset number of bits. The first segment, the second segment, and the third segment are then compared bit by bit with the first hash value, the second hash value, and the third hash value in the traceability authentication code. If the first segment to be verified, the second segment to be verified, and the third segment to be verified all match the corresponding hash value in the traceability authentication code, then the authentication code to be verified is determined to match the traceability authentication code. After a successful match, the timestamp is extracted from the source verification code, and the template version number of the tag display template is determined based on the timestamp. The initial tag data is then rendered according to the tag display template corresponding to the template version number to generate the authentication tag page.