CN114519078A - Cross-chain credible query method and system based on block chain - Google Patents

Cross-chain credible query method and system based on block chain Download PDF

Info

Publication number
CN114519078A
CN114519078A CN202210407404.7A CN202210407404A CN114519078A CN 114519078 A CN114519078 A CN 114519078A CN 202210407404 A CN202210407404 A CN 202210407404A CN 114519078 A CN114519078 A CN 114519078A
Authority
CN
China
Prior art keywords
query
node
chain
target data
key value
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.)
Granted
Application number
CN202210407404.7A
Other languages
Chinese (zh)
Other versions
CN114519078B (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.)
People's Court Information Technology Service Center
Beijing Institute of Technology BIT
Original Assignee
People's Court Information Technology Service Center
Beijing Institute of Technology BIT
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 People's Court Information Technology Service Center, Beijing Institute of Technology BIT filed Critical People's Court Information Technology Service Center
Priority to CN202210407404.7A priority Critical patent/CN114519078B/en
Publication of CN114519078A publication Critical patent/CN114519078A/en
Application granted granted Critical
Publication of CN114519078B publication Critical patent/CN114519078B/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
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6227Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database where protection concerns the structure of data, e.g. records, types, queries

Abstract

The present disclosure relates to the field of block chain technologies, and in particular, to a block chain-based cross-chain trusted query method and system. The method comprises the steps of converting a query request received from a query chain into a query message, wherein the query message comprises a key value of target data; under the condition that the consensus verification result of the query message is passed, the query message is sent to a queried chain so that the queried chain queries according to the key value of the target data to obtain a query response and sends the query response, wherein the query response comprises the queried target data; under the condition that the consensus verification result of the query response is passed, verifying the target data according to the query response; and sending the target data to the query chain under the condition that the verification result of the target data is passed. Through the embodiment of the invention, cross-chain trusted query of the block chain is realized, and the security of the query message received by the query chain is ensured.

Description

