Maintenance accessory tracing method, system and equipment and storage medium

By implementing maintenance accessories traceability methods in the server, using hash links and digital signature technology, the problem of data easily being tampered in the existing technology is solved, and the accurate traceability of maintenance accessories and the improvement of supply chain transparency is achieved.

CN119539835AInactive Publication Date: 2025-02-28杭州维时科技有限公司
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411685730.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-23
Publication Date
2025-02-28
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing methods for traceability of maintenance accessories are difficult to ensure the integrity and authenticity of data during multi-link circulation, and information is easily lost or tampered with, affecting the accurate traceability of maintenance accessories.

Method used

By implementing a maintenance accessories traceability method in the server, the flow links are arranged in the order of execution, the original flow information is obtained, and data blocks are generated, and hash links are established using hash values ​​to form a traceability chain. At the same time, digital signature technology and multi-node consistency verification are used to ensure the authenticity and credibility of the data.

Benefits of technology

It effectively prevents data tampering, realizes the full life cycle traceability of maintenance accessories, improves the transparency of the supply chain, and improves the accuracy of maintenance accessories traceability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119539835A_ABST
    Figure CN119539835A_ABST
Patent Text Reader

Abstract

The invention discloses a maintenance accessory tracing method which is applied to a server. The method comprises the following steps: arranging circulation links of maintenance accessories according to an execution sequence, and obtaining original circulation information of the circulation links; a data block corresponding to the circulation link is generated according to the original circulation information, and a preorder data block hash value of the current data block is equal to a data block hash value of the preorder data block; a preorder data block hash value of a target data block corresponding to a first circulation link in the circulation links is a preset hash value; and calculating a data block hash value of each data block according to a preset algorithm, and constructing a hash link between the data block hash value of the preorder data block and the preorder data block hash value of the current data block to obtain a traceability chain. According to the invention, the completeness and non-tampering property of the maintenance accessory circulation information can be effectively ensured, and the transparency and reliability of maintenance accessory management are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software, and specifically to a method, system, device and storage medium for tracing the source of repair parts. Background Art

[0002] With the continuous advancement of technology, electronic devices have become indispensable tools for communication and information processing in modern society. With increasing frequency of use and more complex functions, electronic device failures and damage are also increasing, leading to a growing demand for electronic device repair services. Repair parts traceability is a crucial component of modern supply chain management, especially in industries such as automotive, aviation, and healthcare, where ensuring the authenticity and reliability of repair parts is crucial.

[0003] However, existing repair parts traceability methods still have some flaws in practical applications. For example, data integrity and authenticity are difficult to guarantee, especially during multi-link circulation. Information is easily lost or tampered with, and lost or tampered data is difficult to detect and recover, which affects the accurate traceability of repair parts. Summary of the Invention

[0004] The present application provides a repair parts traceability method, system, device and storage medium, which are used to solve the problem that data is easily tampered with during the repair parts traceability process, and improve the accuracy of repair parts traceability.

[0005] In a first aspect of the present application, a method for tracing the source of repair parts is provided, which is applied to a server. The method comprises: arranging the circulation links of the repair parts in order of execution, and obtaining the original circulation information of the circulation links, wherein the original circulation information comprises the circulation time, the circulation location, the operator information, and the operation type, and the circulation links comprise the warehousing link, the outbound link, the transportation link, and the maintenance link; generating a data block corresponding to the circulation link according to the original circulation information, wherein the data block comprises a data block hash value and a previous data block hash value, wherein the data block hash value is the hash value of the current data block, and the previous data block hash value is the hash value of the current data block. The hash value of the previous data block of the block, the previous data block is the data block corresponding to the previous circulation link, and the previous circulation link is the circulation link before the circulation link corresponding to the current data block, wherein the previous data block hash value of the current data block is equal to the data block hash value of the previous data block, and the previous data block hash value of the target data block corresponding to the first circulation link in the circulation link is a preset hash value; the data block hash value of each data block is calculated according to a preset algorithm, and a hash link is constructed between the data block hash value of the previous data block and the previous data block hash value of the current data block to obtain a traceability chain.

[0006] Optionally, generating a data block corresponding to a circulation link according to the original circulation information specifically includes: generating a link identifier according to the execution order; generating a block header and a block body corresponding to the link identifier according to the link identifier, wherein the block header data of the block header includes a hash value of a preceding data block of the current data block, and the block body data of the block body includes the link identifier and the original circulation information; serializing the block header data and the block body data according to a predefined format; constructing a structure of the data block, wherein the structure includes a block header area and a block body area; writing the serialized block header data into the block header area of ​​the structure; and writing the serialized block body data into the block body area of ​​the structure to obtain the current data block.

