A data processing method, device and storage medium
By processing data through blockchain smart contracts and storing it in a database according to data attributes, the problem of low query efficiency caused by single data storage is solved, and the diversity and reliability of data storage are achieved.
Patent Information
- Application Number
- CN202010273708.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-09
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2040-08-28
AI Technical Summary
Existing technologies use a single data storage method, which requires comparing the entire dataset for filtering when querying data, resulting in low efficiency and the need to query irrelevant information as well.
By using smart contracts on the blockchain, sub-data and their attributes of the data to be processed are obtained, stored in the database according to the attributes, and data blocks are generated and added to the blockchain, thus achieving diversified data storage.
It improves the diversity of data storage and query efficiency, and enhances the reliability and security of data.
Smart Images

Figure CN111488372B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a data processing method, device and storage medium. Background Technology
[0002] With the advent of the mobile internet era, the level of mobility in society has gradually increased, and data has played an increasingly significant role in various industries. Big data can be used for information mining, but there are still many shortcomings in the use of data. For example, when storing data in a database, it is usually stored as a whole, and the data storage method is too simplistic. This leads to the need to compare and filter the entire data when querying it, and to compare and query irrelevant information in the data. Summary of the Invention
[0003] This application provides a data processing method, device, and storage medium that can improve the diversity of data storage and enhance data reliability.
[0004] One embodiment of this application provides a data processing method, which may include:
[0005] Obtain a storage instruction for the data to be processed in the blockchain, generate a contract call block containing contract call functions according to the storage instruction, and when the contract call block passes consensus verification, trigger a smart contract to obtain confirmation information corresponding to the data to be processed, and obtain the data to be processed from the blockchain block according to the confirmation information;
[0006] Obtain at least two sub-data points of the data to be processed and the data attributes corresponding to each sub-data point respectively; store the data to be processed in the database according to the at least two sub-data points and the data attributes corresponding to the sub-data points; determine the data to be processed stored in the database as the target data; the target data is data with a database storage format.
[0007] The database storing the target data is generated into a data block through the smart contract of the blockchain, and the data block is added to the blockchain.
[0008] One embodiment of this application provides a data processing device, which may include:
[0009] The storage instruction acquisition unit is used to acquire storage instructions for data to be processed in the blockchain, generate a contract call block containing contract call functions according to the storage instructions, and trigger a smart contract to acquire confirmation information corresponding to the data to be processed when the contract call block passes consensus verification, and retrieve the data to be processed from the blockchain block according to the confirmation information.
[0010] The target data acquisition unit is used to acquire at least two sub-data of the data to be processed and the data attributes corresponding to each sub-data, store the data to be processed in the database according to the at least two sub-data and the data attributes corresponding to the sub-data, and determine the data to be processed stored in the database as target data, wherein the target data is data with a database storage format;
[0011] A block generation unit is used to generate data blocks from the database storing the target data through the smart contract of the blockchain, and add the data blocks to the blockchain.
[0012] Specifically, the storage instruction acquisition unit is used for:
[0013] Obtain a storage instruction for the data to be processed in the blockchain, the storage instruction carrying user information and address information;
[0014] A contract call block containing contract call functions is generated according to the storage instructions. When the contract call block passes consensus verification, the smart contract is triggered to obtain confirmation information corresponding to the data to be processed. Based on the confirmation information, encrypted data is obtained from the block of the blockchain corresponding to the address information.
[0015] The encrypted data is decrypted using the user's private key corresponding to the user information to obtain the decrypted data, which is then identified as the data to be processed.
[0016] Specifically, the target data acquisition unit is used for:
[0017] At least two sub-data points of the data to be processed are obtained, and the data attributes corresponding to the sub-data points are determined according to the data format of the sub-data points; the at least two sub-data points are used to constitute the data to be processed.
[0018] Based on the data attributes of the sub-data, the sub-data is stored in a target address in the database; the target address is used to store data with the aforementioned data attributes.
[0019] The data to be processed stored in the database is identified as the target data.
[0020] Specifically, the block generation unit is used for:
[0021] Obtain the data storage private key, and use the data storage private key to encrypt the database storing the target data to generate an encrypted database;
[0022] Through the smart contracts of the blockchain.
[0023] The encrypted database is recorded in the block body, a Merkle tree of the encrypted database is generated in the block body, and the value of the root of the Merkle tree is saved in the block header;
[0024] The data in the block header of the previous block is used to generate a hash value through a hash algorithm, and the hash value is written into the parent hash value of the block header;
[0025] The current time is stored in the timestamp field of the block header, the block body and the block header are combined to generate a data block, and the data block is added to the blockchain.
[0026] This also includes:
[0027] An information adding unit is used to retrieve the corresponding identifier information from an identifier list when the storage instruction carries the user's user information; the identifier list stores the correspondence between user information and identifier information.
[0028] Based on the user information in the storage instruction, the identification information is added to the target data corresponding to the data to be processed in the database.
[0029] This also includes:
[0030] An access permission determination unit is used to determine the access permissions of the database based on the smart contract of the blockchain.
[0031] Obtain the identification information of the target data in the database, retrieve the user information corresponding to the identification information from the identification list, and set the access permission of the user information to the database to allow access.
[0032] This also includes:
[0033] The data query unit is used to obtain query instructions for the database stored in the blockchain;
[0034] Based on the query instruction, retrieve the target data associated with the query instruction from the database.
[0035] One embodiment of this application provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor and executing the above-described method steps.
[0036] One embodiment of this application provides a computer device, including a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed by the above-described method steps.
[0037] In this embodiment, a storage instruction for data to be processed in the blockchain is obtained, and the data to be processed is retrieved from the blockchain block according to the storage instruction; at least two sub-data points of the data to be processed and the data attributes corresponding to each sub-data point are obtained, and the data to be processed is stored in a database according to the at least two sub-data points and the corresponding data attributes; the data to be processed stored in the database is determined as target data, and the target data is data with a database storage format; through the smart contract of the blockchain, the database storing the target data is generated into a data block, and the data block is added to the blockchain. By storing data using data attributes and corresponding sub-data points, the data stored in the above manner can be queried according to the data attributes, improving the diversity of data storage; and by processing the data through the blockchain, the reliability of the data is improved. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1a This is a system architecture diagram of data processing provided in an embodiment of this application;
[0040] Figure 1b This is a schematic diagram of a distributed system scenario provided in an embodiment of this application;
[0041] Figure 1c This is a schematic diagram of a block structure provided in an embodiment of this application;
[0042] Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application;
[0043] Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application;
[0044] Figure 4 This is a schematic diagram of a data processing scenario provided in an embodiment of this application;
[0045] Figure 5 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application;
[0046] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0047] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0048] Please see Figure 1a This is a system architecture diagram for data processing provided in an embodiment of the present invention. Blockchain 10f establishes a connection with a user terminal cluster via a communication bus. The user terminal cluster may include: user terminal 10a, user terminal 10b, ..., user terminal 10c. Blockchain 10f includes blockchain nodes 10d, ..., blockchain nodes 10e. Blockchain 10f obtains a storage instruction for the data to be processed in the blockchain, and retrieves the data to be processed from the blocks of the blockchain according to the storage instruction; Blockchain 10f obtains at least two sub-data points of the data to be processed and the data attributes corresponding to each sub-data point, and stores the data to be processed in a database according to the at least two sub-data points and the corresponding data attributes; Blockchain 10f determines the data to be processed stored in the database as target data, and the target data is data with a database storage format; Blockchain 10f generates a data block from the database storing the target data through the smart contract of the blockchain, and adds the data block to the blockchain.
[0049] The user terminals include: tablet computers, smartphones, personal computers (PCs), laptops, handheld computers, and other terminal devices.
[0050] The blockchain involved in this application embodiment is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. A blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.
[0051] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operational monitoring. The user management module is responsible for managing the identity information of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the correspondence between user real identities and blockchain addresses (access management). Furthermore, under authorization, it monitors and audits transactions of certain real identities and provides risk control rule configuration (risk control audit). The basic services module is deployed on all blockchain node devices to verify the validity of business requests. After consensus is reached on valid requests, they are recorded in storage. For a new business request, the basic services first perform interface adaptation parsing and authentication (interface adaptation), and then encrypt the business information through a consensus algorithm (consensus management). After encryption, the data is transmitted completely and consistently to the shared ledger (network communication) and recorded and stored. The smart contract module is responsible for contract registration, issuance, triggering, and execution. Developers can define contract logic using a programming language and publish it to the blockchain (contract registration). According to the contract terms, the key or other events are invoked to trigger execution and complete the contract logic. It also provides functions for contract upgrades and cancellations. The operation monitoring module is mainly responsible for deployment, configuration modification, contract settings, cloud adaptation, and real-time status visualization output during product release, such as alarms, monitoring network conditions, and monitoring the health status of node devices.
[0052] The platform's product service layer provides the basic capabilities and implementation frameworks for typical applications. Developers can leverage these basic capabilities, along with the specific characteristics of their business needs, to implement blockchain-based business logic. The application service layer provides blockchain-based application services to business stakeholders.
[0053] The following will combine Figure 1b and Figure 1c The following describes specific implementation scenarios provided in the embodiments of this application. The blockchain network involved in the embodiments of this invention can be a distributed system formed by connecting clients and multiple nodes (any form of computing device in the network, such as servers and user terminals) through network communication.
[0054] Taking a distributed system as an example, see blockchain system. Figure 1b , Figure 1bThis is an optional structural diagram of the distributed system 100 provided in this embodiment of the invention applied to a blockchain system. It consists of multiple nodes (any form of computing device in the network, such as servers or user terminals) and clients, forming a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In the distributed system, any machine, such as a server or terminal, can join and become a node. A node includes a hardware layer, a middleware layer, an operating system layer, and an application layer.
[0055] See Figure 1b The functions of each node in the blockchain system shown include:
[0056] 1) Routing: A basic function of nodes used to support communication between nodes.
[0057] In addition to routing capabilities, nodes can also have the following functions:
[0058] 2) Applications are deployed in the blockchain to implement specific business needs. They record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system. When other nodes successfully verify the source and integrity of the record data, they add the record data to a temporary block.
[0059] For example, the business logic implemented by the application includes:
[0060] 2.1) A wallet is used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system; after other nodes successfully verify the transaction, they store the transaction record data in the temporary block of the blockchain as a response to acknowledge the validity of the transaction; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;
[0061] 2.2) Shared ledger, used to provide functions such as storage, query and modification of ledger data. It sends the record data of the operation on the ledger data to other nodes in the blockchain system. After the other nodes verify the validity, as a response to acknowledge the validity of the ledger data, they store the record data in a temporary block. They can also send confirmation to the node that initiated the operation.
[0062] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented through code deployed on a shared ledger that executes when certain conditions are met. Based on actual business needs, the code is used to complete automated transactions, such as querying the logistics status of goods purchased by a buyer and transferring the buyer's electronic money to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions; they can also execute contracts for processing received information.
[0063] 3) A blockchain consists of a series of blocks that are sequentially generated. Once a new block is added to the blockchain, it will not be removed. The blocks record the data submitted by the nodes in the blockchain system.
[0064] See Figure 1c , Figure 1c This is an optional schematic diagram of the block structure provided in this embodiment of the invention. Each block includes the hash value of the transaction records stored in this block (the hash value of this block) and the hash value of the previous block. The blocks are connected through their hash values to form a blockchain. Additionally, the block may include information such as a timestamp when it was generated. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains relevant information used to verify the validity of the information (anti-counterfeiting) and to generate the next block.
[0065] Please see Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application. Figure 2 As shown, the method described in this application embodiment may include the following steps S101-S103.
[0066] S101, obtain a storage instruction for the data to be processed in the blockchain, generate a contract call block containing contract call functions according to the storage instruction, and when the contract call block passes consensus verification, trigger a smart contract to obtain confirmation information corresponding to the data to be processed, and obtain the data to be processed from the block of the blockchain according to the confirmation information;
[0067] Specifically, the data processing device obtains a storage instruction for the data to be processed in the blockchain, and retrieves the data to be processed from the blocks of the blockchain according to the storage instruction. It can be understood that the data processing device can be... Figure 1aIn the blockchain 10f, the contract call function is a function contained in a smart contract, which is applicable to the data processing process in this application. When the smart contract is created, a contract call function is written into it. When triggered, the program code within the contract call function is executed, and the function name is packaged into a contract call block. Consensus is reached on this contract call block. The contract call function includes at least one function. The confirmation information indicates that, after consensus is reached, the data to be processed is allowed to be retrieved. The data to be processed is data stored in the blockchain, specifically encrypted data within a block. The storage instruction can be a click instruction or a touch screen instruction. The storage instruction carries user information and address information. The user information is the user information corresponding to the user who sent the storage instruction, and the address information is the storage address information of the data to be processed in the blockchain. The data to be processed is retrieved from the blockchain block according to the storage instruction. Since the storage instruction carries address information, the address information can be obtained from the storage instruction, and the data to be processed can be retrieved from the block corresponding to the address information.
[0068] S102, obtain at least two sub-data of the data to be processed and the data attributes corresponding to each sub-data respectively, store the data to be processed in the database according to the at least two sub-data and the data attributes corresponding to the sub-data, and determine the data to be processed stored in the database as target data, wherein the target data is data with a database storage format;
[0069] Specifically, the data processing device acquires at least two sub-data points of the data to be processed and the data attributes corresponding to each sub-data point. Based on the at least two sub-data points and their corresponding data attributes, the data to be processed is stored in a database. The data stored in the database is then identified as the target data. It is understood that data attributes are characteristics of data. Each piece of data to be processed may include multiple sub-data points, and each sub-data point corresponds to a data attribute. Specifically, the data attribute corresponding to a sub-data point can be determined based on its data format or its tag. For example, if the data attributes in the database include name information and address information, and the data format of sub-data point "AA" is the same as that of sub-data points in the database whose data attribute is address information, then the data attribute of sub-data point "AA" is address information. The data attributes of each sub-data point in the data to be processed are determined, and the data to be processed is stored in the database based on the data attributes of each sub-data point. The data stored in the database is then identified as the target data.
[0070] S103, through the smart contract of the blockchain, generate a data block from the database storing the target data, and add the data block to the blockchain.
[0071] Specifically, the data processing device, through the blockchain's smart contract, generates data blocks from the database storing the target data and adds these data blocks to the blockchain. This means that, through the blockchain's smart contract, a data block is generated based on the hash value of the previous block and the database storing the target data, and then added to the blockchain. Simultaneously, the database containing the target data can also be encrypted; specifically, asymmetric encryption can be used to generate an encrypted database, which is then stored.
[0072] In this embodiment, a storage instruction for data to be processed in the blockchain is obtained, and the data to be processed is retrieved from the blockchain block according to the storage instruction; at least two sub-data points of the data to be processed and the data attributes corresponding to each sub-data point are obtained, and the data to be processed is stored in a database according to the at least two sub-data points and the corresponding data attributes; the data to be processed stored in the database is determined as target data, and the target data is data with a database storage format; through the smart contract of the blockchain, the database storing the target data is generated into a data block, and the data block is added to the blockchain. By storing data using data attributes and corresponding sub-data points, the data stored in the above manner can be queried according to the data attributes, improving the diversity of data storage; and by processing the data through the blockchain, the reliability of the data is improved.
[0073] Please see Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application. Figure 3 As shown, the method described in this application embodiment may include the following steps S201-S208.
[0074] S201, Obtain a storage instruction for the data to be processed in the blockchain, the storage instruction carrying user information and address information;
[0075] Specifically, the data processing device acquires a storage instruction for the data to be processed in the blockchain. The storage instruction carries user information and address information. It can be understood that the data to be processed is data stored in the blockchain, specifically encrypted data in a block. The storage instruction is an operation instruction for the data to be processed, specifically a click instruction or a touch screen instruction. The storage instruction carries user information and address information. The user information is the user information corresponding to the user who sent the storage instruction. The user information can be the user's ID card information, mobile phone number, etc. The address information is the storage address information of the data to be processed in the blockchain, and the address information can be associated with the user information.
[0076] S202, a contract call block containing contract call functions is generated according to the storage instruction. When the contract call block passes consensus verification, the smart contract is triggered to obtain confirmation information corresponding to the data to be processed. The encrypted data is obtained from the blockchain block corresponding to the address information according to the confirmation information. The encrypted data is decrypted using the user private key corresponding to the user information to obtain the decrypted data. The decrypted data is then identified as the data to be processed.
[0077] Specifically, the data processing device retrieves encrypted data from the blockchain block corresponding to the address information according to the storage instruction; decrypts the encrypted data using the user's private key corresponding to the user information to obtain decrypted data, and identifies the decrypted data as data to be processed. It can be understood that the address information and user information are retrieved from the storage instruction, and the encrypted data is retrieved from the block corresponding to the address information. The encrypted data is generated by the user corresponding to the user information using asymmetric encryption methods with the user's public key. The encrypted data is decrypted using the user's private key corresponding to the user information. The user's key includes the user's public key and user's private key. The decrypted data is identified as data to be processed.
[0078] S203, acquire at least two sub-data of the data to be processed, and determine the data attributes corresponding to the sub-data according to the data format of the sub-data; the at least two sub-data are used to constitute the data to be processed;
[0079] Specifically, the data processing device acquires at least two sub-data of the data to be processed, and determines the data attribute corresponding to the sub-data according to the data format of the sub-data. It can be understood that the data attribute is a feature of the data. Each piece of data to be processed may include multiple sub-data, and each sub-data corresponds to a data attribute. That is, each piece of data includes at least two data attributes. The data attribute corresponding to the sub-data is determined according to the data format of the sub-data. For example, if the data format of the sub-data "AA" is the same as that of the sub-data whose data attribute is address information, then the data attribute of the sub-data "AA" is address information.
[0080] S204, based on the data attributes of the sub-data, store the sub-data in the target address of the database; the target address is used to store data with the data attributes; the data to be processed stored in the database is determined as the target data.
[0081] Specifically, the data processing device stores the sub-data in a target address in the database according to the data attributes of the sub-data; the target address is used to store data with the data attributes; the data to be processed stored in the database is determined as the target data. It can be understood that the data attributes of each sub-data in the data to be processed are determined, the target address corresponding to the sub-data in the database is determined, and the sub-data is stored in the target address in the database. When all the sub-data of the data to be processed are stored in the database, the data to be processed stored in the database is determined as the target data.
[0082] S205, obtain the data storage private key, use the data storage private key to encrypt the database storing the target data to generate an encrypted database; through the smart contract of the blockchain, generate data blocks from the encrypted database, and add the data blocks to the blockchain.
[0083] Specifically, the data processing device acquires the data storage private key, uses the data storage private key to encrypt the database storing the target data, generating an encrypted database. Through the blockchain's smart contract, the encrypted database is used to generate data blocks, which are then added to the blockchain. It is understood that the storage private key is the private key corresponding to the blockchain. The database storing the target data is encrypted using the data storage private key, employing asymmetric encryption to generate the encrypted database. The encrypted database can be decrypted using the public key corresponding to the storage private key to view the database. Through the blockchain's smart contract, the encrypted database is recorded in the block body. The block includes a block body and a block header. A Merkle tree of the encrypted database is generated in the block body. The value of the Merkle tree root is saved in the block header. The data in the previous block's block header is hashed using a hash algorithm to generate a hash value, which is written into the parent hash value of the block header. The current time is saved in the timestamp field of the block header. The block body and the block header are combined to generate a data block, which is then added to the blockchain. Please see Figure 4 This provides a schematic diagram of a data processing scenario for an embodiment of this application. For example... Figure 4 As shown, the blockchain obtains a storage instruction for the data to be processed in the block, retrieves the data to be processed from the block according to the smart contract, obtains sub-data of the data to be processed, determines the data attributes corresponding to the sub-data according to the data format of the sub-data, stores the sub-data in the database according to the data attributes of the sub-data, determines the data to be processed stored in the database as the target data, obtains the data storage private key, encrypts the database storing the target data using the data storage private key to generate an encrypted database, and processes the encrypted database on the blockchain through the blockchain's smart contract.
[0084] S206, the storage instruction carries user information and retrieves the identifier information corresponding to the user information from the identifier list; the identifier list stores the correspondence between user information and identifier information; according to the user information in the storage instruction, the identifier information is added to the target data corresponding to the data to be processed in the database.
[0085] Specifically, the data processing device retrieves the identifier information corresponding to the user information from the identifier list; based on the user information in the storage instruction, it adds the identifier information to the target data corresponding to the data to be processed in the database. It is understood that the identifier list stores the correspondence between user information and identifier information. The identifier information can be numbers or letters. The data processing device retrieves the identifier information corresponding to the user information from the identifier list, determines the identifier information corresponding to the data to be processed based on the data to be processed corresponding to the user information, and adds the identifier information to the target data corresponding to the data to be processed in the database. The identifier information can serve as a data attribute of the target data. When performing data queries, data can be filtered based on the data identifier. By adding data attributes that can be used for data filtering, the efficiency of data querying in the database can be improved.
[0086] S207, Based on the smart contract of the blockchain, determine the access permissions of the database; obtain the identification information of the target data in the database, obtain the user information corresponding to the identification information from the identification list, and set the access permissions of the user information to the database to allow access.
[0087] Specifically, the data processing device determines the access permissions of the database based on the smart contract of the blockchain; it obtains the identification information of the target data in the database, retrieves the user information corresponding to the identification information from the identification list, and sets the user information's access permission to the database to allowed access. It is understood that the access permissions of the database can be preset, written into a smart contract, and the database access permissions can be set by running the smart contract. Furthermore, the user information storing data in the database is set to have allowed access to the database. Specifically, obtaining the identification information of the target data in the database, retrieving the user information corresponding to the identification information from the identification list, and setting the user information's access permission to the database to allowed access ensures that only user information with allowed access can access the database, thus improving the security of the data in the database.
[0088] S208, Obtain a query instruction for a database stored in the blockchain; Based on the query instruction, retrieve the target data associated with the query instruction from the database.
[0089] Specifically, the data processing device acquires a query instruction for a database stored in the blockchain; based on the query instruction, it retrieves the target data associated with the query instruction from the database. It can be understood that the query instruction is an operation instruction for the target data in the database. The query instruction carries query conditions and user information. The query conditions are the criteria for querying data from the database, and the data that meets the query conditions is the required data. For example, the database stores multiple data, each including identity information, address information, contact information, etc. The query condition could be data with the address information "XX". The user information is the user information corresponding to the user who sent the query instruction, such as the user's ID card information, mobile phone number, etc. Based on the query conditions in the query instruction, the data attributes of the query conditions in the database are determined, and the target data that meets the query conditions is retrieved from the database based on the data attributes.
[0090] In this embodiment, a storage instruction for data to be processed in the blockchain is obtained, and the data to be processed is retrieved from the blockchain block according to the storage instruction; at least two sub-data points of the data to be processed and the data attributes corresponding to each sub-data point are obtained, and the data to be processed is stored in a database according to the at least two sub-data points and the corresponding data attributes; the data to be processed stored in the database is determined as target data, and the target data is data with a database storage format; through the smart contract of the blockchain, the database storing the target data is generated into a data block, and the data block is added to the blockchain. By using data attributes and corresponding sub-data points to store data, the diversity of data storage is improved; data stored in the above manner can be queried according to data attributes, improving the efficiency of data query; by setting access permissions for user information, the security of data in the database is improved; and by processing data through the blockchain, the reliability of data is improved.
[0091] Please see Figure 5 This document provides a schematic diagram of the structure of a data processing device according to an embodiment of this application. The data processing device may be a computer program (including program code) running on a computer device; for example, the data processing device may be an application software. This device can be used to execute corresponding steps in the methods provided in the embodiments of this application. Figure 5 As shown, the data processing device 1 in this application embodiment may include: a storage instruction acquisition unit 11, a target data acquisition unit 12, and a block generation unit 13.
[0092] The storage instruction acquisition unit 11 is used to acquire storage instructions for data to be processed in the blockchain, generate a contract call block containing contract call functions according to the storage instructions, and trigger a smart contract to acquire confirmation information corresponding to the data to be processed when the contract call block passes consensus verification, and acquire the data to be processed from the block of the blockchain according to the confirmation information.
[0093] The target data acquisition unit 12 is used to acquire at least two sub-data of the data to be processed and the data attributes corresponding to each sub-data, store the data to be processed in the database according to the at least two sub-data and the data attributes corresponding to the sub-data, and determine the data to be processed stored in the database as target data. The target data is data with a database storage format.
[0094] The block generation unit 13 is used to generate data blocks from the database storing the target data through the smart contract of the blockchain, and add the data blocks to the blockchain.
[0095] The storage instruction acquisition unit 11 is specifically used for:
[0096] Obtain a storage instruction for the data to be processed in the blockchain, the storage instruction carrying user information and address information;
[0097] A contract call block containing contract call functions is generated according to the storage instructions. When the contract call block passes consensus verification, the smart contract is triggered to obtain confirmation information corresponding to the data to be processed. Based on the confirmation information, encrypted data is obtained from the block of the blockchain corresponding to the address information.
[0098] The encrypted data is decrypted using the user's private key corresponding to the user information to obtain the decrypted data, which is then identified as the data to be processed.
[0099] The target data acquisition unit 12 is specifically used for:
[0100] At least two sub-data points of the data to be processed are obtained, and the data attributes corresponding to the sub-data points are determined according to the data format of the sub-data points; the at least two sub-data points are used to constitute the data to be processed.
[0101] Based on the data attributes of the sub-data, the sub-data is stored in a target address in the database; the target address is used to store data with the aforementioned data attributes.
[0102] The data to be processed stored in the database is identified as the target data.
[0103] The block generation unit 13 is specifically used for:
[0104] Obtain the data storage private key, and use the data storage private key to encrypt the database storing the target data to generate an encrypted database;
[0105] The encrypted database is recorded in the block body through the smart contract of the blockchain, a Merkle tree of the encrypted database is generated in the block body, and the value of the root of the Merkle tree is saved in the block header.
[0106] The data in the block header of the previous block is used to generate a hash value through a hash algorithm, and the hash value is written into the parent hash value of the block header;
[0107] The current time is stored in the timestamp field of the block header, the block body and the block header are combined to generate a data block, and the data block is added to the blockchain.
[0108] Please see Figure 5 The data processing device 1 described in this application embodiment may include: an information adding unit 14, an access permission determining unit 15, and a data querying unit 16.
[0109] Information adding unit 14 is used to retrieve the identifier information corresponding to the user information from the identifier list when the storage instruction carries the user's user information; the identifier list stores the correspondence between user information and identifier information;
[0110] Based on the user information in the storage instruction, the identification information is added to the target data corresponding to the data to be processed in the database.
[0111] Access permission determination unit 15 is used to determine the access permissions of the database according to the smart contract of the blockchain;
[0112] Obtain the identification information of the target data in the database, retrieve the user information corresponding to the identification information from the identification list, and set the access permission of the user information to the database to allow access.
[0113] The data query unit 16 is used to obtain query instructions for the database stored in the blockchain;
[0114] Based on the query instruction, retrieve the target data associated with the query instruction from the database.
[0115] In this embodiment, a storage instruction for data to be processed in the blockchain is obtained, and the data to be processed is retrieved from the blockchain block according to the storage instruction; at least two sub-data points of the data to be processed and the data attributes corresponding to each sub-data point are obtained, and the data to be processed is stored in a database according to the at least two sub-data points and the corresponding data attributes; the data to be processed stored in the database is determined as target data, and the target data is data with a database storage format; through the smart contract of the blockchain, the database storing the target data is generated into a data block, and the data block is added to the blockchain. By storing data using data attributes and corresponding sub-data points, the data stored in the above manner can be queried according to the data attributes, improving the diversity of data storage; and by processing the data through the blockchain, the reliability of the data is improved.
[0116] Please see Figure 6 This document provides a schematic diagram of the structure of a computer device according to an embodiment of this application. Figure 6 As shown, the computer device 1000 may include: at least one processor 1001, such as a CPU, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen, and optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1005 may also be at least one storage device located remotely from the aforementioned processor 1001. Figure 6 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a data processing application program.
[0117] exist Figure 6 In the computer device 1000 shown, the network interface 1004 provides network communication functions, the user interface 1003 is mainly used to provide an input interface for the user, and the processor 1001 can be used to call the data processing application stored in the memory 1005 to achieve the above. Figures 2-4 The description of the data processing method in any corresponding embodiment will not be repeated here.
[0118] It should be understood that the computer device 1000 described in the embodiments of this application can execute the foregoing text. Figures 2-4 The description of the data processing method in any corresponding embodiment can also be performed as described above. Figure 5 The description of the data processing device in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated.
[0119] Furthermore, it should be noted that this application also provides a computer-readable storage medium storing a computer program executed by the aforementioned data processing device. The computer program includes program instructions, and when the processor executes the program instructions, it can execute the aforementioned... Figures 2-4 The description of the data processing method in any corresponding embodiment is already provided, and therefore will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the computer-readable storage medium embodiments related to this application, please refer to the description of the method embodiments of this application. As an example, program instructions may be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network. These multiple computing devices distributed across multiple locations and interconnected via a communication network can constitute a blockchain system.
[0120] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0121] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A data processing method, characterized in that, include: Obtain a storage instruction for the data to be processed in the blockchain, generate a contract call block containing contract call functions according to the storage instruction, and when the contract call block passes consensus verification, trigger a smart contract to obtain confirmation information corresponding to the data to be processed, and obtain the data to be processed from the blockchain block according to the confirmation information; Obtain at least two sub-data points of the data to be processed, and determine the data attributes corresponding to the sub-data points according to the data format of the sub-data points; The at least two sub-data are used to constitute the data to be processed; Determine the target address corresponding to the data attribute of the sub-data in the database, and store the sub-data in the target address in the database; The target address is used to store data with the aforementioned data attributes; The data to be processed stored in the database is identified as the target data, which is data with a database storage format; Through the smart contract of the blockchain, data blocks are generated from the database storing the target data, and the data blocks are added to the blockchain; Retrieve query commands for a database stored in the blockchain; Based on the query conditions in the query instruction, determine the data attributes of the query conditions in the database, locate the target address corresponding to the data attributes of the query conditions in the database, and obtain the data associated with the query instruction from the target address associated with the query conditions in the database.
2. The method according to claim 1, characterized in that, The process involves obtaining a storage instruction for the data to be processed in the blockchain, generating a contract call block containing contract call functions based on the storage instruction, and triggering a smart contract to obtain confirmation information corresponding to the data to be processed when the contract call block passes consensus verification. The process then involves retrieving the data to be processed from the blockchain block based on the confirmation information. Obtain a storage instruction for the data to be processed in the blockchain, the storage instruction carrying user information and address information; A contract call block containing contract call functions is generated according to the storage instructions. When the contract call block passes consensus verification, the smart contract is triggered to obtain confirmation information corresponding to the data to be processed. Based on the confirmation information, encrypted data is obtained from the block of the blockchain corresponding to the address information. The encrypted data is decrypted using the user's private key corresponding to the user information to obtain the decrypted data, which is then identified as the data to be processed.
3. The method according to claim 1, characterized in that, The step of generating data blocks from the database storing the target data through the smart contract of the blockchain, and adding the data blocks to the blockchain, includes: Obtain the data storage private key, and use the data storage private key to encrypt the database storing the target data to generate an encrypted database; The encrypted database is recorded in the block body through the smart contract of the blockchain, a Merkle tree of the encrypted database is generated in the block body, and the value of the root of the Merkle tree is saved in the block header. The data in the block header of the previous block is used to generate a hash value through a hash algorithm, and the hash value is written into the parent hash value of the block header; The current time is stored in the timestamp field of the block header, the block body and the block header are combined to generate a data block, and the data block is added to the blockchain.
4. The method according to claim 1, characterized in that, Also includes: The storage instruction carries the user's user information and retrieves the identifier information corresponding to the user information from the identifier list; The identifier list stores the correspondence between user information and identifier information; Based on the user information in the storage instruction, the identification information is added to the target data corresponding to the data to be processed in the database.
5. The method according to claim 1, characterized in that, Also includes: Access permissions to the database are determined based on the smart contract of the blockchain; Obtain the identification information of the target data in the database, retrieve the user information corresponding to the identification information from the identification list, and set the access permission of the user information to the database to allow access.
6. A data processing device, characterized in that, include: The storage instruction acquisition unit is used to acquire storage instructions for data to be processed in the blockchain, generate a contract call block containing contract call functions according to the storage instructions, and trigger a smart contract to acquire confirmation information corresponding to the data to be processed when the contract call block passes consensus verification, and retrieve the data to be processed from the blockchain block according to the confirmation information. A target data acquisition unit is configured to acquire at least two sub-data points of the data to be processed, and determine the data attributes corresponding to the sub-data points according to the data format of the sub-data points; the at least two sub-data points are used to constitute the data to be processed. The target data acquisition unit is further configured to determine the target address corresponding to the data attribute of the sub-data in the database, and store the sub-data in the target address in the database; the target address is used to store data having the data attribute; The target data acquisition unit is further configured to determine the data to be processed stored in the database as target data, wherein the target data is data with a database storage format; A block generation unit is used to generate data blocks from the database storing the target data through the smart contract of the blockchain, and add the data blocks to the blockchain; The data query unit is used to obtain a query instruction for a database stored in the blockchain, determine the data attribute of the query condition in the database according to the query condition in the query instruction, locate the target address corresponding to the data attribute of the query condition in the database, and obtain the data associated with the query instruction from the target address associated with the query condition in the database.
7. A computer-readable storage medium, characterized in that, The computer storage medium stores a computer program, the computer program including program instructions, which, when executed by a processor, perform the method as described in any one of claims 1-5.
8. A computer device, characterized in that, The method is characterized by comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed as described in any one of claims 1-5.
Citation Information
Patent Citations
Medical data storage method based on block chain technology and information data processing terminal
CN108648784A
Block chain-based test method and device, storage medium and computer equipment
CN110598446A