Cross-chain trusted query method and system based on block chain
Technical Field
The present disclosure relates to the field of block chain technologies, and in particular, to a block chain-based cross-chain trusted query method and system.
Background
In a judicial scene, each of a court system, a scouting yard system and a judicial administrative system is provided with a block chain system for storing data of each party, when the data needs to be mutually inquired among the court system, the scouting yard system or the judicial administrative system, a cross-chain technology of the block chain needs to be adopted to realize data inquiry among different block chain systems, and how to ensure the credibility of the data inquired in the cross-chain mode is a problem of close attention in the prior art.
At present, in order to perform query between different blockchain systems, an existing method is to integrate a blockchain with a database management system, for example, an etherhouse uses a level db, which is a Key-Value structure-based database to fetch data, and a part of blockchains select to use a file system or a relational database to store data, and complete query of cross-chain data through a third-party database, but this method directly stores all data on the blockchain, which may result in an increase in data storage amount on the blockchain, reduce efficiency of cross-chain query, and greatly waste computational resources of the blockchain. In addition, the centralized database is often provided by a third-party server, so that the returned query result may be tampered, and the centralized database sink is difficult to ensure the security of the query data, so that the method for performing cross-chain query by using the database is difficult to ensure the credibility of the query data.
Now, a cross-chain trusted query method based on a block chain is needed, so that the problem that the cross-chain query method in the prior art is difficult to ensure the credibility of query data is solved.
Disclosure of Invention
In order to solve the problem that a cross-chain query method cannot guarantee the credibility of query data, embodiments of the present disclosure provide a block chain-based cross-chain trusted query method and system, which improve the credibility of cross-chain query data and improve the efficiency of cross-chain query.
In order to solve the technical problems, the specific technical scheme is as follows:
in one aspect, embodiments herein provide a block chain-based cross-chain trusted query method, including,
converting a query request received from a query chain into a query message, wherein the query message comprises a key value of target data;
under the condition that the consensus verification result of the query message is passed, sending the query message to a queried chain so that the queried chain queries according to the key value of the target data to obtain a query response, wherein the query response comprises the queried target data;
receiving the query response sent by the queried chain, and verifying the target data according to the query response under the condition that the consensus verification result of the query response is passed;
and sending the target data to the query chain under the condition that the verification result of the target data is passed.
Further, the query response further comprises a hash value of the target data and a verification path, and the structure of the verification path is a partial red-black tree;
the verification path comprises a plurality of nodes in a second cross-chain index library of the queried chain, and each node comprises a key value of the node and a hash value of the node.
Further, the step of validating the target data in response to the query response may include,
step 1: taking the hash value of the target data as a first child node hash value;
step 2: determining a second child node in the same hierarchy as the first child node in the verification path;
and step 3: calculating the hash value of the father node according to the hash value of the first child node, the hash value of the second child node and the key value of the father node of the first child node and the second child node;
and 4, step 4: if the father node is not the root node, taking the father node as the first child node, and repeating the step 2;
and 5: and if the father node is the root node, judging whether the hash value of the root node is the same as the hash value of the root node in the verification path, and if so, passing the target data verification.
Further, converting the query request received from the query chain transmission to a query message further comprises,
determining the key value corresponding to the name of the target data in the query request;
and replacing the name of the target data with the key value to obtain the query message.
On the other hand, the embodiment herein also provides a block chain-based cross-chain trusted query method, which includes,
acquiring a query message converted by a relay chain according to a query request sent by the query chain, wherein the query message comprises a key value of target data;
determining block header information of the target data in a first cross-chain index library according to the key value of the target data;
searching a red-black tree corresponding to the block header information in a second cross-chain index database according to the block header information, searching a target data query result of a leaf node corresponding to the key value in the red-black tree, and recording a verification path of the target data query result, wherein the target data query result comprises the target data and a hash value of the target data;
and sending a query response comprising a target data query result and a verification path to the relay chain, so that the relay chain sends the target data in the target data query result to the query chain after the query response is verified.
Further, determining a target data query result corresponding to the key value in a second cross-chain index library according to the block header information and the key value further comprises,
determining a root node of a red-black tree corresponding to the block header information;
determining a query path according to the key value and the key value of each node in the index tree corresponding to the root node, wherein any child node in the query path only has a parent node corresponding to the child node;
and taking the data corresponding to the leaf nodes in the query path as the target data query result.
Further, each node of the second cross-chain index library comprises a key value of the node and a hash value of the node;
the key value of a leaf node in the second cross-chain index database is the same as the key value of the target data, and the hash value of the leaf node is a hash value calculated by the target data through a hash algorithm;
the hash value of any father node in the second cross-chain index library is a hash value calculated by a hash algorithm from the hash values of all the next-level child nodes corresponding to the father node and the key value of the father node;
and the hash value of the root node in the second cross-chain index library is a hash value calculated by a hash algorithm from the hash values of all the next-level child nodes corresponding to the root node and the key value of the root node.
Further, the step of determining the query path according to the key value and the key value of each node in the index tree corresponding to the root node comprises,
step 1: taking the root node as a top-level node, and recording the top-level node in the query path;
step 2: comparing the key value of the target data with the key value of the head-level node;
and step 3: if the key value of the target data is greater than the key value of the first-level node, taking a next-level child node of the first-level node in the right sub-tree of the first-level node as a secondary node, recording the secondary node in the query path according to the hierarchical relationship between the secondary node and the first-level node, taking the secondary node as the first-level node, and repeating the step 2;
and 4, step 4: if the key value of the target data is less than or equal to the key value of the first-level node, taking a next-level child node of the first-level node in a left sub-tree of the first-level node as a secondary node, recording the secondary node in the query path according to the hierarchical relationship between the secondary node and the first-level node, taking the secondary node as the first-level node, and repeating the step 2;
and 5: and when the next-level child node does not exist in the first-level node and the key value of the first-level node is equal to the key value of the target data, finishing determining the query path.
Further, recording the verification path of the target data query result further comprises,
in the process of determining the query path, if the key value of the target data is greater than the key value of the first-level node, recording the key value of the first-level node and a next-level child node of the first-level node in a left sub-tree of the first-level node in the verification path according to the hierarchical relationship;
and if the key value of the target data is less than or equal to the key value of the first-level node, recording the key value of the first-level node and a next-level child node of the first-level node in a right sub-tree of the first-level node in the verification path according to the hierarchical relationship.
Finally, the embodiment of the present disclosure further provides a block chain-based cross-chain trusted query system, which includes a query chain, a relay chain, and a queried chain;
the query chain is used for sending a query request to the relay chain;
the relay chain is used for converting a query request received from the query chain into a query message, and the query message comprises a key value of target data; sending the query message to the queried chain under the condition that the consensus verification result of the query message is passed;
the inquired chain is used for determining the block header information of the target data in a first cross-chain index library according to the key value of the target data; searching a red-black tree corresponding to the block header information in a second cross-chain index database according to the block header information, searching a target data query result of a leaf node corresponding to the key value in the red-black tree, and recording a verification path of the target data query result, wherein the target data query result comprises the target data and a hash value of the target data; sending a query response including a target data query result and a verification path to the relay chain;
the relay chain is further used for verifying the target data according to the inquiry response under the condition that the consensus verification result of the inquiry response is passed; and sending the target data to the query chain under the condition that the verification result of the target data is passed.
By utilizing the embodiment of the text, the query chain sends the query request to the relay chain, and the node on the relay chain performs consensus verification on the query request, so that the security of the query request of the query chain in the process of cross-chain transmission is ensured, the relay chain converts the query request into the query message which can be processed by the queried chain according to the data structure of the queried chain under the condition that the result of the consensus verification on the query request passes, then sends the query message to the queried chain, and after the queried chain receives the query message sent by the relay chain, the node on the queried chain performs consensus verification on the query message, so that the security of the query message received by the queried chain is ensured, and under the condition that the result of the consensus verification on the query message passes, the queried chain searches the query result corresponding to the query message in the first cross-chain index library and the second cross-chain index library according to the query message, the cross-chain query between different block chains is realized through the cross-chain technology of the block chains. And the structure of the second cross-chain index library of the queried chain is a red-black tree, and the target data is searched in the red-black tree, so that the query speed of the queried chain is improved, and the cross-chain query efficiency is improved. In addition, the inquired chain also records a verification path of the target data inquiry result in the inquiry process, and sends both the inquiry result and the verification path of the target data to the relay chain, the relay chain verifies the target data through the verification path, and after the verification is passed, the target data is sent to the inquiry chain, so that the credible inquiry among different block chains is realized.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of an implementation system of a block chain-based cross-chain trusted query method according to an embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating a block chain-based cross-chain trusted query method according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a block chain-based cross-chain trusted query method according to an embodiment of the present disclosure;
fig. 4 is a process of determining a target data query result corresponding to a key value in a second cross-chain index repository according to the block header information and the key value in the embodiment herein;
FIG. 5 is a diagram illustrating a structure of a Reddish-Black tree in a second inter-chain index repository according to an embodiment of the present disclosure;
FIG. 6 illustrates a process of converting a query request received from a query chain into a query message according to an embodiment herein;
FIG. 7 is a data flow diagram of a block chain based cross-chain trusted query system according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure.
[ description of reference ]:
101. a query chain;
102. a relay chain;
103. a queried chain;
802. a computer device;
804. a processing device;
806. a storage resource;
808. a drive mechanism;
810. an input/output module;
812. an input device;
814. an output device;
816. a presentation device;
818. a graphical user interface;
820. a network interface;
822. a communication link;
824. a communication bus.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments herein without making any creative effort, shall fall within the scope of protection.
It should be noted that the terms "first," "second," and the like in the description and claims herein and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments herein described are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or device.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
Fig. 1 is a schematic diagram of an implementation system of a block chain-based cross-chain trusted query method according to an embodiment of the present disclosure, where the implementation system may include: the query chain 101, the relay chain 102, and the queried chain 103, the query chain 101, the relay chain 102, and the queried chain 103 communicate with each other through a Network, and the Network may include a Local Area Network (LAN), a Wide Area Network (WAN), the internet, or a combination thereof, and is connected to a website, a user device (e.g., a computing device), and a backend system. The query chain 101 may correspond to any one of a court chain, a quarantine chain, or a judicial administration chain, and the queried chain 103 may correspond to any one of the court chain, the quarantine chain, or the judicial administration chain, but it should be noted that the query chain 101 corresponds to a different block chain from the queried chain 103. Query chain 101 may initiate a cross-chain query request to queried chain 103, and relay chain 102 is responsible for cross-chain data transfer between query chain 101 and queried chain 103. Wherein, the queried chain 103 can respond to the query request of the query chain 101 forwarded by the relay chain 102 through one or more servers. And a judicial data-oriented data processing system is deployed on the server. Alternatively, the servers may be nodes of a cloud computing system (not shown), or each server may be a separate cloud computing system comprising multiple computers interconnected by a network and operating as a distributed processing system. The server may run any suitable computing system that enables it to act as a node in the blockchain network of queried chain 103.
In addition, it should be noted that fig. 1 shows only one application environment provided by the present disclosure, and in practical applications, other application environments may also be included, for example, cross-chain trusted query on medical data of each hospital may be implemented on the query chain 101, the relay chain 102, and the queried chain 103, and this specification is not limited.
In the prior art, when a block chain is queried across chains, a block chain and a database management system are integrated together, for example, an etherhouse or the like uses a level db (Key-Value structure) -based database to fetch data, while part of the block chain selects a file system or a relational database to store data, and completes the query of data across chains through a third-party database. However, the method adopts the database to perform cross-chain query, and credibility is difficult to guarantee. In the forensic scene, the data is stored firstly instead of a single chain, but a plurality of chains are stored, so that the storage load on each chain is smaller; secondly, the uplink is also sensitive and authoritative data, and the requirements on authority, safety and privacy are higher and the requirements on real-time performance and high load are lower in the data access in the judicial field; finally, the condition of multi-chain cross-chain query is more complex and variable, a plurality of chains are used for storing important and sensitive data, the security of a centralized database is difficult to guarantee, the centralized database is provided by a third-party server, and therefore the returned query result is likely to be tampered. Therefore, it is difficult to guarantee credibility by using the database for cross-chain query.
The other method is based on cross-chain credible query of the light nodes, and the light nodes are adopted for verification of the query, wherein the light nodes refer to the following steps: the technology that the node locally only stores the transaction data related to the node, but not stores the complete blockchain information comprises the following specific steps: and arranging light nodes of the source chain in advance in the target chain, wherein the nodes and all nodes on the source chain carry out connection synchronization information, and when the target chain receives cross-chain information data about the source chain, the light nodes can be verified truthfully according to block header information stored in the light nodes. The scheme of the light node partially uses the concept of SPV for reference, thereby effectively reducing the cost of cross-chain query verification and ensuring the credibility. However, the light node-based cross-link query method has the disadvantages that the data fields are not directly queried, and if the transaction is to be queried, the transaction complete information containing all the field information can be obtained only by querying according to the hash value of the transaction. In a forensic department cross-chain query scene, an attribute segment on another chain needs to be queried, and the method obviously cannot complete the query of any field. Thus, the data flexibility and the universality of the existing block chain query are relatively low, and the conventional database query function is not achieved.
A verifiable query based on a vChain framework is characterized in that an ADS (authenticated data structure) is built into a block chain structure on the basis of the light node method, any attribute on a chain can be queried, and the light node and some cryptography methods are adopted in the method to ensure the integrity of results during cross-chain query. However, the method only supports one-chain query or cross-chain query of homogeneous chains, and the structure of the method is more complex and less efficient to adapt to a plurality of heterogeneous chains. The problems faced by forensic department cross-chain query are as follows: chains of different departments are heterogeneous, and sometimes direct query is needed according to attribute names without knowing the specific structure of opposite heterogeneous data, so that the method cannot meet the requirement of a legal suspects scene.
Aiming at the problems in the existing block chain cross-chain query technology, the embodiment of the invention provides a block chain based cross-chain trusted query method, which improves the data structure of a queried chain, thereby improving the query speed, and adds a verification step in the query process, and the verification step is executed by a relay chain, thereby realizing cross-chain trusted query. Fig. 2 is a flowchart illustrating a block chain-based cross-chain trusted query method according to an embodiment of the present disclosure. The process of cross-chain querying based on blockchains is described in this figure, but may include more or fewer operational steps based on conventional or non-creative efforts. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual system or apparatus product executes, it can execute sequentially or in parallel according to the method shown in the embodiment or the figures. As shown in fig. 2, the method may be performed by a relay chain, and may include:
step 201: converting a query request received from a query chain into a query message, wherein the query message comprises a key value of target data;
step 202: under the condition that the consensus verification result of the query message is passed, sending the query message to a queried chain so that the queried chain queries according to the key value of the target data to obtain a query response, wherein the query response comprises the queried target data;
step 203: receiving the query response sent by the queried chain, and verifying the target data according to the query response under the condition that the consensus verification result of the query response is passed;
step 204: and sending the target data to the query chain under the condition that the verification result of the target data is passed.
By the method of the embodiment, the query chain sends the query request to the relay chain, and the node on the relay chain performs consensus verification on the query request, so that the security of the query request of the query chain in the process of cross-chain transmission is ensured, the relay chain converts the query request into a query message which can be processed by the query chain according to the data structure of the queried chain under the condition that the result of the consensus verification on the query request passes, then sends the query message to the queried chain, and after the query chain receives the query message sent by the relay chain, the node on the queried chain performs consensus verification on the query message, so that the security of the query message received by the queried chain is ensured, and under the condition that the result of the consensus verification on the query message passes, the queried chain searches the query result corresponding to the query message in the first cross-chain index library and the second cross-chain index library according to the query message, the cross-chain inquiry among different block chains is realized through the cross-chain technology of the block chains. And the structure of the second cross-chain index library of the queried chain is a red-black tree, and the target data is searched in the red-black tree, so that the query speed of the queried chain is improved, and the cross-chain query efficiency is improved. In addition, the inquired chain also records a verification path of the target data inquiry result in the inquiry process, and sends both the inquiry result and the verification path of the target data to the relay chain, the relay chain verifies the target data through the verification path, and after the verification is passed, the target data is sent to the inquiry chain, so that the credible inquiry among different block chains is realized.
In this embodiment, since the data structures may be different between the query chain and the queried chain, the query chain does not know the unique identifier of the data in the queried chain, and only knows the name of the data to be queried (i.e., the target data), therefore, when receiving a query request sent by the query chain, the relay chain needs to convert the query request into a query message that can be processed by the query chain, where the query message may include a key value of the target data and a signature of the query request, then the nodes on the relay chain perform consensus verification on the query message, and after the verification is passed, the nodes on the relay chain generate proposal blocks of the query message and store the proposal blocks in respective storage areas of the nodes on the relay chain, thereby ensuring the security of the query message. Specifically, a cross-link gateway enumerated by the relay link may receive an inquiry request sent by an inquiry link, and convert the inquiry request into an inquiry message, where the cross-link gateway may encapsulate the inquiry request by using an ibtp (inter block chain Transfer protocol) protocol to obtain the inquiry message.
And when the result of the consensus verification of the relay chain on the query message is passed, the relay chain sends the query message to the queried chain, the nodes on the queried chain perform consensus verification on the query message, and after the verification is passed, a proposal block of the query message is generated and stored in respective storage areas of the nodes on the chain, so that the security of the query message is ensured, and then the queried chain performs query according to the key value of the target data to obtain a query response and sends the query response to the relay chain, wherein the query response comprises the queried target data. After the relay link receives the query response sent by the queried link, the link node of the relay link performs consensus verification on the query response, and after the verification is passed, a proposal block of the query response is generated and stored in respective storage areas of the link nodes, so that the security of the query response in the transmission process is ensured. And then the relay chain sends the query response to the cross-chain gateway, and the cross-chain gateway sends the target data in the query response to the relay chain to complete cross-chain query.
Correspondingly, the embodiment herein also provides a block chain-based cross-chain trusted query method, which is executed by a queried chain, as shown in fig. 3, including,
step 301: acquiring a query message converted by a relay chain according to a query request sent by the query chain, wherein the query message comprises a key value of target data;
step 302: determining block header information of the target data in a first cross-chain index library according to the key value of the target data;
step 303: searching a red-black tree corresponding to the block header information in a second cross-chain index database according to the block header information, searching a target data query result of a leaf node corresponding to the key value in the red-black tree, and recording a verification path of the target data query result, wherein the target data query result comprises the target data and a hash value of the target data;
step 304: and sending a query response comprising a target data query result and a verification path to the relay chain, so that the relay chain sends the target data in the target data query result to the query chain after the query response is verified.
In this embodiment, when the queried link receives the query message sent by the relay chain, the link node of the queried chain performs consensus verification on the query message first, in the case that the result of the consensus verification on the query message is passed, the queried chain determines the block header information of the target data in the first cross-chain index library according to the key value of the target data, wherein the structure of the first cross-chain index library is a k-v database, a plurality of target data are stored in the same Mercker tree in a queried chain, the root node of the Mercker tree is the block head information, therefore, the first cross-chain index base stores the corresponding relation between the key values of a plurality of target data and the block head information, the block header information corresponding to the key value of the target data can be found in the first cross-chain index library, that is, the mercker tree where the target data is located is found.
And then the searched chain searches a red-black tree corresponding to the block header information in a second cross-chain index base according to the block header information, and searches a target data query result of a leaf node corresponding to the key value in the searched red-black tree, wherein the second cross-chain index base stores a plurality of Merck trees, each Merck tree has a structure of the red-black tree, the Merck tree where the target data is located is determined according to the block header information, and then the target data query result of the leaf node of the Merck tree is searched in the found Merck tree according to the key value of the target data, wherein the query result of the target data comprises the target data and the hash value of the target data, and the hash value of the target data can be understood as the hash value of the target data, namely the hash value of the leaf node of the found Merck tree corresponding to the key value.
In addition, the queried chain also records a verification path of the target data query result, so that the relay chain can verify the target data through the verification path.
According to an embodiment of the present disclosure, in order to increase the query speed in the second cross-chain index database, as shown in fig. 4, determining the target data query result corresponding to the key value in the second cross-chain index database according to the chunk header information and the key value in step 303 further includes,
step 401: determining a root node of a red-black tree corresponding to the block header information;
step 402: determining a query path according to the key value and the key value of each node in the index tree corresponding to the root node, wherein any child node in the query path only has a parent node corresponding to the child node;
step 403: and taking the data corresponding to the leaf nodes in the query path as the target data query result.
Further, each node of the second cross-chain index library comprises a key value of the node and a hash value of the node;
the key value of a leaf node in the second cross-chain index database is the same as the key value of the target data, and the hash value of the leaf node is a hash value calculated by the target data through a hash algorithm;
the hash value of any father node in the second cross-chain index library is a hash value calculated by a hash algorithm from the hash values of all the next-level child nodes corresponding to the father node and the key value of the father node;
and the hash value of the root node in the second cross-chain index library is a hash value calculated by a hash algorithm from the hash values of all the next-level child nodes corresponding to the root node and the key value of the root node.
In this embodiment, the red-black tree in the second cross-chain index library may be as shown in fig. 5, the target Data may include basic information, professional information, reward and punishment information, traffic information, social service information, and the like, each target Data is stored in Data of the Data structure shown in fig. 5, i.e., Data1-Data6, each target Data has a key value key, the key values key are permanently stored in the mercker tree of the blockchain in the form of hash operation, it is ensured that the key is not tampered, i.e., key 1 is 5, key 2 is 8, key 3 is 9, key 4 is 11, Data5 is 13, Data6 is 16, and hash values of the target Data are stored in leaf nodes of the red-black tree shown in fig. 5, i.e., H1-H6 are hash values of Data 1-6, and corresponding leaf nodes (5, H3, H388) are leaf nodes (H388, h2) The key of which the hash value of (2) is H2 is 8, the key of which the hash value of the leaf node (9, H3) is H3 is 9, the key of which the hash value of the leaf node (11, H4) is H4 is 11, the key of which the hash value of the leaf node (13, H5) is H5 is 13, and the key of which the hash value of the leaf node (16, H6) is H6 is 16.
The parent node in the red-black tree shown in fig. 5 also includes a key value and a hash value, for example, the hash value of the parent node (5, H7) is H7, the key value is 5, the hash value of the parent node is a hash value calculated by a hash algorithm on the hash values of all the next-level child nodes corresponding to the parent node and the key value of the parent node, that is, H7 is the hash values H1 and H2 of the next-level child nodes, and the key value 5 of the parent node is obtained by the hash algorithm; the hash value of the parent node is H10, the key value is 8, the hash value of the parent node is the hash value calculated by the hash algorithm on the hash values of all the next-level child nodes corresponding to the parent node and the key value of the parent node, that is, H10 is the hash values H7 and H8 of the next-level child nodes, and the key value 8 of the parent node is obtained by the hash algorithm.
The root node in the red and black tree shown in fig. 5 also includes a key value and a hash value, for example, the hash value of the root node (12, H11) is H11, the key value is 12, the hash value of the root node is a hash value calculated by a hash algorithm on the hash values of all next-level child nodes corresponding to the root node and the key value of the root node, that is, H11 is the hash values H10, H9 of the next-level child nodes, and the key value 12 of the root node is obtained by a hash algorithm.
In the query process, firstly, determining a root node of a red-black tree corresponding to block header information, namely finding the red-black tree corresponding to the block header information; determining a query path according to the key value and the key value of each node in the index tree corresponding to the root node, wherein any child node in the query path only has one parent node corresponding to the child node (namely, the child node conforms to a binary tree structure), and the query path represents all nodes passed by in the process of traversing the red-black tree to find target data; and finally, taking data corresponding to the leaf nodes in the query path as a query result of the target data.
Preferably, according to one embodiment herein, the step 402 of determining the query path includes, according to the key value and the size of the key value of each node in the index tree corresponding to the root node,
step 1: taking the root node as a top-level node, and recording the top-level node in the query path;
step 2: comparing the key value of the target data with the key value of the first-level node;
and step 3: if the key value of the target data is greater than the key value of the first-level node, taking a next-level child node of the first-level node in the right sub-tree of the first-level node as a secondary node, recording the secondary node in the query path according to the hierarchical relationship between the secondary node and the first-level node, taking the secondary node as the first-level node, and repeating the step 2;
and 4, step 4: if the key value of the target data is less than or equal to the key value of the first-level node, taking a next-level child node of the first-level node in a left sub-tree of the first-level node as a secondary node, recording the secondary node in the query path according to the hierarchical relationship between the secondary node and the first-level node, taking the secondary node as the first-level node, and repeating the step 2;
and 5: and when the next-level child node does not exist in the first-level node and the key value of the first-level node is equal to the key value of the target data, finishing determining the query path.
Illustratively, continuing with fig. 5, if the key value of the target data is 11, first taking the root node (12, H11) as the top node, recording the root node (12, H11) in the query path; then comparing the key value 11 of the target data with the key value 12 of the first-level node (12, H11), and if the key value 11 of the target data is smaller than the key value of the first-level node (12, H11), executing step 4 to obtain that the secondary node is (8, H10), recording the secondary node (8, H10) in the query path, and recording the node (8, H10) as the next-level child node of the node (12, H11); then taking the secondary node (8, H10) as a primary node, continuing to compare the key value 8 of the primary node (8, H10) with the key value 11 of the target data, if the key value 11 of the target data is greater than the key value 8 of the primary node (8, H10), executing step 3 to obtain that the secondary node is (10, H8), and recording the secondary node (10, H8) in the query path; then, taking the secondary node (10, H8) as the primary node, continuing to compare the key value 10 of the primary node (10, H8) with the key value 11 of the target Data, because the key value 11 of the target Data is greater than the key value 10 of the primary node (10, H8), executing step 3 to obtain a leaf node (11, H4), and since the key value 11 of the leaf node (11, H4) is equal to the key value 11 of the target Data, the Data4 pointed to by the leaf node (11, H4) is the target Data, and H4 is a hash value of Data 4.
Through the steps, only half of the red and black trees need to be traversed in each iteration, and compared with the existing method for traversing the whole Merck tree, the method greatly shortens the query path and improves the query speed.
According to an embodiment herein, in order for the relay chain to verify the queried target data, the step 303 of recording the verification path of the target data query result further includes,
in the process of determining the query path, if the key value of the target data is greater than the key value of the first-level node, recording the key value of the first-level node and a next-level child node of the first-level node in a left sub-tree of the first-level node in the verification path according to the hierarchical relationship;
and if the key value of the target data is less than or equal to the key value of the first-level node, recording the key value of the first-level node and a next-level child node of the first-level node in a right sub-tree of the first-level node in the verification path according to the hierarchical relationship.
In this embodiment, since the key value of the leaf node in the second cross-chain index library is the same as the key value of the target data, the hash value of the leaf node is the hash value calculated by the hash algorithm for the target data, the hash value of any parent node in the second cross-chain index library is the hash value calculated by the hash algorithm for the hash value of all next-level child nodes corresponding to the parent node and the key value of the parent node, and the hash value of the root node in the second cross-chain index library is the hash value calculated by the hash algorithm for the hash value of all next-level child nodes corresponding to the root node and the key value of the root node, the verification path may record a node opposite to the node in the query path, that is, the hash value of the root node may be calculated according to the hash value of the target data in the query result of the target data and the node in the verification path, and then comparing whether the calculated hash value of the root node is the same as the hash value of the root node in the target data query result, and if so, passing the verification.
Illustratively, continuing with fig. 5, if the key value of the target data is 11, in determining the query path, the root node (12, H11) is first used as the top node; then comparing the key value 11 of the target data with the key value 12 of the top node (12, H11), because the key value 11 of the target data is smaller than the key value of the top node (12, H11), obtaining a next-level node (15, H9) in the right sub-tree of the top node (12, H11), recording the node (15, H9) in the verification path, and recording the key value 12 of the top node (12, H11) in the verification path; comparing, when the first-level node is (8, H10) during the determination of the query path, a size of a key value 8 of the first-level node (8, H10) with a key value 11 of the target data, because the key value 11 of the target data is greater than the key value 8 of the first-level node (8, H10), obtaining a next-level node (5, H7) in a left sub-tree of the first-level node (8, H10), recording the node (5, H7) in the verification path, and recording the key value 8 of the first-level node (8, H10) in the verification path, comparing, when the first-level node is (10, H8) during the determination of the query path, a size of a key value 10 of the first-level node (10, H8) with the key value 11 of the target data, because the key value 11 of the target data is greater than the value 10 of the first-level node (10, H8), obtaining a next-level node (9) in the left sub-tree of the first-level node (10, H8), h3) The node (9, H3) is recorded in the verification path, and the key value 10 of the top node (10, H8) is recorded in the verification path.
According to one embodiment herein, the query response further includes a hash value of the target data and a verification path, and the structure of the verification path is a partial red-black tree;
the verification path comprises a plurality of nodes in a second cross-chain index library of the queried chain, and each node comprises a key value of the node and a hash value of the node.
In this embodiment, the queried chain sends the hash value of the root node of the query path, the target data, the hash value of the target data, and the verification path to the relay chain, so that the relay chain verifies the target data. The partial red-black tree comprises designated nodes of a complete red-black tree in a second cross-chain index base of the queried chain.
Correspondingly, according to one embodiment herein, the step 203 of verifying the target data according to the query response comprises,
step 1: taking the hash value of the target data as a first child node hash value;
step 2: determining a second child node in the same hierarchy as the first child node in the verification path;
and step 3: calculating the hash value of the father node according to the hash value of the first child node, the hash value of the second child node and the key value of the father node of the first child node and the second child node;
and 4, step 4: if the father node is not the root node, taking the father node as the first child node, and repeating the step 2;
and 5: and if the father node is the root node, judging whether the hash value of the root node is the same as the hash value of the root node in the verification path, and if so, passing the target data verification.
Illustratively, continuing with fig. 5, if the key value of the target Data is 11, the target Data is Data4, the hash value of the target Data is H4, and the verification path records node (9, H3), node (5, H7), and node (15, H9), and the key value 12 of node (12, H11), key value 8 of node (8, H10), and key value 10 of top node (10, H8). And calculating hash values A of H3, H4 and H10, calculating hash values B of A, H7 and 8, calculating hash values C of B, H9 and 12, comparing whether the hash values C are the same with the hash values H11 of the root node, and if the hash values C are the same, indicating that the target data is not tampered and the target data passes verification.
According to one embodiment herein, as shown in fig. 6, converting the query request received from the query chain to the query message in step 201 further comprises,
step 601: determining the key value corresponding to the name of the target data in the query request;
step 602: and replacing the name of the target data with the key value to obtain the query message.
In this embodiment, the query request of the target data sent by the query chain may include the name of the target data, but due to the difference in data structure between the query chain and the queried chain, the query chain may not know the key value of the target data in the queried chain, so that the relay chain is required to convert the name of the target data into the key value of the target data, and then replace the name of the target data with the key value of the target data, so as to obtain the query message.
It should be noted that the method shown in fig. 6 may be executed by a cross-link gateway enumerated by the relay link, and then the cross-link gateway sends the target data to the query chain.
Based on the same inventive concept, the embodiment of the present specification further provides a block chain-based cross-chain trusted query system, which includes a query chain, a relay chain and a queried chain;
the query chain is used for sending a query request to the relay chain;
the relay chain is used for converting a query request received from the query chain into a query message, and the query message comprises a key value of target data; sending the query message to the queried chain under the condition that the consensus verification result of the query message is passed;
the inquired chain is used for determining the block header information of the target data in a first cross-chain index library according to the key value of the target data; searching a red-black tree corresponding to the block header information in a second cross-chain index database according to the block header information, searching a target data query result of a leaf node corresponding to the key value in the red-black tree, and recording a verification path of the target data query result, wherein the target data query result comprises the target data and a hash value of the target data; sending a query response including a target data query result and a verification path to the relay chain;
the relay chain is further used for verifying the target data according to the inquiry response under the condition that the consensus verification result of the inquiry response is passed; and sending the target data to the query chain under the condition that the verification result of the target data is passed.
The beneficial effects obtained by the system are consistent with those obtained by the method, and the embodiments of the present description are not repeated.
Fig. 7 is a data flow diagram of a block chain-based cross-chain trusted query system according to an embodiment of the present disclosure, where a process of performing cross-chain query on a query chain, a relay chain, and a queried chain is described in the present disclosure, and specifically, the method includes the following steps:
step 701: the inquiry chain sends an inquiry request to the relay chain;
in this step, the query request includes the name of the target data;
step 702: the relay chain converts the query request into a query message;
in this step, the relay link first determines a key value corresponding to the name of the target data in the query request; then replacing the name of the target data with a key value to obtain the query message;
step 703: the relay chain sends the query message to the queried chain under the condition that the result of the consensus verification on the query message is passed;
step 704: the inquired chain determines the block header information of the target data in a first cross-chain index library according to the key value of the target data;
in this step, the structure of the first cross-chain index library is a k-v database, a plurality of target data are stored in the same merkel tree in the queried chain, and the root node of the merkel tree is the block header information, so that the first cross-chain index library stores the corresponding relationship between the key values of the plurality of target data and the block header information, that is, the block header information corresponding to the key values of the target data can be found in the first cross-chain index library, that is, the merkel tree where the target data is located is found.
Step 705: the inquired chain searches a red-black tree corresponding to the block header information in the second cross-chain index base according to the block header information, searches a target data inquiry result of a leaf node corresponding to the key value in the searched red-black tree, and records a verification path of the target data inquiry result;
in this step, a plurality of merkel trees are stored in the second cross-chain index library, and the structure of each merkel tree is a red-black tree as shown in fig. 5. And searching a target data query result in a red and black tree shown in fig. 5, and recording a verification path of the target data query result.
Step 706: the inquired chain sends an inquiry response comprising a target data inquiry result and a verification path to the relay chain;
step 707: the relay link verifies the target data according to the verification path under the condition that the consensus verification result of the query response is passed;
in this step, the hash value of the target data is used as a first child node hash value; then determining a second child node in the same hierarchy as the first child node in the verification path; then calculating the hash value of the father node according to the hash value of the first child node, the hash value of the second child node and the key value of the father node of the first child node and the second child node; if the father node is not the root node, taking the father node as the first child node, and repeating the step 2; and if the father node is the root node, judging whether the hash value of the root node is the same as the hash value of the root node in the verification path, and if so, passing the target data verification.
Step 708: and the relay chain transmits the target data to the query chain under the condition that the verification result of the target data is passed.
As shown in fig. 8, which is a schematic structural diagram of a computer device in this embodiment, a server or a node on a chain of a query chain, a server or a node on a chain of a relay chain, or a server or a node on a chain of a queried chain in this embodiment may be a computer device in this embodiment, and perform the above-described method in this embodiment. Computer device 802 may include one or more processing devices 804, such as one or more Central Processing Units (CPUs), each of which may implement one or more hardware threads. The computer device 802 may also include any storage resources 806 for storing any kind of information, such as code, settings, data, etc. For example, and without limitation, storage resources 806 may include any one or more of the following in combination: any type of RAM, any type of ROM, flash memory devices, hard disks, optical disks, etc. More generally, any storage resource may use any technology to store information. Further, any storage resource may provide volatile or non-volatile reservation of information. Further, any storage resources may represent fixed or removable components of computer device 802. In one case, when the processing device 804 executes associated instructions stored in any storage resource or combination of storage resources, the computer device 802 can perform any of the operations of the associated instructions. The computer device 802 also includes one or more drive mechanisms 808, such as a hard disk drive mechanism, an optical disk drive mechanism, etc., for interacting with any storage resource.
Computer device 802 may also include an input/output module 810 (I/O) for receiving various inputs (via input device 812) and for providing various outputs (via output device 814). One particular output mechanism may include a presentation device 816 and an associated Graphical User Interface (GUI) 818. In other embodiments, input/output module 810 (I/O), input device 812, and output device 814 may also be excluded, as just one computer device in a network. Computer device 802 may also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the above-described components together.
Communication link 822 may be implemented in any manner, such as over a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 822 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
It should be noted that, when the node on the query chain, the node on the relay chain, or the node on the queried chain in the embodiment of this document implements the method described in the embodiment of this document for the computer device 802 described in this embodiment, the presentation device 816 and the associated Graphical User Interface (GUI)818 may not be included. Such as a computer minimal system comprising only the processing device 804, the storage resources 806, and the network interface 820.
Corresponding to the methods in fig. 2-4, 6-7, embodiments herein also provide a computer-readable storage medium having a computer program stored thereon, which when executed by a processor performs the above steps.
Embodiments herein also provide computer readable instructions, wherein when executed by a processor, a program thereof causes the processor to perform the methods as shown in fig. 2-4, 6-7.
It should be understood that, in various embodiments herein, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments herein.
It should also be understood that, in the embodiments herein, the term "and/or" is only one kind of association relation describing an associated object, meaning that three kinds of relations may exist. For example, a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided herein, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may also be an electric, mechanical or other form of connection.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments herein.
In addition, functional units in the embodiments herein may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present invention may be implemented in a form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The principles and embodiments of this document are explained herein using specific examples, which are presented only to aid in understanding the methods and their core concepts; meanwhile, for the general technical personnel in the field, according to the idea of this document, there may be changes in the concrete implementation and the application scope, in summary, this description should not be understood as the limitation of this document.

