A method and apparatus for full-text search in a blockchain
By configuring business models and parsing services on a blockchain service platform and combining them with a full-text search engine, the complexity of data search on consortium blockchains is solved, enabling flexible and efficient full-text search while meeting privacy requirements.
Patent Information
- Application Number
- CN202211738172.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-12-30
AI Technical Summary
Existing technologies cannot effectively perform full-text searches on consortium blockchains. In particular, due to the complexity of the data and privacy requirements, existing public blockchain search solutions cannot be directly adapted. Furthermore, data transfer increases the complexity of the search and makes it impossible to achieve full-text search of the entire dataset.
Deploy data parsing services on the blockchain service platform, parse transaction data by configuring business models, build query indexes, and use a full-text search engine for real-time full-text search to avoid data transfer.
It enables flexible business data search, reduces search complexity, and allows full-text search based on the raw data stored on the blockchain, meeting the privacy needs of different alliance members.
Smart Images

Figure CN116089463B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification belong to the field of blockchain technology, and in particular relate to a full-text search method and apparatus in blockchain. Background Technology
[0002] Blockchain is a decentralized, trustless distributed ledger. Blockchain technology features multi-party writing, transparency, and immutability. Based on different access control mechanisms, blockchains can be categorized into public blockchains, consortium blockchains, and private blockchains. For public blockchains, any node can join the network. Consortium blockchains, however, have access control features; only authorized nodes can join the network. Therefore, they are often more secure and efficient than public blockchains and are primarily used for collaboration between enterprises or institutions.
[0003] In practical applications, as blockchain data accumulates during operation, more and more business users are beginning to have search needs for this data. Therefore, how to leverage existing data search capabilities to perform data searches based on the ever-accumulating data on the blockchain, according to the business needs of these users, is a pressing issue that needs to be addressed in the blockchain field. Summary of the Invention
[0004] This specification provides one or more embodiments of the following technical solutions:
[0005] This specification provides a full-text search method in blockchain, applied to service programs deployed on a blockchain service platform; including:
[0006] Obtain the business model configured for each block of the blockchain; wherein each block of the blockchain stores business data with business semantics; the business model is used to parse the transaction data stored in each block of the blockchain according to the business semantics to obtain the business data;
[0007] Based on the obtained business model, the transaction data stored in each block of the blockchain is parsed to obtain the business data with business semantics contained in the transaction data, and a query index is established for the business data obtained by data parsing.
[0008] The business data for which a query index has been established is sent to a full-text search engine that is connected to the blockchain service platform, so that the full-text search engine responds to the data query request for the business data triggered by the data query party and performs a data query on the business data based on the query index.
[0009] This specification also provides a full-text search device in a blockchain, applied to a service program deployed on a blockchain service platform; including:
[0010] The acquisition module acquires the business model configured for each block of the blockchain; wherein each block of the blockchain stores business data with business semantics; the business model is used to parse the transaction data stored in each block of the blockchain according to the business semantics to obtain the business data;
[0011] The parsing module performs data parsing on the transaction data stored in each block of the blockchain based on the obtained business model, so as to obtain the business data with business semantics contained in the transaction data, and establishes a query index for the business data obtained by data parsing.
[0012] The sending module sends the business data with the established query index to the full-text search engine that is connected to the blockchain service platform, so that the full-text search engine responds to the data query request for the business data triggered by the data query party and performs a data query on the business data based on the query index.
[0013] This specification also provides an electronic device, including a communication interface, a processor, a memory, and a bus, wherein the communication interface, the processor, and the memory are interconnected via the bus;
[0014] The memory stores machine-readable instructions, and the processor executes the method described in any of the preceding descriptions by invoking the machine-readable instructions.
[0015] This specification also provides a machine-readable storage medium storing machine-readable instructions that, when invoked and executed by a processor, implement the method described in any of the preceding descriptions.
[0016] In the above technical solutions, on the one hand, a business model can be configured for the relevant blocks after there is a business need, and the business model can be used to parse the transaction data stored in each block to obtain business data with business semantics, so as to complete the business search of the data on the chain, thereby making the entire search method more flexible.
[0017] On the other hand, a full-text search engine can be used to perform real-time full-text searches on the complete original data stored on the blockchain, based on the content of the data, targeting the business data with specific semantics contained in the original data. For the data query party, there is no need to intervene in the data on-chain stage to transfer the business data stored in each block of the blockchain, thereby reducing the complexity of searching for business data with business semantics stored in each block of the blockchain. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments in this specification, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This specification illustrates a network architecture diagram for performing full-text search on business data stored in a blockchain, based on an exemplary embodiment.
[0020] Figure 2 This specification illustrates, according to an exemplary embodiment, another network architecture diagram for performing full-text search on business data stored in a blockchain;
[0021] Figure 3 This specification illustrates, according to an exemplary embodiment, another network architecture diagram for performing full-text search on business data stored in a blockchain;
[0022] Figure 4 This is a flowchart illustrating a full-text search method in a blockchain according to an exemplary embodiment of this specification;
[0023] Figure 5 This is a schematic diagram illustrating, according to an exemplary embodiment, how to create a query index for business data.
[0024] Figure 6 This is a schematic structural diagram of an electronic device according to an exemplary embodiment of this specification;
[0025] Figure 7 This is a block diagram of a consensus node in a blockchain system illustrated in this specification according to an exemplary embodiment. Detailed Implementation
[0026] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0027] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.
[0028] In public blockchains, it is common to provide search capabilities for information such as on-chain transactions, account addresses, and contract addresses, as well as queries for related transactions. For example, search engines such as Blockchair, Amberdata, and Etherscan can provide search functions for on-chain block hashes, transaction hashes, account addresses, and smart contract input and output parameters.
[0029] In consortium blockchains, on-chain data is more complex and possesses stronger business semantics compared to public blockchains. Furthermore, consortium blockchains have higher privacy requirements for on-chain data, and the visibility requirements for on-chain data with business semantics often differ among different consortium members. This means that some data search solutions based on public blockchains cannot be directly adapted to the consortium blockchain environment.
[0030] In related technologies, in order to perform data search on business data with business semantics contained in on-chain data, it is usually possible to intervene in the data on-chain stage, extract business data with business semantics stored in each block on the chain, then transfer the extracted business data to a database, and then perform data search on these business data based on the database.
[0031] However, transferring data not only increases the complexity of searching business data, but also makes it impossible to perform full-text searches on the original full data stored on the blockchain, based on the content of the data and targeting the business data with specific semantics.
[0032] In view of this, this specification provides a solution for full-text search of business data with business semantics stored on the blockchain.
[0033] In implementation, a service program for parsing on-chain data can be deployed on the blockchain service platform. When parsing on-chain data, this service program can obtain the business model configured for each block of the blockchain. Each block of the blockchain can store business data with business semantics. Specifically, the business model can be used to parse the transaction data stored in each block of the blockchain according to the aforementioned business semantics to obtain the aforementioned business data.
[0034] Then, based on the acquired business model, the transaction data stored in each block of the blockchain can be parsed to obtain business data with business semantics contained in the transaction data, and a query index can be established for the parsed business data. The business data with the established query index is then sent to a full-text search engine connected to the blockchain service platform. When the full-text search engine receives a data query request for this business data triggered by the data query party, it maliciously responds to the data query request and performs a data query on the business data based on the aforementioned query index.
[0035] In the above technical solutions, on the one hand, a business model can be configured for the relevant blocks after there is a business need, and the business model can be used to parse the transaction data stored in each block to obtain business data with business semantics, so as to complete the business search of the data on the chain, thereby making the entire search method more flexible.
[0036] On the other hand, a full-text search engine can be used to perform real-time full-text searches on the complete original data stored on the blockchain, based on the content of the data, targeting the business data with specific semantics contained in the original data. For the data query party, there is no need to intervene in the data on-chain stage to transfer the business data stored in each block of the blockchain, thereby reducing the complexity of searching for business data with business semantics stored in each block of the blockchain.
[0037] Please see Figure 1 , Figure 1 This specification illustrates a network architecture diagram for performing full-text search on business data stored in a blockchain, based on an exemplary embodiment.
[0038] like Figure 1 As shown, the above network architecture may include the following components:
[0039] 1: Blockchain Node
[0040] A blockchain node is used to store and maintain the original block data generated on the blockchain.
[0041] 2: Business Model Management Service
[0042] This business model management service can specifically be a service program deployed on a blockchain service platform (such as a BaaS platform) that is responsible for managing the business models configured for each block of the blockchain and providing storage and query functions for the business models.
[0043] Within the blockchain, each block can store business data with business semantics published by different business parties.
[0044] The aforementioned business model can be used to parse the transaction data stored in each block of the blockchain according to the aforementioned business semantics to obtain the aforementioned business data.
[0045] For example, business data with business semantics stored on the blockchain typically consists of multiple key-value pairs containing business semantics. These key-value pairs can usually be included in the "data" field of a transaction, or in the transaction receipt generated after the transaction is successfully executed, and so on. The aforementioned business model can parse the transaction data, such as transactions and transaction receipts, contained in the block according to the above business semantics to reconstruct the key-value pairs with business semantics.
[0046] 3: Data parsing service
[0047] The data parsing service (i.e.) Figure 1 The data export service shown can be a service program deployed on a blockchain service platform, which is responsible for obtaining raw blocks from blockchain nodes in real time, then using the business model management service to manage the business model, parsing the transaction data contained in these raw blocks, creating a query index for the parsed business data, and then submitting it to the full-text search engine that is connected to the blockchain service platform.
[0048] For example, in one instance, a standardized data export service program is typically deployed on a blockchain service platform. In addition to exporting on-chain data, this data export service program usually also has the function of parsing on-chain data. In this case, the aforementioned data parsing service can specifically be this data export service program.
[0049] 4: Full-text search engine
[0050] Full-text search refers to a global search based on the content of the complete original data, without requiring partial data transfer. The full-text data search engine is specifically responsible for receiving query requests from the search console and responding to those requests by performing a full-text search on the business data submitted by the data parsing service, which includes the query index.
[0051] The specific type of the full-text data search engine is not specifically limited in this specification; for example, in one instance, the full-text data search engine may specifically be a search engine such as ElasticSearch.
[0052] 5: Search Gateway
[0053] This search gateway is responsible for receiving query requests triggered by the data queryer on the search console, submitting the query request to the full-text search engine to initiate a full-text search, and then sending the query results returned by the full-text search engine to the search console.
[0054] 6: Search Console
[0055] The search console is responsible for receiving query requests triggered by data queryers, sending the query requests to the search gateway, receiving the query results returned by the search gateway, and then presenting the query results to the data queryers through a web page.
[0056] It should be noted that in practical applications, Figure 1 The network architecture shown can also be extended to support aggregated searches across multiple blockchains.
[0057] Please see Figure 2 , Figure 2 This specification illustrates, according to an exemplary embodiment, another network architecture diagram for performing full-text search on business data stored in a blockchain.
[0058] exist Figure 2 In this process, the data export service can obtain data from multiple blockchains, perform data parsing, create query indexes for the parsed business data, and write them into a search engine to achieve data aggregation and search across multiple blockchains.
[0059] Please see Figure 3 , Figure 3 This specification illustrates, according to an exemplary embodiment, another network architecture diagram for performing full-text search on business data stored in a blockchain.
[0060] exist Figure 3 In this context, search results from different search gateways can be aggregated through a search gateway proxy, enabling data aggregation and search across multiple blockchains in different network environments.
[0061] Please see Figure 4 , Figure 4 This is a flowchart illustrating a full-text search method in a blockchain according to an exemplary embodiment of this specification. The method can be applied to a service program deployed on a blockchain service platform for parsing on-chain data; the method includes:
[0062] Step 402: Obtain the business model configured for each block of the blockchain; wherein, each block of the blockchain stores business data with business semantics; the business model is used to parse the transaction data stored in each block of the blockchain according to the business semantics to obtain the business data;
[0063] The aforementioned service program for parsing on-chain data can specifically be... Figure 1 The data parsing service shown is an example. It should be noted that this data parsing service typically refers to a service program that functionally possesses the ability to parse on-chain data.
[0064] For example, in one instance, a standardized data export service program is typically deployed on a blockchain service platform. In addition to exporting on-chain data, this data export service program usually also has the function of parsing on-chain data. In this case, the aforementioned data parsing service can specifically be this data export service program.
[0065] The transaction data stored in each block of the blockchain can include business data with business semantics that are notified on the blockchain by various business parties that have access to the blockchain.
[0066] In practical applications, the business data with business semantics that are stored on the blockchain by the business parties that access the blockchain generally consists of multiple key-value pairs containing business semantics. These key-value pairs with business semantics can usually be included in the "data" field of the transaction, as well as in the transaction receipt generated after the transaction is successfully executed, and so on.
[0067] For example, taking the storage of business data by calling a smart contract as an example, in this case, the above transaction can be a smart contract call transaction. The above business data can typically include the call input data (i.e., the input parameters when initiating the contract call) contained in the "data" field (i.e., the transaction payload) of the smart contract call transaction, the smart contract execution result contained in the transaction receipt, and the smart contract event generated after the smart contract call is completed, which is contained in the transaction receipt.
[0068] For example, taking the method of storing business data through original certificate of authenticity as an example, in this case, the above transaction can be an original certificate of authenticity transaction other than smart contract call transaction. The above business data can usually include the transaction content data contained in the "data" field of the transaction, as well as the transaction execution result contained in the transaction receipt.
[0069] In practical applications, the business semantics of the business data stored on the blockchain by different business parties are usually related to their respective business operations. Since the businesses of different parties often have significant differences, this leads to substantial differences in the business semantics of the business data stored on the blockchain by different business parties. For example, even if a key-value pair with specific business semantics stored on the blockchain by one business party is presented to other business parties in plaintext, those other business parties typically cannot understand its true business meaning.
[0070] Therefore, to ensure the correct parsing of the business data stored on the blockchain by each business party, in addition to storing business data with specific business semantics related to their own business on the blockchain, each business party can also configure a business model for each block storing this business data. For example, please see... Figure 1 Each business entity can use the aforementioned business model management service to configure a business model for the blocks storing its business data.
[0071] Specifically, this business model can be used to parse the transaction data stored in each block of the blockchain according to the business semantics of the aforementioned business data, so as to correctly reconstruct the aforementioned business data.
[0072] It should be noted that the specific form of the above data model is not specifically limited in this specification.
[0073] In one embodiment, the aforementioned business model can specifically be a data model describing the aforementioned business semantics. This data model may specifically include descriptive data corresponding to data structures related to the aforementioned business semantics. For example, the descriptive data may specifically be the data type corresponding to the business data contained in the transaction data stored in the block, and the data order of the business data contained in the transaction data within the transaction data, etc. Furthermore, since the transaction data stored in each block of the blockchain is usually encoded according to a preset encoding method, the aforementioned data model may also include a decoding method corresponding to the preset encoding method.
[0074] For example, taking the storage of business data through a smart contract call as an example, the above transaction can be a smart contract call transaction, and the above business model can be the contract interface description file generated by the smart contract during compilation. Of course, when storing business data through original notarization, the above transaction can also be an original notarization transaction other than a smart contract call transaction. In this case, the above business model can be a description file related to the processing flow of the original notarization transaction.
[0075] In this specification, after the business party configures the business model for storing each block of its business data, the above data parsing service can obtain the block data corresponding to these blocks and the business model configured for these blocks in real time.
[0076] For example, see Figure 1 The aforementioned data parsing service can obtain the block data of these blocks from the blockchain nodes in real time, and can also obtain the business models configured for these blocks from the business model management service program deployed on the blockchain service platform.
[0077] Step 404: Based on the obtained business model, perform data parsing on the transaction data stored in each block of the blockchain to obtain the business data with business semantics contained in the transaction data, and establish a query index for the business data obtained by data parsing.
[0078] After obtaining the business model, the aforementioned data parsing service can perform data parsing on the transaction data stored in each block based on the obtained business model to obtain business data with business semantics.
[0079] In one embodiment shown, as previously described, the business model may specifically include descriptive data corresponding to the data structure related to the business semantics. In this case, when the data parsing service parses the transaction data stored in each block, it may specifically parse the data structure of the transaction data stored in each block based on the descriptive data included in the obtained business model, so as to obtain the business data with business semantics contained in the transaction data.
[0080] In one embodiment shown, as mentioned above, since the transaction data stored in each block of the blockchain is usually encoded according to a preset encoding method, the data model can include not only descriptive data corresponding to the data structure related to the business semantics, but also decoding methods corresponding to the preset encoding methods. In this case, when the data parsing service parses the transaction data stored in each block, it can first decode the transaction data stored in each block based on the decoding methods included in the obtained business model, and after decoding, parse the data structure of the transaction data stored in each block based on the descriptive data included in the business model.
[0081] After the data parsing is completed, the data parsing service can also create a query index for the parsed business data.
[0082] In one implementation method, the query index created for the aforementioned business data may specifically include a basic query index created for key fields contained in the transaction data; and a business query index created for the business data obtained from data parsing. The aforementioned key fields may specifically be basic fields contained in the transaction data format; for example, the `from` field, `to` field, etc., in the transaction format.
[0083] By creating both a basic query index and a business query index for business data, when initiating a query on business data based on the query index, in addition to initiating a query on the business data at the business level, the basic query index can also be used to assist the query initiated at the business level, thus achieving accurate querying.
[0084] For example, the `from` and `to` fields in the transaction data format refer to the account that initiated the transaction and the account that received the transaction, respectively. When a query is initiated on the business data based on the basic query index of the `from` and `to` fields and the aforementioned business query index, a precise query of the business data with business semantics carried in a transaction initiated by a specific account can be achieved. Conversely, if a basic query index corresponding to the `from` and `to` fields is not established, only a fuzzy query can be performed on the business data with business semantics carried in the transaction, and the query scope cannot be narrowed to a specific transaction initiated by a specific account.
[0085] Of course, in practical applications, the query index created for the above business data may not specifically include the basic query index created for the key fields contained in the transaction data, and this specification does not impose any special restrictions.
[0086] In one embodiment, the business entity can pre-specify the effective interval for the business model configured for each block storing its business data; this effective interval can be a block number range, denoted as [N, M]. Here, N represents the starting block number where the business model becomes effective, and M represents the ending block number where the business model becomes ineffective. In practical applications, the business entity can set the aforementioned effective interval according to the storage status of its business data on the blockchain.
[0087] For example, assuming the business party learns from the receipt of the business data storage that its own business data is stored in blocks from N to M, then the above effective range can be set to [N, M].
[0088] In practical applications, the business model configured by the business party may change dynamically; for example, the business party may configure a new business model at a certain block number, or update the original business model at a certain block number. Therefore, in order to cope with the dynamic changes in the business model, the aforementioned data parsing service can use a batch re-indexing approach to create and update index data during the data parsing and index building process.
[0089] In one embodiment shown, please refer to Figure 5 Suppose that a new business model is configured in the Tth block, or the original business model is updated in the Tth block; where T is greater than N and less than M.
[0090] In this scenario, the aforementioned data parsing service can, based on a continuously running first task, parse the transaction data stored in each block within the interval [T, M] and establish a query index for the resulting business data. Furthermore, the data parsing service can dynamically create a second task and run it to re-parse the transaction data stored in each block within the interval [N, T] and establish a query index for the resulting business data. The second task then terminates after the index is established. Specifically, the first and second tasks can be a single task thread created by the data parsing service.
[0091] In this way, after the second task is completed, the final query index will contain the query indexes corresponding to the business data contained in each block of the effective range of the business model.
[0092] Step 406: The business data with the established query index is sent to the full-text search engine that is connected to the blockchain service platform, so that the full-text search engine responds to the data query request for the business data triggered by the data query party and performs a data query on the business data based on the query index.
[0093] After creating a query index for the business data obtained from the data parsing, the aforementioned data parsing service can send the indexed business data to a full-text search engine that is connected to the blockchain service platform. Subsequently, upon receiving a data query request for the business data triggered by the data query party, the full-text search engine can respond to the data query request and perform a data query on the business data based on the aforementioned query index.
[0094] In one embodiment shown, in addition to creating a query index for the business data obtained from data parsing, the data parsing service can also add attribute identifiers to the business data obtained from data parsing in order to facilitate the control of viewing permissions for the business data; for example, the aforementioned attribute identifiers may specifically include the model identifier of the business model, or the chain identifier of the blockchain, etc.
[0095] Specifically, this attribute identifier can be associated with data viewing permissions for the business data. It should be noted that in practical applications, the attribute identifier added to the business data can be an additional attribute identifier added to the business data based on the query index, or it can be part of the query index (such as as a specific attribute value in the query index). This specification does not impose any special limitations.
[0096] Then, the business data with the established query index and the aforementioned attribute identifiers can be sent to the full-text search engine connected to the blockchain service platform. Subsequently, upon receiving a data query request for this business data triggered by the data query party, the full-text search engine can respond to the request by verifying whether the data query party has the data viewing permissions associated with the aforementioned attribute identifiers. If so, it further executes a data query on the business data based on the query index and returns the query results to the data query party for output and display; for example, please see... Figure 1 The query results can be sent to the search console via the search gateway for presentation to the data querying party. However, if verification determines that the data querying party does not have the data viewing permissions associated with the aforementioned attribute identifier, the query results can be hidden and not returned to the data querying party.
[0097] For example, in one instance, if the aforementioned blockchain is a consortium blockchain, the data queryer can be a consortium member within the consortium blockchain. In this way, access control can be exercised over the visibility of business data with business semantics among different consortium members.
[0098] In the above technical solutions, on the one hand, business parties can configure business models for relevant blocks after having business needs, and use the business models to parse the transaction data stored in each block to obtain business data with business semantics, so as to complete the business search of the data on the chain, thereby making the entire search method more flexible.
[0099] On the other hand, a full-text search engine can be used to perform real-time full-text searches on the complete original data stored on the blockchain, based on the content of the data, targeting the business data with specific semantics contained in the original data. For the data query party, there is no need to intervene in the data on-chain stage to transfer the business data stored in each block of the blockchain, thereby reducing the complexity of searching for business data with business semantics stored in each block of the blockchain.
[0100] Figure 6 This is a schematic structural diagram of an electronic device provided in an exemplary embodiment. Please refer to... Figure 6 At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, memory 608, and non-volatile memory 610, and may also include other hardware required for business operations. One or more embodiments of this specification can be implemented in software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into memory 608 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution subject of the following processing flow is not limited to each logic module, but can also be hardware or logic devices.
[0101] like Figure 7 As shown, Figure 7 This specification is a block diagram illustrating a full-text search device in a blockchain according to an exemplary embodiment, applied to a service program deployed on a blockchain service platform; the device can be applied to, for example... Figure 6 The electronic device shown implements the technical solution of this specification. The device includes:
[0102] The acquisition module 702 acquires the business model configured for each block of the blockchain; wherein, each block of the blockchain stores business data with business semantics; the business model is used to parse the transaction data stored in each block of the blockchain according to the business semantics to obtain the business data;
[0103] The parsing module 704 performs data parsing on the transaction data stored in each block of the blockchain based on the obtained business model, so as to obtain the business data with business semantics contained in the transaction data, and establishes a query index for the business data obtained by data parsing.
[0104] The sending module 706 sends the business data with the established query index to the full-text search engine that is connected to the blockchain service platform, so that the full-text search engine responds to the data query request for the business data triggered by the data query party and performs a data query on the business data based on the query index.
[0105] The specific details of each module of the above-mentioned device have been described in detail in the previously described method flow, so they will not be repeated here.
[0106] Accordingly, this specification also provides an electronic device including a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement all the steps in the previously described method flow.
[0107] Accordingly, this specification also provides a computer-readable storage medium having executable instructions stored thereon; wherein, when executed by a processor, the instructions implement all the steps in the previously described method flow.
[0108] The apparatus embodiments are basically the same as the method embodiments, so relevant details can be found in the description of the method embodiments.
[0109] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the technical solution in this specification, depending on actual needs.
[0110] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.
[0111] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0112] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0113] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0114] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0115] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0116] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this specification. The singular forms “a,” “described,” and “the” used in one or more embodiments of this specification and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0117] It should be understood that although the terms first, second, third, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be referred to as second information without departing from the scope of one or more embodiments of this specification, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "in response to a determination," or "when," or "in the event of a determination."
[0118] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit the scope of one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this specification should be included within the protection scope of one or more embodiments of this specification.
Claims
1. A full-text search method in blockchain, applied to service programs deployed on a blockchain service platform; comprising: Obtain the business model configured for each block of the blockchain; wherein each block of the blockchain stores business data with business semantics; the business model is used to parse the transaction data stored in each block of the blockchain according to the business semantics to obtain the business data; Based on the obtained business model, the transaction data stored in each block of the blockchain is parsed to obtain the business data with business semantics contained in the transaction data, and a query index is established for the business data obtained by data parsing. The business data for which a query index has been established is sent to a full-text search engine that is connected to the blockchain service platform, so that the full-text search engine responds to the data query request for the business data triggered by the data query party and performs a data query on the business data based on the query index.
2. The method as described in claim 1, wherein the service program includes a data export service program deployed on the blockchain service platform for exporting block data in the blockchain.
3. The method as described in claim 1, wherein the full-text search engine is the ElasticSearch search engine.
4. The method as described in claim 2, wherein the blockchain service platform further deploys a business model management service program for managing the business model; Obtain the business model configured for each block of the blockchain, including: The business model configured for each block of the blockchain is obtained from the business model management service program deployed on the blockchain service platform.
5. The method as described in claim 1, wherein the business model includes descriptive data corresponding to a data structure related to the business semantics; Based on the obtained business model, the transaction data stored in each block of the blockchain is parsed to obtain the business data with business semantics contained in the transaction data, including: Based on the description data contained in the obtained business model, the data structure of the transaction data stored in each block of the blockchain is parsed to obtain the business data with business semantics contained in the transaction data.
6. The method as described in claim 5, wherein the transaction data stored in each block of the blockchain is encoded according to a preset encoding method; the business model further includes a decoding method corresponding to the preset encoding method; Based on the description data contained in the obtained business model, the data structure of the transaction data stored in each block of the blockchain is parsed to obtain the business data with business semantics contained in the transaction data, including: Based on the decoding method included in the obtained business model, the transaction data stored in each block of the blockchain is decoded. After decoding, based on the description data included in the business model, the data structure of the transaction data stored in each block of the blockchain is parsed to obtain the business data with business semantics contained in the transaction data.
7. The method as described in claim 1, wherein a query index is established for the business data obtained through data parsing, comprising: Establish a basic query index for the key fields contained in the transaction data; as well as, Establish a business query index for the business data obtained from data parsing.
8. The method of claim 7, wherein the transaction data includes transactions stored in each block of the blockchain and transaction receipts generated after the transactions are executed.
9. The method of claim 8, wherein if the transaction is a smart contract call transaction, the business data includes the call input data contained in the transaction payload of the smart contract call transaction, the smart contract execution result contained in the transaction receipt, and the smart contract event contained in the transaction receipt; If the transaction is a native transaction other than a smart contract call transaction, the business data includes the transaction content data contained in the transaction payload and the transaction execution result contained in the transaction receipt.
10. The method as described in claim 9, wherein if the transaction is a smart contract call transaction, then the business model is the contract interface description file generated by the smart contract at compile time.
11. The method of claim 1, wherein the business data having business semantics includes key-value pairs having business semantics.
12. The method as described in claim 1, wherein the business model is configured with an effective range [N, M]; wherein, N represents the starting block number where the business model becomes effective, and M represents the ending block number where the business model becomes ineffective. Based on the obtained business model, the transaction data stored in each block of the blockchain is parsed, and a query index is established for the business data obtained from the data parsing, including: If the business model is configured in the T-th block of the blockchain, or if the business model is updated in the T-th block, then based on the continuously running first task, the transaction data stored in each block within the interval [T, M] is parsed, and a query index is established for the business data obtained from the data parsing; and, A second task is dynamically created and run to parse the transaction data stored in each block within the interval [N, T], establish a query index for the business data obtained from the data parsing, and end the second task after the index is established; wherein, the value of T is greater than N and less than M.
13. The method of claim 1, before sending the business data with the established query index to the full-text search engine interfaced with the blockchain service platform, further includes: Add attribute identifiers to the business data obtained from data parsing; wherein, the attribute identifiers are associated with data viewing permissions for the business data; The step of sending the business data with the established query index to a full-text search engine connected to the blockchain service platform, so that the full-text search engine responds to the data query request for the business data triggered by the data query party, and performs a data query on the business data based on the query index, including: The business data, for which a query index has been established and the attribute identifier has been added, is sent to a full-text search engine that is connected to the blockchain service platform. This allows the full-text search engine to respond to a data query request for the business data triggered by the data query party, verifying whether the data query party has the data viewing permission for the business data associated with the attribute identifier. If so, the search engine further performs a data query on the business data based on the query index and returns the query results to the data query party for output and display.
14. The method as described in claim 1, wherein the blockchain is a consortium blockchain; and the data querying party is a consortium member in the consortium blockchain.
15. A full-text search device in a blockchain, applied to a service program deployed on a blockchain service platform; comprising: The acquisition module acquires the business model configured for each block of the blockchain; wherein each block of the blockchain stores business data with business semantics; the business model is used to parse the transaction data stored in each block of the blockchain according to the business semantics to obtain the business data; The parsing module performs data parsing on the transaction data stored in each block of the blockchain based on the obtained business model, so as to obtain the business data with business semantics contained in the transaction data, and establishes a query index for the business data obtained by data parsing. The sending module sends the business data with the established query index to the full-text search engine that is connected to the blockchain service platform, so that the full-text search engine responds to the data query request for the business data triggered by the data query party and performs a data query on the business data based on the query index.
16. An electronic device, comprising a communication interface, a processor, a memory, and a bus, wherein the communication interface, the processor, and the memory are interconnected via the bus; The memory stores machine-readable instructions, and the processor executes the method according to any one of claims 1 to 14 by invoking the machine-readable instructions.
17. A machine-readable storage medium storing machine-readable instructions that, when invoked and executed by a processor, implement the method of any one of claims 1 to 14.
Citation Information
Patent Citations
Data retrieval system and method based on block chain
CN112506925A
Block chain data supervision method and system based on knowledge graph and computer equipment
CN114064801A