A dynamic index based on mercury commitment for keyword query and device

By constructing MM Tree and Verkle Tree using a dynamic indexing method based on mercury commitment, the problems of high retrieval overhead and insufficient privacy for frequently queried keywords in blockchain systems are solved, achieving efficient and verifiable queries across blocks and data privacy protection.

CN115858532BActive Publication Date: 2025-12-12CHANGSHA UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211624737.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-16
Publication Date
2025-12-12
Estimated Expiration
2042-12-16

AI Technical Summary

Technical Problem

Existing blockchain systems suffer from high retrieval costs, insufficient privacy, and difficulties in constructing dynamic indexes when querying frequently used keywords. In particular, in smart healthcare scenarios, malicious clients may obtain additional data information through multiple queries, and existing solutions have failed to effectively solve the problem of verifiable queries across blocks.

Method used

A dynamic indexing method based on mercury commitment is adopted. By constructing MM Tree and Verkle Tree, the location of data objects is estimated by using the historical frequency of keywords. Mercury vector commitment is used to generate soft commitments, reducing update overhead. The correctness and completeness of query results are verified by validation vector.

Benefits of technology

It enables efficient cross-block querying of data objects containing frequently used keywords, ensuring data privacy and verifiability of query results, while reducing retrieval overhead and update costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115858532B_ABST
    Figure CN115858532B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on mercury commitment key query dynamic index and device, can directly query all data objects of frequent keyword across block, and provide verification vector VO verification query result. When using mercury commitment to generate soft commitment, no specific information is bound, and malicious user cannot obtain additional information. Specifically, the structure and size of the dynamic index tree are predetermined, the number of related data objects is estimated using the historical frequency of keywords, and the leaf node position is reserved. Group the keywords and their data objects together, and the groups of the same keyword are adjacent, ensuring that the similarity of the keyword set under the node is maximized. Use historical data to initialize the tree structure, and update the original data with new data objects to avoid node splitting and merging. When a new data object is inserted, the vector commitment and membership proof of other nodes in the tree do not need to be updated, reducing the update overhead.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of blockchains, and particularly relates to a dynamic index for keyword query based on a mercury commitment and a device. BACKGROUND

[0002] A blockchain is a distributed shared ledger that stores and verifies data blocks in a chain-like data structure, and has characteristics such as decentralization, non-tamperability, traceability, and openness. A blockchain system ensures that honest nodes in the network have the same ledger through a peer-to-peer network and a consensus protocol, and uses technologies such as a hash algorithm, a timestamp, and a Merkle tree to protect the integrity and traceability of data. A blockchain stores the hash value of a previous block in a subsequent block, and if a transaction in a block is to be tampered with, the value of the block and all subsequent blocks need to be changed. However, due to the consensus protocol, it is impossible to control more than 51% of the computing power to arbitrarily tamper with transaction data, which ensures the non-tamperability of the blockchain. Due to these characteristics of the blockchain, it is widely used in many fields, such as the Internet of Things, medical health, financial systems, and information sharing.

[0003] Users can join the blockchain as nodes and save a complete blockchain ledger. The data on the blockchain is growing, and the storage overhead required is growing. To reduce the storage pressure of nodes, we use a hybrid storage model in which off-chain servers (SPs) and blockchains store data together, with SPs storing raw data and blockchains storing data hash values to reduce the storage data of the blockchain. When a user needs to query data on the blockchain, the user can send a query request to the SP. However, the SP is not trusted, and the SP may maliciously return incorrect and incomplete query results. Therefore, a verifiable data structure (ADS) needs to be constructed to be maintained by the SP and the blockchain to achieve verifiable query results. In our previous work, we designed a KVerkle tree for keyword query of encrypted data. In practical applications, some keywords are of great interest to many users and are therefore frequently queried. However, most verifiable query problems support querying all data within one or more blocks, and cross-block verifiable queries for frequently queried keywords have not been studied. For these keywords with high query frequency, the SP must traverse all locally stored blocks to retrieve data objects that match the query conditions every time a query request is received. On the other hand, transactions are constantly generated, and the number of blocks is constantly growing, so retrieving all blocks will result in a large overhead. Designing a verifiable query result for keywords with high query frequency can improve query efficiency and reduce retrieval overhead.

[0004] Consider the application of blockchain system to the smart medical scene. Each patient's medical record contains multiple keyword information (name, hospital, diagnosis, and region). For example, a doctor wants to query the medical records of patients diagnosed with "Corona virus" in the region "Hunan". The doctor can input the query q = <Hunan ^ Corona ^ viru>. The SP performs keyword search, and if there is data matching the request q, the detailed records of these data are returned. If not, return empty.

[0005] Currently, there are some works on verifiable query problems for blockchain. The existing scheme mainly designs an ADS to verify the integrity and correctness of the query results while reducing the data insertion overhead. C. Zhang et al. constructs an index for each keyword, so it does not need to consider the searchable problem. In addition to the root node, each node saves a data, so from top to bottom, new data is added layer by layer. The chameleon vector commitment is used to realize the verifiable search, and the trapdoor is used to update the vector members without changing the vector commitment. However, this method has the following problems: (1) The privacy concept is not considered in the chameleon vector commitment, and the malicious client may learn additional information about the vector from the proof and commitment; in our problem model, the data owner makes a profit by selling data, so the privacy of the data needs to be ensured. When a malicious user obtains the vector commitment and proof through multiple queries, he may learn additional information about the data; (2) There is no search key, so the searchable dynamic index construction problem is not solved. SUMMARY

[0006] In order to solve the problems in the existing scheme, the present application provides a dynamic index based on mercury commitment for keyword query and an apparatus, which realizes direct query of all data objects of frequent keywords across the region and provides verification of vector VO verification query result. The mercury commitment is constructed for zero-knowledge set, and no specific information is bound when the commitment is generated using the soft commitment, and the malicious user cannot obtain additional information. Specifically, the structure and size of the dynamic index tree are predetermined, the number of related data objects is estimated using the historical frequency of keyword occurrence, and the leaf node position is reserved. Group the keyword and its data objects, and the groups of the same keyword are adjacent, which ensures that the similarity of the keyword set under the node is maximized. The tree structure is initialized using historical data, and the original data is updated with new data objects to avoid node splitting and merging. The MM Tree is constructed using the mercury vector, and when a new data object is inserted, the vector commitment and member proof of other nodes in the tree do not need to be updated, reducing the update overhead.

[0007] In a first aspect of the present application, a dynamic index method based on mercury commitment for keyword query is provided, comprising the following steps:

[0008] The data owner calculates the number of times of keyword history query, the frequent keyword set of the current time slice and the history data set containing the frequent keyword;

[0009] The data owner calculates the frequent keyword similarity, and assigns a contained frequent keyword to each of the to-be-assigned history data, and the frequent keyword of the to-be-assigned history data is used to determine the optimal storage location where the to-be-assigned history data can be quickly queried;

[0010] The data owner calculates the storage group, and determines the number and capacity of the storage group according to the degree and the number of leaf nodes of the tree;

[0011] The data owner constructs an optimization objective function and a constraint condition, wherein the optimization objective function is:

[0012]

[0013] The constraint condition is: The constraint condition is: u The constraint condition is: u The constraint condition is: u The constraint condition is: u+1

[0014] The constraint condition is:

[0015]

[0016]

[0017] x ju ∈{0,1},j∈(1,p),u∈(1,Z)

[0018] The constraint condition is: ju The constraint condition is: j The constraint condition is: u The constraint condition is: j The constraint condition is: j

[0019] The data owner assigns the to-be-assigned history data to the corresponding storage group according to the optimization objective function and the constraint condition;

