CN113221151A - Data processing method and device based on block chain and storage medium - Google Patents

Data processing method and device based on block chain and storage medium Download PDF

Info

Publication number
CN113221151A
CN113221151A CN202110598149.4A CN202110598149A CN113221151A CN 113221151 A CN113221151 A CN 113221151A CN 202110598149 A CN202110598149 A CN 202110598149A CN 113221151 A CN113221151 A CN 113221151A
Authority
CN
China
Prior art keywords
data
service data
target service
change log
change
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110598149.4A
Other languages
Chinese (zh)
Inventor
王凯宁
赵小君
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Digital Finance Ltd
Original Assignee
Digital Finance Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Digital Finance Ltd filed Critical Digital Finance Ltd
Priority to CN202110598149.4A priority Critical patent/CN113221151A/en
Publication of CN113221151A publication Critical patent/CN113221151A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The embodiment of the application provides a data processing method, a device and a storage medium based on a block chain, wherein the method comprises the following steps: acquiring a first change log of target service data from a block chain, and acquiring the target service data from a database; verifying the target service data by using the first change log; if the verification fails, the target service data stored in the database is corrected according to the change log included in the change log set of the target service data, so that the safety and reliability of the service data stored in the database can be ensured.

Description

Data processing method and device based on block chain and storage medium
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a data processing method and apparatus based on a block chain, and a storage medium.
Background
Data is a companion which is necessary to exist in any business, at present, the data of the business can be stored by using a database, but because the database is centralized and can be tampered, a person who has the database modification authority can create, delete and modify any data in the database, so that the database can be illegally tampered, and the safety and reliability of the data cannot be ensured.
Disclosure of Invention
The embodiment of the application provides a data processing method, a data processing device and a storage medium based on a block chain, which can ensure the safety and reliability of service data stored in a database.
In one aspect, an embodiment of the present application provides a data processing method based on a block chain, where the method includes:
acquiring a first change log of target service data from a block chain, and acquiring the target service data from a database;
verifying the target service data by using the first change log;
and if the verification is not passed, correcting the target service data stored in the database according to a change log included in a change log set of the target service data, wherein the change log set includes the change log of the target service data stored in the block chain within a preset time period.
In another aspect, an embodiment of the present application provides a data processing apparatus based on a block chain, where the apparatus includes:
the acquisition module is used for acquiring a first change log of target service data from a block chain and acquiring the target service data from a database;
the processing module is used for verifying the target service data by utilizing the first change log;
the processing module is further configured to modify the target service data stored in the database according to a change log included in a change log set of the target service data if the verification fails, where the change log set includes the change log of the target service data stored in the block chain within a preset time period.
Accordingly, an embodiment of the present application provides a computer device, which includes a processor, a communication interface, and a memory, where the processor, the communication interface, and the memory are connected to each other, where the processor is adapted to execute a computer program, and the memory stores a computer program, and when the computer program is executed by the processor, the above-mentioned data processing method based on a block chain is implemented.
Accordingly, embodiments of the present application provide a computer-readable storage medium, which stores a computer program, the computer program being adapted to be loaded by a processor and to execute the above-mentioned data processing method based on a block chain.
Accordingly, embodiments of the present application provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to execute the above block chain-based data processing method.
In the embodiment of the application, a first change log of the target service data can be acquired from a block chain, the target service data is acquired from a database, the first change log is used for verifying the target service data, and when the verification fails, the target service data stored in the database is corrected according to the change log included in the change log set of the target service data; because the block chain has the characteristics of decentralization and incapability of being tampered, the method can monitor the service data in the database by using the change log stored on the block chain, and can correct the illegally tampered service data, so that the safety and reliability of the service data in the database can be ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1A is a block chain system according to an exemplary embodiment of the present application;
fig. 1B is a block chain structure diagram according to an exemplary embodiment of the present application;
fig. 1C is a schematic flow chart of a block generation process according to an exemplary embodiment of the present application;
fig. 2 is a schematic flowchart of a data processing method based on a blockchain according to an exemplary embodiment of the present application;
fig. 3 is a schematic flowchart of a data processing method based on a blockchain according to another exemplary embodiment of the present application;
fig. 4 is a flowchart illustrating a data processing method based on a blockchain according to another exemplary embodiment of the present application;
fig. 5 is a schematic structural diagram of a data processing apparatus based on a blockchain according to an exemplary embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device according to an exemplary embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the descriptions of "first", "second", etc. referred to in the embodiments of the present application are only for descriptive purposes and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a technical feature defined as "first" or "second" may explicitly or implicitly include at least one such feature.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm, and is mainly used for sorting data according to a time sequence and encrypting the data into an account book, so that the data cannot be falsified or forged, and meanwhile, the data can be verified, stored and updated. The related art of the blockchain will be described in detail with reference to the accompanying drawings.
Please refer to fig. 1A, which is a schematic structural diagram of a blockchain system according to an exemplary embodiment of the present application. As shown in fig. 1A, the blockchain system is a data sharing system, and the blockchain system may include a plurality of nodes, where the plurality of nodes may specifically include node 1, node 2, node 3 …, and node N, where node 1, node 2, node 3 …, and node N. Each node can receive data sent by the outside when working normally, and can carry out block uplink processing based on the received data, and can also send data to the outside. In order to ensure data intercommunication among the nodes, information connection can exist among the nodes, and the nodes can transmit information through the information connection. For example, when an arbitrary node in the blockchain system receives input information, other nodes in the blockchain system acquire the input information according to a consensus algorithm, and store the input information as data in shared data, so that the data stored on all nodes in the blockchain system are consistent.
It should be understood that the information connection is not limited to the connection manner, and may be directly or indirectly connected through a wired communication manner, may be directly or indirectly connected through a wireless communication manner, and may also be connected through other connection manners, which is not limited herein.
It is understood that each node in the blockchain system has a node identifier corresponding thereto, and each node in the blockchain system may store node identifiers of other nodes in the blockchain system, so that the generated block is broadcast to other nodes in the blockchain system according to the node identifiers of other nodes. Each node may maintain a node identifier list as shown in the following table, and store the node name and the node identifier in the node identifier list correspondingly. The node identifier may be an IP (Internet Protocol ) address and any other information that can be used to identify the node, and table 1 only illustrates the IP address as an example:
TABLE 1
Node name Node identification
Node 1 117.114.151.174
Node 2 117.116.189.145
Node 3 117.113.181.124
Node N xx.xx.xx.xx
Each node in the blockchain system stores one identical blockchain. The block chain is composed of a plurality of blocks, referring to fig. 1B, the block chain is composed of a plurality of blocks, the starting block includes a block header and a block main body, the block header stores an input information characteristic value, a version number, a timestamp and a difficulty value, and the block main body stores input information; the next block of the starting block takes the starting block as a parent block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the parent block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain is associated with the block data stored in the parent block, and the safety of the input information in the block is ensured.
When each block in the block chain is generated, referring to fig. 1C, when the node where the block chain is located receives the input information, the input information is verified, after the verification is completed, the input information is stored in the memory pool, and the hash tree for recording the input information is updated; and then, updating the updating time stamp to the time when the input information is received, trying different random numbers, and calculating the characteristic value for multiple times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
wherein, SHA256 is a characteristic value algorithm used for calculating a characteristic value; version is version information of the relevant block protocol in the block chain; prev _ hash is a block head characteristic value of a parent block of the current block; merkle _ root is a characteristic value of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, is a fixed value within a period of time, and is determined again after exceeding a fixed time period; x is a random number; TARGET is a feature threshold, which can be determined from nbits.
Therefore, when the random number meeting the formula is obtained through calculation, the information can be correspondingly stored, and the block head and the block main body are generated to obtain the current block. And then, the node where the block chain is located respectively sends the newly generated blocks to other nodes in the block chain system where the newly generated blocks are located according to the node identifications of the other nodes in the block chain system, the newly generated blocks are verified by the other nodes, and the newly generated blocks are added to the block chain stored in the newly generated blocks after the verification is completed.
Aiming at the problem that a database cannot ensure the safety and reliability of service data, the application provides a data processing method based on a block chain based on the characteristics of block chain decentralization and incapability of being tampered, and the method specifically comprises the following steps: acquiring a first change log of target service data from a block chain, acquiring the target service data from a database, verifying the target service data by using the first change log, and correcting the target service data stored in the database according to the change log included in a change log set of the target service data when the verification fails; the method can monitor the service data in the database by using the change log stored in the block chain, and can correct the illegally tampered service data, thereby ensuring the safety and reliability of the service data in the database.
The data processing method based on the blockchain provided by the embodiment of the application can be executed by computer equipment, the computer equipment can be a node in a blockchain system, and the node can be a terminal or a server. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN, a big data and artificial intelligence platform, and the like. The terminal may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and the like.
A block chain-based data processing method of the present application is described in detail below.
Fig. 2 is a flowchart illustrating a method for processing data based on a blockchain according to an exemplary embodiment of the present application, where the method may include the following steps S201 to S203:
s201, obtaining a first change log of the target service data from the block chain, and obtaining the target service data from a database.
The target service data is service data to be monitored, and may be core data of the service, for example, when the service is a payment service, the target service data may be an account balance of a user, and the like; the first change log is a latest change log of the target service data, and the first change log may include a current field value of the target service data, a change value of the target service data, and a field value before the change of the target service data.
When the target service data is changed, the computer device may store a change log of the target service data to the block chain, update a current field value of the target service data in the database, and when it is required to monitor whether the target service data in the database is tampered, the computer device may obtain a first change log of the target service data from the block chain and obtain the target service data from the database.
S202, the target service data is verified by utilizing the first change log.
It can be understood that the blockchain is a billing technology which is commonly maintained by multiple parties, uses cryptography to ensure transmission and access security, and can realize data consistent storage, difficult tampering and repudiation prevention. Therefore, the change log stored in the block chain cannot be tampered, the computer device may obtain the first change log of the target service data to verify the target service data, and if the current field value of the target service data recorded in the first change log is not consistent with the field value of the target service data obtained from the database, the computer device may determine that the verification fails, that is, the target service data stored in the database is tampered illegally. For example, for the payment service, if the account balance of the first change log record is 20 yuan, and the field value corresponding to the account balance stored in the database is 18 yuan, the verification fails.
S203, if the verification is not passed, correcting the target service data stored in the database according to a change log included in a change log set of the target service data, wherein the change log set includes the change log of the target service data stored in the block chain within a preset time period.
When the verification fails, the computer device may modify the target service data stored in the database by using the change log stored in the block chain, specifically: the computer device may obtain a change log (i.e., a change log set) of the target service data within a preset time period, where the preset time period is a time period from a past time to a current time, for example, the preset time period may be specifically a previous day, a previous week or a previous month, or may be a previous 24 hours, a previous 72 hours or a previous 128 hours, and so on, for example, when the preset time period is a previous day (or a previous 24 hours), and the current time is 2021 year, 5 month, 27 day 1 hour 0, the computer device may obtain, from the block chain, the change log of the target service data included from 2021 year, 5 month, 26 day 1 hour 0 to 2021 year, 5 month, 27 day 1 hour 0. The computer equipment can calculate the change value and the current field value of the target service data recorded by the change log according to the time sequence of the uploading block chain of the change log, and corrects the target service data stored in the database by using the calculated value; or the current field value of the target service data recorded by the first change log in the change log set can be acquired to correct the target service data stored in the database. Taking a payment service as an example, a computer device acquires a change log 1, a change log 2 and a change log 3 within a preset time period, wherein the uploading time of block chains of the change log 1, the change log 2 and the change log 3 is respectively 9:00, 11:00 and 13:00 of the same day, the current account balance recorded by the change log 1 is 20 yuan, the change amounts recorded by the change log 2 and the change log 3 are respectively minus 5 yuan and minus 3 yuan, so that the calculated value is 12(20-5-3) yuan, and the field value corresponding to target service data stored in a database is replaced by the calculated value of 12 yuan to realize correction; or acquiring the current account balance recorded in the change log 3, and directly replacing the field value corresponding to the target service data stored in the database by using 12 elements to realize correction if the recorded current account balance is 12 elements.
In one embodiment, when the change log of the target service data is not acquired within a preset time period, that is, when the change log set is empty, the computer device may acquire a first change log of the target service data, and modify the target service data stored in the database according to a current field value of the target service data recorded by the first change log; or all change logs of the target service data can be obtained, the change value and the current field value of the target service data recorded by the change logs are calculated according to the time sequence of the uploading block chain of each change log in all the change logs, and the target service data stored in the database is corrected by using the calculated value.
In the embodiment of the application, the computer device may obtain a first change log of the target service data from the blockchain, obtain the target service data from the database, verify the target service data by using the first change log, and modify the target service data stored in the database according to the change log included in the change log set of the target service data when the verification fails; because the block chain has the characteristics of decentralization and incapability of being tampered, the method can monitor the service data in the database by using the change log stored on the block chain, and can correct the illegally tampered service data, so that the safety and reliability of the service data in the database can be ensured.
Fig. 3 is a flowchart illustrating a method for processing data based on a blockchain according to another exemplary embodiment of the present application, where the method may include the following steps S301 to S305:
s301, when a preset check time period is met, a first change log of the target service data is obtained from the block chain, and the target service data is obtained from the database.
In one embodiment, the computer device may obtain a key field configured in advance for a service, and use service data corresponding to the key field as target service data, where the key field configured in advance may include one or more service fields of the service. For example, when the key field pre-configured for the payment service is the account balance of the user, the service data corresponding to the account balance stored in the database is used as the target service data.
When the current time reaches the verification time indicated by the preset verification time period, the computer device may obtain the first change log of the target service data from the block chain, and obtain the target service data from the database.
The pre-configured key fields and the preset verification time period may be input by a manager on a configuration interface of the displayed service.
The configuration interface can comprise a field configuration area and a time configuration area, a manager can input one or more service fields in the field configuration area, and the computer equipment takes the input one or more service fields as key fields of the service after acquiring the input one or more service fields; meanwhile, the administrator may input the verification time period through the time configuration area, for example, set the verification time period to a little morning per day, or a little morning on the first day of each month, and so on.
In an embodiment, when receiving a data change request sent by a first terminal device for target service data, a computer device may change the target service data stored in a database by using change data of the target service data carried in the data change request, generate a second change log of the target service data, and store the second change log of the target service data to a blockchain, where the blockchain may be the blockchain system.
The first terminal device may be installed with an application program of a service, and a user may use the application program to implement a function corresponding to the service, so as to implement a change of target service data, for example, payment software is used to complete payment of money, at this time, the first terminal device needs to send a data change request to the computer device, and implement a change of the target service data stored in the database according to change data carried by the data change request, for example, the change data may be a field value after the target service data is changed, or may be a change value, when the change data is the change value, the computer device needs to calculate the target service data stored in the database according to the change value, so as to implement the change, for example, for the payment service, the change value is: and adding 5, namely adding 5 on the basis of the field value corresponding to the account balance stored in the database to obtain the current field value of the target service data. Meanwhile, the computer device needs to generate a second change log of the target service data, and store the second change log to the block chain.
In one embodiment, the computer device may generate the data blocks of the second change log by using a hash algorithm when storing the second change log to the blockchain, broadcast the data blocks of the second change log in the blockchain so that the blockchain performs consensus processing on the data blocks of the second change log, and store the data blocks of the second change log to the blockchain after the data blocks of the second change log pass the consensus.
S302, analyzing the first change log to obtain reference service data, and if the target service data stored in the database is inconsistent with the reference service data, determining that the verification fails.
And when the current field value of the target service data recorded in the first change log is not consistent with the field value corresponding to the target service data stored in the database, the verification of the target service data stored in the database is determined to be failed, namely the target service data is illegally tampered. For example, for the payment service, if the account balance of the first change log record is 20 yuan, and the field value corresponding to the account balance stored in the database is 18 yuan, the verification fails.
S303, when the verification fails, acquiring a preset time period configured in advance for the target service data, and acquiring a change log set of the target service data in the preset time period from the block chain, wherein the change log set comprises one or more change logs.
When the verification fails, the computer device may obtain a preset time period configured in advance for the target service data, and obtain a change log set of the target service data within the preset time period from the block chain, where the change log set may include one or more change logs.
The preset time period configured in advance may be input by a manager on a configuration interface of the service.
After configuring one or more service fields as target service data, a manager can configure a preset time period corresponding to each field respectively for the one or more fields, and can also configure the same preset time period uniformly for the one or more fields. If one or more fields configured for the payment service are account balance and transfer amount, the preset time period can be respectively set as the previous week and the previous month for the account balance and the transfer amount, and the preset time period can also be uniformly set as the previous week for the account balance and the transfer amount.
In an embodiment, when the administrator does not configure the preset time period corresponding to each field for one or more service fields, that is, when the target service data does not have the preset time period configured in advance, the computer device may obtain, from the blockchain, a first change log of the target service data to form a change log set of the target service data, or obtain, from the blockchain, all change logs of the target service data to form a change log set of the target service data.
S304, determining first correction data of the target business data according to the change records of the target business data included in each change log in the one or more change logs.
After acquiring the one or more change logs, the computer device may parse the one or more change logs to obtain a change record of the target service data recorded in each change log, where the change record may include a current field value, a change value, a field value before change, and the like of the target service data.
When acquiring the first modification data, the computer device may calculate change records of the target service data included in the change log according to a time sequence of the one or more change log uploading block chains, for example, obtain the first modification data by calculating a current field value of the target service data of the first change log record and a change value of a subsequent change log record in a forward chronological sequence, or may use a current field value of the target service data of the first change log (latest change log) record included in the one or more change logs as the first modification data. Taking a payment service as an example, the computer device acquires a change log 1, a change log 2 and a change log 3 within a preset time period, wherein the uploading time of block chains of the change log 1, the change log 2 and the change log 3 is respectively 9:00, 11:00 and 13:00 of the same day, the current account balance recorded by the change log 1 is 20 yuan, the change amounts recorded by the change log 2 and the change log 3 are respectively reduced by 5 yuan and 3 yuan, and the obtained first correction data is 12(20-5-3) yuan; or directly acquiring the current account balance recorded in the change log 3 as 12 yuan as first correction data.
S305, correcting the target service data stored in the database according to the first correction data.
When the first correction data is the current field value of the target service data, the first correction data can be directly used for replacing the field value corresponding to the target service data stored in the database, so as to correct the target service data stored in the database. For example, for the payment service, the first correction data is 12 elements, the field value corresponding to the target service data stored in the database is 18 elements, and the 18 elements stored in the database are replaced by the 12 elements indicated by the first correction data.
In one embodiment, the first correction data may also be a correction value, such as for a payment service: and subtracting 5, wherein the field value corresponding to the target service data stored in the database is 18 elements, and the field value corresponding to the target service data stored in the corrected database is 13(18-5) elements.
When some error data exist in the database and need to be repaired manually, the computer device may respond to a data correction request sent by the second terminal device for the target service data, correct the target service data stored in the database by using the second correction data, generate a third change log of the target service data, and store the third change log of the target service data to the block chain.
The second terminal device includes a management interface, and the second terminal device may be the same terminal device as the first terminal device or different terminal devices, which is not limited in this application. The manager can input data in the management interface displayed by the second terminal device as second correction data, and send a data correction request carrying the second correction data to the computer device. And the computer equipment corrects the target service data stored in the database after receiving the second correction data. When the second correction data is the current field value of the target service data, the second correction data can be directly used for replacing the field value corresponding to the target service data stored in the database. For example, for the payment service, the second correction data is 12 elements, and the field value corresponding to the target service data stored in the database is 18 elements, the 18 elements stored in the database are replaced by the 12 elements indicated by the second correction data.
In one embodiment, the second correction data may also be a correction value, such as for a payment service: and subtracting 5, wherein the field value corresponding to the target service data stored in the database is 18 elements, and the field value corresponding to the target service data stored in the corrected database is 13(18-5) elements.
Further, after the target service data is modified, the computer device may generate a third change log of the target service data, and store the third change log of the target service data to a blockchain, where the blockchain may be the blockchain system. Wherein the third change log may include a current field value, a changed value, a field value before the change, and the like of the target business data.
In one embodiment, the computer device may generate the data blocks of the third change log by using a hash algorithm when storing the third change log to the blockchain, broadcast the data blocks of the third change log in the blockchain so that the blockchain performs consensus processing on the data blocks of the third change log, and store the data blocks of the third change log to the blockchain when the data blocks of the third change log pass the consensus.
In the embodiment of the application, a first change log of a target service can be acquired from a block chain, target service data can be acquired from a database, reference service data recorded in the first change log is used for verifying the target service data stored in the database, when the verification fails, the target service data stored in the database is corrected by using the change log included in a change log set of the target service data, and meanwhile, the target service data stored in the database can be corrected according to a data correction request sent by a management interface, so that the safety and reliability of the service data stored in the database can be ensured more flexibly.
The above-mentioned computer device may run a plurality of components to implement a data processing flow based on a block chain, where the components may specifically include: a data modification component, a data comparison component, and a data modification component, where a component may be understood as a program module (or a program process) in a computer device, and each component may implement a corresponding function. The data change component is built by adopting a block chain technology, and the change log originally stored in the database can be changed into be stored in the block chain, so that the characteristics of decentralization and tamper resistance of the block chain can be utilized, the safety of the change log is effectively ensured, the change log is prevented from being lost, and meanwhile, the data change component can be used for performing data interaction with nodes in the block chain to obtain the change log. The data comparison component can compare target business data stored in the database at regular time according to a preset check time period, and meanwhile, as managers can configure the target business data on the configuration interface, resource waste caused by comparison of all data can be avoided. When the target service data stored in the database is found not to pass the verification, the data correction component can acquire a change log set of the target service data in a preset time period to correct the target service data stored in the database.
Fig. 4 is a flowchart illustrating a data processing method based on a blockchain according to another exemplary embodiment of the present application. The method can be described by combining a data change component, a data comparison component and a data correction component which are included in the computer equipment; the method may comprise the following steps S401-S411:
s401, the data change component acquires target business data configured by a manager on a configuration interface.
S402, the data change component is connected with the database, and target service data stored in the database are monitored.
And S403, the data change component receives and responds to the data change request and sends a data change event to the database.
S404, the database changes the target business data stored in the database according to the data change event.
The database changes the target service data stored in the database according to the obtained change data.
S405, the data change component stores a second change log corresponding to the target service data to the block chain.
S406, the data change component receives the data correction request and sends a data correction event to the database.
And S407, the database corrects the target service data stored in the database according to the data correction event.
The database corrects the target service data stored in the database according to the obtained second correction data.
S408, the data change component stores a third change log corresponding to the target service data in the block chain.
And S409, when the preset verification time period is met, the data change component acquires a first change log of the target service data from the block chain and sends the first change log to the data comparison component, and the data comparison component verifies the target service data stored in the database by using the first change log.
And S410, if the verification fails, the data comparison component sends a data correction instruction to the data correction component.
S411, after receiving the data correction instruction, the data correction component corrects the target service data stored in the database according to the change log included in the change log set of the target service data.
In one possible embodiment, the data modification component (or computer device) may also send a data illegal tampering alarm to the management device of the business to prompt the management personnel to take measures for security investigation.
In the embodiment of the application, when monitoring and correcting the target service data stored in the database, the data change component, the data comparison component and the data correction component can be used together to realize the purpose, so that the complex problem can be decomposed into a plurality of local problems which are easy to solve, and the processing efficiency of the computer equipment during data processing is improved.
While the method of the embodiments of the present application has been described in detail above, to facilitate better implementation of the above-described aspects of the embodiments of the present application, the apparatus of the embodiments of the present application is provided below accordingly. Referring to fig. 5, fig. 5 is a schematic structural diagram of a block chain-based data processing apparatus provided in the present application, where the apparatus 50 may be disposed in a computer device, and the apparatus 50 may be configured to perform corresponding steps in the block chain-based data processing method, where the apparatus 50 may include:
an obtaining module 501, configured to obtain a first change log of target service data from a blockchain, and obtain the target service data from a database;
a processing module 502, configured to verify the target service data by using the first change log;
the processing module 502 is further configured to, if the verification fails, modify the target service data stored in the database according to a change log included in a change log set of the target service data, where the change log set includes a change log of the target service data stored in the block chain within a preset time period.
In an embodiment, the obtaining module 501 is further configured to:
acquiring a preset time period which is configured in advance aiming at the target service data;
the processing module 502 is further configured to:
acquiring a change log set of the target service data in a preset time period from the block chain, wherein the change log set comprises one or more change logs;
determining first correction data of the target business data according to change records of the target business data included in each change log in the one or more change logs;
and correcting the target service data stored in the database according to the first correction data.
In an embodiment, the obtaining module 501 is further configured to:
acquiring a key field which is pre-configured for a service, wherein the key field comprises one or more service fields of the service;
the processing module 502 is further configured to:
and determining target service data according to the service data corresponding to the key field.
In one embodiment, the processing module 502 is further configured to:
analyzing the first change log to obtain reference service data;
and if the target service data stored in the database is inconsistent with the reference service data, determining that the verification fails.
In one embodiment, further comprising:
a receiving module 503, configured to receive a data change request sent by a first terminal device for the target service data, where the data change request carries change data of the target service data;
the processing module 502 is further configured to:
responding to the data change request, changing the target business data stored in the database according to the change data, and generating a second change log of the target business data;
and storing a second change log of the target service data to the block chain.
In one embodiment, the receiving module 503 is further configured to:
receiving a data correction request sent by a second terminal device for the target service data, wherein the data correction request carries second correction data of the target service data, and the second correction data is input through a management interface;
the processing module 502 is further configured to:
responding to the data correction request, correcting the target business data stored in the database by using the second correction data, and generating a third change log of the target business data;
and storing the third change log of the target service data to the block chain.
In one embodiment, the processing module 502 is further configured to:
the method comprises the steps of showing a configuration interface of a service, wherein the configuration interface comprises a field configuration area and a time configuration area;
the obtaining module 501 is further configured to:
acquiring one or more service fields input through the field configuration area, and taking the input one or more service fields as key fields of the service;
and acquiring a verification time period and a preset time period input through the time configuration area.
In an embodiment, the obtaining module 501 is further configured to:
and when the preset check time period is met, acquiring a first change log of the target service data from the block chain, and acquiring the target service data from a database.
In the embodiment of the application, a first change log of target service data is acquired from a block chain, the target service data is acquired from a database, the first change log is used for verifying the target service data, and when the verification fails, the target service data stored in the database is corrected according to the change log included in a change log set of the target service data; because the block chain has the characteristics of decentralization and incapability of being tampered, the method can monitor the service data in the database by using the change log stored on the block chain, and can correct the illegally tampered service data, so that the safety and reliability of the service data in the database can be ensured.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure, where the device 60 at least includes a processor 601, a memory 602, and a communication interface 603. The processor 601, the memory 602, and the communication interface 603 may be connected by a bus or other means. The device 60 may include, but is not limited to, a blockchain node and the communication interface 603 may be used to receive or transmit data. The memory 602 has stored therein a computer-readable storage medium for storing a computer program, the computer program comprising computer instructions. The processor 601 is used to execute computer instructions. The processor 601 (or CPU) is a computing core and a control core of the computer device 60, and is adapted to implement one or more computer instructions, and specifically to load and execute the one or more computer instructions so as to implement a corresponding method flow or a corresponding function.
The memory 602 has stored therein a computer program comprising one or more computer instructions; one or more computer instructions are loaded and executed by the processor 601 to implement the corresponding steps in the above embodiment of the data processing method based on blockchains; in a specific implementation, the computer instructions in the memory 602 are loaded by the processor 601 and perform the following steps:
acquiring a first change log of target service data from a block chain, and acquiring the target service data from a database;
verifying the target service data by using the first change log;
and if the verification is not passed, correcting the target service data stored in the database according to a change log included in a change log set of the target service data, wherein the change log set includes the change log of the target service data stored in the block chain within a preset time period.
In one embodiment, the processor 601 is further configured to:
acquiring a preset time period which is configured in advance aiming at the target service data;
acquiring a change log set of the target service data in a preset time period from the block chain, wherein the change log set comprises one or more change logs;
determining first correction data of the target business data according to change records of the target business data included in each change log in the one or more change logs;
and correcting the target service data stored in the database according to the first correction data.
In one embodiment, the processor 601 is further configured to:
acquiring a key field which is pre-configured for a service, wherein the key field comprises one or more service fields of the service;
and determining target service data according to the service data corresponding to the key field.
In one embodiment, the processor 601 is further configured to:
analyzing the first change log to obtain reference service data;
and if the target service data stored in the database is inconsistent with the reference service data, determining that the verification fails.
In one embodiment, the processor 601 is further configured to:
receiving a data change request sent by a first terminal device for the target service data, wherein the data change request carries change data of the target service data;
responding to the data change request, changing the target business data stored in the database according to the change data, and generating a second change log of the target business data;
and storing a second change log of the target service data to the block chain.
In one embodiment, the processor 601 is further configured to:
receiving a data correction request sent by a second terminal device for the target service data, wherein the data correction request carries second correction data of the target service data, and the second correction data is input through a management interface;
responding to the data correction request, correcting the target business data stored in the database by using the second correction data, and generating a third change log of the target business data;
and storing the third change log of the target service data to the block chain.
In one embodiment, the processor 601 is further configured to:
the method comprises the steps of showing a configuration interface of a service, wherein the configuration interface comprises a field configuration area and a time configuration area;
acquiring one or more service fields input through the field configuration area, and taking the input one or more service fields as key fields of the service;
and acquiring a verification time period and a preset time period input through the time configuration area.
In one embodiment, the processor 601 is further configured to:
and when the preset check time period is met, acquiring a first change log of the target service data from the block chain, and acquiring the target service data from a database.
In the embodiment of the application, a first change log of target service data is acquired from a block chain, the target service data is acquired from a database, the first change log is used for verifying the target service data, and when the verification fails, the target service data stored in the database is corrected according to the change log included in a change log set of the target service data; because the block chain has the characteristics of decentralization and incapability of being tampered, the method can monitor the service data in the database by using the change log stored on the block chain, and can correct the illegally tampered service data, so that the safety and reliability of the service data in the database can be ensured.
Embodiments of the present application also provide a computer-readable storage medium (Memory), which is a Memory device in the computer device 60 and is used for storing programs and data. It is understood that the computer-readable storage medium herein can include both built-in storage media in the computer device 60 and, of course, extended storage media supported by the computer device 60. The computer-readable storage medium provides storage space that stores an operating system for the computer device 60. Also stored in the memory space are one or more computer instructions, which may be one or more computer programs (including program code), suitable for loading and execution by processor 601. It should be noted that the computer-readable storage medium may be a high-speed RAM Memory, or may be a Non-Volatile Memory (Non-Volatile Memory), such as at least one disk Memory; and optionally at least one computer readable storage medium remotely located from the aforementioned processor 601.
One or more embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps performed in the embodiments of the methods described above.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the claims. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for processing data based on a blockchain, the method comprising:
acquiring a first change log of target service data from a block chain, and acquiring the target service data from a database;
verifying the target service data by using the first change log;
and if the verification is not passed, correcting the target service data stored in the database according to a change log included in a change log set of the target service data, wherein the change log set includes the change log of the target service data stored in the block chain within a preset time period.
2. The method of claim 1, wherein the verifying the target business data using the first change log comprises:
analyzing the first change log to obtain reference service data;
and if the target service data stored in the database is inconsistent with the reference service data, determining that the verification fails.
3. The method of claim 1, further comprising:
the method comprises the steps of showing a configuration interface of a service, wherein the configuration interface comprises a field configuration area and a time configuration area;
acquiring one or more service fields input through the field configuration area, and taking the input one or more service fields as key fields of the service;
and acquiring a verification time period and a preset time period input through the time configuration area.
4. The method of claim 3, wherein prior to obtaining the first change log of the target business data from the blockchain and obtaining the target business data from the database, the method further comprises:
acquiring a key field which is pre-configured for the service, wherein the key field comprises one or more service fields of the service;
and determining target service data according to the service data corresponding to the key field.
5. The method according to claim 3, wherein the modifying the target business data stored in the database according to the change log included in the change log set of the target business data comprises:
acquiring a preset time period which is configured in advance aiming at the target service data;
acquiring a change log set of the target service data in a preset time period from the block chain, wherein the change log set comprises one or more change logs;
determining first correction data of the target business data according to change records of the target business data included in each change log in the one or more change logs;
and correcting the target service data stored in the database according to the first correction data.
6. The method of claim 3, wherein obtaining the first change log of the target business data from the blockchain and obtaining the target business data from the database comprises:
and when the preset check time period is met, acquiring a first change log of the target service data from the block chain, and acquiring the target service data from a database.
7. The method according to any one of claims 1 to 6, further comprising:
receiving a data change request sent by a first terminal device for the target service data, wherein the data change request carries change data of the target service data;
responding to the data change request, changing the target business data stored in the database according to the change data, and generating a second change log of the target business data;
and storing a second change log of the target service data to the block chain.
8. The method according to any one of claims 1 to 6, further comprising:
receiving a data correction request sent by a second terminal device for the target service data, wherein the data correction request carries second correction data of the target service data, and the second correction data is input through a management interface;
responding to the data correction request, correcting the target business data stored in the database by using the second correction data, and generating a third change log of the target business data;
and storing the third change log of the target service data to the block chain.
9. An apparatus for data processing based on a blockchain, the apparatus comprising:
the acquisition module is used for acquiring a first change log of target service data from a block chain and acquiring the target service data from a database;
the processing module is used for verifying the target service data by utilizing the first change log;
the processing module is further configured to modify the target service data stored in the database according to a change log included in a change log set of the target service data if the verification fails, where the change log set includes the change log of the target service data stored in the block chain within a preset time period.
10. A computer-readable storage medium, characterized in that it stores a computer program adapted to be loaded by a processor and to execute the method of blockchain based data processing according to any of claims 1 to 8.
CN202110598149.4A 2021-05-28 2021-05-28 Data processing method and device based on block chain and storage medium Pending CN113221151A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110598149.4A CN113221151A (en) 2021-05-28 2021-05-28 Data processing method and device based on block chain and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110598149.4A CN113221151A (en) 2021-05-28 2021-05-28 Data processing method and device based on block chain and storage medium

