Block chain up-chain and down-chain linkage query method and system based on decentralized oracle machine
By leveraging the digest computation and multi-signature mechanism of a decentralized oracle network, the problem of strong heterogeneity in multimodal data is solved, enabling efficient and secure linkage queries between on-chain and off-chain data, and improving the accuracy and efficiency of data queries.
Patent Information
- Application Number
- CN202511545052.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-01-23
AI Technical Summary
Existing technologies are unable to effectively solve the problems of strong heterogeneity of multimodal data and low efficiency of on-chain and off-chain data matching, and centralized oracles suffer from insufficient data credibility and trust bottlenecks.
A decentralized oracle network is adopted to generate data digests and tags through digest calculation and information annotation. Combined with time indexing, it realizes lightweight on-chain storage and distributed off-chain storage. A multi-signature mechanism is used to adjust the signature threshold according to the data sensitivity to ensure the integrity and security of data transmission.
It enables accurate and fast querying of multimodal data, reduces on-chain storage costs, balances the security and efficiency of different sensitive data, eliminates centralized trust bottlenecks, and improves the accuracy and efficiency of data querying.
Smart Images

Figure CN121387939A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of blockchains, in particular to a blockchain on-chain and off-chain linkage query method and system based on a decentralized oracle. BACKGROUND
[0002] With the development of smart city, Internet of Things and other technologies, the multi-modal data generated in city governance has exploded. Such data has the characteristics of strong heterogeneity: for example, a traffic monitoring video may contain video pictures, environmental audio, caption text and other elements, and the formats, features and sensitivity of different modal data differ significantly. The traditional single-modal data management method cannot meet the storage, retrieval and control needs of multi-modal data.
[0003] Blockchain is introduced into city data governance due to its "non-tamperable" and "traceable" characteristics, but has natural shortcomings: the on-chain storage cost is extremely high, and it is impossible to directly store massive multi-modal raw data; the blockchain itself is a closed system and cannot directly access off-chain data; the non-tamperable nature of on-chain data conflicts with the need for dynamic control of sensitive information, and traditional centralized middleware is easy to become a bottleneck of trust.
[0004] Currently, on-chain and off-chain data linkage mainly relies on centralized oracles or simple application programming interfaces, which has the following problems: data credibility is insufficient, off-chain data may be tampered with or replaced during transmission, and there is a lack of effective verification mechanism; the query of sensitive data may be maliciously intercepted or tampered with when executed off-chain.
[0005] Chinese Patent Application Publication No. CN112507360A provides a blockchain data on-chain method and device based on threshold signature and oracle, which solves the problems of low efficiency and high cost of existing oracle network data on-chain by using threshold signature technology to split and recombine private keys in a decentralized oracle network, and realizes efficient, secure and reliable on-chain of data sources. However, it does not distinguish between data types, and cannot solve the storage and retrieval problems of multi-modal data with strong heterogeneity and large quantities. The fixed threshold number of threshold signature algorithm cannot adapt to data sensitivity levels. In addition, threshold signature has the disadvantages of poor fault tolerance and rigid process, and the threshold number is usually a fixed value. If some nodes fail or go offline, the private key fragments need to be restarted and redistributed, and the nodes need to be re-signed, which not only prolongs the query interruption time, but also may cause data synchronization inconsistency problems due to re-fragmentation.
[0006] In summary, there is currently a lack of a blockchain on-chain and off-chain linkage query method and system to solve or partially solve the aforementioned problems. SUMMARY
[0007] The purpose of this invention is to overcome the shortcomings of the existing technology by providing a blockchain on-chain and off-chain linkage query method and system based on decentralized oracles, so as to solve or partially solve the problems of strong heterogeneity of multimodal data and low efficiency of on-chain and off-chain data matching.
[0008] The objective of this invention can be achieved through the following technical solutions: One aspect of the present invention provides a blockchain on-chain and off-chain linkage query method based on a decentralized oracle, comprising: The system acquires multimodal data to be stored and saves it off-chain. It then calculates a data digest and obtains labels and their values through information annotation. Construct a time index with timestamp ranges as index keys and data summaries as index values; The time index, tag, and tag value are stored in a storage contract deployed on the blockchain; The off-chain storage synchronizes the data summary and storage address to the on-chain oracle contract via a publish-subscribe approach. The oracle contract is subscribed to by a decentralized oracle network. In response to a user query, the storage contract sends a message to the oracle contract, and the nodes in the decentralized oracle network generate an integrity proof based on the subscribed user query. The decentralized oracle network aggregates the digital signatures of each node to obtain a multi-signature that reaches a threshold. It then sends the original data, multi-signature, and integrity proof to the user, enabling on-chain and off-chain linked queries.
[0009] As a preferred technical solution, the process of obtaining a data digest through digest calculation includes the following steps: For text data, the SHA-256 algorithm is used to generate a content hash; For image data, feature points are extracted using the SIF algorithm, and image hashes are calculated from the feature vectors. For audio data, the audio hash is calculated after extracting the Mel spectrum features; For video data, the hashes of the keyframe sequences are calculated separately and then the video hashes are calculated by merging them. The data digest is obtained by merging the content hash, image hash, audio hash, and video hash.
[0010] As a preferred technical solution, the process of obtaining labels and label values through information annotation includes the following steps: The time label, the place label and the event label are extracted by combining automatic labeling and manual auditing, wherein the time label adopts a timestamp created by data, the place label is obtained by extracting position information or geographical position entities in text through image recognition, and the event label is obtained by identifying key events through manual auditing and cross verifying the results.
[0011] As a preferred technical solution, the publishing-subscribing includes the following steps: When new data is written in the off-chain storage, the synchronization data is triggered to generate a synchronization package including a data digest and a storage address, and is sent to nodes in the decentralized oracle network. Each node in the decentralized oracle network receives the synchronization package through point-to-point, and establishes a copy in the local database.
[0012] As a preferred technical solution, the process of generating the integrity proof includes the following steps: A Merkle tree is constructed with file block hashes as leaf nodes, a root hash is generated and compared with a data digest in the on-chain storage contract, and a Merkle path and intermediate node hashes required for verification are generated.
[0013] As a preferred technical solution, the process of multiple signature includes the following steps: According to the sensitivity level of the data requested by the user, a signature node threshold is obtained; Each node in the decentralized oracle network digitally signs the data result queried by itself and broadcasts in the decentralized oracle network; The signatures are collected and verified for validity, and a multiple signature is generated after the signature node threshold is reached, wherein the signature node threshold is: Normal data: the signature node threshold is 2 / 3 of the nodes; Sensitive data: the signature node threshold is 3 / 4 of the nodes; High sensitivity data: the signature node threshold is 4 / 5 of the nodes.
[0014] As a preferred technical solution, the off-chain storage is a distributed columnar storage database, and the multi-modal data is stored by modality type-time stamp, each shard corresponds to a unique data digest.
[0015] As a preferred technical solution, the user query includes a label, a value of the label or a time stamp interval.
[0016] As a preferred technical solution, the label and the value of the label are stored in the on-chain storage contract in the structure of <key:value>.
[0017] In another aspect of the present application, a decentralized oracle-based on-chain and off-chain linkage query system is provided for implementing the aforementioned on-chain and off-chain linkage query method, and the system comprises: The off-chain storage is used to obtain the multi-modal data to be stored and saved in the off-chain storage, and the data summary is obtained by the summary calculation, the label and the value of the label are obtained by the information labeling, and the time index is constructed with the time stamp interval as the index key and the data summary as the index value. The on-chain oracle contract is used to synchronize the data summary and the storage address to the oracle contract deployed on the chain in a publish-subscribe manner. The on-chain storage contract is used to store the time index, the label and the value of the label, and send to the oracle contract in response to the user query. The decentralized oracle network comprises a plurality of nodes configured to subscribe to the oracle contract, generates an integrity proof based on the subscribed user query, aggregates the digital signatures of the nodes to obtain a multi-signature reaching a threshold, and sends the original data corresponding to the user query, the multi-signature and the integrity proof to the user, thereby realizing the on-chain and off-chain linkage query of the blockchain.
[0018] Compared with the prior art, the present application has at least one of the following beneficial effects: (1) Precise and fast query of multi-modal data: the present application adopts hierarchical storage, stores lightweight data such as summaries and labels on the chain, and stores original data in a distributed database off-chain, thereby reducing the storage cost on the chain and realizing precise and fast query of multi-modal data.
[0019] (2) Targeted design of modalities: the present application adopts customized hash strategies for text, image, audio and video, generates labels by combining manual and automatic labeling, constructs an index with the blockchain time stamp interval as the key and the data summary hash as the value, and further improves the query accuracy and precision of multi-modal data.
[0020] (3) Balancing the security and efficiency of different sensitive data: in the process of multi-signature, the present application obtains a threshold of signature nodes according to the sensitivity level of the data requested by the user; each node in the decentralized oracle network digitally signs the data results obtained by each node, and broadcasts in the decentralized oracle network, collects the signatures and verifies the validity, generates a multi-signature after the threshold of signature nodes, balances the security and efficiency of different sensitive data, directly verifies the data integrity, and eliminates the centralized trust bottleneck. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1A flowchart of the on-chain and off-chain linkage query method based on a decentralized oracle in the embodiment of the present application; Figure 2 A schematic diagram of the on-chain and off-chain linkage query system based on a decentralized oracle in the embodiment of the present application. DETAILED DESCRIPTION
[0022] 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 part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work should fall within the protection scope of the present application.
[0023] Embodiment 1 To solve the problems in the prior art, the present embodiment provides an on-chain and off-chain linkage query method based on a decentralized oracle to meet the demand of content management. Specifically, for multi-modal data, first, the summary information is calculated, and multiple tags are used to describe the main features of the data, such as time, place, event, etc.; then, an index is established based on time sequence, which can quickly match the on-chain data with the off-chain multi-modal data, and search for data that meets the conditions within a certain time range according to certain features; finally, the index, summary, key meta information and tag information are stored on the chain, and the original data is stored in the off-chain database.
[0024] In the multi-modal data query scenario of the blockchain, the parameters off-chain need to be transmitted into the blockchain system for matching. Since this process involves on-chain and off-chain joint query, it is necessary to ensure the authenticity and integrity of the transmitted parameters. Even if the data source (for example, the oracle) is assumed to be authoritative and trustworthy, there is still a risk of data loss or tampering during data transmission.
[0025] The present method will study a trusted off-chain data feeding mechanism from the aspects of authenticity proof and trusted execution environment.
[0026] For authenticity proof, the present method provides integrity assurance based on a decentralized oracle and multi-signature to prevent data obtained from a single data source from being tampered with. By obtaining data from multiple data sources and dynamically adjusting the signature threshold of the oracle node according to data sensitivity, the threshold number of signatures is collected, and the data is proved to be authentic and trustworthy after multi-comparison.
[0027] For trusted execution environment, the present method uses trusted hardware to provide integrity assurance, ensuring that the data feeding system running in the secure area is protected by the CPU, preventing tampering or spying by other processes, and proving that the program is running in the secure area by generating a digital signature.
[0028] Referring to Figure 1 The method comprises the following steps: Step S1, obtaining multi-modal data to be stored and saving in an off-chain storage, obtaining data digest through digest calculation, and obtaining labels and values of the labels through information labeling.
[0029] For multi-modal data such as pictures, videos, audios, and texts, this step first calculates digest information and uses multiple labels to describe the main features of the data, such as time, place, and event, and retains the correspondence between key meta-information (i.e., the values of the labels) and the labels.
[0030] When calculating the digest information, different types of data are processed differently using the SHA-256 hash algorithm: for text data, the SHA-256 algorithm is used to generate a content hash; for image data, feature points are first extracted using the SIFT algorithm, and then a hash is calculated for the feature vector; for audio data, a hash is calculated after extracting the Mel-frequency cepstral coefficients; and for video data, a hash is calculated for each key frame sequence and then merged, and all hash results together form a unique digital fingerprint of the multi-modal data.
[0031] When generating feature labels, both automatic labeling and manual review mechanisms are combined. The time label uses the timestamp of data creation, the location label extracts location information or geographic location entities from text through image recognition, and the event label identifies key events through manual review and cross-verification of the results.
[0032] Step S2, constructing a time index with a timestamp interval as the index key and the data digest as the index value.
[0033] This step designs a time sequence index based on the natural time sequence characteristics of the blockchain system to support rapid positioning of information within a specific time range in a large amount of data, providing users with faster and more intuitive query results. Based on the blockchain block timestamp, the index key is the timestamp interval [start_time, end_time], and the index value is the hash value of the corresponding data digest.
[0034] Step S3, storing the time index, labels, and values of the labels in the storage contract deployed on the chain.
[0035] Store lightweight data such as digests, labels, and key meta-information in the storage smart contract of the blockchain, and store the original data in the off-chain distributed database. Key meta-information refers to the values in the label key-value pairs generated in step 1. Each label is stored in the <key:value> structure, such as type:traffic_accident and location:shanghai_pudong.
[0036] In step S4, the off-chain storage synchronizes the data summary and storage address to the on-chain oracle contract via a publish-subscribe mechanism. The oracle contract is subscribed to by the decentralized oracle network.
[0037] The off-chain distributed database achieves data synchronization through a publish-subscribe model. When new data is written to the off-chain database, a synchronization event is automatically triggered, generating a synchronization packet containing a data summary and storage address.
[0038] Oracle nodes receive synchronization packets via a peer-to-peer network, and each node creates a complete copy in its local database. This synchronizes data to every oracle node in the decentralized oracle network. A digital signature stored off-chain is attached when the synchronization packet is generated. Upon receiving the packet, the oracle node first verifies the validity of the digital signature to confirm that the synchronization packet has not been tampered with before creating its local copy.
[0039] In step S5, the storage contract responds to the user query by sending it to the oracle contract. Nodes in the decentralized oracle network generate an integrity proof based on the subscribed user query.
[0040] When a user initiates a query, they can retrieve the required data from the blockchain storage smart contract using key metadata, time-series data, or tags.
[0041] The storage smart contract notifies the on-chain oracle smart contract of the user's query conditions.
[0042] Nodes acquire query tasks by listening to oracle smart contract events and quickly locate the original data using local indexes in an off-chain database. After subscribing to user query conditions, each oracle node queries the original data in its oracle node database and generates an integrity proof.
[0043] The process of generating integrity proofs employs a Merkle tree structure: a Merkle tree is constructed with file block hashes as leaf nodes, a root hash is generated, and compared with the digest information stored on the chain to ensure that the data has not been tampered with. The proof information includes the Merkle path and the hashes of intermediate nodes required for verification.
[0044] Step S6: The decentralized oracle network aggregates the digital signatures of each node to obtain a multi-signature that meets the threshold. The original data, multi-signature, and integrity proof corresponding to the user's query are sent to the user, realizing on-chain and off-chain linkage query of the blockchain.
[0045] The multi-signature process is initiated while generating the integrity proof, the signature aggregation adopts a multi-signature scheme, and the signature threshold is dynamically adjusted according to the data sensitivity level: for example, ordinary data requires more than 2 / 3 of the nodes to sign, and high-sensitive data requires more than 4 / 5 of the nodes to sign. In the multi-signature process, each oracle node in the decentralized oracle network digitally signs the data results queried by itself and broadcasts the signature in the network.
[0046] The signature aggregator collects the signatures and verifies the validity, and generates an aggregated signature after reaching the threshold. The oracle returns the original data and the multi-signature meeting the threshold number and the integrity proof to the user In summary, on the one hand, the method combines multi-modal differentiated summary calculation, time index and hierarchical storage mechanism to reduce on-chain storage costs and achieve accurate and fast query of multi-modal data. On the other hand, the method uses a dynamic threshold multi-signature mechanism to balance the security and efficiency of different sensitive data, directly verifies the data integrity, and eliminates the centralized trust bottleneck.
[0047] Compared with existing threshold signature methods, the method uses multi-signature instead of threshold signature, optimizes with data sensitivity level, and only maintains its own private key. The node generates an independent signature using the existing password library without complex collaboration; the signature retains traceability, each signature is bound to the node public key and can be verified individually. By using multi-signature, the method improves ease of use. There is no need to deploy a collaborative network, reducing the technical threshold. Fault tolerance cost is reduced. Node failure can be directly located without the need to restart the process, and only the signature can be supplemented or the node can be replaced without the risk of key fragment leakage. Bandwidth consumption is reduced, the node only broadcasts independent signatures, the data volume is much smaller than the key fragment, and there is no need for pairwise interaction. When the number of nodes is large, bandwidth occupancy is reduced, and transmission delay can be reduced.
[0048] Embodiment 2 Based on embodiment 1, referring to Figure 2 The embodiment provides a blockchain on-chain and off-chain linkage query system based on a decentralized oracle, which is used for the blockchain on-chain and off-chain linkage query method of embodiment 1, and the system comprises: (1) Off-chain storage, used for obtaining multi-modal data to be stored and saving in off-chain storage, obtaining data digest through summary calculation, obtaining label and value of label through information labeling, and constructing time index with time stamp interval as index key and data digest as index value.
[0049] (2) On-chain oracle contract, used for synchronizing data digest and storage address to the on-chain deployed oracle contract through the publish-subscribe mode. (3) On-chain storage contract, used for storing time index, label and value of label, and sending to the oracle contract in response to user query.
[0050] (4) The decentralized oracle network comprises a plurality of nodes configured to subscribe to the oracle contract, generate an integrity proof based on a subscribed user query, aggregate digital signatures of the nodes to obtain a multi-signature reaching a threshold, and send original data corresponding to the user query, the multi-signature and the integrity proof to the user, thereby realizing on-chain and off-chain linkage query of the blockchain.
[0051] The above merely illustrates the specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed by the present application, and these modifications or replacements shall be encompassed within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for on-chain off-chain linkage query based on a decentralized oracle blockchain, characterized in that, The application relates to a method for realizing blockchain on-chain and off-chain linkage query. The method comprises the following steps: acquiring multi-modal data to be stored and saving the data in off-chain storage, calculating a data digest through digest calculation, and obtaining labels and values of the labels through information labeling; constructing a time index with a time stamp interval as an index key and a data digest as an index value; storing the time index, the labels and the values of the labels in a storage contract deployed on a chain; the off-chain storage synchronizes the data digest and a storage address to a chain-deployed oracle contract through a publish-subscribe mode, and the oracle contract is subscribed by a decentralized oracle network; the storage contract sends a user query to the oracle contract, and nodes in the decentralized oracle network generate integrity proofs based on the subscribed user query; 2.The on-chain off-chain linkage query method based on a decentralized oracle of claim 1, wherein, the decentralized oracle network aggregates digital signatures of the nodes to obtain a multi-signature reaching a threshold, and sends original data corresponding to the user query, the multi-signature and the integrity proof to the user, thereby realizing blockchain on-chain and off-chain linkage query. The process of calculating the data digest through digest calculation comprises the following steps: for text data, a content hash is generated by using an SHA-256 algorithm; for image data, feature points are extracted by using an SIF algorithm, and an image hash is calculated based on the feature vectors; for audio data, a mel-frequency spectrum feature is extracted, and an audio hash is calculated; for video data, a hash is calculated for a key frame sequence, and then a video hash is calculated by merging the hashes; 3.The on-chain off-chain linkage query method based on a decentralized oracle of claim 1, wherein, the content hash, the image hash, the audio hash and the video hash are merged to obtain the data digest. The process of obtaining the labels and the values of the labels through information labeling comprises the following steps:
4. The on-chain off-chain linkage query method based on a decentralized oracle of claim 1, characterized in that, time labels, place labels and event labels and values corresponding to the labels are extracted by combining automatic labeling and manual auditing, wherein the time labels adopt a time stamp generated by data, the place labels are obtained by extracting position information or geographical position entities in text through image recognition, and the event labels are obtained by identifying key events by manual auditing and cross-verification of the results. The publish-subscribe mode comprises the following steps: when new data is written in the off-chain storage, synchronization data is triggered, a synchronization package comprising a data digest and a storage address is generated, and the synchronization package is sent to nodes in the decentralized oracle network; 5. The on-chain off-chain linkage query method based on a decentralized oracle of claim 1, characterized in that, each node in the decentralized oracle network receives the synchronization package through point-to-point, and a copy is established in a local database. The process of generating the integrity proof comprises the following steps:
6. The on-chain off-chain linkage query method based on a decentralized oracle of claim 1, characterized in that, a Merkle tree is constructed with a file block hash as a leaf node, a root hash is generated, and the root hash is compared with a data digest in the on-chain storage contract, a Merkle path and an intermediate node hash required for verification are generated. The process of the multi-signature comprises the following steps: a signature node threshold is obtained according to a sensitivity level of data requested by a user; each node in the decentralized oracle network digitally signs data results queried by the node, and broadcasts the data results in the decentralized oracle network; the signatures are collected and verified, and a multi-signature is generated after the signature node threshold is reached, wherein the signature node threshold is: for normal data, the signature node threshold is 2 / 3 of the nodes; for sensitive data, the signature node threshold is 3 / 4 of the nodes. High sensitivity data: signature node threshold is 4 / 5 of the node.
7. The on-chain off-chain linkage query method based on a decentralized oracle of claim 1, characterized in that, The off-chain storage is a distributed column storage database, and the multi-modal data is stored according to the mode type-time stamp, and each shard corresponds to a unique data digest. 8.The on-chain off-chain linkage query method based on a decentralized oracle of claim 1, wherein, The user query includes a label, a value of the label or a time stamp interval. 9.The on-chain off-chain linkage query method based on a decentralized oracle of claim 1, wherein, The label and the value of the label are stored in the storage contract on the chain in the structure of <key:value>.
10. A decentralized oracle-based on-chain off-chain linkage query system based on a blockchain, characterized in that, The system for implementing the blockchain on-chain and off-chain linkage query method comprises: The off-chain storage is used for obtaining multi-modal data to be stored and saved in the off-chain storage, obtaining a data digest through digest calculation, obtaining a label and a value of the label through information labeling, and constructing a time index with a time stamp interval as an index key and the data digest as an index value; The on-chain oracle contract is used for synchronizing the data digest and the storage address to the oracle contract deployed on the chain through a publish-subscribe mode; The on-chain storage contract is used for storing the time index, the label and the value of the label, and sending the user query to the oracle contract in response to the user query; The decentralized oracle network comprises a plurality of nodes configured to subscribe to the oracle contract, generates an integrity proof based on the subscribed user query, aggregates digital signatures of the nodes, obtains a multi-signature reaching a threshold, and sends the original data corresponding to the user query, the multi-signature and the integrity proof to the user, thereby realizing the blockchain on-chain and off-chain linkage query.
Citation Information
Patent Citations
Blockchain data uploading method and device based on threshold signature and oracle machine
CN112507360A
Cited By
Intelligent contract-driven supply chain economic optimization method
CN121998204A
Smart Contract-Driven Supply Chain Economic Optimization Approach
CN121998204B