[0020] The SP combines the water vector commitment and the dynamic index tree to construct an MM Tree;

[0021] ​​The data owner computes the prime number matrix, hash value, soft commitment, and membership proof stored in each node of the tree;

[0022] For the historical dataset, SP generates an MM Tree using the Verkle tree construction method. Let n i Let n be a node, and S be the number of its child nodes; the node n i When it is a leaf node, it contains the data object's prime matrix, prime matrix hash value, data encryption value, and membership proof. The node n i When it is a non-leaf node, the data it contains is:

[0023] {M pos ,h pos C pos V pos ,τ par,j}

[0024] Wherein, the M pos For a prime matrix, the h pos The value obtained by hashing the prime matrix and hash values ​​of all child nodes of the node at position pos, wherein C is... pos and V pos By SCom PP (PRF(sk p The soft commitment pairs calculated from pos) are C pos V is not bound to specific vector data. pos Used to verify membership proof, the τ par,j It is by The calculated membership proof indicates that the node is the parent node n. par The j-th child node.

[0025] For SP data insertion, despite the use of an MM Tree structure, the data objects in the new time slice are complex. Therefore, a dynamic data insertion mechanism based on frequency estimation and two-end aggregation is designed. Let the keyword k... i The position assigned in N is The object of k will be from The position is stored from left to right; if there are other objects with different keys that need to be inserted into i(k), then... i These objects will be from The positions are stored starting from right to left.

[0026] SP generates validation vectors, which are divided into validation vectors for verifying the correctness and completeness of query results, and insertion vectors for inserting a new data object. MVkle dyn - The verification vector of a leaf node in a tree consists of two parts: a proof VO used to verify the correctness of the answer. part1a proof of validity VO to verify the completeness of the answer part2 The insertion verification vector UpdVO records the prime matrix and hash value of the inserted node and the prime matrix and hash value of the sibling node of all nodes on the tree path.

[0027] Query and verification, when the SP receives a query request q, if the frequent keyword is contained in q, the frequent keyword is retrieved in the dynamic index tree based on the mercury vector commitment. From the root node, if the prime matrix of the current node meets the query condition, further explore its subtree. The data requester receives the query result R(q) and the verification vector VO part1 , VO part2 After that, the correctness and integrity of the query result are verified.

[0028] The second aspect of the application provides a dynamic index device for keyword query based on mercury commitment, comprising:

[0029] A first calculation unit is used for the data owner to calculate the number of historical keyword queries, the frequent keyword set of the current time slice and the historical data set containing the frequent keyword;

[0030] A second calculation unit is used for the data owner to calculate the frequent keyword similarity and allocate a contained frequent keyword for each of the to-be-allocated historical data, and the frequent keyword of the to-be-allocated historical data is used to determine the optimal storage position of the to-be-allocated historical data which can be quickly queried;

[0031] A third calculation unit is used for the data owner to calculate the storage group, and the number and capacity of the storage group are determined according to the degree of the tree and the number of leaf nodes;

[0032] A fourth calculation unit is used for the data owner to construct an optimization objective function and a constraint condition, wherein the optimization objective function is:

[0033]

[0034] Wherein, the represents the maximum average similarity of the frequent keywords in each group and between adjacent groups under the condition that each group meets the storage capacity S, the u represents the serial number of the storage group, the Z represents the number of the storage groups, the Sim(g u ) represents the average similarity in the storage group g u , and the Sim(g u , g u+1 ) represents the average similarity between the storage groups.

[0035] The constraint condition is:

[0036]

[0037]

[0038]

[0039] wherein, the x ju represents when the data object o j is stored in the group g u , the K(o j ) represents the frequent keyword set contained by the data object o j ;

[0040] a historical data distribution unit, configured to distribute the to-be-distributed historical data to the corresponding storage group according to the optimization target function and the constraint condition by the data owner;

[0041] a fifth calculation unit, configured to calculate the prime matrix, hash value, soft commitment and membership proof stored by each node in the tree by the data owner;

[0042] a sixth calculation unit, configured to generate the MMTree according to the construction method of the Verkle tree by the SP according to the historical data set;

[0043] a seventh calculation unit, configured to insert the data record based on the dynamic data insertion mechanism of the frequency estimation and two-end aggregation by the SP;

[0044] an eighth calculation unit, configured to generate the verification vector by the SP, the verification vector is divided into the verification vector for verifying the correctness and integrity of the query result, and the insertion vector when a new data object is inserted;

[0045] a ninth calculation unit, configured to query and verify by the SP, the frequent keyword is retrieved in the MM Tree based on the mercury vector commitment, and the verification result is verified according to the query result and the verification vector.

[0046] In a third aspect, the application provides an electronic device, characterized in that: comprising at least one electronic computer, comprising at least one mobile communication device and a storage server connected with the electronic computer; the storage server stores a computer program that can be run by at least one electronic computer, and the program is executed by the at least one electronic computer to enable the at least one electronic computer to execute the above-mentioned dynamic index method for keyword query based on mercury commitment. BRIEF DESCRIPTION OF DRAWINGS

[0047] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the accompanying drawings in the embodiments.

[0048] Figure 1 is a system model diagram;

[0049] Figure 2Dynamic index construction provided for the embodiment of the present application;

[0050] Figure 3 Object allocation algorithm based on keyword similarity provided for the embodiment of the present application;

[0051] Figure 4 Gain algorithm based on provided for the embodiment of the present application;

[0052] Figure 5 MM dynamic index tree node provided for the embodiment of the present application;

[0053] Figure 6 MM dynamic index tree provided for the embodiment of the present application;

[0054] Figure 7 MVkle d yn-Tree dynamic insertion instance;

[0055] Figure 8 Structure diagram of electronic device provided for the embodiment of the present application. DETAILED DESCRIPTION

[0056] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the protection scope of the present application.

[0057] The present application will be described in detail from the following four aspects. 1) Introduce the blockchain system model in the present application; 2) The overall architecture of MM index; 3) The basic structure of frequent keyword dynamic index; 4) Dynamic index tree based on mercury vector commitment.

[0058] I. Blockchain system model

[0059] Before introducing the embodiments of the present application, the system model diagram is introduced first, referring to Figure 1 The system is composed of four parts. The data owner is the user who provides data; the data demander is the user who initiates data query; the SP is the off-chain server who provides query service and stores data encryption value; the blockchain is a distributed ledger who stores data hash value and provides data verification. Referring to Figure 1 The data owner sends encrypted data to the SP to construct a verifiable index structure, and sends data hash value to the blockchain to verify the query result. The data demander sends a query request to the data owner, and the data owner obtains a query matrix by encoding and encrypting it and then sends it to the SP, and the SP provides query service.

[0060] The data stored in SP is abstracted as a data object o = <id, M, Ek(data)>, where id is a unique identifier of the data record, M is an encoding encrypted prime matrix of the data record key set, and Ek(data) is an encrypted value of the data. The data owner sends the encrypted value of the data to the SP instead of the original data. The data stored in the blockchain is o = <id, M, hash(data)>, and the data owner sends the hash value hash(data) of the data to the chain. The data stored on the chain is tamper-proof, so storing the hash value not only reduces the storage overhead on the chain, but also verifies the correctness of the data object. The data requester sends a query request q to the data owner, and the data owner sends the encoding encrypted prime matrix M(q) to the SP for query, and the SP provides query service and returns the data record satisfying q. The query q is a disjunctive expression or a conjunctive expression of frequent keywords, for example , which represents a data set containing frequent keywords or . K q is the set of frequent keywords of q: Let K(o i ) be the set of frequent keywords of the data object o i . The query q is searched based on the verifiable index structure. R(q) is used to represent the data set matching the query q, and here the return is the encrypted value of the data; then The SP returns R(q) and VO SP to the data requester, and returns the identifier set ID of R(q) to the data owner. The data requester requests the block root node data from the blockchain as VO chain . The VO and VO chain are used together to verify the integrity and correctness of the query result R(q). The data owner sends the corresponding original data and public key in ID to the data requester, and the data requester encrypts the original data using the received public key. The encrypted data obtained is compared with R(q), and if they are the same, then the data owner has honestly sent the data with the identifier ID, and the data requester has indeed received the required original value of the data.