Publications (1)

Publication Number Publication Date
CN113221151A true CN113221151A (en) 2021-08-06

Family

ID=77099740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110598149.4A Pending CN113221151A (en) 2021-05-28 2021-05-28 Data processing method and device based on block chain and storage medium

Country Status (1)

Country Link
CN (1) CN113221151A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022341A (en) * 2022-05-17 2022-09-06 中国银行股份有限公司 Parameter modification method and device based on block chain, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874440A (en) * 2017-02-07 2017-06-20 杭州秘猿科技有限公司 A kind of block chain state storage method based on SQL database
CN109800207A (en) * 2019-01-14 2019-05-24 深圳前海微众银行股份有限公司 Log analytic method, device, equipment and computer readable storage medium
CN109902074A (en) * 2019-04-17 2019-06-18 江苏全链通信息科技有限公司 Log storing method and system based on data center
CN111241192A (en) * 2019-12-31 2020-06-05 航天信息软件技术有限公司 Data synchronization method
CN111639363A (en) * 2020-05-24 2020-09-08 石高峰 Data analysis method based on block chain and edge computing server
WO2020238255A1 (en) * 2019-05-30 2020-12-03 创新先进技术有限公司 Smart contract management method and apparatus based on blockchain, and electronic device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874440A (en) * 2017-02-07 2017-06-20 杭州秘猿科技有限公司 A kind of block chain state storage method based on SQL database
CN109800207A (en) * 2019-01-14 2019-05-24 深圳前海微众银行股份有限公司 Log analytic method, device, equipment and computer readable storage medium
CN109902074A (en) * 2019-04-17 2019-06-18 江苏全链通信息科技有限公司 Log storing method and system based on data center
WO2020238255A1 (en) * 2019-05-30 2020-12-03 创新先进技术有限公司 Smart contract management method and apparatus based on blockchain, and electronic device
CN111241192A (en) * 2019-12-31 2020-06-05 航天信息软件技术有限公司 Data synchronization method
CN111639363A (en) * 2020-05-24 2020-09-08 石高峰 Data analysis method based on block chain and edge computing server

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115022341A (en) * 2022-05-17 2022-09-06 中国银行股份有限公司 Parameter modification method and device based on block chain, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2021233049A1 (en) Blockchain–based data processing method, apparatus, device, and readable storage medium
CN111427957B (en) Block chain voting information verification method, device, equipment and storage medium
CN111737360B (en) Block chain-based equipment management method and device and computer equipment
CN110569251A (en) Data processing method, related equipment and computer readable storage medium
CN110222535B (en) Processing device, method and storage medium for block chain configuration file
CN109861996B (en) Block chain-based relationship proving method, device, equipment and storage medium
CN110597673B (en) Disaster recovery method, device and equipment of storage system and computer readable storage medium
CN113326165B (en) Data processing method and device based on block chain and computer readable storage medium
CN111488372A (en) Data processing method, device and storage medium
CN111813788A (en) Information query method and device and information synchronization method and device
CN110598474A (en) Data acquisition method, system, device and storage medium based on block chain
CN111899019A (en) Method and system for cross validation and sharing of blacklist and multiple parties
CN110705893A (en) Service node management method, device, equipment and storage medium
US20220239668A1 (en) Blockchain-based message processing method and apparatus, device, and storage medium
CN111679978A (en) Program testing method, program testing device, electronic equipment and storage medium
CN113950679A (en) Validating a measurement dataset using speaker consensus
CN109858257B (en) Access control method and device
CN112713996B (en) Block chain-based fault verification method, server and terminal
CN113221151A (en) Data processing method and device based on block chain and storage medium
CN114157613A (en) Data reporting method, gateway, server, electronic device and storage medium
CN111552746B (en) Data synchronization method, device, electronic equipment and storage medium
CN110519287B (en) Information management method and related equipment
CN112685077A (en) Data modification method, system, computer device and computer readable storage medium
CN108882230B (en) Call record management method, device and system
CN117010889A (en) Data processing method, device, equipment, medium and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination