Blockchain data retrieval method and apparatus, electronic device, and storage medium

By using a pre-set search engine and smart contracts to manage access permissions in the blockchain, the problems of low efficiency and security in blockchain retrieval are solved, achieving fast and efficient data retrieval and security assurance.

CN114661788BActive Publication Date: 2026-01-13CHINA TELECOM CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210289278.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-22
Publication Date
2026-01-13
Estimated Expiration
2042-03-22

AI Technical Summary

Technical Problem

Existing blockchain retrieval technologies are inefficient, unable to directly retrieve data based on content, and lack access control, posing a risk of data leakage.

Method used

By establishing a data index through a pre-set search engine, querying target transaction hashes using target keywords, and managing access permissions through blockchain smart contracts, fast and efficient data retrieval and security are achieved.

Benefits of technology

It enables rapid retrieval of blockchain data based on data content, improving retrieval efficiency, and prevents data leakage through access control, thereby enhancing the security of data retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114661788B_ABST
    Figure CN114661788B_ABST
Patent Text Reader

Abstract

The present disclosure provides a blockchain data retrieval method and device, electronic equipment and storage medium, and relates to the technical field of blockchain. The method comprises: receiving a retrieval request sent by a data retrieval user, wherein the retrieval request is used for retrieving target data from a blockchain, and the retrieval request comprises a target keyword of the target data; querying a target transaction hash corresponding to the target keyword based on a preset search engine, wherein the preset search engine stores a mapping relationship between the target keyword and the target transaction hash; retrieving the target data from the blockchain according to the target transaction hash; and judging whether the data retrieval user has access authority of the target data, and returning the target data if yes. The present disclosure overcomes the technical problems in the related art that the blockchain data cannot be retrieved according to the content and lacks permission management, and improves the security and retrieval efficiency of data retrieval in the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of blockchain technology, and in particular to a blockchain data retrieval method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the rapid development of blockchain technology, the number of blockchain users is growing rapidly, and at the same time, more and more valuable data is being stored on the blockchain. Because the amount of data stored on the blockchain is enormous, users' need for efficient data retrieval on the blockchain is becoming increasingly urgent.

[0003] However, current blockchain retrieval technology cannot directly retrieve data from the blockchain based on content. When a user wants to retrieve data containing a certain keyword, they can only query a large amount of transaction content based on transaction hash or block hash, and then iterate through all transaction content to match a certain keyword to obtain the query result, or directly iterate through all block data to query and match to obtain the query result. However, both of the above methods are inefficient and cannot meet the needs of efficient data retrieval.

[0004] Furthermore, current blockchain retrieval technologies cannot establish corresponding permission relationships between users and data, thus posing a security risk of data leakage.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] This disclosure provides a blockchain data retrieval method, apparatus, electronic device, and storage medium, which at least to some extent overcomes the problems in related technologies where blockchain data cannot be retrieved based on data content and where there is a lack of permission management during the retrieval process.

[0007] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0008] According to one aspect of this disclosure, a blockchain data retrieval method is provided, comprising:

[0009] Receive a search request sent by a data retrieval user, wherein the search request is used to retrieve target data from the blockchain, and the search request includes target keywords of the target data;

[0010] Based on a preset search engine, the target transaction hash corresponding to the target keyword is queried, wherein the preset search engine stores the mapping relationship between the target keyword and the target transaction hash;

[0011] Retrieve the target data from the blockchain based on the target transaction hash;

[0012] Determine whether the data retrieval user has access to the target data; if so, return the target data.

[0013] In one embodiment of this disclosure, the blockchain includes a contract ledger, and determining whether the data retrieval user has access rights to the target data specifically includes:

[0014] Obtain a data digest of the target data;

[0015] Based on the data summary, the permission information of the target data is queried from the contract ledger, wherein the permission information is used to determine whether the data retrieval user has permission to access the target data;

[0016] Based on the permission information, it is determined whether the data retrieval user has access rights to the target data.

[0017] In one embodiment of this disclosure, the access permissions for the target data include a first access permission, a second access permission, and a third access permission;

[0018] The first access permission is used to grant the user multiple accesses to the target data and to configure access permissions for the target data;

[0019] The second access permission is used to grant the user multiple accesses to the target data;

[0020] The third access permission is used to grant a user a single access to the target data.

[0021] In one embodiment of this disclosure, the method further includes:

[0022] Receive a permission configuration request for the target data, wherein the permission configuration request is sent by a user with first access permission to the target data;

[0023] In response to the permission configuration request, access permissions for the target data are configured for the data retrieval user.

[0024] In one embodiment of this disclosure, the method further includes:

[0025] When the data retrieval user has third access rights to the target data, the third access rights of the data retrieval user are removed after the target data is returned.

[0026] In one embodiment of this disclosure, before querying the target transaction hash corresponding to the target keyword based on a preset search engine, the method further includes:

[0027] Receive data uploaded by users to be retrieved;

[0028] After the blockchain completes the on-chain operation of the data to be retrieved, it stores the data to be retrieved and the corresponding transaction hash to be retrieved in the preset search engine.

[0029] The preset search engine is used to decompose the data to be retrieved into keywords to be retrieved, and a mapping relationship is established between the keywords to be retrieved and the transaction hash to be retrieved.

[0030] The keywords to be searched include target keywords, and the transaction hash to be searched includes target transaction hashes.

[0031] In one embodiment of this disclosure, the step of querying the target transaction hash corresponding to the target keyword based on a preset search engine specifically includes:

[0032] Using a preset search engine, search for the target keywords among the keywords to be searched;

[0033] Based on the mapping relationship between the keyword to be searched and the transaction hash to be searched, the target transaction hash corresponding to the target keyword is obtained.

[0034] In one embodiment of this disclosure, the preset search engine includes an Elasticsearch-based search engine.

[0035] According to another aspect of this disclosure, a blockchain data retrieval device is provided, comprising:

[0036] The retrieval request receiving module is used to receive retrieval requests sent by data retrieval users, wherein the retrieval request is used to retrieve target data from the blockchain, and the retrieval request includes target keywords of the target data;

[0037] The transaction hash query module is used to query the target transaction hash corresponding to the target keyword based on a preset search engine, wherein the preset search engine stores the mapping relationship between the target keyword and the target transaction hash;

[0038] The target data retrieval module is used to retrieve the target data from the blockchain based on the target transaction hash.

[0039] The user permission determination module is used to determine whether the user retrieving the data has access permission to the target data. If so, the target data is returned.

[0040] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0041] Processor; and

[0042] A memory for storing executable instructions of the processor; wherein the processor is configured to execute the aforementioned blockchain data retrieval method by executing the executable instructions.

[0043] According to another aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the blockchain data retrieval method described above.

[0044] The blockchain data retrieval method, apparatus, electronic device, and storage medium provided in the embodiments of this disclosure can retrieve data in the blockchain based on keywords of the data content by pre-establishing a data index using a search engine. This allows for quick and efficient retrieval of the transaction hash corresponding to the blockchain transaction containing the target data. Subsequently, the data is precisely searched using the transaction hash. After data permission confirmation, if the user has access to the target data, the retrieved data results are returned, greatly improving the security and efficiency of data retrieval.

[0045] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0046] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0047] Figure 1 This diagram illustrates a blockchain data retrieval method in related technologies.

[0048] Figure 2 This diagram illustrates a blockchain data retrieval method according to an embodiment of the present disclosure.

[0049] Figure 3 This diagram illustrates a flowchart of a blockchain data retrieval method according to an embodiment of the present disclosure;

[0050] Figure 4 This diagram illustrates a blockchain data storage method according to an embodiment of the present disclosure.

[0051] Figure 5This diagram illustrates a blockchain data access control method according to an embodiment of the present disclosure.

[0052] Figure 6 This illustration shows a flowchart of a blockchain data storage method according to an embodiment of the present disclosure;

[0053] Figure 7 This diagram illustrates yet another blockchain data retrieval method according to an embodiment of the present disclosure.

[0054] Figure 8 This diagram illustrates a blockchain data retrieval device according to an embodiment of the present disclosure.

[0055] Figure 9 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation

[0056] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0057] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0058] To facilitate understanding, the following explanations are provided for several terms used in this disclosure:

[0059] In essence, blockchain is a shared database. In a blockchain system, transaction data generated by each participating entity is packaged into a data block at regular intervals. The data blocks are arranged sequentially according to time to form a chain of data blocks. Each participating entity has the same data chain and cannot unilaterally tamper with it. Any modification to information can only be made with the consent of an agreed proportion of the entities, and only new information can be added. Old information cannot be deleted or modified, thereby realizing information sharing and consistent decision-making among multiple entities and ensuring the immutability, openness, and transparency of the identities of each entity and the transaction information between entities.

[0060] A smart contract is a computer protocol designed to disseminate, verify, or execute contracts in an informational manner. Smart contracts allow for trusted transactions without a third party; these transactions are traceable and irreversible. The purpose of smart contracts is to provide a security method superior to traditional contracts and reduce other transaction costs associated with contracts. A blockchain smart contract is simply code written on the blockchain; once an event triggers a clause in the contract, the code executes automatically. In other words, it executes when the conditions are met, without human intervention. The access control functionality in this disclosure is implemented through the automatic triggering of the designed smart contract.

[0061] A full-text search engine retrieves relevant records that match the user's query criteria from a database and then returns the results to the user in a specific order. Common full-text search engines include Elasticsearch, Solr, and Lucene.

[0062] The following section will further explain the problems existing in the relevant technologies, in conjunction with the aforementioned background technology.

[0063] Figure 1 A schematic diagram of a blockchain data retrieval method in related technologies is shown, such as... Figure 1 As shown, related technologies query data in the blockchain mainly rely on transaction hashes or block hashes to query a large number of transaction contents. Although a transaction hash corresponds to only one transaction data, users often find it difficult to determine the specific transaction hash of the transaction data. On the other hand, a block hash corresponds to all the transaction data information in a block. Therefore, after querying by block hash, users still need to traverse all the transaction data to match it with a certain keyword to obtain the query result.

[0064] Applying the above methods, with a massive amount of data, it often takes a long time to retrieve data from each block in the blockchain. As the data in the blockchain increases and is updated, the number of blocks in the blockchain will also increase, making the data retrieval process more complicated and the retrieval time longer and longer.

[0065] Furthermore, because indexes cannot be created in the blockchain, traditional search engine methods cannot be used to quickly retrieve data within it. Moreover, the process of traversing data in the blockchain can only be done sequentially, requiring reading from the beginning of the block data backwards, resulting in extremely high retrieval costs when performing multiple searches.

[0066] Furthermore, during the blockchain data retrieval process, the relevant technologies cannot control user access permissions, which can easily lead to the risk of data leakage in the blockchain.

[0067] Figure 2 A schematic diagram of a blockchain data retrieval method in an embodiment of this disclosure is shown, such as... Figure 2 As shown, to solve the aforementioned technical problems, the blockchain data retrieval method provided in this disclosure can, upon receiving a target data retrieval request from a data retrieval user including target keywords, query the target transaction hash corresponding to the target keywords based on a preset search engine, and then retrieve the target data from the blockchain based on the target transaction hash. If the data retrieval user does not have access rights to the target data, the target data is returned. The preset search engine stores the mapping relationship between target keywords and target transaction hashes.

[0068] Based on the blockchain data retrieval method provided in this disclosure, a retrieval method combining blockchain and search engine was designed, realizing the function of quickly retrieving blockchain data through data content. Target data can be retrieved directly from the blockchain based on keywords entered by the user.

[0069] On the other hand, this disclosure establishes data ownership and manages data ownership in a decentralized manner within blockchain smart contracts, while also redesigning the contract ledger structure to ensure data security. Before returning search results, the contract ledger pre-determines the user's access permissions to the target data, thereby avoiding the security risks of data leakage.

[0070] The solution provided in this disclosure relates to blockchain data retrieval technology. The following will describe the exemplary implementation method in detail with reference to the accompanying drawings and embodiments.

[0071] First, this disclosure provides a blockchain data retrieval method, which can be executed by any electronic device with computing power.

[0072] Figure 3 This invention discloses a flowchart of a blockchain data retrieval method according to an embodiment of the present invention, as shown below. Figure 3 As shown, the blockchain data retrieval method provided in this embodiment includes the following steps:

[0073] S302, Receive a search request sent by a data retrieval user, wherein the search request is used to retrieve target data from the blockchain, and the search request includes target keywords of the target data.

[0074] It should be noted that a data retrieval user can be any user requesting access to the target data, such as the user who uploaded the data or a visitor user unrelated to the data. A data retrieval user does not necessarily have access rights to the data in the blockchain.

[0075] Furthermore, the target data can be the data that the data retrieval user expects to obtain from the blockchain. It should be understood that the target data can be the data content itself in the blockchain, or it can be transaction information and storage information generated during the transaction process in the blockchain, such as data summary, data submission time, data update time, etc. Any data stored in the blockchain can be used as target data.

[0076] Furthermore, target keywords can be words related to the target data mentioned above. Specifically, target keywords can be phrases obtained after segmenting the target data, or synonyms or near-synonyms of these phrases. Target keywords can be words with the same semantics as some content in the target data. Target keywords are used to enable search engines to identify and match the target data.

[0077] It is worth noting that target keywords can also be obtained by segmenting the search content. For example, when the search request contains the search content "the bright moon rises over the sea", the search engine can automatically decompose it into target keywords after receiving the search content. For example, the aforementioned search content can be decomposed into three keywords: "over the sea", "rises", and "bright moon".

[0078] In some embodiments, a search engine can be preset on the server to directly receive search requests sent by data retrieval users.

[0079] In other embodiments, a blockchain system or other system capable of connecting to a preset search engine may receive the search request sent by the data retrieval user and then forward the search request to the preset search engine.

[0080] S304. Based on the preset search engine, query the target transaction hash corresponding to the target keyword. The preset search engine stores the mapping relationship between the target keyword and the target transaction hash.

[0081] It should be noted that a transaction hash (Txhash) is a unique and immutable transaction identifier for every blockchain transaction. All information related to a transaction can be found through the transaction hash.

[0082] Furthermore, the target transaction hash is a unique identifier generated when the target data is traded on the blockchain. All information related to the target data transaction can be retrieved in the blockchain through the target transaction hash.

[0083] In some embodiments, the preset search engine can be a full-text search engine. Specifically, it can be an Elasticsearch-based search engine, or a Solr- or Lucene-based search engine. It should be understood that any search engine with data storage, word segmentation, and indexing functions can be used in this disclosure, and the embodiments of this disclosure do not limit this.

[0084] It should be noted that the word segmentation methods involved in the embodiments of this disclosure are all preset functions of the search engine. This disclosure does not involve any additions or improvements to the search engine functions in the related technologies, so it will not be elaborated further.

[0085] Figure 4 The diagram illustrates the blockchain data storage method disclosed herein. Users send data to be retrieved to the blockchain in the form of transactions. The blockchain processes the transactions and saves the data. After the blockchain completes the uploading of the data to be retrieved, it combines the uploaded data to be retrieved and its corresponding transaction hash into a data packet and sends the data packet to a preset search engine for storage. The preset search engine has a word segmentation mechanism. After receiving the sent data packet, it can decompose the data to be retrieved into several keywords for retrieval.

[0086] It should be noted that the data to be retrieved can be understood as the data set within the search scope requested by the user, and the keywords to be retrieved are used to match the target keywords. Since the above data package contains the data to be retrieved and its corresponding transaction hash, it should be understood that after the data to be retrieved is decomposed into keywords to be retrieved, the keywords to be retrieved still maintain a correspondence with the transaction hash.

[0087] In some embodiments, the target data exists in the data to be retrieved. In this case, based on the correspondence between the keywords to be retrieved and the transaction hashes, at least one target transaction hash corresponding to the target keyword can be obtained.

[0088] S306, retrieve target data from the blockchain based on the target transaction hash.

[0089] Since transaction hashes have an immutable and unique correspondence with blockchain transactions, once the target transaction hash corresponding to the target data is determined, the unique blockchain transaction data can be determined based on the target transaction hash, thereby obtaining the target data.

[0090] When the target keyword is vague and the search scope is too large, there may be multiple data containing the target keyword in the blockchain, and the target transaction hashes found by S304 may also be multiple. In this case, the scope of the target data can be narrowed through secondary search, or the data corresponding to multiple target transaction hashes can be directly queried, and the user can judge the results.

[0091] In some embodiments, after the target transaction hash of the target data is retrieved, the target transaction hash can be returned to the data query user. The data query user can choose to query all or part of the blockchain transaction data corresponding to the target transaction, or re-retrieve until a unique transaction hash is found.

[0092] In other embodiments, after the target transaction hash of the target data is found, all corresponding transaction data can be queried in the blockchain based on all target transaction hashes. Since the target data has been narrowed down to a certain range based on the target keywords through the query in S304, all returned results are related to the target data that the user expects to obtain, that is, they contain some of the same or similar content as the target data. At this time, the user can select the target data that he expects to obtain from the returned results according to the actual needs.

[0093] S308: Determine whether the data retrieval user has access rights to the target data. If so, return the target data.

[0094] Specifically, Figure 5 This diagram illustrates a blockchain data access control method according to an embodiment of the present disclosure. Figure 5 As shown, after retrieving the target data in the blockchain, the data digest of the target data is first obtained (e.g., calculated using SHA256). Then, based on the data digest, the permission information of the target data can be queried from the contract ledger. The permission information is used to determine whether the data retrieval user has permission to access the target data.

