Tamper-proof trusted index query method, device and electronic equipment

By constructing an index query method based on hash locking and context linking on the blockchain, the problems of long data query time and tampering risk in blockchain systems are solved, realizing fast and secure index query and improving the availability and trustworthiness of the blockchain system.

CN115952559BActive Publication Date: 2026-06-30IFLYTEK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
IFLYTEK CO LTD
Filing Date
2022-12-26
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In blockchain systems, as transaction volume increases, data queries become time-consuming, storage pressure is high, and reliability is low. Especially in scenarios with large data volumes, existing index query methods cannot meet performance requirements and are subject to tampering risks.

Method used

Predefine an index on the blockchain, add a hash value field, build a context link, bind the index to the blockchain data using a hash locking mechanism, and ensure the security and trustworthiness of the index through hash verification and context linking to achieve fast querying.

Benefits of technology

It improves the query performance of blockchain under large data volumes, reduces storage space requirements, ensures the security and trustworthiness of indexed data, prevents tampering, and enhances system availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115952559B_ABST
    Figure CN115952559B_ABST
Patent Text Reader

Abstract

The application discloses a tamper-proof trusted index query method and device and electronic equipment. The main idea of the application is that, in addition to saving complete and trusted information of blocks and transactions on the block chain, indexes of blocks, transactions, accounts, contracts and the like are constructed on the chain, only quick query information and the address of specific information on the chain are saved in the indexes, the database pressure is reduced, and real-time query is achieved. When the indexes are constructed, a hash locking mechanism is used, and meanwhile, context links are established between adjacent index rows through field information, the index storage error or tampering is prevented through the hash locking and context linking mechanism, the indexes are bound with the block chain or transaction information, and it is ensured that the data queried from the indexes is also trusted. Under the premise of safety and trustworthiness, the application solves the low performance problem encountered in the information query process of the block chain, transactions, accounts, contracts and the like under large data, and improves the availability of the block chain under large data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain technology, and in particular to a tamper-proof trusted index query method, apparatus, and electronic device. Background Technology

[0002] With the development of science and technology, blockchain technology, with its advantages such as decentralization and security, is being applied in more and more business scenarios. Blockchain technology is a shared and immutable ledger that stores a large number of transaction data records with total order relationships in a distributed environment. The data is stored in blocks and managed at the block level. As the transaction volume increases, the amount of data stored on the blockchain also increases. As the number of data blocks, the total amount of transaction data, transaction accounts, contract addresses, and other conditions for querying becomes increasingly slow, eventually failing to meet the requirements of use and seriously affecting the use of blockchain in large-scale, long-term business applications.

[0003] Specifically, in a blockchain system, blocks and transactions are stored in a linked list format. Existing methods, when querying data blocks, total transaction data, transaction accounts, contract addresses, and other conditions, will traverse every transaction record in each block. When the data volume is large, this method suffers from problems such as long processing time and slow updates, which seriously affects system performance.

[0004] Furthermore, existing technical solutions directly generate and store blockchain index data using traditional indexing methods, essentially storing data in files or tables without any distinction between the generated index records. This approach not only easily leads to excessive data access pressure and data redundancy when dealing with large amounts of data, but also makes it susceptible to errors in the storage and transmission of index data or malicious tampering. This can cause the blockchain system to query incorrect data using incorrect indexes, reducing the credibility of the blockchain system and posing significant security risks. Summary of the Invention

[0005] In view of the above, the present invention aims to provide a tamper-proof trusted index query method, apparatus and electronic device to solve the problems of excessive access pressure and low reliability in big data scenarios.

[0006] The technical solution adopted in this invention is as follows:

[0007] In a first aspect, the present invention provides a method for querying a tamper-proof trusted index, comprising:

[0008] On-chain predefines indexes for querying data related to each block and transaction, and adds hash value fields to generate corresponding index fields;

[0009] Iterate through each block on the blockchain in sequence, add the data to be queried into the index field, and store only the preset query information and the address of the query information on the blockchain in the index field;

[0010] Build context link fields between adjacent indexes;

[0011] By using a hash locking mechanism, each index record is bound to data related to the blockchain or transactions;

[0012] Multiple index records are stored in a form, and the corresponding data information is retrieved from the index table during a query.

[0013] In at least one possible implementation, retrieving the corresponding data information from the index table during the query includes:

[0014] When querying data, a hash value is generated based on the retrieved index information, and a first verification is performed against the hash value stored in the table:

[0015] If the first verification result is correct, then the index record is retrieved or the corresponding data is retrieved from the blockchain based on the index record, and then the context link field is checked.

[0016] If the first check result is an error or the context link field check fails, the index record will be rebuilt.

[0017] In at least one of the possible implementations, the methods for rebuilding the index include:

[0018] Retrieve the last index record from the index table and generate its corresponding hash value, which is then used for a second verification against the hash value in the index table.

[0019] If the second check result is different, then take the previous record in the index table and repeat the second check until the check is successful, and start rebuilding the index from the point where the check is successful.

[0020] If the second check result is the same, information is added from that index record to rebuild the index.

[0021] In at least one possible implementation, binding each index record to blockchain or transaction-related data includes:

[0022] The data to be added to the index field is concatenated into a string and hashed using a hash algorithm. At the same time, a digital signature hash value is generated using the node certificate and placed into the hash value field of the index field.

[0023] In at least one possible implementation, concatenating the data to be added to the index field into a string includes:

[0024] The values ​​of all fields except the hash value field are concatenated according to a preset format and converted accordingly based on the data type of the values.

[0025] In at least one possible implementation, the construction of the context link field between adjacent indexes includes:

[0026] Based on the number of transactions before the current block and the number of transactions in the current block, the indexed rows are linked vertically, line by line.

[0027] In at least one possible implementation, the algorithm for linking the indexed rows by row is as follows:

[0028] The sum of all transactions before the current block in the previous line and the total number of transactions in the current block is equal to the total number of transactions in the current block in the next line.

[0029] Secondly, the present invention provides a tamper-proof trusted index query device, comprising:

[0030] The index definition module is used to predefine indexes on the chain for querying data related to each block and transaction, and to add hash value fields to generate corresponding index fields;

[0031] The index information adding module is used to traverse each block on the blockchain sequentially, add the data to be queried into the index field, and store only the preset query information and the address of the query information on the blockchain in the index field;

[0032] The index linking module is used to build context link fields between adjacent indexes;

[0033] The index data binding module is used to bind each index record to data related to the blockchain or transactions using a hash locking mechanism;

[0034] The query index table module is used to store multiple index records in a form, and retrieve the corresponding data information by searching the index table during a query.

[0035] Thirdly, the present invention provides an electronic device, comprising:

[0036] One or more processors, a memory, and one or more computer programs, the memory being a non-volatile storage medium, wherein the one or more computer programs are stored in the memory, the one or more computer programs including instructions that, when executed by the device, cause the device to perform the method as described in the first aspect or any possible implementation thereof.

[0037] The main concept of this invention lies in, in addition to storing complete and reliable information about blocks and transactions on the blockchain, constructing indexes for blocks, transactions, accounts, contracts, etc., on the chain. These indexes only need to store information requiring rapid querying and the on-chain addresses of specific information, reducing database pressure and achieving real-time querying. A hash locking mechanism is used during index construction, and context links are established between adjacent index rows using field information. Hash locking and context linking mechanisms prevent index storage errors or tampering, binding the index to the blockchain or transaction information to ensure that data queried from the index is equally reliable. This invention, under the premise of security and reliability, solves the performance problems encountered in querying blockchain, transaction, account, and contract information with large amounts of data, improving the usability of the blockchain under large data volumes.

[0038] Furthermore, this invention also proposes a trusted, tamper-proof index query verification and reconstruction mechanism to ensure that if an index is tampered with, it can prompt the index anomaly and automatically rebuild the erroneous index.

[0039] Compared with existing methods, the solution of the present invention has at least the following advantages:

[0040] (1) When the amount of blockchain data is large, querying data in the traditional way requires traversing the entire blockchain sequentially, which takes a long time. However, by using the solution of this invention, an index is established to construct blocks, transactions, accounts, and contracts, thereby improving data query performance and achieving efficient real-time query results.

[0041] (2) The present invention only needs to save the index information of blocks, transactions, accounts and contracts. It prevents tampering through hash fields and context links, which is different from the previous method of saving all transaction information in blocks off-chain, thus greatly saving storage space.

[0042] (3) Hash locking is performed when building the index to bind the index with information such as blocks or transactions. At the same time, context linking is used to prevent the index data rows from being lost or tampered with, ensuring that the index is safe, authentic and trustworthy. Attached Figure Description

[0043] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described below with reference to the accompanying drawings, wherein:

[0044] Figure 1A flowchart illustrating an embodiment of the tamper-proof trusted index query method provided by the present invention;

[0045] Figure 2 A schematic diagram of an embodiment of the tamper-proof trusted index query device provided by the present invention;

[0046] Figure 3 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation

[0047] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0048] To address the aforementioned drawbacks, this invention proposes incorporating a tamper-proof hash field during index construction. Furthermore, the index information can include not only directly searchable information (essentially simple information to be queried) but also the location of the specific information to be queried within the blockchain. Additionally, linking adjacent indexes during index construction prevents index loss, malicious tampering, and other abnormal scenarios, improving the security of index data and thus enhancing the reliability of data queried from the index. Consequently, when querying blockchain information, since the index is bound to the blockchain or transaction information, directly accessing the index is equivalent to accessing the blockchain, achieving secure and rapid data retrieval. It should be noted that this invention can not only be used for indexing blocks, transactions, accounts, and contracts in general blockchain scenarios and enabling real-time queries, but also for secure, reliable, and rapid data processing in scenarios with large datasets.

[0049] Furthermore, when querying index information, this invention also proposes to perform data verification. If correct, the required index record is retrieved, or the corresponding detailed information is retrieved from the blockchain based on the index record, ensuring fast and secure data query. Then, a context link field check is performed. If the hash check fails or the context link check fails, the record is reconstructed to ensure the integrity, security, and trustworthiness of the index data.

[0050] Specifically, this invention proposes at least one embodiment of a tamper-proof trusted index query method, such as... Figure 1 As shown, it can specifically include:

[0051] Step S1: Predefine an index on the chain for querying data related to each block and transaction, and add a hash value field to generate the corresponding index field;

[0052] In addition to storing blockchain blocks and transaction data as raw data, custom indexes for blocks, transactions, accounts, and contracts are constructed. Taking the construction of a block index as an example: using the block number as the key, data that needs to be queried quickly, such as the version number, the number of all transactions before the current block, and the number of transactions in the current block, are used as the value. At the same time, an anti-tampering hash value field is added to generate the corresponding index fields.

[0053] In some preferred embodiments, the data contained in Value can not only be the data to be queried, but also the address number of a certain detailed information. For example, in the process of building a transaction index, the account name can be used as the key, and the specific transaction number related to the account can be stored in the blockchain in Value.

[0054] Step S2: Iterate through each block on the blockchain and add the data to be queried to the index field;

[0055] During the construction of the block index, each block on the blockchain can be traversed, and data that needs to be queried quickly, such as the block number, version number, the number of all transactions before the current block, and the number of transactions in the current block, can be added to the corresponding index table.

[0056] Step S3: Construct context link fields between adjacent indexes;

[0057] Context linking fields are constructed row by row. For example, in the block index, the number of all transactions before the current block and the number of transactions in the current block are used to link the index rows up and down. The sum of the number of all transactions before the current block and the number of transactions in the current block in the previous row is equal to the number of all transactions in the current block in the next row, so as to ensure the integrity of the index information and prevent the loss of information in a certain row.

[0058] Specifically, in conjunction with the aforementioned steps, during the data addition process, the number of all transactions before the current block is added to the number of transactions in the current block to form the number of all transactions before the current block in the next index, forming adjacent links between the indexes, thereby further improving the security of the index data.

[0059] Step S4: Using a hash locking mechanism, bind each index record to data related to the blockchain or transactions;

[0060] In practice, the data to be added to the index table can be concatenated into a string and hashed using hash algorithms, including but not limited to SHA256 and SM3. At the same time, a digital signature hash value is generated using the node certificate and placed into the hash value field, thus binding the index with blockchain or transaction information.

[0061] The string concatenation method and the calculation of the digital signature hash value can be found below, using the block index as an example:

[0062] The block index value is determined by the hash value, version number, the number of all transactions before the current block, and the number of transactions in the current block.

[0063] Valu6={"hash": "", "version": 1, "totalTxCount": 2000, "curTxCount": 1000};