[0007] Optionally, a block header and a block body corresponding to the link identifier are generated according to the link identifier, specifically including: obtaining a hash value of a preceding data block of the current data block according to the link identifier; creating a block header data structure of the block header, the block header data structure including a preceding hash value field; writing the preceding data block hash value of the current data block into the preceding hash value field to obtain a block header; converting the original flow information into a preset data format; creating a block body data structure of the block body, the block body data structure including an identification field and an information field; writing the link identifier into the identification field; and writing the converted original flow information into the information field to obtain a block body.

[0008] Optionally, a data block hash value of each data block is calculated according to a preset algorithm, and a hash link is constructed between the data block hash value of the previous data block and the previous data block hash value of the current data block, specifically including: performing a hash calculation on the data block data of the previous data block using a preset hash algorithm, where the data block data includes block header data and block body data, to obtain the data block hash value of the previous data block, so as to facilitate the construction of a hash link with the previous data block hash value of the current data block; and writing the data block hash value of the previous data block into the block header of the current data block to establish a link relationship between the current data block and the previous data block.

[0009] Optionally, after generating the data block corresponding to the circulation link according to the original circulation information, it also includes verifying the original circulation information, and the verification of the original circulation information specifically includes: converting the original circulation information into a predefined format to obtain first circulation information; serializing the first circulation information according to the predefined format to obtain second circulation information; calculating the second circulation information through a preset hash algorithm to obtain a first hash value; generating a public-private key pair through a preset signature algorithm, wherein the private key is used to generate a digital signature and the public key is used to verify the signature; using the public key to perform a digital signature verification operation on the digital signature to be verified to obtain a second hash value; comparing the first hash value with the second hash value. If the first hash value is the same as the second hash value, the second circulation information has not been tampered with.

[0010] Optionally, after calculating the data block hash value of each data block according to a preset algorithm and constructing a hash link between the data block hash value of the previous data block and the previous data block hash value of the current data block, it also includes performing a consistency check on the second flow information. The consistency check on the second flow information specifically includes: transmitting the data block to all data nodes in the traceability chain; performing a consistency check on the data block at the data node, the consistency check includes verifying the integrity of the data block and verifying the continuity of the hash link; obtaining the verification result of the data node, and counting the number of data nodes that pass the consistency check; judging whether the number of data nodes that pass the consistency check reaches a preset verification ratio; when the number of data nodes that pass the consistency check reaches the preset verification ratio, completing the consistency check.

[0011] Optionally, a consistency check is performed on the data block at the data node, specifically including: performing structure verification and format verification on the data block through a preset verification algorithm, the structure verification including comparing the data block with a preset data template, checking whether the data block contains all the fields in the preset data template, and the format verification including checking the format specification of the data content, and checking the length and format of the hash value; if the structure verification and format verification are passed, determine whether the hash value of the preceding data block of the target data block is the preset hash value; when the hash value of the preceding data block of the target data block is the preset hash value, compare the data block hash value of the preceding data block with the preceding data block hash value of the current data block to see whether they are equal; if the data block hash value of the preceding data block is equal to the preceding data block hash value of the current data block, then the current data block is matched successfully, and if the data blocks corresponding to all flow links are matched successfully, then the hash links are continuous.

[0012] In a second aspect of the present application, a repair parts tracing system is provided, comprising: An acquisition module is used to arrange the flow links of repair parts in the order of execution and obtain the original flow information of the flow links, which includes the flow time, flow location, operator information, and operation type. The flow links include the warehousing link, the outbound link, the transportation link, and the maintenance link; A generation module, configured to generate a data block corresponding to a flow link based on original flow information, wherein the data block includes a data block hash value and a previous data block hash value, wherein the data block hash value is a hash value of the current data block, the previous data block hash value is a hash value of a previous data block of the current data block, the previous data block is a data block corresponding to a previous flow link, and the previous flow link is a flow link preceding the flow link corresponding to the current data block, wherein the previous data block hash value of the current data block is equal to the data block hash value of the previous data block, and the previous data block hash value of the target data block corresponding to the first flow link in the flow link is a preset hash value; The link module calculates the data block hash value of each data block according to a preset algorithm, and constructs a hash link between the data block hash value of the previous data block and the previous data block hash value of the current data block to obtain a traceability chain.

[0013] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device performs any of the methods described above.

[0014] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any one of the above methods is executed.

[0015] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. Hash values ​​are used to link the data blocks corresponding to each flow link in the order of flow. Each data block contains the hash value of the previous block. Tampering with the data at any link will destroy the hash link, effectively preventing data tampering. Each flow link is fully recorded, including detailed time, location, personnel information, operation type and other key data, to achieve full lifecycle traceability of accessories and improve supply chain transparency.

[0016] 2. Digital signature technology is used to verify the authenticity of information. Digital signatures are generated and verified using public-private key pairs, and hash value comparisons are used to verify data tampering. Multi-node consistency verification is also used to ensure data consistency across all nodes. This multi-level verification effectively guarantees data authenticity and credibility.