[0061] II. Overall architecture of MM index

[0062] Referring to Figure 2 , the timestamps are sequentially organized into time slices. In the t time slice, the blockchain node is based on the transaction data T t-1The frequent keyword set is counted, and the structure of the dynamic index tree is constructed. The blockchain nodes reach a consensus on the index tree structure (generate an index tree structure block), so that at the t+1 time slice, the blockchain nodes insert the data of the t+1 time slice into the leaf nodes according to the consensus index tree structure. It should be noted that the length of each time slice is determined according to the number of leaf nodes l, that is, the current The dynamic index construction includes three stages:

[0063] Transaction consensus stage: at the t-1 time slice, the blockchain nodes package the transactions in the transaction pool, generate a transaction block, determine the frequent keywords and the data objects containing the frequent keywords.

[0064] MM dynamic index tree construction: at the t time slice, the MM dynamic index tree structure is constructed according to the transactions of the t-1 time slice. The blockchain nodes reach a consensus on the index tree structure, generate an index tree block and chain it.

[0065] Index generation stage: at the t+1 time slice, the blockchain nodes perform online index construction on the data that arrives, insert it into the index tree of the structure determined in the previous stage, and generate an MM index tree. The end time of the time slice is the total number of insertions of the data objects containing the frequent keywords.

[0066] The index of the block follows the prime number coding Verkle tree structure, and the data is stored in the Verkle tree leaf node. The data owner initializes the MM dynamic index tree, and the SP constructs the MM dynamic index tree structure according to the tree node position and the parent-child relationship between the nodes locally. According to the frequent keyword set determined at the t time slice, the data objects are stored in the leaf nodes according to the data object allocation algorithm, and the prime number matrix and the hash value are generated from bottom to top until the root node. When new data arrives, the data objects are inserted into the leaf nodes of the MM dynamic index tree according to the dynamic insertion rule of the data. For the frequent keywords and the data objects containing the keywords that cannot be inserted into the MM tree, a small frequent keyword prime number coding Verkle tree is constructed according to the prime number coding Verkle tree structure.

[0067] III. Basic structure of the dynamic index of the frequent keywords

[0068] 1) Data object allocation problem of the dynamic index

[0069] In an embodiment of the present application, a data object allocation method of a dynamic index is provided. The method embodiment of the present application is used in the system model described above, and the method includes the following steps:

[0070] Step S100, the data owner calculates the number of historical keyword queries, the frequent keyword set of the current time slice, and the historical data set containing the frequent keywords.

[0071] Step S200: The data owner calculates the frequent keyword similarity and assigns a frequent keyword to each of the historical data to be assigned. The frequent keywords of the historical data to be assigned are used to determine the best storage location where the historical data to be assigned can be quickly queried.

[0072] Step S300: The data owner calculates the storage group and determines the number and capacity of the storage group based on the degree of the tree and the number of leaf nodes.

[0073] Step S400: The data owner constructs the optimization objective function and constraints, wherein the optimization objective function is:

[0074]

[0075] Among them, the Sim(g) represents maximizing the average similarity of frequent keywords within a group and between adjacent groups while satisfying the storage capacity S. Here, u represents the sequence number of the storage group, Z represents the number of storage groups, and Sim(g) represents the number of storage groups. u ) represents the storage group g u The average similarity within the Sim(g) range u ,g u+1 The number ) represents the average similarity between the storage groups;

[0076] The constraints are as follows:

[0077]

[0078] Indicates each group g u The number of stored data objects shall not exceed the storage capacity S;

[0079]

[0080] This means that the number of times the same data object is assigned across all groups is equal to the number of its associated frequent keywords |K(o j )|,|K(o j )| <Z;

[0081] x ju ∈{0,1},j∈(1,p),u∈(1,Z)

[0082] Indicates when data object o j Stored in group g u In the middle of the hour, x ju =1;

[0083] Step S500: The data owner allocates the historical data to be allocated to the corresponding storage group according to the optimization objective function and constraints.

[0084] In the above steps S100 to S500, the data owner first sets a storage capacity for the storage group, and the total number of all data records allocated to the storage group reaches the capacity, so that waste of storage space can be avoided. Then, an optimization objective function of maximizing the average similarity of frequent keywords in each group and between adjacent groups under the condition that the storage capacity S of each group is satisfied is defined, and then the allocation of data records is implemented, and the similarity of keywords is maximized under the condition that the storage capacity is satisfied.

[0085] The above steps S100 to S500 are fully described as follows:

[0086] There are l leaf nodes in the index tree, and the degree fanout of the tree is S, and all non-leaf nodes contain S child nodes. In order to facilitate allocation, the leaf nodes are grouped. The leaf nodes and all their sibling nodes are grouped into a group to build a parent node, and all the leaf nodes can be divided into Z=l / S groups. When a keyword k i becomes a frequent keyword, the data objects in the keyword set k i are allocated to the same group of the index tree for storage. Let O(k i ) be the data object set containing k i . Since the data objects are allocated according to the frequent keywords, the definition of the frequent keywords is given in the embodiment of the application.

[0087] Definition 1: The number of queries y i of a keyword k i is calculated through historical queries, and when y i ≥ζ, the keyword k i is a query frequent keyword, and a set K={k1,…,k m} is composed of m frequent keywords. For each frequent keyword k i , there are f i data objects in all blocks, and f i is the frequency of the keyword k i in the historical data.

[0088] Definition 2: Use O={o1,…,o p} to represent the set of data objects, where o j represents the jth data object. Each data object o j is associated with a keyword set, and if multiple keywords in the set are query frequent keywords, then o j is simultaneously present in the data object set of these frequent keywords, and the frequent keyword set of the data object o j is K(o j )={ki |k i ∈K}.

[0089] Definition 3: The similarity measurement method of this invention is similar to Hamming distance, which is the number of different elements at corresponding positions in two strings of equal length. Frequent keyword k i Encoded as vector v i Frequent keyword k j Encoded as vector v j Each vector has α elements. Compare v sequentially. i [r] and v j [r], 1≤r≤α, e i,j Let k be the number of distinct characters at its corresponding position. i and k j The similarity between them is sim i,j =e i,j / α, sim i,j The smaller the value, the better. i and k j The higher the similarity, the better.

[0090] In a dynamic index tree of degree S, we group all leaf nodes with the same parent node together to store data objects. The specific definition of a group is given below.

