A data consistency processing method and device, a terminal and a storage medium

By recording business data on-chain requests on the business side and using flag adjustments, the server pressure and synchronization lag problems caused by data consistency processing in blockchain business are solved, and timely synchronization and consistency of business data and blockchain data are achieved.

CN115098521BActive Publication Date: 2025-10-10HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210733917.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2025-10-10
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

In existing blockchain businesses, data consistency processing increases the pressure on the servers of business parties and blockchain services, and there is a lag in data synchronization.

Method used

By forming record information of business data chain-up requests on the business side and adjusting the flag value, when abnormalities in writing business data to be chained into the blockchain are detected, the target data is searched from the blockchain to ensure the consistency of business data and blockchain data, reduce server pressure and improve synchronization timeliness.

Benefits of technology

It achieves timely synchronization of business data and blockchain data under abnormal circumstances, reduces the service pressure on business parties and blockchain servers, and ensures data consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098521B_ABST
    Figure CN115098521B_ABST
Patent Text Reader

Abstract

The application is suitable for the field of blockchain technology, and provides a data consistency processing method and device, a terminal and a storage medium, wherein the method comprises: obtaining a business data on-chain request, extracting a target data on-chain request record with a first value of a flag bit from a system database when it is detected that writing the to-be-on-chained business data into the blockchain is abnormal; finding a target data matching the target data on-chain request record from the blockchain; based on the target data, when it is determined that the business data in the system database and the on-chained data in the blockchain have consistency, setting the flag bit corresponding to the target data on-chain request record to a second value. The scheme can reduce the service pressure of the business party and the blockchain server, and at the same time ensure the timeliness of data synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of blockchain technology, and in particular relates to a data consistency processing method, device, terminal and storage medium. Background Art

[0002] In blockchain businesses, uploading data to the blockchain requires invoking third-party contract services. When a business party invokes a blockchain smart contract, if a service restart or network congestion occurs, the completion status of the on-chain contract execution cannot be obtained in a timely manner, resulting in a lack of consistency between the business party's data and the blockchain data.

[0003] The existing processing method is to pull the full amount of data, that is, at a certain interval, the ledger data and business data are fully compared and updated through the interface provided by the contract to ensure that the business party's data remains consistent with the blockchain data. The above process will cause data processing performance to decrease as the amount of data increases, and the need to pull the full amount of data regularly will increase the pressure on the servers of the business party and blockchain services, and will be greatly affected by network volatility.

[0004] Existing processing methods also involve actively pulling data when users need to query data. This means that when users query or operate on data, they first retrieve the ledger data from the blockchain, ensuring that the business data is consistent with the blockchain data. However, this method has a certain lag in maintaining data consistency, which brings inconvenience to users' data operations. Summary of the Invention

[0005] The embodiments of the present application provide a data consistency processing method, device, terminal, and storage medium to address the problem that, when maintaining data consistency, the existing technology increases the server pressure of the business party and the blockchain service and causes data synchronization lag.

[0006] A first aspect of an embodiment of the present application provides a data consistency processing method, including:

[0007] Obtain a business data on-chain request, which is used to instruct the business data to be on-chain to be written to the blockchain;

[0008] When an abnormality is detected in writing the business data to be uploaded to the blockchain, a target data upload request record with a flag bit set to a first value is extracted from a system database; the system database stores business data, a data upload request record corresponding to the business data upload request, and a flag bit for indicating a processing status of the business data upload request;

[0009] Searching the blockchain for target data that matches the target data upload request record;

[0010] Based on the target data, when it is determined that the business data in the system database is consistent with the on-chain data in the blockchain, the flag position corresponding to the target data on-chain request record is set to the second value.

[0011] A second aspect of an embodiment of the present application provides a data consistency processing device, including:

[0012] An acquisition module is used to obtain a business data on-chain request, where the business data on-chain request is used to instruct the business data to be on-chain to be written to the blockchain;

