A method and device for querying blockchain stored data
By constructing a multi-level index tree in an external database, using hash values to perform layer-by-layer retrieval, and combining the characteristics of the blockchain storage system, the problem of low retrieval efficiency of the blockchain storage system under large amounts of data is solved, and query efficiency is improved. efficiency.
Patent Information
- Application Number
- CN202110426757.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-20
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2041-04-20
AI Technical Summary
Due to the chain storage characteristics, the existing blockchain storage system cannot efficiently handle large-scale data retrieval and transaction processing of distributed databases, resulting in low query efficiency.
By pre-building a multi-level index tree in the external database, using the hash value of the query information submitted by the user to perform layer-by-layer retrieval, a multi-level index mechanism is introduced based on the characteristics of the blockchain storage system to improve query efficiency.
It achieves rapid retrieval of blockchain storage data, improves transaction processing and query efficiency, and solves the problem of low retrieval efficiency of blockchain storage systems under large data volumes.
Smart Images

Figure CN113157735B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing, and in particular to a method and device for querying blockchain stored data. Background Art
[0002] At present, the rapid development of big data has brought great challenges to the fields of data management and data security. For example, the data lake composed of multi-source raw data has become the focus of attention. The management of such complex data and the guarantee of data security are relatively difficult. With the development of blockchain technology, using the encryption properties of blockchain technology itself to store data has gradually become a hot topic. The natural encryption properties of blockchain technology can effectively protect data security and data privacy.
[0003] However, the current blockchain storage system essentially only organizes data in a blockchain manner. Although this can improve data security and encryption characteristics, due to the chain storage characteristics of the blockchain system, the native blockchain storage system can only search for data in a linear manner. This method is obviously not feasible when the amount of data is large, which makes data retrieval and transaction processing for distributed databases face great obstacles and low retrieval efficiency.
[0004] Therefore, how to better implement transaction processing and query based on blockchain storage systems has become a research focus of the industry. Summary of the invention
[0005] The present invention provides a method and device for querying blockchain storage data, so as to better realize transaction processing and query based on the blockchain storage system.
[0006] The present invention provides a method for querying blockchain stored data, comprising:
[0007] Obtaining a hash value of the query information according to the query information submitted by the user;
[0008] The query information includes block number, table name, keyword or semantics, and temporal information;
[0009] According to the hash value of the query information, the multi-level index tree in the external database is searched layer by layer to obtain the target storage data corresponding to the hash value of the query information;
[0010] The multi-level index tree includes the hash value of the query information pre-stored by the user.
[0011] According to a method for querying blockchain stored data provided by the present invention, before the step of obtaining a hash value of the query information submitted by the user, the method further includes:
[0012] According to the original data stored by the user, the original data is sliced to obtain a plurality of sliced data;
[0013] Encrypting the sliced data according to the encryption key of the user to obtain encrypted sliced data;
[0014] Generate a hash value corresponding to the encryption key according to the encrypted shard data and the encryption key;
[0015] The encrypted shard data is stored in a blockchain system, and a keyword corresponding to the encrypted shard data, a table name where the keyword is located, and a block number where a table corresponding to the table name is located are obtained.
[0016] According to a method for querying blockchain storage data provided by the present invention, before the step of encrypting the shard data according to the encryption key of the user, the method further includes:
[0017] Extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data;
[0018] A semantic temporal index of the shard data is constructed according to the semantics and temporal information of the shard data.
[0019] According to a method for querying blockchain stored data provided by the present invention, after the step of constructing a semantic temporal index of the shard data according to the semantics and temporal information of the shard data, the method further includes:
[0020] Constructing a table-level hash index of a multi-level index tree according to the hash value of the keyword corresponding to each of the encrypted shard data;
[0021] Constructing a block-level hash index of the multi-level index tree according to the hash value of the table name where each keyword is located in the block number;
[0022] Constructing a root node-level hash index of the multi-level index tree according to the hash value of the block number of the table corresponding to each table name;
[0023] The multi-level index tree is constructed according to the table-level hash index, the block-level hash index, the tree root node-level hash index and the semantic temporal index of the shard data.
[0024] According to a method for querying blockchain storage data provided by the present invention, the step of extracting semantic and temporal information of the shard data to obtain the semantic and temporal information of the shard data is specifically as follows:
[0025] In the case where the segmented data is structured data, the meta information in the structured data is extracted to obtain the semantic and temporal information of the structured data.
[0026] According to a method for querying blockchain storage data provided by the present invention, the step of extracting semantic and temporal information of the shard data to obtain the semantic and temporal information of the shard data is specifically as follows:
[0027] In the case that the segmented data is semi-structured data, the semi-structured data is converted into network ontology language data, and the attribute relationship in the network ontology language data is extracted to obtain the semantics and temporal information of the semi-structured data.
[0028] According to a method for querying blockchain storage data provided by the present invention, the step of extracting semantic and temporal information of the shard data to obtain the semantic and temporal information of the shard data is specifically as follows:
[0029] In the case where the slice data is unstructured data, meta information in the unstructured data is extracted to obtain semantic and temporal information of the unstructured data.
[0030] The present invention also provides a device for querying blockchain stored data, comprising:
[0031] A query module, used to obtain a hash value of the query information according to the query information submitted by the user;
[0032] The query information includes block number, table name, keyword or semantics, and temporal information;
[0033] A query result returning module is used to search layer by layer in the multi-level index tree in the external database according to the hash value of the query information, obtain the target storage data corresponding to the hash value, and return it to the user;
[0034] The multi-level index tree includes the hash value of the query information pre-stored by the user.
[0035] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-mentioned edge network dynamic service unloading and scheduling methods are implemented.
[0036] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned edge network dynamic service unloading and scheduling methods are implemented.
[0037] The method and device for querying blockchain storage data provided by the present invention pre-builds a multi-level index tree in an external database, so that when a user performs a data query, the system can quickly retrieve the target storage data corresponding to the hash value of the query information through the hash value of the query information. The method of the present invention improves the query efficiency by combining the characteristics of the blockchain storage system and introducing a multi-level index mechanism. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 It is a flowchart of a method for querying blockchain storage data provided by the present invention;
[0040] Figure 2 is a schematic diagram of a framework of a multi-level indexing mechanism in an embodiment of the present invention;
[0041] Figure 3 is a schematic diagram of a method for extracting semantic and temporal information of data in an embodiment of the present invention;
[0042] Figure 4 It is a schematic diagram of the overall architecture of the method for querying blockchain storage data provided by the present invention;
[0043] Figure 5 It is a schematic diagram of an SGX hardware security system and a homomorphic encryption method in an embodiment of the present invention;
[0044] Figure 6 is a schematic diagram of a distributed storage adjustable consistency assurance method in an embodiment of the present invention;
[0045] Figure 7 It is a schematic diagram of the structure of the device for querying blockchain storage data provided by the present invention;
[0046] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] Figure 1 It is a flowchart of the method for querying blockchain storage data provided by the present invention, such as Figure 1 As shown, including:
[0049] Step S1, obtaining a hash value of the query information according to the query information submitted by the user;
[0050] The query information includes block number, table name, keyword or semantics and temporal information.
[0051] Specifically, the query information submitted by the user described in the present invention refers to the information content input by the user into the system query layer.
[0052] In an embodiment of the present invention, the keyword in the query information refers to the keyword corresponding to the query information pre-stored by the user in the blockchain system; the table name in the query information refers to the table name where the keyword corresponding to the query information pre-stored by the user is located; the block number in the query information refers to the block number where the table corresponding to the table name in the query information pre-stored by the user is located; the semantic and temporal information in the query information refers to sequence information and semantic information including data features or time states that can be directly obtained from the original data.
[0053] Furthermore, according to the query information submitted by the user, a hash value corresponding to the query information can be obtained based on a pre-built multi-level index tree.
[0054] Step S2, searching layer by layer in the multi-level index tree in the external database according to the hash value of the query information, and obtaining the target storage data corresponding to the hash value of the query information;
[0055] The multi-level index tree includes the hash value of the query information pre-stored by the user.
[0056] Specifically, the multi-level index tree described in the present invention is pre-built and stored in an external database, not in the blockchain system. Since the multi-level index tree only contains hash values, it can be ensured that even if it is stored in an external database, it will not affect the information security of the blockchain system.
[0057] The multi-level index tree includes three layers of structure: table-level hash index, block-level hash index, and tree root node-level hash index.
[0058] The target storage data described in the present invention refers to the storage data content in the blockchain system that the user requests to query.
[0059] In the embodiment of the present invention, through the pre-constructed multi-level index tree, layer-by-layer retrieval can be performed in the multi-level index tree according to the hash value of the query information to obtain the target storage data.
[0060] The layer-by-layer retrieval described in the present invention refers to a retrieval process from the root node level hash index of a multi-level index tree to the block level hash index, and then from the block level hash index to the table level hash index, based on the block number, table name, hash value or semantics of the keyword and the hash value of the temporal information submitted by the user.
[0061] The method provided by the embodiment of the present invention pre-builds a multi-level index tree in an external database, so that when a user performs a data query, the system can quickly retrieve the target storage data corresponding to the hash value of the query information through the hash value of the query information. The method of the present invention improves the query efficiency by combining the characteristics of the blockchain storage system and introducing a multi-level index mechanism.
[0062] Based on any of the above embodiments, before the step of obtaining a hash value of the query information according to the query information submitted by the user, the method further includes:
[0063] According to the original data stored by the user, the original data is sliced to obtain a plurality of sliced data;
[0064] Encrypting the sliced data according to the encryption key of the user to obtain encrypted sliced data;
[0065] Generate a hash value corresponding to the encryption key according to the encrypted shard data and the encryption key;
[0066] The encrypted shard data is stored in a blockchain system, and a keyword corresponding to the encrypted shard data, a table name where the keyword is located, and a block number where a table corresponding to the table name is located are obtained.
[0067] Specifically, the original data described in the present invention refers to user stored data that has not been processed or simplified in any way.
[0068] The user encryption key described in the present invention refers to the key information generated by the system when the user encrypts the slice data.
[0069] The data sharding described in the present invention refers to dividing the original data stored by the user into multiple manageable blocks, which can be distributed on multiple storage nodes of the blockchain system. The specific sharding rules are determined according to the data type and application.
[0070] Furthermore, the user encrypts the shard data to ensure that others cannot access the data in the shard, no matter what state the data is in.
[0071] Based on the hash algorithm, the encrypted shard data and encryption key generate a unique hash value, which is used to construct the Merkle tree in the blockchain system. Among them, the Merkle tree is also called a hash tree because any parent node of the Merkle tree is equal to the hash result of the addition of the left and right child node data.
[0072] The encrypted shard data is distributedly stored in the blockchain system. Based on the distributed data storage characteristics, the keyword corresponding to the encrypted shard data and the table name where the keyword is located, as well as the block number where the table corresponding to the table name is located can be obtained.
[0073] At the same time, before storage, the system can also copy the encrypted shard data into multiple backups to prevent data loss and alleviate performance bottlenecks caused by large-scale I / O interfaces.
[0074] Furthermore, the blockchain peer-to-peer network system distributes each replicated backup shard data to multiple storage nodes geographically dispersed for data storage. Different storage nodes belong to different individuals or organizations, and no entity can access all the data in the system. Only content owners can access their own data.
[0075] The method of the embodiment of the present invention constructs a distributed data storage system of the blockchain system by performing data sharding, shard data encryption, shard data hashing and other processing on the original data.
[0076] Based on any of the above embodiments, before the step of encrypting the shard data according to the encryption key of the user, the method further includes:
[0077] Extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data;
[0078] A semantic temporal index of the shard data is constructed according to the semantics and temporal information of the shard data.
[0079] Specifically, the semantic and temporal information described in the present invention includes semantic information and temporal information. Semantic information refers to various metadata that can be directly obtained from the original data and data features obtained through other feature algorithms; temporal information refers to sequence information that changes over time, such as weather data and traffic data.
[0080] The shard data described in the present invention may be multi-dimensional heterogeneous data. In an embodiment of the present invention, multi-dimensional heterogeneous data is classified into three categories, namely structured data, semi-structured data and unstructured data.
[0081] Furthermore, semantic and temporal information is extracted from the three types of multivariate heterogeneous data, and a semantic temporal index of the sharded data is constructed based on the extracted semantic and temporal information, wherein the index may be a B+ tree, a hash index, a bitmap index or a hash index.
[0082] The method of the embodiment of the present invention constructs a semantic temporal index by extracting semantic and temporal information from shard data, so as to support semantic and temporal queries on data in a blockchain storage system based on the semantic temporal index.
[0083] Based on any of the above embodiments, after the step of constructing a semantic temporal index of the shard data according to the semantics and temporal information of the shard data, the method further includes:
[0084] Constructing a table-level hash index of a multi-level index tree according to the hash value of the keyword corresponding to each of the encrypted shard data;
[0085] Constructing a block-level hash index of the multi-level index tree according to the hash value of the table name where each keyword is located in the block number;
[0086] Constructing a root node-level hash index of the multi-level index tree according to the hash value of the block number of the table corresponding to each table name;
[0087] The multi-level index tree is constructed according to the table-level hash index, the block-level hash index, the tree root node-level hash index and the semantic temporal index of the shard data.
[0088] Specifically, the keyword described in the present invention refers to the value used to identify each encrypted shard data. Through the hash algorithm, according to the hash value of the keyword corresponding to each encrypted shard data, a table-level hash index of a multi-level index tree is constructed, thereby directly pointing to the logical position of the encrypted shard data in the system through the table-level hash index.
[0089] Furthermore, also based on the hash algorithm, a block-level hash index of a multi-level index tree is constructed according to the hash value of the table name where each keyword is located in the block number; a root node-level hash index of a multi-level index tree is constructed according to the hash value of the block number where the table corresponding to each table name is located. A three-layer hash index tree is constructed based on the table-level hash index, block-level hash index, and root node-level hash index.
[0090] In an embodiment of the present application, in order to implement semantic and temporal queries on data in a blockchain storage system, a semantic temporal index of the sharded data is added to the above-mentioned hash index tree.
[0091] The method of the embodiment of the present invention, by constructing a multi-level index mechanism, enables users to perform fast data retrieval queries based on block numbers, table names, keywords and semantics as well as temporal information.
[0092] Figure 2 Schematic diagram of the framework of the multi-level indexing mechanism in the embodiment of the present invention. Figure 2 As shown in the figure, the blockchain system has a chain storage characteristic, and the constructed multi-level index mechanism is a three-layer index structure, which is divided into table-level hash index, block-level hash index, and tree root node-level hash index.
[0093] like Figure 2 As shown in the left figure, at the table-level hash index layer, for example, in the keyword donate, the corresponding data is 1001100…01, and in the keyword transfer, the corresponding data is 1101100…01; Figure 2 As shown in the right figure, in the table name Histogram, the keyword is bucket 1 、bucket 2 、bucket 3 Etc. Different keywords correspond to different shard data. For example, in bucket 1, the corresponding shard data is Min-500; in bucket 2, the corresponding shard data is 500-800; in bucket 3, the corresponding shard data is 800-1600.
[0094] like Figure 2 As shown in the left figure, at the block-level hash index layer, there are n tables, ((1,1,Ts 1 ),P 1 ),…,((n,j,Ts n ),P n ). Another example Figure 2 As shown in the right figure, it includes n blocks, namely block 1, block 2, ..., block n. Each block has its own block number. According to the block number, you can see the data structure content in the corresponding block.
[0095] The block-level hash index layer is the tree root node-level hash index layer, which is combined with the block-level hash index layer and the table-level hash index layer to form a three-layer hash index mechanism.
[0096] Based on any of the above embodiments, the step of extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data is specifically as follows:
[0097] In the case where the segmented data is structured data, the meta information in the structured data is extracted to obtain the semantic and temporal information of the structured data.
[0098] Specifically, when the sharded data is structured data, the present application adopts a semantic and temporal extraction method based on conversion rules, which can extract metadata from structured data by setting multiple rules and use the metadata as the semantic and temporal information of the structured data.
[0099] The method of the embodiment of the present invention obtains the semantics and temporal information of the structured data by extracting the semantics and temporal information of the structured data, so as to realize the semantic and temporal query of the structured data.
[0100] Based on any of the above embodiments, the step of extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data is specifically as follows:
[0101] In the case that the segmented data is semi-structured data, the semi-structured data is converted into network ontology language data, and the attribute relationship in the network ontology language data is extracted to obtain the semantics and temporal information of the semi-structured data.
[0102] Specifically, the semi-structured data described in the present invention is extensible markup language (XML) file data, and its elements mainly include three categories: nodes, attributes and attribute values.
[0103] Furthermore, the process of extracting semantic and temporal information is divided into content conversion and hierarchical relationship conversion. XML data is now converted into Web Ontology Language (OWL) data, and then the class-attribute relationship in the OWL data is used as semantic and temporal information.
[0104] The method of the embodiment of the present invention obtains the semantics and temporal information of the semi-structured data by extracting the semantics and temporal information of the semi-structured data, so as to realize the semantic and temporal query of the semi-structured data.
[0105] Based on any of the above embodiments, the step of extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data is specifically as follows:
[0106] In the case where the slice data is unstructured data, meta information in the unstructured data is extracted to obtain semantic and temporal information of the unstructured data.
[0107] Specifically, the unstructured data described in the present invention includes pictures, videos, documents, etc. In the embodiments of the present application, some current mainstream deep learning-based methods, including supervised neural network models and unsupervised pre-trained network models, are used to extract metadata from unstructured data. Such methods are rich in variety and are very suitable for automatic extraction of semantic information of unstructured data, including Uniform Resource Locator (URL) location information, key item features, feature item names, feature item content, etc., thereby obtaining the semantic and temporal information of unstructured data.
[0108] The method of the embodiment of the present invention obtains the semantics and temporal information of the unstructured data by extracting the semantics and temporal information of the unstructured data, so as to realize the semantic and temporal query of the unstructured data.
[0109] Figure 3 FIG. 1 is a schematic diagram of a method for extracting semantic and temporal information of data in an embodiment of the present invention. Figure 3 As shown, for the extraction of semantic and temporal information of structured data, the semantic and temporal information of structured data is obtained based on rule-based feature methods; for the extraction of semantic and temporal information of semi-structured data, the semantic and temporal information of semi-structured data is obtained based on content conversion and hierarchical conversion; for the extraction of semantic and temporal information of unstructured data, the semantic and temporal information of unstructured data is obtained based on feature models such as deep learning.
[0110] It should be noted that the rapidly and massively growing data is diverse in form and complex in structure. Semantic and temporal extraction of multi-dimensional heterogeneous data is a key step in classifying, organizing, retrieving and querying information.
[0111] The method of the embodiment of the present invention realizes semantic query and temporal query on the blockchain database by integrating semantic and temporal information.
[0112] Figure 4 It is a schematic diagram of the overall architecture of the method for querying blockchain storage data provided by the present invention. Figure 4 As shown, the overall architecture includes a data layer, an index layer, and a query layer.
[0113] Services are provided to users through cloud services, among which the data layer is responsible for data storage and semantic temporal information extraction; the index layer is responsible for building hash index trees; and the query layer is responsible for providing a variety of query structures.
[0114] The data in the data layer includes data of various modalities, structured data, unstructured data, and various heterogeneous data.
[0115] Blockchain systems include blockchain systems based on decentralized architectures such as Bitcoin and Ethereum. Consensus schemes include but are not limited to Proof of Work (POW), Proof of Stake (POS), Byzantine Fault Tolerance (BFT), and Virtual Routing Forwarding (VRF).
[0116] In addition, the entire system uses the SGX security system and encrypted operators based on homomorphic encryption to ensure system data security.
[0117] Data security refers to ensuring that as little original data information as possible is provided to users during the retrieval and calculation processes, thereby reducing the risk of data leakage.
[0118] Through the embodiments of the present invention, a method for data sharding and encryption is provided, which, under the premise of ensuring data security, structures the data to a certain extent and distributes the data on different physical machines, so as to facilitate subsequent various operations on the storage system.
[0119] Figure 5 is a schematic diagram of an SGX hardware security system and a homomorphic encryption method in an embodiment of the present invention, such as Figure 5 As shown, the users of the system are divided into data requesters and data uploaders. After the data uploader uploads the data to the blockchain storage system through the system cloud service interface, the data requester can apply for data access rights from the data uploader.
[0120] In an embodiment of the present invention, the cloud service system is responsible for data connection with the data system, and the data system mainly includes three parts, namely the blockchain database, the SGX security system, and the database basic secret operator.
[0121] The construction method of the blockchain database and the index construction method are as described above and will not be repeated here.
[0122] The SGX hardware system is a security hardware system designed based on the SGX technology developed by Intel. Its essence is to design a set of CPU instructions and use hardware to create a trusted security zone. Relevant data and instructions run in the security zone and are completely invisible to users at the operating system level. All codes placed in the security zone are enabled through special instructions and are built and loaded into Windows dynamic link library files. This area is isolated from the operating system, virtual machine, and even the lower-level components such as BIOS and privileged system code, thus preventing many hidden dangers.
[0123] The SGX security system does not rely on the security status of firmware and software, and provides a trusted execution environment for user space. Through a new set of instruction set extensions and access control mechanisms, it achieves isolated operation between different programs, ensuring the confidentiality and integrity of user key code and data from being damaged by malware.
[0124] The basic secret operator of the database is implemented based on technologies such as homomorphic encryption, with the aim of supporting the secret query technology of the blockchain database. Among them, homomorphic encryption technology is a cryptographic technology based on the computational complexity theory of mathematical problems.
[0125] The method of the embodiment of the present invention develops basic secret state operators through the cooperation of software and hardware, realizes the data secret state query function, and ensures data security.
[0126] Figure 6 Schematic diagram of a method for ensuring the adjustable consistency of distributed storage in an embodiment of the present invention. Figure 6 As shown, the blockchain distributed system includes two types of nodes, coordination nodes and replica nodes. The replica nodes are further divided into read operation response nodes and write operation response nodes.
[0127] Distributed storage refers to the aforementioned distributed data storage system based on the blockchain system.
[0128] The consistency of data among all nodes in the system is a natural characteristic of the blockchain distributed ledger, but building a blockchain database requires each node to expand its transaction processing capabilities, so ensuring adjustable consistency is the basis for the normal operation of the blockchain database.
[0129] In an embodiment of the present invention, the adjustable consistency refers to at least five adjustable consistency levels.
[0130] Through the embodiments of the present invention, a distributed storage adjustable consistency guarantee method is proposed. Figure 6 As shown, the total number of nodes in the blockchain distributed system is N, the number of nodes responding to write operations is W, and the number of nodes responding to read operations is R. Furthermore, the coordination node achieves different degrees of consistency levels by adjusting parameters such as N, W, and R, thereby achieving adjustable consistency.
[0131] In an embodiment of the present invention, a query method for blockchain storage data is also provided, which improves the retrieval performance of the blockchain storage system by designing a multi-level index mechanism; supports semantic query and temporal query of on-chain data by adding semantic and temporal information to the on-chain data; develops basic secret operators through the cooperation of software and hardware to realize data secret query function and ensure data security; and for the adjustable consistency problem in distributed databases, realizes the elasticity and adjustability of the storage system in distributed transaction processing by designing a set of redundant copy intelligent detection algorithms, ensuring at least five adjustable consistency levels.
[0132] Figure 7 It is a schematic diagram of the structure of the query device for blockchain storage data provided by the present invention. Figure 7 As shown, including:
[0133] A query module 710, configured to obtain a hash value of the query information according to the query information submitted by the user;
[0134] The query information includes block number, table name, keyword or semantics, and temporal information;
[0135] The query result returning module 720 is used to search layer by layer in the multi-level index tree in the external database according to the hash value of the query information, obtain the target storage data corresponding to the hash value, and return it to the user;
[0136] The multi-level index tree includes the hash value of the query information pre-stored by the user.
[0137] The query device for blockchain storage data provided by the present invention pre-builds a multi-level index tree in an external database, so that when a user performs a data query, the system can quickly retrieve the target storage data corresponding to the hash value of the query information through the hash value of the query information. The method of the present invention improves the query efficiency by combining the characteristics of the blockchain storage system and introducing a multi-level index mechanism.
[0138] The edge network dynamic service unloading and scheduling device described in the present invention and the edge network dynamic service unloading and scheduling method described above can refer to each other, so they are not described in detail.
[0139] Figure 8 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 8As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the query method for the blockchain storage data, the method comprising: obtaining the hash value of the query information submitted by the user; wherein the query information includes the block number, the table name, the keyword or the semantics and the temporal information; according to the hash value of the query information, searching layer by layer in the multi-level index tree in the external database to obtain the target storage data corresponding to the hash value of the query information; wherein the multi-level index tree includes the hash value of the query information pre-stored by the user.
[0140] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0141] On the other hand, the present invention also provides a computer program product, comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, and when the program instructions are executed by a computer, the computer can execute the query method for the blockchain storage data provided by the above methods, the method comprising: obtaining a hash value of the query information submitted by a user; wherein the query information includes a block number, a table name, a keyword or semantics, and temporal information; according to the hash value of the query information, searching layer by layer in a multi-level index tree in an external database to obtain the target storage data corresponding to the hash value of the query information; wherein the multi-level index tree includes the hash value of the query information pre-stored by the user.
[0142] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the query method for the blockchain storage data provided by the above methods, the method comprising: obtaining a hash value of the query information submitted by a user; wherein the query information includes a block number, a table name, a keyword or semantics, and temporal information; according to the hash value of the query information, searching layer by layer in a multi-level index tree in an external database to obtain the target storage data corresponding to the hash value of the query information; wherein the multi-level index tree includes the hash value of the query information pre-stored by the user.
[0143] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for querying blockchain stored data, characterized in that: include: Obtaining a hash value of the query information according to the query information submitted by the user; The query information includes block number, table name, keyword or semantics, and temporal information; According to the hash value of the query information, the multi-level index tree in the external database is searched layer by layer to obtain the target storage data corresponding to the hash value of the query information; Wherein, the multi-level index tree includes the hash value of the query information pre-stored by the user; Before the step of obtaining a hash value of the query information according to the query information submitted by the user, the method further includes: According to the original data stored by the user, the original data is sliced to obtain a plurality of sliced data; Encrypting the sliced data according to the encryption key of the user to obtain encrypted sliced data; Generate a hash value corresponding to the encryption key according to the encrypted shard data and the encryption key; The encrypted shard data is stored in the blockchain system, and a keyword corresponding to the encrypted shard data, a table name where the keyword is located, and a block number where a table corresponding to the table name is located are obtained; Before the step of encrypting the shard data according to the encryption key of the user, the method further includes: Extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data; Constructing a semantic temporal index of the shard data according to the semantic and temporal information of the shard data; After the step of constructing a semantic temporal index of the shard data according to the semantic and temporal information of the shard data, the method further includes: Constructing a table-level hash index of a multi-level index tree according to the hash value of the keyword corresponding to each of the encrypted shard data; Constructing a block-level hash index of the multi-level index tree according to the hash value of the table name where each keyword is located in the block number; Constructing a root node-level hash index of the multi-level index tree according to the hash value of the block number of the table corresponding to each table name; The multi-level index tree is constructed according to the table-level hash index, the block-level hash index, the tree root node-level hash index and the semantic temporal index of the shard data.
2. The method for querying blockchain storage data according to claim 1, characterized in that: The step of extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data is specifically as follows: In the case where the segmented data is structured data, the meta information in the structured data is extracted to obtain the semantic and temporal information of the structured data.
3. The method for querying blockchain storage data according to claim 1, characterized in that: The step of extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data is specifically as follows: In the case that the segmented data is semi-structured data, the semi-structured data is converted into network ontology language data, and the attribute relationship in the network ontology language data is extracted to obtain the semantics and temporal information of the semi-structured data.
4. The method for querying blockchain storage data according to claim 1, characterized in that: The step of extracting semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data is specifically as follows: In the case where the slice data is unstructured data, meta information in the unstructured data is extracted to obtain semantic and temporal information of the unstructured data.
5. A device for querying blockchain stored data, characterized in that: include: A query module, used to obtain a hash value of the query information according to the query information submitted by the user; The query information includes block number, table name, keyword or semantics, and temporal information; A query result returning module is used to search layer by layer in the multi-level index tree in the external database according to the hash value of the query information, obtain the target storage data corresponding to the hash value, and return it to the user; Wherein, the multi-level index tree includes the hash value of the query information pre-stored by the user; Also includes: A data slicing module is used to slice the original data stored by the user to obtain multiple sliced data; An encryption module, used for encrypting the slice data according to the encryption key of the user to obtain encrypted slice data; A generation module, used to generate a hash value corresponding to the encryption key according to the encrypted shard data and the encryption key; A storage module is used to store the encrypted shard data in a blockchain system, and obtain a keyword corresponding to the encrypted shard data, a table name where the keyword is located, and a block number where a table corresponding to the table name is located; An extraction module, used to extract semantic and temporal information from the shard data to obtain the semantic and temporal information of the shard data; A semantic temporal index building module, used to build a semantic temporal index of the shard data according to the semantics and temporal information of the shard data; A table-level hash index building module, used to build a table-level hash index of a multi-level index tree according to the hash value of the keyword corresponding to each encrypted shard data; A block-level hash index building module, used to build a block-level hash index of the multi-level index tree according to the hash value of the table name where each keyword is located in the block number; A tree root node level hash index construction module, used to construct a tree root node level hash index of the multi-level index tree according to the hash value of the block number of the table corresponding to each table name; A multi-level index tree construction module is used to construct the multi-level index tree according to the table-level hash index, the block-level hash index, the tree root node-level hash index and the semantic temporal index of the shard data.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method for querying blockchain storage data as described in any one of claims 1 to 4 are implemented.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for querying blockchain storage data as described in any one of claims 1 to 4 are implemented.