[0091] Definition 4: Using G = {g1, ..., g} Z} represents the ordered set of all groups in the index tree, where g u Let g represent the u-th group. The maximum number of items stored in each group is fixed at S, and each leaf node in a group stores one data object. u The collection of stored data objects is g u ={o1,…,o S Let data object o j In group g u The only known frequent keyword in the text is k. i <o j ,g u >,k i <o j ,g u >∈K(o j And k i <o j ,g u >≠k i <o j ,g v > The frequent keywords identified for the same data object differ across different groups. Group g u The set of frequent keywords is K(g) u )= Let kx , k y is the different frequent keywords in K(g u ), is the number of times of calculating the similarity of two different frequent keywords, so the average similarity in group g u is:

[0092]

[0093] The greater the average similarity of frequent keywords between adjacent storage groups, the higher the query efficiency. Let k x be the frequent keywords in K(g u ), k y be the frequent keywords in K(g u+1 ), |K(g u )||K(g u+1 )| be the number of times of calculating the similarity of two frequent keywords between groups, so the average similarity between groups is:

[0094]

[0095] Specifically, based on the above four definitions, the steps of the method embodiment are as follows:

[0096] The optimization objective function is constructed as:

[0097]

[0098] For formula (3), given the frequent keyword set K = {k1,…,k m}, the data object set O = {o1,…,o p}, the data object o j is associated with multiple frequent keywords, so the frequent keyword set of o j is K(o j ) = {k i |k i ∈K}, the ordered set of all groups in the index tree is G = {g1,…,g Z}, and the storage capacity of group g u is S. Therefore, the data object allocation problem is to allocate all data objects to G, and a data object is associated with multiple frequent keywords, so the same data object can be allocated to multiple groups. According to definition 3, the smaller the frequent keyword Hamming distance determined by different data objects between group g u and adjacent groups g u and g u+1 , the greater the average similarity, so the goal is to maximize the average similarity of frequent keywords within each group and between adjacent groups under the condition that the storage capacity S of each group is met.

[0099] The constraint condition is:

[0100]

[0101]

[0102] x ju ∈{0,1}, j∈(1,p), u∈(1,Z) (6)

[0103] Where, for formula (4): each group g u The number of stored data objects is not greater than the storage capacity S; for formula (5): the number of allocations of the same data object in all groups is equal to the number of its associated frequent keywords |K(o j )|, |K(o j )|<Z; for formula (6): when the data object o j is stored in the group g u , x ju =1.

[0104] After constructing the optimization objective function and the constraint condition in step S500, it is necessary to prove that the data object allocation problem based on maximum similarity proposed by the method is an NP difficult problem, so as to realize the solution.

[0105] Proof process: the generalized multiple assignment problem (GMAP) is a known NP difficult problem, we will reduce the generalized multiple assignment problem (GMAP) to a special case of the data object allocation problem based on maximum similarity, and prove that our problem is an NP difficult problem. A generalized multiple assignment problem of fixed size can be described as follows: given a set of n items IT={it1,it2,…,it n}, the weight of each it i is w i and a set of agents A={a1,a2,…,a m} with m. The capacity of each agent a j is t j . The cost of assigning it i to a j is c ij , and the item it i can be assigned to a i r times. The solution is the assignment from the item to the agent, so that:

[0106]

[0107]

[0108]

[0109] x ij ∈{0,1}, (i=1,…,n; j=1,…,m;) (10)

[0110] For a given GMAP instance, we can transform it in polynomial time into an instance of a data object assignment problem based on maximum similarity: the item it in the GMAP instance. i Mapped to data object o j And agent a j Corresponding storage group g u Assuming all data objects o j If the weight is 1, then it i weight w i Corresponding data object o j The weight; Agent a j capacity t j Corresponding storage group g u The maximum number of storage objects S; in our problem, due to the data object o j Existence |K(o) j A storage group can only store one frequent keyword for a data object. This is to ensure that the data object... j Every frequent keyword can appear in the text, therefore o j Must be assigned to |K(o) j In each storage group, this constraint is used... It means that x ju =1 indicates that the data object o j Assigned to storage group g u Therefore, |K(o) j | Corresponding item 'it' in the GMAP instance i The number of times it can be repeatedly assigned r i .

[0111] Since our goal is to calculate the average similarity within groups, Sim(g) u Sim(g) function and inter-group average similarity u ,g u+1 The function, according to formulas (1) and (2), allocates data objects o each time. j Give g u This will change Sim(g) u ) and Sim(g u ,g u+1 Value; assuming data object o j Not assigned to g u At that time, the average similarity within a group and between adjacent groups were Sim′(g) and Sim′(g) respectively. u ) and Sim′(g u ,g u+1Sim(g u ) u Sim(g u+1 ,g j ) are the average similarity of the data objects o u in the group g j after the assignment, and the change of the objective function is ρ ju = Sim(g u )+ Sim(g u ,g u+1 )-(Sim'(g u )+ Sim'(g u ,g u+1 )), and ρ ju is exactly the cost c i generated by the assignment of the item it j to the agent a ij .

[0112] By the above mapping, the optimization objective of the GMAP instance is consistent with the special case of our problem, and thus the data object assignment problem with maximum similarity is NP-hard.

[0113] 2) Data object assignment method

[0114] Specifically, the embodiments of the present application provide the following two methods for assignment calculation:

[0115] The first method is a key similarity-based object assignment algorithm:

[0116] The data object assignment problem based on maximum similarity is NP-hard, so only an approximate solution can be found for the data object assignment. The optimization objective is to maximize the average similarity of frequent keys within and between adjacent groups, and a most direct idea is to preferentially select data objects containing the same key and assign them to the same storage group. If the data objects of the key are all assigned or the capacity of the storage group reaches the threshold, the data object containing the key with maximum similarity is selected for further assignment.

[0117] As shown in Algorithm 1, first, the keys in K are sorted according to the number of data objects associated with them (line 1). If K is not empty, the storage groups in G = {g1,..., g Z} are assigned keys in turn (lines 2-3). k is used to save the currently selected key to be assigned. If k has no specified value, let k be the key in the current sequence K with the maximum |O(k i | (line 4). When |g u | < S, the object-key pair containing k is assigned to g u(5, 6). If the number of objects containing k is not enough, select the frequent keyword k with the largest similarity to the current keyword i Assignment is done (7-8). Since k always holds the keyword to be assigned, if the current group g u is full, there are still objects in O(k) to be assigned, which will be assigned to g u+1 in the next round (3). Finally, return the set of groups G (10).

[0118]

[0119] Time complexity analysis: The time cost of sorting all keywords in line 1 is O(mlogm). The cost of line 9 is O(m 2 ). So the total time complexity is O(n+m 2 ).

[0120] For better understanding, a specific example is given. Refer to Figure 3 , the number of groups is 3, and the maximum capacity of a group is 3. g i represents the i-th assigned group. The set of data objects O = {o1, o2, o3, o4}, and the set of frequent keywords K = {k1, k2, k3, k4}, where k1 = "brand", k2 = "grand", k3 = "brandy", k4 = "brown". The similarity between keywords is calculated using Hamming distance: Sim(k1, k2) = 0.67, Sim(k1, k3) = 0.84, Sim(k1, k4) = 0.34, Sim(k2, k3) = 0.67, Sim(k2, k4) = 0.17, Sim(k3, k4) = 0.34. The object-keyword pairs are stored in the set Λ = {<o1, k1>, <o1, k3>, <o2, k3>, <o2, k4>, <o3, k2>, <o3, k4>, <o4, k1>, <o4, k3>}, and the keyword k3 with the largest frequency in K is selected for assignment. g1 = {<o2, k3>, <o4, k3>, <o1, k3>}. |g1| = 3, so the keyword k4 = "brown" with the largest similarity to k3 is selected for assignment, g2 = {<o3, k4>, <o2, k4>}. |g2| < 3, and the keyword k1 = "brand" with the largest similarity to k4 is selected for assignment, g2 = {<o3, k4>, <o2, k4>, <o4, k1>}. |g2| = 3, and the data objects containing k1 are assigned to g3, g3 = {<o1, k4>}. There are no data objects containing k1 in Λ, so the keyword k2 = "grand" with the largest similarity to k1 is selected for assignment, g3 = {<o1, k1>, <o4, k2>}. The total similarity gain of this assignment is 3.125.

[0121] The second method is to solve the problem based on a gain-based object allocation algorithm:

[0122] The optimization objective is to maximize the average similarity of frequent keywords within and between adjacent groups, while also meeting the maximum capacity requirement of each storage group. Keyword similarity-based algorithms only consider the similarity between the selected data object and the currently chosen frequent keyword, without considering the total similarity of keywords across the entire storage group. Therefore, we propose a gain-based algorithm. Assume that storage group g is selected... i Data objects are assigned based on keyword similarity, let g be assigned to g. i Data object-key pair <o j ,k i >. Use Δsim to represent the allocation of o. j Give g i The additional average similarity of keywords within and between adjacent groups (hereinafter referred to as total similarity):

[0123]

[0124] When the basic storage units of data objects are the same, prioritizing data objects with larger Δsim values ​​helps to maximize the overall similarity while ensuring the storage capacity threshold is met.

[0125] Theorem 2: In the s-th step, the data object o i Assigned to group g u In the middle, the total frequent keyword similarity is the maximum. If in step s+1, the data object o t Assigned to group g j In the middle, then o i and o t It contains the same frequent keywords. Proof: Data object o i Assigned to group g u In the context of frequent keywords, the average similarity of deltsim keywords is... max Maximum. i The frequent keyword is k′, and the group is g. u The number of frequent keywords is r = |K(g) u At this time Maximum. t The most frequent keyword is k t o t Assigned to group g j The average similarity of the total frequent keywords is When o i and o t The keywords in the text are different. When o i and o to t contain the same frequent key k i , because o t is assigned to the storage group g u with the maximum average similarity of total frequent keys in the group, we can get

[0126]

[0127] In summary, for the s-th step, data objects o i are assigned to the storage group g u , and for the s+1-th step, data objects o t are assigned to the storage group g j , o i and o t contain the same frequent key.

[0128] According to Theorem 2, if a data object-key pair is selected at the s-th step, the data object containing the key will also be selected at the s+1-th step; therefore, the keys are assigned continuously. We propose a gain-based greedy algorithm, which selects the key k with the maximum Δsim at each step, and then assigns the data objects O(k) containing k continuously. Algorithm 2 describes the gain-based data object assignment algorithm; the algorithm steps are similar to Algorithm 1. If K is not empty, the storage groups in G = {g1,..., g Z} are assigned keys in turn (lines 1 and 2). k is used to hold the key that should be assigned. If k has no specified value, k is set to the key with the maximum Δsim value (line 3). When |g u | < S, the object-key pair containing k is assigned to g u (line 4-7). If the number of objects containing k is not enough, the key k i with the maximum Δsim value is selected to be assigned (lines 8-9). Since k always holds the key to be assigned, if there are still objects in O(k) that have not been assigned after the current group g u is complete, the assignment will continue in g u+1 (line 2). Finally, the storage group set G is returned (line 10).

[0129]

[0130] Time complexity analysis: Line 9 requires selecting the key with the maximum total gain, and therefore the time cost is O(m 2 ). Therefore, the total time complexity is O(n+m 2 ).

[0131] For the sake of understanding, a specific example is given here. Refer to Figure 4 , the same data as in Figure 3 is used. First, the storage group g1 is selected, |g1| < 3 and After the keyword k3 with the largest frequency is selected and stored in g1, the total similarity is 1, so the assigned frequent keyword is determined to be k3. The data object-keyword pairs <o1, k3>, <o2, k3> and <o4, k3> are stored in g1. Since g1 is full, the keyword with the largest gain is searched for and stored in g2. k4 is stored in g2, Δsim = -0.42, and the data object-keyword pairs containing k1 are assigned, g2 = {<o1, k1>, <o4, k1>}. Since O(k1) only contains two data objects o1 and o4, g2 has a total of 3 nodes; the keyword with the largest gain is searched for and stored in g2, k2 is stored in g2, Δsim = 0.58. The data object-keyword pairs containing k2 are assigned, g2 = {<o1, k1>, <o4, k1>, <o3, k2>}. Since g2 is full and there are no data object-keyword pairs containing k2, the storage group g3 is selected, the keyword k4 is assigned, and g3 = {<o2, k4>, <o3, k4>}. The total gain of the assigned keywords is 3.67.

[0132] Four, dynamic index tree based on mercury vector commitment

[0133] The mercury vector commitment and the dynamic index tree are combined, and the dynamic index tree based on the mercury vector commitment is proposed. The data owner uses the soft commitment in the mercury vector commitment to generate a soft commitment pair for each node, and the soft commitment pair is not bound to any specific information. When the jth element in the vector is updated, the soft commitment pair of the vector will not change, and only a new membership proof τ par,j is generated. Therefore, the new data object is inserted into the leaf node, and all the nodes on the tree path of the node do not need to update the vector commitment, and all the child nodes of each ancestor node do not need to update the membership proof. Compared with the traditional vector commitment, the use of the mercury vector commitment reduces the update overhead.

[0134] The dynamic index tree based on the mercury vector commitment is a q-ary tree, and all data is stored in the leaf nodes. The leaf node contains a data object prime matrix, a prime matrix hash value, a data encryption value and a membership proof. Referring to Figure 5 , the structure of a non-leaf node located at pos in the index tree is composed of 5 parts: {M pos ,h pos ,C pos ,V pos ,τ par,j}. Among them, the M pos is a prime matrix, the h posThe value obtained by hashing the prime matrix and hash values ​​of all child nodes of the node at position pos, wherein C is... pos and V pos By SCom PP (PRF(sk p The soft commitment pair calculated from pos) is C pos Without being bound to specific vector data, the Vpos is used to verify membership proofs, and the τ par,j It is by SOpen PP (j,C pos ,S,aux par The calculated membership proof indicates that the node is the parent node n. par The j-th child node.

[0135] It can be noted that the soft commitment pair for each node is predetermined by the node's position `pos`. During the new data object insertion phase, the soft commitment pairs remain unchanged, but membership proofs can be generated for the new data object. To prevent untrusted third parties from returning incorrect query results, data requesters can use the soft commitment pairs and membership proofs to verify the correctness of the query results.

[0136] refer to Figure 6 , Figure 6 (b) shows the index tree based on mercury vector commitment. When a data object is inserted into node n9, if the prime matrix stored in the node remains unchanged, the new data is directly stored in n9, and then the membership proof τ is calculated. 12,3 ( Figure 6 (b) dashed circle); if the stored prime matrix changes, the node data that needs to be recalculated is the shaded part in the diagram, and the updated part includes the member proof τ in n9. 12,3 n 12 M in 12 and h 12 n 13 The prime matrix M in 13 and h 13 For Verkle trees using traditional vector commitments, when a data object is inserted into node n9, the nodes within the dashed box need to be updated. The update includes n 12 The prime matrix M in 12 h 12 C 12 and τ 13,3 The members in n9 prove τ 12,3 And τ in n7 12,1 τ in n8 12,2 n 13 M in 13 h 13 and C 13 n 10τ in 13,1 and n 11 τ in 13,2 (like Figure 6 (a) is shown.

[0137] 1) Insertion of data objects in dynamic scenarios

[0138] In dynamic scenarios, the insertion of data objects, despite the design of a dynamic index tree structure, presents complex challenges due to the intricate nature of data objects within new time slices. Typical special cases include the following:

[0139] ① Given a frequent keyword, the number of data objects containing that frequent keyword may be more than expected, and there is no suitable storage location for the extra objects;

[0140] ② Given a frequent keyword, the number of data objects containing that frequent keyword may be less than expected, which will result in the waste of the original storage space;

[0141] ④ New frequent keywords have appeared, and obviously these new frequent keywords have not been assigned a position in the original index structure.

[0142] To address this, a dynamic data insertion mechanism based on frequency estimation and two-end aggregation is designed. Let the keyword k... i The position assigned in N is k i The object will be from The positions are stored from left to right; if other objects with different keys need to be inserted into S(k)... i These objects will be from Positions are stored starting from right to left. Specifically, insertion of S(k)... i The data objects on the right include two types: the first is a new frequent keyword k. new The object, the second type S(k) i The keyword k on the right j The object. Where k j Objects inserted into S(k) i In ) if and only if S(k j The location ) contains all the data objects. Here, k new Or k j Objects inserted into S(k) i When these objects arrive, proceed in the order they arrived. Start storing.

[0143] For the new frequent keyword k new It is necessary to determine which keyword it can replace. On the one hand, k new and k iHaving a certain degree of similarity is beneficial for index building and facilitates keyword searching. On the other hand, the group has enough space to store k. new This allows for full utilization of leaf nodes for storage. Therefore, we select the corresponding k based on similarity and the number of remaining positions within the group. i Assume k new Let p be the proportion of related objects. Calculate the confidence interval using interval estimation of the total proportion. p approximately follows a normal distribution, with a mean equal to the total proportion π and a standard error equal to π / 2. Therefore, the standardized random variable of the sample proportion follows a normal distribution, that is: Thus, the confidence interval for the overall proportion π at the 1-α confidence level is: We use the lower bound π of the confidence interval lowr To estimate k in n leaf intervals new Minimum number of leaf nodes required: π lowr ·n. Therefore, the sum of k is selected. new The original frequent keywords k with an approximation degree above the threshold i Let k i S(k) i The number of leaf nodes that currently have no stored data is m′. Choose |π. lowr The S(k) with the smallest nm′| value i ) is used to store k new The object.

[0144] Based on the above rules, S(k) i ) is used to store k i The object may also store a new key and an object containing the right-hand key. For any existing frequent key k i Its objects may be stored in S(k) i It may also be stored in S(k) i The preceding sequence S(k) i ) - If both sequences above are full, then a small index tree will be generated for these unstoreable data objects, following the Verkle tree structure for prime number encoding.