[0013] an extraction module configured to extract, from a system database, a target data on-chain request record with a flag bit set to a first value upon detecting an abnormality in writing the business data to be on-chain to the blockchain; the system database storing business data, a data on-chain request record corresponding to the business data on-chain request, and a flag bit indicating a processing status of the business data on-chain request;

[0014] A search module, configured to search the blockchain for target data that matches the target data upload request record;

[0015] A status value setting module is used to set the flag position corresponding to the target data on-chain request record to a second value when it is determined that the business data in the system database is consistent with the on-chain data in the blockchain based on the target data.

[0016] A third aspect of an embodiment of the present application provides a terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the computer program.

[0017] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0018] A fifth aspect of the present application provides a computer program product, which, when executed on a terminal, enables the terminal to execute the steps of the method described in the first aspect.

[0019] As can be seen from the above, in an embodiment of the present application, by forming a record information of the business data on-chain request at the business end and adjusting the value of the flag bit, the processing status of the business data on-chain request is marked, so that when an abnormality is detected in writing the business data to be on-chain to the blockchain, based on the record information of the business data on-chain request and the corresponding flag bit, the target data that matches the target data on-chain request record is searched from the blockchain, and then the consistency between the business data in the business end and the data in the blockchain is determined, thereby reducing the service pressure of the business party and the blockchain server, and ensuring the timeliness of data synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0021] Figure 1 This is a process of a data consistency processing method provided by the embodiment of the present application Figure 1 ;

[0022] Figure 2 This is a process of a data consistency processing method provided by the embodiment of the present application Figure 2 ;

[0023] Figure 3 This is a structural diagram of a data consistency processing device provided in an embodiment of the present application;

[0024] Figure 4 This is a structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.

[0026] It will be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0027] It should also be understood that the terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0028] It should be further understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0029] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0030] In specific implementations, the terminals described in the embodiments of the present application include, but are not limited to, other portable devices such as mobile phones, laptop computers, or tablet computers with touch-sensitive surfaces (e.g., touch screen displays and / or touch pads). It should also be understood that in some embodiments, the device is not a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., touch screen displays and / or touch pads).

[0031] In the following discussion, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and / or joystick.

[0032] The terminal supports various applications, such as one or more of the following: a drawing application, a presentation application, a word processing application, a website creation application, a disk burning application, a spreadsheet application, a game application, a phone application, a video conferencing application, an email application, an instant messaging application, a workout support application, a photo management application, a digital camera application, a digital video camera application, a web browsing application, a digital music player application, and / or a digital video player application.

[0033] Various applications that can be executed on the terminal can use at least one common physical user interface device, such as a touch-sensitive surface. One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal can be adjusted and / or changed between applications and / or within a corresponding application. In this way, the common physical architecture of the terminal (e.g., the touch-sensitive surface) can support a variety of applications with user interfaces that are intuitive and transparent to the user.

[0034] It should be understood that the size of the serial numbers of each step in this embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of this application.

[0035] In order to illustrate the technical solution described in this application, specific embodiments are provided below.

[0036] See also Figure 1 , Figure 1 This is a process of a data consistency processing method provided by the embodiment of the present application Figure 1 .like Figure 1 As shown, a data consistency processing method includes the following steps:

[0037] Step 101: Obtain a request to upload business data to the blockchain.

[0038] The business data on-chain request is used to instruct the business data to be on-chain to be written to the blockchain.

[0039] In the embodiment of the present application, the execution subject of the data consistency processing method is a business terminal. The business terminal is, for example, a personal computer equipped with a business system, a user's mobile phone, etc. The business system is, for example, a transaction system, a transfer system, etc.

[0040] Correspondingly, in step 101, the business data is, for example, transaction data, transfer data, etc., and more specifically includes account information of both parties to the transaction, transaction amount, account information of both parties to the transfer, transfer amount, and other information.

[0041] Step 102: When an abnormality is detected in writing the business data to be uploaded to the blockchain, a target data upload request record with a flag bit of the first value is extracted from the system database.

