CN108595720B - Block chain space-time data query method, system and electronic equipment - Google Patents

Block chain space-time data query method, system and electronic equipment Download PDF

Info

Publication number
CN108595720B
CN108595720B CN201810765882.9A CN201810765882A CN108595720B CN 108595720 B CN108595720 B CN 108595720B CN 201810765882 A CN201810765882 A CN 201810765882A CN 108595720 B CN108595720 B CN 108595720B
Authority
CN
China
Prior art keywords
tree
block
time
data
range
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810765882.9A
Other languages
Chinese (zh)
Other versions
CN108595720A (en
Inventor
曲强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Institute of Advanced Technology of CAS
Original Assignee
Shenzhen Institute of Advanced Technology of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Institute of Advanced Technology of CAS filed Critical Shenzhen Institute of Advanced Technology of CAS
Priority to CN201810765882.9A priority Critical patent/CN108595720B/en
Publication of CN108595720A publication Critical patent/CN108595720A/en
Priority to PCT/CN2018/114374 priority patent/WO2020010763A1/en
Application granted granted Critical
Publication of CN108595720B publication Critical patent/CN108595720B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a block chain space-time data query method, a system and electronic equipment. The method comprises the following steps: step a: inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatiotemporal data in a block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header; step b: giving a time range and a space range corresponding to the spatio-temporal data, and searching blocks conforming to the time range in a topological structure G of the directed acyclic graph by using time meta-information in each block head in the block chain module; step c: and reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in the block header conforming to the time range, searching key data conforming to the space range, and obtaining corresponding space-time data according to the key data. The method and the device are very efficient, and can achieve the purpose of rapidly returning results meeting given requirements in an online mode.

Description

Block chain space-time data query method, system and electronic equipment
Technical Field
The application belongs to the technical field of internet databases, and particularly relates to a block chain space-time data query method, a system and electronic equipment.
Background
The block chain technology, also called as distributed book technology, is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, and the like. The blockchain is a brand new decentralized infrastructure and distributed computing paradigm that has been gradually created with the increasing popularity of digital cryptocurrency, such as bitcoin. Because the block chain has the advantages of decentralization, time sequence data, collective maintenance, safety, credibility and the like, in recent years, the block chain has been widely applied to industries such as finance, medical treatment, education and the like, and the industrial and academic circles are also exploring more application scenes of the block chain. The advent of blockchain technology has spurred the creation of a large number of new applications in various fields including spatiotemporal data management, for example, considering supply chain scenarios in which items are tracked during transportation. The demand during transportation not only requires constant updates of spatiotemporal information, but should also support rapid queries of spatiotemporal data, such as listing all data at l at time t, or all data at l from time t1 to time t 2. However, the current block chain technology cannot efficiently respond to the query of the spatio-temporal data, and the efficient query research on the spatio-temporal data has been attracting attention in the database, and if the efficient spatio-temporal data query can be performed on the block chain, the block chain technology has wide application prospects.
The block chain utilizes a Merkle tree to hash the transaction data in blocks, wherein each block comprises a block head and a block body, the block head is used for linking to the previous block to provide integrity for the block chain, and the block body comprises a data record in the process of creating the verified block. When data in the block chain needs to be inquired, the transaction data of the current block can be inquired through the block body, and the previous block of the current block in the block chain can be found through the block head. At present, for data query in a certain data mode in a block chain, it is necessary to query the transaction data in the block body of the block from the latest added block in the block chain, and then trace back to the previous block through the block head for query, and so on, and traverse the transaction data of the whole block chain.
In summary, the prior art block chain technology has the following disadvantages: 1) the method does not support the efficient management of the time and space data, and comprises the effective storage of the time and space data and the efficient query of the time and space data; 2) the query of the current block chain on the data needs to be performed on a block by a block, wherein the block is newly added to the block chain, and the block is traced back to the previous block through the block head of the current block chain; 3) the current block chain data query response method is not suitable for querying frequently-changed space-time data; 4) there is also no index to the spatial coordinate data to speed up the whole process; 5) in the block chain system, more than one complex index is often needed to build an index for the multidimensional data of the space-time data, which is not only very tedious but also has a large overhead.
Disclosure of Invention
The application provides a block chain spatiotemporal data query method, a system and electronic equipment, and aims to solve at least one of the technical problems in the prior art to a certain extent.
In order to solve the above problems, the present application provides the following technical solutions:
a block chain space-time data query method comprises the following steps:
step a: inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatiotemporal data in a block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
step b: giving a time range and a space range corresponding to the spatio-temporal data, and searching blocks conforming to the time range in a topological structure G of the directed acyclic graph by using time meta-information in each block head in the block chain module;
step c: reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in a block header conforming to the time range, searching key data conforming to the space range, and obtaining corresponding space-time data according to the key data;
and the node set of the topological structure G is V, and the edge set of the topological structure G is E.
The technical scheme adopted by the embodiment of the application further comprises the following steps: in the step b, searching for a block meeting the time range in the topological structure G of the directed acyclic graph by using the time meta information in the header of each block in the block chain module specifically includes: and searching the blocks of the directed acyclic graph according to the time range and realizing the searching by a breadth-first algorithm, wherein the topological structure G has a plurality of source nodes s for each V e V, the source nodes s start to search, and the nodes before the nearest current point are traced for the subsequent search.
The technical scheme adopted by the embodiment of the application further comprises the following steps: in the step b, searching for a block meeting the time range in the topology structure G of the directed acyclic graph by using the time meta information in the header of each block in the block chain module specifically includes:
step b1, setting a time range β, and starting to run a breadth first algorithm by using the current latest verification block returned by the GetrobustAccepted function;
b2, in the running process of the breadth first algorithm, if the time meta-information in the block head is in the time range β, putting the block into the result set;
and b3, when the searched time section is out of the time range β or the end time of the time meta-information in the block head of all the next blocks is less than the start time of the time range β, terminating the running of the breadth-first algorithm.
The technical scheme adopted by the embodiment of the application further comprises the following steps: in step c, reading root node information of a tree index structure based on a combination of the Merkle tree and the kd-tree in the block header conforming to the time range, and searching key data conforming to the space range specifically includes: obtaining a root node of a tree index structure based on the combination of the Merkle tree and the kd-Tree from a block header conforming to the time range, and comparing the space range with the tree nodes all the time from the root node downwards along a simple path; if the spatial range is larger than the tree node, the path enters the right sub-tree of the tree, if the spatial range is smaller than the tree node, the path enters the left sub-tree of the tree until a hyper-rectangle conforming to the spatial range is accessed, and hash value data in the hyper-rectangle is returned.
The technical scheme adopted by the embodiment of the application further comprises the following steps: in the step c, obtaining the corresponding spatiotemporal data according to the key data specifically includes: and finding a root node of the key-value pair index based on the Merkle Patricia-trie technology in the block header conforming to the time range, converting the hash value data into original space-time data according to the key-value pair index based on the Merkle Patricia-trie technology, and returning the original space-time data.
Another technical scheme adopted by the embodiment of the application is as follows: a system for block chain spatiotemporal data query, comprising:
a block chain module: for storing block data;
a data insertion module: the block chain module is connected with the block chain module and used for inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree and storing the spatiotemporal data in the block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
the time range searching module: the block chain module is connected with the time range and the space range corresponding to the given spatio-temporal data, and the time meta information in the head of each block in the block chain module is utilized to search out a block which accords with the time range in the topological structure G of the directed acyclic graph;
a spatial range search module: the time range searching module is connected with the time range searching module and is used for reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in a block header conforming to the time range, searching key data conforming to the space range and obtaining corresponding space-time data according to the key data;
and the node set of the topological structure G is V, and the edge set of the topological structure G is E.
The technical scheme adopted by the embodiment of the application further comprises the following steps: the time range searching module searches blocks meeting the time range in the topological structure G of the directed acyclic graph by using the time meta information in the block header of each block in the block chain module specifically as follows: and searching the blocks of the directed acyclic graph according to the time range and realizing the searching by a breadth-first algorithm, wherein the topological structure G has a plurality of source nodes s for each V e V, the source nodes s start to inquire, and the nodes in the nearest front of the current node are considered for the later inquiry.
the technical scheme adopted by the embodiment of the application also comprises that the time range searching module searches blocks which accord with the time range in a topological structure G (V, E) of the directed acyclic graph by using the time meta-information in each block head in the block chain module specifically comprises the steps of setting the time range β, starting to run a breadth-first algorithm by using a current latest verification block returned by a GetrobustAccepted function, putting the blocks into a result set if the time meta-information in the block head is within the time range β in the running process of the breadth-first algorithm, and stopping running the breadth-first algorithm when the end time of the time meta-information in the block head of the block which is searched out of the time range β or all the next block heads is smaller than the start time of the time range β.
The technical scheme adopted by the embodiment of the application further comprises the following steps: the step of reading root node information of a tree index structure based on combination of a Merkle tree and a kd tree in a block header conforming to the time range by the space range searching module, wherein the step of searching key data conforming to the space range specifically comprises the following steps: obtaining a root node of a tree index structure based on the combination of the Merkle tree and the kd-Tree from a block header conforming to the time range, and comparing the space range with the tree nodes all the time from the root node downwards along a simple path; if the spatial range is larger than the tree node, the path enters the right sub-tree of the tree, if the spatial range is smaller than the tree node, the path enters the left sub-tree of the tree until a hyper-rectangle conforming to the spatial range is accessed, and hash value data in the hyper-rectangle is returned.
The technical scheme adopted by the embodiment of the application further comprises the following steps: the spatial range searching module obtains corresponding space-time data according to the key data, and specifically comprises: and finding a root node of the key-value pair index based on the Merkle Patricia-trie technology in the block header conforming to the time range, converting the hash value data into original space-time data according to the key-value pair index based on the Merkle Patricia-trie technology, and returning the original space-time data.
The embodiment of the application adopts another technical scheme that: an electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the following operations of the block chain spatiotemporal data query method described above:
step a: inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatiotemporal data in a block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
step b: giving a time range and a space range corresponding to the spatio-temporal data, and searching blocks conforming to the time range in a topological structure G of the directed acyclic graph by using time meta-information in each block head in the block chain module;
step c: and reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in the block header conforming to the time range, searching key data conforming to the space range, and obtaining corresponding space-time data according to the key data.
Compared with the prior art, the embodiment of the application has the advantages that: the block chain spatiotemporal data query method, the block chain spatiotemporal data query system and the electronic equipment in the embodiment of the application form a new tree index by combining the Merkle tree and the kd tree so as to store spatiotemporal data in the block chain system on a directed acyclic graph structure, screen blocks conforming to a time range in the directed acyclic graph based on the new tree index, and query data conforming to a space range in the screened blocks. Compared with the prior art, the embodiment of the application has the advantages that:
1. the method is designed aiming at the spatio-temporal data from the adjustment of the storage structure of the block chain to the query of the block chain system on the data, and can accord with the application scene of the block chain on the spatio-temporal data management;
2. the space-time data query method is very efficient, results meeting given requirements can be returned rapidly in an 'on-line mode', the speed from generation to verification of the blocks is greatly improved, the designed efficient indexes are all light in weight, the occupied space is small, and the requirements of space-time block chains are met;
3. the query response process is simple and convenient to realize, and can be suitable for various mainstream spatio-temporal data queries such as knn and range query;
4. according to the method, specific time meta-information is added into the head of each block and is used for recording the time interval of the spatio-temporal data in the block, the block meeting the limit can be quickly found through given time limit during query, corresponding data in the block can be positioned according to the index combining the Merkle tree and the kd tree, and the defects that each query response in the prior art needs to traverse each block and the data in each block is read very inefficiently are overcome;
5. the method improves the defect that a block chain system is difficult to establish a non-complex index structure for multidimensional data, establishes a tree index combining a Merkle tree and a kd tree aiming at spatial data, and makes key value pairs by utilizing Merkle Patricia-trie for each time-space data, so that the key values obtained through the tree index can be conveniently and quickly positioned to original data;
6. aiming at the situation that the space-time data is mostly applied to frequent updating, the block chain adopts a directed acyclic graph structure (DAG) with faster verification time, and the verification time of the structure is superior to that of a chain structure.
Drawings
FIG. 1 is a flow chart of a block chain spatio-temporal data query method according to an embodiment of the present application;
FIG. 2 is a directed acyclic graph according to an embodiment of the present application;
FIG. 3 is a flow chart of a time range search of an embodiment of the present application;
FIG. 4 is a flow chart of a spatial range search of an embodiment of the present application;
FIG. 5 is a diagram of an exemplary response to a spatiotemporal scope query performed on a directed acyclic graph;
FIG. 6 is a block chain spatiotemporal data query system according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a hardware device of a block chain spatio-temporal data query method according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Please refer to fig. 1, which is a flowchart illustrating a method for querying spatiotemporal data in a block chain according to an embodiment of the present application. The block chain space-time data query method comprises the following steps:
step 100: in the updating process of the block chain blocks, inserting the spatio-temporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatio-temporal data in a block chain module; meanwhile, for each block in the block chain module, time meta-information is introduced in the block header;
in step 100, the spatio-temporal data is structurally in a block chain, and a tree index structure based on the combination of a Merkle tree and a kd tree is adopted in the application. Wherein, the Merkle tree is a tree structure for storing hash values, the leaves thereof are hash values of data, and the non-leaf nodes are hash values of the series strings of the corresponding child nodes thereof. And the kd-tree is a binary tree constructed for multi-dimensional euclidean space partitioning and also represents a partition of k-dimensional space formed by k-dimensional data sets, i.e. each node in the tree corresponds to a k-dimensional hyper-rectangle. And combining the two, namely the data in the kd tree nodes, and carrying out hash processing according to the Merkle tree rule. The Merkle Patricia-trie is used for storing key value pairs of the space-time data, and the key values obtained through the tree index structure can be conveniently and quickly positioned to the original data. And for the time meta-information added into each block header, the time interval for recording the spatio-temporal data in the block, when in query, the block which is in accordance with the time range can be quickly found through a given time range, and corresponding data in the block can be positioned according to a tree index structure which combines a Merkle tree and a kd tree.
Step 200: in the process of spatio-temporal data query, a time range and a space range corresponding to spatio-temporal data are given, and blocks conforming to the time range are searched in a topological structure G (V, E) of a Directed Acyclic Graph (DAG) by utilizing time meta-information in each block head in a block chain module; the node set of the topological structure G is V, and the edge set of the topological structure G is E.
In step 200, in the block chain technology, a Directed Acyclic Graph (DAG) with shorter verification time is selected, which can improve the efficiency of the block chain, so that blocks can be output in parallel in the network, and the verification time is shorter. In a DAG network, each transaction is validated requiring a link to a more recent transaction that already exists in the network, such that the width of the network remains within a certain range, allowing the new transaction to have a faster validation time. A directed acyclic graph is shown in fig. 2.
given a time range β, first searching for a block satisfying a condition on a DAG topology G (V, E) according to β, as shown in fig. 2, the topology G has a plurality of source nodes s for each V E V (a node V belonging to a node set V), the source nodes s are nodes with an degree of 0 in the directed acyclic graph, for each node V in the topology G, they are verified by subsequent nodes, and the subsequent nodes are verified by more subsequent nodes.
And starting the query by the source node s, and considering the nearest previous node of the current node for the subsequent query. The time-scale search of the blocks of each directed acyclic graph is implemented with a breadth-first algorithm (BFS). Specifically, please refer to fig. 3, which is a flowchart illustrating time range searching according to an embodiment of the present disclosure. The step of time range searching comprises:
step 201, given a time range β (start time, end time), returning the current latest verification block by utilizing a GetRebausteAccepted (G) function, and starting to run BFS;
step 202, during the execution of BFS, if the time meta information in the chunk header is within a given time range, β
Figure GDA0002381548360000111
Figure GDA0002381548360000112
Putting the block into a result set;
and step 203, when the searched blocks are out of the time range β or the end time of the time meta-information in all the next block headers is less than the start time of the time range β, terminating the operation of BFS.
Step 300: for each block which accords with the time range, reading root node information of a tree index structure based on the combination of a Merkle tree and a kd tree in the block head of each block, then accessing the whole tree index structure based on the combination of the Merkle tree and the kd tree from top to bottom, searching key data which accords with the space range, and obtaining corresponding original space-time data through a Merkle Patricia-trie technology according to the key data;
in step 300, the present application proposes an efficient block chain query response method for spatio-temporal data, so that it can support queries such as "all data in a region l in a time period s". The main process of the spatial range search is a tree traversal process, and specifically, refer to fig. 4, which is a flowchart of the spatial range search according to the embodiment of the present application. The step of spatial range search comprises:
step 301: obtaining a root node of a tree index structure based on the combination of a Merkle tree and a kd-Tree from a block head of a block conforming to a time range, and comparing a given space range with tree nodes all the time from the root node downwards along a simple path;
step 302: if the given space range is larger than the tree node, the path enters the right subtree of the tree, if the given space range is smaller than the tree node, the path enters the left subtree of the tree until a hyper-rectangle conforming to the space range is accessed, and data in the hyper-rectangle is returned;
step 303: for the returned data, because the returned data are all hash values, a root node of the key-value pair index based on the MerklePatricia-trie technology needs to be found in the block header;
step 304: and converting the hash value data into original space-time data according to the key value pair index based on the Merkle Patricia-trie technology, and returning the original space-time data.
Note that the spatial range search process will process all blocks that fit a given time range once, and the resulting returned data is the spatio-temporal data that fits the spatio-temporal query requirements. FIG. 5 is a diagram of an example of a response to a spatiotemporal range query performed on a directed acyclic graph. Firstly, obtaining blocks in a given time range according to the given time range, then, searching a corresponding hyper-rectangle in each block according to the given space range, and returning a data result in the hyper-rectangle.
Please refer to fig. 6, which is a flowchart illustrating a block chain spatiotemporal data query system according to an embodiment of the present application. The block chain space-time data query system comprises a block chain module, a data insertion module, a time range search module and a space range search module.
A block chain module: for storing block data;
a data insertion module: the block chain module is connected with the block chain module and used for inserting the spatio-temporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree in the updating process of the block chain block and storing the spatio-temporal data in the block chain module; meanwhile, for each block in the block chain module, time meta-information is introduced in the block header; in the embodiment of the application, the structure of the spatio-temporal data in the block chain adopts a tree index structure based on the combination of a Merkle tree and a kd tree. Wherein, the Merkle tree is a tree structure for storing hash values, the leaves thereof are hash values of data, and the non-leaf nodes are hash values of the series strings of the corresponding child nodes thereof. And the kd-tree is a binary tree constructed for multi-dimensional euclidean space partitioning and also represents a partition of k-dimensional space formed by k-dimensional data sets, i.e. each node in the tree corresponds to a k-dimensional hyper-rectangle. And combining the two, namely the data in the kd tree nodes, and carrying out hash processing according to the Merkle tree rule. The Merkle Patricia-trie is used for storing key value pairs of the space-time data, and the key values obtained through the tree index structure can be conveniently and quickly positioned to the original data. And for the time meta-information added into each block header, the time interval for recording the spatio-temporal data in the block, when in query, the block which is in accordance with the time range can be quickly found through a given time range, and corresponding data in the block can be positioned according to a tree index structure which combines a Merkle tree and a kd tree.
The time range searching module: the block chain module is connected with the block chain module and used for giving a time range and a space range corresponding to the spatio-temporal data in the spatio-temporal data query process, and searching blocks conforming to the time range in a topological structure G (V, E) of a Directed Acyclic Graph (DAG) by using time meta-information in each block head in the block chain module; in the embodiment of the application, in the block chain technology, a Directed Acyclic Graph (DAG) with shorter verification time is selected, so that the efficiency of the block chain can be improved, blocks can be output in parallel in a network, and the verification time is shorter. In a DAG network, each transaction is validated requiring a link to a more recent transaction that already exists in the network, such that the width of the network remains within a certain range, allowing the new transaction to have a faster validation time.
in order to implement a fast time search on the DAG, the present application introduces time meta-information contained in each block header, given a time range β, a block satisfying a condition is first searched out from β on a DAG topology G (V, E), the topology G having a plurality of source nodes s (i.e. nodes to be verified in a newly added directed acyclic graph) for each V E V, starting a query from the source nodes, considering the nearest previous node to trace the current point for the subsequent query, the block search of each directed acyclic graph being implemented with a breadth-first algorithm (BFS), in particular, the time range search module is implemented in a time range search manner, given a time range β (start time, end time), the latest verification block returned using a getrobustaccested (G) function, from which the BFS is started to run, in the course of the execution of the BFS, if the time meta-information in the block header is within the given time range β, i.e.,
Figure GDA0002381548360000131
Figure GDA0002381548360000141
and when the searched block is out of the time range β or the end time of the time meta-information in the block head of all the next blocks is less than the start time of the time range β, terminating the operation of BFS.
A spatial range search module: the system comprises a time range searching module, a hierarchical tree indexing module and a hierarchical tree indexing module, wherein the hierarchical tree indexing module is connected with the time range searching module and is used for reading root node information of a tree-shaped indexing structure based on combination of a Merkle tree and a kd tree in each block head conforming to a time range, then accessing the whole tree-shaped indexing structure of the Merkle tree and the kd tree from top to bottom, searching key data conforming to a space range, and obtaining corresponding original space-time data through a Merkle Patricia-trie technology according to the key data; the method provides an efficient block chain query response method aiming at space-time data, so that queries such as all data of a region in an s time period can be supported.
Specifically, the spatial range search module has a spatial range search mode: obtaining a root node of a tree index structure based on the combination of a Merkle tree and a kd-Tree from a block head of a block, and comparing a given spatial range with tree nodes all the time from the root node downwards along a simple path; if the given space range is larger than the tree node, the path enters the right subtree of the tree, if the given space range is smaller than the tree node, the path enters the left subtree of the tree until a hyper-rectangle conforming to the space range is accessed, and data in the hyper-rectangle is returned; for the returned data, because the returned data are all hash values, a root node of the key-value pair index based on the Merkle Patricia-trie technology needs to be found in the block header; and converting the hash value data into original space-time data according to the key value pair index based on the Merkle Patricia-trie technology, and returning the original space-time data.
According to the method, a special test network is established on the tangle (based on the directed acyclic graph) of iota, and the space-time data on Pokemongo is used for testing, so that the user can inquire the space-time data meeting the conditions on line in the test network by using the method provided by the application, and the inquiry response time is very fast. For the query mode, the experiment adopts a plurality of mainstream query modes: knn query, ball-point query, range query and bound knn query, the obtained results are all that the response speed satisfies the query of "online".
Fig. 7 is a schematic structural diagram of a hardware device of a block chain spatio-temporal data query method according to an embodiment of the present application. As shown in fig. 7, the apparatus includes one or more processors and memory. Taking a processor as an example, the apparatus may further include: an input system and an output system.
The processor, memory, input system, and output system may be connected by a bus or other means, as exemplified by the bus connection in fig. 7.
The memory, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules. The processor executes various functional applications and data processing of the electronic device, i.e., implements the processing method of the above-described method embodiment, by executing the non-transitory software program, instructions and modules stored in the memory.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data and the like. Further, the memory may include high speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory located remotely from the processor, and these remote memories may be connected to the processing system over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input system may receive input numeric or character information and generate a signal input. The output system may include a display device such as a display screen.
The one or more modules are stored in the memory and, when executed by the one or more processors, perform the following for any of the above method embodiments:
step a: inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatiotemporal data in a block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
step b: giving a time range and a space range corresponding to the spatio-temporal data, and searching blocks conforming to the time range in a topological structure G of the directed acyclic graph by using time meta-information in each block head in the block chain module;
step c: and reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in the block header conforming to the time range, searching key data conforming to the space range, and obtaining corresponding space-time data according to the key data.
The product can execute the method provided by the embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the methods provided in the embodiments of the present application.
Embodiments of the present application provide a non-transitory (non-volatile) computer storage medium having stored thereon computer-executable instructions that may perform the following operations:
step a: inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatiotemporal data in a block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
step b: giving a time range and a space range corresponding to the spatio-temporal data, and searching blocks conforming to the time range in a topological structure G of the directed acyclic graph by using time meta-information in each block head in the block chain module;
step c: and reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in the block header conforming to the time range, searching key data conforming to the space range, and obtaining corresponding space-time data according to the key data.
Embodiments of the present application provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to perform the following:
step a: inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatiotemporal data in a block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
step b: giving a time range and a space range corresponding to the spatio-temporal data, and searching blocks conforming to the time range in a topological structure G of the directed acyclic graph by using time meta-information in each block head in the block chain module;
step c: and reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in the block header conforming to the time range, searching key data conforming to the space range, and obtaining corresponding space-time data according to the key data.
The block chain spatiotemporal data query method, the block chain spatiotemporal data query system and the electronic equipment in the embodiment of the application form a new tree index by combining the Merkle tree and the kd tree so as to store spatiotemporal data in the block chain system on a directed acyclic graph structure, screen blocks conforming to a time range in the directed acyclic graph based on the new tree index, and query data conforming to a space range in the screened blocks. Compared with the prior art, the embodiment of the application has the advantages that:
1. the method is designed aiming at the spatio-temporal data from the adjustment of the storage structure of the block chain to the query of the block chain system on the data, and can accord with the application scene of the block chain on the spatio-temporal data management;
2. the space-time data query method is very efficient, results meeting given requirements can be returned rapidly in an 'on-line mode', the speed from generation to verification of the blocks is greatly improved, the designed efficient indexes are all light in weight, the occupied space is small, and the requirements of space-time block chains are met;
3. the query response process is simple and convenient to realize, and can be suitable for various mainstream spatio-temporal data queries such as knn and range query;
4. according to the method, specific time meta-information is added into the head of each block and is used for recording the time interval of the spatio-temporal data in the block, the block meeting the limit can be quickly found through given time limit during query, corresponding data in the block can be positioned according to the index combining the Merkle tree and the kd tree, and the defects that each query response in the prior art needs to traverse each block and the data in each block is read very inefficiently are overcome;
5. the method improves the defect that a block chain system is difficult to establish a non-complex index structure for multidimensional data, establishes a tree index combining a Merkle tree and a kd tree aiming at spatial data, and makes key value pairs by utilizing Merkle Patricia-trie for each time-space data, so that the key values obtained through the tree index can be conveniently and quickly positioned to original data;
6. aiming at the situation that the space-time data is mostly applied to frequent updating, the block chain adopts a directed acyclic graph structure (DAG) with faster verification time, and the verification time of the structure is superior to that of a chain structure.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (11)

