WO2018120129A1 - Data query method, device and node apparatus - Google Patents

Data query method, device and node apparatus Download PDF

Info

Publication number
WO2018120129A1
WO2018120129A1 PCT/CN2016/113758 CN2016113758W WO2018120129A1 WO 2018120129 A1 WO2018120129 A1 WO 2018120129A1 CN 2016113758 W CN2016113758 W CN 2016113758W WO 2018120129 A1 WO2018120129 A1 WO 2018120129A1
Authority
WO
WIPO (PCT)
Prior art keywords
query
node
data
blockchain
result
Prior art date
Application number
PCT/CN2016/113758
Other languages
French (fr)
Chinese (zh)
Inventor
骆磊
Original Assignee
深圳前海达闼云端智能科技有限公司
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 深圳前海达闼云端智能科技有限公司 filed Critical 深圳前海达闼云端智能科技有限公司
Priority to PCT/CN2016/113758 priority Critical patent/WO2018120129A1/en
Priority to CN201680002915.3A priority patent/CN106716421B/en
Publication of WO2018120129A1 publication Critical patent/WO2018120129A1/en

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/105Multiple levels of security

Definitions

  • the present disclosure relates to the field of blockchain technology, and in particular, to a data query method, device, and node device.
  • a blockchain is a decentralized distributed database system in which all nodes in a blockchain network participate in maintenance. It is composed of a series of data blocks generated by cryptography, and each block is a blockchain. One block. According to the order of the generation time, the blocks are linked together in an orderly manner to form a data chain, which is aptly called a blockchain.
  • the blockchain has its own unique block generation, transaction generation and verification protocols, and has security features such as non-tamperable, unforgeable and fully traceable.
  • the blockchain network is based on a P2P network, and each P2P network node participating in transaction and block storage, verification, and forwarding is a node in a blockchain network.
  • the blockchain data is completely public to each node, and the node can view the information of any transaction in any block at will.
  • the querier when the querier needs to query the data in the blockchain, if the querier itself is a node in the blockchain network, it is only necessary to query from the blockchain copy stored by itself; Rather than a node in a blockchain network, a query request needs to be sent to a node in the blockchain network to implement data query.
  • the present disclosure provides a data query method, apparatus, and node device.
  • a data query method for a blockchain node of a blockchain network, the method comprising:
  • the query result with the highest ratio is used as the query result corresponding to the data to be queried.
  • a data query method is provided, which is applied to a blockchain node of a blockchain network, and the method includes:
  • a query result is returned to the target blockchain node.
  • a data query apparatus which is applied to a blockchain node of a blockchain network, the device comprising:
  • a security level determining module configured to receive a query request, and determine a security level of the data to be queried corresponding to the query request;
  • a first query node determining module configured to determine a query node according to the security level, where the query node is a node in a blockchain network;
  • a first query request forwarding module configured to send the query request to the determined query node
  • the first query result determining module is configured to receive the query result returned by the query node. If the query result with the highest ratio meets the preset condition, the query result with the highest ratio is used as the query result corresponding to the data to be queried.
  • a data query apparatus which is applied to a blockchain node of a blockchain network, the device comprising:
  • a security level determining module configured to determine, according to a query request sent by the target blockchain node, a security level of the data to be queried corresponding to the query request;
  • a query probability determination module configured to determine a probability of responding to the query request according to the security level
  • the first query result returning module is configured to, when determining to respond to the query request according to the probability, return a query result to the target blockchain node.
  • a computer program product comprising a computer program executable by a programmable device, the computer program having when executed by the programmable device The code portion of the method of performing the above first aspect.
  • a non-transitory computer readable storage medium comprising one or more programs for performing The method of the above first aspect.
  • a node device including:
  • One or more processors for executing a program in the non-transitory computer readable storage medium.
  • a computer program product characterized in that the computer program product comprises a computer program executable by a programmable device, the computer program having when The portion of code used to perform the method described in the second aspect above when the device is executed.
  • a non-transitory computer readable storage medium comprising one or more programs for performing The method of the above second aspect.
  • a node device including:
  • One or more processors for executing a program in the non-transitory computer readable storage medium.
  • the embodiments of the present disclosure include at least the following beneficial effects: determining different query strategies according to different security levels, avoiding query errors caused by single nodes being attacked, data being tampered with, etc.; improving credibility and correctness of query results, and preventing blocks Chain data is tampered with query errors and security risks.
  • FIG. 1 is a schematic diagram of a blockchain network according to an embodiment of the present disclosure
  • FIG. 2 is a schematic flowchart of a data query method according to an embodiment of the present disclosure
  • FIG. 3 is a schematic flowchart of a data query method according to another embodiment of the present disclosure.
  • FIG. 4 is a schematic diagram of a process flow when a candidate result does not satisfy a pre-condition in an embodiment of the present disclosure
  • FIG. 5 is a schematic diagram of a target blockchain node releasing information when a query fails in an embodiment of the present disclosure
  • FIG. 6 is a schematic flowchart diagram of a data query method according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic flowchart diagram of a data query method according to another embodiment of the present disclosure.
  • FIG. 8 is a block diagram of a data query apparatus according to an embodiment of the present disclosure.
  • FIG. 9 is a block diagram of a data query apparatus according to another embodiment of the present disclosure.
  • FIG. 10 is a block diagram of an apparatus for a data query method, according to an exemplary embodiment.
  • the data in the blockchain is set to different security levels according to the attributes, and the data of different security levels is correspondingly selected by different query nodes in the query, and then the data query is performed by the corresponding number of query nodes; And according to the query result returned by the query node, whether the query success judgment threshold of the security level data is reached, and if the query success judgment threshold is reached, the query result is considered to be trustworthy, and the query success judgment threshold is not required to be a higher ratio or directly
  • the second query is performed in a hundred percent ratio. If the second query still fails to reach the query success judgment threshold corresponding to the corresponding security level data, the warning may be performed or the accuracy of the data may be determined manually or by other means. Therefore, the data query method, device and node device of the embodiments of the present disclosure can improve the credibility and correctness of the query result, and prevent query errors and security risks caused by the tampering of the blockchain data.
  • the query method of the blockchain data may be applied to a scenario where the query end is not a node in the blockchain, or may be applied to a scenario where the query end is a node in the blockchain, and the query result may be improved. Reliability and accuracy, preventing query errors and security risks caused by tampering with blockchain data.
  • Blockchain node A blockchain is a decentralized distributed database system in which all nodes in a blockchain network participate in maintenance. It is composed of a series of data blocks generated by cryptography. Each data block is A block in a blockchain. The blocks are ordered according to the order in which they are generated. The links are linked together to form a data chain, which is aptly called a blockchain.
  • a node in a blockchain network may be referred to as a blockchain node, wherein the blockchain network is based on a P2P (Peer to Peer) network, and each P2P network node participating in the transaction and block storage, verification, and forwarding is Is a node in a blockchain network.
  • P2P Peer to Peer
  • the user identity in the blockchain can be represented by a public key or an account address generated based on the public key, and the public key and the private key appear in pairs, wherein the private key is mastered by the user and not issued to the above.
  • the public key or the above account address can be freely posted in the blockchain network.
  • the public key can be the above account address through a specific hash and encoding. It is worth mentioning that there is no one-to-one correspondence between user identity and blockchain nodes. Users can use their own private key on any blockchain node.
  • Blockchain data write The blockchain node writes data to the blockchain by issuing a transaction to the blockchain network.
  • the transaction includes: the blockchain node performs a digital signature on the generated transaction data packet according to a preset transaction data format, and uses the private key of the blockchain node to perform the digital signature on the transaction data packet, and the digital signature is used to prove the The identity of the user of the blockchain node; then, after the transaction is posted to the blockchain network, the "miner” in the blockchain network (ie, the block that performs the PoW (Proof Of Work) consensus competition mechanism
  • the chain node records the new block generated in the blockchain and publishes the new block to the blockchain network.
  • the new block in the blockchain is periodically generated by the above-mentioned “miners” by implementing a consensus competition mechanism such as PoW or PoS, so the time interval for generating new blocks is usually related to the above-mentioned preset technical requirements, and the settings are different.
  • the default technical requirements can change the time interval at which the blockchain generates new blocks.
  • FIG. 1 a schematic diagram of a blockchain network according to an embodiment of the present disclosure.
  • the blockchain network 100 includes: one or more blockchain nodes 101, and these block links
  • the point 101 can be implemented in various forms, for example, a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet), a PMP (Portable Multimedia Player), a server, a mine. Machine and so on.
  • PDA Personal Digital Assistant
  • PAD Tablet
  • PMP Portable Multimedia Player
  • each block in the blockchain includes a block header and a block body.
  • the block body holds the transaction data.
  • Transaction data is saved via the Merkel tree.
  • the hash of the Merkel root is stored in the block header.
  • the block header includes at least: a hash value of the previous block header, a hash value of the Merkel root, a time stamp, and a block number.
  • Transaction data can be any type of data including, but not limited to, various types of statistical data (eg, demographic data, medical data, etc.), various types of currency transaction data (eg, transfer transaction data), and various types.
  • Request data for example, query request, node join request, etc.
  • the blockchain data in order to ensure the security of the information query, is set according to the data attribute security level, and different security levels correspond to different query strategies, thereby improving the security and accuracy of the data query.
  • the ratio of the query node refers to the ratio of the number of query nodes to the total number of blockchain nodes, as shown in equation (1).
  • the query node is a node that responds to the query request, or a node that receives the query request.
  • n is the number of query nodes and N is the total number of blockchain nodes in the blockchain network.
  • the query success determination threshold is the ratio of the number of query results with the highest proportion of query results returned by the query node to the total number of query nodes, as shown in equation (2).
  • n is the number of query results with the highest ratio.
  • n in formula (1) and formula (2) includes these should respond to the query request, and the query is returned. The result, but because of the exception, the query node that did not return the query result and the total number of query nodes that returned the query result.
  • the security level may be determined according to the category to which the blockchain data belongs.
  • the blockchain data of the first security level may be data related to personal information, currency transaction data, etc.; blockchain data of the second security level may be various types of statistical data; blockchain data of the third security level There may be various types of request data (eg, query requests, node join requests, etc.). It should be understood that the security level of the blockchain data may be set according to actual conditions, and is not limited to the examples given herein.
  • the security level of the data to be written to the blockchain is determined when the block is newly created. Write the security level of the data along with the data into the blockchain. Thus, when performing a data query, the security level of the data can be queried from the blockchain.
  • the correspondence between the security level of the blockchain data and the query strategy shown in Table 1 above is stored in a block of the blockchain.
  • the blockchain node may determine the data to be queried according to the query request, and query the correspondence between the security level of the blockchain data and the query policy from the block of the blockchain to determine the data to be queried. Query strategy.
  • FIG. 2 is a schematic flowchart of a data query method according to an embodiment of the present disclosure. The method includes the following steps:
  • step 201 a query request is received to determine a security level of the data to be queried corresponding to the query request.
  • step 202 the query node is determined based on the security level.
  • step 203 a query request is sent to the determined query node.
  • step 204 the query result returned by the query node is received. If the query result with the highest ratio satisfies the preset condition, the query result with the highest proportion is used as the query result corresponding to the data to be queried.
  • step 301 the target blockchain node determines the security level of the data to be queried according to the query request.
  • the query side when a data query is to be performed, the query side generates a query request and sends the query request to the target blockchain node.
  • the query end here is an electronic device in a non-blockchain network.
  • the query request is generated by the target blockchain node itself, that is, the target blockchain node is the query end.
  • the query request includes at least one of the following information: a transaction hash, an account address, and a query keyword.
  • the determined data to be queried may include: whether the transaction corresponding to the transaction hash is valid, currency transaction data, and the like.
  • the security level of the data to be queried is determined to be the first security level.
  • the determined data to be queried may include: information of the account corresponding to the account address, transaction record of the account corresponding to the account address, and the like.
  • the security level of the data to be queried is determined as the first security level.
  • the determined data to be queried may include: data corresponding to the keyword.
  • the security level of the data to be queried may be determined according to the keyword, and when the keyword includes: an account, a transaction, and the like, the security level of the data to be queried is determined as the first security level; when the keyword is not included Security of data to be queried when accounts, transactions, etc.
  • the rating is determined to be the second security level or other level.
  • the security level of the data to be queried is determined according to the query request.
  • the target blockchain node determines the query policy according to the security level of the data to be queried.
  • the query policy corresponding to the security level may be queried from the block in which the correspondence relationship shown in Table 1 above is stored.
  • step 303 the target blockchain node determines the query node according to the query policy corresponding to the security level.
  • step 304 the target blockchain node forwards the query request to the query node.
  • each blockchain node stores address information of all nodes in the blockchain network, and when a new node joins the blockchain network and has a node exits the blockchain network, Update the saved address information. Therefore, the target block chain node can randomly select and query the block number node corresponding to the policy as the query node according to the stored address information of the block chain node, for example, the IP address information, and according to the block chain node. IP address, forwarding of query requests. For example, when the query node determines that the proportion of the query node is w1%, w1% ⁇ N nodes are randomly selected as nodes in the blockchain network, and the query is sent to the w1% ⁇ N query nodes according to the IP address. request.
  • the query node determined by the target blockchain node may include itself, and when it includes itself, there is no need to forward the query request.
  • step 305 the target blockchain node receives the query node and returns the query result.
  • the query node that receives the query request performs a query according to the query request, obtains the query result, and returns the query result to the target block chain node.
  • the target block chain node forwards the address information together with the query request when forwarding the query request, thereby the query node may obtain the query result according to the address of the target block chain node. Information, will query results Return to the target blockchain node.
  • the query node When the query node obtains the query result according to the query request: when the query request includes the transaction hash, the query node determines the block where the data to be queried is located according to the transaction hash, and obtains data from the corresponding block, and the acquired data. The data is returned to the target blockchain node as a result of the query.
  • the query node verifies the transaction corresponding to the transaction hash according to the transaction hash, that is, according to the transaction hash, performs a query in the blockchain to determine whether the transaction is recorded in a certain block, and Based on the location of the block in the blockchain, determine how much confirmation the block received.
  • the query result includes a transaction verification result, the transaction verification result including at least: whether the transaction has been recorded in the block, and the number of confirmed blocks obtained.
  • the query node determines the block corresponding to the account address according to the account address, and obtains data from the corresponding block, and returns the acquired data as a query result to the target block chain node.
  • the query node traverses the blockchain according to the query keyword, obtains data corresponding to the keyword, and returns the data corresponding to the keyword as the query result to the target block.
  • Chain node When the query request includes the query keyword, the query node traverses the blockchain according to the query keyword, obtains data corresponding to the keyword, and returns the data corresponding to the keyword as the query result to the target block.
  • step 306 the target blockchain node determines the candidate result according to the query result returned by the query node.
  • the target block chain node receives the query result returned by the query node, and compares different query results, and uses the highest proportion of the query result as a candidate result. For example, if the number of returned query results is 100, and 85 of the query results are all A, then A is the highest proportion of the query results, which is used as a candidate result.
  • step 307 when the candidate result satisfies the preset condition, the candidate result is used as the query result corresponding to the data to be queried.
  • the preset condition is that the ratio of the number of query nodes of the returned query result to the candidate result to the total number of query nodes is greater than or equal to the query success judgment threshold corresponding to the data to be queried. Therefore, the target block chain node returns the query result as the candidate result. The number of query nodes is compared with the total number of query nodes. When the ratio is greater than or equal to the query success determination threshold in the query policy corresponding to the data to be queried, the candidate result is obtained. As the query result corresponding to the data to be queried.
  • not all query nodes will return the query result.
  • the query node may not return the query result due to an abnormality (for example, being illegally controlled, tampered with, shutting down, or malfunctioning, etc.), but the calculation of the ratio
  • the number of query nodes that return the query result as the candidate result is compared with the total number of query nodes, so that the query node that does not return the query result has an impact on the query result, improves the referenceability of the query result, and reduces the query risk.
  • the query when the candidate result does not satisfy the preset condition, the query is re-executed.
  • the number of query nodes is adjusted to improve the credibility and correctness of the query result.
  • step 401 the target blockchain node increases the number of query nodes according to the first preset ratio.
  • the first preset ratio may be set to be 10% to 50%. In some embodiments, if the first query is unsuccessful (ie, the candidate result does not satisfy the preset condition), the proportion of the query node is increased to 100%.
  • step 402 the target blockchain node forwards the query request to the query node.
  • step 403 the target blockchain node receives the query node and returns the query result.
  • step 404 the target blockchain node determines the candidate result according to the query result returned by the query node.
  • step 405 when the candidate result satisfies the preset condition, the candidate result is used as the query result corresponding to the data to be queried.
  • step 405 when it is determined whether the candidate result satisfies the preset condition, the query success determination threshold is the same as in step 307.
  • the query success determination threshold may also be scaled up in step 405, which is not limited in this disclosure.
  • the target block chain node issues the warning information to the blockchain network.
  • the warning information includes: a transaction hash, an account address, or a query keyword in the query request.
  • the warning information is used to prompt the nodes in the blockchain network, and the data corresponding to the query request presents a security risk.
  • the target block chain node sends a prompt message to the query end, where the prompt information is used to prompt that the query result is unavailable or the query is invalid.
  • the third and fourth times of the query may also be performed, and the number of queries may be set according to actual conditions until the number of queries reaches the maximum number of queries, and when the query fails, according to the figure 5 outputs warning information and prompt information.
  • the index of the query node can be increased once for each additional query.
  • the data query method of the embodiment of the present disclosure determines different query strategies according to different security levels, avoids query errors caused by single node being attacked, data being tampered with, etc.; improves credibility and correctness of query results, and prevents blockchain Query errors and security risks caused by tampering with data; avoiding the possibility of querying only a single node, and the single node being attacked or data being tampered with, so that the error message is queried; on the other hand, it is avoided All query requests use the same proportion of query nodes for resource waste caused by query, and each query passes the 100% blockchain node to query the burden on all blockchain nodes, which can ensure reliable query results. In the case of sex, reduce the negative impact on the concurrency of the blockchain.
  • FIG. 6 is a schematic flowchart diagram of a data query method according to another embodiment of the present disclosure. The method includes the following steps:
  • step 601 determining, according to the query request sent by the target blockchain node, the security level of the data to be queried corresponding to the query request;
  • step 602 a probability of responding to the query request is determined according to the security level
  • step 603 when the response query request is determined according to the probability, the query result is returned to the target.
  • Standard blockchain node
  • the target blockchain node ie, the blockchain node that receives the query request sent by the query end or the blockchain node that generates the query request itself
  • the blockchain node that receives the query request may determine the probability of responding to the query request according to the query policy corresponding to the query request, thereby returning the query result according to the probability.
  • step 701 the target blockchain node issues a query request to the blockchain network.
  • the query request may be generated by the target blockchain node itself or by an electronic device in the non-blockchain network.
  • the target blockchain node sends a query request to the blockchain node connected to itself, and these blockchain nodes send query requests to other blockchain nodes, so that in the blockchain network Each blockchain node can receive a query request.
  • step 702 the blockchain node that receives the query request determines the security level of the data to be queried according to the query request.
  • a query policy is determined according to the security level of the data to be queried.
  • step 702 determines the security level of the data to be queried
  • step 703 determines that the implementation principle of the query policy is the same as that of the embodiment shown in FIG. 3, and details are not described herein again.
  • step 704 the blockchain node determines the probability of responding to the query request according to the query policy corresponding to the security level.
  • the probability of responding to the query request is the same as the ratio of the query nodes in Table 1 above, whereby the blockchain node can query from the block storing the information shown in Table 1 to a different security level. The probability of responding to the query request.
  • the blockchain node can obtain the probability that it needs to respond to the query request according to the security level.
  • the blockchain After the node obtains the probability of responding to the query request, it determines whether it responds to the query request by generating a random number.
  • the random number can be any integer between 1 and 10. It can be seen that the probability that the ten digits 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 appear in the random array is 10%. Since the probability of responding to the query request is 80%, it can be set to not respond to the query request if the generated random number is 1 or 2, and respond to the query request if the generated random number is any number between 3 and 10. According to this method, since each node has an 80% probability, the result will be returned. According to the probability theory, about 80% of the nodes working normally in the blockchain network will respond to the query request and return the query result.
  • the total number of nodes in the 80% blockchain network should be used as the denominator to determine whether the query result satisfies the percentage of the query success decision threshold.
  • the number of query results that are the highest among the query results returned by the blockchain node in response to the query request is a numerator that determines whether the percentage of the query success determination threshold is satisfied.
  • the block chain node may further determine whether to respond to the query request according to other manners, for example, if the proportion of the query node corresponding to the security level is higher than a preset value, in response to the query request manner, the embodiment of the present disclosure is This is not limited.
  • step 705 in response to the query node of the query request, the query result is returned to the target blockchain node.
  • step 706 the target blockchain node determines the candidate result according to the query result returned by the query node.
  • step 707 when the candidate result satisfies the preset condition, the candidate result is used as the query result corresponding to the data to be queried.
  • the query is re-inquired.
  • the target blockchain node when the query is re-inquired, the target blockchain node re-publishes the query request to the blockchain network, and if the blockchain node receives the same query request again, it will respond to the query request.
  • the probability is increased according to the second preset ratio, and the second preset ratio can be set to be 10%-50%.
  • the blockchain node that receives the same query request again increases the probability of responding to the query request to 100%, ie All nodes in the blockchain network that receive the query request respond to the query request
  • the query node responding to the query request returns the query result to the target blockchain node.
  • the target block chain node determines the candidate result according to the query result returned by the query node.
  • the candidate result When the candidate result satisfies the preset condition, the candidate result is used as the query result corresponding to the data to be queried.
  • the query success determination threshold may remain unchanged, or the ratio is increased.
  • the disclosure is not limited to the embodiment shown in FIG. 4 above, when performing the second query. If the candidate result still fails to meet the preset condition, the second query fails, and the target block chain node issues the warning information to the blockchain network.
  • the warning information includes: a transaction hash, an account address, or a query keyword in the query request.
  • the warning information is used to prompt the nodes in the blockchain network, and the data corresponding to the query request presents a security risk.
  • the target block chain node sends a prompt message to the query end, where the prompt information is used to prompt that the query result is unavailable or the query is invalid.
  • the third and fourth times of the query may also be performed, and the number of queries may be set according to actual conditions until the number of queries reaches the maximum number of queries, and when the query fails, according to the figure 5 outputs warning information and prompt information.
  • Each additional query increases the probability of responding to a query request by one.
  • the data query method of the embodiment of the present disclosure determines different query strategies according to different security levels. It avoids query errors caused by single node being attacked, data being tampered with, etc.; improving the credibility and correct rate of query results, preventing query errors and security risks caused by blockchain data being tampered with; avoiding only by single node Querying, and the single node is attacked or the data is tampered with, making the possibility of querying the error message; on the other hand, it avoids the waste of resources caused by the query of all the query requests using the same proportion of query nodes, and Each query passes the 100% blockchain node to query the burden on all blockchain nodes, which can reduce the negative impact on the concurrency of the blockchain while ensuring the reliability of the query results.
  • an embodiment of the present disclosure further provides a data query device, which is applied to a blockchain node of a blockchain network, and the device includes:
  • the security level determining module 801 is configured to receive a query request, and determine a security level of the data to be queried corresponding to the query request;
  • the first query node determining module 802 is configured to determine a query node according to the security level, where the query node is a node in a blockchain network;
  • the first query request forwarding module 803 is configured to send the query request to the determined query node
  • the first query result determining module 804 is configured to receive the query result returned by the query node. If the query result with the highest ratio meets the preset condition, the query result with the highest ratio is used as the query result corresponding to the data to be queried. .
  • the security level determining module 801 is configured to query a security level corresponding to the to-be-queried data in a block in which the correspondence between the data to be queried and the security level is stored.
  • the first query result determining module 804 includes:
  • a first candidate result determining submodule configured to use the highest ranked query result as a first candidate result
  • a first query result determining submodule configured to return the query result as the first candidate
  • the query result with the highest ratio is used as the query result corresponding to the data to be queried.
  • the apparatus 800 further includes:
  • the query node adjustment module 805 is configured to adjust the number of query nodes when the highest proportion of the query result does not meet the preset condition
  • the second query node determining module 806 is configured to determine the query node according to the adjusted number of query nodes
  • a second query request forwarding module 807 configured to forward the query request to the determined query node
  • the second query result determining module 808 is configured to determine a query result corresponding to the to-be-queried data according to the query result returned by the query node.
  • the second query result determining module 808 includes:
  • a second candidate result determining submodule configured to use the highest proportion of the query result as the second candidate result
  • the early warning information issuance sub-module is configured to, when the returned query result is that the ratio of the number of query nodes of the second candidate result to the total number of query nodes is smaller than the query success judgment threshold corresponding to the to-be-queried data, to the blockchain network Post warning information.
  • an embodiment of the present disclosure further provides a data query apparatus, which is applied to a blockchain node of a blockchain network, and the apparatus 900 includes:
  • the security level determining module 901 is configured to determine, according to the query request sent by the target blockchain node, a security level of the data to be queried corresponding to the query request;
  • the query probability determining module 902 is configured to determine a probability of responding to the query request according to the security level
  • the first query result returning module 903 is configured to determine the response according to the probability When the request is queried, the query result is returned to the target blockchain node.
  • the apparatus 900 further includes:
  • the probability adjustment module 904 is configured to adjust the probability when the query request is repeatedly received
  • the second query result returning module 905 is configured to, when determining to respond to the query request according to the adjusted probability, return a query result to the target blockchain node
  • the first query result return module 903 includes:
  • a first block determining submodule configured to determine, according to the transaction hash, a block in which the data to be queried is located when the transaction hash is included in the query request;
  • the first query result determining submodule is configured to acquire data from the determined block and return the acquired data as a query result to the target blockchain node.
  • the first query result return module 903 includes:
  • a transaction verification submodule configured to verify a transaction corresponding to the transaction hash according to the transaction hash when the transaction hash is included in the query request
  • a second query result determining submodule configured to return the verification result as the query result to the target blockchain node, the verification result including at least: whether the transaction has been recorded in the block, and the obtained confirmation The number of blocks.
  • the first query result return module 903 includes:
  • a second block determining submodule configured to determine, according to the account address, a block corresponding to the account address when the query request includes an account address
  • the third query result determining submodule is configured to acquire data from the determined block and return the acquired data as the query result to the target blockchain node.
  • the first query result return module 903 includes:
  • a third block determining submodule configured to: when the query request includes a query keyword, traverse the blockchain according to the query keyword, and obtain data corresponding to the keyword;
  • the fourth query result determining submodule is configured to return data corresponding to the keyword as the query result to the target blockchain node.
  • FIG. 10 is a block diagram of an apparatus 1000 for a data query method, which may be a node device in a blockchain, according to an exemplary embodiment.
  • the apparatus 1000 can include a processor 1001, a memory 1002, a multimedia component 1003, an input/output (I/O) interface 1004, and a communication component 1005.
  • the processor 1001 is configured to control the overall operation of the apparatus 1000 to complete all or part of the steps of the data query method described above.
  • the memory 1002 is for storing operating systems, various types of data to support operations at the device 1000, such as instructions that may include any application or method for operation on the device 1000, and application-related data.
  • the memory 1002 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read only memory ( Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read Only Read-Only Memory (ROM), magnetic memory, flash memory, disk or optical disk.
  • SRAM static random access memory
  • EEPROM Electrically Erasable Programmable Read-Only Memory
  • EPROM Erasable Programmable Read-Only Memory
  • PROM Programmable Read-Only Memory
  • ROM Read Only Read-Only Memory
  • the multimedia component 1003 can include a screen and an audio component.
  • the screen may be, for example, a touch screen, and the audio component is used to output and/or input an audio signal.
  • the audio component can include a microphone for receiving an external audio signal.
  • the received audio signal may be further stored in memory 1002 or transmitted via communication component 1005.
  • the audio component also includes at least one speaker for outputting an audio signal.
  • I/O interface 1004 provides for communication between processor 1001 and other interface modules Interface, the other interface modules mentioned above may be a keyboard, a mouse, a button, and the like. These buttons can be virtual buttons or physical buttons.
  • Communication component 1005 is used for wired or wireless communication between the device 1000 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 1005 can include: Wi-Fi module, Bluetooth module, NFC module.
  • the device 1000 may be configured by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), and digital signal processing devices (Digital Signal Processors).
  • ASICs Application Specific Integrated Circuits
  • DSPs Digital Signal Processors
  • Digital Signal Processors Digital Signal Processors
  • DSPD Processing Device
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • controller microcontroller, microprocessor or other electronic components Used to execute the above data query method.
  • a computer program product comprising a computer program executable by a programmable device, the computer program having when executed by the programmable device The code portion used to perform the data query method described above.
  • non-transitory computer readable storage medium comprising instructions, such as a memory 1002 comprising instructions executable by processor 1001 of apparatus 1000 to perform the data query method described above .
  • the non-transitory computer readable storage medium can be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.