[0145] To facilitate understanding, a concrete example is provided here. (Reference) Figure 7 The set of prime numbers P = {2, 3, 5, 7, 11, 13, 17, 19, 23} has a prime number matrix with 6 elements. In the dynamic index tree, the position assigned to the frequent keyword k1 = "brand" is S(k1) =<n1,n2,n3,n4,n5> k1 is encoded as a prime matrix The position of k2 = "brandy" is S(k2) =<n6,n7,n8,n9> k2 encoding is a prime matrix New data<o1,k1> Stored in n1, data<o2,k2> Stored in n6. The new frequent key k3 = "grand", k3 is encoded as a prime matrix. The similarity between k3 and both k1 and k2 exceeds the threshold of 0.6, and the proportion of k3 in the historical data is... Standard error is The 95% confidence interval is [0.19, 0.31]. Based on the lower limit of the confidence interval of 0.19, estimate the minimum required... In the leaf nodes, when k3 becomes a new frequent key, m′1 = 4 in S(k1) and m′2 = 3 in S(k2), through |π lowr ·nm′| Calculates the new data containing k3 and stores it in the allocation location of k2.<o3,k3> Stored to n9, n9, n 12 and n 13 The prime number matrix and hash value in the node are recalculated. When<o6,k2> Upon arrival, there is no storage space left in S(k2). According to the dynamic insertion rule,<o6,k2> Insert into the allocated position n5 of k1, n5, n 11 and n 13 The prime number matrix and hash value in the nodes are recalculated. After all 9 leaf nodes are full, newly arriving data objects generate a small prime number matrix Verkle tree structure according to the method in Section 4.

[0146] 2) Dynamic index tree initialization and data insertion

[0147] The data owner first generates a public key pair pk and a private key pair sk, as well as a PRF key sk. p Then, starting from the bottom up, new nodes are created for the non-leaf nodes located at pos, and the position of the parent node is obtained to generate membership proofs for the new nodes. The data owner first assigns the position pos of the new node, and then calculates the soft commitment pair (C) based on pos and the key. pos V pos Then, locate the parent node's position `par` and its corresponding index `j`, and determine whether a soft commitment pair has been generated at `par`. If not, first calculate the parent node's soft commitment pair (C). par V par ) and auxiliary information aux par Use aux par Calculate the new node n pos Member proof τ par,j , used to prove n pos is n par The j-th child node. (Cpos V ops ), τ par,j (C) par V par Send it to SP. Light nodes only store the M of the root node. t h t and (C) t V t ), where M t and h t Used to verify data integrity, (C t V t This is used to verify the correctness of the data. As shown in Algorithm 3. Figure 6 Middle node n 10 For example, the node initialization process involves first generating the PRF key and public parameter PP, and then calculating node n based on position 10. 10 Soft commitments and auxiliary information (C 10 V 10 ),aux 10 Obtain node n. 10 The parent node is at position 13, and it is the first child node of the parent node. Determine the position of n. 13 No soft commitment pair was generated at position 13. Node n was generated based on position 13. 13 Soft commitments and auxiliary information (C 13 V 13 ),aux 13 ), then generate n 10 Member proof τ 13,1 Finally, (C) 10 V 10 ), τ 13,1 (C) 13 V 13 Send to SP.

[0148] After the data owner sends the initialization information for all non-leaf nodes in the dynamic index tree to the SP, the SP constructs an MVKle locally. dyn -Tree. SP uses the aforementioned frequent key allocation algorithm to assign frequent keys and historical data objects to leaf nodes based on historical data. Then, based on the prime number matrix stored in the leaf nodes, it calculates the prime number matrix and hash value of each node from bottom to top, completing the dynamic index tree initialization. Finally, it sets the root node's M... t h t and (C) t V t Submit to the blockchain.

[0149]

[0150] When new data arrives, SP inserts the new data object into the MVkle dyn -Tree's leaf node according to the insertion rule. The position of insertion is determined according to the frequent keywords contained in the data. Then the prime matrix and data encryption value in the data object are stored in the leaf node. The membership proof and the prime matrix of the ancestor node are calculated.

[0151] MVkle dyn -Tree index tree, the soft vector commitment pair (C i , V i ) and the proof τ par,j are determined when the node is created and will not change subsequently. However, after the data object is inserted into the leaf node, the prime matrix and hash value used for searching and verification of the ancestor node may need to be updated. This is because the prime matrix of the parent node is the Hadamard product of the prime matrices of all child nodes: The hash value is related to the prime matrix and hash value of all child nodes: h par = hash (M1|h1|…|M q |h q ). The prime matrix is used to search and verify the integrity of the result, and the hash value is used to verify the correctness of the prime matrix. Therefore, when the prime matrix of the inserted data object is inconsistent with the prime matrix originally stored in the leaf node, the prime matrix M par of the parent node needs to be updated. In addition, M and h of the nodes along the path from n i to the root node root also need to be updated accordingly. Since the prime matrix and hash value of the root node have changed, the corresponding light node also needs to update the maintained prime matrix M t and hash value h t . If the M t and h t of the root node have changed, call algorithm 4 to generate an insertion verification vector UpdVO to record the prime matrix and hash value of the inserted node and the prime matrix and hash value of the sibling nodes of all nodes on the tree path, and send UpdVO to the smart contract. After the smart contract receives UpdVO, the smart contract first verifies whether the prime matrix and hash value of the new data are consistent with the data owner. Then, according to the prime matrix and hash value in UpdVO, the root hash is reconstructed from bottom to top, and compared with the root hash stored on the chain. If they are consistent, the correctness of the index tree structure is verified, and then the prime matrix of the new data object is used to replace the original prime matrix of the inserted node to generate a new root hash layer by layer.

[0152]