Claims (10)

1. A block chain based cross-chain trusted query method is characterized in that the method comprises the following steps,
converting a query request received from a query chain into a query message, wherein the query message comprises a key value of target data;
under the condition that the consensus verification result of the query message is passed, sending the query message to a queried chain so that the queried chain queries according to the key value of the target data to obtain a query response, wherein the query response comprises the queried target data;
receiving the query response sent by the queried chain, and verifying the target data according to the query response under the condition that the consensus verification result of the query response is passed;
and sending the target data to the query chain under the condition that the verification result of the target data is passed.
2. The block chain based cross-chain trusted query method according to claim 1, wherein the query response further includes a hash value of the target data and a verification path, and the structure of the verification path is a partial red-black tree;
the verification path comprises a plurality of nodes in a second cross-chain index library of the queried chain, and each node comprises a key value of the node and a hash value of the node.
3. The blockchain-based cross-chain trusted query method according to claim 2, wherein the step of verifying the target data according to the query response comprises,
step 1: taking the hash value of the target data as a first child node hash value;
and 2, step: determining a second child node in the same hierarchy as the first child node in the verification path;
and step 3: calculating the hash value of the father node according to the hash value of the first child node, the hash value of the second child node and the key value of the father node of the first child node and the second child node;
and 4, step 4: if the father node is not the root node, taking the father node as the first child node, and repeating the step 2;
and 5: and if the father node is the root node, judging whether the hash value of the root node is the same as the hash value of the root node in the verification path, and if so, passing the target data verification.
4. The blockchain-based cross-chain trusted query method of claim 1, wherein converting a query request received from a query chain to a query message further comprises,
determining the key value corresponding to the name of the target data in the query request;
and replacing the name of the target data with the key value to obtain the query message.
5. A block chain based cross-chain trusted query method is characterized in that the method comprises the following steps,
acquiring a query message converted by a relay chain according to a query request sent by the query chain, wherein the query message comprises a key value of target data;
determining block header information of the target data in a first cross-chain index library according to the key value of the target data;
searching a red-black tree corresponding to the block header information in a second cross-chain index database according to the block header information, searching a target data query result of a leaf node corresponding to the key value in the red-black tree, and recording a verification path of the target data query result, wherein the target data query result comprises the target data and a hash value of the target data;
and sending a query response comprising a target data query result and a verification path to the relay chain, so that the relay chain sends the target data in the target data query result to the query chain after the query response is verified.
6. The method of claim 5, wherein determining a target data query result corresponding to a key value in a second cross-chain index database according to the chunk header information and the key value further comprises,
determining a root node of a red-black tree corresponding to the block header information;
determining a query path according to the key value and the key value of each node in the index tree corresponding to the root node, wherein any child node in the query path only has a parent node corresponding to the child node;
and taking the data corresponding to the leaf nodes in the query path as the target data query result.
7. The method according to claim 6, wherein each node in the second inter-chain index repository includes a key value of the node and a hash value of the node;
the key value of a leaf node in the second cross-chain index database is the same as the key value of the target data, and the hash value of the leaf node is a hash value calculated by the target data through a hash algorithm;
the hash value of any father node in the second cross-chain index library is a hash value calculated by a hash algorithm from the hash values of all the next-level child nodes corresponding to the father node and the key value of the father node;
and the hash value of the root node in the second cross-chain index library is a hash value calculated by a hash algorithm from the hash values of all the next-level child nodes corresponding to the root node and the key value of the root node.
8. The method according to claim 7, wherein the step of determining the query path according to the key value and the key value of each node in the index tree corresponding to the root node comprises,
step 1: taking the root node as a top-level node, and recording the top-level node in the query path;
step 2: comparing the key value of the target data with the key value of the first-level node;
and step 3: if the key value of the target data is greater than the key value of the first-level node, taking a next-level child node of the first-level node in the right sub-tree of the first-level node as a secondary node, recording the secondary node in the query path according to the hierarchical relationship between the secondary node and the first-level node, taking the secondary node as the first-level node, and repeating the step 2;
and 4, step 4: if the key value of the target data is less than or equal to the key value of the first-level node, taking a next-level child node of the first-level node in a left sub-tree of the first-level node as a secondary node, recording the secondary node in the query path according to the hierarchical relationship between the secondary node and the first-level node, taking the secondary node as the first-level node, and repeating the step 2;
and 5: and when the next-level child node does not exist in the first-level node and the key value of the first-level node is equal to the key value of the target data, finishing determining the query path.
9. The blockchain-based cross-chain trusted query method of claim 8, wherein recording a verification path of the target data query result further comprises,
in the process of determining the query path, if the key value of the target data is greater than the key value of the first-level node, recording the key value of the first-level node and a next-level child node of the first-level node in a left sub-tree of the first-level node in the verification path according to the hierarchical relationship;
and if the key value of the target data is less than or equal to the key value of the first-level node, recording the key value of the first-level node and a next-level child node of the first-level node in a right sub-tree of the first-level node in the verification path according to the hierarchical relationship.
10. A block chain-based cross-chain trusted query system is characterized by comprising a query chain, a relay chain and a queried chain;
the query chain is used for sending a query request to the relay chain;
the relay chain is used for converting a query request received from the query chain into a query message, and the query message comprises a key value of target data; sending the query message to the queried chain under the condition that the consensus verification result of the query message is passed;
the inquired chain is used for determining the block header information of the target data in a first cross-chain index library according to the key value of the target data; searching a red-black tree corresponding to the block header information in a second cross-chain index database according to the block header information, searching a target data query result of a leaf node corresponding to the key value in the red-black tree, and recording a verification path of the target data query result, wherein the target data query result comprises the target data and a hash value of the target data; sending a query response including a target data query result and a verification path to the relay chain;
the relay chain is further used for verifying the target data according to the inquiry response under the condition that the consensus verification result of the inquiry response is passed; and sending the target data to the query chain under the condition that the verification result of the target data is passed.
CN202210407404.7A 2022-04-19 2022-04-19 Cross-chain credible query method and system based on block chain Active CN114519078B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210407404.7A CN114519078B (en) 2022-04-19 2022-04-19 Cross-chain credible query method and system based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210407404.7A CN114519078B (en) 2022-04-19 2022-04-19 Cross-chain credible query method and system based on block chain