[0064] Concatenate the values ​​of all fields except the hash value field according to the string format. If the value is an integer, convert it to a string. If the value is boolean, convert it to "true" / "false".

[0065] Add a "0x90" separator between the first field value and the second field value;

[0066] Add a "0x80" separator between the second and third field values;

[0067] No separator is needed between the third field value and the fourth field value, or between any two subsequent field values.

[0068] The splicing process is as follows:

[0069] S=string(V1)+”Ox90”+string(V2)+”0x80″+string(V3)+…+string(V n )

[0070] Where V1, V2, ..., V n The index is the specific value in Value, and string is used to convert numeric values ​​of different data types into string types.

[0071] The concatenated string is then encrypted using an algorithm such as SHA256 to calculate the digital signature hash value to be placed in the hash value field. The formula is as follows:

[0072] hash = sha256(S)

[0073] When the number of blocks in the blockchain exceeds the number of records in the current index form, index information that is not in the form can be added to the form to update the index, and the updated index information can be subject to the hash locking described above.

[0074] Step S5: Store the constructed multiple index records in a form for retrieving the corresponding data information during querying.

[0075] Specifically, when information needs to be queried, it is no longer necessary to traverse every block. Instead, the record value of the index table stored in the database is retrieved. If the value is the required information value, it is retrieved directly. If the value is the address number record value of a certain detailed information, the detailed information is retrieved from the blockchain based on the address number record value. This query method greatly improves the retrieval performance of the blockchain under the condition of large data volume.

[0076] When querying index information, this invention also proposes to perform data verification operations. Specifically, when querying data, a hash value is generated based on the retrieved index information, and a first verification is performed with the hash value stored in the table. If the first verification result is correct, the index record is obtained or the corresponding data is retrieved from the blockchain based on the index record, and then the context link field check is performed. If the first verification result is incorrect or the context link field check fails, the index is rebuilt to ensure that the data in the index record is complete, secure, and trustworthy.

[0077] Based on this, furthermore, when it is necessary to rebuild the index, the last index record in the index table (directory) can be retrieved and a corresponding hash value generated, which can be used for a second verification with the hash value in the form:

[0078] If the second verification result is different, it means that it has been tampered with. Take the previous record in the index table in turn for the second verification until the verification is successful, and rebuild the index from the point of successful verification.

[0079] If the second verification result is the same, it means that the reconstruction location has not been tampered with, so add an index record from that location and rebuild the form.

[0080] In summary, the main concept of this invention is to construct an index for blocks, transactions, accounts, contracts, etc., on the blockchain, in addition to storing complete and reliable information about blocks and transactions on the blockchain. The index stores only quick query information and the on-chain addresses of specific information, reducing database pressure and achieving real-time querying. A hash locking mechanism is used when constructing the index, and context links are established between adjacent index rows using field information. Hash locking and context linking mechanisms prevent index storage errors or tampering, binding the index to the blockchain or transaction information to ensure that data queried from the index is equally reliable. This invention, under the premise of security and reliability, solves the performance problems encountered in querying blockchain, transaction, account, and contract information under large data volumes, improving the availability of the blockchain under large data volumes.

[0081] Corresponding to the above embodiments and preferred solutions, the present invention also provides an embodiment of an anti-tampering trusted index query device, such as... Figure 2 As shown, it may specifically include the following components:

[0082] Index definition module 1 is used to predefine indexes on the chain for querying data related to each block and transaction, and to add hash value fields to generate corresponding index fields;

[0083] The index information adding module 2 is used to traverse each block on the blockchain in turn, add the data to be queried into the index field, and only store the preset query information and the address of the query information on the blockchain in the index field;

[0084] Index Linking Module 3 is used to build context link fields between adjacent indexes;

[0085] Index data binding module 4 is used to bind each index record to data related to the blockchain or transactions using a hash locking mechanism;

[0086] The query index table module 5 is used to store multiple index records in a form, and retrieve the corresponding data information by searching the index table during a query.

[0087] The above should be understood Figure 2 The division of components in the tamper-proof trusted index query device shown is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or physically separated. These components can be implemented entirely in software via processing element calls; entirely in hardware; or partially in software via processing element calls and partially in hardware. For example, a particular module can be a separate processing element or integrated into a chip within an electronic device. The implementation of other components is similar. Furthermore, these components can be fully or partially integrated together or implemented independently. During implementation, each step of the above method or each of the above components can be completed through integrated logic circuits in the hardware of the processor element or through software instructions.

