A method and system for carbon footprint traceability of metering boxes
By using asymmetric encryption and hash algorithms to sign and concatenate the carbon emission data from metering bins, combined with a fault-tolerant consensus algorithm, the problem of reliable transmission and version consistency of carbon emission data across entities is solved, achieving data immutability and multi-party recognition, and supporting carbon accounting and compliance auditing.
Patent Information
- Application Number
- CN202611252427.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-18
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, the decentralized recording of carbon emission data from metering boxes makes it impossible to verify the authenticity and completeness of vouchers when transferring data across entities, making reliable data transfer difficult. Furthermore, inconsistent versions and the lack of a multi-party consensus mechanism make it difficult to meet the needs of carbon accounting and compliance auditing.
Asymmetric encryption algorithms are used to sign carbon emission data with private keys. Feature values are extracted using hash algorithms and underlying byte concatenation is performed. Cross-domain transfer records are constructed using one-way association mapping verification. Combined with fault-tolerant consensus algorithms, the data is written into the global carbon emission ledger to ensure data integrity and version consistency.
It enables the reliable flow and version consistency of metering box carbon footprint data, ensuring the data source is undeniable, preventing tampering, and providing a reliable foundation for carbon accounting and compliance auditing.
Smart Images

Figure CN123116352A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of carbon footprint traceability technology, and in particular to a method and system for tracing the carbon footprint of a metering box. Background Technology
[0002] Carbon footprint management of power equipment has become a crucial aspect of emission reduction in the energy industry. As core equipment in the power system, metering boxes involve multiple independent entities and geographical regions during their assembly and transportation phases. The reliable cross-entity transfer and tamper-proof protection of carbon emission data are pressing technical challenges. Currently, the application of information technologies such as blockchain, asymmetric encryption, and hash algorithms is receiving increasing attention, providing a technological foundation for building a cross-entity, verifiable carbon data management system.
[0003] In existing technologies, carbon emission data management for metering boxes generally employs independent systems maintained by each participating party. During the assembly phase, carbon emission data is recorded by the manufacturer using energy consumption monitoring equipment and stored in a local database; during the transportation phase, mileage and fuel consumption data are collected by the logistics provider through onboard terminals and stored separately. This two-stage, decentralized recording method isolates carbon emission data, making it impossible for the recipient to verify the authenticity and completeness of credentials during cross-enterprise transfers, with data authenticity relying on subjective trust in the provider. Furthermore, under traditional database storage methods, carbon emission data can be modified or deleted at any time by personnel with administrative privileges after entry, and the operation traces are difficult to trace. Although some solutions introduce digital signatures to identify data sources, when assembly phase data needs to be combined with transportation phase data to form a complete record chain, the lack of cryptographic protection between the preceding and following data allows any party to replace or delete parts of the content, making it difficult for downstream recipients to detect tampering. In addition, the independent storage of carbon footprint records by each participating party leads to inconsistent data versions, and the lack of a multi-party consensus mechanism means there is no reliable audit basis in case of data disputes, severely restricting the application of carbon footprint data in carbon accounting and compliance auditing. Summary of the Invention
[0004] This application provides a method and system for tracing the carbon footprint of a metering box, which solves the technical problems of reliable flow and version consistency of carbon data across stages, and improves the verifiability and auditing efficiency of carbon footprint data.
[0005] Firstly, this application provides a method for tracing the carbon footprint of a metering box, including: S1. Obtain the initial carbon emission data generated during the assembly stage, and use an asymmetric encryption algorithm to perform private key signing on the initial carbon emission data to obtain the first carbon emission record with the first identity tag. S2. Based on the first carbon emission record, extract its underlying data feature values using a hash algorithm to obtain a first hash digest; S3. Determine whether the first hash digest meets the preset fixed length verification condition. If so, the first carbon emission record and the first hash digest are structured and packaged to generate an initial handover certificate. S4. Obtain the second carbon emission data generated during the transportation phase, and use an asymmetric encryption algorithm to perform private key signing on the second carbon emission data to obtain the second carbon emission record with a second identity tag. S5. Convert the initial handover certificate into a first underlying byte sequence, convert the second carbon emission record into a second underlying byte sequence, and then concatenate the underlying bytes. Extract the feature value of the concatenated byte stream using a hash algorithm to obtain a second hash digest. S6. Determine whether there is a one-way association mapping relationship between the second hash digest and the first hash digest in the initial handover certificate. If so, encapsulate the second carbon emission record, the initial handover certificate and the second hash digest in a structured manner to generate a cross-domain transfer record. S7. A fault-tolerant consensus algorithm is used to perform multi-node broadcast verification of the cross-domain transfer record. After successful verification, the record is written into the global carbon emission ledger to obtain a carbon footprint record from assembly to transportation with version consistency.
[0006] Secondly, this application provides a metering box carbon footprint traceability system for implementing the aforementioned metering box carbon footprint traceability method, including: The assembly acquisition module is used to acquire the initial carbon emission data generated during the assembly stage, and to perform private key signing on the initial carbon emission data using an asymmetric encryption algorithm to obtain the first carbon emission record with a first identity tag. The digest extraction module is used to extract the underlying data feature values of the first carbon emission record using a hash algorithm to obtain a first hash digest. The digest packaging module is used to determine whether the first hash digest meets the preset fixed length verification condition. If so, the first carbon emission record and the first hash digest are structured and packaged to generate an initial handover certificate. The transportation acquisition module is used to acquire the second carbon emission data generated during the transportation phase, and to perform private key signing on the second carbon emission data using an asymmetric encryption algorithm to obtain a second carbon emission record with a second identity tag. The sequence splicing module is used to convert the initial handover certificate into a first underlying byte sequence, convert the second carbon emission record into a second underlying byte sequence, and then splice the underlying bytes. The feature values of the spliced byte stream are extracted by a hash algorithm to obtain a second hash digest. The circulation generation module is used to determine whether there is a one-way association mapping relationship between the second hash digest and the first hash digest in the initial handover certificate. If so, the second carbon emission record, the initial handover certificate and the second hash digest are structured and encapsulated to generate a cross-domain circulation record. The consensus on-chain module is used to perform multi-node broadcast verification of the cross-domain transfer record using a fault-tolerant consensus algorithm. After successful verification, the record is written into the global carbon emission ledger to obtain a carbon footprint record from assembly to transportation with version consistency.
[0007] Thirdly, this application provides a computer-readable storage medium storing instructions that, when executed by a processor, implement the aforementioned method for tracing the carbon footprint of a metering box.
[0008] The beneficial effects of this application are as follows: This application proposes a method and system for tracing the carbon footprint of a metering box. Compared with the prior art, this application implements asymmetric encryption signature on carbon emission data during the assembly and transportation stages to bind the source identity. The initial handover certificate generated during the assembly stage is concatenated and hashed with the data during the transportation stage at the underlying level. A cross-domain transfer record is constructed based on one-way association mapping verification. After multi-node broadcast verification by a fault-tolerant consensus algorithm, it is written into the global carbon emission ledger. This can solve the technical problems of difficulty in reliable transfer of carbon emission data caused by the two-stage decentralized records, difficulty in detecting data tampering, and inconsistency of carbon footprint versions among multiple participants. Specifically, this application performs private key signing and identity tagging on carbon emission data during the assembly and transportation stages, respectively, ensuring that the data at each stage possesses an undeniable source attribute at the moment of generation, establishing a trust anchor for cross-entity transmission. By concatenating the initial handover certificate from the assembly stage with the second carbon emission record from the transportation stage at the low-level byte level and extracting the second hash digest, the one-way and sensitivity of hash operations are utilized to couple the data from the preceding and following stages into a cryptographically related whole. This ensures that any modification to the data at any stage will disrupt the consistency of the concatenated byte stream's characteristic values, achieving a shift in the cross-stage data integrity protection mechanism from reliance on human management to mathematical verification. Furthermore, by comparing the second hash digest with the original first carbon emission record in the initial handover certificate... A one-way association mapping between hash digests ensures that only two-stage data that passes integrity verification can be structured and encapsulated into cross-domain transfer records, effectively preventing data from being replaced or deleted during the merging process. Based on this, a fault-tolerant consensus algorithm is used to broadcast and verify the cross-domain transfer records to multiple nodes and write them into the global carbon emission ledger. This enables multiple participants distributed in different geographical locations to reach a consensus on the same carbon footprint history through a distributed voting mechanism, avoiding version differences and data disputes caused by a single centralized storage. This results in a carbon footprint record that is verifiable in origin, immutable in content, linked across stages, and consistent in version, assembled from the metering box into the transportation stage, providing a reliable data foundation for carbon accounting, carbon trading, and compliance auditing. Attached Figure Description
[0009] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a flowchart illustrating a method for tracing the carbon footprint of a metering box according to this application. Figure 2 This is a diagram illustrating the synchronization and convergence process of the ledger copies of each node after being written in this application; Figure 3 This is a comparison chart of interception rates under typical tampering attacks in this application; Figure 4 This is a schematic diagram of the structure of a metering box carbon footprint traceability system according to this application. Detailed Implementation
[0011] This application provides a method and system for tracing the carbon footprint of a metering box. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0012] For ease of understanding, the specific process of the embodiments of this application is described below. Please refer to [link / reference]. Figure 1 One embodiment of a method for tracing the carbon footprint of a metering box in this application includes: S1. Obtain the initial carbon emission data generated during the assembly stage, and use an asymmetric encryption algorithm to perform private key signing on the initial carbon emission data to obtain the first carbon emission record with the first identity tag.
[0013] In one specific embodiment, performing S1 includes the following steps: Acquire energy consumption, welding process emissions, and raw material processing carbon emission data collected by energy consumption monitoring equipment at each workstation during the metering box assembly stage, and summarize them to form initial carbon emission data including timestamp, process identifier, equipment number, and emission amount fields; A secure hash algorithm is used to extract features from the initial carbon emission data to obtain a target data digest. The private key of the first processing node is used to sign the target data digest to obtain the signed ciphertext. The first identity tag is determined by concatenating the signature ciphertext based on the registration identifier of the first processing node. The first identity tag and the initial carbon emission data are then encapsulated to obtain the first carbon emission record with the first identity tag.
[0014] Specifically, the metering box assembly stage includes workstations such as sheet metal processing, welding, installation of internal circuit breakers and metering instruments, and wiring. Each workstation's power distribution circuit is equipped with energy consumption monitoring equipment. This equipment is a multi-functional power meter with energy metering and data uploading functions. It collects the voltage, current, and power factor of the workstation equipment at a sampling interval of 1 second. The three are multiplied to obtain the instantaneous power. The instantaneous power is converted to kilowatts. The instantaneous power is multiplied by the number of hours corresponding to the sampling interval to obtain the energy increment for a single sampling. When the sampling interval is 1 second, the number of hours is 1 divided by 3600. The energy increment is accumulated within the start and end time of a single process to obtain the energy consumption of that process, in kilowatt-hours. The energy consumption is multiplied by the electricity carbon emission factor to obtain the energy carbon emission. For example, the electricity carbon emission factor is 0.5568 kg of carbon dioxide per kilowatt-hour. Welding process emissions are calculated from two parts: welding wire consumption and carbon dioxide shielding gas consumption. The calculation method is to multiply the welding wire consumption by the welding wire carbon emission factor, plus the shielding gas consumption volume multiplied by the carbon dioxide density under standard conditions of 1.977 kg / m³. The carbon dioxide shielding gas is included in the emissions based on its consumption mass; for example, the welding wire carbon emission factor is taken as 1.9 kg of carbon dioxide per kilogram. Raw material processing carbon emissions are obtained by multiplying the mass of cold-rolled steel sheet used in box body processing by the material carbon emission factor; for example, the cold-rolled steel sheet carbon emission factor is taken as 2.0 kg of carbon dioxide per kilogram. The data collected and converted from each workstation are aggregated according to a unified data structure to form initial carbon emission data. This initial carbon emission data is a collection of multiple workstation records. Each workstation record contains four fields: timestamp, process identifier, equipment number, and emissions. The timestamp is a Unix timestamp of the record's creation time, with a resolution of 1 second. The process identifier is an 8-digit code: the first two digits represent the workshop number, the middle two digits represent the production line number, and the last four digits represent the process number. The equipment number is the asset code of the energy consumption monitoring equipment. The emissions field represents the sum of the carbon emissions from electrical energy, welding processes, and raw material processing recorded at that workstation, expressed in kilograms of carbon dioxide, rounded to two decimal places. The initial carbon emission data is organized in JSON text format, with each field value represented by text characters, providing a unified format for subsequent deserialization processing.
[0015] After the initial carbon emission data is aggregated, the first processing node serializes the initial carbon emission data into a UTF-8 encoded byte sequence and uses the SHA-256 secure hash algorithm to extract features from the byte sequence to obtain the target data digest. The first processing node is an edge computing node deployed in the assembly workshop, responsible for the aggregation and signature processing of carbon emission data during the assembly stage. The SHA-256 algorithm groups the input byte sequence into 512-bit blocks, pads the end according to the padding rules, and appends 64 bits of length information. After 64 rounds of compression iterations, a 256-bit digest, or 32 bytes, is output. Any change in any byte in the input byte sequence will cause a change in the target data digest. The signature processing uses the elliptic curve digital signature algorithm, with the secp256r1 curve selected. The private key of the first processing node is a 256-bit random integer, and the public key is generated by scalar multiplication of the private key and the elliptic curve base point, and is registered with the network when the node joins the network. The signature processing procedure is as follows: A 256-bit signature random number is generated. The scalar multiplication of the signature random number with the elliptic curve base point yields the curve point. The first signature component is obtained by taking the modulo of the curve point's x-coordinate with the base point's order. The second signature component is then calculated using the target data digest, private key, and signature random number according to the signature equation. Each signature component is 32 bytes, and they are concatenated sequentially to obtain a 64-byte signature ciphertext. Therefore, one target data digest corresponds to one signature ciphertext. If the target data digest remains unchanged, signature verification will pass; any alteration will result in signature failure.
[0016] After obtaining the signed ciphertext, the first identity tag is determined based on the registration identifier of the first processing node. The registration identifier is a unique code assigned by the certificate authority when the first processing node joins the carbon emission ledger network. The certificate authority is the organization responsible for verifying the node's identity upon joining the network and issuing certificates. The registration identifier is 32 bytes long. The binding relationship between the registration identifier and the first processing node's public key is stored in the network node's registry. The receiver can retrieve the corresponding public key based on the registration identifier. The registration identifier is used as a prefix and concatenated with the signed ciphertext byte by byte to obtain a 96-byte first identity tag. Encapsulation processing is performed according to a preset encapsulation structure, which includes a tag field and a data field. The first identity tag is Base64 encoded into printable characters and written to the tag field. The initial carbon emission data is written to the data field. The two are combined into a JSON object to obtain the first carbon emission record with the first identity tag. The resulting data correspondence is as follows: multiple collection records from multiple workstations correspond to one initial carbon emission data, one initial carbon emission data corresponds to one target data digest, one target data digest corresponds to one signature ciphertext, one registration identifier and one signature ciphertext correspond to one first identity tag, and one first identity tag and one initial carbon emission data correspond to one first carbon emission record.
[0017] S2. Based on the first carbon emission record, extract its underlying data feature values using a hash algorithm to obtain the first hash digest.
[0018] In one specific embodiment, performing S2 includes the following steps: Obtain the first carbon emission record, perform byte parsing operation on the first carbon emission record, extract the underlying bytecode corresponding to each data field in the field order, and form an initial underlying feature set; Assign an order status identifier to each feature element in the initial underlying feature set, arrange and combine them according to the preset field type priority, and determine the target feature sequence; Verify whether the target feature sequence conforms to the preset data structure integrity rules. If it does, perform symmetric encryption on the target feature sequence to obtain an encrypted feature sequence. Extract a fixed-length digest from the encrypted feature sequence using a hash algorithm to obtain the first hash digest.
[0019] Specifically, after obtaining the first carbon emission record, a byte parsing operation is performed on it. This byte parsing operation is the process of restoring the JSON character stream to the underlying bytecode of each field. Parsing is performed according to JSON deserialization rules, converting all field values from text characters to their corresponding binary forms, with big-endian byte order uniformly adopted. The first carbon emission record consists of a tag field and a data field. The tag field carries the first identity tag encoded in Base64. When parsing the tag field, Base64 characters are decoded to restore the 96-byte identity tag bytecode. The data field carries the timestamp, process identifier, equipment number, and emission amount of each workstation record. The text value of the timestamp field is converted to the 8-byte timestamp bytecode corresponding to a 64-bit unsigned integer. The text value of the emission amount field is converted to 4-byte emission amount bytecode according to the IEEE 754 single-precision floating-point format. The process identifier field and the equipment number field are converted to UTF-8 bytecode. The equipment number field is a variable-length field, with a 2-byte length identifier appended to its bytecode. The length identifier records the actual number of bytes in the equipment number bytecode. The bytecode extracted from each field is used as a feature element. All feature elements constitute the initial underlying feature set. For example, when the first carbon emission record contains 12 workstation records, the data field generates 48 feature elements. Together with the 1 feature element generated by the tag field, the initial underlying feature set contains a total of 49 feature elements. That is, one first carbon emission record corresponds to one initial underlying feature set, and multiple data fields correspond to multiple feature elements.
[0020] Each feature element in the initial underlying feature set is assigned a sequence status identifier, a 16-bit unsigned integer starting from 0 and incrementing according to the extraction order of the feature elements, used to mark the source position of the feature elements. Subsequently, the feature elements are arranged and combined according to a preset field type priority, with the field type priority set from high to low as numeric fields, character fields, and coded fields. Emissions and timestamp fields are numeric fields, process identifier and equipment number fields are character fields, and identity tag fields are coded fields. During arrangement, all feature elements are sorted from high to low priority, and feature elements within the same priority are arranged from small to large according to their sequence status identifiers. After arrangement, the bytecode of each feature element is concatenated sequentially, with the length identifier participating in the concatenation along with the corresponding equipment number feature element, forming a continuous target feature sequence. This arrangement rule ensures that the target feature sequences generated by the same first carbon emission record at different processing nodes remain consistent, eliminating the impact of differences in the output field order of different serialization tools on the summary results.
[0021] The target feature sequence undergoes a data structure integrity check. The preset data structure integrity rules include four criteria: all sequential status identifiers increment continuously from 0 to the total number of feature elements minus 1, with no duplicate or missing identifiers; the byte length of each feature element conforms to the standard length of its corresponding field type: timestamp bytecode is 8 bytes, process identifier bytecode is 8 bytes, emission quantity bytecode is 4 bytes, and the equipment number bytecode length is based on the value recorded in the length identifier and does not exceed 16 bytes; the total number of feature elements equals the number of workstation records in the data field multiplied by 4 plus 1; if any workstation record has a missing field, the total number of feature elements decreases accordingly, and the check fails; the floating-point value restored from the emission quantity bytecode is non-negative and not greater than the preset single-process emission limit (e.g., 1000 kg of carbon dioxide), and the integer value restored from the timestamp bytecode is not later than the Unix timestamp at the time of the check execution. If all four criteria are met simultaneously, the target feature sequence is deemed to conform to the data structure integrity rules; if any one criterion is not met, the first carbon emission record is deemed to have a missing or corrupted field, the summary extraction process is terminated, and a structure anomaly alarm is generated.
[0022] After successful verification, symmetric encryption is performed on the target feature sequence. The symmetric encryption uses the AES algorithm with a 128-bit key length and operates in cipher block chaining mode with a block length of 128 bits. The initial vector is the first 16 bytes of the 256-bit digest obtained by SHA-256 operation on the target feature sequence. Each target feature sequence corresponds to a unique initial vector, and the same plaintext sequence generates a unique ciphertext, ensuring that the encrypted feature sequences generated by different processing nodes for the same first carbon emission record are completely consistent. The initial vector can be recalculated by the receiver from the target feature sequence and does not need to be transmitted with the ciphertext. The padding method uses PKCS7 padding. When the byte length of the target feature sequence is not an integer multiple of 16 bytes, it is padded with bytes corresponding to the missing bytes to make it an integer multiple of 16 bytes before performing block encryption. The ciphertext of each block is chained with the ciphertext of the previous block to obtain the encrypted feature sequence. The session key is generated by the first processing node and the receiving node through elliptic curve Diffie-Hellman key exchange negotiation: both parties calculate a shared point based on the secp256r1 curve using their respective registered private keys and the other party's registered public keys. The x-coordinate of the shared point is then processed by SHA-256, and the first 128 bits are truncated as the session key. The session key is stored in the node's cryptographic device, with an example update period of 30 days. After expiration, it is renegotiated in the same manner, and the receiving node uses this key to perform the decryption operation to complete the verification. The encrypted feature sequence corresponds one-to-one with the target feature sequence, and any modification to any byte of the plaintext is propagated to all subsequent blocks through block chaining.
[0023] A fixed-length digest is extracted from the encrypted feature sequence using a hash algorithm. The hash algorithm used is SHA-256, which groups the encrypted feature sequence into 512-bit blocks. After 64 rounds of compression iterations, a 256-bit digest, or 32-byte first hash digest, is output. The resulting data correspondence is as follows: one first carbon emission record corresponds to one initial underlying feature set, one initial underlying feature set corresponds to one target feature sequence, one target feature sequence corresponds to one encrypted feature sequence, and one encrypted feature sequence corresponds to one first hash digest. Any change in any byte of any field will completely change the first hash digest through three levels of permutation, encryption, and hashing. It should be noted that the target data digest extracted from the initial carbon emission data during S1 only covers the initial carbon emission data itself and is used for private key signing to bind the source identity and solve the non-repudiation problem. The first hash digest extracted in this step covers the complete first carbon emission record containing the first identity tag and the initial carbon emission data and is used for initial handover certificate packaging and cross-stage integrity verification. The two digests have different protection objects and purposes.
[0024] S3. Determine whether the first hash digest meets the preset fixed length verification condition. If so, the first carbon emission record and the first hash digest are structured and packaged to generate the initial handover certificate.
[0025] In one specific embodiment, performing S3 includes the following steps: Perform a byte length calculation on the first hash digest to obtain the digest length value; The abstract length value is compared with the preset standard length value to determine whether the abstract length value meets the preset fixed length verification condition. If the preset fixed-length verification condition is met, the carbon emission data field, identity tag field, and timestamp field are extracted from the first carbon emission record. The extracted fields are then merged with the first hash digest to form a merged data set. The merged data set is subjected to structured encapsulation and serialization packaging to generate initial handover documents for cross-stage transfer.
[0026] Specifically, a byte length counting operation is performed on the first hash digest. The first hash digest is the binary digest output by the SHA-256 algorithm. The byte length counting operation is a process of sequentially reading and counting the byte array of the digest: starting from the first byte of the digest, traversing byte by byte to the last byte, counting the total number of bytes traversed, and obtaining the digest length value in bytes. Alternatively, the digest length value can be obtained by directly reading the length attribute of the byte array. The SHA-256 algorithm always outputs 256 bits for any input length. Therefore, the digest length value corresponding to the normally generated first hash digest is 32 bytes. For example, after performing digest extraction on the first carbon emission record containing 12 workstation records, its first hash digest digest has a digest length value of 32 bytes.
[0027] The digest length is compared with a preset standard length, which is a pre-defined benchmark based on the output bit width of the hash algorithm. The SHA-256 algorithm has an output bit width of 256 bits, corresponding to a standard length of 32 bytes. The comparison determines if the two values are completely equal. If the difference between the digest length and the standard length is zero, they are considered equal, and the digest length meets the preset fixed-length verification condition, allowing the packaging process to continue. If the digest length is 31 bytes, 33 bytes, or any other value not exceeding 32 bytes, they are considered unequal, indicating that the digest has been truncated, extra bytes have been added at the end, or the hash algorithm parameters are misconfigured. This terminates the packaging process, generates a digest error alarm, and triggers a re-execution of the digest extraction instruction. The length equality comparison intercepts corrupted digests before voucher generation, preventing abnormal fingerprints from entering the cross-stage transmission process.
[0028] After successful verification, the carbon emission data field, identity tag field, and timestamp field are extracted from the JSON object of the first carbon emission record by field name: The carbon emission data field is the content of the data field, which carries the process identifier, equipment number, and emission amount of each workstation record, reflecting the carbon emission details during the metering box assembly stage; The identity tag field is the content of the tag field, which carries the first identity tag encoded in Base64, reflecting the identity of the data source; The timestamp field is a timestamp sequence composed of the timestamp fields of each workstation record in the data field according to the workstation record order. The timestamp sequence is organized in the JSON as an array, and the array elements are numeric Unix timestamp integers. The order of the elements is consistent with the order of each workstation record in the data field. The number of array elements is equal to the number of workstation records. For example, when the first carbon emission record contains 12 workstation records, the timestamp sequence is a JSON array containing 12 numeric elements. The timestamp sequence is used by the voucher recipient to verify the data generation time sequence. The extracted three types of fields are then merged with the first hash digest. The merging is performed in a preset element order: the identity tag field, carbon emission data field, timestamp field, and first hash digest are linked in sequence to form an ordered merged data set containing four elements. Each element retains the source field name to maintain traceability during subsequent parsing. That is, the three types of extracted fields and one first hash digest correspond to one merged data set.
[0029] The merged data set undergoes structured encapsulation and serialization packaging. Structured encapsulation follows a pre-defined voucher structure, which defines four fields: a label field, a data field, a time field, and a summary field. The identity label field from the merged data set is written into the label field, the carbon emission data field into the data field, and the timestamp field into the time field. The value of the time field is the aforementioned JSON array. The first hash digest is Base64 encoded and then written into the summary field. Serialization packaging serializes the encapsulated object into JSON format using UTF-8 encoding. The order of the fields in the serialization output is fixed as label field, data field, time field, and summary field. The serialized byte stream is the initial handover voucher. In addition to the four fields, the voucher structure adds a version field, which is placed at the beginning of the JSON object. The field name is "Version," and the field value is the decimal value 1, corresponding to hexadecimal 0x0001. Under UTF-8 encoding, it is represented as a single-byte character and is used to mark the voucher format version to support subsequent upgrades. The initial handover credentials are data packets used for cross-stage transmission. These are sent by the first processing node to the second processing node in the transport stage via an encrypted channel established according to the Transport Layer Security (TLS) 1.3 protocol. During channel establishment, the first and second processing nodes exchange node certificates issued by a Certificate Authority (CA). The node certificates contain the node registration identifier and the node's public key. After verifying that the other party's registration identifier matches the record in the network registry, both parties exchange a negotiated key using an elliptic curve Diffie-Hellman ephemeral key exchange, with the secp256r1 curve selected. Each party generates a 256-bit temporary private key. They exchange temporary public keys, calculate a shared point using their own temporary private key and the recipient's temporary public key, and extract the first 128 bits of the shared point's x-coordinate after SHA-256 processing as the transmission key. The initial handover credential byte stream is encrypted using the AES algorithm before transmission. The working mode adopts Galois counter mode, with an authentication tag length of 16 bytes. The initial vector is a randomly generated 12-byte number sent along with the ciphertext for each transmission. After decryption, the receiver verifies the integrity of the ciphertext based on the authentication tag. The initial handover credential also serves as input data for subsequent byte concatenation processing and as the base data for one-way association mapping verification. The resulting data correspondence is as follows: one first hash digest corresponds to one digest length value, one first carbon emission record corresponds to three types of extracted fields, the three types of extracted fields and one first hash digest correspond to one merged data set, and one merged data set corresponds to one initial handover credential.
[0030] S4. Obtain the second carbon emission data generated during the transportation phase, and use an asymmetric encryption algorithm to perform private key signing on the second carbon emission data to obtain the second carbon emission record with a second identity tag.
[0031] In one specific embodiment, performing S4 includes the following steps: Obtain the unique identifier of the transport vehicle, mileage data, and fuel consumption or electricity consumption data; Based on a pre-set carbon emission factor database, the fuel consumption value or electricity consumption value is converted and calculated to obtain the transportation carbon emission amount. The second carbon emission data is obtained by concatenating the transportation carbon emission data, mileage data and vehicle identification data. A secure hash algorithm is used to extract features from the second carbon emission data to obtain a carbon emission hash digest. The private key of the second processing node is used to sign the carbon emission hash digest to obtain the signed ciphertext. A second identity tag is generated based on the registration identifier of the second processing node. The second identity tag is combined and encapsulated with the second carbon emission data to obtain the second carbon emission record with the second identity tag.
[0032] Specifically, the second processing node acquires the unique identifier of the transport vehicle, mileage data, and fuel consumption or electricity consumption values. This second processing node is an edge computing node deployed on the logistics carrier, responsible for summarizing and signing carbon emission data during the transportation phase. The transportation phase refers to the stage where the metering boxes are transported from the assembly plant to the installation site. The vehicle is either a diesel or electric truck. The unique identifier of the vehicle is the Vehicle Identification Number, consisting of 17 characters. The second processing node reads this information from the vehicle control module via the onboard automatic diagnostic system interface. One transportation task corresponds to one vehicle identifier. The mileage data is the actual distance traveled by the vehicle between the origin and destination points, in kilometers. This data is obtained by the satellite positioning terminal by accumulating the distances between adjacent positioning points at 30-second sampling intervals and cross-checking it with the vehicle's odometer reading. If the deviation exceeds a preset deviation threshold, the odometer reading takes precedence and a verification alarm is generated. The preset deviation threshold is, for example, 2%. The fuel consumption figure is calculated by adding the difference between the fuel tank level sensor readings at the start and end of the transport for diesel trucks to the cumulative diesel consumption from refueling records along the way, in liters. The electricity consumption figure is calculated by multiplying the difference in state of charge at the start and end of the transport by the battery management system of electric trucks by the rated battery capacity, in kilowatt-hours. The second processing node also performs a reasonableness check on the collected results: when the vehicle is a diesel truck, the fuel consumption figure is divided by the mileage data and then multiplied by 100 to obtain the fuel consumption per 100 kilometers. If the fuel consumption per 100 kilometers exceeds the preset fuel consumption check range, the data is considered abnormal and re-collection is triggered. The preset fuel consumption check range is, for example, 15 to 35 liters per 100 kilometers. When the vehicle is an electric truck, the electricity consumption per 100 kilometers is calculated in the same way. The preset electricity consumption check range is, for example, 100 to 200 kilowatt-hours per 100 kilometers. Thus, a batch of metering boxes awaiting transport corresponds to one transport task, and one transport task corresponds to one vehicle identifier, one mileage data, and one fuel consumption figure or one electricity consumption figure.
[0033] After successful verification, the second processing node performs conversion calculations on the fuel consumption or electricity consumption values based on a pre-set carbon emission factor database. The carbon emission factor database is a factor lookup table pre-stored on the second processing node. Each entry includes the energy type, factor value, unit of measurement, and version number. The version number is cached along with the conversion result to support audit backtracking. When the vehicle is a diesel truck, the transportation carbon emissions equal to the fuel consumption value multiplied by the diesel carbon emission factor. For example, the diesel carbon emission factor is 2.63 kg CO2 per liter. For instance, if a transport consumes 120 liters of diesel, the transportation carbon emissions are 315.60 kg CO2. When the vehicle is an electric truck, the transportation carbon emissions equal to the electricity consumption value multiplied by the electricity carbon emission factor, which is 0.5568 kg CO2 per kilowatt-hour. The unit for transportation carbon emissions is kilograms of CO2, rounded to two decimal places. That is, one fuel consumption value or one electricity consumption value corresponds to one transportation carbon emission after one conversion.
[0034] Subsequently, the transportation carbon emissions, mileage data, and vehicle identification are concatenated. The concatenation is performed in a fixed field order: vehicle identification, mileage data, and transportation carbon emissions. The data is organized as JSON text and encoded in UTF-8. The vehicle identification is written as a 17-byte character, while the mileage data and transportation carbon emissions are represented as text characters. The concatenated result is the second carbon emissions data. This fixed field order ensures that the byte sequence of the second carbon emissions data for the same transportation task remains consistent across all processing nodes. This provides a unified format benchmark for subsequent byte concatenation with the initial handover document; that is, one vehicle identification, one mileage data point, and one transportation carbon emissions point correspond to one set of second carbon emissions data.
[0035] After the second carbon emission data is generated, the second processing node serializes the second carbon emission data into a UTF-8 encoded byte sequence. The secure hash algorithm SHA-256 is used to extract features from the byte sequence. The SHA-256 algorithm groups the input byte sequence into 512-bit groups, pads the end according to the padding rules, and adds 64-bit length information. After 64 rounds of compression iteration, a 256-bit digest, or 32-byte carbon emission hash digest, is output. Any change in any byte in the input byte sequence will cause a change in the carbon emission hash digest. The signature processing uses the elliptic curve digital signature algorithm, with the secp256r1 curve selected. The private key of the second processing node is a 256-bit random integer, and the public key is generated by scalar multiplication of the private key and the elliptic curve base point and is filed with the network during node registration. During signing, a 256-bit signature random number is generated. The scalar multiplication of the signature random number and the elliptic curve base point is calculated to obtain the curve point. The first signature component is obtained by taking the modulo of the x-coordinate of the curve point with the order of the base point. The second signature component is then calculated using the carbon hash digest, the private key, and the signature random number according to the signature equation. Each of the two signature components is 32 bytes, and they are concatenated in order to obtain a 64-byte signature ciphertext. That is, one second carbon data corresponds to one carbon hash digest, and one carbon hash digest corresponds to one signature ciphertext. If the carbon hash digest remains unchanged, the signature verification will pass; any modification will result in signature verification failure.
[0036] After obtaining the ciphertext, a second identity tag is generated based on the registration identifier of the second processing node. The registration identifier is a unique code assigned by the certificate authority when the second processing node joins the carbon emission ledger network, with a length of 32 bytes. The binding relationship between the registration identifier and the public key of the second processing node is stored in the network node's registry. The receiver can retrieve the corresponding public key based on the registration identifier. The registration identifier is used as a prefix and concatenated with the ciphertext in byte order to obtain a 96-byte second identity tag. The combination and encapsulation are performed according to a preset encapsulation structure, which includes a tag field and a data field. The second identity tag is Base64 encoded into printable characters and written to the tag field. The second carbon emission data is written to the data field. The two are combined into a JSON object to obtain the second carbon emission record with the second identity tag. The second carbon emission record serves as the input data for subsequent underlying byte concatenation processing. The resulting data correspondence is: one registration identifier and one ciphertext correspond to one second identity tag, and one second identity tag and one second carbon emission data correspond to one second carbon emission record.
[0037] S5. Convert the initial handover certificate into the first underlying byte sequence, convert the second carbon emission record into the second underlying byte sequence, and then concatenate the underlying bytes. Extract the feature value of the concatenated byte stream using a hash algorithm to obtain the second hash digest.
[0038] In one specific embodiment, performing S5 includes the following steps: Read all bytes of the initial handover document and generate the first underlying byte sequence in standard format; The second carbon emission record is subjected to unified serialization encoding processing. After removing redundant format markers, it is converted into a second underlying byte sequence that is consistent with the encoding of the first underlying byte sequence. According to the preset splicing order rules, the first underlying byte sequence and the second underlying byte sequence are spliced together end to end to generate a continuous and complete spliced byte stream; The concatenated byte stream is subjected to byte-by-byte feature extraction using a hash algorithm to generate a fixed-length feature value that covers all concatenated content, thus obtaining a second hash digest.
[0039] Specifically, the entire byte content of the initial handover certificate is read to generate a standard-format first-level byte sequence. The initial handover certificate is a data packet sent by the first processing node during the assembly phase to the second processing node via an encrypted channel. Its content is a byte stream serialized in JSON format and encoded in UTF-8. The byte stream sequentially carries five fields: version, tag, data, time, and digest. The digest field contains a Base64-encoded first hash digest. After receiving the initial handover certificate, the second processing node stores its byte stream as is. The read operation is the process of directly loading the stored byte array into memory. During loading, decoding, character conversion, and reserialization are not performed, ensuring that the first-level byte sequence is consistent byte-by-byte with the byte content sent by the first processing node, avoiding distortion of subsequent feature values caused by byte differences introduced by character set conversion or format reordering. The standard format refers to a voucher structure with UTF-8 encoding and a fixed field order. After loading, an encoding compliance check is performed: the byte stream is verified byte by byte to ensure it conforms to the UTF-8 encoding rules, the bit patterns of the leading byte and subsequent bytes of multi-byte characters are matched, and the byte array is sequentially traversed to count the total number of bytes to obtain the voucher length value in bytes. When an illegal byte sequence is found during the check, it is determined that the voucher is damaged in the transmission or storage stage, the splicing process is terminated and a voucher abnormality alarm is generated, triggering a processing instruction to request the first processing node to resend the initial handover voucher. That is, one initial handover voucher corresponds to one first underlying byte sequence, and one first underlying byte sequence corresponds to one voucher length value.
[0040] The second carbon emission record undergoes unified serialization encoding. This record is a JSON object consisting of a tag field and a data field. The tag field carries a Base64-encoded second identity tag, while the data field carries the second carbon emission data, composed of the vehicle identifier, mileage data, and transport carbon emissions. The unified serialization encoding process follows preset serialization rules: the field order is fixed with the tag field first, followed by the data field; the encoding method is UTF-8, consistent with the encoding of the first underlying byte sequence; redundant format markers are removed by deleting all indentation, line breaks, and spaces between fields in the serialized output; the numerical text maintains the same format as when the second carbon emission data was generated, ensuring that only the field names, field values, and valid bytes corresponding to structural symbols are retained in the byte stream. After eliminating formatting differences, the byte sequences generated by the same second carbon emission record at any processing node are completely consistent. For example, after the second processing node of the logistics carrier and the verification node of the receiver perform unified serialization encoding on the same second carbon emission record, the second underlying byte sequences output by both are identical byte by byte. That is, one second carbon emission record corresponds to one second underlying byte sequence, and the total number of bytes is counted to obtain the record length value.
[0041] The first and second underlying byte sequences are concatenated end-to-end according to a preset concatenation order rule. This concatenation order is based on the sequence of the metering box's lifecycle stages, with assembly preceding transportation. Therefore, the first underlying byte sequence is placed before the second, and the last byte of the first sequence is placed after it. The last byte of the first sequence is directly adjacent to the first byte of the second, with no separator bytes or markers inserted between them. This ensures that the source position of any byte in the concatenated result can be uniquely determined by the byte offset. After concatenation, a concatenation integrity check is performed: the total number of bytes in the concatenated byte stream equals the sum of the voucher length and the record length. If the length difference is zero, the first segment of the concatenated byte stream is compared byte-by-byte with the first underlying byte sequence, and the second segment is compared byte-by-byte with the second underlying byte sequence. If all matches, the concatenation is considered complete, resulting in a continuous and complete concatenated byte stream. If any comparison position is inconsistent, it is determined that there is byte misalignment or missing content in the concatenation process, feature extraction is terminated, and concatenation is re-executed. Since the digest field of the initial handover certificate carries the first hash digest, the byte content of the concatenated byte stream completely covers all the bytes corresponding to the first hash digest. That is, one first underlying byte sequence and one second underlying byte sequence correspond to one concatenated byte stream. This inclusion relationship provides the data foundation for subsequent one-way association mapping verification.
[0042] Byte-by-byte feature extraction is performed on the concatenated byte stream using a hash algorithm, specifically the SHA-256 algorithm, consistent with the algorithm and parameters used for digest extraction in the assembly stage. Starting from the first byte of the concatenated byte stream, all bytes are read sequentially, grouped into 512-bit groups. At the end, a 1 bit is appended, followed by 0 bits to complete the length, and then 64 bits of length information are appended to ensure the total length is a multiple of 512 bits. Each group is then sequentially processed by a compression function, resulting in a 256-bit digest (32-byte second hash digest) after 64 rounds of compression iterations. Feature extraction covers all bytes of the concatenated byte stream. Any change to any byte in the emissions recorded at any workstation during assembly, the mileage data during transportation, or the carbon emissions during transportation will completely alter the second hash digest through compression iterations. Furthermore, the original content of the concatenated byte stream cannot be deduced from the second hash digest; that is, one concatenated byte stream corresponds to one second hash digest. The resulting data correspondence is as follows: an initial handover certificate corresponds to a first underlying byte sequence, a second carbon emission record corresponds to a second underlying byte sequence, a first underlying byte sequence and a second underlying byte sequence correspond to a concatenated byte stream, a concatenated byte stream corresponds to a second hash digest, and the second hash digest simultaneously locks the data content of the assembly stage and the transportation stage.
[0043] S6. Determine whether there is a one-way association mapping relationship between the second hash digest and the first hash digest in the initial handover certificate. If so, encapsulate the second carbon emission record, the initial handover certificate and the second hash digest in a structured manner to generate a cross-domain transfer record.
[0044] In one specific embodiment, performing S6 includes the following steps: The first hash digest is extracted from the initial handover document. The input for generating the second hash digest is verified to completely contain all the bytes corresponding to the first hash digest. The two are then compared to determine whether there is a one-way association mapping relationship. If a one-way association mapping relationship exists, the initial handover certificate, the second carbon emission record, and the second hash digest are written into the certificate field, transportation field, and digest field of the preset encapsulation structure, respectively. The unique identifier of the batch metering box is written into the identifier field. The encapsulated object is serialized in JSON format and encoded in UTF-8 to generate a cross-domain transfer record.
[0045] Specifically, the first hash digest is extracted from the initial handover document. The second processing node parses the byte stream of the initial handover document according to the JSON deserialization rules, locates the digest field by field name, reads the Base64 encoded string in the digest field and performs Base64 decoding to restore the 32-byte first hash digest. At the same time, the starting byte offset and ending byte offset of the digest field value in the document byte stream are recorded. The verification process checks whether the input for generating the second hash digest completely contains all the bytes corresponding to the first hash digest. This verification includes two parts: positional inclusion verification and feature consistency recalculation. Positional inclusion verification determines whether the byte offset range of the digest field completely falls within the range of the first segment of the concatenated byte stream. The first segment of the concatenated byte stream is the first underlying byte sequence. If the starting byte offset is not less than 0 and the ending byte offset is not greater than the voucher length, it indicates that the byte content carrying the first hash digest has been completely covered by the concatenated byte stream. Feature consistency recalculation involves re-performing the SHA-256 operation on the concatenated byte stream, grouping it into 512-bit blocks, and performing 64 rounds of compression iterations to obtain the recalculated feature value. The recalculated feature value is then compared byte-by-byte with the second hash digest. If the number of differing bytes (32 bytes) is 0, the two are considered to be consistent, proving that the second hash digest was indeed generated by the concatenated byte stream containing the complete voucher content. When both location inclusion verification and feature consistency recalculation pass simultaneously, it is determined that there is a one-way association mapping relationship between the second hash digest and the first hash digest. The one-way association mapping relationship means that the second hash digest is generated in the forward direction by a concatenated byte stream that covers the byte content of the first hash digest through a one-way hash operation. The original content of the first hash digest or the concatenated byte stream cannot be derived from the second hash digest in reverse, and any modification to any byte in the concatenated byte stream will cause the recalculated feature value to deviate from the second hash digest. If any one of the verifications fails, it is determined that the data in the assembly stage or transportation stage was replaced or deleted before merging, the generation of the transfer record is terminated and an association anomaly alarm is generated. That is, an initial handover document corresponds to a first hash digest, and a concatenated byte stream that covers the byte content of the first hash digest corresponds to a second hash digest. The two constitute a one-way association mapping.
[0046] When a one-way association mapping relationship exists, the second carbon emission record, the initial handover certificate, and the second hash digest are encapsulated in a structured manner. The encapsulation structure includes a certificate field, a transportation field, a digest field, and an identifier field: the initial handover certificate is written to the certificate field, the second carbon emission record is written to the transportation field, the second hash digest is converted into printable characters after Base64 encoding and written to the digest field, and the identifier field is written to the unique identifier of the metering box in this batch. The unique identifier of the metering box is the asset code assigned by the manufacturer and is used for ledger retrieval. The encapsulated object is serialized in JSON format and encoded in UTF-8. The order of each field in the serialization output is fixed as certificate field, transportation field, digest field, and identifier field, generating a cross-domain transfer record containing complete link information. The cross-domain transfer record serves as the basis for generating the broadcast verification request in the consensus verification process. That is, three original data objects and one unique identifier of a metering box correspond to one cross-domain transfer record.
[0047] S7. A fault-tolerant consensus algorithm is used to perform multi-node broadcast verification of cross-domain transfer records. After successful verification, the records are written into the global carbon emission ledger to obtain carbon footprint records from assembly to transportation with version consistency.
[0048] In one specific embodiment, performing S7 includes the following steps: Based on the cross-domain transfer records, a broadcast verification request is generated and sent to each consensus node in the blockchain network. A fault-tolerant consensus algorithm is used to collect the consensus vote set returned by each node. The number of valid votes in the consensus voting set is counted. If the number of valid votes reaches the preset consensus threshold, the cross-domain transfer record is confirmed to have passed verification. Verified cross-domain transfer records are written into the global carbon emission ledger in chronological order. Carbon footprint entries for each stage are retrieved and sorted from the global carbon emission ledger by the unique identifier of the metering box, and carbon footprint records for the assembly to transportation stage with consistent version attributes are obtained.
[0049] Specifically, a broadcast verification request is generated based on the cross-domain transfer record. The cross-domain transfer record is a JSON object containing a credential field, a transport field, a digest field, and an identifier field. The second processing node performs SHA-256 operation on the UTF-8 byte stream of the cross-domain transfer record, and generates a 32-byte record digest by grouping into 512-bit blocks and compressing iteratively in 64 rounds. The record digest, the full text of the cross-domain transfer record, the registration identifier of the second processing node, and the request timestamp are combined into a broadcast verification request. The request timestamp is the Unix timestamp at the time of request generation with a resolution of 1 second. The record digest is signed with the private key of the second processing node using the elliptic curve digital signature algorithm and sent along with the request. The signature parameters are consistent with those in the assembly stage, the curve used is secp256r1, and the signature ciphertext is 64 bytes. The broadcast verification request is sent to each consensus node in the blockchain network via an encrypted inter-node channel. These consensus nodes are verification nodes deployed by entities including manufacturers, logistics carriers, installation service providers, and auditing institutions. Upon receiving the request, each consensus node performs local verification: retrieving the public key verification request signature of the second processing node from the network registry based on the registration identifier to confirm the request's origin; parsing the cross-domain transfer record and verifying that all four fields are complete; re-performing unified serialization encoding, underlying byte concatenation, and SHA-256 operations on the initial handover certificate in the certificate field and the second carbon emission record in the transportation field, recalculating the second hash digest, and performing a byte-by-byte equal-value comparison with the content written in the digest field; extracting the first hash digest from the initial handover certificate and verifying the one-way association mapping relationship. Consensus nodes that pass all local verifications generate a vote of approval, while those that fail at any stage generate a vote of disapproval. Each vote includes the node registration identifier, voting opinion, record digest, and node signature. Each consensus node returns its vote, forming a consensus vote set.
[0050] The fault-tolerant consensus algorithm adopts the practical Byzantine fault-tolerant algorithm. Its security parameters are: the total number of consensus nodes is 3 times the number of tolerable failure nodes plus 1, the number of tolerable failure nodes is the number of malicious or downtime nodes allowed in the network, and the preset consensus threshold is 2 times the number of tolerable failure nodes plus 1. For example, when the total number of consensus nodes is 7 and the number of tolerable failure nodes is 2, the preset consensus threshold is 5 votes. The number of valid votes in the consensus voting set is counted. A valid vote is a vote that meets three conditions simultaneously: the signature of the voting node is verified by its registered public key, the voting opinion is "yes", the record digest in the vote is consistent byte by byte with the record digest in the broadcast verification request, and duplicate votes from the same consensus node are counted as only one vote. When the number of valid votes reaches 5, the cross-domain transfer record is deemed to have passed verification. If the number of valid votes does not reach the consensus threshold within the preset waiting time limit, the verification is deemed to have failed. The preset waiting time limit is 10 seconds for example. When the verification fails, the writing process is terminated and a consensus failure alarm is generated. The cross-domain transfer record is transferred to the reconsideration queue and broadcast verification is re-initiated for a preset number of retries. The preset number of retries is 3 for example. That is, one cross-domain transfer record corresponds to one broadcast verification request, one broadcast verification request corresponds to one consensus voting set, and one consensus voting set corresponds to one valid vote count result.
[0051] After successful verification, the cross-domain transfer records are written to the global carbon emission ledger in chronological order. The global carbon emission ledger is a chain-like ledger with copies synchronously stored by each consensus node. During writing, a ledger entry is generated, containing an entry number, a write timestamp, the cross-domain transfer record, a consensus proof, and a chain digest. The entry number is an integer starting from 0 and incrementing sequentially; the write timestamp is the Unix timestamp of the entry's writing time; the consensus proof is the set of signatures of all valid votes that have reached the consensus threshold; and the chain digest is a 32-byte digest obtained by performing a SHA-256 operation on all bytes of the previous ledger entry. The chain digest of the first ledger entry is a 32-byte all-zero value. Entries are linked end-to-end through their chain digests; any modification to the content of any entry breaks the chain digest verification of its subsequent entries. After the ledger entry is appended, it is synchronized to all consensus nodes. Each node performs a consistency check according to the entry number, confirming that its local copy is consistent with the master node's content. Thus, the ledger copies held by each participating entity maintain version consistency. During the tracing process, a search is performed in the global carbon emission ledger based on the unique identifier of the metering box. The identifier field of the cross-domain transfer record in each ledger entry is parsed one by one. Carbon footprint entries with the same unique identifier as the target metering box are extracted and sorted in ascending order by entry number. The sorting results cover the carbon footprint entries of the assembly stage and the transportation stage in turn, and obtain the assembly to transportation stage carbon footprint record with version consistency attribute. Version consistency attribute means that the set of carbon footprint entries corresponding to the same unique identifier of metering box in the ledger copies of each consensus node are completely consistent and their arrangement order is completely consistent. That is, one cross-domain transfer record corresponds to one ledger entry, one unique identifier of metering box corresponds to multiple carbon footprint entries arranged in order, and multiple carbon footprint entries correspond to one assembly to transportation stage carbon footprint record.
[0052] Please see Figure 2 , Figure 2 The graph illustrates the synchronization and convergence process of ledger replicas across nodes after writing. The horizontal axis represents the number of synchronization rounds, and the vertical axis represents the ledger version consistency rate. The three curves correspond to three network scenarios: 0 failed nodes, 1 failed node, and 2 failed nodes. The graph shows that regardless of the number of failed nodes, the ledger version consistency rate of each node continuously increases with the number of synchronization rounds, eventually approaching 100%. The more failed nodes there are, the more synchronization rounds are required to converge to complete consistency, but the overall convergence trend remains stable. This graph verifies that the fault-tolerant consensus algorithm adopted in this application has good distributed ledger synchronization capabilities. Even if the network has downtime or malicious nodes, the multi-entity carbon emission ledger can still complete replica synchronization and achieve version unification.
[0053] Please see Figure 3 , Figure 3This figure shows a comparison of interception rates under typical tampering attacks. The four attack scenarios include replacing initial handover documents, deleting emission data fields, modifying mileage, and rearranging the order of concatenated bytes. Traditional methods achieve an interception rate of only 30%–63% for each type of attack, demonstrating weak protection capabilities. In contrast, the method proposed in this application achieves an interception rate of 98%–100%, almost completely blocking all types of tampering. This figure demonstrates the effectiveness of the dual-layer cryptographic protection mechanism of the underlying byte concatenation hash binding and cross-stage one-way hash association verification, solving the shortcomings of existing technologies where cross-stage data is easily replaced, deleted, and rearranged without being detected.
[0054] Please see Figure 4 The following describes a carbon footprint traceability system for a metering box according to an embodiment of this application. The carbon footprint traceability system for a metering box includes: The assembly acquisition module is used to acquire the initial carbon emission data generated during the assembly stage. It uses an asymmetric encryption algorithm to perform private key signing on the initial carbon emission data to obtain the first carbon emission record with the first identity tag. The abstract extraction module is used to extract the underlying data feature values from the first carbon emission record using a hash algorithm to obtain the first hash digest. The digest packaging module is used to determine whether the first hash digest meets the preset fixed length verification condition. If so, the first carbon emission record and the first hash digest are structured and packaged to generate the initial handover certificate. The transportation acquisition module is used to acquire the second carbon emission data generated during the transportation phase. It uses an asymmetric encryption algorithm to perform private key signing on the second carbon emission data to obtain a second carbon emission record with a second identity tag. The sequence splicing module is used to convert the initial handover certificate into the first underlying byte sequence, convert the second carbon emission record into the second underlying byte sequence, and then splice the underlying bytes. The feature values of the spliced byte stream are extracted by a hash algorithm to obtain the second hash digest. The circulation generation module is used to determine whether there is a one-way association mapping relationship between the second hash digest and the first hash digest in the initial handover certificate. If so, the second carbon emission record, the initial handover certificate and the second hash digest are structured and encapsulated to generate a cross-domain circulation record. The consensus on-chain module is used to perform multi-node broadcast verification of cross-domain transfer records using a fault-tolerant consensus algorithm. After successful verification, the records are written to the global carbon emission ledger to obtain carbon footprint records from assembly to transportation with version consistency attributes.
[0055] Through the collaborative efforts of the aforementioned components, the system achieves trusted cryptographic transfer, tamper-proof protection, and multi-party version consistency of cross-stage carbon emission data, providing a mathematically verifiable data foundation for carbon accounting, carbon trading, and compliance auditing. The assembly acquisition module summarizes and asymmetrically signs carbon emission data at the workstation level during the assembly phase, generating a first carbon emission record with a source identity tag, establishing an undeniable data anchor for subsequent stages. The digest extraction module extracts a fixed-length first hash digest from the complete first carbon emission record based on a hash algorithm, sensitively mapping any byte-level changes to digest differences, providing an underlying fingerprint for integrity protection. The digest packaging module performs length verification on the first hash digest and then structurally encapsulates it with the first carbon emission record to form an initial handover certificate, ensuring that abnormal digests do not enter the cross-stage transmission chain. The transportation acquisition module signs and encapsulates vehicle energy consumption and driving data during the transportation phase, generating a second carbon emission record with a second identity tag, incorporating carbon data from the logistics process into the trusted acquisition system. The sequence splicing module converts the initial handover certificate and the second carbon emission record into a unified encoded underlying byte sequence and splices them together. A second hash digest is then generated through hash operations, coupling the data from the previous and subsequent stages into a cryptographically linked whole at the underlying byte level. Tampering with the data at any stage will disrupt the characteristic consistency of the spliced byte stream. The flow generation module verifies the one-way association mapping between the second and first hash digests to ensure that only data that passes integrity verification can be structured and encapsulated into cross-domain flow records, mathematically preventing data from being replaced or deleted during the merging process. The consensus on-chain module uses a fault-tolerant consensus algorithm to perform multi-node broadcast verification of the cross-domain flow records. After reaching a consensus on the same carbon footprint history in the distributed network, it is written into the global carbon emission ledger, ensuring that the ledger copies held by manufacturers, logistics providers, installation service providers, and auditing institutions in different geographical locations maintain version consistency. Ultimately, a carbon footprint record for the metering box assembly and transportation stage is formed, which is verifiable in origin, immutable in content, linked across stages, and has a unified version.
[0056] This application also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of the metering box carbon footprint traceability method.
[0057] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the methods and systems described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0058] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A metering box carbon footprint traceability method, characterized in that, include: S1. Obtain the initial carbon emission data generated during the assembly stage, and use an asymmetric encryption algorithm to perform private key signing on the initial carbon emission data to obtain the first carbon emission record with the first identity tag. S2. Based on the first carbon emission record, extract its underlying data feature values using a hash algorithm to obtain a first hash digest; S3. Determine whether the first hash digest meets the preset fixed length verification condition. If so, the first carbon emission record and the first hash digest are structured and packaged to generate an initial handover certificate. S4. Obtain the second carbon emission data generated during the transportation phase, and use an asymmetric encryption algorithm to perform private key signing on the second carbon emission data to obtain the second carbon emission record with a second identity tag. S5. Convert the initial handover certificate into a first underlying byte sequence, convert the second carbon emission record into a second underlying byte sequence, and then concatenate the underlying bytes. Extract the feature value of the concatenated byte stream using a hash algorithm to obtain a second hash digest. S6. Determine whether there is a one-way association mapping relationship between the second hash digest and the first hash digest in the initial handover certificate. If so, encapsulate the second carbon emission record, the initial handover certificate and the second hash digest in a structured manner to generate a cross-domain transfer record. S7. A fault-tolerant consensus algorithm is used to perform multi-node broadcast verification of the cross-domain transfer record. After successful verification, the record is written into the global carbon emission ledger to obtain a carbon footprint record from assembly to transportation with version consistency.
2. The method of claim 1, wherein, S1 includes: Acquire energy consumption, welding process emissions, and raw material processing carbon emission data collected by energy consumption monitoring equipment at each workstation during the metering box assembly stage, and summarize them to form initial carbon emission data including timestamp, process identifier, equipment number, and emission amount fields; A secure hash algorithm is used to extract features from the initial carbon emission data to obtain a target data digest. The private key of the first processing node is used to sign the target data digest to obtain a signed ciphertext. The signature ciphertext is concatenated based on the registration identifier of the first processing node to determine the first identity tag. The first identity tag and the initial carbon emission data are then encapsulated to obtain the first carbon emission record with the first identity tag.
3. The method of claim 1, wherein, S2 includes: Obtain the first carbon emission record, perform byte parsing operation on the first carbon emission record, extract the underlying bytecode corresponding to each data field in the field order, and form an initial underlying feature set; Assign an order status identifier to each feature element in the initial underlying feature set, and arrange and combine them according to the preset field type priority to determine the target feature sequence; Verify whether the target feature sequence conforms to the preset data structure integrity rules. If it does, perform symmetric encryption on the target feature sequence to obtain an encrypted feature sequence. Extract a fixed-length digest from the encrypted feature sequence using a hash algorithm to obtain a first hash digest.
4. The method of claim 1, wherein, S3 includes: Perform a byte length calculation on the first hash digest to obtain the digest length value; The summary length value is compared with the preset standard length value to determine whether the summary length value meets the preset fixed length verification condition. If the preset fixed-length verification condition is met, the carbon emission data field, identity tag field, and timestamp field are extracted from the first carbon emission record. The extracted fields are then merged with the first hash digest to form a merged data set. The merged data set is subjected to structured encapsulation and serialization packaging to generate an initial handover certificate for cross-stage transfer.
5. The method according to claim 1, characterized in that, S4 includes: Obtain the unique identifier of the transport vehicle, mileage data, and fuel consumption or electricity consumption data; The fuel consumption value or electricity consumption value is converted and calculated based on a preset carbon emission factor database to obtain the transportation carbon emission amount. The second carbon emission data is obtained by concatenating the transportation carbon emission data, mileage data and vehicle identification data. A secure hash algorithm is used to extract features from the second carbon emission data to obtain a carbon emission hash digest. The private key of the second processing node is used to sign the carbon emission hash digest to obtain a signed ciphertext. A second identity tag is generated based on the registration identifier of the second processing node. The second identity tag is then combined and encapsulated with the second carbon emission data to obtain a second carbon emission record with the second identity tag.
6. The method of claim 1, wherein, S5 includes: Read all bytes of the initial handover certificate and generate a first underlying byte sequence in standard format; The second carbon emission record is subjected to unified serialization encoding processing, and after removing redundant format markers, it is converted into a second underlying byte sequence that is consistent with the encoding of the first underlying byte sequence. According to the preset splicing order rules, the first underlying byte sequence and the second underlying byte sequence are spliced together end to end to generate a continuous and complete spliced byte stream; The hash algorithm is used to perform byte-by-byte feature extraction on the concatenated byte stream to generate a fixed-length feature value that covers all concatenated content, thus obtaining a second hash digest.
7. The method of claim 1, wherein, S6 includes: The first hash digest is extracted from the initial handover certificate. The input for generating the second hash digest is verified to completely contain all the bytes corresponding to the first hash digest. It is then determined whether there is a one-way association mapping relationship between the two. If a one-way association mapping relationship exists, the initial handover certificate, the second carbon emission record, and the second hash digest are written into the certificate field, transportation field, and digest field of the preset encapsulation structure, respectively, and the unique identifier of the batch metering box is written into the identifier field. The encapsulated object is serialized in JSON format and encoded in UTF-8 to generate a cross-domain transfer record.
8. The method of claim 1, wherein, S7 includes: A broadcast verification request is generated based on the cross-domain transfer record and sent to each consensus node in the blockchain network. A fault-tolerant consensus algorithm is used to collect the consensus vote set returned by each node. The number of valid votes in the consensus voting set is counted. If the number of valid votes reaches a preset consensus threshold, the cross-domain transfer record is determined to have passed verification. Verified cross-domain transfer records are written into the global carbon emission ledger in chronological order. Carbon footprint entries for each stage are retrieved and sorted from the global carbon emission ledger by the unique identifier of the metering box, and carbon footprint records for the assembly to transportation stage with consistent version attributes are obtained.
9. A meter carbon footprint traceability system for implementing a meter carbon footprint traceability method according to any one of claims 1 to 8, characterized in that, include: The assembly acquisition module is used to acquire the initial carbon emission data generated during the assembly stage, and to perform private key signing on the initial carbon emission data using an asymmetric encryption algorithm to obtain the first carbon emission record with a first identity tag. The digest extraction module is used to extract the underlying data feature values of the first carbon emission record using a hash algorithm to obtain a first hash digest. The digest packaging module is used to determine whether the first hash digest meets the preset fixed length verification condition. If so, the first carbon emission record and the first hash digest are structured and packaged to generate an initial handover certificate. The transportation acquisition module is used to acquire the second carbon emission data generated during the transportation phase, and to perform private key signing on the second carbon emission data using an asymmetric encryption algorithm to obtain a second carbon emission record with a second identity tag. The sequence splicing module is used to convert the initial handover certificate into a first underlying byte sequence, convert the second carbon emission record into a second underlying byte sequence, and then splice the underlying bytes. The feature values of the spliced byte stream are extracted by a hash algorithm to obtain a second hash digest. The circulation generation module is used to determine whether there is a one-way association mapping relationship between the second hash digest and the first hash digest in the initial handover certificate. If so, the second carbon emission record, the initial handover certificate and the second hash digest are structured and encapsulated to generate a cross-domain circulation record. The consensus on-chain module is used to perform multi-node broadcast verification of the cross-domain transfer record using a fault-tolerant consensus algorithm. After successful verification, the record is written into the global carbon emission ledger to obtain a carbon footprint record from assembly to transportation with version consistency.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that When the computer program is executed by the processor, it implements a metering box carbon footprint traceability method as described in any one of claims 1 to 8.