Publications (2)

Publication Number Publication Date
CN114519078A true CN114519078A (en) 2022-05-20
CN114519078B CN114519078B (en) 2022-08-09

Family

ID=81600118

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210407404.7A Active CN114519078B (en) 2022-04-19 2022-04-19 Cross-chain credible query method and system based on block chain

Country Status (1)

Country Link
CN (1) CN114519078B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150103A (en) * 2022-08-29 2022-10-04 人民法院信息技术服务中心 Block chain-based digital certificate offline verification method, device and equipment

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
CN108492108A (en) * 2018-03-29 2018-09-04 深圳前海微众银行股份有限公司 Across the chain communication means of block chain, system and computer readable storage medium
CN109165224A (en) * 2018-08-24 2019-01-08 东北大学 A kind of indexing means being directed to keyword key on block chain database
CN109257342A (en) * 2018-09-04 2019-01-22 阿里巴巴集团控股有限公司 Authentication method, system, server and readable storage medium storing program for executing of the block chain across chain
CN110008755A (en) * 2019-03-21 2019-07-12 广东优世联合控股集团股份有限公司 Dynamic data integrity verification system and method can be revoked in a kind of cloud storage
CN110069921A (en) * 2019-04-12 2019-07-30 中国科学院信息工程研究所 A kind of trusted software authority checking system and method towards container platform
CN110166249A (en) * 2019-05-14 2019-08-23 数字钱包(北京)科技有限公司 A kind of information transferring method, device, verifying end and computer readable storage medium
CN110866823A (en) * 2018-08-28 2020-03-06 傲为信息技术(江苏)有限公司 Public link-based transaction method and block chain system
CN111769957A (en) * 2020-09-02 2020-10-13 百度在线网络技术(北京)有限公司 Block chain cross-chain query method, device, equipment and storage medium
CN111935318A (en) * 2020-09-28 2020-11-13 北京百度网讯科技有限公司 Cross-link data verification method, device, equipment and medium
CN112650742A (en) * 2020-12-30 2021-04-13 北京百度网讯科技有限公司 Cross-link data verification method, device, equipment and storage medium
CN113360861A (en) * 2021-07-27 2021-09-07 北京理工大学 Mortgage loan oriented decentralized identity method based on repeater cross-chain
WO2021197097A1 (en) * 2020-04-02 2021-10-07 支付宝(杭州)信息技术有限公司 Cross-chain data subscription
CN114037449A (en) * 2021-11-02 2022-02-11 杭州复杂美科技有限公司 Cross-chain asset transfer method, computer device, and storage medium

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
CN108492108A (en) * 2018-03-29 2018-09-04 深圳前海微众银行股份有限公司 Across the chain communication means of block chain, system and computer readable storage medium
CN109165224A (en) * 2018-08-24 2019-01-08 东北大学 A kind of indexing means being directed to keyword key on block chain database
CN110866823A (en) * 2018-08-28 2020-03-06 傲为信息技术(江苏)有限公司 Public link-based transaction method and block chain system
CN109257342A (en) * 2018-09-04 2019-01-22 阿里巴巴集团控股有限公司 Authentication method, system, server and readable storage medium storing program for executing of the block chain across chain
CN110008755A (en) * 2019-03-21 2019-07-12 广东优世联合控股集团股份有限公司 Dynamic data integrity verification system and method can be revoked in a kind of cloud storage
CN110069921A (en) * 2019-04-12 2019-07-30 中国科学院信息工程研究所 A kind of trusted software authority checking system and method towards container platform
CN110166249A (en) * 2019-05-14 2019-08-23 数字钱包(北京)科技有限公司 A kind of information transferring method, device, verifying end and computer readable storage medium
WO2021197097A1 (en) * 2020-04-02 2021-10-07 支付宝(杭州)信息技术有限公司 Cross-chain data subscription
CN111769957A (en) * 2020-09-02 2020-10-13 百度在线网络技术(北京)有限公司 Block chain cross-chain query method, device, equipment and storage medium
CN111935318A (en) * 2020-09-28 2020-11-13 北京百度网讯科技有限公司 Cross-link data verification method, device, equipment and medium
CN112650742A (en) * 2020-12-30 2021-04-13 北京百度网讯科技有限公司 Cross-link data verification method, device, equipment and storage medium
CN113360861A (en) * 2021-07-27 2021-09-07 北京理工大学 Mortgage loan oriented decentralized identity method based on repeater cross-chain
CN114037449A (en) * 2021-11-02 2022-02-11 杭州复杂美科技有限公司 Cross-chain asset transfer method, computer device, and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
SHAOFENG LIN.ETC: ""Overview of Block Chain Cross Chain Technology"", 《2021 13TH INTERNATIONAL CONFERENCE ON MEASURING TECHNOLOGY AND MECHATRONICS AUTOMATION (ICMTMA)》 *
张志威等: ""区块链的数据管理技术综述"", 《软件学报》 *
贾大宇等: ""存储容量可扩展区块链系统的高效查询模型"", 《软件学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150103A (en) * 2022-08-29 2022-10-04 人民法院信息技术服务中心 Block chain-based digital certificate offline verification method, device and equipment
CN115150103B (en) * 2022-08-29 2022-11-29 人民法院信息技术服务中心 Block chain-based digital certificate offline verification method, device and equipment