[0088] For example, these components can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more Digital Signal Processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, these components can be integrated together to form a System-On-a-Chip (SOC).

[0089] Based on the above embodiments and preferred solutions, those skilled in the art will understand that, in actual operation, the technical concept involved in this invention can be applied to various implementation methods. The following embodiments are used as illustrative examples:

[0090] (1) An electronic device. The device may specifically include: one or more processors, a memory, and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the device, cause the device to perform the steps / functions of the foregoing embodiments or equivalent embodiments.

[0091] Specifically, the electronic device can be a computer-related electronic device, such as, but not limited to, various interactive terminals and electronic products, mobile terminals, etc.

[0092] Figure 3 The schematic diagram illustrates an embodiment of the electronic device provided by the present invention. Specifically, the electronic device 900 includes a processor 910 and a memory 930. The processor 910 and the memory 930 can communicate with each other via an internal connection to transmit control and / or data signals. The memory 930 stores computer programs, and the processor 910 retrieves and runs the computer programs from the memory 930. The processor 910 and the memory 930 can be combined into a single processing device, but more commonly they are independent components. The processor 910 executes the program code stored in the memory 930 to achieve the aforementioned functions. In specific implementations, the memory 930 can be integrated into the processor 910, or it can be independent of the processor 910.

[0093] In addition, to further enhance the functionality of the electronic device 900, the device 900 may also include one or more of the following: an input unit 960, a display unit 970, an audio circuit 980, a camera 990, and a sensor 901. The audio circuit may also include a speaker 982, a microphone 984, etc. The display unit 970 may include a display screen.

[0094] Furthermore, the aforementioned device 900 may also include a power supply 950 for providing electrical energy to various devices or circuits in the device 900.

[0095] It should be understood that the operation and / or function of the various components in the device 900 can be specifically referred to in the foregoing descriptions of the methods, systems, and other embodiments. To avoid repetition, detailed descriptions are appropriately omitted here.

[0096] It should be understood that Figure 3The processor 910 in the illustrated electronic device 900 can be a system-on-a-chip (SoC). The processor 910 may include a central processing unit (CPU) and may further include other types of processors, such as a graphics processing unit (GPU), which will be described in detail below.

[0097] In summary, the various processors or processing units inside the processor 910 can work together to implement the previous method flow, and the corresponding software programs of each processor or processing unit can be stored in the memory 930.

[0098] (2) A computer data storage medium storing a computer program or the aforementioned device, which, when executed, causes a computer to perform the steps / functions of the foregoing embodiments or equivalent embodiments.

[0099] In several embodiments provided by this invention, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer data storage medium. Based on this understanding, certain technical solutions of this invention, or the parts that contribute to the prior art, or parts of such technical solutions, can be embodied in the form of software products as described below.

[0100] It should be noted in particular that the storage medium may refer to a server or a similar computer device, specifically, that is, the aforementioned computer program or the aforementioned device is stored in the storage device of the server or similar computer device.

[0101] (3) A computer program product (which may include the above-mentioned device), which, when run on a terminal device, causes the terminal device to execute the anti-tampering trusted index query method of the foregoing embodiments or equivalent embodiments.

[0102] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the above implementation methods can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the above-mentioned computer program products may include, but are not limited to, APPs.

[0103] Continuing from the previous text, the aforementioned device / terminal can be a computer device, and the hardware structure of this computer device can specifically include: at least one processor, at least one communication interface, at least one memory, and at least one communication bus; the processor, communication interface, and memory can all communicate with each other through the communication bus. The processor may be a central processing unit (CPU), DSP, microcontroller, or digital signal processor, and may also include a GPU, an embedded neural network process unit (NPU), and an image signal processor (ISP). The processor may also include a specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. Furthermore, the processor may have the function of operating one or more software programs, which can be stored in a storage medium such as memory. The aforementioned memory / storage medium may include: non-volatile memory, such as a non-removable disk, USB flash drive, portable hard drive, optical disc, etc., as well as read-only memory (ROM), random access memory (RAM), etc.

[0104] In this embodiment of the invention, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects have an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.

[0105] Those skilled in the art will recognize that the modules, units, and method steps described in the embodiments disclosed in this specification can be implemented using electronic hardware, computer software, and a combination of electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention.