[0153] For ease of understanding, a specific example is provided here. Referring to Figure 7When data object o4 is stored in the dynamic index tree according to the frequent key k3, the insertion node is first located as n8. The root node prime number matrix M... 13 With hash value h 13 The situation has changed. Therefore, the prime number matrix and hash values ​​originally stored in n8 will be...<M(k2),h(M(k2))> Add to UpdVO, then add the prime number matrix and hash values ​​of all sibling nodes of n8.<M(k2),h(M(k2)),M(k3),h(M(k3))> Add to UpdVO. Obtain the value of n8's parent node as n. 12 , will n 12 Prime number matrix and hash values ​​of all sibling nodes <M 10 ,h 10 M 11 ,h 11 Add to UpdVO. SP will add UpdVO and new data o4.<M(k3),h(M(k3))> Send to the smart contract.

[0154] After receiving UpdVO, the smart contract first verifies the correctness of the new data M(k3) and h(M(k3)), and then reconstructs the root hash by calculation. First, M is calculated. 12 =M(k2)°M(k2)°M(k3), h 12 = h(M(k3))|M(k2)|h(M(k3)). Then calculate the root hash h(M). 10 |h 10 |M 11 |h 11 |M 12 |h 12 The integrity of UpdVO is verified by comparing it with the root hash stored on the chain. Then, the original stored value of n8 is replaced with M(k3) and h(M(k3)), and the new root node prime matrix and hash value are calculated.

[0155] 3) Verify the generation of vectors

[0156] MVkle dyn - The verification vector of a leaf node in a tree consists of two parts: a proof VO used to verify the correctness of the answer. part1 Proof (VO) used to verify the completeness of the answer part2 To verify node n pos The correctness of the data objects (membership verification) will be verified from the root node to node n. pos Information on the tree path is inserted into the verification vector VO part1 The root node is inserted into C. i and V i Insert C into the middle node i Vi and τ par,j , leaf node insert Ek(i),τ par,j . To verify the integrity of the data object of node n pos , all the M pos and h i of all the sibling nodes of each node on the tree path of n i must be added to the verification vector VO part2 , and the prime matrix M t and hash value h t of the root node are calculated by layer-by-layer aggregation of the Merkle tree. SP adds the current timestamp to VO part2 each time it generates the verification vector VO part2 . Through the timestamp, the light node can correctly judge the verification vector and the corresponding prime matrix of the query result. Referring to Figure 6 , the verification vector of node n6 includes the correctness proof VO part1 and the integrity proof VO part2 . VO part1 is {C 13 , V 13 , C 11 , V 11 , τ 13,2 , Ek(6),τ 11,3}. The membership is verified from bottom to top according to the soft commitment pair and the membership proof in VO part1 . τ 11,3 proves that Ek(6) is the third element in the vector of n 11 , that is, n6 is the third child node of n 11 , and τ 13,2 proves that C 11 is the second element in the vector of root node n 13 , that is, n 11 is the second child node of n 13 . VO part2 is {M4, h4, M5, h5, M6, h6, M 10 , h 10 , M 12 , h 12}, and the prime matrix M part2 and hash value h 13 are calculated recursively from bottom to top according to the prime matrix and hash value in VO 13 . Finally, the calculated M t , h t and accepted C t are compared with the root node data stored locally by the data requester to complete the verification.

[0157] For ease of understanding, a specific example is provided here. The query request clause sent by the data requester is q = grand, encoded as M(q) = [17 7 11 5 13 0] T . After the SP receives M(q), the query result R(q) = <Ek(8), Ek(9)> is obtained. Referring to Figure 7 , the verification vector of the query result R(q) includes the correctness verification vector VO part1 13 13 13,3 12 12 12,2 12,3 part2 10 10 11 11

[0158] 4) Query and verification

[0159] When the SP receives the query request q, if the frequent keyword is contained in q, the frequent keyword is retrieved in the dynamic index tree based on the mercury vector commitment. Starting from the root node, if the prime matrix of the current node meets the query condition, its subtree is further explored. In addition, the corresponding vector commitment pair (C i i ) and the membership proof τ par,j are added to VO part1 . On the other hand, if the prime matrix does not meet the query condition, it means that there is no matching node in the subtree of this node, and the corresponding prime matrix M i and the hash value h i are added to VO part2 . When the leaf node is reached, the data object whose prime matrix meets the query condition is returned as the query result R(q).