[0017] 3. This embodiment of the present application utilizes a distributed verification mechanism involving multiple nodes, ensuring the reliability of data verification through a preset verification ratio. Each data node participates in the verification process, jointly maintaining data consistency. This not only improves system reliability but also effectively reduces the risk of single points of failure. When the number of verification nodes reaches the preset ratio, verification is deemed passed, ensuring the credibility of the verification result. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 This is a flow chart of a repair parts traceability method according to an embodiment of the present application; Figure 2 This is another flowchart of a repair parts traceability method according to an embodiment of the present application; Figure 3This is a schematic diagram of the structure of a repair parts traceability system in an embodiment of the present application; Figure 4 It is a structural diagram of an electronic device in an embodiment of the present application.

[0019] Explanation of the accompanying drawings: 301, acquisition module; 302, generation module; 303, link module; 304, verification module; 305, check module; 401, processor; 402, communication bus; 403, user interface; 404, network interface; 405, memory. DETAILED DESCRIPTION

[0020] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0021] In the description of the embodiments of this application, words such as "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "for example" or "for instance" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "for example" or "for instance" is intended to present the relevant concepts in a concrete manner.

[0022] In the description of the embodiments of the present application, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0023] Figure 1 It is a flow chart of a repair parts traceability method in an embodiment of the present application.

[0024] See also Figure 1 In an embodiment of the present application, a method for tracing the source of repair parts is applied to a server, and the method includes: S101. Arrange the circulation links of the repair parts according to the execution order and obtain the original circulation information of the circulation links; The repair parts flow links are arranged in the order of execution: warehousing, outbound, transportation, and repair. The original flow information of the flow link includes flow time, flow location, operator information, and operation type.

[0025] During the incoming warehousing phase, each repair part is equipped with an RFID (Radio Frequency Identification) tag with a unique ID (Identity Document). When the repair part arrives at the warehouse, the fixed RFID reader at the warehouse entrance automatically records the specific time the part arrived at the warehouse, including the year, month, day, hour, minute, and second. It also collects detailed information about the flow location at the time of entry, including location information such as the warehouse number, and records the personal information of the warehouse manager who performed the entry operation, such as his / her work number and name, on the traceability platform. The operation type is marked as "incoming." Similarly, the original flow information of the outgoing warehousing phase is recorded.

[0026] During the transportation phase, the parts' departure time and estimated arrival time are recorded. During transportation, the onboard GPS (Global Positioning System) collects real-time vehicle location information. RFID identification devices at key nodes record transit stops and complete information about transport personnel, including drivers and escorts. This phase's operation type is marked as "Transportation."

[0027] During the maintenance phase, the traceability platform records the start and completion times of maintenance work. Location information, such as the maintenance shop number and specific workstation number, is collected. Personal information, such as the employee number and name of the maintenance personnel performing the maintenance work, is also recorded. The operation type for this phase is marked as "Maintenance."

[0028] S102: Generate data blocks corresponding to the circulation link according to the original circulation information; Specifically, a link identifier is generated according to the execution order; a block header and a block body corresponding to the link identifier are generated according to the link identifier, wherein the block header data of the block header includes a hash value of a preceding data block of the current data block, and the block body data of the block body includes the link identifier and original flow information; the block header data and the block body data are serialized according to a predefined format; a structure of the data block is constructed, wherein the structure includes a block header area and a block body area; the serialized block header data is written into the block header area of ​​the structure; the serialized block body data is written into the block body area of ​​the structure to obtain the current data block; Among them, generating a block header and a block body corresponding to the link identifier according to the link identifier specifically includes: obtaining a hash value of a preceding data block of a current data block according to the link identifier; creating a block header data structure of a block header, the block header data structure including a preceding hash value field; writing the preceding data block hash value of the current data block into the preceding hash value field to obtain a block header; converting original flow information into a preset data format; creating a block body data structure of a block body, the block body data structure including an identification field and an information field; writing the link identifier into the identification field; and writing the converted original flow information into the information field to obtain a block body.

[0029] Generate a unique corresponding link identifier for each flow link according to the execution order of the flow links, for example: Storage stage: "IN_STORAGE_001"; Outbound link: "OUT_STORAGE_002"; Transport link: "TRANSPORT_003"; Maintenance link: "MAINTENANCE_004"; The block header data structure includes a preceding hash value. Generating the block header requires obtaining the hash value of the previous data block of the current data block based on the link identifier. For the storage link (IN_STORAGE_001), as the first link, an all-zero hash value (64 zeros) is used as the preceding data block hash value. For the outbound link (OUT_STORAGE_002), the data block of the storage link (IN_STORAGE_001) is searched and the hash value of that block is obtained as the preceding data block hash value. Similarly, the preceding data block hash values ​​of other data blocks are obtained. Next, a block header data structure containing a "previousHash" field is created to store the preceding block hash value, which is a 64-bit hexadecimal number. The obtained preceding block hash value is written to the "previousHash" field to obtain the block header.