1. A block chain space-time data query method is characterized by comprising the following steps:
step a: inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatiotemporal data in a block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
step b: giving a time range and a space range corresponding to the spatio-temporal data, and searching blocks conforming to the time range in a topological structure G of the directed acyclic graph by using time meta-information in each block head in the block chain module;
step c: reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in a block header conforming to the time range, searching key data conforming to the space range, and obtaining corresponding space-time data according to the key data;
and the node set of the topological structure G is V, and the edge set of the topological structure G is E.
2. The method as claimed in claim 1, wherein in step b, the searching for the blocks meeting the time range in the topology G of the directed acyclic graph using the time meta-information in the header of each block in the block chain module is specifically: and searching the blocks of the directed acyclic graph according to the time range and realizing the searching by a breadth-first algorithm, wherein the topological structure G has a plurality of source nodes s for each V e V, the source nodes s start to inquire, and the nodes in the nearest front of the current node are considered for the later inquiry.
3. The method as claimed in claim 2, wherein in the step b, searching for blocks meeting the time range in the topology G of the directed acyclic graph using the time meta-information in the header of each block in the block chain module specifically comprises:
step b1, setting a time range β, and starting to run a breadth first algorithm by using the current latest verification block returned by the GetrobustAccepted function;
b2, in the running process of the breadth first algorithm, if the time meta-information in the block head is in the time range β, putting the block into the result set;
and b3, when the searched time section is out of the time range β or the end time of the time meta-information in the block head of all the next blocks is less than the start time of the time range β, terminating the running of the breadth-first algorithm.
4. The method as claimed in claim 3, wherein in the step c, reading root node information of the tree index structure based on the Merkle tree and kd tree in the block header conforming to the time range, and searching the key data conforming to the space range specifically comprises: obtaining a root node of a tree index structure based on the combination of the Merkle tree and the kd-Tree from a block header conforming to the time range, and comparing the space range with the tree nodes all the time from the root node downwards along a simple path; if the spatial range is larger than the tree node, the path enters the right sub-tree of the tree, if the spatial range is smaller than the tree node, the path enters the left sub-tree of the tree until a hyper-rectangle conforming to the spatial range is accessed, and hash value data in the hyper-rectangle is returned.
5. The method as claimed in claim 4, wherein in the step c, obtaining the corresponding spatio-temporal data according to the key data is specifically: and finding a root node of the key-value pair index based on the Merkle Patricia-trie technology in the block header conforming to the time range, converting the hash value data into original space-time data according to the key-value pair index based on the Merkle Patricia-trie technology, and returning the original space-time data.
6. A system for block chain spatiotemporal data query, comprising:
a block chain module: for storing block data;
a data insertion module: the block chain module is connected with the block chain module and used for inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree and storing the spatiotemporal data in the block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
the time range searching module: the block chain module is connected with the time range and the space range corresponding to the given spatio-temporal data, and the time meta information in the head of each block in the block chain module is utilized to search out a block which accords with the time range in the topological structure G of the directed acyclic graph;
a spatial range search module: the time range searching module is connected with the time range searching module and is used for reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in a block header conforming to the time range, searching key data conforming to the space range and obtaining corresponding space-time data according to the key data;
and the node set of the topological structure G is V, and the edge set of the topological structure G is E.
7. The system of claim 6, wherein the time range searching module searches for blocks in the topology G of the directed acyclic graph using the time meta-information in the header of each block in the block chain module, the blocks corresponding to the time range being: and searching the blocks of the directed acyclic graph according to the time range and realizing the searching by a breadth-first algorithm, wherein the topological structure G has a plurality of source nodes s for each V e V, the source nodes s start to search, and the nodes before the nearest current point are traced for the subsequent search.
8. the system of claim 7, wherein the time range searching module searches blocks in the topology G of the directed acyclic graph using the time meta information in the header of each block in the block chain module to meet the time range, and the time range searching module starts to run the breadth first algorithm using the current latest verification block returned by the GetrobustAccepted function, puts the block into the result set if the time meta information in the header of the block is within the time range β during the running of the breadth first algorithm, and terminates to run the breadth first algorithm if the end time of the time meta information in the header of all the blocks outside the time range β or all the next block is less than the start time of the time range β.
9. The system of claim 8, wherein the spatial range search module reads root node information of a tree index structure based on a combination of the Merkle tree and the kd-tree in a block header corresponding to the time range, and searches key data corresponding to the spatial range specifically comprises: obtaining a root node of a tree index structure based on the combination of the Merkle tree and the kd-Tree from a block header conforming to the time range, and comparing the space range with the tree nodes all the time from the root node downwards along a simple path; if the spatial range is larger than the tree node, the path enters the right sub-tree of the tree, if the spatial range is smaller than the tree node, the path enters the left sub-tree of the tree until a hyper-rectangle conforming to the spatial range is accessed, and hash value data in the hyper-rectangle is returned.
10. The system of claim 9, wherein the spatial range search module obtains the corresponding spatiotemporal data according to the key data by: and finding a root node of the key-value pair index based on the Merkle Patricia-trie technology in the block header conforming to the time range, converting the hash value data into original space-time data according to the key-value pair index based on the Merkle Patricia-trie technology, and returning the original space-time data.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the following operations of the block chain spatiotemporal data query method of any one of above 1 to 5:
step a: inserting the spatiotemporal data in the block chain system into a tree index structure based on the combination of a Merkle tree and a kd tree, and storing the spatiotemporal data in a block chain module; for each block in the blockchain module, introducing temporal meta-information in a block header;
step b: giving a time range and a space range corresponding to the spatio-temporal data, and searching blocks conforming to the time range in a topological structure G of the directed acyclic graph by using time meta-information in each block head in the block chain module;
step c: and reading root node information of a tree index structure based on the combination of the Merkle tree and the kd tree in the block header conforming to the time range, searching key data conforming to the space range, and obtaining corresponding space-time data according to the key data.
CN201810765882.9A 2018-07-12 2018-07-12 Block chain space-time data query method, system and electronic equipment Active CN108595720B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810765882.9A CN108595720B (en) 2018-07-12 2018-07-12 Block chain space-time data query method, system and electronic equipment
PCT/CN2018/114374 WO2020010763A1 (en) 2018-07-12 2018-11-07 Blockchain spatio-temporal data querying method and system, and electronic apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810765882.9A CN108595720B (en) 2018-07-12 2018-07-12 Block chain space-time data query method, system and electronic equipment