[0042] Among them, the system database stores business data, a data uplink request record corresponding to the business data uplink request, and a flag bit for indicating the processing status of the business data uplink request.

[0043] The business side needs to store business data, and this business data needs to be consistent with the business data stored on the blockchain.

[0044] Specifically, when business data is generated in the business end, it is necessary to first write the business data to be uploaded to the blockchain based on the corresponding triggered business data upload request. If the business data to be uploaded is successfully written to the blockchain, the business end obtains the feedback information of the blockchain and parses the feedback information to obtain the data parameters corresponding to the data to be uploaded. Based on these data parameters, data synchronization is performed on the business end. Specifically, the data parameters corresponding to the data to be uploaded need to be synchronized to the business data in the system database to keep the business end data synchronized with the on-chain data.

[0045] The data on-chain request record stored in the system database is generated corresponding to each business data on-chain request. Different data on-chain request records form a business data on-chain request record table in the system database.

[0046] The data upload request record may include request information such as the request time and request identifier corresponding to each service data upload request. Each data upload request record corresponds to a flag bit, and the initial value of the flag bit is the first value.

[0047] The system database is also provided with a flag bit for indicating the processing status of the business data on-chain request. Different values ​​of the flag bit can indicate whether the business data on-chain request is processed normally on the data chain. Here, when the on-chain result feedback information sent by the data chain based on the business data on-chain request is received normally, it can be considered that the business data on-chain request is processed normally on the data chain (the flag bit will be set to the second value at this time), and the on-chain result feedback information can be a success or failure on the chain. When the on-chain result feedback information sent by the data chain based on the business data on-chain request is not received, it can be considered that the business data on-chain request is processed abnormally on the data chain (that is, it is determined that an abnormality occurs when the business data to be on-chain is written to the blockchain, and the value of the flag bit is still the first value at this time).

[0048] Among them, the failure to receive the on-chain result feedback information sent by the data link based on the business data on-chain request may be due to a service restart or network congestion, resulting in the failure to receive the on-chain result feedback information sent by the data link based on the business data on-chain request within the set time period.

[0049] Therefore, when an abnormality is detected in writing the business data to be uploaded to the blockchain, it is necessary to extract the target data upload request record with the flag bit as the first value from the system database to determine the business data upload request that has not been processed normally based on the business data upload request record table.

[0050] Step 103: Search the blockchain for target data that matches the target data on-chain request record.

[0051] When an anomaly is detected in writing the business data to be uploaded to the blockchain, and the target data upload request record corresponding to the business data upload request that has not been processed normally is determined from the system database of the business end, it is necessary to pull the target data that matches the target data upload request record from the blockchain.

[0052] In one embodiment, the target data on-chain request record includes the request time of the business data on-chain request.

[0053] Correspondingly, searching the blockchain for target data that matches the target data upload request record includes:

[0054] Based on the target data on-chain request record, the on-chain data within a set time range from the request time is extracted from the blockchain as the target data.

[0055] Typically, after receiving a request to upload business data to the blockchain, the business end immediately sends the request to the blockchain. Upon receiving the request, the blockchain processes the indicated data to be uploaded. If the upload is successful, the corresponding uploaded data will be stored on the blockchain. The upload time of this uploaded data will satisfy the set timeframe from the request to upload the business data to the blockchain.

[0056] The target data that matches the target data on-chain request record is found from the blockchain through the request time of the business data on-chain request recorded in the target data on-chain request record.

[0057] Step 104: Based on the target data, when it is determined that the business data in the system database is consistent with the on-chain data in the blockchain, the flag position corresponding to the target data on-chain request record is set to a second value.

[0058] Among them, the flag bit serves as the basis for judging whether the business data to be uploaded to the blockchain will be restored when an exception occurs.

[0059] The first value of the flag bit is 0, for example, and the second value is 1, for example.

[0060] Among them, it is necessary to determine whether the business data in the system database and the on-chain data in the blockchain are consistent based on the target data.

