Customer order record query system based on block chain capacity expansion technology
By using a multidimensional index building module, a range query optimization module, and a relational query module, combined with multidimensional hash functions, interval trees, and Bloom filters, the problem of a single blockchain indexing mechanism is solved, enabling fast and accurate order record queries and improving query efficiency and resource utilization.
Patent Information
- Application Number
- CN202510784746.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-11-07
AI Technical Summary
The existing blockchain indexing mechanism is relatively simple and cannot quickly perform complex customer order record queries, especially multi-attribute range queries and related queries, resulting in low query efficiency.
It employs a multidimensional index building module, a range query optimization module, and a relational query module, and combines multidimensional hash functions, interval trees, and Bloom filters to achieve fast location and accurate query.
It significantly improves query efficiency, reduces resource consumption, and meets the order management and analysis needs in complex business scenarios.
Smart Images

Figure CN120910150A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of blockchain expansion, in particular to a customer order record query system based on a blockchain expansion technology. BACKGROUND
[0002] Since the birth of the blockchain, with the characteristics of decentralization, non-tamperability and traceability, the blockchain has shown great application potential in many fields such as finance and supply chain. However, with the explosive growth of users and business volume, the expansion problem is becoming increasingly prominent. For example, Bitcoin is limited by a 1M block size and can only process about 3 transactions per second. In the face of a large number of pending transactions, network congestion is likely to occur. Ethereum is slightly better and can process 15-30 transactions per second. However, it is still difficult to meet the growing demand. If the expansion problem is not solved, the promotion of the blockchain in large-scale application scenarios will be seriously hindered.
[0003] The existing Chinese patent with the publication number CN119624590A discloses an order data processing method and system based on a blockchain. By acquiring multi-source order data sets and performing transaction address analysis, the source and receiving location of the order can be comprehensively understood, ensuring the accuracy and comprehensiveness of the order processing process. Low-frequency orders are processed on the chain to ensure data transparency and non-tamperability, while high-frequency orders are processed through off-chain intelligent elastic rectification to optimize transaction processing efficiency and response speed. This processing strategy greatly improves the processing capacity of high-frequency transactions while ensuring the security of low-frequency transactions. Through bidirectional time sequence synchronization of order transactions, the order and integrity of transaction data are ensured, data loss and duplication are avoided, and the consistency and accuracy of transactions are improved.
[0004] The existing index mechanism of the blockchain is relatively simple and mostly supports data retrieval based on block numbers, block hashes or transaction hashes. When complex queries such as range queries or association queries based on multiple attributes of orders are needed, the data cannot be quickly located through the index, but the entire blockchain structure or a large amount of off-chain index data needs to be traversed, which consumes a lot of time and resources and leads to low query efficiency.
[0005] Therefore, a customer order record query system based on a blockchain expansion technology is needed. SUMMARY
[0006] The technical problem to be solved by the application is to overcome the defects of the prior art. The application provides a customer order record query system based on a blockchain expansion technology to solve the problem of the relatively simple index mechanism of the blockchain in the prior art, which mostly supports data retrieval based on block numbers, block hashes or transaction hashes.
[0007] To solve the above technical problems, the technical scheme adopted by the present application is: a customer order record query system based on blockchain expansion technology, comprising a multi-dimensional index construction module: for combining the multiple attributes of an order for index, mapping the order attributes to a multi-dimensional index space through a specific multi-dimensional hash function, and realizing fast positioning query based on multiple attributes of the order; A range query optimization module: when introducing data, using the existing attribute index in the multi-dimensional index, constructing a special data structure for range query, storing the attribute range information of the order into the interval tree through the construction of the interval tree and the Bloom filter, and adding the range information into the Bloom filter; The method of combining interval tree and Bloom filter is used for range query, the multi-dimensional index is used for quickly positioning the range that may contain the required order data, unnecessary queries are reduced, the interval tree is used for storing the range information of the order attribute, the Bloom filter is used for quickly judging whether a certain range may contain the required order data, the time and resource consumption required for query are significantly reduced under the premise of ensuring the accuracy of the query, and the query efficiency is improved; An association query module: obtaining the attribute information of the order from the multi-dimensional index, abstracting the attribute information of the order into a graph structure, constructing an adjacency matrix A, and starting from the starting order node, using a breadth-first search algorithm to find related orders in the graph; The related orders are found through the graph traversal algorithm, the association relationship between the orders can be effectively mined, the query demand for order association information in complex business scenarios is met, the order set within a specific order amount and order time range can be quickly screened out through the multi-dimensional index, and then the interval tree and the Bloom filter are used for further accurate query.
[0008] The multi-dimensional index construction module comprises an attribute extraction unit, a parameter setting unit, an index calculation unit and an index storage unit; The attribute extraction unit: accurately extracts multiple attribute values for constructing the multi-dimensional index from the order data stored in the blockchain, such as order amount, order time, customer ID and other key attributes, ensures the integrity and accuracy of the data, and provides a reliable data source for subsequent index calculation; The parameter setting unit: is responsible for selecting a hash function suitable for the performance and security requirements of the system, determining the weight coefficient corresponding to each attribute according to the importance evaluation of the business scenario, and reasonably setting the size of the multi-dimensional index space according to the system storage capacity and performance expectation, to provide parameter support for the effective operation of the multi-dimensional hash function; The index calculation unit: uses the parameters determined in the parameter setting unit, accurately calculates the index value corresponding to each order according to the formula of the multi-dimensional hash function, and realizes the mapping and conversion of the order data to the multi-dimensional index space; Index storage unit: the calculated index value is associated with the corresponding order data, which can be stored in a database or a specific file storage structure, to ensure the correspondence between the index value and the order data is accurate and error-free, facilitating subsequent quick retrieval of order data based on the index.
[0009] The multi-dimensional hash function formula in the index calculation unit is: wherein is the n attribute values of the order, is a function for hashing the i-th attribute value, is a weight coefficient, used to adjust the importance of each attribute in the index according to business needs, is the size of the multi-dimensional index space, which realizes efficient mapping of order attributes to index values and lays the foundation for fast query.
[0010] The polynomial hash function formula in the index calculation unit is: wherein, is the i-th attribute value of the order, such as order amount, customer ID, these attribute values will participate in the hash calculation, different attribute values determine the final hash value through specific calculation rules, is a function for hashing the i-th attribute value, is a weight coefficient, p is a prime number, which plays a key role in hash calculation, the purpose of selecting a prime number is to make the hash value distribution more uniform and reduce the possibility of hash collision, common values are 31 or 131, these prime numbers have been proven to effectively optimize the performance of the hash function to some extent in practical applications, to avoid hash collision, usually a larger prime number is selected, i is the index of the attribute, from 1 to n, used to distinguish different attributes, it is part of the exponent in the calculation, giving different weights to attributes in different positions, so that each attribute contributes differently to the hash value, is the size of the hash table, used to limit the range of hash values, the hash value will eventually be modulo, the result will fall between 0 and ( - 1), which facilitates mapping the hash value to a specific location in the hash table for storage or lookup.
[0011] Interval tree is constructed to store the range information of order attributes, and its construction process is based on recursive construction of order attribute ranges sorted by starting value; After sorting these ranges by starting amount, an interval tree is constructed, so that when querying orders in a certain amount range, the tree structure can be quickly located.
[0012] The Bloom filter calculates the bit array length and the number of hash functions of the Bloom filter according to the initialization unit of the Bloom filter, the false positive rate allowed by the system and the order data volume, and completes the initialization of the bit array, and the judgment formula is: There can be Wherein, bit is the bit array of the Bloom filter, is the result of the hash processing of the i-th hash function on the query range .
[0013] The association query module comprises a graph structure construction unit and a graph traversal execution unit, the graph structure construction unit is used for defining each order as a node in the graph structure, and the graph traversal execution unit is used for starting from a starting node, performing traversal in the graph structure according to a selected traversal algorithm, finding order nodes having an association relationship with the starting node, and returning the traversal result to the user in a format meeting business requirements.
[0014] The adjacency matrix A of the graph is defined as: .
[0015] The starting node positioning unit of the order is used for quickly positioning the starting order node of the association query with the aid of the index result of the multi-dimensional index construction module.
[0016] The graph structure construction unit extracts key attribute information from the multi-dimensional index, accurately constructs order nodes and the edge relationship between the nodes, and stores the adjacency matrix A.
[0017] The graph traversal execution unit can start from the starting node and expand layer by layer according to the selected breadth-first search until the finding of all associated order nodes is completed or the deep-first search algorithm is used to explore along a path, accurately traverse the graph structure from the starting order node, find all associated order nodes, and return the result to the graph structure construction unit.
[0018] Compared with the prior art, the application has the following beneficial effects: The customer order record query system based on the blockchain expansion technology provided by the application has a multidimensional index construction module, which can quickly locate order data through multi-attribute combined index and speed up the query, and each unit cooperates to ensure accurate and efficient index construction, and a range query optimization module, which can greatly reduce the query time and resource consumption by combining the multidimensional index results with interval trees and Bloom filters, efficiently processing range queries while ensuring accuracy, and an association query module, which can use multidimensional index information to construct a graph structure, store association relationships through an adjacency matrix, and effectively mine order associations using a graph traversal algorithm to meet complex business needs, and each module cooperates with each other to improve the blockchain order query performance from different dimensions, not only optimizing the query efficiency, but also enhancing the support capability for complex query scenarios, providing enterprises with more efficient and accurate order management and analysis tools, and helping enterprises improve the operation decision-making level. BRIEF DESCRIPTION OF DRAWINGS
[0019] The disclosure of the application will be described with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only. They are not intended to limit the scope of protection of the application. In the drawings, the same reference signs are used to refer to the same parts. Among them Fig. 1 The flowchart of the customer order record query system based on the blockchain expansion technology according to an embodiment of the application is schematically shown; Fig. 2 The flowchart of the multidimensional index construction module according to an embodiment of the application is schematically shown; Fig. 3 The flowchart of the association query module according to an embodiment of the application is schematically shown. DETAILED DESCRIPTION
[0020] It is easy to understand that, according to the technical solution of the application, those skilled in the art can propose a variety of structures and implementation methods that can be replaced with each other without changing the essential spirit of the application. Therefore, the following specific embodiments and drawings are only exemplary descriptions of the technical solution of the application, and should not be considered as the whole or as a limitation or restriction on the technical solution of the application.
[0021] In order to further understand the content of the application, the application will be described in detail in conjunction with the drawings.
[0022] Embodiment one As Figs. 1-3 shown, the following preferred technical solutions are provided: A customer order record query system based on a blockchain expansion technology includes a multidimensional index construction module: for combining multiple attributes of an order for combined indexing, mapping order attributes to a multidimensional index space through a specific multidimensional hash function, and realizing fast positioning query based on multiple attributes of the order; Range query optimization module: when introducing data, use the existing attribute index in the multi-dimensional index to construct a special data structure for range query, store the attribute range information of the order in the interval tree through the construction of interval tree and Bloom filter, and add the range information to the Bloom filter; The interval tree and Bloom filter are combined to perform range query, the multi-dimensional index is used to quickly locate the range that may contain the required order data, unnecessary queries are reduced, the interval tree is used to store the range information of the order attribute, the Bloom filter is used to quickly judge whether a certain range may contain the required order data, the time and resource consumption required for query are significantly reduced under the premise of ensuring the accuracy of the query, and the query efficiency is improved; Correlation query module: obtain the attribute information of the order from the multi-dimensional index, abstract the attribute information of the order into a graph structure, construct an adjacency matrix A, and start from the starting order node to find related orders in the graph using a breadth-first search algorithm; The graph traversal algorithm can effectively mine the association relationship between orders and meet the query demand for order association information in complex business scenarios. The multi-dimensional index can be used to quickly filter out the order set within a specific order amount and order time range, and then the interval tree and Bloom filter are used for further accurate query.
[0023] The multi-dimensional index construction module includes an attribute extraction unit, a parameter setting unit, an index calculation unit, and an index storage unit. The attribute extraction unit accurately extracts multiple attribute values used to construct the multi-dimensional index from the order data stored in the blockchain, such as order amount, order time, customer ID, and other key attributes, to ensure the integrity and accuracy of the data and provide reliable data source for subsequent index calculation; The parameter setting unit is responsible for selecting a hash function suitable for system performance and security requirements, determining the weight coefficient corresponding to each attribute according to the importance evaluation of the business scenario, and reasonably setting the size of the multi-dimensional index space according to the system storage capacity and performance expectation, to provide parameter support for the effective operation of the multi-dimensional hash function; The index calculation unit uses the parameters determined in the parameter setting unit to accurately calculate the index value corresponding to each order according to the multi-dimensional hash function formula, to realize the mapping and conversion of order data to the multi-dimensional index space; The index storage unit stores the calculated index value and the corresponding order data in association, which can be stored in a database or a specific file storage structure to ensure the accuracy of the correspondence between the index value and the order data, and facilitate subsequent quick retrieval of order data based on the index.
[0024] The multi-dimensional hash function formula in the index calculation unit is: wherein n is the number of attributes of the order, f is a function for hashing the i-th attribute value, w is a weight coefficient for adjusting the importance of each attribute in the index according to business needs, is the size of the multi-dimensional index space, which realizes efficient mapping of order attributes to index values and lays the foundation for fast query; The operation steps of the multi-dimensional hash function formula are as follows: Step 1: According to the system requirements and data characteristics, select a suitable hash function , determine the weight coefficient of each attribute , and the size of the multi-dimensional index space ; Step 2: For each attribute of the order , use the selected hash function to calculate its hash value ; Step 3: Multiply the hash value of each attribute by the corresponding weight coefficient to get the weighted hash value ; Step 4: Add the weighted hash values of all attributes to get the sum Step 5: Take the modulus of the sum with the size of the multi-dimensional index space to get the final hash value ; The multi-dimensional hash function needs to use an external hash function to calculate the hash of each attribute value, and then multiply it by the weight coefficient for weighted summation, which means that the calculation of the multi-dimensional hash function depends on the performance and characteristics of the selected external hash function. This function is more suitable for processing complex data objects with multiple attributes, such as records in a database or order data in a blockchain. It can better adapt to the characteristics and importance of different attributes by selecting appropriate external hash functions and weight coefficients, thereby improving the accuracy and efficiency of hashing, and is suitable for scenarios with high data processing requirements.
[0025] The interval tree is constructed to store the range information of the order attributes, and its construction process is based on the recursive construction of the order attribute range after sorting by the starting value; After sorting these ranges by the starting amount, an interval tree is constructed, which enables quick positioning in the tree structure when querying orders within a certain amount range.
[0026] The Bloom filter calculates the allowed false positive rate of the system and the order data volume according to the initialization unit of the Bloom filter, determines the bit array length and the number of hash functions of the Bloom filter, and completes the initialization of the bit array, and the judgment formula is: There can be Wherein, bit is the bit array of the Bloom filter, is the result of the hash processing of the i-th hash function on the query range .
[0027] The association query module includes a graph structure construction unit and a graph traversal execution unit. The graph structure construction unit is configured to define each order as a node in a graph structure. The graph traversal execution unit is configured to start from a starting node, perform traversal in the graph structure according to a selected traversal algorithm, find order nodes having an association relationship with the starting node, and return the traversal result in a format meeting a business requirement to a user.
[0028] The adjacency matrix A of the graph is defined as: .
[0029] For orders having a starting node positioning unit, the index result of the multi-dimensional index construction module is used to quickly position the starting order node of the association query.
[0030] The graph structure construction unit extracts key attribute information from the multi-dimensional index, accurately constructs order nodes and edge relationships between the nodes, and stores the adjacency matrix A.
[0031] The graph traversal execution unit can start from the starting node and expand layer by layer according to a selected breadth-first search until the finding of all associated order nodes is completed, or can perform in-depth exploration along a path according to a depth-first search algorithm. The graph traversal execution unit accurately traverses in the graph structure from the starting order node, finds all associated order nodes, and returns the result to the graph structure construction unit.
[0032] Embodiment two As shown in the formula of the polynomial hash function: Fig. 2 Wherein, is the i-th attribute value of the order, for example, order amount, customer ID, and these attribute values will participate in the hash calculation, and different attribute values jointly determine the final hash value through a specific calculation rule, is a function for performing hash processing on the i-th attribute value, is a weight coefficient, p is a prime number, which plays a key role in hash calculation, the purpose of selecting a prime number is to make the hash value distribution more uniform and reduce the possibility of hash collision, common values are 31 or 131, these prime numbers have been proved to be effective in optimizing the performance of the hash function to a certain extent in practical application, and are used to avoid hash collision, usually a larger prime number is selected, i is the index of the attribute, from 1 to n, used to distinguish different attributes, it is part of the exponent in the calculation, and different weights are given to the attributes in different positions, so that the contribution of each attribute to the hash value is different, is the size of the hash table, used to limit the range of the hash value, the hash value will eventually be mapped to a specific position in the hash table for storage or lookup, mod, the result will fall between 0 and ( - 1), which is convenient for mapping the hash value to a specific position in the hash table for storage or lookup; The operation steps of the polynomial hash function are as follows: Step 1: Set a variable with an initial value of 0 to store the final hash value calculation result, in the subsequent calculation, this variable will continuously accumulate the calculation value corresponding to each attribute; Step 2: Start from the first attribute value , and sequentially perform the following operations on each attribute value: Calculate : multiply the current attribute value by the (i-1)th power of p, for example, when i = 1, calculate , since the 0th power of any number is 1, so the result is just itself; when i = 2, calculate , that is times p; Step 3: Add the above calculation result to the initial set hash value variable; The polynomial hash function directly uses the attribute value for calculation, and gives different weights to different attributes through different powers of prime number p, the calculation process is relatively simple and direct, and does not need additional hash function to preprocess the attribute value, which is suitable for the scene of hash calculation on simple data structure or small data set, for example, hash on string or simple integer sequence, its calculation speed is faster, and it does not need additional complex hash function, which is more suitable for some cases with high performance requirements and small data size.
[0033] The technical scope of the present application is not limited to the content in the above description, and those skilled in the art can make various modifications and changes to the above embodiments without departing from the technical idea of the present application, and these modifications and changes should all belong to the protection scope of the present application.
Claims
1. A customer order record query system based on a blockchain expansion technology, characterized in that: Comprising A multi-dimensional index construction module: for combined indexing of multiple attributes of orders, mapping order attributes to a multi-dimensional index space through a multi-dimensional hash function, realizing positioning query of multiple attributes of orders; A range query optimization module: using the existing attribute index in the multi-dimensional index, constructing the data structure of range query, storing the attribute range information of orders into the interval tree through constructing the interval tree and the Bloom filter, and adding the range information into the Bloom filter; An association query module: obtaining the attribute information of orders from the multi-dimensional index, abstracting the attribute information of orders into a graph structure, constructing an adjacency matrix A, and starting from the starting order node, using the breadth-first search algorithm to find related orders in the graph structure. 2.The blockchain-based capacity expansion technology-based customer order record query system according to claim 1, characterized in that: The multi-dimensional index construction module includes an attribute extraction unit, a parameter setting unit, an index calculation unit, and an index storage unit; The attribute extraction unit extracts multiple attribute values for constructing a multi-dimensional index from order data in a blockchain; The parameter setting unit selects a hash function according to system performance and security requirements, and determines the weight coefficient corresponding to each attribute; The index calculation unit calculates the index value corresponding to the order by using the parameters in the parameter setting unit through the hash function; The index storage unit stores the calculated index value and the corresponding order data in association. 3.The blockchain-based capacity expansion technology-based customer order record query system according to claim 2, characterized in that: The hash function in the index calculation unit includes a multi-dimensional hash function, and the formula of the multi-dimensional hash function is: ; wherein, is an n-tuple of attribute values of the order, is a function that hashes the i-th attribute value, is a weight coefficient, is the size of the multi-dimensional index space. 4.The blockchain-based capacity expansion technology-based customer order record query system according to claim 2, characterized in that: The hash function in the index calculation unit includes a polynomial hash function, and the formula of the polynomial hash function is: ; wherein, is the i-th attribute value of the order, is a function that hashes the i-th attribute value, p is a prime number and i is the index of the attribute, is the size of the hash table. 5.The blockchain-based capacity expansion technology-based customer order record query system according to claim 1, characterized in that: The interval tree is used to store the range information of order attributes, and the construction process is recursively constructed based on the ordering of the starting value of the order attribute range. 6.The blockchain-based capacity expansion technology-based customer order record query system according to claim 1, characterized in that: The Bloom filter uses its own initialization unit to calculate the allowed false positive rate of the system and the order data volume to determine the length of the bit array and the number of hash functions of the Bloom filter, and completes the initialization of the bit array. Its judgment formula is: may exist ; Where bit is the bit array of the Bloom filter. It is the i-th hash function for the query range The result of hash processing. 7.The blockchain-based capacity expansion technology-based customer order record query system according to claim 1, characterized in that: The association query module includes a graph structure construction unit and a graph traversal execution unit; The graph structure construction unit defines each order as a node in the graph structure; The graph traversal execution unit starts from the starting node, traverses the graph structure according to the traversal algorithm, finds the order nodes associated with the starting node, and arranges the traversal results. 8.The blockchain-based capacity expansion technology-based customer order record query system according to claim 6, characterized in that: The adjacency matrix A of the graph structure is defined as: 。 9.The blockchain-based capacity expansion technology-based customer order record query system according to claim 6, characterized in that: The graph structure construction unit extracts key attribute information from the multi-dimensional index, constructs order nodes and edge relationships between nodes, and stores them in the adjacency matrix A. 10.The blockchain-based capacity expansion technology-based customer order record query system according to claim 6, characterized in that: The graph traversal execution unit can expand layer by layer from the starting node through breadth-first search until the associated order nodes are found, or explore along a path through the depth-first search algorithm, accurately traverse the graph structure starting from the starting order node, find the associated order nodes, and arrange the results and return them to the graph structure construction unit.
Citation Information
Patent Citations
Order data processing method and system based on block chain
CN119624590A