[0030] For block data, convert the data format of the original flow information in the block data. Convert the flow time to the "YYYY-MM-DD HH:mm:ss" format, convert the flow location to a standard coding format (such as "WH-A-123"), convert the operator information to a standard format (including work number and name), and convert the operation type to a predefined code: "IN" for incoming goods, "OUT" for outgoing goods, "TRANS" for transportation, and "MAIN" for maintenance. Create a block data structure containing the "stageId" and "flowinfo" fields, write the stage identifier to the "stageId" field, and write the converted original flow information to the "flowinfo" field to obtain the block data.

[0031] Serialize the block header and block body data separately, converting the block header data into JSON format. Arrange the fields in the block body data in a predefined order: "stageId" is always the first field, "flowinfo" is the second field, and the internal fields of the "flowinfo" field have a fixed order: "flowTime", "location", "operator", and "operationType". Convert the block body data into JSON format as well. Define the data block structure: blockHeader: block header area, blockBody: block body area. Write the serialized block header data into the block header area, and write the serialized block body data into the block body area to obtain the current data block.

[0032] S103: Calculate a data block hash value of the data block according to a preset algorithm, and construct a hash link between the data block hash value of the previous data block and the previous data block hash value of the current data block to obtain a traceability chain; Specifically, a hash calculation is performed on the data block data of the previous data block using a preset hash algorithm, where the data block data includes block header data and block body data, to obtain a data block hash value of the previous data block, so as to establish a hash link with the hash value of the previous data block of the current data block; the data block hash value of the previous data block is written into the block header of the current data block to establish a link relationship between the current data block and the previous data block.

[0033] Among them, when performing hash calculation on the data block data of the previous data block, the block header data and the block body data need to be merged. The block header data includes the hash value of the previous data block of the current data block, and the block body data includes the link identifier and original flow information. The block header data and the block body data are merged, and the link identifier and flow information in the block body data are converted into a string format. For example: stageId:"IN_STORAGE_001" flowinfo:{ flowTime:"2024-11-03 10:30:00" location:"WH-A-123" operator:"OP001" operationType:"IN"}, Concatenate the fields of the block in order: "IN_STORAGE_001|2024-11-03 10:30:00|WH-A-123|OP001|IN". Use a special delimiter, such as "#", to concatenate the block header and block body data in the order of block header data first and block body data last. This completes the merging of the block header and block body data, and the merged data is converted to UTF-8 encoding. The processed data string is input into the SHA-256 hash function for calculation to obtain a 64-bit hexadecimal hash value unique to the data block. This hash value is irreversible and unique, uniquely identifying the data block, and any change to the data will result in a significant change in the hash value. Example of the resulting hash value: "8a7d9f3b2e1c4f5a6b8d0e2f4a6c8e0b1d3f5a7c9e1b3d5f7a9c1e3b5d7f9a1b3".

[0034] The data block hash value of the previous data block is written into the block header of the current data block, thereby establishing a one-way reference through the hash value. That is, the current data block references the previous block through the "previousHash" field, forming a chain structure. For example, the data block corresponding to the outbound link includes a block header and a block body. The hash value of the data block in the inbound link is written into the block header of the data block in the outbound link to establish a one-way reference. Similarly, a one-way hash link is established through hash values ​​across all data blocks to form a traceability chain. In the traceability chain, if the flow information in the block body of the data block corresponding to the inbound link is tampered with, the hash value calculation based on the preset hash value in the block header and the block body data containing the abnormal flow information will produce an incorrect hash value. The abnormal hash value will be written as the hash value of the previous data block in the block header corresponding to the outbound link. Because the hash value of the preceding data block written into the block header of the outbound data block is an incorrect hash value, the hash value of the outbound data block calculated based on the abnormal hash value is also an incorrect hash value. Similarly, tampering can be reflected in the subsequent circulation links of the traceability chain. At the final circulation link, the digital signature can be verified to determine whether the circulation information has been tampered with. The specific steps are referred to S206-S208 and are not explained here.