[0061] Here, when the business data to be uploaded indicated by the business data upload request is not written to the blockchain (i.e., data upload fails), it can be determined that the data in the blockchain has not changed. At this time, it can be determined that the business data in the system database is consistent with the uploaded data in the blockchain. Alternatively, when the business data to be uploaded indicated by the business data upload request is written to the blockchain (i.e., data upload is successful), it can be determined that the data in the blockchain has changed. At this time, it is necessary to synchronize the uploaded data with the business data in the system database, update the business-end data, and keep the updated business data in the system database consistent with the data on the blockchain. At this time, it can be determined that the business data in the system database is consistent with the uploaded data in the blockchain.

[0062] Specifically, in one embodiment, the target data on-chain request record includes a request identifier for the business data on-chain request; then determining whether the business data in the system database is consistent with the on-chain data in the blockchain includes:

[0063] Based on the request identifier in the target data on-chain request record, when it is determined that the target data does not contain the target on-chain data corresponding to the request identifier, it is determined that the data in the system is consistent with the data in the blockchain.

[0064] When it is determined that the target data does not include the target on-chain data corresponding to the request identifier, it is considered that the processing status of the business data on-chain request is data on-chain failure.

[0065] Specifically, in another embodiment, the target data on-chain request record includes a request identifier for a business data on-chain request; then determining whether the business data in the system database is consistent with the on-chain data in the blockchain includes:

[0066] Based on the request identifier in the target data on-chain request record, when it is determined that the target data contains the target on-chain data corresponding to the request identifier, the data to be on-chain is synchronized with the business data in the system database to determine whether the business data in the system database is consistent with the on-chain data in the blockchain.

[0067] When it is determined that the target data includes the target on-chain data corresponding to the request identifier of the business data on-chain request, it is considered that the processing status of the business data on-chain request is that the data on-chain is successful.

[0068] During the above process, if an abnormal situation occurs, such as a network timeout or an unexpected service failure, the blockchain cannot obtain the data on-chain feedback information sent based on the business data on-chain request. At this time, it will be determined that an abnormality has occurred in writing the business data to be on-chain to the blockchain. At this time, the data to be on-chain on the business side has been submitted, and the business side does not know the result of the data on-chain. Therefore, a compensation mechanism is needed to ensure that the business data remains consistent with the chain.

[0069] Specifically, it is necessary to pull all abnormal data with a flag bit of 0 (i.e., the first value) from the system database, use the generation time of each data as a parameter, and pull all transaction data within the set time period from the blockchain. After unpacking the transaction data, compare the request number (requestId) corresponding to the business data on-chain request with the requestId of the unpacked on-chain data. If the target on-chain data that matches the request number is not matched, it is determined that the target data stored in the blockchain does not contain the target on-chain data corresponding to the request identifier of the business data on-chain request. At this time, it is considered that the data on-chain has failed, and there is no need to compensate the data locally on the business end. On the contrary, if the target on-chain data that matches the request number is matched, it is determined that the target data stored in the blockchain contains the target on-chain data corresponding to the request identifier of the business data on-chain request. At this time, the data on-chain is considered successful. Then, it can be determined that the business data in the local system database and the on-chain data in the blockchain are in an inconsistent state. It is necessary to unpack these target on-chain data to obtain the corresponding on-chain parameters (such as transfer amount, account, transfer balance, transfer contract, etc.), and execute the business logic on the business end to re-enter the database to complete the data compensation of the business data locally on the business end, so that the business data in the system database and the on-chain data in the blockchain are consistent. At this time, the flag position corresponding to the target data on-chain request record is set to 1 (that is, the second value).

[0070] In the above processing process, when maintaining data consistency, the solution adopted is not full pull, nor active pull triggered by the user. Instead, when an abnormality is detected in the data to be uploaded to the chain, the data upload request record with the flag bit as the first value is extracted from the system database of the business end, and the target data corresponding to the record is obtained from the blockchain. When the data content corresponding to the data to be uploaded to the chain is matched from the target data, data synchronization is performed locally on the business end to maintain data consistency between the business end and the blockchain, and the value of the flag bit of the data upload request record is changed to the second value, thereby realizing effective marking of the processing status of the data upload request.