[0095] In some embodiments, access permissions to the target data may include a first access permission, a second access permission, and a third access permission, wherein the first access permission is ownership, which may permit the user to access the target data multiple times and to configure access permissions to the target data; the second access permission is usage right, which may permit the user to access the target data multiple times; and the third access permission is borrowing right, which may permit the user to access the target data once.

[0096] Specifically, when it is determined that a data retrieval user has ownership or usage rights to the target data, the data retrieval user can use the target data; when it is determined that a data retrieval user has the right to borrow the target data, the borrowing right is revoked after the data retrieval user uses the target data once.

[0097] In some embodiments, the user who uploads the data can be assumed to be the owner of the data. The owner can grant other users in the blockchain the right to use or borrow the data. Of course, ownership of the data can be relinquished or transferred, and this disclosure does not limit this.

[0098] In some embodiments, the permission information for the target data is stored in the contract ledger in the form of a user list.

[0099] Table 1 Contract Ledger Structure

[0100] Contract ledger structure DataHash (Data Digest) Owner User Borrower UpdateTime CommitTime function authentication()(authentication method) function grantAuthorization()(ownership authorization method) function borrowAuthentication()(ownership borrowing method)

[0101] As shown in Table 1, the contract ledger of this embodiment includes the following attribute information:

[0102] Data summary: The result of hashing the data using a hash algorithm (such as SHA256), used to match the contract ledger information corresponding to the data.

[0103] Owner: The user who owns the data. For example, the user who uploaded the data can be assumed to own it. Ownership of data can also be transferred between users.

[0104] User: The user who has the right to use the data, such as a user who has been authorized by the user who owns the data.

[0105] Borrower: The user who has the right to borrow the data, such as a user who has been authorized by the user who owns the data to borrow it.

[0106] Update time: Contract ledger update time.

[0107] Submission time: The time when the contract ledger was created.

[0108] It is worth noting that three new methods have been added to the contract ledger: authentication method, ownership authorization method, and ownership borrowing method, which can respectively realize the authentication, authorization, and borrowing of ownership.

[0109] Specifically, authentication methods are used to determine whether a user has access to the data.

[0110] Ownership authorization methods are used to grant users the right to use data. This can be done by adding a user to the user list of a data contract ledger, or by deleting a user from the user list of a data contract ledger to remove the user's right to use the data.

[0111] The ownership borrowing method is used to grant users the right to borrow data. This can be done by adding a user to the borrower list of a data contract ledger to grant the user the right to borrow the data, or by deleting a user from the borrower list of a data contract ledger to remove the user's right to borrow the data.

[0112] In some embodiments, when target data is queried in the blockchain, the corresponding contract ledger is first queried based on the data summary of the target data, and the authentication method in the contract ledger is automatically triggered to determine whether the user has access to the target data, that is, whether the user appears in the list of owners, users or borrowers recorded in the contract ledger.

[0113] In other embodiments, when the contract ledger receives a permission configuration request from a user who owns certain data, it can call the ownership authorization method or ownership borrowing method, depending on whether the request is for authorization or borrowing, to add or remove the right to use or borrow the data for the specified user included in the permission configuration request.

[0114] Based on the characteristics of smart contracts in cross-chain blockchains, this disclosure presents an embodiment of a blockchain data ownership contract ledger structure, and further proposes an ownership management method based on smart contracts, thereby realizing ownership management in a decentralized manner.

[0115] Based on the same inventive concept Figure 6 This illustration shows a flowchart of a blockchain data storage method according to an embodiment of the present disclosure. Based on the above embodiments, this embodiment solves the technical problem of the inability to integrate blockchain with search engines, thereby enabling blockchain data to be efficiently retrieved by calling external search engines. This method can... Figure 3 The process is executed prior to S304 in the blockchain data retrieval method shown.

[0116] like Figure 6 As shown, the blockchain data storage method includes the following steps:

[0117] S602, Receive data uploaded by the user to be retrieved.

[0118] S604: After the blockchain completes the on-chain operation of the data to be retrieved, it stores the data to be retrieved and the corresponding transaction hash to be retrieved in the preset search engine.

[0119] S606 uses a preset search engine to decompose the data to be retrieved into keywords to be retrieved, and establishes a mapping relationship between the keywords to be retrieved and the transaction hashes to be retrieved.

[0120] It should be noted that, since there is a mapping relationship between the keywords to be searched and the transaction hashes to be searched, when there are keywords in the keywords to be searched that match the target keywords, the target transaction hash exists in the transaction hashes to be searched.