[0035] Optional, in Figure 1 After step S103 of the illustrated embodiment, the following steps may be performed: Specifically, the data block is transmitted to all data nodes in the traceability chain; the data block is subjected to consistency verification at the data node, which includes verifying the integrity of the data block and verifying the continuity of the hash link; the verification results of the data node are obtained, and the number of data nodes that pass the consistency verification is counted; and it is determined whether the number of data nodes that pass the consistency verification reaches the preset verification ratio; Among them, the consistency check of the data block at the data node specifically includes: performing structural verification and format verification on the data block through a preset verification algorithm, the structural verification includes comparing the data block with a preset data template, checking whether the data block contains all the fields in the preset data template, and the format verification includes checking the format specification of the data content, and checking the length and format of the hash value; if the structural verification and format verification are passed, it is determined whether the hash value of the previous data block of the target data block is the preset hash value; when the hash value of the previous data block of the target data block is the preset hash value, compare the data block hash value of the previous data block with the hash value of the previous data block of the current data block; if the data block hash value of the previous data block is equal to the hash value of the previous data block of the current data block, then the current data block is matched successfully, and if the data blocks corresponding to all flow links are matched successfully, then the hash link is continuous.

[0036] The data block is transmitted to all data nodes in the traceability chain. Each data node receives the complete data block information, including the block header and block body data, ensuring that all nodes receive the same data for subsequent verification. Each node compares the received data block with the pre-set data template for structural and format verification. Verification is performed to ensure that all required fields are included. This verification includes checking whether the block header contains the "previousHash" field, whether the block body contains the "stageId" and "flowinfo" fields, and whether the "flowInfo" field contains the "flowTime", "location", "operator", and "operationType" fields, ensuring that the hierarchical structure of all fields conforms to the pre-set template. A verification algorithm is used to compare the content format of each field in the data block to ensure that it conforms to the pre-set template: checking whether the previousHash is a 64-bit hexadecimal string; whether the stageId conforms to the pre-defined stage identifier format; whether the flowTime is in the standard date and time format; and whether the data type of each field is correct. If the structure verification and format verification pass, determine whether the hash value of the previous data block of the target data block corresponding to the first circulation link is the preset hash value. When the hash value of the previous data block of the target data block corresponding to the first circulation link is the preset hash value, compare the data block hash value of the previous data block with the hash value of the previous data block of the current data block to see if they are equal. If they are equal, it means that the current data block matches successfully, and the link relationship between the current data block and the previous data block is valid. Verify each data block on the traceability chain in turn. If the data blocks corresponding to all circulation links match successfully, the hash link is continuous.

[0037] Verification results are transmitted using a peer-to-peer (P2P) network: each node sends its verification results to neighboring nodes, which then share their results with each other. Each node maintains a verification result pool, and all nodes contribute to the results. Each data node independently counts the number of nodes in its result pool that have passed verification. Specifically, the node calculates the ratio of the number of nodes that have passed verification to the total number of responding nodes among all received verification results. This counting process is continuous, and the statistics are updated in real time as new verification results are received. Each node compares the calculated pass ratio with a pre-set verification ratio. For example, if the pre-set verification ratio is 67%, the node determines whether the number of nodes that have passed verification currently reaches 67% of the total number of responding nodes. This determination process continues until the pre-set ratio is reached. When the pass ratio reaches or exceeds the pre-set verification ratio, the data block passes the consistency check and is considered complete.

[0038] Figure 2 This is another flow chart of a repair parts traceability method in an embodiment of the present application.

[0039] See also Figure 2 In an embodiment of the present application, a method for tracing the source of repair parts is applied to a server, and the method includes: S201. Arrange the circulation links of the repair parts according to the execution order and obtain the original circulation information of the circulation links; S202: Generate data blocks corresponding to the circulation link according to the original circulation information; S203, converting the original flow information to obtain first flow information; S204: Serialize the first flow information to obtain second flow information; S205: Calculate the second flow information using a preset hash algorithm to obtain a first hash value; Steps S201 to S205 may refer to steps S101 to S103 and will not be described in detail here.

[0040] S206. Generate a public-private key pair using a preset signature algorithm; Generally, the RSA algorithm can be used to generate a public-private key pair. Two prime numbers, p and q, are randomly generated using a prime number generation algorithm. These two prime numbers must be unequal and have a sufficiently long length, usually 512 bits or longer, to ensure that the generated key has sufficient security strength. These two prime numbers are multiplied together to obtain the modulus n. The number of bits in this modulus n determines the length of the final key. To ensure security, a key length of 2048 bits or 4096 bits can be used. The Euler function is calculated for subsequent calculation of the private key: Where n is the modulus, p and q are randomly generated prime numbers, and the Euler function obtained must be kept secret. The result of the Euler function is an important parameter for generating the private key. If it is leaked, the security of the entire key system may be destroyed. Select a public key exponent e. This number must be the same as the previously calculated Euler function. To improve computational efficiency, 65537 is usually chosen as the public key exponent, which is a number with only two 1s in binary representation. To calculate the private key exponent d, the extended Euclidean algorithm is used to obtain a number d such that d multiplied by e is positive. The remainder equals 1. Therefore, the public key, consisting of the modulus n and the public key exponent e, can be publicly distributed to anyone who needs to verify the signature. For example, parts manufacturers verify the parts information from upstream suppliers; transportation companies verify the authenticity of information during handovers; repair stations verify the source and flow of parts; and warehouses verify the authenticity of incoming parts. The private key, consisting of the modulus n and the private key exponent d, is kept by managers at each flow link and cannot be disclosed.