Also Published As

Publication number Publication date
CN114519078B (en) 2022-08-09

Similar Documents

Publication Publication Date Title
US11615104B2 (en) Subquery generation based on a data ingest estimate of an external data system
US11663227B2 (en) Generating a subquery for a distinct data intake and query system
US11604795B2 (en) Distributing partial results from an external data system between worker nodes
US11586692B2 (en) Streaming data processing
US11636105B2 (en) Generating a subquery for an external data system using a configuration file
US11243963B2 (en) Distributing partial results to worker nodes from an external data system
US11314753B2 (en) Execution of a query received from a data intake and query system
US11126632B2 (en) Subquery generation based on search configuration data from an external data system
US10977260B2 (en) Task distribution in an execution node of a distributed execution environment
US11921873B1 (en) Authenticating data associated with a data intake and query system using a distributed ledger system
US20220327149A1 (en) Dynamic partition allocation for query execution
US11269859B1 (en) Correlating different types of data of a distributed ledger system
US11327992B1 (en) Authenticating a user to access a data intake and query system
US11461334B2 (en) Data conditioning for dataset destination
US10726009B2 (en) Query processing using query-resource usage and node utilization data
US11232100B2 (en) Resource allocation for multiple datasets
US11163758B2 (en) External dataset capability compensation
US10795884B2 (en) Dynamic resource allocation for common storage query
US11416528B2 (en) Query acceleration data store
US11416465B1 (en) Processing data associated with different tenant identifiers
US11507562B1 (en) Associating data from different nodes of a distributed ledger system
CN114519078B (en) Cross-chain credible query method and system based on block chain
US11860858B1 (en) Decoding distributed ledger transaction records
US11966391B2 (en) Using worker nodes to process results of a subquery
GUGULOTH et al. T-Broker: Lightweight Feedback Mechanism Scheme Improve System Efficiency for Multiple Cloud Collaborative Services

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