[0160] After the data requester receives the query result R(q) and the verification vectors VO part1 , VO part2 , the correctness and integrity of the query result are verified. As shown in Algorithm 5, VO part2 is calculated layer by layer from bottom to top until the prime matrix M t and the hash value h t of the root node are calculated. Then M t , h t ​​​​​​​​​​​​​​The query results are compared with the locally stored prime number matrix and hash value of the root node to verify their completeness (lines 1-4). First, the locally stored root node vector commitment and VO are used. part1 C in t Compare (line 5). If they match, then use the data encryption values ​​Ek(d) and τ from R. par,j and VO part1 Use SVE from bottom to top PP (C pos ,j,(C par V par ),τ par,j Verify membership relationships to prove the correctness of the query results (lines 6-8).

[0161]

[0162] To facilitate understanding, a concrete example is provided here. The light node receives the validation vector VO, which is the query result R(q). part1 and VO part2 Verify the completeness and correctness of the query results using R(q) and VO. part1 The data in the table is verified from bottom to top for correctness. This is done using Ek(8) and C... 12 V 12 ,τ 12,2 It can be verified that n8 is n 12 The second child node, via Ek(9) and C 12 V 12 ,τ 12,3 It can be verified that n9 is n 12 The third child node of C, and Ek(8) and Ek(9) have not been tampered with. 12 and C 13 V 13 ,τ 13,3 It can be verified that n 12 It is the third child of the root node and has not been tampered with. First, verify the VO. part2 Determine if the prime matrices M8 and M9 satisfy the query request, and then calculate the Hadamard product M′ of M7, M8, and M9. 12 =[6 7], h′ 12 = hash(M7|h7|M8|h8|M9|h9). Based on M 10 M 11 and M′ 12 Calculate the Hadamard product M′ of the root node. t Hash value h′ t =hash(M 10 |h 10 |M 11 |h 11 |M′12 h' 12 ). The M' is compared with the M stored in the local according to the timestampe in the verification vector. t h' t and the M stored in the local. t h t to verify the integrity of the query result.

[0163] The experimental results are provided below:

[0164] Experimental platform (environment): The hardware environment of the experiment is AMD Ryzen 7 5800H with Radeon Graphics 3.20GHz, and the RAM is 16.0GB PC, and the operating system is Windows 10. Java language is used for writing, and a block is constructed for all data.

[0165] Experimental data: In order to simplify the experimental process, the data packaged by the block can be randomly generated by using the code, and the keyword data set used for testing is 10000 most commonly used English words of Google.

[0166] Comparison algorithm: The Merkle hash tree, KVerkle tree and dynamic MM tree are compared. For each index, the index tree construction algorithm, query algorithm, result verification algorithm and data insertion algorithm are compared.

[0167] Performance indicators: Storage overhead and time overhead are used as evaluation indicators. The storage overhead includes the memory occupied when constructing the index tree and the size of the verification vector. The time overhead includes: the time overhead of constructing the index tree, the time overhead of querying the data in the block, the time overhead of verifying the query result, and the time overhead of inserting new data. For each experiment, we randomly generate 20 experimental results and report the average results.

[0168] Parameters: The influence of the number of test data and the fan-out of the tree on the performance indicators. The number of transactions is [64, 128, …, 8192, 16383], and the default value is 1024. The fan-out of ADS is [2, 4, 8, …, 1024], and the fan-out of Merkle hash tree is determined as 4. In order to compare fairly, we set the default value of the fan-out of other ADS to 4.

[0169] Reference Figure 8The application further provides an electronic device, which comprises an electronic computer, a mobile communication device, a storage server, and a computer program stored in the storage server and executable on the electronic computer. The electronic computer runs the computer program to implement the above-mentioned dynamic index based on the mercury commitment and oriented to the key query and stored in the storage server. The mobile communication device can send a computer executable query instruction to the electronic computer through network communication, and the electronic computer executes the query operation on the storage server.

Claims

1. A method for dynamic index of key query based on mercury commitment, characterized in that The method comprises the following steps: calculating the number of historical query of keywords, the frequent keyword set of the current time slice and the historical data set to be allocated containing the frequent keyword; calculating the frequent keyword similarity, and allocating a contained frequent keyword to each historical data to be allocated, the frequent keyword of the historical data to be allocated being used to determine the best storage location where the historical data to be allocated can be quickly queried; calculating the storage group, and determining the number and capacity of the storage group according to the degree and the number of leaf nodes of the tree; constructing an optimization objective function and a constraint condition, the optimization objective function being: wherein the represents maximizing the average similarity of frequent keys within and between adjacent groups under the condition that each group satisfies the storage capacity S, the u represents the serial number of the storage group, the Z represents the number of the storage groups, the Sim(g u ) represents the average similarity within the storage group g u , and the Sim(g u , g u+1 ) represents the average similarity between the storage groups. the constraint condition being: x ju ∈{0,1}, j∈(1,p),u∈(1,Z) wherein the x ju represents the data object o j whether stored in the group g u , the x ju = 1 when stored, the K(o j ) represents the frequent keyword set contained in the data object o j ; allocating the historical data to be allocated to the corresponding storage group according to the optimization objective function and the constraint condition. 2.The method for dynamic index of key-value query based on mercury commitment according to claim 1, wherein, According to the optimization objective function and the constraint condition, the data record to be allocated is allocated to the corresponding storage group by a greedy algorithm. 3.The method for dynamic index of key-value query based on mercury commitment according to claim 2, wherein, The greedy algorithm comprises any one of an object allocation algorithm based on the keyword similarity and a keyword allocation algorithm based on the gain. 4.The method for dynamic index of key-value query based on mercury commitment according to claim 3, wherein, The allocation of the data record to be allocated to the corresponding storage group further comprises: participating in the allocation of the data record to be allocated according to the current remaining capacity of the storage group until the storage capacity of the storage group is full. 5.The method for dynamic index of key-value query based on mercury commitment according to claim 4, characterized in that, The method comprises the following steps: combining the Mercury vector commitment and the dynamic index tree to propose an MM Tree; The data owner calculates the data of each node in the dynamic index tree, and the leaf node contains a prime matrix of data objects, a prime matrix hash value, a data encryption value and a membership proof, and the non-leaf node structure at the pos in the tree is composed of five parts: {M pos ,h pos ,C pos ,V pos ,τ par,j} Wherein, the M pos is a prime matrix, the h pos is a value obtained by hashing the sum of the prime matrices and the hash values of all child nodes of the node at pos, the C pos and V pos are a soft commitment pair calculated by SCom PP (PRF(sk p , pos)), C pos is not bound to specific vector data, V pos is used to verify the membership proof, and the τ par,j is a membership proof calculated by , indicating that the node is the jth child node of the parent node n par . 6.The method for dynamic index of key-value query based on mercury commitment according to claim 5, wherein, After obtaining the data stored in the node in the tree, the method further comprises: The SP constructs the whole tree from bottom to top according to the preset rule. 7.The method for dynamic index of key-value query based on mercury commitment according to claim 6, wherein, Inserting a data record, designing a dynamic data insertion mechanism based on frequency estimation and two-end aggregation according to the typical situation of the data object in the new time slice, and inserting the data object into the index tree according to the dynamic insertion mechanism; The soft vector commitment pair (C i , V i ) and the proof τ par,j of each node in the index tree are determined when the node is created and will not change subsequently, but when the prime matrix of the inserted data object is inconsistent with the prime matrix originally stored in the leaf node, the prime matrix M par of the parent node needs to be updated; Along n i M and h of the nodes on the path to the root node root need to be updated accordingly, since the prime matrix and hash value of the root node have changed, the corresponding light nodes also need to update the maintained prime matrix M t and hash value h t . 8.The method for dynamic index of key-value query based on mercury commitment according to claim 6, wherein, The verification vector generation, the verification vector of the leaf node includes two parts: a proof VO for verifying the correctness of the answer part1 , a proof VO for verifying the integrity of the answer part2 The insertion verification vector UpdVO records the prime matrix and hash value of the inserted node and the prime matrix and hash value of the sibling nodes of all nodes on the tree path, and sends the UpdVO to the smart contract. 9.The method for dynamic index of key-value query based on mercury commitment according to claim 6, wherein, When the SP receives a query request q, if the q contains a frequent keyword, the frequent keyword is searched in the dynamic index tree based on the Mercury vector commitment, starting from the root node, if the prime matrix of the current node meets the query condition, the sub-tree thereof is further explored, and when the leaf node is reached, the data object whose prime matrix meets the query condition is returned as the query result R(q) and the verification vector.

10. A device for dynamic indexing of key-based queries based on a mercury commitment, characterized in that, The method comprises: a first calculation unit configured to calculate the number of historical query of keywords, the frequent keyword set of the current time slice and the historical data set to be allocated containing the frequent keyword; a second calculation unit configured to calculate the frequent keyword similarity, and allocate a contained frequent keyword to each historical data to be allocated, the frequent keyword of the historical data to be allocated being used to determine the best storage location where the historical data to be allocated can be quickly queried; a third calculation unit configured to calculate the storage group, and determine the number and capacity of the storage group according to the degree and the number of leaf nodes of the tree; a fourth calculation unit configured to construct an optimization objective function and a constraint condition, the optimization objective function being: wherein the represents maximizing the average similarity of frequent keys within and between adjacent groups under the condition that each group satisfies the storage capacity S, the u represents the serial number of the storage group, the Z represents the number of the storage groups, the Sim(g u ) represents the average similarity within the storage group g u , the Sim(g u , g u+1 ) represents the average similarity between the storage groups; the constraint condition being: x ju ∈ {0,1}, j e (1, p), u e (1, Z) wherein the x ju indicates when the data object o j is stored in the group g u , the K(o j ) indicates the set of frequent keywords contained by the data object o j . a historical data distribution unit configured to distribute the to-be-distributed historical data to the corresponding storage groups according to the optimization objective function and the constraint condition; a fifth calculation unit configured to calculate the prime matrix, hash value, soft commitment and membership proof stored in each node in the tree; a sixth calculation unit configured to generate an MM Tree according to the construction method of the Verkle tree according to the historical data set; a seventh calculation unit configured to insert a data record based on a frequency estimation and a dynamic data insertion mechanism of two-end aggregation; an eighth calculation unit configured to generate a verification vector, the verification vector being divided into a verification vector for verifying the correctness and integrity of a query result and an insertion vector for inserting a new data object; a ninth calculation unit configured to query and verify, retrieve a frequent keyword in the MM Tree based on the mercury vector commitment, and verify the result according to the query result and the verification vector.

11. An electronic device, comprising: at least one electronic computer, at least one mobile communication device, and a storage server connected to the electronic computer; the storage server stores a computer program executable by the at least one electronic computer, and the program is executed by the at least one electronic computer to enable the at least one electronic computer to perform the mercury commitment-based keyword query dynamic indexing method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Space keyword query method based on social perception in distributed environment

    CN108932347A

  • Method and System for Fuzzy Keyword Search Over Encrypted Data

    US20200125563A1