[0041] S207: Use the public key to perform a digital signature verification operation on the digital signature to be verified to obtain a second hash value; Assume the public key is (n, e), the digital signature value is s, and the verification calculation is: m = s e mod n, where: s: digital signature value (the result of encrypting the original hash value with the private key d).

[0042] e: Public key exponent (usually 65537).

[0043] n: modulus (the product of two large prime numbers p and q).

[0044] m: verified hash value (second hash value).

[0045] mod is the modulus (remainder) operation, which represents the remainder after the division operation. Since d and e satisfy: So the first hash value can be restored, where d is the private key exponent, is the Euler function.

[0046] S208: Compare the first hash value and the second hash value. If the first hash value and the second hash value are the same, the second flow information has not been tampered with. Comparing the first hash value with the second hash value, if the first hash value and the second hash value are the same, the second circulation information has not been tampered with. If the second circulation information has been tampered with, the second hash value obtained when verifying the signature using the public key is the same as the second hash value obtained when verifying the signature using the public key before the tampering. However, because the second circulation information has been tampered with, the first hash value of the second circulation information will change after the tampering. Therefore, when the first hash value and the second hash value are the same, the second circulation information has not been tampered with.

[0047] S209: Build a hash link to obtain a traceability chain; Step S209 may refer to step S103 and will not be described again here.

[0048] A repair parts traceability method in an embodiment of the present application is described above. Now, in combination with the above-mentioned repair parts traceability method, a repair parts traceability system 300 in an embodiment of the application will be described in detail.

[0049] See also Figure 3 , is a structural diagram of a repair parts traceability system provided in an embodiment of the present application. A repair parts traceability system 300 specifically includes: The acquisition module 301 is used to arrange the flow links of the repair parts in the order of execution and obtain the original flow information of the flow links, which includes the flow time, flow location, operator information, and operation type. The flow links include the warehousing link, the outbound link, the transportation link, and the maintenance link; A generation module 302 is configured to generate a data block corresponding to a flow link based on the original flow information, wherein the data block includes a data block hash value and a previous data block hash value, wherein the data block hash value is the hash value of the current data block, the previous data block hash value is the hash value of the previous data block of the current data block, the previous data block is the data block corresponding to the previous flow link, and the previous flow link is the flow link before the flow link corresponding to the current data block, wherein the previous data block hash value of the current data block is equal to the data block hash value of the previous data block, and the previous data block hash value of the target data block corresponding to the first flow link in the flow link is a preset hash value; The link module 303 calculates the data block hash value of each data block according to a preset algorithm, and constructs a hash link between the data block hash value of the previous data block and the previous data block hash value of the current data block to obtain a traceability chain.

[0050] Optionally, the generating module 302 is specifically configured to: Generate a link identifier according to the execution order; generate a block header and block body corresponding to the link identifier based on the link identifier, the block header data of the block header includes the hash value of the previous data block of the current data block, and the block body data of the block body includes the link identifier and original flow information; serialize the block header data and the block body data according to the predefined format; construct a structure of the data block, the structure includes a block header area and a block body area; write the serialized block header data into the block header area of ​​the structure; write the serialized block body data into the block body area of ​​the structure to obtain the current data block.

[0051] Optionally, the generating module 302 is further specifically configured to: Obtain the hash value of the previous data block of the current data block according to the link identifier; create a block header data structure of the block header, the block header data structure includes a previous hash value field; write the hash value of the previous data block of the current data block into the previous hash value field to obtain a block header; convert the original flow information into a preset data format; create a block body data structure of the block body, the block body data structure includes an identification field and an information field; write the link identifier into the identification field; write the converted original flow information into the information field to obtain a block body.

[0052] Optionally, the link module 303 is specifically configured to: A hash calculation is performed on the data block data of the previous data block using a preset hash algorithm. The data block data includes block header data and block body data, and a data block hash value of the previous data block is obtained to facilitate the construction of a hash link with the hash value of the previous data block of the current data block; the data block hash value of the previous data block is written into the block header of the current data block to establish a link relationship between the current data block and the previous data block.

[0053] Optionally, the system further includes a verification module 304, which is specifically configured to: The original flow information is converted into a predefined format to obtain first flow information; the first flow information is serialized according to the predefined format to obtain second flow information; the second flow information is calculated by a preset hash algorithm to obtain a first hash value; a public-private key pair is generated by a preset signature algorithm, wherein the private key is used to generate a digital signature and the public key is used to verify the signature; the public key is used to perform a digital signature verification operation on the digital signature to be verified to obtain a second hash value; the first hash value is compared with the second hash value. If the first hash value is the same as the second hash value, the second flow information has not been tampered with.