[0121] In some embodiments, when the search engine receives the target keyword, it can query the target keyword in the keywords to be searched, and obtain the target transaction hash corresponding to the target keyword based on the above mapping relationship between the keywords to be searched and the transaction hash to be searched.

[0122] It should be understood that the above-mentioned keywords to be retrieved are the keywords obtained after word segmentation of the data to be retrieved. Since there is a corresponding relationship between the data to be retrieved and the transaction hash to be retrieved, the keywords obtained after word segmentation still maintain a corresponding relationship with the transaction hash to be retrieved. For example, the data to be retrieved "The bright moon rises over the sea" corresponds to the transaction hash A. After it is decomposed into three keywords "over the sea", "rises", and "bright moon", the three keywords still correspond to the transaction hash A. At this time, when the target keyword input by the data retrieval user matches any one of the keywords "over the sea", "rises", and "bright moon", the transaction hash A is returned.

[0123] In some embodiments, after the data in the blockchain is synchronously stored in the search engine, it can be retrieved according to the Figure 7 schematic diagram of the blockchain data retrieval method shown.

[0124] Specifically, as Figure 7 shown, after the user submits the keyword / retrieval content to the search engine, the search engine uses its word segmentation mechanism to retrieve the keyword / retrieval content submitted by the user, and then returns the corresponding transaction hash. Using the transaction hash, the data can be accurately found on the blockchain. After the blockchain confirms the user's data access permission through the smart contract, the data is returned to the user.

[0125] The embodiments of the present disclosure combine blockchain and search engine technologies, solve the problem that data cannot be retrieved from the blockchain based on content currently, and implement a method for retrieving data on the blockchain based on keywords / content, with great creativity.

[0126] For ease of understanding, a specific application example is provided below. The complete implementation process of the blockchain data retrieval method provided by the present disclosure is shown through steps 1 to 10. This application example is only used to explain the present invention and is not used to limit the present invention.

[0127] 1. User A sends a piece of data (assuming the data contains: "The bright moon rises over the sea, at this time the whole world shares the same moment") to the blockchain in the form of a transaction. The blockchain completes the operation of uploading to the chain and generates a transaction hash.

[0128] 2. Package the data and the transaction hash as a data packet and send the data packet to the search engine. The search engine uses the word segmentation mechanism for storage, and the data is decomposed into keywords when stored.

[0129] 3. User A authorizes the use right of the data to User B by calling the ownership authorization method of the data contract ledger in the blockchain.

[0130] 4. User B sends the keyword "bright moon" to the preset search engine to retrieve the data containing the two characters "bright moon" in the blockchain.

[0131] 6. The search engine found data containing "A bright moon rises over the sea, we share this moment though far apart," and further located the transaction hash of this data;

[0132] 7. User B receives the returned result, which is the transaction hash of the data;

[0133] 8. User B uses the transaction hash to perform a precise search on the blockchain and obtains the query result;

[0134] 9. The blockchain smart contract determines data ownership and verifies whether user B has access to the data;

[0135] 10. Since user B has the right to use this data, the access permission verification is successful, and the data containing "A bright moon rises over the sea, and we share this moment though we are far apart" is returned to user B.

[0136] Based on the same inventive concept, this disclosure also provides a blockchain data retrieval device, as described in the following embodiments. Since the principle by which this device solves the problem is similar to that of the method embodiments described above, the implementation of this device embodiment can refer to the implementation of the method embodiments described above, and repeated details will not be repeated.

[0137] Figure 8 This illustration shows a schematic diagram of a blockchain data retrieval device according to an embodiment of the present disclosure, such as... Figure 8 As shown, the device 800 includes:

[0138] The retrieval request receiving module 801 is used to receive retrieval requests sent by data retrieval users, wherein the retrieval request is used to retrieve target data from the blockchain, and the retrieval request includes target keywords of the target data;

[0139] The transaction hash query module 802 is used to query the target transaction hash corresponding to the target keyword based on a preset search engine. The preset search engine stores the mapping relationship between the target keyword and the target transaction hash.

[0140] The target data retrieval module 803 is used to retrieve target data from the blockchain based on the target transaction hash.

[0141] The user permission judgment module 804 is used to determine whether the data retrieval user has access rights to the target data. If so, the target data is returned.

[0142] It should be noted that the blockchain data retrieval device provided in the above embodiments is only illustrated by the division of the above functional modules when used for blockchain data retrieval. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the blockchain data retrieval device and the blockchain data retrieval method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0143] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."

