WO2024001029A1 - 一种维护区块链数据的方法、装置、电子设备和存储介质 - Google Patents
一种维护区块链数据的方法、装置、电子设备和存储介质 Download PDFInfo
- Publication number
- WO2024001029A1 WO2024001029A1 PCT/CN2022/135428 CN2022135428W WO2024001029A1 WO 2024001029 A1 WO2024001029 A1 WO 2024001029A1 CN 2022135428 W CN2022135428 W CN 2022135428W WO 2024001029 A1 WO2024001029 A1 WO 2024001029A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- blockchain
- data
- relational database
- ciphertext
- node
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 80
- 238000007405 data analysis Methods 0.000 claims abstract description 60
- 238000004458 analytical method Methods 0.000 claims abstract description 40
- 238000012795 verification Methods 0.000 claims abstract description 10
- 238000004364 calculation method Methods 0.000 claims description 22
- 238000006243 chemical reaction Methods 0.000 claims description 19
- 230000004044 response Effects 0.000 claims description 10
- 238000012423 maintenance Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 description 21
- 238000010586 diagram Methods 0.000 description 14
- 230000006870 function Effects 0.000 description 14
- 238000012545 processing Methods 0.000 description 14
- 238000005516 engineering process Methods 0.000 description 11
- 230000006872 improvement Effects 0.000 description 9
- 238000004590 computer program Methods 0.000 description 8
- 230000008520 organization Effects 0.000 description 7
- 239000000047 product Substances 0.000 description 5
- 230000005012 migration Effects 0.000 description 4
- 238000013508 migration Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000010205 computational analysis Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 230000008093 supporting effect Effects 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 108010001267 Protein Subunits Proteins 0.000 description 1
- 238000004873 anchoring Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000006227 byproduct Substances 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000013075 data extraction Methods 0.000 description 1
- 238000013501 data transformation Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 230000001976 improved effect Effects 0.000 description 1
- 230000001939 inductive effect Effects 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000011068 loading method Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 229920001296 polysiloxane Polymers 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 239000010979 ruby Substances 0.000 description 1
- 229910001750 ruby Inorganic materials 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/008—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols involving homomorphic encryption
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3218—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using proof of knowledge, e.g. Fiat-Shamir, GQ, Schnorr, ornon-interactive zero-knowledge proofs
- H04L9/3221—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using proof of knowledge, e.g. Fiat-Shamir, GQ, Schnorr, ornon-interactive zero-knowledge proofs interactive zero-knowledge proofs
Definitions
- the embodiments of this specification belong to the field of blockchain technology, and particularly relate to a method, device, electronic device and storage medium for maintaining blockchain data.
- Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
- data blocks are combined into a chained data structure in a chronological manner and are cryptographically guaranteed to be an untamperable and unforgeable distributed ledger.
- non-relational databases In traditional blockchain technology, in order to meet the storage needs of blockchain nodes for large amounts of data when running blockchain services, blockchain nodes usually use non-relational databases with efficient access efficiency for data storage.
- non-relational databases lack transaction relationships, lack connections between data and are not standardized, which is not conducive to data analysis. Relational databases have complete transaction relationships, connections between data and a strict standardized structure. If the non-relational database in traditional blockchain technology is replaced by a relational database, although it is beneficial to data analysis, it will not be used in the block chain.
- the direct use of relational databases in the chain's underlying system will bring huge challenges to the online read and write performance of blockchain nodes when running blockchain services. Therefore, how to implement convenient data analysis services while ensuring that the blockchain service execution process has high access efficiency is an urgent problem in this field that needs to be solved.
- the purpose of the present invention is to provide a method, device, electronic device and storage medium for maintaining blockchain data.
- a method for maintaining blockchain data is proposed, which is applied to node devices deployed with blockchain nodes, and the node devices maintain blockchain non-relational Database and blockchain relational database.
- the blockchain non-relational database is used to maintain homomorphic ciphertext data and its corresponding zero-knowledge proof.
- the homomorphic ciphertext data is run by the blockchain node.
- the blockchain data generated during the blockchain service is obtained through homomorphic encryption; the method includes:
- the standard data is maintained in the blockchain relational database.
- the blockchain relational database is used to provide data analysis services to analysis demanders.
- the data analysis services include ciphertext computing services.
- a device for maintaining blockchain data is proposed, which is applied to node equipment deployed with blockchain nodes, and the node equipment maintains blockchain non-relational Database and blockchain relational database.
- the blockchain non-relational database is used to maintain homomorphic ciphertext data and its corresponding zero-knowledge proof.
- the homomorphic ciphertext data is run by the blockchain node.
- the blockchain data generated during the blockchain service is obtained through homomorphic encryption; the device includes:
- a homomorphic ciphertext data acquisition unit used to acquire the homomorphic ciphertext data maintained in the blockchain non-relational database and its corresponding zero-knowledge proof;
- a data conversion unit configured to convert the homomorphic ciphertext data into standard data defined by the database schema information corresponding to the blockchain relational database when the zero-knowledge proof verification is successful;
- a standard data maintenance unit is used to maintain the standard data in the blockchain relational database.
- the blockchain relational database is used to provide data analysis services to analysis demanders.
- the data analysis services include passwords. Text computing services.
- an electronic device including:
- Memory used to store instructions executable by the processor
- the processor implements the method described in the first aspect by running the executable instructions.
- a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
- the embodiment of this specification separately deploys a blockchain non-relational database and a blockchain relational database on node devices.
- the blockchain non-relational database is used to maintain and run blockchain services on blockchain nodes.
- the homomorphic ciphertext data obtained by encrypting the generated blockchain data and its corresponding zero-knowledge proof enable the blockchain node to efficiently store the encrypted blockchain data and perform homomorphic processing when running the blockchain service. Efficient reading of ciphertext data; on the other hand, by converting homomorphic ciphertext data maintained in the blockchain non-relational database into standard data and synchronously maintaining it in the blockchain relational database, thereby utilizing blocks Chain relational database realizes convenient data analysis services.
- the method for maintaining blockchain data involved in the embodiments of this specification realizes the backup of one data in two places, objectively improves the disaster recovery capability, and realizes convenient data access while ensuring efficient access efficiency during the execution of the blockchain service.
- Analysis service at the same time, because the backed up data is not the plain text of blockchain data but the homomorphic ciphertext data obtained after encryption, and the data analysis service includes ciphertext computing service, it is possible to ensure data security through ciphertext while providing Basic computational analysis capabilities for ciphertext.
- Figure 1 is a flow chart of a method for maintaining blockchain data provided by an exemplary embodiment.
- Figure 2 is a system architecture diagram for maintaining blockchain data provided by an exemplary embodiment.
- Figure 3 is a schematic structural diagram of a device provided by an exemplary embodiment.
- Figure 4 is a block diagram of a device for maintaining blockchain data provided in an exemplary embodiment.
- Figure 1 is a flow chart of a method for maintaining blockchain data provided by an exemplary embodiment. This method is applied to node equipment deployed with blockchain nodes.
- the node equipment maintains a blockchain non-relational database and a blockchain relational database.
- the blockchain non-relational database is used to maintain homomorphic encryption. Text data and its corresponding zero-knowledge proof, the homomorphic ciphertext data is obtained by the blockchain node through homomorphic encryption of the blockchain data generated when running the blockchain service; the method includes:
- FIG. 2 is a system architecture diagram for maintaining blockchain data provided by an exemplary embodiment.
- each blockchain node in the blockchain network is deployed on the corresponding node device, and each node device maintains both a blockchain non-relational database and a blockchain relational database.
- the blockchain non-relational database belongs to the non-relational database
- the blockchain relational database belongs to the relational database.
- the blockchain non-relational database serves as the native database for blockchain nodes to run blockchain services, that is, as part of the infrastructure of the underlying system of the blockchain, it is used to run blockchain services on blockchain nodes.
- the blockchain data generated during the process is efficiently accessed.
- the blockchain node uses it as a substitute for directly storing the blockchain data when it needs to store the blockchain data in the blockchain non-relational database.
- the blockchain node can first perform homomorphic encryption on the blockchain data to obtain homomorphic ciphertext data, and then store the homomorphic ciphertext data in the blockchain non-relational database, thereby avoiding direct storage of plaintext data and inducing data leakage.
- the blockchain non-relational database is also used to maintain blockchain data generated when the blockchain node will run the blockchain service, that is It is said that some blockchain data with low privacy requirements can be directly accessed in plain text in the blockchain non-relational database.
- the blockchain node due to the need to ensure that the homomorphic ciphertext data has credentials that can be proven to be valid, the blockchain node while storing any homomorphic ciphertext data in the blockchain non-relational database, also A corresponding zero-knowledge proof will be generated for any homomorphic ciphertext data.
- the zero-knowledge proof corresponding to any homomorphic ciphertext data is used to prove to a third party the plaintext data (i.e., the area before encryption) corresponding to any homomorphic ciphertext data.
- Blockchain data has specific data attributes, such as the range of data values, whether the data belongs to a specified set, whether the data is generated by specified operation logic, etc. The specific information proved depends on the functional semantic definition in the actual scenario, in terms of capabilities No distinction is made, and this specification does not limit the specific types of zero-knowledge proofs. Therefore, any homomorphic ciphertext data maintained in the blockchain non-relational database involved in the embodiment of this specification is jointly maintained with a corresponding zero-knowledge proof.
- Blockchain non-relational databases can specifically use Key-Value databases (key-value databases, a typical non-relational database, referred to as K-V database). Unlike relational databases, K-V databases do not know the value of the stored data. And there is no concept of schema (database schema information) like in MySQL (relational database management system) and PostgreSQL (a free software object-relational database management system with very complete features). This means that it cannot filter and query part of the stored data by using SQL (Structured Query Language) with where like a relational database. If you don't know where to query, you need to traverse all key values, find the corresponding value, filter it, and finally retain only the part of the data you want.
- SQL Structured Query Language
- K-V database can ensure high performance only when the key is known, otherwise its performance is obviously insufficient. Therefore, although the K-V database is superior to the relational database in terms of absolute access speed, the requirement of knowing the key value limits its application scenarios.
- non-relational databases have efficient access speed but lack data analysis capabilities, such as the lack of index-based and data-based databases. The ability to query relationships between
- the blockchain underlying system including blockchain nodes and corresponding blockchain databases
- a non-relational database with efficient access speed i.e., blockchain non-relational type database
- the blockchain node can efficiently access data from the blockchain non-relational database when running the blockchain service, thereby ensuring the efficient operation of the blockchain service.
- the stored Blockchain data is encrypted to obtain homomorphic ciphertext data, so it can also avoid security risks caused by data leaks.
- the node devices involved in the embodiments of this specification also maintain an additional blockchain relational database as a native database for providing data analysis services to users, that is, as part of the infrastructure of the data analysis system, used to provide analysis services to users.
- the demander provides data analysis services.
- blockchain non-relational databases can specifically use relational databases such as Oracle database and MySQL.
- a relational database refers to a database that uses a relational model to organize data. It stores data in the form of rows and columns to facilitate user understanding. The series of rows and columns in a relational database are called tables, and a set of tables consists of database. Users retrieve data from a database through queries, which are executable codes that limit certain areas of the database.
- the relational model can be simply understood as a two-dimensional table model, and a relational database is a data organization composed of two-dimensional tables and the relationships between them.
- a relational database needs to define the table structure, table relationships, and standardized Database schema information such as data structure is then stored in data based on the database schema information. It supports SQL and has strong data analysis capabilities.
- relational databases place great emphasis on data consistency, they pay a huge price for reducing read and write performance.
- the reliability of relational database for storing and processing data is very good, the efficiency will become very poor once faced with the processing of massive data, especially when encountering high concurrent reading and writing, the performance will drop very much. sharp.
- relational databases have powerful data analysis capabilities but poor access speed and read and write performance, and are not suitable for large-scale concurrent read and write application scenarios.
- the data analysis system deployed under the node device chain (including the data analysis engine and corresponding database not shown in Figure 2) adopts a non-relational database (i.e., block database) with efficient access speed, chain relational database), thus enabling node devices to utilize the powerful data analysis capabilities of blockchain non-relational databases when running data analysis services by calling the data analysis engine, thereby ensuring that convenient data analysis is provided to analysis demand parties.
- a non-relational database i.e., block database
- chain relational database i.e., block database
- the embodiments of this application can respond to the analysis of part of the requirements of the demand side.
- the ciphertext operation requirements of the standard data in the ciphertext state the calculation results are directly returned to the analysis requester after the ciphertext calculation is completed on the node device side, thereby avoiding the analysis requester to bear the complex ciphertext operation and minimizing the need for analysis. It puts forward requirements for the technical environment and computing pressure, provides convenient ciphertext computing services to the analysis demand side, and at the same time maximizes the data value of the standard data in the ciphertext state in the blockchain relational database.
- the data maintained in the blockchain relational database involved in the embodiments of this specification is obtained through data conversion and migration in the blockchain non-relational database.
- the process of data conversion and migration will be introduced in detail below.
- obtaining the homomorphic ciphertext data maintained in the non-relational database of the blockchain and its corresponding zero-knowledge proof includes: receiving an active push from the blockchain node The homomorphic ciphertext data and the corresponding zero-knowledge proof; and/or, sending a blockchain data request to the blockchain node, receiving the blockchain node's response to the blockchain The homomorphic ciphertext data returned by the data request and its corresponding zero-knowledge proof.
- the method for maintaining blockchain data involved in the embodiments of this specification is applied to node devices, specifically to the data conversion engine deployed under the node device chain.
- the node device can obtain the homomorphic ciphertext data maintained in the non-relational database of the blockchain and its corresponding zero-knowledge proof in at least one of two ways.
- the two ways include: first, by receiving the blockchain The homomorphic ciphertext data actively pushed by the node and its corresponding zero-knowledge proof.
- each time a blockchain node adds or modifies a homomorphic ciphertext to the blockchain non-relational database during the process of running the blockchain service In the case of text data, the blockchain nodes will actively push data update messages carrying the latest added or modified homomorphic ciphertext data and their corresponding zero-knowledge proofs to the off-chain data conversion engine.
- This method can promptly The data in the blockchain non-relational database is converted and synchronized to the blockchain relational database, thereby ensuring the symmetry and timeliness of the data in the blockchain relational database; secondly, through the node device to the blockchain node Send a blockchain data request to obtain the homomorphic ciphertext data returned by the blockchain node in response to the blockchain data request and its corresponding zero-knowledge proof.
- This method obtains the homomorphic ciphertext through the request-response mode. Text data and its corresponding zero-knowledge proof can effectively control the range of requested homomorphic ciphertext data and thus shield some data that does not need to be maintained in the blockchain relational database.
- sending a blockchain data request to the blockchain node includes: initiating to the smart contract deployed by the blockchain node a non-relational database maintained in the blockchain for the smart contract.
- the homomorphic ciphertext data and the corresponding blockchain data request of the zero-knowledge proof includes: initiating to the smart contract deployed by the blockchain node a non-relational database maintained in the blockchain for the smart contract.
- the homomorphic ciphertext data in and the corresponding blockchain data request of the zero-knowledge proof includes: initiating to the smart contract deployed by the blockchain node a non-relational database maintained in the blockchain for the smart contract.
- the homomorphic ciphertext data in and the corresponding blockchain data request of the zero-knowledge proof includes: initiating to the smart contract deployed by the blockchain node a non-re
- the blockchain data involved in the embodiments of this specification includes block data, status data and event data.
- block data refers to the blockchain ledger maintained by each blockchain node in the blockchain network.
- the blockchain ledger and/or the homomorphic ciphertext data corresponding to the blockchain ledger are essentially maintained in the block.
- the blockchain ledger is a special data structure, it is composed of multiple blocks connected end-to-end through hash anchoring and cannot be tampered with.
- Each block consists of a block header and The block header of any block contains information such as the status tree root, transaction number root, receipt tree root, block height and the hash value of the corresponding parent block.
- the body contains the transaction data (transaction hash) contained in the block.
- the block data involved in the embodiments of this specification refers to the data contained in the blockchain ledger.
- the status data and event data involved in the embodiments of this specification are maintained by various smart contracts deployed by the blockchain nodes.
- the homomorphic ciphertext data corresponding to the status data, event data and/or status data and event data are Maintain the contract storage space corresponding to each smart contract in the blockchain non-relational database.
- a blockchain node is deployed with several smart contracts, and each smart contract maintains corresponding status data. These status data are maintained on the blockchain in the form of encrypted homomorphic ciphertext data.
- the node device can initiate a blockchain data request to the smart contract deployed by the blockchain node (in fact, any smart contract is deployed on each blockchain node in the blockchain network).
- the blockchain data request is Formally it is a blockchain transaction. After the blockchain transaction is received by the blockchain node, the blockchain node will further call the smart contract instructed by the blockchain transaction to execute the blockchain transaction.
- the smart contract When the smart contract executes the blockchain transaction, it searches and obtains the homomorphic ciphertext data indicated by the blockchain transaction from the contract storage space corresponding to the smart contract in the blockchain non-relational database, and stores the homomorphic ciphertext data.
- the ciphertext data and its corresponding zero-knowledge proof are called back to the node device as a response message corresponding to the blockchain data request (such as in the form of a blockchain event), thereby realizing the acquisition of blockchain non-relationships by calling smart contracts.
- the node device can directly initiate a blockchain data request to the blockchain node, for example, initiate a blockchain data request through the data query interface of the blockchain node.
- the blockchain data request is used to make the district
- the blockchain node retrieves the homomorphic ciphertext data indicated by the blockchain data request (obtained from the block data through homomorphic encryption) and its corresponding zero-knowledge proof from the blockchain non-relational database and calls it back to the node. equipment.
- the node device can directly initiate a blockchain data request to the blockchain non-relational database, for example, through the database interface of the blockchain non-relational database, which is equivalent to the node.
- the blockchain non-relational database directly responds to the received blockchain data request and returns the homomorphic ciphertext data indicated by the blockchain data request and its corresponding zeros. Proof of knowledge.
- a blockchain data request is in the same form as a blockchain transaction, it does not necessarily have all the properties of a blockchain transaction.
- a blockchain node may not necessarily Instead of consensus in the blockchain network, it is processed as a local call request.
- This kind of blockchain transaction that will only be executed within the local blockchain node without consensus is called a local transaction; of course, the blockchain Data requests can also have all the properties of a blockchain transaction, that is, after completing consensus in the blockchain network as a consensus transaction, they are executed separately by each blockchain node in the blockchain network.
- the node device when the node device confirms that the zero-knowledge proof (the number of which can be one or more) is successfully verified, it can determine the plaintext data corresponding to the homomorphic ciphertext data (that is, homomorphic encryption).
- the previous blockchain data has the corresponding data attributes of the zero-knowledge proof. Therefore, the node device can verify the integrity, normativeness and correctness of the homomorphic ciphertext data by verifying the zero-knowledge proof, thereby ultimately determining the homomorphic ciphertext data. Whether the static ciphertext data is valid.
- the node device Only after confirming that the homomorphic ciphertext data is valid, the node device will perform the next steps of data conversion and migration, thereby filtering invalid data to ultimately ensure the integrity of the standard data maintained in the blockchain relational database. Completeness, standardization and correctness.
- Schema is an abstract collection of metadata, including a set of schema components: mainly the declaration of elements and attributes, and the definition of complex and simple data types. , specifically including: defining the elements that can appear in the document; defining the attributes that can appear in the document; defining which element is a sub-element; defining the order of sub-elements; defining the number of sub-elements; defining whether the element is empty or can be Contains text; defines data types for elements and attributes; defines default and fixed values for elements and attributes.
- schema is the organization and structure of the database.
- Database schema information contains schema objects, which can be tables, columns, data types, views, stored procedures, relationships, and primary keys. , foreign key, etc.
- Database schema information can be represented by a visual diagram that shows database objects and their relationships to each other. Since the database schema information is used to describe the structure of the database and can be used as a blueprint for creating a database, by specifying the database schema information corresponding to a database, it can guide how the data in the database is stored.
- the node device After the node device obtains the homomorphic ciphertext data and confirms that it is valid, it will convert the homomorphic ciphertext data into standard data defined by the database schema information based on the database schema information corresponding to the blockchain relational database.
- the converted standard data can be maintained in the blockchain relational database according to certain rules, and the standard data already has a standardized structure and has a defined relationship with other data in the blockchain relational database. .
- the conversion process of homomorphic ciphertext data to standard data includes but is not limited to the conversion of data tables, rows, and columns. For example, the same process is realized through the ETL (Extract-Transform-Load, data warehouse technology based on data extraction, transformation, and loading) mechanism.
- the method when the blockchain data request is for the homomorphic ciphertext data maintained in the blockchain non-relational database by the smart contract and the corresponding zero-knowledge proof , the method also includes:
- the database schema information corresponding to the blockchain relational database can be maintained at the node device in advance (for example, set by the administrator user of the node device), or can be obtained by requesting a smart contract.
- each smart contract deployed by the blockchain node has a corresponding contract storage space in the blockchain non-relational database, and each smart contract has different characteristics when processing data, organizing data, and storing data. characteristics, so the corresponding contract storage spaces of different smart contracts in the non-relational blockchain have different data organization forms, and this data organization form includes the format, relationship and connotation of the data organization, etc. It is also based on database schema information The form is maintained in the smart contract.
- the embodiment of this specification obtains the smart data by requesting the corresponding smart contract.
- the first database schema information maintained in the contract corresponding to the blockchain data and/or homomorphic ciphertext data maintained in the non-relational database by the smart contract is used to maintain the smart contract in the blockchain relational database.
- the organizational model of the standard data obtained by converting the involved blockchain data and/or homomorphic ciphertext data, so as to correctly maintain the standard data involved in the smart contract in the blockchain relational database.
- the database schema information corresponding to each smart contract can be obtained through the embodiments of this specification, and the database schema information corresponding to the smart contract can be obtained according to the corresponding smart contract.
- the database schema information is used as the database schema information corresponding to the blockchain relational database to realize the conversion of the blockchain data and/or homomorphic ciphertext data involved in the corresponding smart contract into standard data, and finally according to different intelligence
- the database schema information of each contract enables the correct maintenance of standard data involved in multiple smart contracts in the blockchain relational database.
- the database schema information corresponding to any smart contract only supports the maintenance of standard data involved in any smart contract (that is, from any smart contract Standard data obtained by converting blockchain data and/or homomorphic ciphertext data), thereby supporting multiple smart contracts using different data organization forms to maintain blockchain data and/or in a blockchain non-relational database.
- the homomorphic ciphertext data is correctly converted into standard data, it is finally migrated to the blockchain relational database for maintenance in the form of standard data.
- S106 Maintain the standard data in the blockchain relational database.
- the blockchain relational database is used to provide data analysis services to analysis requesters.
- the data analysis services include ciphertext computing services.
- the node device After the node device obtains the standard data, it can store the standard data in the blockchain relational database according to the blockchain mode information corresponding to the blockchain relational database to achieve homomorphism in the blockchain non-relational database. Conversion and migration of ciphertext data to standard data in blockchain relational database. Since the blockchain relational database supports a variety of SQL and has powerful data analysis capabilities (such as data query capabilities based on various conditions, indexes, and relationships), the blockchain relational database can easily provide analysis needs to parties. data analysis services. For example, the data analysis engine deployed on and off the chain of the node device provides a data analysis interface to the outside world to provide data analysis services for the blockchain relational database to the external analysis requester who calls the analysis interface. Since the data analysis service includes a ciphertext calculation service, it can also make full use of the data value of the standard data in a ciphertext state maintained in the blockchain relational database.
- the embodiment of this specification separately deploys a blockchain non-relational database and a blockchain relational database on node devices.
- the blockchain non-relational database is used to maintain and run blockchain services on blockchain nodes.
- the homomorphic ciphertext data obtained by encrypting the generated blockchain data and its corresponding zero-knowledge proof enable the blockchain node to efficiently store the encrypted blockchain data and perform homomorphic processing when running the blockchain service. Efficient reading of ciphertext data; on the other hand, by converting homomorphic ciphertext data maintained in the blockchain non-relational database into standard data and synchronously maintaining it in the blockchain relational database, thereby utilizing blocks Chain relational database realizes convenient data analysis services.
- the method for maintaining blockchain data involved in the embodiments of this specification realizes the backup of one data in two places, objectively improves the disaster recovery capability, and realizes convenient data access while ensuring efficient access efficiency during the execution of the blockchain service.
- Analysis service at the same time, because the backed up data is not the plain text of blockchain data but the homomorphic ciphertext data obtained after encryption, and the data analysis service includes ciphertext computing service, it is possible to ensure data security through ciphertext while providing Basic computational analysis capabilities for ciphertext.
- the method further includes: receiving a data analysis request sent by the analysis requester; and returning an analysis result obtained by analyzing the blockchain relational database based on the data analysis request to the analysis requester.
- the data analysis engine deployed on and off-chain on the node device can also be used to receive data analysis requests sent by the analysis requester, and then call the blockchain relational database based on the data analysis engine. Analyze some of the data, and finally return the analysis results to the analysis requester, thereby realizing a complete data analysis service.
- the data analysis engine will query the data that satisfies both condition A and condition B in the blockchain relational database and use these data as the analysis results. Return to analyzing the demand side.
- the data analysis request is a ciphertext calculation request
- the analysis result is a ciphertext calculation result
- analyzing the blockchain relational database based on the data analysis request includes: converting the At least one to-be-operated data indicated by the ciphertext operation request maintained in the blockchain relational database performs ciphertext calculation to obtain the ciphertext calculation result.
- the data analysis engine deployed on and off-chain on the node device can also be used to receive ciphertext computing requests sent by the analysis requester, and retrieve blockchain relationships based on the ciphertext computing requests.
- At least part of the data to be calculated in the at least one data to be calculated is standard data in a ciphertext state (supporting full ciphertext calculations, a mixture of ciphertext and plaintext) Ciphertext operation), and then perform ciphertext calculation on the at least one data to be operated according to the requirements of the ciphertext operation request to obtain the ciphertext calculation result.
- the ciphertext calculation result is also in the ciphertext state, and the node device calculates the ciphertext
- the result is returned to the analysis requester as a response message of the ciphertext operation request, thereby realizing a complete ciphertext operation service.
- the zero-knowledge proof is used to indicate that the blockchain data belongs to the first set corresponding to the first data range if the verification is successful; the standard data is maintained in the blockchain relationship
- the method includes: maintaining the standard data in a data table corresponding to the first set in the blockchain relational database.
- the blockchain relational database maintains respective data tables corresponding to different sets of standard data, and different sets have different data properties, such as different data ranges.
- the data range can be clearly known by the node device and maintained in the corresponding data table.
- the node device needs to pass the zero-knowledge proof corresponding to the homomorphic ciphertext data before conversion.
- the node device can confirm that the standard data obtained after converting the homomorphic ciphertext data should also belong to the first set corresponding to the first data range (because the data conversion process does not change the data value, but only changing the structure and relationship of the data), so the node device can store the standard data into the data table corresponding to the first set in the blockchain relational database to ensure the standard data of the ciphertext state It can also be assigned to the correct data table according to the predefined table structure. At the same time, this classification of standard data in ciphertext status based on the data table structure also brings convenience to subsequent data analysis of these standard data. Help (equivalent to providing the retrieval dimensions of the data range).
- Figure 3 is a schematic structural diagram of a device provided by an exemplary embodiment.
- the device includes a processor 302, an internal bus 303, a network interface 306, a memory 308 and a non-volatile memory 310.
- the processor 302 reads the corresponding computer program from the non-volatile memory 310 into the memory 308 and then runs it.
- the execution subject of the following processing flow is not limited to each A logic unit can also be a hardware or logic device.
- FIG 4 is a block diagram of a device for maintaining blockchain data provided in this specification according to an exemplary embodiment.
- This device can be applied to the equipment shown in Figure 3 to implement the instructions of this specification.
- Technical solution: This device is applied to node equipment deployed with blockchain nodes.
- the node equipment maintains a blockchain non-relational database and a blockchain relational database.
- the blockchain non-relational database is used to maintain Homomorphic ciphertext data and its corresponding zero-knowledge proof.
- the homomorphic ciphertext data is obtained by the blockchain node through homomorphic encryption of the blockchain data generated when running the blockchain service; the device includes :
- the homomorphic ciphertext data acquisition unit 401 is used to acquire the homomorphic ciphertext data maintained in the blockchain non-relational database and its corresponding zero-knowledge proof;
- the data conversion unit 402 is configured to convert the homomorphic ciphertext data into standard data defined by the database schema information corresponding to the blockchain relational database when the zero-knowledge proof verification is successful;
- the standard data maintenance unit 403 is used to maintain the standard data in the blockchain relational database.
- the blockchain relational database is used to provide data analysis services to analysis demanders.
- the data analysis services include Cryptotext computing service.
- the homomorphic ciphertext data acquisition unit 401 is specifically used to:
- the homomorphic ciphertext data acquisition unit 401 is further used to:
- the device when the blockchain data request is for the homomorphic ciphertext data maintained in the blockchain non-relational database by the smart contract and the corresponding zero-knowledge proof , the device also includes:
- the mode information query request sending unit 404 is configured to initiate a mode information query request to the smart contract, and determine the first database mode information recorded in the smart contract returned by the smart contract in response to the mode information query request. It is the database schema information corresponding to the blockchain relational database.
- the blockchain non-relational database is also used to maintain blockchain data generated when the blockchain node will run the blockchain service.
- the blockchain data includes block data, status data and event data.
- Optional also includes:
- the data analysis request receiving unit 405 is used to receive the data analysis request sent by the analysis requester;
- the analysis result return unit 406 is used to return the analysis result obtained by analyzing the blockchain relational database based on the data analysis request to the analysis requester.
- the data analysis request is a ciphertext calculation request
- the analysis result is a ciphertext calculation result
- the analysis result return unit 406 is specifically used to:
- the zero-knowledge proof is used to indicate that the blockchain data belongs to the first set corresponding to the first data range if the verification is successful;
- the standard data maintenance unit 403 is specifically used to:
- the standard data is maintained in the data table corresponding to the first set in the blockchain relational database.
- PLD Programmable Logic Device
- FPGA Field Programmable Gate Array
- HDL Hardware Description Language
- the controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor. , logic gates, switches, Application Specific Integrated Circuit (ASIC), programmable logic controllers and embedded microcontrollers.
- controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, For Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
- the controller in addition to implementing the controller in the form of pure computer-readable program code, the controller can be completely programmed with logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded logic by logically programming the method steps. Microcontroller, etc. to achieve the same function. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as structures within hardware components as well as software modules implementing the methods.
- the systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions.
- a typical implementation device is a server system.
- the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, or a personal digital assistant. , media player, navigation device, email device, game console, tablet, wearable device, or a combination of any of these devices.
- the functions are divided into various modules and described separately.
- the functions of each module can be implemented in the same or multiple software and/or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. .
- the device embodiments described above are only illustrative.
- the division of the units is only a logical function division. In actual implementation, there may be other division methods.
- multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
- the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
- These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
- the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
- These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
- Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
- a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
- processors CPUs
- input/output interfaces network interfaces
- memory volatile and non-volatile memory
- Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
- RAM random access memory
- ROM read-only memory
- flash RAM flash random access memory
- Computer-readable media includes permanent and non-transitory, removable and non-removable media and may be implemented by any method or technology for storage of information. Information may be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory.
- PRAM phase change memory
- SRAM static random access memory
- DRAM dynamic random access memory
- RAM random access memory
- read-only memory read-only memory
- ROM read-only memory
- EEPROM electrically erasable programmable read-only memory
- flash memory or other memory technology
- compact disc read-only memory CD-ROM
- DVD digital versatile disc
- Magnetic tape magnetic tape storage, graphene storage or other magnetic storage devices or any other non-transmission medium can be used to store information that can be accessed by a computing device.
- computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
- one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. Product form.
- computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
- program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types.
- program modules may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network.
- program modules may be located in both local and remote computer storage media including storage devices.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Bioethics (AREA)
- Databases & Information Systems (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Quality & Reliability (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本说明书提供一种维护区块链数据的方法、装置、电子设备和存储介质,所述方法应用于部署有区块链节点的节点设备,节点设备维护有区块链非关系型数据库和区块链关系型数据库,区块链非关系型数据库用于维护同态密文数据及其对应的零知识证明,同态密文数据由区块链节点将运行区块链服务时生成的区块链数据通过同态加密得到;所述方法包括:获取区块链非关系型数据库中维护的同态密文数据及其对应的零知识证明;在零知识证明验证成功的情况下,将同态密文数据转换为区块链关系型数据库对应的数据库模式信息定义的标准数据;将标准数据维护在区块链关系型数据库中,区块链关系型数据库用于向分析需求方提供数据分析服务,数据分析服务包括密文运算服务。
Description
本申请要求于2022年06月29日提交中国专利局、申请号为202210764596.7、发明名称为“一种维护区块链数据的方法、装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本说明书实施例属于区块链技术领域,尤其涉及一种维护区块链数据的方法、装置、电子设备和存储介质。
区块链(Blockchain)是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链系统中按照时间顺序将数据区块以顺序相连的方式组合成链式数据结构,并以密码学方式保证的不可篡改和不可伪造的分布式账本。
在传统区块链技术中,为了契合区块链节点在运行区块链服务过程中对大量数据的存储需求,区块链节点通常使用具有高效的存取效率的非关系型数据库进行数据存储,然而,非关系型数据库由于缺乏事务关系,数据之间缺乏联系且未标准化,不利于进行数据分析。关系型数据库具有完整的事务关系,数据之间具有联系且具有严格的标准化结构,如果将传统区块链技术中的非关系型数据库替换为关系型数据库,虽然利于进行数据分析,但在区块链底层系统直接使用关系型数据库又会对区块链节点运行区块链服务过程中的在线读写性能带来巨大挑战。因此,如何在确保区块链服务执行过程具有高效存取效率的情况下实现便捷的数据分析服务是本领域亟待解决的问题。
发明内容
本发明的目的在于提供一种维护区块链数据的方法、装置、电子设备和存储介质。
根据本说明书一个或多个实施例的第一方面,提出了一种维护区块链数据的方法,应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护同态密文数据及其对应的零知识证明,所述同态密文数据由所述区块链节点将运行区块链服务时生成的区块链数据通过同态加密得到;所述方法包括:
获取所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明;
在所述零知识证明验证成功的情况下,将所述同态密文数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;
将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务,所述数据分析服务包括密文运算服务。
根据本说明书一个或多个实施例的第二方面,提出了一种维护区块链数据的装置,应用于部署有区 块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护同态密文数据及其对应的零知识证明,所述同态密文数据由所述区块链节点将运行区块链服务时生成的区块链数据通过同态加密得到;所述装置包括:
同态密文数据获取单元,用于获取所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明;
数据转换单元,用于在所述零知识证明验证成功的情况下,将所述同态密文数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;
标准数据维护单元,用于将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务,所述数据分析服务包括密文运算服务。
根据本说明书一个或多个实施例的第三方面,提出了一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器通过运行所述可执行指令以实现如第一方面所述的方法。
根据本说明书一个或多个实施例的第四方面,提出了一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如第一方面所述方法的步骤。
本说明书实施例通过在节点设备上分别部署区块链非关系型数据库和区块链关系型数据库,一方面,由于区块链非关系型数据库用于维护将区块链节点运行区块链服务时生成的区块链数据加密得到的同态密文数据及其对应的零知识证明,这使得区块链节点运行区块链服务时能够对区块链数据加密后进行高效存储以及对同态密文数据进行高效读取;另一方面,通过将从区块链非关系型数据库中维护的同态密文数据转换为标准数据并同步维护于区块链关系型数据库中,从而利用区块链关系型数据库实现便捷的数据分析服务。另外,由于在转换前需要验证同态密文数据对应的零知识证明,因此可以确保所进行转换的同态密文数据的有效性。本说明书实施例涉及的维护区块链数据的方法实现了一份数据两处备份,客观上提高了容灾能力,在确保区块链服务执行过程具有高效存取效率的情况下实现便捷的数据分析服务;同时由于备份的数据并非区块链数据明文而是加密后得到的同态密文数据,且数据分析服务中包括密文运算服务,因此实现了在通过密文保证数据安全的同时提供针对密文的基础运算分析能力。
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是一示例性实施例提供的一种维护区块链数据的方法的流程图。
图2是一示例性实施例提供的一种维护区块链数据的系统架构图。
图3是一示例性实施例提供的一种设备的结构示意图。
图4是一示例性实施例提供的一种维护区块链数据的装置的框图。
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。
图1是一示例性实施例提供的一种维护区块链数据的方法的流程图。该方法应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护同态密文数据及其对应的零知识证明,所述同态密文数据由所述区块链节点将运行区块链服务时生成的区块链数据通过同态加密得到;所述方法包括:
S102:获取所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明。
图2是一示例性实施例提供的一种维护区块链数据的系统架构图。如图2所示,区块链网络中的每个区块链节点都部署于对应的节点设备上,每个节点设备都会同时维护有区块链非关系型数据库和区块链关系型数据库。在本说明书实施例中,区块链非关系型数据库属于非关系型数据库,而区块链关系型数据库属于关系型数据库。
一方面,区块链非关系型数据库作为区块链节点运行区块链服务的原生数据库,即作为区块链底层系统的基础架构的一部分,用于对区块链节点运行区块链服务的过程中生成的区块链数据进行高效存取,而为了确保数据安全,区块链节点在需要向区块链非关系型数据库中存储区块链数据时,作为直接存储区块链数据的代替,区块链节点可以先对区块链数据进行同态加密得到同态密文数据,然后将同态密文数据存储在区块链非关系型数据库,从而避免直接存储明文数据而诱发数据泄露的风险,当然,所述区块链非关系型数据库除了可以维护同态密文数据外,还用于维护所述区块链节点将运行区块链服务时生成的区块链数据,也就是说对于一些隐私需求较低的区块链数据,可以直接在区块链非关系型数据库中以明文状态存取。另外,在本说明书实施例中,由于需要确保同态密文数据具有能够被证明有效的凭证,区块链节点在向区块链非关系型数据库中存储任一同态密文数据的同时,还会为该任一同态密文数据生成对应的零知识证明,任一同态密文数据对应的零知识证明用于向第三方证明该任一同态密文数据对应的明文数据(即加密前的区块链数据)具有特定的数据属性,例如,如数据数值的范围、数据是否属于指定集合、数据是否由指定运算逻辑产生等,具体证明的信息取决于实际场景中的功能语义定义,在能力上不做区分,本说明书也不限制零知识证明的具体类型。因此,本说明书实施例所涉及的区块链非关系型数据库中维护的任一同态密文数据都联合维护有对应零知识证明。区块链非关系型数据库可以具体采用Key-Value数据库(键值对数据库,一种典型的非关系型数据库,简称K-V数据库),不同于关系型数据库,K-V数据库并不清楚存储数据的值,而且也没有像MySQL(关系型数据库管理系统)和PostgreSQL(一种特性非常齐全的自由软件的对象-关系型数据库管理系统)中schema(数据库模式信 息)的概念。这也就意味着它不能像关系型数据库一样通过使用带where的SQL(Structured Query Language,结构化查询语句)来过滤并查询所存数据的部分内容。如果你不知道该从哪查询,你需要遍历所有的key值,找到对应的value,对其进行过滤,最终只保留你想要的那部分数据。这样一来计算量会非常大,同时也意味着只有在key已知的情况下,K-V数据库才能保证高性能,否则其性能明显不足。因此,虽然在绝对访问速度方面K-V数据库优于关系型数据库,但需要已知key值的要求限制了其应用场景。上述描述虽然仅涉及对K-V数据库的介绍,但实质上适用于大多数非关系型数据库,总的来说,就是非关系型数据库具有高效的访问速度但缺乏数据分析能力,例如缺乏基于索引、数据间关系的查询能力。
在本说明书实施例中,由于节点设备部署的区块链底层系统(包含区块链节点与对应的区块链数据库)沿用了具有高效的访问速度的非关系型数据库(即区块链非关系型数据库),因此可以使区块链节点在运行区块链服务时,能够高效地从区块链非关系型数据库中存取数据,从而确保区块链服务的高效运行,同时由于存储的是区块链数据加密后的得到同态密文数据,因此还可以避免数据泄露带来的安全风险。
另一方面,本说明书实施例涉及的节点设备还额外维护有区块链关系型数据库,以作为对用户提供数据分析服务的原生数据库,即作为数据分析系统的基础架构的一部分,用于向分析需求方提供数据分析服务。例如,区块链非关系型数据库可以具体采用oracle数据库、MySQL等关系型数据库。关系型数据库,是指采用了关系模型来组织数据的数据库,其以行和列的形式存储数据,以便于用户理解,关系型数据库这一系列的行和列被称为表,一组表组成了数据库。用户通过查询来检索数据库中的数据,而查询是一个用于限定数据库中某些区域的执行代码。关系模型可以简单理解为二维表格模型,而一个关系型数据库就是由二维表及其之间的关系组成的一个数据组织,关系型数据库需要提前定义好表的结构、表的关系、规范化的数据结构等数据库模式信息,再根据数据库模式信息存入数据,支持SQL,具有强大的数据分析能力,但由于关系型数据库十分强调数据的一致性,并为此降低读写性能付出了巨大的代价,虽然关系型数据库存储数据和处理数据的可靠性很不错,但一旦面对海量数据的处理的时候效率就会变得很差,特别是遇到高并发读写的时候性能就会下降的非常厉害。总的来说,就是关系型数据库具有强大的数据分析能力但访问速度、读写性能较差,不适用于大规模并发读写的应用场景。
在本说明书实施例中,由于节点设备链下部署的数据分析系统(包括图2中未示出的数据分析引擎与对应的数据库)采用了具有高效的访问速度的非关系型数据库(即区块链关系型数据库),因此可以使节点设备在通过调用数据分析引擎而运行数据分析服务时,能够利用区块链非关系型数据库强大的数据分析能力,从而确保向分析需求方提供便捷的数据分析服务。另外,由于区块链关系型数据库中维护的标准数据有通过同态密文数据转换得到的,其依然处于密文状态,具有较小的数据价值,对于分析需求方而言,虽然可以通过查询服务获取这些密文状态的标准数据,但可能因为缺乏必要的密文运算能力而无法利用这些密文状态的标准数据,本申请实施例通过提供密文运算服务,可以响应于分析需求方对部分处于密文状态的标准数据的密文运算需求,在节点设备侧完成密文计算后直接向分析需求方返回计 算结果,从而避免由分析需求方承担复杂的密文运算,尽可能不对分析需求方的技术环境和计算压力提出要求,给分析需求方提供了便捷的密文运算服务,同时最大化利用区块链关系型数据库中处于密文状态的标准数据的数据价值。
本说明书实施例涉及的区块链关系型数据库中维护的数据是通过区块链非关系型数据库中的数据转换、迁移得到的。下面将具体介绍这个数据转换、迁移的过程。
在本说明书实施例中,所述获取所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明,包括:接收所述区块链节点主动推送的所述同态密文数据及其对应的所述零知识证明;和/或,向所述区块链节点发送区块链数据请求,接收所述区块链节点响应于所述区块链数据请求返回的所述同态密文数据及其对应的所述零知识证明。
本说明书实施例所涉及的维护区块链数据的方法应用于节点设备,具体应用于节点设备链下部署的数据转换引擎。节点设备可以通过两种方式中至少一种方式获取区块链非关系型数据库中维护的同态密文数据及其对应的零知识证明,这两种方式包括:其一,通过接收区块链节点的主动推送的同态密文数据及其对应的零知识证明,例如每次区块链节点在运行区块链服务的过程中向区块链非关系型数据库中新增或修改同态密文数据的情况下,区块链节点都会向链下的数据转换引擎主动推送携带有最新新增或修改的同态密文数据及其对应的零知识证明的数据更新消息,本方式可以及时将区块链非关系型数据库中的数据转换并同步至区块链关系型数据库中,从而确保区块链关系型数据库中数据的对称性和时效性;其二,通过节点设备向区块链节点发送区块链数据请求以获取所述区块链节点响应于所述区块链数据请求返回的同态密文数据及其对应的零知识证明,本方式通过请求-响应模式来获取同态密文数据及其对应的零知识证明,可以有效控制请求的同态密文数据的范围从而屏蔽一些不需要维护在区块链关系型数据库中的数据。
可选的,所述向所述区块链节点发送区块链数据请求,包括:向所述区块链节点部署的智能合约发起针对所述智能合约维护在所述区块链非关系型数据库中的所述同态密文数据及其对应的所述零知识证明的所述区块链数据请求;或者,向所述区块链节点发起针对所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明的所述区块链数据请求。
本说明书实施例所涉及的区块链数据包括区块数据、状态数据和事件数据。其中,区块数据是指区块链网络中每个区块链节点所维护的区块链账本,区块链账本和/或区块链账本对应的同态密文数据实质被维护在区块链非关系型数据库中,由于区块链账本是一种特殊的数据结构,其是由多个区块通过哈希锚定首尾相连而成,具有不可篡改性,每个区块由区块头和区块体组成,任一区块的区块头中包含有该个区块的状态树根、交易数根、收据树根、区块高度和对应父区块的哈希值等信息,而区块体中包含有该个区块包含的交易数据(交易哈希)。本说明书实施例所涉及的区块数据指的就是区块链账本中包含的数据。本说明书实施例涉及的状态数据和事件数据则是由区块链节点所部署的各个智能合约所维护,实质上状态数据、事件数据和/或状态数据、事件数据对应的同态密文数据是维护在区块链非关系型数据库中对应于各个智能合约的合约存储空间。
在一实施例中,区块链节点部署有若干的智能合约,任一智能合约中都维护有相应的状态数据,这些状态数据被以加密得到同态密文数据的形式维护在区块链非关系型数据库中对应于所述任一智能合约的合约存储空间内。而节点设备可以向区块链节点部署的智能合约(事实上,任一智能合约部署在区块链网络中每个区块链节点上)发起区块链数据请求,该区块链数据请求在形式上属于一种区块链交易,该区块链交易在由区块链节点接收到后,区块链节点会进一步调用该区块链交易所指示的智能合约执行该区块链交易。智能合约在执行该区块链交易时,从区块链非关系型数据库中对应于该智能合约的合约存储空间查找并获取区块链交易所指示的同态密文数据,并将该同态密文数据及其对应的零知识证明作为区块链数据请求对应的响应消息(如以区块链事件的形式)回调至节点设备,从而实现以调用智能合约的方式来获取区块链非关系型数据库中维护的同态密文数据及其对应的零知识证明。
在另一实施例中,节点设备可以向区块链节点直接发起区块链数据请求,例如通过区块链节点的数据查询接口发起区块链数据请求,该区块链数据请求用于使区块链节点从区块链非关系型数据库中调取区块链数据请求所指示的同态密文数据(由区块数据经过同态加密得到的)及其对应的零知识证明并回调至节点设备。
在又一实施例中,节点设备可以直接向区块链非关系型数据库发起区块链数据请求,例如通过区块链非关系型数据库的数据库接口发起区块链数据请求,此时相当于节点设备链下的本地调用而无需经过区块链节点,区块链非关系型数据库直接响应于接收到的区块链数据请求返回区块链数据请求指示的同态密文数据及其对应的零知识证明。
需要注意的是,虽然区块链数据请求在形式上与区块链交易相同,但不一定具有区块链交易的所有性质,例如区块链节点在接收到区块链数据请求后不一定会将其在区块链网络中进行共识,而是作为本地调用请求进行处理,这种不进行共识仅会在本地区块链节点内部执行的区块链交易称为本地交易;当然,区块链数据请求也可以具有区块链交易的所有性质,即作为共识交易在区块链网络中完成共识后,由区块链网络中的每个区块链节点各自分别执行。
S104:在所述零知识证明验证成功的情况下,将所述同态密文数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据。
在本说明书实施例中,节点设备在确认所述零知识证明(其数量可以为一个或多个)验证成功的情况下,可以确定所述同态密文数据对应的明文数据(即同态加密前的区块链数据)具有零知识证明各自对应的数据属性,由此节点设备可以通过验证零知识证明来验证同态密文数据完整性、规范性和正确性等,从而最终判定所述同态密文数据是否有效。而在确认所述同态密文数据有效的情况下,节点设备才会进行接下来的数据转换和迁移的步骤,从而过滤无效数据,以最终保证区块链关系型数据库中维护的标准数据的完整性、规范性和正确性。
本说明书实施例所涉及的数据库模式信息具体是指数据库schema,schema是元数据的一个抽象集合,包含一套schema component(模式组件):主要是元素与属性的声明、复杂与简单数据类型的定义,具体包括:定义可出现在文档中的元素;定义可出现在文档中的属性;定义哪个元素是子元素;定义子 元素的次序;定义子元素的数目;定义元素是否为空,或者是否可包含文本;定义元素和属性的数据类型;定义元素和属性的默认值以及固定值。而在数据库中,schema是数据库的组织和结构。数据库模式信息中包含了schema对象,能够是表(table)、列(column)、数据类型(data type)、视图(view)、存储过程(stored procedures)、关系(relationships)、主键(primary key)、外键(foreign key)等。数据库模式信息能够用一个可视化的图来表示,它显示了数据库对象及其相互之间的关系。由于数据库模式信息用于描述数据库的结构,能够作为创建一个数据库的蓝图,因此通过规定一个数据库对应的数据库模式信息,可以指导该数据库中数据是如何进行储存。
节点设备在获取到同态密文数据并确认其有效后,将基于区块链关系型数据库对应的数据库模式信息,将同态密文数据转换为该数据库模式信息所定义的标准数据,这意味着转换得到的标准数据能够被按照一定的规则维护在区块链关系型数据库中,并且标准数据也已经具备了规范化的结构以及被定义有与区块链关系型数据库中其他数据之间的关系。同态密文数据到标准数据的转换过程包括但不限于数据表、行、列的转换,例如通过ETL(Extract-Transform-Load,基于数据抽取、转换和加载的数据仓库技术)机制实现了同态密文数据到标准数据的转换,其具体实现方式现有技术均有所记载,这里不再赘述。由于转换的同态密文数据处于密文状态而转换过程不涉及解密,因此转换得到的标准数据也依然处于密文状态,具有密文形式。当然,本说明书实施例也支持直接对明文数据(例如明文状态存储在区块链非关系型数据库中的区块链数据)进行转换得到标准数据,其具体方式与转换同态密文数据相同,区别在于最终转换得到的标准数据处于明文状态。
可选的,在所述区块链数据请求针对于所述智能合约维护在所述区块链非关系型数据库中的所述同态密文数据及其对应的所述零知识证明的情况下,所述方法还包括:
向所述智能合约发起模式信息查询请求,将所述智能合约响应于所述模式信息查询请求返回的记录于所述智能合约中的第一数据库模式信息确定为所述区块链关系型数据库对应的所述数据库模式信息。
在本说明书实施例中,区块链关系型数据库对应的数据库模式信息可以被预先维护在节点设备处(例如由节点设备的管理员用户所设置),或者,向智能合约请求获取得到。如前所述,由于区块链节点部署的每个智能合约在区块链非关系型数据库中都有对应的合约存储空间,且每个智能合约在处理数据、组织数据、存储数据时具有不同的特性,因此不同智能合约在区块链非关系型中对应的合约存储空间具有不同的数据组织形式,而这个数据组织形式包括数据组织的格式、关系和内涵等,它同样是以数据库模式信息的形式被维护在智能合约中。因此,为了正确应对不同智能合约在区块链非关系型数据库所维护的具有不同组织特性的区块链数据和/或同态密文数据,本说明书实施例通过向对应智能合约请求获取该智能合约中维护的对应于该智能合约维护在非关系型数据库中的区块链数据和/或同态密文数据的第一数据库模式信息,来作为在区块链关系型数据库中维护该智能合约涉及的区块链数据和/或同态密文数据转换得到的标准数据的组织模式,从而在区块链关系型数据库中正确地维护该智能合约涉及的标准数据。当区块链节点包含多个智能合约时,且不同的智能合约具有不同的数据组织形式的情况下,通过本说明书实施例可以获取每个智能合约对应的数据库模式信息,并按照对应智能合约的数据库模式 信息,来作为所述区块链关系型数据库对应的所述数据库模式信息实现对应智能合约涉及的区块链数据和/或同态密文数据到标准数据的转换,并最终按照不同智能合约各自的数据库模式信息,实现多个智能合约涉及的标准数据在区块链关系型数据库中的正确维护。此时相当于区块链关系型数据库应用有多种不同的数据库模式信息,且任一智能合约对应的数据库模式信息仅支持维护该任一智能合约涉及的标准数据(即来自该任一智能合约中区块链数据和/或同态密文数据转换得到的标准数据),从而支持多个采用不同数据组织形式的智能合约维护在区块链非关系型数据库中的区块链数据和/或同态密文数据正确地转换为标准数据后,最终以标准数据的形式迁移至区块链关系型数据库中维护。
S106:将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务,所述数据分析服务包括密文运算服务。
节点设备在获得标准数据后,便可以按照区块链关系型数据库对应的区块链模式信息将标准数据存储于区块链关系型数据库中,以实现区块链非关系型数据库中的同态密文数据到区块链关系型数据库中标准数据的转换迁移。由于区块链关系型数据库支持多种SQL,具有强大的数据分析能力(例如基于各类条件、索引、关系的数据查询能力),因此区块链关系型数据库可以方便地向分析需求方提供便捷的数据分析服务。例如,通过节点设备上链下部署的数据分析引擎向外部提供数据分析接口,来向外部调用该分析接口的分析需求方提供针对区块链关系型数据库的数据分析服务。由于数据分析服务中包括密文运算服务,因此也能够充分利用区块链关系型数据库中维护的处于密文状态的标准数据的数据价值。
本说明书实施例通过在节点设备上分别部署区块链非关系型数据库和区块链关系型数据库,一方面,由于区块链非关系型数据库用于维护将区块链节点运行区块链服务时生成的区块链数据加密得到的同态密文数据及其对应的零知识证明,这使得区块链节点运行区块链服务时能够对区块链数据加密后进行高效存储以及对同态密文数据进行高效读取;另一方面,通过将从区块链非关系型数据库中维护的同态密文数据转换为标准数据并同步维护于区块链关系型数据库中,从而利用区块链关系型数据库实现便捷的数据分析服务。另外,由于在转换前需要验证同态密文数据对应的零知识证明,因此可以确保所进行转换的同态密文数据的有效性。本说明书实施例涉及的维护区块链数据的方法实现了一份数据两处备份,客观上提高了容灾能力,在确保区块链服务执行过程具有高效存取效率的情况下实现便捷的数据分析服务;同时由于备份的数据并非区块链数据明文而是加密后得到的同态密文数据,且数据分析服务中包括密文运算服务,因此实现了在通过密文保证数据安全的同时提供针对密文的基础运算分析能力。
可选的,还包括:接收所述分析需求方发送的数据分析请求;将基于所述数据分析请求对所述区块链关系型数据库进行分析得到的分析结果返回所述分析需求方。作为一种提供数据分析服务的实施例,节点设备上链下部署的数据分析引擎还可以用于接收分析需求方发送的数据分析请求,然后基于所述数据分析引擎调用区块链关系型数据库中的部分数据进行分析,最终将分析得到的分析结果返回所述分析需求方,从而实现一次完整的数据分析服务。例如,数据分析请求是针对同时满足条件A与条件B的数据查询请求,那么数据分析引擎将在区块链关系型数据库中查询同时具备条件A与条件B的数据,并将这些数据作为分析结果返回分析需求方。
可选的,所述数据分析请求为密文运算请求,所述分析结果为密文计算结果;所述基于所述数据分析请求对所述区块链关系型数据库进行分析,包括:将所述区块链关系型数据库中维护的所述密文运算请求指示的至少一个待运算数据进行密文计算以得到所述密文计算结果。作为一种提供密文运算服务的实施例,节点设备上链下部署的数据分析引擎还可以用于接收分析需求方发送的密文运算请求,基于所述密文运算请求调取区块链关系型数据库中的涉及参与运算的至少一个待运算数据,其中,所述至少一个待运算数据中至少部分待运算数据为处于密文状态的标准数据(支持全密文运算、密文与明文的混合密文运算),然后按照密文运算请求的要求对所述至少一个待运算数据进行密文计算以获取密文计算结果,该密文计算结果也处于密文状态,节点设备将这个密文计算结果作为密文运算请求的响应消息返回给所述分析需求方,从而实现一次完整的密文运算服务。
可选的,所述零知识证明在验证成功的情况下用于表明所述区块链数据属于第一数据范围对应的第一集合;所述将所述标准数据维护在所述区块链关系型数据库中,包括:将所述标准数据维护在所述区块链关系型数据库中第一集合对应的数据表中。在本说明书实施例中,区块链关系型数据库对应于不同集合的标准数据维护有各自的数据表,而不同的集合具有不同的数据性质,例如具有不同的数据范围,对于明文状态的标准数据而言,其数据范围可以被节点设备清楚获知从而被维护到对应的数据表中,但对于密文状态的标准数据而言,节点设备需要通过转换前的同态密文数据对应的零知识证明来判断该同态密文数据对应的明文数据(即同态加密前的区块链数据)所处的数据范围,例如当零知识证明用于表明所述区块链数据处于第一数据范围且第一数据范围对应于第一集合,因此节点设备可以将确认该同态密文数据转换后得到的标准数据也应当属于第一数据范围对应的第一集合(因为数据转换过程并不会改变数据的值,而只是改变数据的结构与关系),于是节点设备就能够将该标准数据存储到所述区块链关系型数据库中第一集合对应的数据表中,以确保密文状态的标准数据也能按照预先定义的表结构而被分配至正确地的数据表中,同时这种对于密文状态的标准数据的基于数据表结构的分类,也给后续针对这些标准数据的数据分析带来了帮助(相当于提供了数据范围的检索维度)。
图3是一示例性实施例提供的一种设备的示意结构图。请参考图3,在硬件层面,该设备包括处理器302、内部总线303、网络接口306、内存308以及非易失性存储器310,当然还可能包括其他功能所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器302从非易失性存储器310中读取对应的计算机程序到内存308中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
如图4所示,图4是本说明书根据一示例性实施例提供的一种维护区块链数据的装置的框图,该装置可以应用于如图3所示的设备中,以实现本说明书的技术方案;该装置应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护同态密文数据及其对应的零知识证明,所述同态密文数据由所述区块链节点将运行区块链服 务时生成的区块链数据通过同态加密得到;所述装置包括:
同态密文数据获取单元401,用于获取所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明;
数据转换单元402,用于在所述零知识证明验证成功的情况下,将所述同态密文数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;
标准数据维护单元403,用于将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务,所述数据分析服务包括密文运算服务。
可选的,所述同态密文数据获取单元401具体用于:
接收所述区块链节点主动推送的所述同态密文数据及其对应的所述零知识证明;和/或,
向所述区块链节点发送区块链数据请求,接收所述区块链节点响应于所述区块链数据请求返回的所述同态密文数据及其对应的所述零知识证明。
可选的,所述同态密文数据获取单元401进一步用于:
向所述区块链节点部署的智能合约发起针对所述智能合约维护在所述区块链非关系型数据库中的所述同态密文数据及其对应的所述零知识证明的所述区块链数据请求;或者,
向所述区块链节点发起针对所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明的所述区块链数据请求。
可选的,在所述区块链数据请求针对于所述智能合约维护在所述区块链非关系型数据库中的所述同态密文数据及其对应的所述零知识证明的情况下,所述装置还包括:
模式信息查询请求发送单元404,用于向所述智能合约发起模式信息查询请求,将所述智能合约响应于所述模式信息查询请求返回的记录于所述智能合约中的第一数据库模式信息确定为所述区块链关系型数据库对应的所述数据库模式信息。
可选的,所述区块链非关系型数据库还用于维护所述区块链节点将运行区块链服务时生成的区块链数据。
可选的,所述区块链数据包括区块数据、状态数据和事件数据。
可选的,还包括:
数据分析请求接收单元405,用于接收所述分析需求方发送的数据分析请求;
分析结果返回单元406,用于将基于所述数据分析请求对所述区块链关系型数据库进行分析得到的分析结果返回所述分析需求方。
可选的,所述数据分析请求为密文运算请求,所述分析结果为密文计算结果;所述分析结果返回单元406具体用于:
将所述区块链关系型数据库中维护的所述密文运算请求指示的至少一个待运算数据进行密文计算以得到所述密文计算结果。
可选的,所述零知识证明在验证成功的情况下用于表明所述区块链数据属于第一数据范围对应的第 一集合;所述标准数据维护单元403具体用于:
将所述标准数据维护在所述区块链关系型数据库中第一集合对应的数据表中。
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为服务器系统。当然,本发明不排除随着未来计算机技术的发展,实现上述实施例功能的计算机例如可以为个人计算机、膝上型计算机、车载人机交互设备、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板 计算机、可穿戴设备或者这些设备中的任何设备的组合。
虽然本说明书一个或多个实施例提供了如实施例或流程图所述的方法操作步骤,但基于常规或者无创造性的手段可以包括更多或者更少的操作步骤。实施例中列举的步骤顺序仅仅为众多步骤执行顺序中的一种方式,不代表唯一的执行顺序。在实际中的装置或终端产品执行时,可以按照实施例或者附图所示的方法顺序执行或者并行执行(例如并行处理器或者多线程处理的环境,甚至为分布式数据处理环境)。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、产品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、产品或者设备所固有的要素。在没有更多限制的情况下,并不排除在包括所述要素的过程、方法、产品或者设备中还存在另外的相同或等同要素。例如若使用到第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
为了描述的方便,描述以上装置时以功能分为各种模块分别描述。当然,在实施本说明书一个或多个时可以把各模块的功能在同一个或多个软件和/或硬件中实现,也可以将实现同一功能的模块由多个子模块或子单元的组合实现等。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
本发明是参照根据本发明实施例的方法、装置(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息 存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储、石墨烯存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
本领域技术人员应明白,本说明书一个或多个实施例可提供为方法、系统或计算机程序产品。因此,本说明书一个或多个实施例可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书一个或多个实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本说明书一个或多个实施例可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本本说明书一个或多个实施例,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本说明书的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。
以上所述仅为本说明书一个或多个实施例的实施例而已,并不用于限制本本说明书一个或多个实施例。对于本领域技术人员来说,本说明书一个或多个实施例可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在权利要求范围之内。
Claims (12)
- 一种维护区块链数据的方法,应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护同态密文数据及其对应的零知识证明,所述同态密文数据由所述区块链节点将运行区块链服务时生成的区块链数据通过同态加密得到;所述方法包括:获取所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明;在所述零知识证明验证成功的情况下,将所述同态密文数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务,所述数据分析服务包括密文运算服务。
- 根据权利要求1所述的方法,所述获取所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明,包括:接收所述区块链节点主动推送的所述同态密文数据及其对应的所述零知识证明;和/或,向所述区块链节点发送区块链数据请求,接收所述区块链节点响应于所述区块链数据请求返回的所述同态密文数据及其对应的所述零知识证明。
- 根据权利要求2所述的方法,所述向所述区块链节点发送区块链数据请求,包括:向所述区块链节点部署的智能合约发起针对所述智能合约维护在所述区块链非关系型数据库中的所述同态密文数据及其对应的所述零知识证明的所述区块链数据请求;或者,向所述区块链节点发起针对所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明的所述区块链数据请求。
- 根据权利要求3所述的方法,在所述区块链数据请求针对于所述智能合约维护在所述区块链非关系型数据库中的所述同态密文数据及其对应的所述零知识证明的情况下,所述方法还包括:向所述智能合约发起模式信息查询请求,将所述智能合约响应于所述模式信息查询请求返回的记录于所述智能合约中的第一数据库模式信息确定为所述区块链关系型数据库对应的所述数据库模式信息。
- 根据权利要求1所述的方法,所述区块链非关系型数据库还用于维护所述区块链节点将运行区块链服务时生成的区块链数据。
- 根据权利要求1所述的方法,所述区块链数据包括区块数据、状态数据和事件数据。
- 根据权利要求1所述的方法,还包括:接收所述分析需求方发送的数据分析请求;将基于所述数据分析请求对所述区块链关系型数据库进行分析得到的分析结果返回所述分析需求方。
- 根据权利要求7所述的方法,所述数据分析请求为密文运算请求,所述分析结果为密文计算结果;所述基于所述数据分析请求对所述区块链关系型数据库进行分析,包括:将所述区块链关系型数据库中维护的所述密文运算请求指示的至少一个待运算数据进行密文计算 以得到所述密文计算结果。
- 根据权利要求1所述的方法,所述零知识证明在验证成功的情况下用于表明所述区块链数据属于第一数据范围对应的第一集合;所述将所述标准数据维护在所述区块链关系型数据库中,包括:将所述标准数据维护在所述区块链关系型数据库中第一集合对应的数据表中。
- 一种维护区块链数据的装置,应用于部署有区块链节点的节点设备,所述节点设备维护有区块链非关系型数据库和区块链关系型数据库,所述区块链非关系型数据库用于维护同态密文数据及其对应的零知识证明,所述同态密文数据由所述区块链节点将运行区块链服务时生成的区块链数据通过同态加密得到;所述装置包括:同态密文数据获取单元,用于获取所述区块链非关系型数据库中维护的所述同态密文数据及其对应的所述零知识证明;数据转换单元,用于在所述零知识证明验证成功的情况下,将所述同态密文数据转换为所述区块链关系型数据库对应的数据库模式信息定义的标准数据;标准数据维护单元,用于将所述标准数据维护在所述区块链关系型数据库中,所述区块链关系型数据库用于向分析需求方提供数据分析服务,所述数据分析服务包括密文运算服务。
- 一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器通过运行所述可执行指令以实现如权利要求1-9中任一项所述的方法。
- 一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如权利要求1-9中任一项所述方法的步骤。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210764596.7A CN115129787A (zh) | 2022-06-29 | 2022-06-29 | 一种维护区块链数据的方法、装置、电子设备和存储介质 |
CN202210764596.7 | 2022-06-29 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2024001029A1 true WO2024001029A1 (zh) | 2024-01-04 |
Family
ID=83381848
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/135428 WO2024001029A1 (zh) | 2022-06-29 | 2022-11-30 | 一种维护区块链数据的方法、装置、电子设备和存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115129787A (zh) |
WO (1) | WO2024001029A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115129787A (zh) * | 2022-06-29 | 2022-09-30 | 蚂蚁区块链科技(上海)有限公司 | 一种维护区块链数据的方法、装置、电子设备和存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106528898A (zh) * | 2017-01-04 | 2017-03-22 | 泰康保险集团股份有限公司 | 将非关系型数据库数据转换到关系型数据库的方法及装置 |
US20200076602A1 (en) * | 2018-08-29 | 2020-03-05 | International Business Machines Corporation | Trusted identity solution using blockchain |
CN112288434A (zh) * | 2020-11-20 | 2021-01-29 | 网易(杭州)网络有限公司 | 隐私交易方法、装置、零知识证明系统和隐私交易架构模型 |
CN113821817A (zh) * | 2021-11-22 | 2021-12-21 | 支付宝(杭州)信息技术有限公司 | 基于区块链的数据处理方法、装置、设备及系统 |
CN115129787A (zh) * | 2022-06-29 | 2022-09-30 | 蚂蚁区块链科技(上海)有限公司 | 一种维护区块链数据的方法、装置、电子设备和存储介质 |
-
2022
- 2022-06-29 CN CN202210764596.7A patent/CN115129787A/zh active Pending
- 2022-11-30 WO PCT/CN2022/135428 patent/WO2024001029A1/zh unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106528898A (zh) * | 2017-01-04 | 2017-03-22 | 泰康保险集团股份有限公司 | 将非关系型数据库数据转换到关系型数据库的方法及装置 |
US20200076602A1 (en) * | 2018-08-29 | 2020-03-05 | International Business Machines Corporation | Trusted identity solution using blockchain |
CN112288434A (zh) * | 2020-11-20 | 2021-01-29 | 网易(杭州)网络有限公司 | 隐私交易方法、装置、零知识证明系统和隐私交易架构模型 |
CN113821817A (zh) * | 2021-11-22 | 2021-12-21 | 支付宝(杭州)信息技术有限公司 | 基于区块链的数据处理方法、装置、设备及系统 |
CN115129787A (zh) * | 2022-06-29 | 2022-09-30 | 蚂蚁区块链科技(上海)有限公司 | 一种维护区块链数据的方法、装置、电子设备和存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN115129787A (zh) | 2022-09-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102258437B1 (ko) | 블록체인 기반 데이터 저장 및 쿼리 방법 및 디바이스 | |
CN109299102B (zh) | 一种基于Elastcisearch的HBase二级索引系统及方法 | |
CN110674228B (zh) | 数据仓库模型构建和数据查询方法、装置及设备 | |
CN109471863B (zh) | 基于分布式数据库的信息查询方法及装置、电子设备 | |
CN109614823B (zh) | 一种数据的处理方法、装置及设备 | |
US9582528B2 (en) | System and method for operating a big-data platform | |
WO2024001028A1 (zh) | 一种维护区块链数据的方法、装置、电子设备和存储介质 | |
Poorthuis et al. | Making big data small: strategies to expand urban and geographical research using social media | |
Zhao et al. | Modeling MongoDB with relational model | |
CN109491989B (zh) | 数据处理方法及装置、电子设备、存储介质 | |
CN105786808B (zh) | 一种用于分布式执行关系型计算指令的方法与设备 | |
JP6434154B2 (ja) | トランザクションアクセスパターンに基づいた結合関係の識別 | |
US10509773B2 (en) | DBFS with flashback archive | |
KR20210005043A (ko) | 입력 및 출력 스키마 매핑 | |
CN107506464A (zh) | 一种基于ES实现HBase二级索引的方法 | |
CN111221791A (zh) | 一种多源异构数据导入数据湖的方法 | |
CN108363741B (zh) | 大数据统一接口方法、装置、设备及存储介质 | |
WO2024001029A1 (zh) | 一种维护区块链数据的方法、装置、电子设备和存储介质 | |
CN111949850A (zh) | 多源数据的采集方法、装置、设备及存储介质 | |
CN111723161A (zh) | 一种数据处理方法、装置及设备 | |
CN113779349A (zh) | 数据检索系统、装置、电子设备和可读存储介质 | |
WO2024001039A1 (zh) | 一种维护区块链数据的方法、装置、电子设备和存储介质 | |
CN109063061B (zh) | 跨分布式系统数据处理方法、装置、设备及存储介质 | |
CN113190517A (zh) | 数据集成方法、装置、电子设备和计算机可读介质 | |
CN112035466A (zh) | 一种区块链查询外置索引开发框架 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22949109 Country of ref document: EP Kind code of ref document: A1 |