[0054] Optionally, the system further includes a verification module 305, which is specifically configured to: Transmit data blocks to all data nodes in the traceability chain; perform consistency checks on data blocks at data nodes, including verifying the integrity of data blocks and the continuity of hash links; obtain verification results of data nodes, and count the number of data nodes that pass the consistency check; determine whether the number of data nodes that pass the consistency check reaches the preset verification ratio; when the number of data nodes that pass the consistency check reaches the preset verification ratio, the consistency check is completed.

[0055] Optionally, the verification module 305 is further specifically configured to: The data block is subjected to structural verification and format verification through a preset verification algorithm. Structural verification includes comparing the data block with a preset data template to check whether the data block contains all the fields in the preset data template. Format verification includes checking the format specification of the data content and checking the length and format of the hash value. If the structural verification and format verification are passed, it is determined whether the hash value of the preceding data block of the target data block is the preset hash value. When the hash value of the preceding data block of the target data block is the preset hash value, the data block hash value of the preceding data block is compared with the preceding data block hash value of the current data block to see whether they are equal. If the data block hash value of the preceding data block is equal to the preceding data block hash value of the current data block, the current data block is matched successfully. If the data blocks corresponding to all flow links are matched successfully, the hash links are continuous.

[0056] It should be noted that the above embodiments provide devices that implement their functions using only the division of the above functional modules as examples. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0057] This embodiment also discloses an electronic device, referring to Figure 4 The electronic device may include: at least one processor 401 , at least one communication bus 402 , a user interface 403 , a network interface 404 , and at least one memory 405 .

[0058] The communication bus 402 is used to implement the connection and communication between these components.

[0059] The user interface 403 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.

[0060] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0061] The processor 401 may include one or more processing cores. The processor 401 utilizes various interfaces and lines to connect various parts of the entire server, and executes various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 405, as well as calling data stored in the memory 405. Optionally, the processor 401 may be implemented in the form of at least one hardware component selected from digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 401 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 401 and may be implemented separately on a single chip.

[0062] Among them, the memory 405 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory 405 includes a non-transitory computer-readable storage medium. The memory 405 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 405 may also be optionally at least one storage device located away from the aforementioned processor 401. As Figure 4 As shown, the memory 405 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program for a repair parts tracing method.

[0063] exist Figure 4 In the electronic device shown, the user interface 403 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 401 can be used to call an application program storing a repair parts traceability method in the memory 405. When executed by one or more processors 401, the electronic device executes one or more methods in the above-mentioned embodiments.

[0064] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for this application.

[0065] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0066] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely schematic, such as the division of units, which is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interface, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

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

[0068] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0069] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory 405. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory 405 and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory 405 includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a magnetic disk, or an optical disk.

[0070] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification, those skilled in the art will easily think of other embodiments of the present disclosure. This application is intended to cover any variations, uses or adaptive changes of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the technical field that are not recorded in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A maintenance parts tracing method, characterized in that: Applied in a server, the method comprises: Arrange the circulation links of the repair parts in the order of execution, and obtain the original circulation information of the circulation links, wherein the original circulation information includes the circulation time, the circulation location, the operator information, and the operation type, and the circulation links include the warehousing link, the outbound link, the transportation link, and the maintenance link; Generate a data block corresponding to the circulation link according to the original circulation information, the data block includes a data block hash value and a preceding data block hash value, the data block hash value is the hash value of the current data block, the preceding data block hash value is the hash value of the preceding data block of the current data block, the preceding data block is the data block corresponding to the preceding circulation link, the preceding circulation link is the previous circulation link of the circulation link corresponding to the current data block, wherein the preceding data block hash value of the current data block is equal to the data block hash value of the preceding data block, and the preceding data block hash value of the target data block corresponding to the first circulation link in the circulation link is a preset hash value; The data block hash value of each data block is calculated according to a preset algorithm, and a hash link is constructed between the data block hash value of the previous data block and the previous data block hash value of the current data block to obtain a traceability chain.

2. The method according to claim 1, characterized in that The step of generating the data block corresponding to the circulation link according to the original circulation information specifically includes: Generate a link identifier according to the execution order; Generate a block header and a block body corresponding to the link identifier according to the link identifier, wherein the block header data of the block header includes a hash value of a preceding data block of the current data block, and the block body data of the block body includes the link identifier and the original flow information; Serializing the block header data and the block body data according to a predefined format; Constructing a data block structure, wherein the structure includes a block header area and a block body area; Writing the serialized block header data into the block header area of ​​the structure; The serialized block body data is written into the block body area of ​​the structure to obtain the current data block.