[0144] The following reference Figure 9 To describe an electronic device 900 according to such an embodiment of the present disclosure. Figure 9 The electronic device 900 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0145] like Figure 9 As shown, the electronic device 900 is manifested in the form of a general-purpose computing device. The components of the electronic device 900 may include, but are not limited to: at least one processing unit 910, at least one storage unit 920, and a bus 930 connecting different system components (including the storage unit 920 and the processing unit 910).

[0146] The storage unit stores program code that can be executed by the processing unit 910, causing the processing unit 910 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 910 can perform the following steps of the above method embodiments: receiving a search request sent by a data retrieval user, wherein the search request is for retrieving target data from the blockchain, and the search request includes target keywords of the target data; querying the target transaction hash corresponding to the target keywords based on a preset search engine, wherein the preset search engine stores a mapping relationship between target keywords and target transaction hashes; retrieving the target data from the blockchain according to the target transaction hash; determining whether the data retrieval user has access rights to the target data, and if so, returning the target data.

[0147] Specifically, the aforementioned processing unit 910 can perform the following:

[0148] Obtain a data summary of the target data;

[0149] Based on the data summary, query the permission information of the target data from the contract ledger. The permission information is used to determine whether the data retrieval user has permission to access the target data.

[0150] Based on permission information, determine whether the user retrieving the data has access rights to the target data.

[0151] In some embodiments, access permissions to the target data include a first access permission, a second access permission, and a third access permission;

[0152] The first access permission is used to grant users multiple accesses to the target data and to configure access permissions for the target data.

[0153] The second access permission is used to grant a user multiple accesses to the target data;

[0154] Third access permission is used to grant a user a single access to the target data.

[0155] Furthermore, the aforementioned processing unit 910 can also perform:

[0156] The permission configuration request for receiving target data is sent by a user with first access to the target data.

[0157] In response to a permission configuration request, configure access permissions for the target data for the data retrieval user.

[0158] Furthermore, the aforementioned processing unit 910 can also perform:

[0159] When a data retrieval user has third-party access to the target data, the third-party access to the data retrieval user is removed after the target data is returned.

[0160] In some embodiments, the processing unit 910 may also perform:

[0161] Receive data uploaded by users to be retrieved;

[0162] Once the blockchain completes the process of uploading the data to be retrieved onto the chain, it stores the data to be retrieved and the corresponding transaction hash to be retrieved in the preset search engine.

[0163] The data to be retrieved is broken down into keywords by using a pre-defined search engine, and a mapping relationship is established between the keywords and the transaction hashes to be retrieved.

[0164] The keywords to be searched include target keywords, and the transaction hashes to be searched include target transaction hashes.

[0165] Specifically, the aforementioned processing unit 910 can perform the following:

[0166] Use the preset search engine to search for target keywords among the keywords to be searched;

[0167] Based on the mapping relationship between the keywords to be searched and the transaction hashes to be searched, the target transaction hashes corresponding to the target keywords are obtained.

[0168] In some embodiments, the default search engine is an Elasticsearch-based search engine.

[0169] Storage unit 920 may include readable media in the form of volatile storage units, such as random access memory (RAM) 9201 and / or cache memory 9202, and may further include read-only memory (ROM) 9203.

[0170] Storage unit 920 may also include a program / utility 9204 having a set (at least one) program module 9205, such program module 9205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0171] Bus 930 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0172] Electronic device 900 can also communicate with one or more external devices 940 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 900, and / or with any device that enables electronic device 900 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 950. Furthermore, electronic device 900 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 960. As shown, network adapter 960 communicates with other modules of electronic device 900 via bus 930. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0173] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0174] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.

[0175] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0176] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.

[0177] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0178] In practical implementation, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0179] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0180] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0181] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0182] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.

Claims