[0071] In an embodiment of the present application, by forming a record information of the business data on-chain request at the business end and marking the processing status of the business data on-chain request with the help of adjusting the value of the flag bit, when an abnormality is detected in writing the business data to be on-chain to the blockchain, based on the record information of the business data on-chain request and the corresponding flag bit, the target data that matches the target data on-chain request record is searched from the blockchain, and then the consistency between the business data in the business end and the data in the blockchain is determined, thereby reducing the service pressure of the business party and the blockchain server, and ensuring the timeliness of data synchronization.

[0072] The embodiments of this application also provide different implementation methods of the data consistency processing method.

[0073] See also Figure 2 , Figure 2 This is a process of a data consistency processing method provided by the embodiment of the present application Figure 2 .like Figure 2 As shown, a data consistency processing method includes the following steps:

[0074] Step 201: Obtain a request to upload business data to the blockchain.

[0075] The business data on-chain request is used to instruct the business data to be on-chain to be written to the blockchain.

[0076] The implementation process of this step is the same as the implementation process of step 101 in the aforementioned embodiment, and will not be repeated here.

[0077] Step 202: Store the request information of the business data uplink request in the system database, obtain a data uplink request record corresponding to the business data uplink request, and set the flag position corresponding to the data uplink request record to the first value.

[0078] The request information specifically includes the request time, request identifier and other information of the business data chain request.

[0079] Step 203: When it is detected that the business data to be uploaded to the blockchain is successfully written, the flag position corresponding to the data upload request record is set to the second value, and the data to be uploaded to the blockchain is synchronized with the business data in the system database.

[0080] Among them, if feedback information is received on the blockchain indicating that the data is successfully uploaded based on the business data upload request, it is determined that the business data to be uploaded is successfully written into the blockchain.

[0081] At this point, it can be determined that the data in the blockchain has changed. In this case, the data to be uploaded to the chain needs to be synchronized with the business data in the system database, and the business-end data needs to be updated. The business data in the updated system database remains consistent with the data in the blockchain.

[0082] Step 204: When it is detected that the business data to be uploaded fails to be written into the blockchain, the flag position corresponding to the data upload request record is set to the second value, and a prompt message indicating that the data processing failed is output.

[0083] Among them, if feedback information of data failure on the blockchain based on the business data on-chain request is received, it is determined that the business data to be on-chain has failed to be written into the blockchain.

[0084] When the business data to be uploaded fails to be written into the blockchain, a prompt message indicating data processing failure needs to be output to the user on the business side.

[0085] Step 205: When an abnormality is detected in writing the business data to be uploaded to the blockchain, a target data upload request record with a flag bit of the first value is extracted from the system database.

[0086] The system database stores business data, a data uplink request record corresponding to the business data uplink request, and a flag bit for indicating the processing status of the business data uplink request.

[0087] The implementation process of this step is the same as the implementation process of step 102 in the aforementioned embodiment, and will not be repeated here.

[0088] Step 206: Search the blockchain for target data that matches the target data upload request record.

[0089] The implementation process of this step is the same as the implementation process of step 103 in the aforementioned embodiment, and will not be repeated here.

[0090] Step 207: Based on the target data, when it is determined that the business data in the system database is consistent with the on-chain data in the blockchain, the flag position corresponding to the target data on-chain request record is set to the second value.

[0091] The implementation process of this step is the same as the implementation process of step 104 in the aforementioned embodiment, and will not be repeated here.

[0092] In an embodiment of the present application, by forming a record information of the business data on-chain request at the business end and marking the processing status of the business data on-chain request by adjusting the value of the flag bit, when an abnormality is detected in writing the business data to be on-chain to the blockchain, based on the record information of the business data on-chain request and the corresponding flag bit, the target data that matches the target data on-chain request record is searched from the blockchain, and then the consistency between the business data in the business end and the data in the blockchain is determined. When it is detected that the business data to be on-chain fails to be written to the blockchain or is successfully written, different processing measures are adopted respectively to ensure the consistency between the business data in the business end and the data in the blockchain, reduce the service pressure of the business party and the blockchain server, and ensure the timeliness of data synchronization.

