A method, system and computer program product for normalizing and asynchronously notarizing business data
By generating unique business identifiers and data version identifiers, combined with idempotent evidence storage identifiers, and asynchronously submitting and inspecting blockchain evidence storage records, the problems of evidence storage omissions and duplicate submissions during asynchronous evidence storage are solved, and data integrity and reliable verification are achieved.
Patent Information
- Application Number
- CN202611433690.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2046-09-16
AI Technical Summary
Existing blockchain-based evidence storage technologies struggle to accurately distinguish between different stages of anomaly during asynchronous processing, leading to omissions or duplicate submissions of evidence. Furthermore, inconsistencies between business data and on-chain evidence storage records affect data integrity and reliability.
By generating a unique business identifier and a data version identifier, combined with an idempotent identifier for evidence storage, an evidence storage data package is formed and asynchronously submitted to the blockchain network. The three-state joint inspection is used to identify anomaly types, and differentiated recovery is performed for different anomalies to ensure data consistency and credible verification.
It improves the integrity, accuracy, and resistance to duplicate submissions in an asynchronous processing environment, ensuring long-term reliable verification and reducing the impact on business response.
Smart Images

Figure CN122951771B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of trusted data storage and blockchain data processing technology, specifically to a standardized asynchronous trusted storage method, system, and computer program product for business data. Background Technology
[0002] With the development of e-government, enterprise digitalization, and internet business systems, a large amount of contract documents, approval records, transaction data, business documents, operation records, and other electronic data are generated and stored in digital form. For business scenarios with auditing, supervision, dispute resolution, or accountability requirements, relying solely on traditional business databases to store relevant data often makes it technically difficult to fully prove whether the data has been modified after its creation. Therefore, leveraging the characteristics of blockchain—multi-node joint maintenance, data tamper-proofing after writing, and historical traceability—to create credible evidence for business data has become a technical solution for trusted electronic data management.
[0003] Existing blockchain-based evidence storage technologies typically calculate hash values for the business data to be stored, write the hash value or related evidence information to the blockchain, and recalculate the hash value of the data to be verified when needed. This hash value is then compared with the hash value stored in the blockchain to determine whether the business data has changed. For business scenarios containing sensitive information or large amounts of data, a method can be adopted where plaintext business data is stored off-chain, while the data hash fingerprint is written on-chain. This reduces the amount of on-chain data storage and mitigates the data exposure risk caused by directly writing plaintext business data to the blockchain.
[0004] For example, Chinese patent CN109766724A discloses a data storage method based on blockchain. This method generates a globally unique identifier upon receiving a data storage request and generates a hash value based on the data to be stored. The globally unique identifier and hash value are then sent to a message queue. A consumer module retrieves the corresponding information from the message queue and calls the blockchain interface for storage. In subsequent processing, the system can also query the blockchain to see if the corresponding data exists. If the data does not exist, the information to be processed is placed back into the message queue. This solution decouples the data receiving process from the blockchain writing process to a certain extent through the message queue, which helps reduce the impact of blockchain processing speed on the front-end data storage request and allows for the reprocessing of data that was not successfully written to the blockchain.
[0005] However, in real-world business systems, the generation of business data, the formation of evidence storage tasks, and the completion of blockchain transactions typically occur at different processing stages. With asynchronous processing, anomalies don't necessarily only occur during the submission of already formed evidence storage tasks to the blockchain. For example, if business data has been persisted but the corresponding evidence storage task hasn't been formed correctly, the system may not have a failed task that can be directly re-executed. Or, for instance, the evidence storage data may have been successfully written to the blockchain, but due to network anomalies, lost return information, or abnormal local state updates, the local evidence storage task may remain incomplete. In these situations, simply performing a uniform resubmission based on existing failed tasks is insufficient to fully reflect the actual correspondence between business data, asynchronous tasks, and on-chain evidence storage results, and may lead to issues such as missing or duplicate submissions.
[0006] On the other hand, data consistency between business systems and blockchain systems has also attracted attention. For example, Chinese patent CN113127499A discloses a blockchain-based microservice method, device, and medium. This method associates business transaction data from the microservice platform with transaction data from the blockchain platform through transaction data identifiers and can perform periodic reconciliation. In the event of business processing failures, timeouts, or anomalies in blockchain accounting, transaction compensation is implemented based on the corresponding transaction status and log information. This solution can improve the consistency problem between microservice business data and blockchain transaction data to a certain extent.
[0007] However, the aforementioned existing technologies primarily focus on status queries, reconciliation, retries, or transaction compensation for established transactions or evidence storage tasks. When the business system and the trusted evidence storage system adopt an asynchronous, decoupled architecture, business data records, asynchronous evidence storage task records, and blockchain evidence storage records reflect the execution facts of different processing stages. Relying solely on the existence of on-chain records or whether the evidence storage task is in a failed state makes it difficult to accurately distinguish whether the anomaly occurred during the evidence storage task formation stage, the task execution stage, or the on-chain processing result return and local state update stage. Therefore, when adopting a unified compensation strategy, situations may arise where business data has been formed but no corresponding task is available for recovery, or where on-chain transactions have actually been completed but are resubmitted due to a lack of timely confirmation of the local state. Summary of the Invention
[0008] This invention aims to provide a standardized asynchronous trusted evidence storage method, system, and computer program product for business data, in order to solve the problems in existing blockchain evidence storage technologies, such as business processing being easily blocked by the on-chain process, unstable hash verification due to differences in structured data representation, and inconsistencies between the business records, evidence storage task records, and on-chain evidence storage records during asynchronous evidence storage, resulting in missed storage, duplicate submissions, or error recovery. It achieves asynchronous decoupling of business data and trusted evidence storage process, stable fingerprint generation, evidence storage anomaly identification, differentiated recovery, and long-term trusted verification.
[0009] A standardized asynchronous trusted evidence storage method for business data includes the following steps:
[0010] S1. After the business data is persisted locally, a storage event is generated with the unique business identifier. The storage event is written into the asynchronous task queue and the status of the corresponding storage task is recorded, so that the business processing flow ends after the storage event is written.
[0011] S2. Asynchronously acquire the corresponding business data. For structured business data, form a definite data sequence according to the predetermined field order, null value handling rules and character encoding rules. For unstructured business data, acquire the data content according to a fixed reading sequence, calculate the hash fingerprint and encapsulate it with the unique business identifier and operation metadata into a storage data package.
[0012] S3. Asynchronously submit the evidence storage data packet to the blockchain network, update the evidence storage task status according to the submission result, and establish a local correspondence between the business unique identifier and the on-chain transaction identifier after obtaining the on-chain transaction identifier;
[0013] S4. According to the preset inspection cycle, cross-check the local business records, evidence storage task records and on-chain evidence storage records based on the unique business identifier. Identify task missing anomalies, task incomplete anomalies or anomalies that exist on the chain but are not confirmed locally based on the existence status of the three and the status of the evidence storage task.
[0014] S5. For task missing exceptions, regenerate the evidence storage task based on the corresponding business data; for task incomplete exceptions, restore the corresponding evidence storage task; for exceptions that exist on the chain but are not confirmed locally, stop resubmitting and complete the local correspondence based on the evidence storage record on the chain; before resubmitting the first two types of exceptions, query the corresponding evidence storage record on the chain, and if the record already exists on the chain, convert it to the exception that exists on the chain but is not confirmed locally.
[0015] S6. During verification, determine the data version identifier corresponding to the business data to be verified, recalculate the hash fingerprint of the business data to be verified according to the normalized processing rules corresponding to the data version in step S2, and compare it with the on-chain hash fingerprint obtained based on the unique business identifier and the data version identifier to determine the consistency status of the business data.
[0016] As a further improvement, in step S1, when the business data is persisted locally, a data version identifier associated with the business unique identifier is generated, and an idempotent identifier for evidence storage is generated based on the business unique identifier, the business event type, and the data version identifier. The same business unique identifier corresponds to different idempotent identifiers for evidence storage under different data versions, and duplicate evidence storage events of the same data version correspond to the same idempotent identifier for evidence storage. The idempotent identifier for evidence storage is transmitted together with the evidence storage task record and the evidence storage data packet.
[0017] As a further improvement, in step S2, a normalization rule identifier is set for the normalization processing rule. The normalization rule identifier is used to indicate the set of fields participating in the evidence storage, the field order, the null value representation method, and the character encoding method. When generating the evidence storage data packet, the normalization rule identifier is associated with the corresponding hash fingerprint, so that during verification, the same normalization processing rule as that used during evidence storage is called according to the normalization rule identifier corresponding to the evidence storage record on the chain to re-form the data sequence to be verified.
[0018] As a further improvement, in step S4, a record group to be verified is formed based on the same unique business identifier and data version identifier. This record group includes local business records, evidence storage task records, and on-chain evidence storage records; wherein:
[0019] When a local business record exists, but the corresponding evidence storage task record does not exist and the corresponding on-chain evidence storage record does not exist, it is determined to be a task missing anomaly.
[0020] When the local business record and the corresponding evidence storage task record exist, the evidence storage task status is not a successful submission status and the corresponding on-chain evidence storage record does not exist, it is determined to be an incomplete task exception.
[0021] When local business records and corresponding evidence storage task records exist, and the evidence storage task status is not a successful submission status but the corresponding on-chain evidence storage record exists, it is determined to be an exception where the record already exists on the chain but is not confirmed locally.
[0022] The anomaly type is then associated with the unique business identifier, data version identifier, and evidence idempotency identifier and recorded.
[0023] As a further improvement, in step S5:
[0024] For task-missing anomalies, locate the corresponding data snapshot to be stored based on the unique business identifier and data version identifier, and regenerate the storage task that is consistent with the original storage idempotent identifier.
[0025] For task incomplete exceptions, recover the existing evidence-saving task associated with the corresponding evidence-saving idempotency flag from the persistent cache or failure compensation queue;
[0026] For anomalies that exist on the chain but are not confirmed locally, the corresponding on-chain transaction identifier and on-chain hash fingerprint are read, and the hash fingerprint of the corresponding local business data is recalculated according to the normalized rule identifier associated with the on-chain evidence storage record. When the two are consistent, the on-chain transaction identifier is written into the local correspondence and the evidence storage task status is updated to the submission success status, without submitting the evidence storage data packet to the blockchain network again.
[0027] As a further improvement, for exceptions such as missing tasks or incomplete tasks, the blockchain network is queried using the idempotency identifier before resubmitting the notarization task:
[0028] The commit is executed if no corresponding on-chain evidence record exists.
[0029] When there is a corresponding on-chain evidence record and the on-chain hash fingerprint is consistent with the local hash fingerprint recalculated according to the corresponding data version and normalization rules, the submission is stopped and the local state is repaired according to the type of exception that exists on the chain but is not confirmed locally.
[0030] If a corresponding on-chain evidence record exists but the on-chain hash fingerprint is inconsistent with the recalculated local hash fingerprint, the original on-chain evidence record will not be overwritten and will be recorded as a content conflict type exception.
[0031] As a further improvement, the operation metadata includes at least one of the following: operation subject identifier, operation time information, digital signature information, project identifier, unit identifier, and equipment traceability information; the hash calculation of both structured and unstructured business data is completed locally, and the blockchain network stores the hash fingerprint and the corresponding operation metadata but does not store the corresponding business plaintext data.
[0032] Another aspect of this invention provides a standardized asynchronous trusted evidence storage system for business data. This system implements the method described above, comprising: an event and task management module, used to generate evidence storage events using a unique business identifier after the business data has been locally persisted, write the evidence storage events into an asynchronous task queue, and record the status of the corresponding evidence storage tasks; a standardized fingerprint generation module, used to form a defined data sequence for structured business data according to a predetermined field order, null value handling rules, and character encoding rules, to obtain data content for unstructured business data according to a fixed reading sequence, and to calculate the corresponding hash fingerprint; and an asynchronous evidence storage module, used to submit an evidence storage data packet including the hash fingerprint, the unique business identifier, and operation metadata to the blockchain network, and update the evidence storage based on the submission result. The system includes a task status module, which establishes a local correspondence between a unique business identifier and an on-chain transaction identifier; a status inspection module, which cross-checks local business records, evidence storage task records, and on-chain evidence storage records based on the unique business identifier, and identifies task-missing anomalies, incomplete task anomalies, or anomalies that exist on-chain but are not confirmed locally based on the existence status of the three and the evidence storage task status; a difference recovery module, which performs tasks to regenerate evidence storage tasks, restore existing evidence storage tasks, or complete the local correspondence based on the anomaly type; and an evidence verification module, which recalculates the hash fingerprint of the business data to be verified according to the same normalized processing rules as the normalized fingerprint generation module, and compares it with the corresponding on-chain hash fingerprint.
[0033] As a further improvement, the event and task management module is also used to generate data version identifiers and evidence storage idempotency identifiers; the status inspection module is used to form a group of records to be checked, including local business records, evidence storage task records and on-chain evidence storage records, based on the unique business identifier and data version identifier; the difference recovery module includes a task reconstruction unit, a task recovery unit and a local status repair unit, which are respectively used to regenerate evidence storage tasks for task missing anomalies, restore existing evidence storage tasks for task incomplete anomalies, and complete the local correspondence by verifying the consistency between on-chain hash fingerprints and locally recalculated hash fingerprints for anomalies that exist on-chain but are not confirmed locally.
[0034] A third aspect of the present invention provides a computer program product, including a computer program that, when executed by a processor, causes the computer to perform a standardized asynchronous trusted evidence storage method for the business data.
[0035] This invention generates a notarization event after business data is persisted locally and then uses asynchronous tasks to perform subsequent normalization, hash calculation, and blockchain notarization. This eliminates the need for business processing to wait for blockchain consensus and transaction completion, thus reducing the impact of the trusted notarization process on normal business responses. By standardizing the field order, null value handling method, and character encoding rules for structured business data, and calculating hash fingerprints for unstructured business data according to a fixed reading sequence, the same business content can form stable and repeatable digital fingerprints, improving the consistency of notarization and subsequent verification. Furthermore, it uses a unique business identifier as the association benchmark. The system performs joint verification of local business records, evidence storage task records, and on-chain evidence storage records. Based on different state combinations, it identifies anomalies such as missing tasks, incomplete tasks, and existing on-chain but unconfirmed local anomalies. For each anomaly, it regenerates the evidence storage task from the original business data, recovers the task from the persistent task data, or uses existing on-chain transaction results to reverse-complete the local correspondence. This not only helps to discover silent omissions in evidence storage tasks that are difficult to identify by traditional failed task retry mechanisms, but also prevents the resubmission of the same evidence storage data when the on-chain transaction has been successful but the local state has not been updated in time. Furthermore, through mechanisms such as data version, idempotent evidence identifier, and standardized rule identifier, asynchronous task recovery and historical verification can correspond to the data version and standardized processing rules of the original business event. During the recovery process, the on-chain hash fingerprint and the locally recalculated hash fingerprint are combined to determine content consistency. This can also distinguish between different situations where the data has been successfully recorded on the chain but not confirmed locally and conflicts with the content recorded on the chain. This improves the integrity, accuracy, anti-duplicate submission capability, and long-term verifiability of business data evidence storage in complex asynchronous processing environments, and enables trusted evidence storage and audit traceability while keeping plaintext business data stored locally. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the overall process of a standardized asynchronous trusted evidence storage method for business data according to the present invention;
[0037] Figure 2 A comparison chart of the business response times of synchronous evidence storage, ordinary asynchronous evidence storage, and the asynchronous trusted evidence storage method of the present invention;
[0038] Figure 3 The graph shows a comparison of the anomaly identification and recovery results of the ordinary asynchronous retry method and the method of the present invention under different anomaly injection conditions.
[0039] Figure 4 This is a comparison chart showing the consistency results of structured business data when hashed directly and after being processed using the normalization method of this invention. Detailed Implementation
[0040] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0041] I. General Description
[0042] The following is combined Figure 1 This invention provides a detailed description of a standardized asynchronous trusted evidence storage method, system, and computer program product for business data.
[0043] This embodiment uses government and enterprise procurement as a typical application scenario for illustration, but the present invention is not limited to government and enterprise procurement scenarios. It can also be applied to contract management, electronic approval, engineering project management, supply chain business, financial business documents, government affairs processing, electronic file management, medical business records, and other business systems that require the formation of long-term, stable, and verifiable electronic evidence of business data.
[0044] like Figure 1 As shown in this embodiment, after the business data is persisted locally, the current business thread is not required to continue waiting for the blockchain nodes to complete consensus, packaging, and transaction confirmation. Instead, a notarization event is formed and handed over to the asynchronous task system for processing. The background task reads the business data to be notarized according to the data version corresponding to the business event, performs deterministic normalization processing on the structured business data, obtains the data content of the unstructured data according to a fixed reading method, calculates the hash fingerprint, forms a notarization data packet, and asynchronously submits it to the blockchain network.
[0045] Unlike ordinary asynchronous retry mechanisms, this invention does not treat failed evidence storage tasks as the sole object of anomaly detection. Instead, during subsequent operation, it uses the same unique business identifier as a unified index to simultaneously observe three independent state facts:
[0046] First, does the local business record already exist?
[0047] Second, whether the corresponding evidence storage task has been established and its current status;
[0048] Third, whether the corresponding evidence already exists in the blockchain network.
[0049] By jointly judging the three types of states, it is possible to further distinguish whether the anomaly occurred before the evidence storage task was formed, during the execution of the evidence storage task, or whether the blockchain had actually succeeded but the local system did not correctly receive the processing result.
[0050] Depending on the stage of the anomaly, this invention implements recovery from different data sources, thereby avoiding two types of problems caused by uniformly "resubmitting" for all anomalies: one is the silent omission of data due to the lack of failed tasks available for retry; the other is the duplicate on-chaining caused by resubmitting after the blockchain has already been successfully verified.
[0051] This embodiment can further combine data version identifier, snapshot location information of data to be stored, normalization rule identifier, and idempotency identifier to ensure that even if the business data itself and the data normalization rules change, the system can still restore the data version and normalization rules corresponding to the original business event, thereby ensuring the stability of long-term verification.
[0052] II. Terminology Explanation
[0053] To enable those skilled in the art to accurately understand the present invention, the main terms involved in this embodiment will be explained below.
[0054] 1. Business Data
[0055] Business data refers to the data that a business system generates and persists after executing a business operation. It can be structured or unstructured data.
[0056] Structured business data, such as procurement project initiation information, approval records, quotation records, review scores, contract amounts, payment applications, and acceptance results, typically exist in database table fields, JSON objects, or other structured formats.
[0057] Unstructured business data includes PDF contract documents, Word documents, scanned copies, images, original electronic invoices, and other binary files.
[0058] 2. Unique Business Identifier
[0059] The unique business identifier is a data identifier used to establish a logical connection between local business records, evidence storage task records, and on-chain evidence storage records.
[0060] In one embodiment, a unique business identifier can be formed by combining the procurement project ID and the business document ID, or it can be formed by the business database primary key, UUID, or a unique key composed of multiple business fields.
[0061] The unique business identifier primarily answers which business object the evidence record belongs to.
[0062] 3. Data version identifier
[0063] Data version identifiers are used to distinguish the business status of the same business object at different times.
[0064] For example, the same procurement contract can correspond to versions V1, V2, and V3 respectively when it is first generated, when a supplementary agreement takes effect, and when it is subsequently changed.
[0065] The unique business identifier answers which business object it is, while the data version identifier further answers which historical state of that business object it is.
[0066] 4. Idempotent identifier for evidence preservation
[0067] The evidence preservation idempotency flag is used to identify whether two evidence preservation requests belong to the same logical evidence preservation of the same business data version.
[0068] In one embodiment, an idempotent identifier for evidence storage can be generated based on a unique business identifier, a business event type, and a data version identifier.
[0069] For different data versions with the same unique business identifier, generate different idempotent evidence identifiers; for evidence storage events that are repeatedly generated due to network retries, service restarts, or task recovery for the same data version, maintain the same idempotent evidence identifier.
[0070] Therefore, the idempotency flag for evidence storage is mainly used to avoid duplicate evidence storage during the abnormal recovery process.
[0071] 5. Location information of the snapshot of the data to be stored
[0072] The location information of the data snapshot to be stored is used to locate the data status corresponding to the occurrence of the business event.
[0073] It can be the database version number, historical table record number, event log offset, data snapshot ID, or data location parameter that can uniquely restore the corresponding historical business data.
[0074] This mechanism is used to prevent asynchronous tasks from reading the current data of business objects that have already been modified.
[0075] 6. Standardization Rules
[0076] Normalization rules refer to the data processing rules followed when transforming logically identical business data into a uniquely identifiable data sequence before calculating the hash of structured data.
[0077] In one embodiment, the normalization rules include at least: the set of fields involved in the evidence storage; the order of the fields; the rules for representing null values; the character encoding rules; and the rules for concatenating fields.
[0078] 7. Standardized rule identifiers
[0079] The normalization rule identifier is used to identify the specific normalization rule used when generating a hash fingerprint.
[0080] When the system is upgraded in the future, the field set, null value representation method or character encoding rules will still retain the corresponding original normalization rule identifier of the old evidence records.
[0081] When verifying historical data, the system calls the rules used at that time based on the original normalization rule identifier to recalculate, instead of directly using the latest rules currently in the system.
[0082] 8. Local business records
[0083] Local business records are business facts that have been successfully and persistently saved by the business system. Once a local business record has been created, it means that the corresponding business operation has been completed at the business layer.
[0084] 9. Evidence Preservation Task Record
[0085] The evidence storage task record describes whether the corresponding business data has been formed into a blockchain evidence storage task to be executed, and the current execution status of the task. Task status includes, for example, pending, processing, failed submission, and successful submission.
[0086] 10. On-chain evidence storage records
[0087] On-chain evidence records are evidence facts that have been confirmed and formed by the blockchain network, and may include at least one of the following: unique business identifier, idempotent evidence identifier, hash fingerprint, operation metadata, on-chain transaction identifier, and block height.
[0088] III. System Overall Structure
[0089] The business data standardization asynchronous trusted evidence storage system in this embodiment includes at least an event and task management module, a standardized fingerprint generation module, an asynchronous evidence storage module, a status inspection module, a difference recovery module, and an evidence storage verification module.
[0090] The event and task management module connects to the data persistence process of the business system to generate evidence-based events after business data has been successfully saved. This module can be implemented as a standalone backend service, or it can be implemented using a business event bus, database change subscription, or message production service.
[0091] The standardized fingerprint generation module is used to locate business data based on evidence storage events, perform deterministic standardized processing on structured business data, read the binary content of unstructured data according to a fixed reading sequence, and calculate the corresponding hash fingerprint.
[0092] The asynchronous evidence storage module is responsible for consuming asynchronous tasks and submitting the generated evidence storage data packets to the consortium blockchain or other permissioned blockchain networks.
[0093] The status inspection module is used to perform joint inspections on local business records, evidence storage task records, and on-chain evidence storage records according to a predetermined cycle.
[0094] The difference recovery module selects different recovery actions based on the anomaly type output by the status inspection module.
[0095] During audits, supervision, or dispute resolution, the evidence verification module obtains the corresponding business data and on-chain evidence records based on the unique business identifier, re-performs normalization and hash calculation on the business data, and compares it with the on-chain hash fingerprint.
[0096] The following combination Figure 1 Further explanation is provided in S1-S6.
[0097] 1. S1: Business data persistence, event generation, and asynchronous decoupling
[0098] like Figure 1 As shown, in step S1, after the business data is persisted locally, a certificate event is generated with the unique business identifier, the certificate event is written to the asynchronous task queue and the status of the corresponding certificate task is recorded, so that the business processing flow ends after the certificate event is written.
[0099] For example, after the procurement personnel complete the contract signing, the business system first saves the structured data such as the basic contract information, contract amount, signing time, and supplier information, as well as the contract PDF file, to the local business database and file storage server.
[0100] Once a business transaction has been successfully committed, the system generates a unique business identifier, such as CGHT-2026-000125.
[0101] If multiple historical versions of the same contract exist, a data version identifier can be further generated, such as V1. This then forms a corresponding evidence storage event. An evidence storage event can at least include: a unique business identifier; a business event type; a data version identifier; the location information of the data to be stored; and the event generation time. For example, the business event type could be "Contract signing completed".
[0102] To avoid multiple logically different evidence storage tasks arising from message retries for the same version, an idempotent evidence storage identifier can be further formed based on the unique business identifier, business event type, and data version identifier.
[0103] Once the notarization event is written to the message queue, the current business thread can immediately return a successful contract signing message to the user without waiting for blockchain consensus and block generation. Therefore, even if a transaction on a consortium blockchain takes several seconds from submission to final confirmation, it will not increase the synchronization response time of the contract signing business interface.
[0104] To prevent changes in business content during the actual execution of asynchronous tasks, this embodiment can also record the snapshot location information of the data to be stored when the business data is persisted locally. For example, for business systems that use historical version tables to store data, the historical record number can be recorded; for event tracing systems, the event sequence number can be recorded; and for systems with database snapshot mechanisms, the corresponding snapshot ID can be recorded.
[0105] Subsequent background tasks do not simply read the latest record corresponding to the unique identifier of the business, but rather read the business records under the corresponding data version for that unique identifier. Therefore, even if the contract is subsequently modified, the original V1 evidence storage task will still correspond to the V1 content and will not incorrectly calculate the hash for the V2 content.
[0106] 2. S2: Business data normalization and deterministic hash fingerprint generation
[0107] In step S2, the asynchronous task consumer reads the evidence storage event and obtains the corresponding business data to be stored based on the unique business identifier, data version identifier, and location information of the data to be stored.
[0108] For unstructured files, this embodiment reads the complete binary data of the file in a fixed reading order and calculates the file hash fingerprint according to a predetermined hash algorithm.
[0109] For structured business data, the first step is to standardize it.
[0110] For example, the original contract data might include: Contract Number; Contract Amount; Supplier; Signing Date; Payment Method. The actual order of the fields may differ when different business interfaces generate JSON data.
[0111] This embodiment does not directly calculate the hash of the original JSON text. Instead, it first determines the field set and field order according to normalization rules. For example, the normalization rules stipulate that the field order is: Contract Number → Supplier → Contract Amount → Signing Date → Payment Method. Then, a unified representation method is adopted for null values, such as using a pre-defined null value marker. All strings then use the same character encoding, such as UTF-8. Finally, a uniquely determined data sequence is formed according to fixed connection rules. As long as the actual content of the business fields remains unchanged, the final hashed data sequence remains consistent regardless of changes in the original database query order or the JSON output order.
[0112] Furthermore, this embodiment configures a normalization rule identifier for each set of normalization rules. For example: NR-01. If the system adds new fields or adjusts null value rules later, a new one is formed: NR-02. The evidence storage data package is associated with the currently used normalization rule identifier when it is formed. In this way, when verifying a historical evidence storage record formed using NR-01 five years later, the system will still use NR-01 to restore the normalized input at that time, instead of directly using the current NR-05 version of the system. This solves the problem that the historical hash cannot be reproduced due to the business data remaining unchanged but the normalization program being upgraded. After normalization is completed, a hash fingerprint is calculated based on the determined data sequence. Then, the hash fingerprint is associated with the business unique identifier, data version identifier, normalization rule identifier, evidence storage idempotency identifier, and necessary operation metadata to form an evidence storage data package. Operation metadata may include operation subject identifier, operation time, digital signature, project identifier, unit identifier, and device information. The business plaintext data is still stored locally and is not uploaded to the blockchain with the evidence storage data package.
[0113] 3. S3: Asynchronous submission of evidence storage data packets and establishment of on-chain and off-chain relationships.
[0114] In step S3, the asynchronous evidence storage module retrieves the tasks to be executed from the task queue and submits the corresponding evidence storage data package to the blockchain network. After the blockchain network completes transaction verification, node consensus, and block writing, it returns the corresponding on-chain transaction identifier. The on-chain transaction identifier can be, for example, a transaction hash, a transaction ID, or other identifier that can uniquely identify an on-chain transaction. The local system establishes the following correspondences: unique business identifier; data version identifier; evidence storage idempotent identifier; and on-chain transaction identifiers. For example: unique business identifier: CGHT-2026-000125; data version: V1; on-chain transaction ID: TX-8A75… Simultaneously, the corresponding task status is updated to successful submission. If the blockchain interface directly returns failure, the task status is updated to failed submission and saved to a persistent cache or failure compensation queue.
[0115] For example, after the backend service submits a transaction to the blockchain, the chain node completes consensus and writes it into the block, but the network disconnects during the process of returning the transaction ID. At this time: On-chain fact: Success; Local task status: Failure or processing.
[0116] 4. S4: Three-state joint inspection and anomaly occurrence stage identification
[0117] A typical failure retry mechanism usually starts processing from the list of failed tasks. Its implicit premise is that the corresponding evidence storage task has already been created. However, the asynchronous evidence storage chain actually involves multiple independent processing stages. For example: after the business database submission is successful but before the evidence storage event is written to the message queue, an exception occurs in the backend service; the evidence storage event already exists, but an exception occurs during consumer processing; the transaction has been written to the blockchain, but the successful result has not been written back locally. Although these three exceptions may ultimately manifest as the business system not obtaining a complete evidence storage state, the recovery methods are completely different.
[0118] Therefore, this invention does not use a single task status as the basis for anomaly judgment, but instead uses the same unique business identifier and data version identifier as the correlation benchmark, simultaneously reading three independent status facts. The first status fact is the local business record. If the local business record exists, it indicates that the business operation itself has been successfully formed. The second status fact is the evidence storage task record. The evidence storage task record is used to determine whether the business fact has entered the asynchronous trusted evidence storage processing flow. The third status fact is the on-chain evidence storage record. The on-chain evidence storage record represents the final evidence storage fact confirmed by the blockchain network. For each business data version that should be evidenced, the status inspection module forms a group of records to be checked. For example: unique business identifier: CGHT-2026-000125; data version: V1. Subsequently, the following are queried: business record B; task record T; on-chain record C.
[0119] In the first scenario: B exists; T does not exist; C does not exist. This indicates that the business operation has been completed, but the corresponding evidence storage task has not been formed, or an exception occurred before the task record was formed. This invention defines this state as a task-missing exception. The key point is that the system has no failed tasks that can be retried. Therefore, the traditional method of traversing the failure queue and retrying cannot detect or repair this exception.
[0120] In the second scenario: B exists; T exists; T's state is not "submission successful"; C does not exist. This indicates that the evidence storage task has been successfully formed, but the blockchain write has not yet been successfully completed during the execution phase. This invention defines this as a task incomplete exception. This exception differs from the first type because the corresponding data to be stored or the task execution context usually already exists in the task's persistent storage.
[0121] In the third scenario: B exists; T exists; T shows a non-successful state; C exists. This indicates that the corresponding evidence already exists on the blockchain, but the local system still considers the task unsuccessful. This situation typically occurs when the on-chain transaction has succeeded, but the blockchain response returns a failure, a network timeout occurs, or the local database has not completed a success status update. This invention defines it as an exception where the transaction exists on the blockchain but is not confirmed locally. Its core characteristic is that it cannot be resubmitted, because resubmitting may result in duplicate on-chain records for the same business facts.
[0122] Therefore, this invention utilizes the state combination of three independent fact sources to not only determine whether there has been a failure, but also to further determine at which processing stage the failure occurred.
[0123] In other words: business facts are used to confirm the existence of the source business; task facts are used to confirm whether the trusted evidence storage process has been initiated; and on-chain facts are used to confirm whether the trusted evidence storage has been truly completed. Combining these three elements allows for the establishment of a relatively clear reasoning path for the fault phase.
[0124] To further avoid misjudgments between different versions of the same business object, this embodiment performs a three-state joint verification not only based on the unique business identifier, but also combines the data version identifier or the idempotent identifier of the evidence storage. For example, if contract V1 has completed evidence storage, but contract V2 is in a task execution failure state, if only the contract ID is used to check whether a record exists on the chain, it may be wrong to mistakenly regard the evidence storage record of V1 as the successful storage record of V2.
[0125] Therefore, in a preferred embodiment, the following should be used: a unique business identifier + a data version identifier; or: an idempotent notation identifier to locate the corresponding on-chain notarization record. During the inspection process, the hash fingerprint in the on-chain notarization record can be further compared with the hash fingerprint recalculated locally for the corresponding version. If the on-chain record exists, but the on-chain hash is inconsistent with the local corresponding version hash, it cannot be simply concluded that the on-chain process was successful but the local process was not confirmed. In this case, it can be further identified as a content conflict anomaly. Therefore, the state diagnosis mechanism can be further extended from the simple three-state existence judgment to: record existence state judgment; task execution state judgment; and content consistency judgment. The above processing method enables the present invention to distinguish: no task; task exists but not on-chain; task has been on-chain but not known locally; and on-chain record exists but is not the correct content corresponding to the current data version.
[0126] 5. S5: Differentiated recovery based on the stage of anomaly occurrence
[0127] After determining the anomaly type, the differential recovery module does not use a uniform resend process, but instead selects different recovery sources based on the stage at which the anomaly occurred.
[0128] 1) Recovery of task-missing anomalies
[0129] For task-missing anomalies where business records exist but task records do not exist, or on-chain records do not exist, this embodiment cannot recover existing tasks from the task queue or failure cache because there are no valid tasks that can be directly recovered. Therefore, a trusted evidence processing chain needs to be re-established from the business facts. The system first reads the corresponding data to be evidenced based on the unique business identifier and data version identifier. If snapshot location information for the data to be evidenced is set, the data version at the time of the original business event is obtained first based on the snapshot location information. For example: unique business identifier: CGHT-2026-000125; data version: V1; snapshot location ID: SNAP-15372. The system reads V1 data based on the above information, instead of reading the current latest version of the contract, V3. After reading, data normalization is performed according to the normalization rule identifier originally corresponding to the data version. If V1 should have initially used the NR-01 rule, the NR-01 rule is still used to re-form a definite data sequence. Subsequently, the hash fingerprint is recalculated, and the original evidence idempotent identifier is restored based on the unique business identifier, data version, and business event type. If the relevant implementation can deterministically generate an idempotent evidence storage identifier based on the unique business identifier, event type, and version identifier, then the reconstructed task will continue to use the same idempotent identifier as the original logical event. Finally, a new evidence storage task is generated and written to an asynchronous queue. Thus, what is restored is the trusted evidence storage task corresponding to the original business event, rather than creating a new evidence storage fact based on the latest business state.
[0130] 2) Recovery from task incomplete exceptions
[0131] For tasks that are incomplete (e.g., business record exists, task record exists, task status is not successful, no corresponding record exists on the chain), the system already has a valid evidence storage task. Therefore, it is not necessary to reconstruct the entire evidence storage task from the business system. This embodiment prioritizes recovering the corresponding task from the persistent task cache or failure compensation queue. Before recovery, the blockchain can be queried based on the evidence storage idempotency flag. If the query result still confirms that the evidence storage record does not exist on the chain, the original task is restored to the pending state and resubmitted to the blockchain. Therefore, the source of recovery for the second type of exception is: the existing task fact. This is significantly different from the first type of exception, which is reconstructed from "business facts".
[0132] 3) Recovery of anomalies that exist on-chain but are not confirmed locally
[0133] For situations where: the business record exists; the task record shows failure; or the on-chain record already exists, the system cannot directly resubmit. First, it reads the on-chain transaction identifier and on-chain hash fingerprint. Then, based on the data version and normalization rule identifier corresponding to the business data, it re-obtains the local business data and recalculates the local hash according to the original notarization rules. If: the local recalculated hash = the on-chain hash, then it can be confirmed that the notarization record already existing on the chain is the notarization fact that the current business version should form. In this case, the recovery direction of this invention is completely opposite to the traditional retry. The traditional method is usually: local failure state → resend to the chain. This invention adopts: on-chain success fact → reverse repair of the local state. Specifically, the on-chain transaction identifier is rewritten into the local correspondence table of the business unique identifier, data version identifier, and on-chain transaction identifier, and the corresponding notarization task status is updated to submission successful. Then, the subsequent automatic on-chain processing of this task is terminated. For example: local task status: FAILED; on-chain query: TX-8A75 exists; local recalculated hash: H1; on-chain hash: H1. The system then executes: Task status: FAILED → SUCCESS; Transaction ID: TX-8A75 (rewrite). The blockchain submission interface is not called again. This restores consistency between the local state and the on-chain facts without creating duplicate on-chain evidence.
[0134] 4) Content conflict type anomaly
[0135] If a record related to the same business identifier exists on the chain, but: the on-chain hash ≠ the local hash recalculated based on the corresponding business version; then this situation cannot be simply considered a success. In this case, it can be identified as a content conflict anomaly. The system saves: the unique business identifier; the data version identifier; the evidence preservation idempotency identifier; the local hash; the on-chain hash; and the on-chain transaction identifier. It also suspends the current automatic compensation. This is because at this point, at least: there is a business version association error; an on-chain index error; an inconsistent snapshot of the data to be preserved; or other data consistency anomalies. Before determining the true cause, continuing automatic on-chain processing may further amplify the evidence conflict. Therefore, the differentiated recovery logic formed by this invention can be summarized as follows: The task was never formed: reconstruct from the business facts. The task was formed but not completed: recover from the task facts. Success was achieved on the chain but not known locally: reverse repair from the on-chain facts. It exists on the chain but the content is inconsistent: block automatic compensation and retain conflict information. This forms a complete anomaly diagnosis and recovery closed loop.
[0136] 6. S6: Trusted Verification
[0137] In step S6, when auditors, regulators, or business personnel need to verify historical business data, they locate the corresponding local business data and on-chain evidence records based on the unique business identifier and data version identifier.
[0138] For structured business data, the normalized rules used when the original evidence was stored are obtained based on the normalized rule identifier stored in the on-chain or local associated records.
[0139] The data sequence to be hashed is reconstructed using the same set of fields, field order, null value handling method, character encoding method, and concatenation rules. A new local hash fingerprint is calculated. For unstructured files, the complete binary content of the corresponding data version file is reread and the hash is calculated. Then, the recalculated local hash is compared with the hash fingerprint stored on the chain. If they match, it means that the data content being verified is consistent with the data content at the time of original notarization. If they do not match, it means that at least the current data differs from the original notarized data, requiring further auditing.
[0140] It should be noted that the verification in this embodiment does not simply use the latest standardized rules of the system, but prioritizes the standardized rule version corresponding to the original evidence record.
[0141] Therefore, even if the system undergoes multiple upgrades, it can restore the input processing method used in the past, thus improving the stability of long-term evidence verification.
[0142] IV. Examples, Comparative Examples, and Verification of Technical Effects
[0143] 1. Verify the overall design
[0144] This embodiment employs a reproducible software testing environment. The business system, asynchronous task service, and blockchain access service are deployed independently. The business database stores structured business records, the file storage module stores unstructured files such as PDFs, Word documents, and scanned copies, the message queue stores evidence storage events and failure compensation tasks, and the consortium blockchain test network is used to generate on-chain evidence storage records.
[0145] To avoid the impact of hardware performance differences on the verification of technical principles, all test groups used the same server resources, the same business dataset, the same network conditions, and the same blockchain node configuration.
[0146] Unless otherwise specified, each test method is repeated independently 5 times, processing 10,000 business events consecutively each time. The time involved in the test starts from when the business request enters the business service and ends when the business service returns the business operation completion result to the caller, excluding the final confirmation time for asynchronous backend uploading.
[0147] 2. Example 1: The Standardized Asynchronous Trusted Evidence Storage Method of the Present Invention
[0148] This embodiment adopts Figure 1 The processing flow from S1 to S6 is shown.
[0149] 1) S1 business data storage and asynchronous event generation
[0150] For each piece of business data to be notified, the local business database is first persisted. The business system generates a unique business identifier for each business record. For example, the unique business identifier is PO20260800001; the data version identifier is V1; and the business event type is contract signing completion. A corresponding notification idempotent identifier is formed based on the unique business identifier, data version identifier, and business event type. After the business data is persisted locally, a notification event is generated and written to a message queue. Once the message is successfully written to the queue, business processing completion information is returned to the front end without waiting for the blockchain to complete consensus, packaging, and transaction confirmation. For data that needs to support historical version recovery, a snapshot location information of the data to be notified is also saved, allowing the backend consumer to obtain the data version at the time the business event occurred, rather than the latest value at the time of task execution.
[0151] 2) S2 business data normalization and hash calculation
[0152] For structured business data, the set of fields participating in the notarization is determined according to normalization rules. For example, a purchase contract includes: contract number; supplier name; contract amount; contract signing date; and payment method. The normalization rules stipulate a fixed order: contract number → supplier name → contract amount → contract signing date → payment method. Null values are represented uniformly, and characters use a uniform encoding method. This forms a uniquely defined data sequence, and then a hash fingerprint is calculated. For unstructured files such as PDFs, the complete binary data is read according to a fixed reading sequence, and the hash fingerprint is calculated.
[0153] 3) S3 asynchronous on-chain
[0154] The backend consumer retrieves the evidence storage task from the message queue and encapsulates the hash fingerprint, unique business identifier, operating entity identifier, operation time information, and other operation metadata into an evidence storage data package. This data package is then submitted to the consortium blockchain network. After the consortium blockchain successfully forms a transaction, it returns an on-chain transaction identifier. The local system establishes the correspondence between the unique business identifier, data version identifier, evidence storage idempotency identifier, and on-chain transaction identifier, and updates the evidence storage task status to "submitted successfully."
[0155] 4) S4 Three-State Combined Diagnosis
[0156] According to the preset inspection cycle, query the unique identifier and data version corresponding to the same business: local business records; evidence storage task records; and on-chain evidence storage records. Determine the status based on the processing relationship. If: business exists, task does not exist, and not on-chain, it is determined to be a task missing anomaly. If: business exists, task exists but failed, and not on-chain, it is determined to be a task incomplete anomaly. If: business exists, task exists but shows as unsuccessful locally, and is on-chain, it is determined to be an anomaly where it exists on-chain but is not confirmed locally. If the on-chain record exists, but the corresponding on-chain hash is inconsistent with the local hash recalculated based on the original data version, it is further determined to be a content conflict anomaly.
[0157] 5) S5 Differentiation Recovery
[0158] For task-missing anomalies, the original business data is retrieved again based on the unique business identifier, data version identifier, and data snapshot location information, and the notarization task is regenerated. For task-incomplete anomalies, the original task is restored from the task persistent cache or failure compensation queue. For anomalies where the task already exists on-chain but is not confirmed locally, it is not submitted to the chain again. Instead, the on-chain hash and on-chain transaction identifier are read, and the local hash is recalculated according to the original normalization rules. If the two match, the on-chain transaction identifier is written back to the local correspondence, and the notarization task status is restored to successful submission. For content conflict anomalies, on-chain data is not overwritten, nor is automatic compensation continued. Instead, the conflicting data is retained and entered into the anomaly verification path.
[0159] 6) S6 Data Verification
[0160] When an audit is required, the original business data is located based on the unique business identifier and data version identifier, and the data processing rules used during evidence storage are restored according to the corresponding normalization rules. A new, definitive data sequence is formed and its hash is calculated. When the recalculated result matches the on-chain hash, the business data is deemed consistent with the data stored during evidence storage.
[0161] 3. Comparative Example 1: Synchronous Blockchain Evidence Storage Method
[0162] Comparative Example 1 does not use asynchronous message queues.
[0163] After the business data is successfully saved, the current business thread directly executes data reading, hash calculation, blockchain submission, and waits for the blockchain network to return the transaction result. Only after the on-chain transaction is successful will the business thread return a success message to the calling client. This method can achieve basic trusted evidence storage, but the blockchain transaction confirmation time is directly added to the business interface response time.
[0164] 4. Comparative Example 2: Normal Asynchronous Failure Retry Method
[0165] Comparative Example 2 uses a conventional message queue for asynchronous on-chain submission. After business data is persisted, a message is generated and submitted to the blockchain by a backend consumer. When the on-chain interface explicitly returns failure, the failed task is added back to the failure queue and resubmitted. However, Comparative Example 2 does not employ a three-state joint diagnostic mechanism involving local business records, evidence storage task records, and on-chain evidence storage records. Its recovery targets primarily come from already generated failed tasks. Therefore: for cases where business data has been stored but the task was never successfully generated, there are no failed tasks available for retry; for cases where the blockchain has succeeded but the local system has not correctly received a success receipt, the local task may still be judged as failed and resubmitted; and for cases where records exist on the blockchain but their content corresponds to different business versions, no further conflict determination is performed based on hash content.
[0166] 5. Comparative Example 3: Direct Serialization and Hash Method for Structured Business Data
[0167] Comparative Example 3 does not implement the unified field order, unified null value representation, and unified character encoding of this invention. The test program directly performs hash calculations on the structured text output by the business interface. For data with the same logical content but different field orders, their underlying text byte sequences are different, thus potentially resulting in different hash values.
[0168] 6. Experiment 1: Verification of Service Response Time
[0169] 1) Testing Method
[0170] The following methods were used: Comparative Example 1, synchronous on-chain method; Comparative Example 2, ordinary asynchronous method; and Example 1, the method of the present invention, to process the same 10,000 business events. Each method was repeated independently 5 times. The average business response time and the 95th percentile response time (P95) of all business requests were recorded in each test. Although the method of the present invention requires additional recording of task status, data version, and other information in the business thread, and therefore may have a small amount of additional processing overhead compared to a simple ordinary asynchronous queue, the expected response time is still significantly lower than that of the synchronous on-chain method because it also does not wait for blockchain consensus.
[0171] 2) Test Results
[0172] Table 1 Average Response Time for Different Evidence Preservation Methods
[0173]
[0174] The data in Table 1 has been recalculated based on 5 independent tests. Using the method of this invention, the average business response time is 71.2 ms. Compared to the 1321.2 ms of the synchronous on-chain method, the average response time is reduced.
[0175] Table 2. Response Time of P95 Services for Different Evidence Preservation Methods
[0176]
[0177] As shown in Tables 1 and 2, because the business thread of this invention can be terminated after the evidence storage event enters asynchronous processing, its business interface response time is basically unaffected by the blockchain consensus time. Although this invention incurs approximately 5 ms of additional overhead compared to the simplest ordinary asynchronous method to increase data versioning, evidence storage task status, and subsequent inspection and recovery capabilities, it still maintains a significantly lower response time than synchronous blockchain evidence storage. Figure 2 As can be clearly seen, this invention increases the ability to manage abnormal consistency without reintroducing the blockchain confirmation process into the business synchronization link, thus maintaining the low business blocking characteristics of asynchronous processing.
[0178] 7. Experiment 2: Verification of the stability of hashing structured business data
[0179] 1) Test data construction
[0180] Select 1000 structured procurement business records with distinct logical content. Each record contains 5 main fields. For each record, construct 6 data sequences with identical logical meaning but different presentation formats, including: standard field order format; random field order format; format with varying empty field positions; format with varying null value representation; format with different interface field output order; and format with interface output before character encoding processing. This results in 6000 structured data representations to be tested. Each group of 6 data representations represents the same logical business content.
[0181] 2) Comparative Example 3 Test
[0182] Comparative Example 3 directly hashes the original text sequence. The first standard form in each group is used as the reference hash. If the hashes of the other five texts differ due to differences in field arrangement or null value representation, it is determined that the equivalent data hashes are not consistent. In the test results, only 1000 standard reference forms have the same reference hash as their own, while the remaining 5000 have different hashes due to changes in the underlying byte sequence. Therefore, the number of equivalent representation hashes that are consistent in Comparative Example 3 is 16.67%.
[0183] 3) Testing the method of this invention
[0184] Example 1 first parses the business fields, then follows the normalization rules: fixed set of fields for evidence storage; fixed field order; unified null values; unified character encoding; and fixed field concatenation method. Therefore, all six logically equivalent data sets in the same group form the same definite data sequence. After testing 6000 data sets, all 6000 data sets are consistent with the reference hash of their respective logical business records.
[0185] Table 3. Validation results of normalized hashing of structured data
[0186]
[0187] It should be noted that this experiment verifies the stability of the representation of logically equivalent business data, and is not intended to prove that hash algorithms do not have collisions.
[0188] The technical advantage of this invention lies in ensuring that data with the same logical content but different original field arrangements or formats are first converted into the same defined data sequence, thereby avoiding meaningless hash changes caused by differences in input bytes. Figure 4 This can intuitively illustrate the role of the standardization process in S2 of the present invention in improving the stability of long-term evidence verification.
[0189] 8. Experiment 3: Verification of Asynchronous Evidence Storage Anomaly Recovery Capability
[0190] 1) Exception Injection Scheme
[0191] To verify the S4-S5 technical solution, the test system was artificially configured with four types of anomalies. Each test processed 10,000 normal business data entries and injected the following anomalies: 15 missing task anomalies; 20 incomplete task anomalies; 20 anomalies existing on the chain but not confirmed locally; and 10 content conflict anomalies. A total of 65 anomalies were injected in each test. The test was repeated independently 5 times, therefore the cumulative number of anomalies is: Missing task anomalies: 15 × 5 = 75; Incomplete task anomalies: 20 × 5 = 100; Existing on the chain but not confirmed locally: 20 × 5 = 100; Content conflict anomalies: 10 × 5 = 50.
[0192] 2) Various anomaly formation methods
[0193] Task missing anomalies are simulated by interrupting the production process after business data has been successfully written but before the notarization task record is formed. At this point, the state is: business record exists; task record does not exist; on-chain record does not exist. Task incomplete anomalies are simulated by blocking the blockchain submission interface after the task has been successfully formed. At this point, the state is: business record exists; task record exists but its status is unsuccessful; on-chain record does not exist. On-chain existing but locally unconfirmed anomalies are simulated by allowing transactions to be successfully written to the blockchain but blocking the writing of transaction success receipts to the local task status. At this point, the state is: business record exists; local task status is unsuccessful; on-chain record already exists. Content conflict anomalies are simulated by setting the same query identifier for an on-chain record, but making its on-chain hash different from the recalculated hash of the current version to be verified.
[0194] 3) Results of the normal asynchronous retry method
[0195] Comparative Example 2 primarily relies on the failed task queue. For the 100 task incomplete anomalies, since the corresponding tasks already exist and are in a failed state, they can be detected and retried by the normal failure queue. For the 75 task missing anomalies, since the tasks were never formed, no failed tasks entered the failure queue, so normal failure retries cannot directly detect them. For the 100 anomalies that exist on the chain but are not locally confirmed, the local task status is still failed, and the normal retry mechanism may resubmit, resulting in 100 unnecessary duplicate submissions. For the 50 content conflict anomalies, normal existence checks cannot determine whether existing on-chain records are consistent with the content of the current business version, therefore, they cannot complete the conflict classification in the sense of this invention.
[0196] 4) Results of the method of the present invention
[0197] After adopting the three-state joint diagnosis: 75 task missing anomalies were identified through a combination of business existence, task absence, and on-chain absence, and the evidence storage tasks were regenerated from the original business data version; 100 task incomplete anomalies were identified and resumed from the persistent tasks; 100 anomalies that existed on-chain but were not confirmed locally were all found to have evidence storage records through on-chain queries. After recalculating the local hash and confirming that it was consistent with the on-chain hash, the on-chain transaction identifier was written back to the local machine, and the task status was restored to success without being submitted to the blockchain again; 50 content conflict anomalies entered the content conflict handling path because the on-chain hash and the locally recalculated hash were different, and automatic compensation was suspended.
[0198] Table 4 Results of handling four types of anomalies
[0199]
[0200] The 100% mentioned above indicates that in the four preset and identifiable fault injection models, the state conditions all meet the judgment rules set in the claims, and does not mean that any actual production environment fault can achieve a 100% recovery rate.
[0201] Table 5 Comparison of risks between duplicate submissions and silent omissions
[0202]
[0203] Depend on Figure 3 As can be seen, ordinary asynchronous failure retry can mainly handle tasks that have been formed and have clearly failed. However, this invention can further identify silent omissions that occurred before the task was formed and anomalies that were actually successful on the chain but not confirmed in the local state by jointly judging the three states of business records, task records and on-chain records.
[0204] 9. Experiment 4: Verification of Data Version Misalignment Recovery
[0205] To further verify the role of data version identifiers and snapshot location information for data to be stored, two consecutive versions, V1 and V2, were generated from 1000 business objects. The test process was set as follows: first, V1 business data was generated; V1 storage event was generated; before the background task was actually executed, the business object was modified to V2; then the asynchronous storage consumer was started.
[0206] 1) Comparison without snapshot positioning
[0207] If the asynchronous consumer only queries the latest data based on the unique business identifier, then all 1000 V1 events may read V2 content. Under this setting, the number of correct historical versions corresponding to V1 business events is 0.
[0208] 2) Embodiments of the present invention
[0209] The evidence storage event of this invention simultaneously saves the data version identifier V1 and the snapshot location information corresponding to V1. Therefore, even if the latest state in the current business database is already V2, the backend consumer can still obtain the original V1 data based on the V1 snapshot location information.
[0210] V1 data was obtained for all 1000 V1 evidence events.
[0211] Table 6. Version correspondence results when business data is subsequently modified during asynchronous execution.
[0212]
[0213] This experiment further demonstrates that the data version identifier and snapshot location information in this invention are not only part of general data version management, but are directly used to solve the problem of misaligned data to be stored caused by the difference between the occurrence time of business events and the actual execution time of asynchronous tasks.
[0214] 10) Experiment 5: Historical verification under the condition of changes in the version of standardized rules
[0215] To verify the effectiveness of standardized rule identifiers in long-term verification, two standardized rules, NR-01 and NR-02, were established. NR-01 uses five business fields. After the system upgrade, NR-02 will add a new business field or adjust the way null values are represented. 1000 simulated historical evidence records generated according to NR-01 were selected from the historical evidence repository.
[0216] Comparative Example
[0217] During verification, historical data is recalculated directly using the system's current NR-02 rules. Because the rules have changed, some or all records produce results different from the historical on-chain hashes. In simulation tests, all 1000 records failed to match the original on-chain hashes due to the changed input sequence.
[0218] Each historical on-chain record is associated with its normalized rule identifier NR-01. During verification, the original field set, null value rules, and encoding rules are restored based on the NR-01. All 1000 historical records have been re-generated with fingerprints consistent with the historical hashes on the chain.
[0219] Table 7 Historical verification results after the standardization rule upgrade
[0220]
[0221] The foregoing description of embodiments of the present invention, through which those skilled in the art are able to implement or use the present invention, will be readily apparent to those skilled in the art. Various modifications to these embodiments will be readily apparent to those skilled in the art. The general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novelty disclosed herein.
Claims
1. A standardized asynchronous trusted evidence storage method for business data, characterized in that, Includes the following steps: S1. After the business data is persisted locally, a unique business identifier and a data version identifier corresponding to the business data are generated. A storage event is generated using the unique business identifier and the data version identifier. The storage event is written into an asynchronous task queue and the status of the corresponding storage task is recorded. The business processing flow ends after the storage event is written. S2. Asynchronously acquire the corresponding business data. For structured business data, form a definite data sequence according to the predetermined field order, null value handling rules and character encoding rules. For unstructured business data, acquire the data content according to a fixed reading sequence, calculate the hash fingerprint and encapsulate it with the unique business identifier and operation metadata into a storage data package. S3. Asynchronously submit the evidence storage data packet to the blockchain network, update the evidence storage task status according to the submission result, and establish a local correspondence between the business unique identifier, data version identifier and on-chain transaction identifier after obtaining the on-chain transaction identifier. S4. According to the preset inspection cycle, cross-check the local business records, evidence storage task records and on-chain evidence storage records based on the business unique identifier and data version identifier. Identify task missing anomalies, task incomplete anomalies or anomalies that exist on the chain but are not confirmed locally based on the existence status of the three and the status of the evidence storage task. When a local business record exists, but the corresponding evidence storage task record does not exist and the corresponding on-chain evidence storage record does not exist, it is determined to be a task missing anomaly. When the local business record and the corresponding evidence storage task record exist, the evidence storage task status is not a successful submission status and the corresponding on-chain evidence storage record does not exist, it is determined to be an incomplete task exception. When local business records and corresponding evidence storage task records exist, and the evidence storage task status is not a successful submission status but the corresponding on-chain evidence storage record exists, it is determined to be an exception where the record already exists on the chain but is not confirmed locally. S5. For task missing exceptions, regenerate the evidence storage task based on the corresponding business data; for task incomplete exceptions, restore the corresponding evidence storage task; for exceptions that exist on the chain but are not confirmed locally, stop resubmitting and complete the local correspondence based on the evidence storage record on the chain; before resubmitting the first two types of exceptions, query the corresponding evidence storage record on the chain, and if the record already exists on the chain, convert it to the exception that exists on the chain but is not confirmed locally. S6. During verification, determine the data version identifier corresponding to the business data to be verified, recalculate the hash fingerprint of the business data to be verified according to the normalized processing rules corresponding to the data version in step S2, and compare it with the on-chain hash fingerprint obtained based on the unique business identifier and the data version identifier to determine the consistency status of the business data.
2. The standardized asynchronous trusted evidence storage method for business data according to claim 1, characterized in that, In step S1, when the business data is persisted locally, a data version identifier associated with the business unique identifier is generated, and an idempotent identifier for evidence storage is generated based on the business unique identifier, the business event type, and the data version identifier. The same business unique identifier corresponds to different idempotent identifiers for evidence storage under different data versions, and duplicate evidence storage events of the same data version correspond to the same idempotent identifier for evidence storage. The idempotent identifier for evidence storage is transmitted together with the evidence storage task record and the evidence storage data packet.
3. The standardized asynchronous trusted evidence storage method for business data according to claim 1, characterized in that, In step S2, a normalization rule identifier is set for the normalization processing rule. The normalization rule identifier is used to indicate the set of fields participating in the evidence storage, the field order, the null value representation method, and the character encoding method. When generating the evidence storage data packet, the normalization rule identifier is associated with the corresponding hash fingerprint, so that during verification, the same normalization processing rule as that used during evidence storage is called according to the normalization rule identifier corresponding to the evidence storage record on the chain to re-form the data sequence to be verified.
4. The standardized asynchronous trusted evidence storage method for business data according to claim 3, characterized in that, In step S4, a record group to be verified is formed based on the same business unique identifier and data version identifier. The record group to be verified includes local business records, evidence storage task records and on-chain evidence storage records. The exception type is then associated with the business unique identifier, data version identifier and evidence storage idempotency identifier.
5. The standardized asynchronous trusted evidence storage method for business data according to claim 4, characterized in that, In step S5: For task-missing anomalies, locate the corresponding data snapshot to be stored based on the unique business identifier and data version identifier, and regenerate the storage task that is consistent with the original storage idempotent identifier. For task incomplete exceptions, recover the existing evidence-saving task associated with the corresponding evidence-saving idempotency flag from the persistent cache or failure compensation queue; For anomalies that exist on the chain but are not confirmed locally, the corresponding on-chain transaction identifier and on-chain hash fingerprint are read, and the hash fingerprint of the corresponding local business data is recalculated according to the normalized rule identifier associated with the on-chain evidence storage record. When the two are consistent, the on-chain transaction identifier is written into the local correspondence and the evidence storage task status is updated to the submission success status, without submitting the evidence storage data packet to the blockchain network again.
6. The standardized asynchronous trusted evidence storage method for business data according to claim 5, characterized in that, For exceptions involving missing or incomplete tasks, query the blockchain network using the idempotent notation identifier before resubmitting the notation task: The commit is executed if no corresponding on-chain evidence record exists. When there is a corresponding on-chain evidence record and the on-chain hash fingerprint is consistent with the local hash fingerprint recalculated according to the corresponding data version and normalization rules, the submission is stopped and the local state is repaired according to the type of exception that exists on the chain but is not confirmed locally. If a corresponding on-chain evidence record exists but the on-chain hash fingerprint is inconsistent with the recalculated local hash fingerprint, the original on-chain evidence record will not be overwritten and will be recorded as a content conflict type exception.
7. The standardized asynchronous trusted evidence storage method for business data according to claim 1, characterized in that, The operation metadata includes at least one of the following: operation subject identifier, operation time information, digital signature information, project identifier, unit identifier, and equipment traceability information; the hash calculation of both structured and unstructured business data is completed locally, and the blockchain network stores the hash fingerprint and corresponding operation metadata but does not store the corresponding plaintext business data.
8. A standardized asynchronous trusted evidence storage system for business data, characterized in that, This system is used to implement the method described in any one of claims 1-7, comprising: an event and task management module, used to generate a notarization event with a unique business identifier after the business data has been locally persisted, write the notarization event into an asynchronous task queue and record the corresponding notarization task status; a standardized fingerprint generation module, used to form a definite data sequence for structured business data according to a predetermined field order, null value handling rules and character encoding rules, to obtain data content for unstructured business data according to a fixed reading sequence, and to calculate the corresponding hash fingerprint; and an asynchronous notarization module, used to submit a notarization data packet including a hash fingerprint, a unique business identifier and operation metadata to the blockchain network, update the notarization task status according to the submission result, and establish... The system includes: a local mapping relationship between the unique business identifier and the on-chain transaction identifier; a status inspection module, which cross-checks local business records, evidence storage task records, and on-chain evidence storage records based on the unique business identifier, and identifies task-missing anomalies, task-incomplete anomalies, or anomalies that exist on-chain but are not confirmed locally based on the existence status of the three and the status of the evidence storage task; a difference recovery module, which performs tasks to regenerate evidence storage tasks, restore existing evidence storage tasks, or complete the local mapping relationship based on the anomaly type; and an evidence verification module, which recalculates the hash fingerprint of the business data to be verified according to the same normalized processing rules as the normalized fingerprint generation module, and compares it with the corresponding on-chain hash fingerprint.
9. The standardized asynchronous trusted evidence storage system for business data according to claim 8, characterized in that, The event and task management module is also used to generate data version identifiers and evidence storage idempotency identifiers; the status inspection module is used to form a checklist group including local business records, evidence storage task records and on-chain evidence storage records based on the unique business identifier and data version identifier; the difference recovery module includes a task reconstruction unit, a task recovery unit and a local status repair unit, which are respectively used to regenerate evidence storage tasks for task missing anomalies, restore existing evidence storage tasks for task incomplete anomalies, and complete the local correspondence by verifying the consistency between on-chain hash fingerprints and locally recalculated hash fingerprints for anomalies that exist on-chain but are not confirmed locally.
10. A computer program product, characterized in that, The method includes a computer program that, when executed by a processor, causes the computer to perform the standardized asynchronous trusted evidence storage method for business data as described in any one of claims 1-7.
Citation Information
Patent Citations
A block chain-based data storage method
CN109766724A
Micro-service method and device based on block chain, and medium
CN113127499A
On-chain and off-chain data similarities and differences positioning system and method based on block chain
CN122112131A
Grain quality detection data traceability management method and system based on block chain
CN122114957A