Abstract

A data query method, device and a node apparatus, the method comprising: receiving a query request, determining a security level of data to be queried corresponding to the query request (201); determining a query node according to the security level, the query node being a node in a blockchain network (202); sending the query request to the determined query node (203); receiving a query result returned by the query node, and if a query result having a highest proportion satisfies a preset condition, taking the query result having the highest proportion as a query result corresponding to the data to be queried (204). The method determines different query policies according to different security levels, thus preventing query errors caused by a single node being attacked and data being tampered with, thereby improving the credibility and accuracy of the query result and avoiding query errors and security risks resulted from the blockchain data being tampered with.

Description

数据查询方法、装置及节点设备Data query method, device and node device 技术领域Technical field
本公开涉及区块链技术领域,尤其涉及一种数据查询方法、装置及节点设备。The present disclosure relates to the field of blockchain technology, and in particular, to a data query method, device, and node device.
背景技术Background technique
区块链是由区块链网络中所有节点共同参与维护的去中心化分布式数据库系统,它是由一系列基于密码学方法产生的数据块组成,每个数据块即为区块链中的一个区块。根据产生时间的先后顺序,区块被有序地链接在一起,形成一个数据链条,被形象地称为区块链。区块链有其特有的区块产生、交易产生和验证协议,具有不可篡改、不可伪造和完全可追溯等安全特性。A blockchain is a decentralized distributed database system in which all nodes in a blockchain network participate in maintenance. It is composed of a series of data blocks generated by cryptography, and each block is a blockchain. One block. According to the order of the generation time, the blocks are linked together in an orderly manner to form a data chain, which is aptly called a blockchain. The blockchain has its own unique block generation, transaction generation and verification protocols, and has security features such as non-tamperable, unforgeable and fully traceable.
区块链网络基于P2P网络,每个参与交易和区块存储、验证、转发的P2P网络节点都是一个区块链网络中的节点。区块链数据对每个节点是完全公开的,节点可以随意查看任何一个区块任意一笔交易的信息。The blockchain network is based on a P2P network, and each P2P network node participating in transaction and block storage, verification, and forwarding is a node in a blockchain network. The blockchain data is completely public to each node, and the node can view the information of any transaction in any block at will.
相关技术中,当查询者需要查询区块链中的数据时,若查询者本身就是区块链网络中的一个节点,则只要从自己存储的区块链副本中进行查询即可;若查询者并不是区块链网络中的节点,则需要向区块链网络中的节点发送查询请求,以实现数据查询。In the related art, when the querier needs to query the data in the blockchain, if the querier itself is a node in the blockchain network, it is only necessary to query from the blockchain copy stored by itself; Rather than a node in a blockchain network, a query request needs to be sent to a node in the blockchain network to implement data query.
由于区块链网络中的单一节点有被数据篡改或黑客攻击的可能性,因此,若某一节点的区块链副本已经被篡改了,则查询者向其发送查询请求后会接收到错误的查询结果。Since a single node in a blockchain network has the possibility of being tampered with by data or hacked, if a blockchain copy of a node has been tampered with, the queryer will receive an error after sending a query request to it. search result.
发明内容 Summary of the invention
为克服相关技术中存在的问题,本公开提供一种数据查询方法、装置及节点设备。To overcome the problems in the related art, the present disclosure provides a data query method, apparatus, and node device.
根据本公开实施例的第一方面,提供一种数据查询方法,应用于区块链网络的区块链节点,所述方法包括:According to a first aspect of the embodiments of the present disclosure, a data query method is provided for a blockchain node of a blockchain network, the method comprising:
接收查询请求,确定与所述查询请求对应的待查询数据的安全等级;Receiving a query request, determining a security level of the data to be queried corresponding to the query request;
根据所述安全等级确定查询节点,所述查询节点为区块链网络中的节点;Determining a query node according to the security level, where the query node is a node in a blockchain network;
发送所述查询请求给所确定的所述查询节点;Sending the query request to the determined query node;
接收所述查询节点返回的查询结果,如果比例最高的查询结果满足预设条件,将所述比例最高的查询结果作为所述待查询数据对应的查询结果。Receiving the query result returned by the query node, if the query result with the highest ratio meets the preset condition, the query result with the highest ratio is used as the query result corresponding to the data to be queried.
根据本公开实施例的第二方面,提供一种数据查询方法,应用于区块链网络的区块链节点,所述方法包括:According to a second aspect of the embodiments of the present disclosure, a data query method is provided, which is applied to a blockchain node of a blockchain network, and the method includes:
根据目标区块链节点发送的查询请求,确定与所述查询请求对应的待查询数据的安全等级;Determining, according to the query request sent by the target blockchain node, a security level of the data to be queried corresponding to the query request;
根据所述安全等级确定响应所述查询请求的概率;Determining a probability of responding to the query request according to the security level;
当根据所述概率,确定响应所述查询请求时,返回查询结果给所述目标区块链节点。When it is determined to respond to the query request according to the probability, a query result is returned to the target blockchain node.
根据本公开实施例的第三方面,提供一种数据查询装置,应用于区块链网络的区块链节点,所述装置包括:According to a third aspect of the embodiments of the present disclosure, there is provided a data query apparatus, which is applied to a blockchain node of a blockchain network, the device comprising:
安全等级确定模块,被配置为接收查询请求,确定与所述查询请求对应的待查询数据的安全等级;a security level determining module, configured to receive a query request, and determine a security level of the data to be queried corresponding to the query request;
第一查询节点确定模块,被配置为根据所述安全等级确定查询节点,所述查询节点为区块链网络中的节点;a first query node determining module, configured to determine a query node according to the security level, where the query node is a node in a blockchain network;
第一查询请求转发模块,被配置为发送所述查询请求给所确定的所述查询节点; a first query request forwarding module configured to send the query request to the determined query node;
第一查询结果确定模块,被配置为接收所述查询节点返回的查询结果,如果比例最高的查询结果满足预设条件,将所述比例最高的查询结果作为所述待查询数据对应的查询结果。The first query result determining module is configured to receive the query result returned by the query node. If the query result with the highest ratio meets the preset condition, the query result with the highest ratio is used as the query result corresponding to the data to be queried.
根据本公开实施例的第四方面,提供一种数据查询装置,应用于区块链网络的区块链节点,所述装置包括:According to a fourth aspect of the embodiments of the present disclosure, there is provided a data query apparatus, which is applied to a blockchain node of a blockchain network, the device comprising:
安全等级确定模块,被配置为根据目标区块链节点发送的查询请求,确定与所述查询请求对应的待查询数据的安全等级;a security level determining module, configured to determine, according to a query request sent by the target blockchain node, a security level of the data to be queried corresponding to the query request;
查询概率确定模块,被配置为根据所述安全等级确定响应所述查询请求的概率;a query probability determination module configured to determine a probability of responding to the query request according to the security level;
第一查询结果返回模块,被配置为在根据所述概率,确定响应所述查询请求时,返回查询结果给所述目标区块链节点。The first query result returning module is configured to, when determining to respond to the query request according to the probability, return a query result to the target blockchain node.
根据本公开实施例的第五方面,提供一种计算机程序产品,所述计算机程序产品包含能够由可编程的装置执行的计算机程序,所述计算机程序具有当由所述可编程的装置执行时用于执行上述第一方面的方法的代码部分。According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product comprising a computer program executable by a programmable device, the computer program having when executed by the programmable device The code portion of the method of performing the above first aspect.
根据本公开实施例的第六方面,提供一种非临时性计算机可读存储介质,所述非临时性计算机可读存储介质中包括一个或多个程序,所述一个或多个程序用于执行上述第一方面所述的方法。According to a sixth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium comprising one or more programs for performing The method of the above first aspect.
根据本公开实施例的第七方面,提供一种节点设备,包括:According to a seventh aspect of the embodiments of the present disclosure, a node device is provided, including:
上述第六方面所述的非临时性计算机可读存储介质;以及The non-transitory computer readable storage medium of the above sixth aspect;
一个或者多个处理器,用于执行所述非临时性计算机可读存储介质中的程序。One or more processors for executing a program in the non-transitory computer readable storage medium.
根据本公开实施例的第八方面,提供一种计算机程序产品,其特征在于,所述计算机程序产品包含能够由可编程的装置执行的计算机程序,所述计算机程序具有当由所述可编程的装置执行时用于执行上述第二方面所述的方法的代码部分。 According to an eighth aspect of an embodiment of the present disclosure, there is provided a computer program product, characterized in that the computer program product comprises a computer program executable by a programmable device, the computer program having when The portion of code used to perform the method described in the second aspect above when the device is executed.
根据本公开实施例的第九方面,提供一种非临时性计算机可读存储介质,所述非临时性计算机可读存储介质中包括一个或多个程序,所述一个或多个程序用于执行上述第二方面所述的方法。According to a ninth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium comprising one or more programs for performing The method of the above second aspect.
根据本公开实施例的第十方面,提供一种节点设备,包括:According to a tenth aspect of the embodiments of the present disclosure, a node device is provided, including:
上述第九方面所述的非临时性计算机可读存储介质;以及The non-transitory computer readable storage medium of the above ninth aspect;
一个或者多个处理器,用于执行所述非临时性计算机可读存储介质中的程序。One or more processors for executing a program in the non-transitory computer readable storage medium.
本公开实施例至少包括以下有益效果:根据不同安全等级确定不同的查询策略,避免了单个节点被攻击、数据被篡改等导致的查询错误;提高查询结果的可信度和正确率,防止区块链数据被篡改带来的查询错误和安全风险。The embodiments of the present disclosure include at least the following beneficial effects: determining different query strategies according to different security levels, avoiding query errors caused by single nodes being attacked, data being tampered with, etc.; improving credibility and correctness of query results, and preventing blocks Chain data is tampered with query errors and security risks.
本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。Other features and advantages of the present disclosure will be described in detail in the detailed description which follows.
附图说明DRAWINGS
附图是用来提供对本公开的进一步理解,并且构成说明书的一部分,与下面的具体实施方式一起用于解释本公开,但并不构成对本公开的限制。在附图中:The drawings are intended to provide a further understanding of the disclosure, and are in the In the drawing:
图1是本公开一实施例的区块链网络的示意图;1 is a schematic diagram of a blockchain network according to an embodiment of the present disclosure;
图2是本公开一实施例的数据查询方法的流程示意图;2 is a schematic flowchart of a data query method according to an embodiment of the present disclosure;
图3是本公开另一实施例的数据查询方法的流程示意图;3 is a schematic flowchart of a data query method according to another embodiment of the present disclosure;
图4是本公开一实施例中候选结果未满足预先条件时的处理流程示意图;4 is a schematic diagram of a process flow when a candidate result does not satisfy a pre-condition in an embodiment of the present disclosure;
图5是本公开一实施例中查询失败时,目标区块链节点发布信息的示意图;FIG. 5 is a schematic diagram of a target blockchain node releasing information when a query fails in an embodiment of the present disclosure; FIG.
图6是本公开一实施例的数据查询方法的流程示意图;FIG. 6 is a schematic flowchart diagram of a data query method according to an embodiment of the present disclosure;
图7是本公开另一实施例的数据查询方法的流程示意图; FIG. 7 is a schematic flowchart diagram of a data query method according to another embodiment of the present disclosure;
图8是本公开一实施例的数据查询装置的框图;FIG. 8 is a block diagram of a data query apparatus according to an embodiment of the present disclosure; FIG.
图9是本公开另一实施例的数据查询装置的框图;9 is a block diagram of a data query apparatus according to another embodiment of the present disclosure;
图10是根据一示例性实施例示出的一种用于数据查询方法的装置的框图。FIG. 10 is a block diagram of an apparatus for a data query method, according to an exemplary embodiment.
具体实施方式detailed description
在对本公开提供的区块链权限控制方法、装置及节点设备进行说明之前,先对本公开各个实施例所涉及的区块链进行介绍。Before describing the blockchain authority control method, apparatus, and node device provided by the present disclosure, the blockchains involved in the various embodiments of the present disclosure are first introduced.
本公开实施例中,将区块链中的数据根据属性设置不同安全等级,而不同安全等级的数据在查询时则对应不同的查询节点随机抽取比例,进而由相应数量的查询节点进行数据查询;并根据查询节点返回的查询结果统计是否达到该安全级数据的查询成功判断阈值,如果达到查询成功判断阈值则认为此查询结果可信,达不到查询成功判断阈值则需要以更高比例或者直接以百分百的比例进行第二次查询,如果第二次查询依然达不到相应安全级数据对应的查询成功判断阈值,则可进行预警或由人工及其他方式判定此数据的准确性。由此,本公开实施例的数据查询方法、装置和节点设备可提高查询结果的可信度和正确率,防止区块链数据被篡改带来的查询错误和安全风险。In the embodiment of the present disclosure, the data in the blockchain is set to different security levels according to the attributes, and the data of different security levels is correspondingly selected by different query nodes in the query, and then the data query is performed by the corresponding number of query nodes; And according to the query result returned by the query node, whether the query success judgment threshold of the security level data is reached, and if the query success judgment threshold is reached, the query result is considered to be trustworthy, and the query success judgment threshold is not required to be a higher ratio or directly The second query is performed in a hundred percent ratio. If the second query still fails to reach the query success judgment threshold corresponding to the corresponding security level data, the warning may be performed or the accuracy of the data may be determined manually or by other means. Therefore, the data query method, device and node device of the embodiments of the present disclosure can improve the credibility and correctness of the query result, and prevent query errors and security risks caused by the tampering of the blockchain data.
本公开实施例的,区块链数据的查询方法,可应用于查询端不是区块链中的节点的场景,也可应用于查询端是区块链中的节点的场景,提高查询结果的可信度和正确率,防止区块链数据被篡改带来的查询错误和安全风险。In the embodiment of the present disclosure, the query method of the blockchain data may be applied to a scenario where the query end is not a node in the blockchain, or may be applied to a scenario where the query end is a node in the blockchain, and the query result may be improved. Reliability and accuracy, preventing query errors and security risks caused by tampering with blockchain data.
在对本公开提供的数据查询方法、装置和节点设备进行说明之前,先对本公开各个实施例所涉及的区块链进行介绍。Before describing the data query method, apparatus and node device provided by the present disclosure, the blockchains involved in various embodiments of the present disclosure are first introduced.
区块链节点:区块链是由区块链网络中所有节点共同参与维护的去中心化分布式数据库系统,它是由一系列基于密码学方法产生的数据块组成,每个数据块即为区块链中的一个区块。根据产生时间的先后顺序,区块被有序 地链接在一起,形成一个数据链条,被形象地称为区块链。下面对区块链网络的一些概念进行介绍。Blockchain node: A blockchain is a decentralized distributed database system in which all nodes in a blockchain network participate in maintenance. It is composed of a series of data blocks generated by cryptography. Each data block is A block in a blockchain. The blocks are ordered according to the order in which they are generated. The links are linked together to form a data chain, which is aptly called a blockchain. Some concepts of the blockchain network are introduced below.
区块链网络中的节点可以称为区块链节点,其中区块链网络基于P2P(Peer to Peer,对等网络)网络,每个参与交易和区块存储、验证、转发的P2P网络节点都是一个区块链网络中的节点。A node in a blockchain network may be referred to as a blockchain node, wherein the blockchain network is based on a P2P (Peer to Peer) network, and each P2P network node participating in the transaction and block storage, verification, and forwarding is Is a node in a blockchain network.
用户身份:区块链中的用户身份可以使用公钥或者是根据该公钥生成的账户地址表示,并且公钥和私钥是成对出现的,其中私钥由用户掌握而不发布到上述的区块链网络中,公钥或者上述的账户地址可随意发布在区块链网络中。其中,公钥可以通过特定的哈希和编码后成为上述的账户地址。值得一提的是,用户身份和区块链节点不存在一一对应关系,用户可以在任意一个区块链节点上使用自己的私钥。User identity: The user identity in the blockchain can be represented by a public key or an account address generated based on the public key, and the public key and the private key appear in pairs, wherein the private key is mastered by the user and not issued to the above. In the blockchain network, the public key or the above account address can be freely posted in the blockchain network. Among them, the public key can be the above account address through a specific hash and encoding. It is worth mentioning that there is no one-to-one correspondence between user identity and blockchain nodes. Users can use their own private key on any blockchain node.
区块链数据写入:由区块链节点通过向区块链网络发布交易(Transaction)实现向区块链写入数据。该交易包括:区块链节点按照预设的交易数据格式对生成的交易数据包,以及利用该区块链节点自己的私钥对该交易数据包进行的数字签名,该数字签名用于证明该区块链节点的用户的身份;而后,该交易被发布到区块链网络后,被区块链网络中的“矿工”(即执行PoW(Proof Of Work,工作证明)共识竞争机制的区块链节点)记录入区块链中产生的新区块,并将该新区块发布到区块链网络中,在该新区块以及该新区块所记录的交易其他区块链节点验证通过和接受后,该新区块所记录的交易即被写入区块链。其中,区块链中的新区块是由上述的“矿工”通过执行PoW或PoS等共识竞争机制而定期产生的,因此产生新区块的时间间隔通常和上述的预设技术要求相关,通过设置不同的预设技术要求可以改变区块链产生新区块的时间间隔。Blockchain data write: The blockchain node writes data to the blockchain by issuing a transaction to the blockchain network. The transaction includes: the blockchain node performs a digital signature on the generated transaction data packet according to a preset transaction data format, and uses the private key of the blockchain node to perform the digital signature on the transaction data packet, and the digital signature is used to prove the The identity of the user of the blockchain node; then, after the transaction is posted to the blockchain network, the "miner" in the blockchain network (ie, the block that performs the PoW (Proof Of Work) consensus competition mechanism The chain node records the new block generated in the blockchain and publishes the new block to the blockchain network. After the new block and the other blockchain nodes recorded in the new block are verified and passed, The transactions recorded in this new block are written to the blockchain. Among them, the new block in the blockchain is periodically generated by the above-mentioned "miners" by implementing a consensus competition mechanism such as PoW or PoS, so the time interval for generating new blocks is usually related to the above-mentioned preset technical requirements, and the settings are different. The default technical requirements can change the time interval at which the blockchain generates new blocks.
参见图1,为本公开一实施例的区块链网络的示意图。Referring to FIG. 1, a schematic diagram of a blockchain network according to an embodiment of the present disclosure.
该区块链网络100中包括:一个或多个区块链节点101,这些区块链节 点101可以各种形式来实施,例如,可以为手机、智能电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、服务器、矿机等。The blockchain network 100 includes: one or more blockchain nodes 101, and these block links The point 101 can be implemented in various forms, for example, a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet), a PMP (Portable Multimedia Player), a server, a mine. Machine and so on.
在一个实施例中,区块链中的每个区块包括区块头和区块主体。区块主体保存交易数据。交易数据通过默克尔树进行保存。默克尔树根的哈希值存储到区块头中。区块头至少包括:上一区块头的哈希值、默克尔树根的哈希值、时间戳和区块号等。In one embodiment, each block in the blockchain includes a block header and a block body. The block body holds the transaction data. Transaction data is saved via the Merkel tree. The hash of the Merkel root is stored in the block header. The block header includes at least: a hash value of the previous block header, a hash value of the Merkel root, a time stamp, and a block number.
交易数据可为任何类型的数据,包括但不限于:各种类型的统计数据(例如,人口数据、医疗数据等),各种类型的货币交易数据(例如,转账交易数据),以及各种类型的请求数据(例如,查询请求、节点加入请求等)等。Transaction data can be any type of data including, but not limited to, various types of statistical data (eg, demographic data, medical data, etc.), various types of currency transaction data (eg, transfer transaction data), and various types. Request data (for example, query request, node join request, etc.).
本公开实施例中,为了保证信息查询的安全性,将对区块链数据按照数据属性进行安全等级设置,不同的安全等级对应不同的查询策略,提高数据查询的安全性和准确率。In the embodiment of the present disclosure, in order to ensure the security of the information query, the blockchain data is set according to the data attribute security level, and different security levels correspond to different query strategies, thereby improving the security and accuracy of the data query.
参见表1,为本公开一实施例的不同安全等级的区块链数据与不同的查询策略的对应关系。Referring to Table 1, the correspondence between blockchain data of different security levels and different query policies is according to an embodiment of the present disclosure.
表1Table 1
Figure PCTCN2016113758-appb-000001
Figure PCTCN2016113758-appb-000001
其中,查询节点比例是指,查询节点数与区块链节点总数的比值,如式(1)所示。在本公开的一实施例中,查询节点为响应查询请求的节点,或接收到查询请求的节点。 The ratio of the query node refers to the ratio of the number of query nodes to the total number of blockchain nodes, as shown in equation (1). In an embodiment of the present disclosure, the query node is a node that responds to the query request, or a node that receives the query request.
Figure PCTCN2016113758-appb-000002
Figure PCTCN2016113758-appb-000002
其中,n为查询节点数,N为区块链网络中的区块链节点总数。Where n is the number of query nodes and N is the total number of blockchain nodes in the blockchain network.
查询成功判定阈值是指,查询节点返回的查询结果中,比例最高的查询结果的数量与查询节点总数的比值,如式(2)所示。The query success determination threshold is the ratio of the number of query results with the highest proportion of query results returned by the query node to the total number of query nodes, as shown in equation (2).
Figure PCTCN2016113758-appb-000003
Figure PCTCN2016113758-appb-000003
其中,m为比例最高的查询结果的数量。Where m is the number of query results with the highest ratio.
应理解,由于区块链中可能存在一些查询节点因关机或死机等异常造成无法响应任何请求的情况,公式(1)和公式(2)中的n包括了这些本应响应查询请求,返回查询结果,但由于异常未返回查询结果的查询节点以及返回查询结果的查询节点的总数。It should be understood that since some query nodes in the blockchain may not be able to respond to any request due to abnormalities such as shutdown or crash, n in formula (1) and formula (2) includes these should respond to the query request, and the query is returned. The result, but because of the exception, the query node that did not return the query result and the total number of query nodes that returned the query result.
在本公开的一实施例中,可根据区块链数据所属的类别,确定其安全等级。第一安全等级的区块链数据可为与个人信息相关的数据、货币交易数据等;第二安全等级的区块链数据可为各种类型的统计数据;第三安全等级的区块链数据可为各种类型的请求数据(例如,查询请求、节点加入请求等)。应理解,区块链数据的安全等级可根据实际情况进行设定,并不限于这里所给出的示例。In an embodiment of the present disclosure, the security level may be determined according to the category to which the blockchain data belongs. The blockchain data of the first security level may be data related to personal information, currency transaction data, etc.; blockchain data of the second security level may be various types of statistical data; blockchain data of the third security level There may be various types of request data (eg, query requests, node join requests, etc.). It should be understood that the security level of the blockchain data may be set according to actual conditions, and is not limited to the examples given herein.
在另一些实施例中,在新建区块时,确定要写入到区块链的数据的安全等级。将数据的安全等级与数据一起写入到区块链中。由此,在进行数据查询时,可从区块链中查询到数据的安全等级。In other embodiments, the security level of the data to be written to the blockchain is determined when the block is newly created. Write the security level of the data along with the data into the blockchain. Thus, when performing a data query, the security level of the data can be queried from the blockchain.
上述表1所示的区块链数据的安全等级与查询策略的对应关系被存储到区块链的一区块中。当区块链节点接收到查询请求时,可根据查询请求,确定待查询数据,并从区块链的区块中查询区块链数据的安全等级与查询策略的对应关系,确定待查询数据的查询策略。The correspondence between the security level of the blockchain data and the query strategy shown in Table 1 above is stored in a block of the blockchain. When the blockchain node receives the query request, it may determine the data to be queried according to the query request, and query the correspondence between the security level of the blockchain data and the query policy from the block of the blockchain to determine the data to be queried. Query strategy.
参见图2,为本公开一实施例的数据查询方法的流程示意图。该方法包括以下步骤: 2 is a schematic flowchart of a data query method according to an embodiment of the present disclosure. The method includes the following steps:
在步骤201中,接收查询请求,确定与查询请求对应的待查询数据的安全等级。In step 201, a query request is received to determine a security level of the data to be queried corresponding to the query request.
在步骤202中,根据安全等级确定查询节点。In step 202, the query node is determined based on the security level.
在步骤203中,发送查询请求给所确定的查询节点。In step 203, a query request is sent to the determined query node.
在步骤204中,接收查询节点返回的查询结果,如果比例最高的查询结果满足预设条件,将比例最高的查询结果作为待查询数据对应的查询结果。In step 204, the query result returned by the query node is received. If the query result with the highest ratio satisfies the preset condition, the query result with the highest proportion is used as the query result corresponding to the data to be queried.
以下将结合图3至图5对本公开实施例的数据查询方法进行介绍。The data query method of the embodiment of the present disclosure will be described below with reference to FIGS. 3 to 5.
参见图3,在步骤301中,目标区块链节点根据查询请求,确定待查询数据的安全等级。Referring to FIG. 3, in step 301, the target blockchain node determines the security level of the data to be queried according to the query request.
在一个实施例中,当要进行数据查询时,查询端生成查询请求,并将查询请求发送给目标区块链节点。这里的查询端为非区块链网络中的电子设备。In one embodiment, when a data query is to be performed, the query side generates a query request and sends the query request to the target blockchain node. The query end here is an electronic device in a non-blockchain network.
在另一实施例中,查询请求由目标区块链节点自己生成,即该目标区块链节点即为查询端。In another embodiment, the query request is generated by the target blockchain node itself, that is, the target blockchain node is the query end.
查询请求中包括以下信息中的至少一者:交易哈希、账户地址和查询关键字。The query request includes at least one of the following information: a transaction hash, an account address, and a query keyword.
当查询请求中包括交易哈希时,确定的待查询数据可包括:交易哈希对应的交易是否生效、货币交易数据等。在一个实施例中,当查询请求中包括交易哈希时,将待查询数据的安全等级确定为第一安全等级。When the transaction hash is included in the query request, the determined data to be queried may include: whether the transaction corresponding to the transaction hash is valid, currency transaction data, and the like. In one embodiment, when a transaction hash is included in the query request, the security level of the data to be queried is determined to be the first security level.
当查询请求中包括账户地址时,确定的待查询数据可包括:账户地址对应的账户的信息、账户地址对应的账户的交易记录等。在一个实施例中,当查询请求中包括账户地址时,将待查询数据的安全等级确定为第一安全等级。When the account address is included in the query request, the determined data to be queried may include: information of the account corresponding to the account address, transaction record of the account corresponding to the account address, and the like. In one embodiment, when the account address is included in the query request, the security level of the data to be queried is determined as the first security level.
当查询请求中包括查询关键字时,确定的待查询数据可包括:与关键字相对应的数据。在一个实施例中,可根据关键字,确定待查询数据的安全等级,当关键字包括:账户、交易等信息时,将待查询数据的安全等级确定为第一安全等级;当关键字未包括账户、交易等信息时,将待查询数据的安全 等级确定为第二安全等级或其它等级。When the query keyword is included in the query request, the determined data to be queried may include: data corresponding to the keyword. In an embodiment, the security level of the data to be queried may be determined according to the keyword, and when the keyword includes: an account, a transaction, and the like, the security level of the data to be queried is determined as the first security level; when the keyword is not included Security of data to be queried when accounts, transactions, etc. The rating is determined to be the second security level or other level.
由此,本公开实施例,可实现根据查询请求,确定待查询数据的安全等级。Therefore, in the embodiment of the present disclosure, the security level of the data to be queried is determined according to the query request.
在步骤302中,目标区块链节点根据待查询数据的安全等级,确定查询策略。In step 302, the target blockchain node determines the query policy according to the security level of the data to be queried.
在本公开的一实施例中,可从存储有上述表1所示的对应关系的区块中,查询安全等级对应的查询策略。In an embodiment of the present disclosure, the query policy corresponding to the security level may be queried from the block in which the correspondence relationship shown in Table 1 above is stored.
在步骤303中,目标区块链节点根据安全等级对应的查询策略,确定查询节点。In step 303, the target blockchain node determines the query node according to the query policy corresponding to the security level.
在步骤304中,目标区块链节点向查询节点转发查询请求。In step 304, the target blockchain node forwards the query request to the query node.
在本公开的一实施例中,每个区块链节点均保存有区块链网络中的所有节点的地址信息,并在有新节点加入区块链网络和有节点退出区块链网络时,更新所保存的地址信息。由此,目标区块链节点可根据存储的区块链节点的地址信息,例如IP地址信息,随机选择和查询策略相对应个数的区块链节点作为查询节点,并根据区块链节点的IP地址,进行查询请求的转发。例如,根据查询策略确定查询节点比例为w1%时,在区块链网络的节点中随机选择w1%×N个节点作为查询节点,根据其IP地址,向这w1%×N个查询节点发送查询请求。In an embodiment of the present disclosure, each blockchain node stores address information of all nodes in the blockchain network, and when a new node joins the blockchain network and has a node exits the blockchain network, Update the saved address information. Therefore, the target block chain node can randomly select and query the block number node corresponding to the policy as the query node according to the stored address information of the block chain node, for example, the IP address information, and according to the block chain node. IP address, forwarding of query requests. For example, when the query node determines that the proportion of the query node is w1%, w1%×N nodes are randomly selected as nodes in the blockchain network, and the query is sent to the w1%×N query nodes according to the IP address. request.
应理解,目标区块链节点所确定的查询节点中可包括自身,且包括自身时,无需进行查询请求的转发。It should be understood that the query node determined by the target blockchain node may include itself, and when it includes itself, there is no need to forward the query request.
在步骤305中,目标区块链节点接收查询节点返回查询结果。In step 305, the target blockchain node receives the query node and returns the query result.
接收到查询请求的查询节点,根据查询请求进行查询,获得查询结果,并将查询结果返回给目标区块链节点。在一个实施例中,目标区块链节点在转发查询请求时,将自己的地址信息与查询请求一起进行转发,由此,查询节点在获取到查询结果时,可根据目标区块链节点的地址信息,将查询结果 返回给目标区块链节点。The query node that receives the query request performs a query according to the query request, obtains the query result, and returns the query result to the target block chain node. In an embodiment, the target block chain node forwards the address information together with the query request when forwarding the query request, thereby the query node may obtain the query result according to the address of the target block chain node. Information, will query results Return to the target blockchain node.
查询节点根据查询请求获取查询结果时:当查询请求中包括交易哈希时,查询节点根据交易哈希,确定待查询数据所在的区块,并从相应的区块中获取数据,以及将获取的数据作为查询结果返回给目标区块链节点。When the query node obtains the query result according to the query request: when the query request includes the transaction hash, the query node determines the block where the data to be queried is located according to the transaction hash, and obtains data from the corresponding block, and the acquired data. The data is returned to the target blockchain node as a result of the query.
在一些实施例中,查询节点根据交易哈希,对交易哈希对应的交易进行验证,即根据交易哈希,在区块链中进行查询,判断交易是否被记录到某个区块中,并且根据区块在区块链中的位置,确定该区块得到了多少确认。由此,查询结果包括交易验证结果,该交易验证结果至少包括:交易是否已被记录到区块中,以及得到的确认区块数。In some embodiments, the query node verifies the transaction corresponding to the transaction hash according to the transaction hash, that is, according to the transaction hash, performs a query in the blockchain to determine whether the transaction is recorded in a certain block, and Based on the location of the block in the blockchain, determine how much confirmation the block received. Thus, the query result includes a transaction verification result, the transaction verification result including at least: whether the transaction has been recorded in the block, and the number of confirmed blocks obtained.
当查询请求中包括账户地址时,查询节点根据账户地址,确定账户地址所对应的区块,并从相应的区块中获取数据,以及将获取的数据作为查询结果返回给目标区块链节点。When the query request includes the account address, the query node determines the block corresponding to the account address according to the account address, and obtains data from the corresponding block, and returns the acquired data as a query result to the target block chain node.
当查询请求中包括查询关键字时,查询节点根据查询关键字,对区块链进行遍历,获得与关键字相对应的数据,以及将与关键字相对应的数据作为查询结果返回给目标区块链节点。When the query request includes the query keyword, the query node traverses the blockchain according to the query keyword, obtains data corresponding to the keyword, and returns the data corresponding to the keyword as the query result to the target block. Chain node.
在步骤306中,目标区块链节点根据查询节点返回的查询结果,确定候选结果。In step 306, the target blockchain node determines the candidate result according to the query result returned by the query node.
目标区块链节点接收查询节点返回的查询结果,并将不同查询结果进行统计,将比例最高的查询结果作为候选结果。例如,若返回的查询结果数为100个,其中有85个查询结果都为A,则将A为比例最高的查询结果,将其作为候选结果。The target block chain node receives the query result returned by the query node, and compares different query results, and uses the highest proportion of the query result as a candidate result. For example, if the number of returned query results is 100, and 85 of the query results are all A, then A is the highest proportion of the query results, which is used as a candidate result.
在步骤307中,当候选结果满足预设条件时,将候选结果作为待查询数据对应的查询结果。In step 307, when the candidate result satisfies the preset condition, the candidate result is used as the query result corresponding to the data to be queried.
在一个实施例中,预设条件为:返回的查询结果为候选结果的查询节点数与查询节点总数的比值大于或等于待查询数据对应的查询成功判断阈值。 由此,目标区块链节点将返回的查询结果为候选结果的查询节点数与查询节点总数相比,当比值大于或等于待查询数据对应的查询策略中的查询成功判定阈值时,即将候选结果作为待查询数据对应的查询结果。In one embodiment, the preset condition is that the ratio of the number of query nodes of the returned query result to the candidate result to the total number of query nodes is greater than or equal to the query success judgment threshold corresponding to the data to be queried. Therefore, the target block chain node returns the query result as the candidate result. The number of query nodes is compared with the total number of query nodes. When the ratio is greater than or equal to the query success determination threshold in the query policy corresponding to the data to be queried, the candidate result is obtained. As the query result corresponding to the data to be queried.
在本公开的实施例中,并不是所有的查询节点都会返回查询结果,例如,查询节点可能由于异常(例如,被非法控制,被篡改,关机或故障等)未返回查询结果,但比值的计算中,将返回的查询结果为候选结果的查询节点数与查询节点总数相比,从而使得未返回查询结果的查询节点对查询结果会产生影响,提高查询结果的可参考性,降低查询风险。In the embodiment of the present disclosure, not all query nodes will return the query result. For example, the query node may not return the query result due to an abnormality (for example, being illegally controlled, tampered with, shutting down, or malfunctioning, etc.), but the calculation of the ratio The number of query nodes that return the query result as the candidate result is compared with the total number of query nodes, so that the query node that does not return the query result has an impact on the query result, improves the referenceability of the query result, and reduces the query risk.
参见图4,当候选结果未满足预设条件时,则重新进行查询。在本公开的一实施例中,重新进行查询时,对查询节点的数量进行调整,以提高查询结果的可信度和正确率。Referring to FIG. 4, when the candidate result does not satisfy the preset condition, the query is re-executed. In an embodiment of the present disclosure, when the query is re-initiated, the number of query nodes is adjusted to improve the credibility and correctness of the query result.
在步骤401中,目标区块链节点按照第一预设比例增加查询节点的数量。In step 401, the target blockchain node increases the number of query nodes according to the first preset ratio.
在本公开的实施例中,第一预设比例可设置为10%-50%。在一些实施例中,若第一次查询未成功(即候选结果未满足预设条件),则将查询节点的比例提高至100%。In an embodiment of the present disclosure, the first preset ratio may be set to be 10% to 50%. In some embodiments, if the first query is unsuccessful (ie, the candidate result does not satisfy the preset condition), the proportion of the query node is increased to 100%.
在步骤402中,目标区块链节点向查询节点转发查询请求。In step 402, the target blockchain node forwards the query request to the query node.
在步骤403中,目标区块链节点接收查询节点返回查询结果。In step 403, the target blockchain node receives the query node and returns the query result.
在步骤404中,目标区块链节点根据查询节点返回的查询结果,确定候选结果。In step 404, the target blockchain node determines the candidate result according to the query result returned by the query node.
在步骤405中,当候选结果满足预设条件时,将候选结果作为待查询数据对应的查询结果。In step 405, when the candidate result satisfies the preset condition, the candidate result is used as the query result corresponding to the data to be queried.
应理解,步骤402-405和上述步骤304-307的实施原理相同,在此不再赘述。且在步骤405中,确定候选结果是否满足预设条件时,查询成功判定阈值与步骤307中相同。当然,在一些实施例中,也可在步骤405中,将查询成功判定阈值按比例提高,本公开对此不作限定。 It should be understood that the implementation principles of steps 402-405 and steps 304-307 are the same, and are not described herein again. And in step 405, when it is determined whether the candidate result satisfies the preset condition, the query success determination threshold is the same as in step 307. Of course, in some embodiments, the query success determination threshold may also be scaled up in step 405, which is not limited in this disclosure.
参见图5,在本公开的实施例中,当进行该第二次查询时,候选结果仍未满足预设条件,则第二次查询失败,目标区块链节点发布预警信息到区块链网络中。该预警信息中包括:查询请求中的交易哈希、账户地址或查询关键字。该预警信息用于提示区块链网络中的节点,查询请求所对应的数据出现安全风险。在一个实施例中,若查询端为非区块链网络中的节点设备,则目标区块链节点向查询端发送提示信息,该提示信息用于提示查询结果不可用或查询无效等。Referring to FIG. 5, in the embodiment of the present disclosure, when the second query is performed, the candidate result still fails to meet the preset condition, and the second query fails, and the target block chain node issues the warning information to the blockchain network. in. The warning information includes: a transaction hash, an account address, or a query keyword in the query request. The warning information is used to prompt the nodes in the blockchain network, and the data corresponding to the query request presents a security risk. In an embodiment, if the query end is a node device in the non-blockchain network, the target block chain node sends a prompt message to the query end, where the prompt information is used to prompt that the query result is unavailable or the query is invalid.
应理解,当第二次查询失败时,还可进行第三次、第四次……查询,查询的次数可根据实际情况进行设置,直到查询次数达到最大查询次数,仍查询失败时,按照图5所示输出预警信息和提示信息。每增加一次查询,可将查询节点的比例提高一次。It should be understood that when the second query fails, the third and fourth times of the query may also be performed, and the number of queries may be set according to actual conditions until the number of queries reaches the maximum number of queries, and when the query fails, according to the figure 5 outputs warning information and prompt information. The index of the query node can be increased once for each additional query.
本公开实施例的数据查询方法,根据不同安全等级确定不同的查询策略,避免了单个节点被攻击、数据被篡改等导致的查询错误;提高查询结果的可信度和正确率,防止区块链数据被篡改带来的查询错误和安全风险;可避免因只通过单个节点进行查询,而该单个节点被攻击或数据被篡改,而使查询到错误信息的可能性;另一方面,也避免了所有的查询请求都采用同一比例查询节点进行查询带来的资源浪费,以及每次查询都通过100%的区块链节点进行查询对所有区块链节点带来的负担,可在保证查询结果可靠性的情况下,降低对区块链并发性造成的负面影响。The data query method of the embodiment of the present disclosure determines different query strategies according to different security levels, avoids query errors caused by single node being attacked, data being tampered with, etc.; improves credibility and correctness of query results, and prevents blockchain Query errors and security risks caused by tampering with data; avoiding the possibility of querying only a single node, and the single node being attacked or data being tampered with, so that the error message is queried; on the other hand, it is avoided All query requests use the same proportion of query nodes for resource waste caused by query, and each query passes the 100% blockchain node to query the burden on all blockchain nodes, which can ensure reliable query results. In the case of sex, reduce the negative impact on the concurrency of the blockchain.
参见图6,为本公开另一实施例的数据查询方法的流程示意图。该方法包括以下步骤:FIG. 6 is a schematic flowchart diagram of a data query method according to another embodiment of the present disclosure. The method includes the following steps:
在步骤601中,根据目标区块链节点发送的查询请求,确定与查询请求对应的待查询数据的安全等级;In step 601, determining, according to the query request sent by the target blockchain node, the security level of the data to be queried corresponding to the query request;
在步骤602中,根据安全等级确定响应查询请求的概率;In step 602, a probability of responding to the query request is determined according to the security level;
在步骤603中,当根据概率,确定响应查询请求时,返回查询结果给目 标区块链节点。In step 603, when the response query request is determined according to the probability, the query result is returned to the target. Standard blockchain node.
在本公开的该实施例中,目标区块链节点(即接收到查询端发送的查询请求的区块链节点或自身产生查询请求的区块链节点)将查询请求发布到区块链网络中,使得区块链网络中的所有节点都可接收到查询请求。接收到查询请求的区块链节点,可根据查询请求所对应的查询策略,确定响应查询请求的概率,从而按照概率进行查询结果的返回。In this embodiment of the present disclosure, the target blockchain node (ie, the blockchain node that receives the query request sent by the query end or the blockchain node that generates the query request itself) issues the query request to the blockchain network. So that all nodes in the blockchain network can receive the query request. The blockchain node that receives the query request may determine the probability of responding to the query request according to the query policy corresponding to the query request, thereby returning the query result according to the probability.
参见图7,在本公开一实施例的数据查询方法中,在步骤701中,目标区块链节点将查询请求发布到区块链网络中。Referring to FIG. 7, in the data query method according to an embodiment of the present disclosure, in step 701, the target blockchain node issues a query request to the blockchain network.
与上述图3所示的实施例相同,查询请求可为目标区块链节点自己生成,或非区块链网络中的电子设备生成。As with the embodiment illustrated in Figure 3 above, the query request may be generated by the target blockchain node itself or by an electronic device in the non-blockchain network.
在该实施例中,目标区块链节点将查询请求发送给与自己连接的区块链节点,而这些区块链节点又将查询请求发送给其它区块链节点,使得区块链网络中的每个区块链节点都可以接收到查询请求。In this embodiment, the target blockchain node sends a query request to the blockchain node connected to itself, and these blockchain nodes send query requests to other blockchain nodes, so that in the blockchain network Each blockchain node can receive a query request.
在步骤702中,接收到查询请求的区块链节点,根据查询请求,确定待查询数据的安全等级。In step 702, the blockchain node that receives the query request determines the security level of the data to be queried according to the query request.
在步骤703中,根据待查询数据的安全等级,确定查询策略。In step 703, a query policy is determined according to the security level of the data to be queried.
应理解,步骤702确定待查询数据的安全等级,以及步骤703确定查询策略的实施原理与上述图3所示的实施例相同,在此不再赘述。It should be understood that the step 702 determines the security level of the data to be queried, and the step 703 determines that the implementation principle of the query policy is the same as that of the embodiment shown in FIG. 3, and details are not described herein again.
在步骤704中,区块链节点根据安全等级对应的查询策略,确定响应查询请求的概率。In step 704, the blockchain node determines the probability of responding to the query request according to the query policy corresponding to the security level.
在本公开的一实施例中,响应查询请求的概率和上述表1中查询节点的比例相同,由此,区块链节点可从存储表1所示信息的区块中查询到与不同安全等级对应的响应查询请求的概率。In an embodiment of the present disclosure, the probability of responding to the query request is the same as the ratio of the query nodes in Table 1 above, whereby the blockchain node can query from the block storing the information shown in Table 1 to a different security level. The probability of responding to the query request.
由于安全等级和响应查询请求的概率是相对应的,因此,区块链节点可根据安全等级获得自己需要响应查询请求的概率。在一个实施例中,区块链 节点获得响应查询请求的概率后,即以生成随机数的方法来确定自身是否响应此查询请求。Since the security level and the probability of responding to the query request are corresponding, the blockchain node can obtain the probability that it needs to respond to the query request according to the security level. In one embodiment, the blockchain After the node obtains the probability of responding to the query request, it determines whether it responds to the query request by generating a random number.
例如,若响应查询请求的概率为80%,则随机数可以为1至10之间的任意整数。则可知1,2,3,4,5,6,7,8,9,10这十个数字在随机数组里面出现的概率都是10%。由于响应查询请求的概率为80%,则可设定如果生成的随机数是1或2则不响应查询请求,如果生成的随机数是3至10之间的任一数则响应查询请求。按照此方法,由于每个节点都有80%的概率会返回结果,根据概率论原理,则区块链网络中正常工作的节点中约80%会响应查询请求,而返回查询结果。因为区块链中可能存在一些节点因关机或死机等原因造成无法响应任何请求,因此80%的区块链网络中的节点总数应作为之后判定查询结果是否满足查询成功判定阈值百分比的分母。而响应查询请求的区块链节点返回的查询结果中占比例最高的查询结果的数量则为判定是否满足查询成功判定阈值百分比的分子。For example, if the probability of responding to a query request is 80%, the random number can be any integer between 1 and 10. It can be seen that the probability that the ten digits 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 appear in the random array is 10%. Since the probability of responding to the query request is 80%, it can be set to not respond to the query request if the generated random number is 1 or 2, and respond to the query request if the generated random number is any number between 3 and 10. According to this method, since each node has an 80% probability, the result will be returned. According to the probability theory, about 80% of the nodes working normally in the blockchain network will respond to the query request and return the query result. Because some nodes in the blockchain may not be able to respond to any request due to shutdown or crash, the total number of nodes in the 80% blockchain network should be used as the denominator to determine whether the query result satisfies the percentage of the query success decision threshold. The number of query results that are the highest among the query results returned by the blockchain node in response to the query request is a numerator that determines whether the percentage of the query success determination threshold is satisfied.
应理解,区块链节点还可根据其它的方式,确定是否响应查询请求,例如,若安全等级对应的查询节点比例高于一预设值时,则响应查询请求的方式,本公开实施例对此不作限定。It should be understood that the block chain node may further determine whether to respond to the query request according to other manners, for example, if the proportion of the query node corresponding to the security level is higher than a preset value, in response to the query request manner, the embodiment of the present disclosure is This is not limited.
在步骤705中,响应查询请求的查询节点,返回查询结果给目标区块链节点。In step 705, in response to the query node of the query request, the query result is returned to the target blockchain node.
应理解,查询节点获取查询结果的实施过程和上述图2所示实施例相同,在此不再赘述。It should be understood that the implementation process of the query node to obtain the query result is the same as the embodiment shown in FIG. 2, and details are not described herein again.
在步骤706中,目标区块链节点根据查询节点返回的查询结果,确定候选结果。In step 706, the target blockchain node determines the candidate result according to the query result returned by the query node.
在步骤707中,当候选结果满足预设条件时,将候选结果作为待查询数据对应的查询结果。In step 707, when the candidate result satisfies the preset condition, the candidate result is used as the query result corresponding to the data to be queried.
应理解,步骤706和步骤707和上述图3所示实施例的步骤306和307 的实施过程相同,在此不再赘述。It should be understood that steps 706 and 707 and steps 306 and 307 of the embodiment shown in FIG. 3 above. The implementation process is the same and will not be described here.
当候选结果未满足查询结果判别阈值预设条件时,则重新进行查询。在本公开的一实施例中,重新进行查询时,目标区块链节点重新将查询请求发布到区块链网络中,区块链节点若再次接收到相同的查询请求,则将响应查询请求的概率按照第二预设比例增加,第二预设比例可设置为10%-50%。在一些实施例中,若第一次查询未成功(即候选结果未满足预设条件),则将再次接收到同样的查询请求的区块链节点将响应查询请求的概率提高至100%,即区块链网络中的所有接收到查询请求的节点均响应查询请求When the candidate result does not satisfy the preset condition of the query result discrimination threshold, the query is re-inquired. In an embodiment of the present disclosure, when the query is re-inquired, the target blockchain node re-publishes the query request to the blockchain network, and if the blockchain node receives the same query request again, it will respond to the query request. The probability is increased according to the second preset ratio, and the second preset ratio can be set to be 10%-50%. In some embodiments, if the first query is unsuccessful (ie, the candidate result does not satisfy the preset condition), the blockchain node that receives the same query request again increases the probability of responding to the query request to 100%, ie All nodes in the blockchain network that receive the query request respond to the query request
响应查询请求的查询节点将查询结果返回给目标区块链节点。目标区块链节点根据查询节点返回的查询结果,确定候选结果。The query node responding to the query request returns the query result to the target blockchain node. The target block chain node determines the candidate result according to the query result returned by the query node.
当候选结果满足预设条件时,将候选结果作为待查询数据对应的查询结果。When the candidate result satisfies the preset condition, the candidate result is used as the query result corresponding to the data to be queried.
应理解,确定候选结果是否满足预设条件时,查询成功判定阈值可保持不变,或比例提高,本公开对此不作限和上述图4所示的实施例相同,当进行第二次查询时,候选结果仍未满足预设条件,则第二次查询失败,目标区块链节点发布预警信息到区块链网络中。该预警信息中包括:查询请求中的交易哈希、账户地址或查询关键字。该预警信息用于提示区块链网络中的节点,查询请求所对应的数据出现安全风险。在一个实施例中,若查询端为非区块链网络中的节点设备,则目标区块链节点向查询端发送提示信息,该提示信息用于提示查询结果不可用或查询无效等。It should be understood that, when determining whether the candidate result meets the preset condition, the query success determination threshold may remain unchanged, or the ratio is increased. The disclosure is not limited to the embodiment shown in FIG. 4 above, when performing the second query. If the candidate result still fails to meet the preset condition, the second query fails, and the target block chain node issues the warning information to the blockchain network. The warning information includes: a transaction hash, an account address, or a query keyword in the query request. The warning information is used to prompt the nodes in the blockchain network, and the data corresponding to the query request presents a security risk. In an embodiment, if the query end is a node device in the non-blockchain network, the target block chain node sends a prompt message to the query end, where the prompt information is used to prompt that the query result is unavailable or the query is invalid.
应理解,当第二次查询失败时,还可进行第三次、第四次……查询,查询的次数可根据实际情况进行设置,直到查询次数达到最大查询次数,仍查询失败时,按照图5所示输出预警信息和提示信息。每增加一次查询,可将响应查询请求的概率提高一次。It should be understood that when the second query fails, the third and fourth times of the query may also be performed, and the number of queries may be set according to actual conditions until the number of queries reaches the maximum number of queries, and when the query fails, according to the figure 5 outputs warning information and prompt information. Each additional query increases the probability of responding to a query request by one.
本公开实施例的数据查询方法,根据不同安全等级确定不同的查询策略, 避免了单个节点被攻击、数据被篡改等导致的查询错误;提高查询结果的可信度和正确率,防止区块链数据被篡改带来的查询错误和安全风险;可避免因只通过单个节点进行查询,而该单个节点被攻击或数据被篡改,而使查询到错误信息的可能性;另一方面,也避免了所有的查询请求都采用同一比例查询节点进行查询带来的资源浪费,以及每次查询都通过100%的区块链节点进行查询对所有区块链节点带来的负担,可在保证查询结果可靠性的情况下,降低对区块链并发性造成的负面影响。The data query method of the embodiment of the present disclosure determines different query strategies according to different security levels. It avoids query errors caused by single node being attacked, data being tampered with, etc.; improving the credibility and correct rate of query results, preventing query errors and security risks caused by blockchain data being tampered with; avoiding only by single node Querying, and the single node is attacked or the data is tampered with, making the possibility of querying the error message; on the other hand, it avoids the waste of resources caused by the query of all the query requests using the same proportion of query nodes, and Each query passes the 100% blockchain node to query the burden on all blockchain nodes, which can reduce the negative impact on the concurrency of the blockchain while ensuring the reliability of the query results.
参见图8,本公开实施例还提供一种数据查询装置,应用于区块链网络的区块链节点,该装置包括:Referring to FIG. 8, an embodiment of the present disclosure further provides a data query device, which is applied to a blockchain node of a blockchain network, and the device includes:
安全等级确定模块801,被配置为接收查询请求,确定与所述查询请求对应的待查询数据的安全等级;The security level determining module 801 is configured to receive a query request, and determine a security level of the data to be queried corresponding to the query request;
第一查询节点确定模块802,被配置为根据所述安全等级确定查询节点,所述查询节点为区块链网络中的节点;The first query node determining module 802 is configured to determine a query node according to the security level, where the query node is a node in a blockchain network;
第一查询请求转发模块803,被配置为发送所述查询请求转发给所确定的所述查询节点;The first query request forwarding module 803 is configured to send the query request to the determined query node;
第一查询结果确定模块804,被配置为接收所述查询节点返回的查询结果,如果比例最高的查询结果满足预设条件,将所述比例最高的查询结果作为所述待查询数据对应的查询结果。The first query result determining module 804 is configured to receive the query result returned by the query node. If the query result with the highest ratio meets the preset condition, the query result with the highest ratio is used as the query result corresponding to the data to be queried. .
在一个实施例中,所述安全等级确定模块801,被配置为在存储有所述待查询数据与安全等级的对应关系的区块中,查询所述待查询数据对应的安全等级。In an embodiment, the security level determining module 801 is configured to query a security level corresponding to the to-be-queried data in a block in which the correspondence between the data to be queried and the security level is stored.
在一个实施例中,第一查询结果确定模块804包括:In one embodiment, the first query result determining module 804 includes:
第一候选结果确定子模块,被配置为将所述比例最高的查询结果作为第一候选结果;a first candidate result determining submodule configured to use the highest ranked query result as a first candidate result;
第一查询结果确定子模块,被配置为在返回的查询结果为所述第一候选 结果的查询节点数与查询节点总数的比值大于或等于所述待查询数据对应的查询成功判断阈值时,将所述比例最高的查询结果作为所述待查询数据对应的查询结果。a first query result determining submodule configured to return the query result as the first candidate When the ratio of the number of the query nodes to the total number of the query nodes is greater than or equal to the query success judgment threshold corresponding to the data to be queried, the query result with the highest ratio is used as the query result corresponding to the data to be queried.
在一个实施例中,所述装置800还包括:In one embodiment, the apparatus 800 further includes:
查询节点调整模块805,被配置为当比例最高的查询结果未满足预设条件时,对查询节点的数量进行调整;The query node adjustment module 805 is configured to adjust the number of query nodes when the highest proportion of the query result does not meet the preset condition;
第二查询节点确定模块806,被配置为根据调整后的查询节点数量,确定查询节点;The second query node determining module 806 is configured to determine the query node according to the adjusted number of query nodes;
第二查询请求转发模块807,被配置为将所述查询请求转发给所确定的所述查询节点;以及a second query request forwarding module 807 configured to forward the query request to the determined query node;
第二查询结果确定模块808,被配置为根据查询节点返回的查询结果,确定所述待查询数据对应的查询结果。The second query result determining module 808 is configured to determine a query result corresponding to the to-be-queried data according to the query result returned by the query node.
在一个实施例中,第二查询结果确定模块808包括:In one embodiment, the second query result determining module 808 includes:
第二候选结果确定子模块,被配置为将比例最高的查询结果作为第二候选结果;a second candidate result determining submodule configured to use the highest proportion of the query result as the second candidate result;
预警信息发布子模块,被配置为在返回的查询结果为所述第二候选结果的查询节点数与查询节点总数的比值小于所述待查询数据对应的查询成功判断阈值时,向区块链网络发布预警信息。The early warning information issuance sub-module is configured to, when the returned query result is that the ratio of the number of query nodes of the second candidate result to the total number of query nodes is smaller than the query success judgment threshold corresponding to the to-be-queried data, to the blockchain network Post warning information.
参见图9,本公开实施例还提供一种数据查询装置,应用于区块链网络的区块链节点,该装置900包括:Referring to FIG. 9, an embodiment of the present disclosure further provides a data query apparatus, which is applied to a blockchain node of a blockchain network, and the apparatus 900 includes:
安全等级确定模块901,被配置为根据目标区块链节点发送的查询请求,确定与所述查询请求对应的待查询数据的安全等级;The security level determining module 901 is configured to determine, according to the query request sent by the target blockchain node, a security level of the data to be queried corresponding to the query request;
查询概率确定模块902,被配置为根据所述安全等级确定响应所述查询请求的概率;The query probability determining module 902 is configured to determine a probability of responding to the query request according to the security level;
第一查询结果返回模块903,被配置为在根据所述概率,确定响应所述 查询请求时,返回查询结果给所述目标区块链节点。The first query result returning module 903 is configured to determine the response according to the probability When the request is queried, the query result is returned to the target blockchain node.
在一个实施例中,装置900还包括:In one embodiment, the apparatus 900 further includes:
概率调整模块904,被配置为在重复接收到所述查询请求时,对所述概率进行调整;The probability adjustment module 904 is configured to adjust the probability when the query request is repeatedly received;
第二查询结果返回模块905,被配置为在根据调整后的概率,确定响应所述查询请求时,返回查询结果给所述目标区块链节点The second query result returning module 905 is configured to, when determining to respond to the query request according to the adjusted probability, return a query result to the target blockchain node
在一个实施例中,第一查询结果返回模块903包括:In one embodiment, the first query result return module 903 includes:
第一区块确定子模块,被配置为在所述查询请求中包括交易哈希时,根据所述交易哈希,确定所述待查询数据所在的区块;a first block determining submodule configured to determine, according to the transaction hash, a block in which the data to be queried is located when the transaction hash is included in the query request;
第一查询结果确定子模块,被配置为从确定的区块中获取数据,以及将获取的数据作为查询结果返回给所述目标区块链节点。The first query result determining submodule is configured to acquire data from the determined block and return the acquired data as a query result to the target blockchain node.
在一个实施例中,第一查询结果返回模块903包括:In one embodiment, the first query result return module 903 includes:
交易验证子模块,被配置为在所述查询请求中包括交易哈希时,根据所述交易哈希,对交易哈希对应的交易进行验证;a transaction verification submodule configured to verify a transaction corresponding to the transaction hash according to the transaction hash when the transaction hash is included in the query request;
第二查询结果确定子模块,被配置为将验证结果作为所述查询结果返回给所述目标区块链节点,所述验证结果至少包括:交易是否已被记录到区块中,以及得到的确认区块数。a second query result determining submodule configured to return the verification result as the query result to the target blockchain node, the verification result including at least: whether the transaction has been recorded in the block, and the obtained confirmation The number of blocks.
在一个实施例中,第一查询结果返回模块903包括:In one embodiment, the first query result return module 903 includes:
第二区块确定子模块,被配置为当所述查询请求中包括账户地址时,根据所述账户地址,确定账户地址所对应的区块;a second block determining submodule configured to determine, according to the account address, a block corresponding to the account address when the query request includes an account address;
第三查询结果确定子模块,被配置为从确定的区块中获取数据,以及将获取的数据作为所述查询结果返回给所述目标区块链节点。The third query result determining submodule is configured to acquire data from the determined block and return the acquired data as the query result to the target blockchain node.
在一个实施例中,第一查询结果返回模块903包括:In one embodiment, the first query result return module 903 includes:
第三区块确定子模块,被配置为当所述查询请求中包括查询关键字时,根据所述查询关键字,对区块链进行遍历,获得与关键字相对应的数据;以 及a third block determining submodule configured to: when the query request includes a query keyword, traverse the blockchain according to the query keyword, and obtain data corresponding to the keyword; and
第四查询结果确定子模块,被配置为将与所述关键字相对应的数据作为所述查询结果返回给所述目标区块链节点。The fourth query result determining submodule is configured to return data corresponding to the keyword as the query result to the target blockchain node.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。With regard to the apparatus in the above embodiments, the specific manner in which the respective modules perform the operations has been described in detail in the embodiment relating to the method, and will not be explained in detail herein.
图10是根据一示例性实施例示出的一种用于数据查询方法的装置1000的框图,该装置1000可以是区块链中的节点设备。如图10所示,该装置1000可以包括:处理器1001,存储器1002,多媒体组件1003,输入/输出(I/O)接口1004,以及通信组件1005。FIG. 10 is a block diagram of an apparatus 1000 for a data query method, which may be a node device in a blockchain, according to an exemplary embodiment. As shown in FIG. 10, the apparatus 1000 can include a processor 1001, a memory 1002, a multimedia component 1003, an input/output (I/O) interface 1004, and a communication component 1005.
其中,处理器1001用于控制该装置1000的整体操作,以完成上述的数据查询方法的全部或部分步骤。存储器1002用于存储操作系统,各种类型的数据以支持在该装置1000的操作,这些数据的例如可以包括用于在该装置1000上操作的任何应用程序或方法的指令,以及应用程序相关的数据。该存储器1002可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,例如静态随机存取存储器(Static Random Access Memory,简称SRAM),电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,简称EEPROM),可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,简称EPROM),可编程只读存储器(Programmable Read-Only Memory,简称PROM),只读存储器(Read-Only Memory,简称ROM),磁存储器,快闪存储器,磁盘或光盘。The processor 1001 is configured to control the overall operation of the apparatus 1000 to complete all or part of the steps of the data query method described above. The memory 1002 is for storing operating systems, various types of data to support operations at the device 1000, such as instructions that may include any application or method for operation on the device 1000, and application-related data. The memory 1002 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read only memory ( Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read Only Read-Only Memory (ROM), magnetic memory, flash memory, disk or optical disk.
多媒体组件1003可以包括屏幕和音频组件。其中屏幕例如可以是触摸屏,音频组件用于输出和/或输入音频信号。例如,音频组件可以包括一个麦克风,麦克风用于接收外部音频信号。所接收的音频信号可以被进一步存储在存储器1002或通过通信组件1005发送。音频组件还包括至少一个扬声器,用于输出音频信号。I/O接口1004为处理器1001和其他接口模块之间提供 接口,上述其他接口模块可以是键盘,鼠标,按钮等。这些按钮可以是虚拟按钮或者实体按钮。通信组件1005用于该装置1000与其他设备之间进行有线或无线通信。无线通信,例如Wi-Fi,蓝牙,近场通信(Near Field Communication,简称NFC),2G、3G或4G,或它们中的一种或几种的组合,因此相应的该通信组件1005可以包括:Wi-Fi模块,蓝牙模块,NFC模块。The multimedia component 1003 can include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and/or input an audio signal. For example, the audio component can include a microphone for receiving an external audio signal. The received audio signal may be further stored in memory 1002 or transmitted via communication component 1005. The audio component also includes at least one speaker for outputting an audio signal. I/O interface 1004 provides for communication between processor 1001 and other interface modules Interface, the other interface modules mentioned above may be a keyboard, a mouse, a button, and the like. These buttons can be virtual buttons or physical buttons. Communication component 1005 is used for wired or wireless communication between the device 1000 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 1005 can include: Wi-Fi module, Bluetooth module, NFC module.
在一示例性实施例中,装置1000可以被一个或多个应用专用集成电路(Application Specific Integrated Circuit,简称ASIC)、数字信号处理器(Digital Signal Processor,简称DSP)、数字信号处理设备(Digital Signal Processing Device,简称DSPD)、可编程逻辑器件(Programmable Logic Device,简称PLD)、现场可编程门阵列(Field Programmable Gate Array,简称FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述的数据查询方法。In an exemplary embodiment, the device 1000 may be configured by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), and digital signal processing devices (Digital Signal Processors). Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), controller, microcontroller, microprocessor or other electronic components Used to execute the above data query method.
在另一示例性实施例中,还提供了一种计算机程序产品,所述计算机程序产品包含能够由可编程的装置执行的计算机程序,所述计算机程序具有当由所述可编程的装置执行时用于执行上述的数据查询方法的代码部分。In another exemplary embodiment, there is also provided a computer program product comprising a computer program executable by a programmable device, the computer program having when executed by the programmable device The code portion used to perform the data query method described above.
在另一示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器1002,上述指令可由装置1000的处理器1001执行以完成上述的数据查询方法。示例地,该非临时性计算机可读存储介质可以是ROM、随机存取存储器(Random Access Memory,简称RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In another exemplary embodiment, there is also provided a non-transitory computer readable storage medium comprising instructions, such as a memory 1002 comprising instructions executable by processor 1001 of apparatus 1000 to perform the data query method described above . By way of example, the non-transitory computer readable storage medium can be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.
以上结合附图详细描述了本公开的优选实施方式,但是,本公开并不限于上述实施方式中的具体细节,在本公开的技术构思范围内,可以对本公开的技术方案进行多种简单变型,这些简单变型均属于本公开的保护范围。The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings. However, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications can be made to the technical solutions of the present disclosure within the scope of the technical idea of the present disclosure. These simple variations are all within the scope of the disclosure.
流程图中或在本公开的实施例中以其他方式描述的任何过程或方法描 述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本公开实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本公开的实施例所述技术领域的技术人员所理解。Any process or method described in the flowchart or otherwise in the embodiments of the present disclosure The description may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a particular logical function or process, and the scope of embodiments of the present disclosure includes additional implementations in which The functions are not performed in a substantially simultaneous manner or in the reverse order, depending on the order shown or discussed, which should be understood by those skilled in the art to which the embodiments of the present disclosure.
另外需要说明的是,在上述具体实施方式中所描述的各个具体技术特征,在不矛盾的情况下,可以通过任何合适的方式进行组合。为了避免不必要的重复,本公开对各种可能的组合方式不再另行说明。It should be further noted that the specific technical features described in the above specific embodiments may be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not be further described in various possible combinations.
此外,本公开的各种不同的实施方式之间也可以进行任意组合,只要其不违背本公开的思想,其同样应当视为本公开所公开的内容。 In addition, any combination of various embodiments of the present disclosure may be made as long as it does not deviate from the idea of the present disclosure, and should also be regarded as the disclosure of the present disclosure.

Claims (4)

  1. 一种数据查询方法,其特征在于,应用于区块链网络的区块链节点,所述方法包括:A data query method, characterized by being applied to a blockchain node of a blockchain network, the method comprising:
    接收查询请求,确定与所述查询请求对应的待查询数据的安全等级;Receiving a query request, determining a security level of the data to be queried corresponding to the query request;
    根据所述安全等级确定查询节点,所述查询节点为区块链网络中的节点;Determining a query node according to the security level, where the query node is a node in a blockchain network;
    发送所述查询请求给所确定的所述查询节点;Sending the query request to the determined query node;
    接收所述查询节点返回的查询结果,如果比例最高的查询结果满足预设条件,将所述比例最高的查询结果作为所述待查询数据对应的查询结果。Receiving the query result returned by the query node, if the query result with the highest ratio meets the preset condition, the query result with the highest ratio is used as the query result corresponding to the data to be queried.
  2. 根据权利要求1所述的方法,其特征在于,接收查询请求,确定与所述查询请求对应的待查询数据的安全等级的步骤包括:The method according to claim 1, wherein the step of receiving a query request and determining a security level of the data to be queried corresponding to the query request comprises:
    在存储有所述待查询数据与安全等级的对应关系的区块中,查询所述待查询数据对应的安全等级。The security level corresponding to the to-be-queried data is queried in the block in which the correspondence between the data to be queried and the security level is stored.
  3. 根据权利要求1所述的方法,其特征在于,如果比例最高的查询结果满足预设条件,将所述比例最高的查询结果作为所述待查询数据对应的查询结果的步骤包括:The method according to claim 1, wherein the step of using the highest proportion of the query result as the query result corresponding to the to-be-queried data comprises:
    将所述比例最高的查询结果作为第一候选结果;Taking the highest-ranking query result as the first candidate result;
    当返回的查询结果为所述第一候选结果的查询节点数与查询节点总数的比值大于或等于所述待查询数据对应的查询成功判断阈值时,将所述比例最高的查询结果作为所述待查询数据对应的查询结果。When the returned query result is that the ratio of the number of the query nodes of the first candidate result to the total number of query nodes is greater than or equal to the query success judgment threshold corresponding to the data to be queried, the query result with the highest ratio is taken as the Query the query result corresponding to the data.
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 further comprising:
    当比例最高的查询结果未满足预设条件时,对查询节点的数量进行调整;When the query result with the highest ratio does not meet the preset condition, the number of query nodes is adjusted;
    根据调整后的查询节点数量,确定查询节点; Determining a query node according to the adjusted number of query nodes;
PCT/CN2016/113758 2016-12-30 2016-12-30 Data query method, device and node apparatus WO2018120129A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2016/113758 WO2018120129A1 (en) 2016-12-30 2016-12-30 Data query method, device and node apparatus
CN201680002915.3A CN106716421B (en) 2016-12-30 2016-12-30 Data query method and device and node equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/113758 WO2018120129A1 (en) 2016-12-30 2016-12-30 Data query method, device and node apparatus

Publications (1)

Publication Number Publication Date
WO2018120129A1 true WO2018120129A1 (en) 2018-07-05

Family

ID=58906742

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/113758 WO2018120129A1 (en) 2016-12-30 2016-12-30 Data query method, device and node apparatus

Country Status (2)

Country Link
CN (1) CN106716421B (en)
WO (1) WO2018120129A1 (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109118220A (en) * 2018-08-03 2019-01-01 上海点融信息科技有限责任公司 For handling the method, apparatus and storage medium of affairs in distributed network
CN110209675A (en) * 2019-06-18 2019-09-06 北京艾摩瑞策科技有限公司 Credit data querying method and its device on block chain
CN111506930A (en) * 2020-04-21 2020-08-07 广州上云区块链科技有限公司 E-commerce transaction information management system and method based on block chain
EP3734535A4 (en) * 2018-08-21 2021-01-06 Alibaba Group Holding Limited Method and apparatus for identifying authenticity of evidence of both parties based on blockchain evidence preservation
EP3779692A4 (en) * 2018-08-01 2021-09-08 Advanced New Technologies Co., Ltd. Data processing method and device, client, and server
CN115062347A (en) * 2022-08-17 2022-09-16 四川新网银行股份有限公司 Data privacy safety sharing method and system for guaranteeing data value accuracy
US11551319B2 (en) 2018-08-21 2023-01-10 Advanced New Technologies Co., Ltd. Method and apparatus for determining evidence authenticity based on blockchain ledger
US11757884B2 (en) 2018-05-29 2023-09-12 Siemens Aktiengesellschaft Method and system for controlling the release of a resource

Families Citing this family (34)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018214165A1 (en) * 2017-05-26 2018-11-29 深圳前海达闼云端智能科技有限公司 Communication method, apparatus, and system, electronic device, and computer readable storage medium
CN107203343B (en) * 2017-05-26 2019-10-08 国信优易数据有限公司 A kind of date storage method, system and equipment
CN109218348B (en) * 2017-06-29 2020-12-01 华为技术有限公司 Method for determining blocks in block chain and node equipment
CN107634849A (en) * 2017-08-08 2018-01-26 广东网金控股股份有限公司 A kind of global block chain link border construction method
CN108197498A (en) * 2017-12-22 2018-06-22 中国联合网络通信集团有限公司 Obtain the method and device of data
CN108170783A (en) * 2017-12-26 2018-06-15 北京比特大陆科技有限公司 Data capture method, device and electronic equipment
CN108304491B (en) * 2018-01-09 2021-05-11 比特大陆科技有限公司 Data query method and device and electronic equipment
CN108717443B (en) * 2018-05-17 2020-06-05 京东数字科技控股有限公司 Data sharing method, block chain system and computer readable storage medium
CN108768672B (en) * 2018-05-31 2021-10-08 中国联合网络通信集团有限公司 Data processing method, device and storage medium
CN108712506B (en) * 2018-05-31 2021-02-02 中国联合网络通信集团有限公司 Block chain node communication method and device and block chain node
CN108768733B (en) * 2018-05-31 2021-06-29 中国联合网络通信集团有限公司 Block chain account book processing method and device and block chain link points
CN108810186B (en) * 2018-05-31 2021-05-18 中国联合网络通信集团有限公司 Block chain node communication method and device and block chain node
CN108777712B (en) * 2018-05-31 2020-04-07 中国联合网络通信集团有限公司 Block chain node communication method and device and block chain node
CN109034832A (en) * 2018-06-13 2018-12-18 湖南搜云网络科技股份有限公司 The information processing method and device of block chain, information processing node and storage medium
CN108959457B (en) * 2018-06-15 2020-11-13 北京文创园投资管理有限公司 Method and system for inquiring and verifying certificate
CN109101577A (en) * 2018-07-19 2018-12-28 清华大学 A kind of data circulation method, apparatus and system
CN109033403B (en) * 2018-08-03 2020-05-12 上海点融信息科技有限责任公司 Method, apparatus and storage medium for searching blockchain data
CN109274837B (en) * 2018-08-22 2020-04-03 北京航空航天大学 Telephone source traceable method and device based on block chain technology
CN109376172B (en) * 2018-09-27 2020-09-29 精硕科技(北京)股份有限公司 Data acquisition method and system based on block chain
CN109522462B (en) * 2018-10-18 2021-06-04 上海达家迎信息科技有限公司 Cloud query method, device, equipment and storage medium based on block chain
CN109450996A (en) * 2018-10-25 2019-03-08 国信优易数据有限公司 A kind of data cochain management method, device, equipment and block catenary system
CN109559136B (en) * 2018-11-28 2021-03-09 中国医学科学院药用植物研究所 Information management system and method
CN109819443B (en) * 2018-12-29 2021-09-21 东莞见达信息技术有限公司 Registration authentication method, device and system based on block chain
CN110008181A (en) * 2019-04-08 2019-07-12 深圳市网心科技有限公司 File polling method and device, computer installation and storage medium
CN110348937A (en) * 2019-05-24 2019-10-18 深圳壹账通智能科技有限公司 Data managing method, device, medium and electronic equipment based on block chain
CN110210209A (en) * 2019-06-06 2019-09-06 中星技术股份有限公司 The method and apparatus for managing picture pick-up device
CN110554047B (en) * 2019-09-06 2021-07-02 腾讯科技(深圳)有限公司 Method, device, system and equipment for processing product defect detection data
CN110597826A (en) * 2019-09-24 2019-12-20 腾讯科技(深圳)有限公司 Data isolation method and device based on block chain network
CN110752969B (en) * 2019-10-21 2021-03-16 腾讯科技(深圳)有限公司 Performance detection method, device, equipment and medium
CN111400752A (en) * 2020-03-12 2020-07-10 杭州城市大数据运营有限公司 Data query method and system based on block chain and electronic equipment
CN111586068B (en) * 2020-05-14 2021-05-04 上海简苏网络科技有限公司 Method and system for solving DPOS consensus node rights and interests potential safety hazard
CN111666554B (en) * 2020-06-03 2023-09-12 泰康保险集团股份有限公司 Certificate authentication method, device, equipment and storage medium
KR102603880B1 (en) * 2021-01-08 2023-11-20 한국전자통신연구원 Method for block consensus and method for managing transaction state
CN116578586B (en) * 2023-05-06 2023-11-17 重庆翰海睿智大数据科技股份有限公司 Dynamic data query system based on big data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853986A (en) * 2014-01-03 2014-06-11 李凤华 Access control method and device
CN105976232A (en) * 2016-06-24 2016-09-28 深圳前海微众银行股份有限公司 Asset transaction method and device
CN106055597A (en) * 2016-05-24 2016-10-26 布比(北京)网络技术有限公司 Digital transaction system, and account information query method therefor
US20160321654A1 (en) * 2011-04-29 2016-11-03 Stephen Lesavich Method and system for storage and retrieval of blockchain blocks using galois fields
CN106100981A (en) * 2016-08-22 2016-11-09 布比(北京)网络技术有限公司 Social network data exchange method and device
CN106227833A (en) * 2016-07-26 2016-12-14 宁圣金融信息服务(上海)有限公司 Block chaining search engine method, system and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102487397B (en) * 2010-12-02 2016-08-10 山东智慧生活数据系统有限公司 Data based on node underlying security grade storage and method for routing and node
US20160342977A1 (en) * 2015-05-20 2016-11-24 Vennd.io Pty Ltd Device, method and system for virtual asset transactions

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160321654A1 (en) * 2011-04-29 2016-11-03 Stephen Lesavich Method and system for storage and retrieval of blockchain blocks using galois fields
CN103853986A (en) * 2014-01-03 2014-06-11 李凤华 Access control method and device
CN106055597A (en) * 2016-05-24 2016-10-26 布比(北京)网络技术有限公司 Digital transaction system, and account information query method therefor
CN105976232A (en) * 2016-06-24 2016-09-28 深圳前海微众银行股份有限公司 Asset transaction method and device
CN106227833A (en) * 2016-07-26 2016-12-14 宁圣金融信息服务(上海)有限公司 Block chaining search engine method, system and device
CN106100981A (en) * 2016-08-22 2016-11-09 布比(北京)网络技术有限公司 Social network data exchange method and device

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11757884B2 (en) 2018-05-29 2023-09-12 Siemens Aktiengesellschaft Method and system for controlling the release of a resource
EP3779692A4 (en) * 2018-08-01 2021-09-08 Advanced New Technologies Co., Ltd. Data processing method and device, client, and server
US11563805B2 (en) 2018-08-01 2023-01-24 Advanced New Technologies Co., Ltd. Method, apparatus, client terminal, and server for data processing
CN109118220A (en) * 2018-08-03 2019-01-01 上海点融信息科技有限责任公司 For handling the method, apparatus and storage medium of affairs in distributed network
EP3734535A4 (en) * 2018-08-21 2021-01-06 Alibaba Group Holding Limited Method and apparatus for identifying authenticity of evidence of both parties based on blockchain evidence preservation
US11551319B2 (en) 2018-08-21 2023-01-10 Advanced New Technologies Co., Ltd. Method and apparatus for determining evidence authenticity based on blockchain ledger
CN110209675A (en) * 2019-06-18 2019-09-06 北京艾摩瑞策科技有限公司 Credit data querying method and its device on block chain
CN111506930A (en) * 2020-04-21 2020-08-07 广州上云区块链科技有限公司 E-commerce transaction information management system and method based on block chain
CN111506930B (en) * 2020-04-21 2023-07-18 广州上云区块链科技有限公司 E-commerce transaction information management system and method based on blockchain
CN115062347A (en) * 2022-08-17 2022-09-16 四川新网银行股份有限公司 Data privacy safety sharing method and system for guaranteeing data value accuracy
CN115062347B (en) * 2022-08-17 2022-11-04 四川新网银行股份有限公司 Data privacy security sharing method and system for guaranteeing data value accuracy

Also Published As

Publication number Publication date
CN106716421B (en) 2020-03-31
CN106716421A (en) 2017-05-24

Similar Documents

Publication Publication Date Title
WO2018120129A1 (en) Data query method, device and node apparatus
US11558177B2 (en) Block chain permission control method, device, and node apparatus
JP6859506B2 (en) Digital certificate management methods, devices, and systems
CN110494877B (en) System and method for issuing and tracking digital tokens within distributed network nodes
CN110494876B (en) System and method for issuing and tracking digital tokens within distributed network nodes
WO2018090331A1 (en) Blockchain network, article transaction method and apparatus, and node device
US11823178B2 (en) Optimization of high volume transaction performance on a blockchain
US20210083856A1 (en) Improved hardware security module management
US20200074470A1 (en) Database configuration for asset transfers
TW201822033A (en) Resource processing method and apparatus
US20220382746A1 (en) Blockchain notification board storing blockchain resources
US20220138212A1 (en) Blockchain implementing reliability database
US11669532B2 (en) Blockchain implementing reliability database
US20200110813A1 (en) Blockchain implementing reliability database
TWI706362B (en) Data processing method, device and server based on blockchain
US11489662B2 (en) Special relationships in a blockchain
EP3864816A1 (en) Blockchain notification board storing blockchain resources
CN111414373A (en) Consensus method and consensus system
TWI700606B (en) Method, device and computer equipment for identifying authenticity of evidence based on blockchain deposit
WO2020155811A1 (en) Block chain intelligent contract execution method, device and electronic apparatus
US11734069B2 (en) Systems and methods for maintaining pooled time-dependent resources in a multilateral distributed register
TW202009856A (en) Method and apparatus for identifying authenticity of evidence of both parties based on blockchain evidence preservation
WO2020227984A1 (en) Parallel multi-blocks creation scheme for blockchain
TW202018644A (en) Blockchain-based data processing method and apparatus, and server
JP2022525551A (en) Preventing erroneous transmission of copies of data records to distributed ledger systems

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16925780

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 30/10/2019)

122 Ep: pct application non-entry in european phase

Ref document number: 16925780

Country of ref document: EP

Kind code of ref document: A1