3. The method according to claim 2, characterized in that The generating a block header and a block body corresponding to the link identifier according to the link identifier specifically includes: Obtaining a hash value of a preceding data block of the current data block according to the link identifier; Creating a block header data structure of the block header, wherein the block header data structure includes a pre-order hash value field; Writing the hash value of the preceding data block of the current data block into the preceding hash value field to obtain the block header; Converting the original flow information into a preset data format; Creating a block body data structure of the block body, wherein the block body data structure comprises an identification field and an information field; Writing the link identifier into the identifier field; The converted original flow information is written into the information field to obtain the block body.

4. The method according to claim 1, characterized in that The step of calculating the data block hash value of each data block according to a preset algorithm and constructing a hash link between the data block hash value of the previous data block and the previous data block hash value of the current data block specifically includes: Performing hash calculation on the data block data of the preceding data block by a preset hash algorithm, wherein the data block data includes block header data and block body data, and obtaining a data block hash value of the preceding data block, so as to construct a hash link with the preceding data block hash value of the current data block; The data block hash value of the previous data block is written into the block header of the current data block to establish a link relationship between the current data block and the previous data block.

5. The method according to claim 1, characterized in that After generating the data block corresponding to the circulation link according to the original circulation information, the method further includes verifying the original circulation information, and the verifying the original circulation information specifically includes: Converting the original flow information into a predefined format to obtain first flow information; Serializing the first flow information according to a predefined format to obtain second flow information; Calculate the second flow information by using a preset hash algorithm to obtain a first hash value; Generate a public-private key pair through a preset signature algorithm, where the private key is used to generate a digital signature and the public key is used to verify the signature; Using the public key to perform a digital signature verification operation on the digital signature to be verified, to obtain a second hash value; The first Hash value is compared with the second Hash value. If the first Hash value is the same as the second Hash value, the second flow information has not been tampered with.

6. The method according to claim 5, characterized in that After calculating the data block hash value of each data block according to the preset algorithm and constructing a hash link between the data block hash value of the previous data block and the previous data block hash value of the current data block, the method further includes performing a consistency check on the second flow information, and the consistency check on the second flow information specifically includes: Transmitting the data block to all data nodes in the traceability chain; Performing a consistency check on the data block at the data node, wherein the consistency check includes verifying the integrity of the data block and verifying the continuity of the hash link; Obtaining verification results of the data nodes, and counting the number of the data nodes that pass the consistency check; Determine whether the number of data nodes that pass the consistency check reaches a preset check ratio; When the number of data nodes that pass the consistency check reaches a preset check ratio, the consistency check is completed.

7. The method according to claim 6, characterized in that The performing consistency check on the data block at the data node specifically includes: Performing structural verification and format verification on the data block by using a preset verification algorithm. The structural verification includes comparing the data block with a preset data template to check whether the data block contains all the fields in the preset data template. The format verification includes checking the format specification of the data content and checking the length and format of the hash value. If the structure verification and the format verification are passed, determining whether the hash value of the preceding data block of the target data block is the preset hash value; When the preceding data block hash value of the target data block is the preset hash value, comparing the data block hash value of the preceding data block with the preceding data block hash value of the current data block to see whether they are equal; If the data block hash value of the previous data block is equal to the previous data block hash value of the current data block, the current data block matches successfully. If the data blocks corresponding to all circulation links match successfully, the hash link is continuous.

8. A maintenance parts traceability system, characterized in that: include: An acquisition module, used to arrange the circulation links of the repair parts in the order of execution, and acquire the original circulation information of the circulation links, wherein the original circulation information includes the circulation time, the circulation location, the operator information, and the operation type, and the circulation links include the warehousing link, the outbound link, the transportation link, and the maintenance link; A generation module, used for generating a data block corresponding to the circulation link according to the original circulation information, wherein the data block includes a data block hash value and a preceding data block hash value, wherein the data block hash value is a hash value of a current data block, wherein the preceding data block hash value is a hash value of a preceding data block of the current data block, wherein the preceding data block is a data block corresponding to a preceding circulation link, wherein the preceding data block hash value of the current data block is equal to the data block hash value of the preceding data block, and the preceding data block hash value of a target data block corresponding to a first circulation link in the circulation link is a preset hash value; The link module is used to calculate the data block hash value of each data block according to a preset algorithm, and to construct a hash link between the data block hash value of the previous data block and the previous data block hash value of the current data block to obtain a traceability chain.

9. A repair parts tracing device, characterized in that: include: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the repair parts tracing device to execute the method as described in any one of claims 1-7.

10. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on the repair parts tracing device, the repair parts tracing device is caused to execute the method as claimed in any one of claims 1 to 7.

Citation Information

Cited By

  • Automobile part multi-source fusion tracing method and system based on distributed block chain

    CN120725696A

  • Block chain-driven industrial Internet of Things alarm event processing method and system

    CN120768681A