1. A blockchain data retrieval method, characterized in that, include: Receive a search request sent by a data retrieval user, wherein the search request is used to retrieve target data from the blockchain, and the search request includes target keywords of the target data; Based on a preset search engine, the target transaction hash corresponding to the target keyword is queried, wherein the preset search engine stores the mapping relationship between the target keyword and the target transaction hash; Retrieve the target data from the blockchain based on the target transaction hash; Determine whether the data retrieval user has access rights to the target data; if so, return the target data. Wherein, the target transaction hash is a unique identifier generated when the target data is used for a blockchain transaction; The blockchain includes a contract ledger. The step of determining whether the data retrieval user has access to the target data includes: obtaining a data digest of the target data; querying permission information of the target data from the contract ledger based on the data digest, wherein the permission information is used to determine whether the data retrieval user has access to the target data; and determining whether the data retrieval user has access to the target data based on the permission information. In addition to storing the target data in the form of a user list, the contract ledger also includes an authentication method, an ownership authorization method, and an ownership borrowing method. The authentication method is used to determine whether a user has access to the target data, the ownership authorization method is used to grant the user the right to use the data, and the ownership borrowing method is used to grant the user the right to borrow the data. The target data refers to the data content itself in the blockchain, or the transaction information and storage information generated during the transaction process of the target data in the blockchain; the target transaction hash is used to query all information related to the transaction of the target data in the blockchain.

2. The blockchain data retrieval method according to claim 1, characterized in that, The access permissions for the target data include a first access permission, a second access permission, and a third access permission; The first access permission is used to grant the user multiple accesses to the target data and to configure access permissions for the target data; The second access permission is used to grant the user multiple accesses to the target data; The third access permission is used to grant a user a one-time access to the target data.

3. The blockchain data retrieval method according to claim 2, characterized in that, The method further includes: Receive a permission configuration request for the target data, the permission configuration request being sent by a user with first access rights to the target data; In response to the permission configuration request, access permissions for the target data are configured for the data retrieval user.

4. The blockchain data retrieval method according to claim 2, characterized in that, The method further includes: When the data retrieval user has third access rights to the target data, the third access rights of the data retrieval user are removed after the target data is returned.

5. The blockchain data retrieval method according to claim 1, characterized in that, Before querying the target transaction hash corresponding to the target keyword based on a preset search engine, the method further includes: Receive data uploaded by users to be retrieved; After the blockchain completes the on-chain operation of the data to be retrieved, it stores the data to be retrieved and the corresponding transaction hash to be retrieved in the preset search engine. The preset search engine is used to decompose the data to be retrieved into keywords to be retrieved, and a mapping relationship is established between the keywords to be retrieved and the transaction hash to be retrieved. The keywords to be searched include target keywords, and the transaction hash to be searched includes target transaction hashes.

6. The blockchain data retrieval method according to claim 5, characterized in that, The step of querying the target transaction hash corresponding to the target keyword based on a preset search engine specifically includes: Using a preset search engine, search for the target keywords among the keywords to be searched; Based on the mapping relationship between the keyword to be searched and the transaction hash to be searched, the target transaction hash corresponding to the target keyword is obtained.

7. The blockchain data retrieval method according to any one of claims 1 to 6, characterized in that, The preset search engine includes an Elasticsearch-based search engine.

8. A blockchain data retrieval device, characterized in that, include: The retrieval request receiving module is used to receive retrieval requests sent by data retrieval users, wherein the retrieval request is used to retrieve target data from the blockchain, and the retrieval request includes target keywords of the target data; The transaction hash query module is used to query the target transaction hash corresponding to the target keyword based on a preset search engine, wherein the preset search engine stores the mapping relationship between the target keyword and the target transaction hash; The target data retrieval module is used to retrieve the target data from the blockchain based on the target transaction hash. The user permission judgment module is used to determine whether the data retrieval user has access to the target data. If so, the target data is returned. Wherein, the target transaction hash is a unique identifier generated when the target data is used for a blockchain transaction; The blockchain includes a contract ledger. The user permission determination module is further configured to obtain a data digest of the target data; query permission information of the target data from the contract ledger based on the data digest, wherein the permission information is used to determine whether the data retrieval user has permission to access the target data; and determine whether the data retrieval user has access rights to the target data based on the permission information. In addition to storing the target data in the form of a user list, the contract ledger also includes an authentication method, an ownership authorization method, and an ownership borrowing method. The authentication method is used to determine whether a user has access to the target data, the ownership authorization method is used to grant the user the right to use the data, and the ownership borrowing method is used to grant the user the right to borrow the data. The target data refers to the data content itself in the blockchain, or the transaction information and storage information generated during the transaction process of the target data in the blockchain; the target transaction hash is used to query all information related to the transaction of the target data in the blockchain.

9. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the blockchain data retrieval method according to any one of claims 1 to 7 by executing the executable instructions.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the blockchain data retrieval method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Health data processing method, device, electronic equipment and storage medium

    CN110729028A

  • Blockchain data query method and system, and related equipment

    CN111259056A

  • Block chain storage data query method and device

    CN113157735A