Publications (2)

Publication Number Publication Date
CN108595720A CN108595720A (en) 2018-09-28
CN108595720B true CN108595720B (en) 2020-05-19

Family

ID=63618197

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810765882.9A Active CN108595720B (en) 2018-07-12 2018-07-12 Block chain space-time data query method, system and electronic equipment

Country Status (2)

Country Link
CN (1) CN108595720B (en)
WO (1) WO2020010763A1 (en)

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108595720B (en) * 2018-07-12 2020-05-19 中国科学院深圳先进技术研究院 Block chain space-time data query method, system and electronic equipment
CN109460406B (en) * 2018-10-15 2021-03-23 咪咕文化科技有限公司 Data processing method and device
CN114662159A (en) 2018-10-26 2022-06-24 蚂蚁双链科技(上海)有限公司 Data processing method, device and equipment
CN109697249A (en) * 2018-12-07 2019-04-30 深圳市云歌人工智能技术有限公司 Search for method, system and the storage medium of target object and issue object
CN109885615B (en) * 2019-01-24 2020-09-22 华东师范大学 Index-based block chain light client-oriented range query verifiable query method
CN110008249B (en) * 2019-01-31 2023-08-08 创新先进技术有限公司 Time-based data query method, device and equipment
CN110008720B (en) * 2019-03-19 2020-10-30 周口师范学院 Dynamic data tracing method and device for Internet of things based on alliance chain
CN110163007B (en) * 2019-04-23 2021-05-04 西安邮电大学 Block chain-based data integrity verification method, equipment and storage medium
CN111861459A (en) * 2019-04-28 2020-10-30 常州一仙智能科技有限公司 Iota account book optimization system and method based on DPoS consensus algorithm
US10853341B2 (en) 2019-06-28 2020-12-01 Advanced New Technologies Co., Ltd. Blockchain based hierarchical data storage
CN110347684B (en) * 2019-06-28 2020-09-01 阿里巴巴集团控股有限公司 Block chain based hierarchical storage method and device and electronic equipment
CN110569246B (en) * 2019-07-23 2022-03-11 腾讯科技(深圳)有限公司 Block chain node information synchronization method and device, computer equipment and storage medium
CN112307010B (en) * 2019-07-29 2024-04-16 创新先进技术有限公司 Data storage method, device and equipment
CN110602148B (en) * 2019-10-10 2021-07-06 深圳前海微众银行股份有限公司 Method and device for generating state tree of block and verifying data on chain
CN111080288B (en) * 2019-10-18 2023-08-18 湖南天河国云科技有限公司 Block chain consensus achieving method and device based on directed acyclic graph
US11269863B2 (en) 2020-01-23 2022-03-08 International Business Machines Corporation Index structure for blockchain ledger
CN111614721B (en) * 2020-04-14 2022-11-22 梁伟 Multi-dimensional block chain network, and method and device for generating multi-dimensional block chain network
CN111832059B (en) * 2020-09-16 2020-12-29 北京长隆讯飞科技有限公司 Space big data management method and system based on cloud service
CN112951357B (en) * 2021-03-23 2023-05-09 电子科技大学 Virtual medical resource lateral expansion method based on blockchain
CN113901142B (en) * 2021-10-13 2024-05-07 辽宁大学 Space-time data-oriented block chain architecture and range query processing method
CN114756603B (en) * 2022-05-23 2023-04-07 天津大学 High-efficiency verifiable query method for lightweight block chain
CN117453982A (en) * 2023-09-12 2024-01-26 武汉世纪科怡科技发展有限公司 File management file classification system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106682825A (en) * 2016-12-22 2017-05-17 南京邮电大学 System and method for evaluating credit of Social Internet of Things based on block chain
WO2017218984A1 (en) * 2016-06-16 2017-12-21 The Bank Of New York Mellon Ensuring data integrity of executed transactions
CN107730176A (en) * 2017-10-18 2018-02-23 上海唯链信息科技有限公司 A kind of goods logistic information inquiry system and method based on block chain

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104750708B (en) * 2013-12-27 2018-09-28 华为技术有限公司 A kind of index establishing method of space-time data, querying method, device and equipment
CN106095952A (en) * 2016-06-15 2016-11-09 公安部第三研究所 In space-time unique based on key assignments cloud storage, magnanimity crosses car record method for quickly querying
AU2016101183A4 (en) * 2016-07-20 2016-09-22 Platform Secured Pty Ltd Network System Innovation Method using blockchain identity based single and multi facial, voice and other bio recognition encryption protocols from existing binary packets to blockchain blocks where the actual member/ user in the blockchain becomes the fully encrypted and shielded block
CN106227833A (en) * 2016-07-26 2016-12-14 宁圣金融信息服务(上海)有限公司 Block chaining search engine method, system and device
CN106295406A (en) * 2016-08-13 2017-01-04 深圳市樊溪电子有限公司 A kind of block chain that is used for is from safe storage system and method thereof
CN107247773B (en) * 2017-06-07 2018-05-15 北京邮电大学 A kind of method that inquiry is traded in distributed data base based on block chain
CN107423368B (en) * 2017-06-29 2020-07-17 中国测绘科学研究院 Spatio-temporal data indexing method in non-relational database
CN107729371B (en) * 2017-09-12 2020-04-21 深圳先进技术研究院 Data indexing and querying method, device, equipment and storage medium of block chain
CN107807951B (en) * 2017-09-18 2020-10-13 联动优势科技有限公司 Block chain generation method, data verification method, node and system
CN108595720B (en) * 2018-07-12 2020-05-19 中国科学院深圳先进技术研究院 Block chain space-time data query method, system and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017218984A1 (en) * 2016-06-16 2017-12-21 The Bank Of New York Mellon Ensuring data integrity of executed transactions
CN106682825A (en) * 2016-12-22 2017-05-17 南京邮电大学 System and method for evaluating credit of Social Internet of Things based on block chain
CN107730176A (en) * 2017-10-18 2018-02-23 上海唯链信息科技有限公司 A kind of goods logistic information inquiry system and method based on block chain