[0093] See also Figure 3 , Figure 3 This is a structural diagram of a data consistency processing device provided in an embodiment of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown.

[0094] The data consistency processing device 300 includes:

[0095] An acquisition module 301 is configured to acquire a business data on-chain request, wherein the business data on-chain request is used to instruct the business data to be on-chain to be written to the blockchain;

[0096] Extraction module 302 is configured to extract, from a system database, a target data on-chain request record with a flag bit set to a first value when an anomaly is detected in writing the business data to be on-chain to the blockchain; the system database stores business data, a data on-chain request record corresponding to the business data on-chain request, and a flag bit indicating the processing status of the business data on-chain request;

[0097] A search module 303 is configured to search the blockchain for target data that matches the target data upload request record;

[0098] The status value setting module 304 is used to set the flag position corresponding to the target data on-chain request record to the second value when it is determined that the business data in the system database is consistent with the on-chain data in the blockchain based on the target data.

[0099] The state value setting module 304 is further configured to:

[0100] Storing the request information of the business data on-chain request in the system database to obtain a data on-chain request record corresponding to the business data on-chain request;

[0101] The flag position corresponding to the data uplink request record is set to the first value.

[0102] The state value setting module 304 is further configured to:

[0103] When it is detected that the business data to be uploaded to the chain is successfully written into the blockchain, the flag position corresponding to the data upload request record is set to the second value, and the data to be uploaded to the chain is synchronized with the business data in the system database.

[0104] The state value setting module 304 is further configured to:

[0105] When it is detected that the business data to be uploaded to the chain fails to be written into the blockchain, the flag position corresponding to the data upload request record is set to the second value, and a prompt message indicating that the data processing failed is output.

[0106] The target data upload request record includes the request time of the business data upload request; the search module 303 is specifically used to:

[0107] Based on the target data on-chain request record, the on-chain data within a set time range from the request time is extracted from the blockchain as the target data.

[0108] The target data upload request record includes a request identifier for the business data upload request; the status value setting module 304 is specifically used to:

[0109] Based on the request identifier in the target data on-chain request record, when it is determined that the target data does not contain the target on-chain data corresponding to the request identifier, it is determined that the data in the system is consistent with the data in the blockchain.

[0110] The target data on-chain request record includes a request identifier for the business data on-chain request; the status value setting module 304 is further specifically used to:

[0111] Based on the request identifier in the target data on-chain request record, when it is determined that the target data contains the target on-chain data corresponding to the request identifier, the data to be on-chain is synchronized with the business data in the system database to determine whether the business data in the system database is consistent with the on-chain data in the blockchain.

[0112] The data consistency processing device provided in the embodiment of the present application can implement each process of the embodiment of the above-mentioned data consistency processing method and can achieve the same technical effect. To avoid repetition, it will not be described here.

[0113] Figure 4This is a structural diagram of a terminal provided by an embodiment of the present application. As shown in the figure, the terminal 4 of this embodiment includes: at least one processor 40 ( Figure 4 Only one is shown), a memory 41 and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, wherein the processor 40 implements the steps of any of the above-mentioned method embodiments when executing the computer program 42.

[0114] The terminal 4 can be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal 4 can include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will understand that Figure 4 It is only an example of terminal 4 and does not constitute a limitation on terminal 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal may also include input and output devices, network access devices, buses, etc.

[0115] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0116] The memory 41 may be an internal storage unit of the terminal 4, such as a hard disk or memory of the terminal 4. The memory 41 may also be an external storage device of the terminal 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash memory card, etc. equipped on the terminal 4. Furthermore, the memory 41 may include both an internal storage unit of the terminal 4 and an external storage device. The memory 41 is used to store the computer program and other programs and data required by the terminal. The memory 41 may also be used to temporarily store data that has been output or is about to be output.