[0106] Furthermore, the modules and units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed in multiple places, such as nodes in a system network. Specifically, some or all of the modules and units can be selected to achieve the purpose of the above-described embodiments, depending on actual needs. Those skilled in the art can understand and implement this without any inventive effort.

[0107] The above description of the structure, features, and effects of the present invention is based on the embodiments shown in the figures. However, the above are only preferred embodiments of the present invention. It should be noted that the technical features involved in the above embodiments and their preferred methods can be reasonably combined and matched by those skilled in the art to form a variety of equivalent solutions without departing from or changing the design concept and technical effects of the present invention. Therefore, the present invention is not limited to the scope of implementation shown in the figures. Any changes made in accordance with the concept of the present invention, or modifications to equivalent embodiments, that do not exceed the spirit covered by the specification and figures, should be within the protection scope of the present invention.

Claims

1. A tamper-proof trusted index query method, characterized in that, include: On-chain predefines indexes for querying data related to each block and transaction, and adds hash value fields to generate corresponding index fields; Iterate through each block on the blockchain in sequence, add the data to be queried into the index field, and store only the preset query information and the address of the query information on the blockchain in the index field; Construct a context link field between adjacent indexes, including: linking the index rows up and down on a row-by-row basis based on the number of all transactions before the current block and the number of transactions in the current block. Specifically, the following algorithm is used: the sum of the number of all transactions before the current block in the previous row and the number of transactions in the current block is equal to the number of all transactions in the current block in the next row. By using a hash locking mechanism, each index record is bound to data related to the blockchain or transactions; Multiple index records are stored in a form, and the corresponding data information is retrieved from the index table during a query.

2. The tamper-proof trusted index query method according to claim 1, characterized in that, The process of retrieving the corresponding data information from the index table during a query includes: When querying data, a hash value is generated based on the retrieved index information, and a first verification is performed against the hash value stored in the table: If the first verification result is correct, then the index record is retrieved or the corresponding data is retrieved from the blockchain based on the index record, and then the context link field is checked. If the first check result is an error or the context link field check fails, the index record will be rebuilt.

3. The tamper-proof trusted index query method according to claim 2, characterized in that, Methods for rebuilding an index include: Retrieve the last index record from the index table and generate its corresponding hash value, which is then used for a second verification against the hash value in the index table. If the second check result is different, then take the previous record in the index table and repeat the second check until the check is successful, and start rebuilding the index from the point where the check is successful. If the second check result is the same, information is added from that index record to rebuild the index.

4. The tamper-proof trusted index query method according to claim 1, characterized in that, The process of binding each index record with blockchain or transaction-related data includes: The data to be added to the index field is concatenated into a string and hashed using a hash algorithm. At the same time, a digital signature hash value is generated using the node certificate and placed into the hash value field of the index field.

5. The tamper-proof trusted index query method according to claim 4, characterized in that, The step of concatenating the data that needs to be added to the index field into a string includes: The values ​​of all fields except the hash value field are concatenated according to a preset format and converted accordingly based on the data type of the values.

6. A tamper-proof trusted index query device, characterized in that, include: The index definition module is used to predefine indexes on the chain for querying data related to each block and transaction, and to add hash value fields to generate corresponding index fields; The index information adding module is used to traverse each block on the blockchain sequentially, add the data to be queried into the index field, and store only the preset query information and the address of the query information on the blockchain in the index field; The index linking module is used to build context linking fields between adjacent indices, including: linking the upper and lower index rows based on the number of all transactions before the current block and the number of transactions in the current block, using the following algorithm: the sum of the number of all transactions before the current block in the previous row and the number of transactions in the current block in the next row is equal to the number of all transactions in the current block in the next row. The index data binding module is used to bind each index record to data related to the blockchain or transactions using a hash locking mechanism; The query index table module is used to store multiple index records in a form, and retrieve the corresponding data information by searching the index table during a query.

7. An electronic device, characterized in that, include: One or more processors, a memory, and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the electronic device, cause the electronic device to perform the tamper-proof trusted index query method according to any one of claims 1 to 5.

8. A computer data storage medium, characterized in that, The computer data storage medium stores a computer program, which, when run on a computer, causes the computer to execute the tamper-proof trusted index query method according to any one of claims 1 to 5.