Also Published As

Publication number Publication date
WO2020010763A1 (en) 2020-01-16
CN108595720A (en) 2018-09-28

Similar Documents

Publication Publication Date Title
CN108595720B (en) Block chain space-time data query method, system and electronic equipment
US11157510B2 (en) Data normalization using data edge platform
US11520780B2 (en) Distributed database systems and structures
US8788464B1 (en) Fast ingest, archive and retrieval systems, method and computer programs
CN111324577B (en) Yml file reading and writing method and device
US20120096054A1 (en) Reading rows from memory prior to reading rows from secondary storage
CN106874425B (en) Storm-based real-time keyword approximate search algorithm
CN111190904A (en) Method and device for hybrid storage of graph-relational database
CN103678550A (en) Mass data real-time query method based on dynamic index structure
CN114064984B (en) World state increment updating method and device based on sparse array linked list
CN110909111A (en) Distributed storage and indexing method based on knowledge graph RDF data characteristics
Xu et al. Efficient and effective similarity search over probabilistic data based on earth mover’s distance
CN112988217A (en) Code library design method and detection method for rapid full-network code traceability detection
CN113704248B (en) Block chain query optimization method based on external index
US20240095241A1 (en) Data search method and apparatus, and device
CN208781225U (en) A kind of block chain spatiotemporal data warehouse system and electronic equipment
Lian et al. Quality-aware subgraph matching over inconsistent probabilistic graph databases
CN116561382A (en) Data processing method, device, equipment and storage medium of graph database
WO2013097065A1 (en) Index data processing method and device
CN114048219A (en) Graph database updating method and device
CN114416741A (en) KV data writing and reading method and device based on multi-level index and storage medium
CN113779025A (en) Optimization method, system and application of classified data retrieval efficiency in block chain
WO2017019883A1 (en) Locality-sensitive hashing for algebraic expressions
Yingfan et al. Revisiting $ k $-Nearest Neighbor Graph Construction on High-Dimensional Data: Experiments and Analyses
Čerešňák et al. Improvement of Data Searching in MongoDB with the Use of Oracle Database

Legal Events

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