[0117] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

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

[0119] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

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

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

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

[0123] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0124] The present application implements all or part of the processes in the above-mentioned embodiment method, and can also be implemented through a computer program product. When the computer program product runs on a terminal, the terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0125] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. A data consistency processing method, characterized in that: include: Obtain a business data on-chain request, which is used to instruct the business data to be on-chain to be written to the blockchain; When an abnormality is detected in writing the business data to be uploaded to the blockchain, a target data upload request record with a flag bit of the first value is extracted from the system database; The system database stores business data, a data on-chain request record corresponding to the business data on-chain request, and a flag bit indicating the processing status of the business data on-chain request; different values ​​of the flag bit are used to indicate whether the business data on-chain request is processed normally on the data chain; Searching the blockchain for target data that matches the target data upload request record; Based on the target data, when it is determined that the business data in the system database is consistent with the on-chain data in the blockchain, the flag position corresponding to the target data on-chain request record is set to the second value.

2. The method according to claim 1, characterized in that After obtaining the request for uploading business data to the chain, the following steps are also included: Storing the request information of the business data on-chain request in the system database to obtain a data on-chain request record corresponding to the business data on-chain request; The flag position corresponding to the data uplink request record is set to the first value.

3. The method according to claim 2, characterized in that After setting the flag position corresponding to the data uplink request record to the first value, the method further includes: When it is detected that the business data to be uploaded to the chain is successfully written into the blockchain, the flag position corresponding to the data upload request record is set to the second value, and the data to be uploaded to the chain is synchronized with the business data in the system database.

4. The method according to claim 2, characterized in that After setting the flag position corresponding to the data uplink request record to the first value, the method further includes: When it is detected that the business data to be uploaded to the chain fails to be written into the blockchain, the flag position corresponding to the data upload request record is set to the second value, and a prompt message indicating that the data processing failed is output.

5. The method according to claim 1, wherein The target data chain upload request record includes the request time of the business data chain upload request; The searching the blockchain for target data that matches the target data on-chain request record includes: Based on the target data on-chain request record, the on-chain data within a set time range from the request time is extracted from the blockchain as the target data.

6. The method according to claim 1, characterized in that The target data on-chain request record includes a request identifier for the business data on-chain request; and determining whether the business data in the system database is consistent with the on-chain data in the blockchain includes: Based on the request identifier in the target data on-chain request record, when it is determined that the target data does not contain the target on-chain data corresponding to the request identifier, it is determined that the data in the system is consistent with the data in the blockchain.

7. The method according to claim 1, characterized in that The target data on-chain request record includes a request identifier for the business data on-chain request; and determining whether the business data in the system database is consistent with the on-chain data in the blockchain includes: Based on the request identifier in the target data on-chain request record, when it is determined that the target data contains the target on-chain data corresponding to the request identifier, the data to be on-chain is synchronized with the business data in the system database to determine whether the business data in the system database is consistent with the on-chain data in the blockchain.

8. A data consistency processing device, characterized in that: include: An acquisition module is used to obtain a business data on-chain request, where the business data on-chain request is used to instruct the business data to be on-chain to be written to the blockchain; An extraction module is configured to extract, from a system database, a target data on-chain request record with a flag bit set to a first value when an abnormality is detected in writing the business data to be on-chain to the blockchain; The system database stores business data, a data on-chain request record corresponding to the business data on-chain request, and a flag bit indicating the processing status of the business data on-chain request; different values ​​of the flag bit are used to indicate whether the business data on-chain request is processed normally on the data chain; A search module, configured to search the blockchain for target data that matches the target data upload request record; A status value setting module is used to set the flag position corresponding to the target data on-chain request record to a second value when it is determined that the business data in the system database is consistent with the on-chain data in the blockchain based on the target data.

9. A terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Block chain data uploading method and device, storage medium and server

    CN111274252A