Block chain-based data security assurance retrieval enhancement generation system and method

By adopting a hybrid architecture of 'on-chain evidence storage and off-chain storage' in the RAG system, combined with encryption algorithms and Merkle trees, the shortcomings of the RAG system in terms of data security, privacy protection and integrity verification are solved, achieving a balance between efficient retrieval and high security.

CN121658428APending Publication Date: 2026-03-13SHANGHAI HAINAJIN FUSHUI DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511888822.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

The existing RAG system has shortcomings in data security, privacy protection and data integrity verification, and cannot simultaneously meet the requirements of efficient retrieval and high security.

Method used

The system adopts a hybrid architecture of 'on-chain evidence storage and off-chain storage', storing the core knowledge base data of the RAG system in a high-performance off-chain database and storing data integrity evidence on-chain. It leverages the blockchain to provide an immutable trust anchor and combines encryption algorithms and Merkle trees to verify data integrity.

Benefits of technology

It achieves data immutability, privacy protection, and full lifecycle traceability, improves data credibility, meets the application requirements of high-security scenarios, and maintains efficient retrieval performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121658428A_ABST
    Figure CN121658428A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data security, and provides a block chain-based data security assurance retrieval enhanced generation system, which is characterized in that document data in an RAG knowledge base is partitioned, encrypted and vectorized, and encrypted hash values or Merkle tree roots are linked for evidence storage, so that the data security assurance retrieval enhanced generation system is obtained; therefore, a non-tampering trust anchor point is provided for the knowledge base data stored under the chain. After a user query is received, the system firstly performs efficient retrieval under a chain, then verifies the integrity of retrieved data through a record on the chain, decrypts the data passing the verification, and finally inputs the data as a context into a large language model to generate a credible and safe answer. According to the method, the security challenges of data integrity, privacy disclosure, source credibility and the like faced by the existing RAG system are solved, and the effective balance between the performance and the security is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of data security, and more particularly to a blockchain-based data security assurance retrieval augmented generation system and method. Specifically, it combines retrieval augmented generation (RAG) with blockchain technology, aiming to address the challenges faced by data knowledge bases in large-scale language model (LLM) applications regarding data security, privacy protection, data integrity verification, and source credibility. The technical solution of this invention can be widely applied to scenarios with extremely high data credibility requirements, such as enterprise internal knowledge management, intelligent customer service, financial risk control, and medical information systems. Background Technology

[0002] With the rapid development of artificial intelligence technology, generative large language models (LLMs) have demonstrated powerful capabilities in the field of natural language processing. However, limited by the timeliness of training data and the scope of knowledge coverage, their generation is prone to "illusions" (i.e., false information detached from reality), and they struggle to efficiently integrate external dynamic knowledge. To address this issue, retrieval augmented generation (RAG) technology has emerged as a key framework connecting traditional information retrieval systems and LLMs, finding widespread application in scenarios such as enterprise knowledge management, intelligent customer service, and financial analysis.

[0003] I. Current Technical Status and Shortcomings of Existing RAG Systems The core logic of Retrieval Enhanced Generation (RAG) is to compensate for the knowledge limitations of LLM by using a "retrieve external knowledge - assist model generation" model. Its standard workflow includes three core steps: indexing, retrieval, and generation. The specific implementation process is as follows: (1) Indexing stage: The system first preprocesses the structured or unstructured documents (such as PDFs, database files, text corpus, etc.) in the external knowledge base, and divides the documents into several appropriate text chunks according to semantic relevance; then, through a pre-trained vector encoding model (such as BERT, Sentence-BERT, etc.), each text chunk is transformed into a high-dimensional numerical vector that can represent semantic information; finally, these vectors and corresponding text chunks are stored in a high-performance vector database (such as Milvus, FAISS, etc.) to complete the indexing of the knowledge base and lay the foundation for subsequent fast retrieval.

[0004] (2) Retrieval stage: When a user initiates a query request, the system first converts the query statement into a query vector using the same vector encoding model as the indexing stage, and then uses vector similarity calculation methods such as cosine similarity and Euclidean distance to match and recall the k text fragments that are most relevant to the query semantics in the vector database (i.e., Top-k retrieval results).

[0005] (3) Generation stage: The relevant text fragments retrieved are used as "factual basis" or "contextual supplementary information" and input into the LLM along with the user's original query, so that the LLM generates answers based on real and specific external knowledge, thereby significantly improving the accuracy and factuality of the answers and effectively reducing the probability of "illusion" phenomena.

[0006] While RAG technology has significant advantages in optimizing LLM output quality and expanding knowledge boundaries, in practical applications, its core data asset—the knowledge base—exposes inherent defects in data security and trustworthiness through its storage and management model. These defects are specifically manifested in the following three aspects: (1) Data integrity risk: The knowledge base of existing RAG systems mostly relies on centralized databases or vector databases for storage, and lacks an effective anti-tampering mechanism. If the text fragments and vector data in the knowledge base are maliciously tampered with (such as replacing key information or inserting false content), the RAG system will retrieve and generate answers based on the tampered data, which will directly lead to the distortion of the output results and seriously damage the credibility of the system and the user experience.

[0007] (2) Privacy risk: Knowledge bases often contain proprietary corporate data (such as internal business documents and technical manuals) and sensitive personal information (such as medical records and financial account information). Existing RAG systems mostly protect data through traditional access control policies (such as account passwords and role permissions), but such mechanisms are easily breached due to system vulnerabilities and abuse of permissions, leading to unauthorized entities obtaining private data and causing data leakage risks.

[0008] (3) Lack of traceability auditing: Throughout the entire lifecycle of data, from collection (e.g., document import), processing (e.g., chunking, vectorization) to retrieval (e.g., query matching, result return), the existing RAG system lacks tamper-proof operation logs and traceability mechanisms. When it is necessary to verify the authenticity of the data source (e.g., the original document of a text fragment) and the data flow path (e.g., the generation time and storage location of a vector), reliable audit evidence cannot be provided, making it difficult to meet the compliance requirements for data traceability in fields such as finance and healthcare.

[0009] II. Limitations of Existing Blockchain Technology Blockchain technology, as a decentralized distributed ledger technology, fundamentally achieves data immutability, trustworthiness, and full lifecycle traceability through three core technologies: cryptographic algorithms (such as hash algorithms and asymmetric encryption), decentralized architecture, and consensus mechanisms (such as PoW, PoS, and PBFT), demonstrating unique advantages in the field of data security. In enterprise-level applications, existing technical solutions (such as related patents) utilize permissioned consortium blockchains (such as Hyperledger Fabric) to build cross-institutional data sharing systems: defining data access rules through smart contracts, segmenting and encrypting sensitive data, and implementing access control, effectively ensuring security and compliance during cross-entity data interaction, providing a technical reference for scenarios with high security requirements.

[0010] However, directly applying blockchain technology to the knowledge base storage of the RAG system will face serious bottlenecks in performance and storage, failing to meet RAG's requirements for real-time performance and efficiency. The specific limitations are as follows: (1) Insufficient transaction throughput: The transaction processing capacity (Transactions Per Second, TPS) of public chains is extremely low. Ethereum (before the merger) has a TPS of about 15-30 transactions per second. Even the optimized public chain or consortium chain cannot meet the high-frequency retrieval needs of the RAG system. The RAG system needs to complete the matching of query vectors with massive storage vectors within milliseconds. The low TPS of the blockchain will cause retrieval requests to queue up and wait, greatly extending the response time.

[0011] (2) Increased storage pressure: The full-node storage characteristic of blockchain requires each participating node to synchronize and store complete ledger data. If the entire knowledge base of the RAG system (containing massive text fragments and high-dimensional vectors) is directly put on the chain, as the scale of the knowledge base expands (such as tens of millions of text fragments and hundreds of millions of vectors), the storage load of each node will increase exponentially, which will not only increase hardware costs, but also lead to a decrease in node synchronization efficiency and further reduce system performance.

[0012] (3) Data synchronization delay: In a blockchain network, data writing (such as adding a new block) requires processes such as node consensus (such as PBFT consensus in a consortium blockchain), block broadcasting, and full node synchronization. This process has an inherent time delay (such as the consensus delay in a consortium blockchain is usually in the second range, while the delay in a public blockchain can reach the minute range). The RAG system has extremely high requirements for retrieval response speed (such as returning results in milliseconds). The data synchronization delay of the blockchain will lead to untimely updates of the knowledge base and delayed retrieval results, which cannot meet the real-time query requirements.

[0013] III. In-depth considerations for the integration of technical solutions Based on the above analysis, it is clear that the core advantages of the RAG system and blockchain technology are inherently contradictory: RAG's core value lies in improving the quality of LLM generation through efficient retrieval of external knowledge, which places extremely high demands on system performance (such as retrieval speed and throughput); blockchain's core value lies in achieving ultimate data security (such as immutability and traceability) by sacrificing some performance (such as low TPS and high latency). The two are at opposite ends of the "performance-security" trade-off curve, and simply combining them cannot form a feasible solution. If the entire knowledge base (text fragments, vector data) of the RAG system is directly stored on the blockchain, the data security problem can be solved, but the low TPS, high latency and high storage cost of the blockchain will completely destroy the high efficiency retrieval advantage of RAG, making the system impractical. While relying solely on the RAG system's own architecture can guarantee retrieval performance, it cannot solve security issues such as data integrity, privacy protection, and traceability auditing, making it difficult to meet the application requirements of high-security scenarios.

[0014] Therefore, the core technical problem that this invention aims to solve is not simply combining RAG with blockchain technology, but rather designing an innovative architecture that, while retaining RAG's efficient retrieval capabilities, utilizes the security features of blockchain to address its data security pain points and circumvents the performance and storage bottlenecks of blockchain.

[0015] To address this core issue, the key design concept of this invention is to construct a hybrid architecture of "on-chain evidence storage and off-chain storage": The core knowledge base data (text fragments, vector data) of the RAG system is stored in a high-performance, highly scalable off-chain database (such as a vector database or the decentralized storage network IPFS) to ensure the real-time retrieval efficiency and storage scalability of the RAG system; simultaneously, "security evidence" that can characterize data integrity (such as the encrypted hash value of text fragments, the root hash value of a Merkle tree constructed from multiple hash values) and data metadata (such as the original document identifier and data generation timestamp) are stored on the blockchain. Through this design, the blockchain only serves as the data "audit layer" and "trust anchor" of the RAG system, eliminating the need to store massive amounts of knowledge base data. This fundamentally resolves the inherent contradiction between RAG and blockchain technologies, achieving a balance between "high-performance retrieval" and "high data security." Summary of the Invention

[0016] To address the aforementioned issues, the present invention aims to provide a blockchain-based data security assurance retrieval enhancement generation system and method, which addresses the shortcomings of existing RAG systems in terms of data integrity, privacy protection, source credibility, and audit traceability.

[0017] The above-mentioned objective of this invention is achieved through the following technical solutions: A blockchain-based data security assurance retrieval enhancement generation system includes a data processing module, a blockchain evidence storage module, a retrieval and verification module, a decryption and generation module, and a security management module. The data processing module is used to segment and vectorize the original external knowledge document, and encrypt the segment and / or the vector to generate integrity evidence of the segment, while storing the encrypted segment and encrypted vector in an off-chain database. The blockchain evidence storage module is used to store the integrity evidence generated by the data processing module and the metadata associated with the original knowledge document on the blockchain, providing an immutable trust anchor for the off-chain database. The retrieval and verification module is used to receive user queries, retrieve relevant encrypted data from the off-chain database based on the queries, and verify the integrity of the retrieved encrypted data using the integrity evidence stored in the blockchain evidence storage module. The decryption and generation module is used to decrypt the encrypted data verified by the retrieval and verification module, and input the decrypted data and the user query as context into the large language model to generate a credible answer. The security management module is used to authenticate users and control access, restrict access permissions to various modules of the system, and is also responsible for key management and data encryption / decryption operations to ensure data security throughout its entire lifecycle. It also works in conjunction with the blockchain evidence storage module to achieve fine-grained access control through on-chain smart contracts.

[0018] Furthermore, the integrity evidence generated by the data processing module includes the cryptographic hash value of the cryptographic block and / or the root hash value of a Merkle tree constructed from the cryptographic hash values ​​of multiple cryptographic blocks as leaf nodes; The data processing module performs a block segmentation operation on the original knowledge document, dividing the document into text blocks of appropriate size and semantics. The vectorization operation uses a pre-trained embedding model to convert each text block into a high-dimensional numerical vector. The original knowledge document processed by the data processing module comes from various structured or unstructured external knowledge sources, including file data such as PDF documents, database files, and API interface data.

[0019] Furthermore, the off-chain database adopts a hybrid storage mode, including a high-performance vector database and an optional decentralized storage network; The vector database is used to store the encrypted blocks and the encrypted vectors to support high-speed, low-latency similarity retrieval. The decentralized storage network is used to store the original knowledge documents or the encrypted blocks, further enhancing the decentralization and censorship resistance of the data. The vector database is selected from databases including Milvus and FAISS, and the decentralized storage network is selected from databases including IPFS. Furthermore, when the off-chain database stores the encrypted blocks and the encrypted vectors, it associates the hash value or block number of the on-chain transaction with the index of the vector database so as to quickly match the on-chain evidence information during subsequent retrieval.

[0020] Furthermore, the data processing module employs a differentiated encryption strategy for the blocks and the vectors: The text blocks are encrypted using an industry-standard symmetric encryption algorithm, specifically AES-CTR-256, to protect the privacy of the text content. For the vector in high-dimensional numerical form, an encryption algorithm that supports encrypted computation, specifically DCPE, is used. This algorithm allows similarity calculation without decrypting the vector, ensuring that vector data is not leaked during the retrieval process, thus forming a double privacy protection.

[0021] Furthermore, the blockchain evidence storage module uses a permissioned consortium blockchain or a public blockchain as the evidence storage layer, storing only key information to avoid performance and storage bottlenecks. The stored content includes: The integrity evidence includes cryptographic hash values, the root hash value of the Merkle tree, the unique identifier and version number of the original knowledge document, the timestamp of the on-chain operation, metadata related to data access permissions, and the system's full lifecycle operation logs of the knowledge base data; When data is uploaded to the blockchain, the root hash value of the Merkle tree, the document version number, the timestamp, and the access control metadata are encapsulated into a transaction and submitted to the blockchain's evidence storage layer. After verification by network consensus mechanisms, including PBFT and PoS, the transaction is packaged into a block to form a permanent and tamper-proof evidence record, which serves as the sole credible basis for data integrity and authenticity.

[0022] Furthermore, the workflow and verification logic of the retrieval and verification module are as follows: The first step is to receive the user query and then transform the query into a high-dimensional query vector using a pre-trained embedding model consistent with the data processing module. The second step involves using the query vector to perform a closed-state similarity retrieval in the encrypted vector database based on algorithms including cosine similarity and Euclidean distance, and recalling the k most relevant encrypted data blocks. The third step is to initiate integrity verification: retrieve the blockchain transaction hash value and Merkle proof path corresponding to the encrypted data block from the vector database, including the sibling node hash and parent node hash of the data block hash. Query the Merkle tree root hash value recorded in the transaction through the blockchain evidence storage module. On the local machine or verification server, calculate the encrypted data block hash and the hash in the proof path layer by layer upwards according to the Merkle tree calculation rules to obtain the local root hash. If the local root hash is consistent with the on-chain root hash, the verification is successful; otherwise, it is determined that the data has been tampered with, and the data block is discarded or marked as untrustworthy.

[0023] Furthermore, the decryption and generation module follows the principle of verification before decryption: Only encrypted data blocks that have passed verification and are filtered by the retrieval and verification module are received and sent to the security management module. The security management module then calls the corresponding decryption key based on the key management strategy to decrypt the data and restore it to the original text block. During the generation phase, the decrypted original text block is integrated with the user's original query in context and fed as input to the Large Language Model (LLM). The model generates a response based on this credible context, ensuring that the output content comes entirely from tamper-proof factual data, fundamentally eliminating illusions or misinformation caused by data issues. Finally, the generated credible response is fed back to the user.

[0024] A blockchain-based data security assurance retrieval enhancement generation method, executed using the aforementioned blockchain-based data security assurance retrieval enhancement generation system, includes the following steps: S1: Data entry and storage, specifically: raw data is collected from structured or unstructured external knowledge sources, including PDF documents, databases, and API interfaces; the raw data is segmented into text blocks of appropriate size and semantics and transformed into high-dimensional numerical vectors through a pre-trained embedding model; the text blocks are encrypted using the AES-CTR-256 symmetric encryption algorithm, and the vectors are encrypted using the DCPE encrypted state computation algorithm; the hash value of each encrypted text block is calculated, and a Merkle tree is constructed with each hash value as a leaf node to generate the root hash value; the root hash value, document version number, timestamp, and access control-related metadata are submitted as transactions to the blockchain storage layer, verified by the consensus mechanism, and packaged into a block; simultaneously, the encrypted text blocks and vectors are stored in a high-performance vector database, and the hash value or block number of the on-chain transaction is associated with the vector database index; S2: Query Response, Verification, and Answer Generation. Specifically: The system receives user queries and converts them into high-dimensional vectors using a pre-trained embedding model. It then uses these query vectors to perform a similarity search in an encrypted vector database, returning the k most relevant encrypted data blocks. Next, it retrieves the blockchain transaction hash value and Merkle proof path corresponding to each encrypted data block from the vector database. It queries the Merkle tree root hash value stored in the blockchain's notarization layer and compares the locally generated root hash with the on-chain root hash using cryptographic calculations. If the verification fails, the data block is discarded. Finally, it sends the verified encrypted data block to the security management module for decryption and restoration to the original text. The original text and the user query are used as context input to a large language model to generate an answer based on credible facts, which is then returned to the user.

[0025] A computer device, characterized in that it includes a memory and one or more processors, wherein the memory stores computer code, and when the computer code is executed by the one or more processors, causes the one or more processors to perform the method as described above.

[0026] A computer-readable storage medium storing computer code that, when executed, performs the method described above.

[0027] Compared with the prior art, the present invention has at least one of the following beneficial effects: (1) Significantly enhance data credibility and integrity, and build an immutable trust foundation. This invention stores core integrity evidence (such as encrypted hash values ​​and the root hash value of a Merkle tree) of RAG knowledge base data on the blockchain through a blockchain evidence storage layer. Utilizing the decentralized architecture and cryptographic mechanisms of blockchain, each piece of data is given an immutable "trust anchor." Whether it's the original text block or vector embedding when data is entered into the database, or the data retrieval process, data consistency can be verified through on-chain evidence storage information. Any malicious tampering (such as replacing key content or injecting false information) will cause a mismatch between the locally calculated hash value and the on-chain evidence value, thus being immediately identified and discarded by the system. Simultaneously, the complete evidence storage timestamps and data-related metadata recorded on the blockchain form a traceable chain of evidence, clearly reconstructing the entire lifecycle of data flow from collection and processing to storage, completely solving the core pain points of traditional RAG systems caused by centralized storage, such as susceptibility to data tampering and low credibility.

[0028] (2) Comprehensive data privacy protection, adaptable to sensitive data processing scenarios To address common enterprise-specific data (such as internal business documents and technical manuals) and sensitive personal information (such as medical records and financial account data) found in the RAG knowledge base, this invention constructs a privacy protection system of "dual-layer encryption + encrypted retrieval": On the one hand, text blocks are encrypted using the AES-CTR-256 symmetric encryption algorithm, and vectors are encrypted using the DCPE encrypted computation algorithm, ensuring that data remains encrypted throughout storage (off-chain vector database / decentralized storage). Even if the database is accessed without authorization, attackers cannot parse the data content. On the other hand, it supports direct vector similarity retrieval in encrypted mode, completing the query matching without decrypting the encrypted vectors, thus avoiding the risk of privacy leakage during the retrieval process. This design effectively solves the problem that traditional RAG systems rely solely on access control policies and are prone to privacy leaks due to permission vulnerabilities, making it securely applicable to scenarios with extremely high data privacy requirements, such as financial risk control and medical information management.

[0029] (3) Significantly enhance audit and traceability capabilities to meet compliance requirements. This invention records all key operations related to knowledge base data (such as data entry and on-chain processing, permission changes, and retrieval verification records) in a decentralized blockchain ledger. This ledger possesses the characteristics of being tamper-proof and non-repudiable: auditors can trace the provenance source of a data block (such as the original document identifier and on-chain node) through on-chain transaction hashes, confirm the order of data processing through timestamps, and verify data access authorization records through permission metadata, without relying on easily forged centralized logs. This transparent and traceable auditing mechanism fully meets the requirements of laws and regulations such as the Data Security Law and the Personal Information Protection Law for auditability throughout the entire data lifecycle. It is particularly suitable for cross-institutional data sharing scenarios (such as medical alliances and financial industry collaborations), providing a credible basis for compliant data flow.

[0030] (4) Achieving a high-efficiency balance between performance and safety, breaking through the bottleneck of technological integration. This invention innovatively adopts a hybrid architecture of "on-chain evidence storage and off-chain storage," fundamentally resolving the inherent contradiction between RAG technology (requiring high-performance retrieval) and blockchain technology (requiring security and trustworthiness but limited performance). It stores massive knowledge base data (encrypted text blocks, vectors) in high-performance off-chain databases (such as Milvus and FAISS) and optional decentralized storage networks (such as IPFS), ensuring millisecond-level retrieval response speed and high-concurrency processing capabilities for the RAG system, avoiding performance degradation caused by redundant storage across blockchain nodes. Only "high-value lightweight information" such as data integrity evidence and core metadata is uploaded to the blockchain, significantly reducing the storage pressure and transaction costs of the blockchain, while leveraging the security features of blockchain to provide trusted endorsement for off-chain data. This architecture retains the advantages of the RAG system in efficiently integrating external knowledge and reducing the "illusion" of LLM, while also possessing the immutability and traceability of blockchain, achieving a technical balance of "security without sacrificing performance, and performance without compromising security." Attached Figure Description

[0031] Figure 1 This is a schematic diagram of the overall architecture of the RAG system for data security assurance based on blockchain, as described in this invention. The diagram illustrates the interrelationships between the RAG core module, data storage layer, blockchain evidence storage layer, and security management module, and highlights the hybrid on-chain and off-chain structure. Figure 2 This is a flowchart of the data entry and on-chain evidence storage process of this invention; the flowchart details each step of the data from the original document to the final on-chain evidence storage, including block division, encryption, hash calculation and Merkle tree construction; Figure 3 This is a flowchart illustrating the user query, data retrieval, on-chain verification, and generation process of this invention. The flowchart details the entire process of a user query, from initiation, off-chain retrieval, on-chain verification to the final generation of an answer. Figure 4 This is a diagram of the Merkle tree data integrity verification structure of the present invention; the diagram clearly shows the construction principle of the Merkle tree and how it uses the root hash value to verify the integrity of a single data block. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0033] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0034] like Figure 1 As shown, this invention provides an innovative system architecture, the core idea of ​​which lies in the deep integration of the high-efficiency retrieval capabilities of RAG technology with the immutability of blockchain technology. The system consists of the following main components working together: The core modules of RAG include an indexer, a retriever, and a generator. The indexer is responsible for processing and vectorizing knowledge base documents. The retriever receives user queries and retrieves relevant data from the knowledge base. The generator combines the retrieved results with the LLM (Local Level Model) to generate the final answer.

[0035] Data Storage Layer: This invention employs a hybrid storage model, primarily comprising a high-performance vector database and an optional decentralized storage network. The vector database (such as Milvus or FAISS) stores encrypted text blocks and vector embeddings to support high-speed, low-latency similarity retrieval. The decentralized storage network (such as IPFS) serves as auxiliary storage, used to store original documents or data chunks, further enhancing data decentralization and censorship resistance.

[0036] Blockchain Evidence Storage Layer: This invention employs a permissioned consortium blockchain or public blockchain as the evidence storage layer. This layer is used solely to store the encrypted hash values, Merkle tree roots, and operation logs of the knowledge base data, serving as the sole trusted source for data integrity and authenticity, thus avoiding the performance and cost issues associated with storing massive amounts of data.

[0037] Security Management Module: This is a critical component responsible for identity authentication, access control, key management, and data encryption / decryption operations, ensuring data security throughout its entire lifecycle. This module works in conjunction with the blockchain evidence storage layer, implementing fine-grained access control through on-chain smart contracts.

[0038] This architecture cleverly separates the high-performance retrieval required by RAG from the robust security provided by the blockchain. The knowledge base itself serves as a high-performance, scalable retrieval database, while the blockchain acts as its immutable "trust layer," handling only a small number of high-value evidence-based transactions. This design fundamentally resolves the inherent trade-off between performance and security in existing technologies.

[0039] Detailed explanation of the key technical features involved in this invention: (1) Data encryption scheme To address the potential privacy risks associated with vector databases, this invention implements strong encryption measures at the data storage level, forming a second layer of protection for data security. Even if the database is compromised by an attacker, unauthorized access will not be able to directly read or utilize the data. This invention encrypts the original text blocks and vector embeddings in the RAG knowledge base separately: Text block encryption: Each text block is encrypted using an industry-standard symmetric encryption algorithm, such as AES-CTR-256. This algorithm is widely used in data encryption scenarios due to its efficiency and high security.

[0040] Vector Encryption: For high-dimensional vectors, this invention employs encryption algorithms that support encrypted computation, such as DCPE. This technology allows for similarity calculation and ranking without decrypting the vectors, ensuring the privacy of the RAG retrieval process. This fundamentally avoids potential privacy leaks during the retrieval process, a feature unmatched by traditional access control schemes.

[0041] (2) Data integrity verification mechanism This invention utilizes the combination of Merkle trees and blockchain to provide robust integrity verification capabilities for RAG knowledge base data.

[0042] Merkle Tree: A Merkle tree is a binary tree structure used to efficiently verify the integrity of large-scale data sets. In this invention, the hash value of each encrypted text block serves as a leaf node of the Merkle tree. By calculating the hash layer by layer upwards, a unique root hash value is finally obtained.

[0043] On-chain verification: When data is added to the database, the unique root hash value is stored on the blockchain as proof. During queries, the RAG system retrieves the data block along with its "proof path" in the Merkle tree. Based on the root hash value stored on-chain, the system can verify whether the data block is consistent with its on-chain state through simple cryptographic calculations; any minor alteration will cause verification failure. This mechanism significantly reduces the storage burden on the blockchain while providing highly efficient and non-repudiable integrity verification.

[0044] (3) On-chain data structure of knowledge base To avoid the storage and performance bottlenecks of blockchain, this invention employs a simplified data structure when uploading data to the blockchain, rather than uploading the entire data block. The data uploaded to the blockchain only includes: a) Merkle tree root hash value; b) The unique identifier and version number of the knowledge document; c) On-chain timestamp; d) Access control metadata; e) Other necessary metadata.

[0045] This data structure allows the blockchain evidence storage layer to serve only as a "trust anchor" for the high-performance off-chain database, achieving a perfect balance between performance and security.

[0046] (4) Performance and safety comparison analysis The value of this invention lies in its resolution of the fundamental contradictions in performance and security between traditional RAG systems and pure blockchain solutions. Table 1 below compares the performance of the three solutions in key technical features in detail: Table 1: Comparison of the present invention with existing technical solutions The hybrid architecture proposed in this invention addresses data integrity and source trust issues through on-chain evidence storage, and mitigates privacy leaks through data-layer encryption. This solution is not a simple aggregation of technologies, but rather a novel, structured solution based on a deep understanding of the respective advantages and disadvantages of RAG and blockchain. It fundamentally resolves the performance-security contradiction that existing technologies cannot overcome, thus demonstrating its inventiveness and practicality.

[0047] The following is an illustration through specific examples: First Embodiment This embodiment provides a blockchain-based data security assurance retrieval enhancement generation system, characterized by including a data processing module, a blockchain evidence storage module, a retrieval and verification module, a decryption and generation module, and a security management module; The data processing module is used to segment and vectorize the original external knowledge document, and encrypt the segment and / or the vector to generate integrity evidence of the segment, while storing the encrypted segment and encrypted vector in an off-chain database.

[0048] The blockchain evidence storage module is used to store the integrity evidence generated by the data processing module and the metadata associated with the original knowledge document on the blockchain, providing an immutable trust anchor for the off-chain database.

[0049] The retrieval and verification module is used to receive user queries, retrieve relevant encrypted data from the off-chain database based on the queries, and verify the integrity of the retrieved encrypted data using the integrity evidence stored in the blockchain evidence storage module.

[0050] The decryption and generation module is used to decrypt the encrypted data verified by the retrieval and verification module, and input the decrypted data and the user query as context into the large language model to generate a credible answer.

[0051] The security management module is used to authenticate users and control access, restrict access permissions to various modules of the system, and is also responsible for key management and data encryption / decryption operations to ensure data security throughout its entire lifecycle. It also works in conjunction with the blockchain evidence storage module to achieve fine-grained access control through on-chain smart contracts.

[0052] The integrity evidence generated by the data processing module includes the cryptographic hash value of the cryptographic block and / or the root hash value of a Merkle tree constructed using the cryptographic hash values ​​of multiple cryptographic blocks as leaf nodes; the data processing module's block segmentation operation on the original knowledge document is to divide the document into text blocks of appropriate size and semantics, and the vectorization operation is to use a pre-trained embedding model to convert each text block into a high-dimensional numerical vector; and the original knowledge document processed by the data processing module comes from various structured or unstructured external knowledge sources, including file data such as PDF documents, database files, and API interface data.

[0053] The off-chain database adopts a hybrid storage mode, including a high-performance vector database and an optional decentralized storage network. The vector database is used to store the encrypted blocks and the encrypted vectors to support high-speed, low-latency similarity retrieval. The decentralized storage network is used to store the original knowledge documents or the encrypted blocks, further enhancing the decentralization and censorship resistance of the data. The vector database uses databases including Milvus and FAISS, and the decentralized storage network uses databases including IPFS. When the off-chain database stores the encrypted blocks and the encrypted vectors, it associates the hash value or block number of the on-chain transaction with the index of the vector database to quickly match the on-chain evidence information during subsequent retrieval.

[0054] The data processing module employs differentiated encryption strategies for the blocks and the vectors: for the text blocks, an industry-standard symmetric encryption algorithm, specifically AES-CTR-256, is used to protect the privacy of the text content; for the high-dimensional numerical vectors, an encryption algorithm that supports encrypted computation, specifically DCPE, is used. This algorithm allows similarity calculations without decrypting the vectors, ensuring that vector data is not leaked during the retrieval process, thus forming dual privacy protection.

[0055] The blockchain evidence storage module uses a permissioned consortium blockchain or public blockchain as the evidence storage layer, storing only key information to avoid performance and storage bottlenecks. The stored content includes: the integrity evidence including encrypted hash values ​​and the root hash value of the Merkle tree, the unique identifier and version number of the original knowledge document, the timestamp of the on-chain operation, metadata related to data access permissions, and the system's full lifecycle operation log of the knowledge base data. When uploading to the blockchain, the root hash value of the Merkle tree, the document version number, the timestamp, and the access control metadata are encapsulated into a transaction and submitted to the blockchain evidence storage layer. After verification by network consensus mechanisms including PBFT and PoS, it is packaged into a block to form a permanent and tamper-proof evidence record, which serves as the sole credible basis for data integrity and authenticity.

[0056] The workflow and verification logic of the retrieval and verification module are as follows: First, after receiving the user query, the query is transformed into a high-dimensional query vector using a pre-trained embedding model consistent with the data processing module. Second, the query vector is used to perform a closed-state similarity retrieval in an encrypted vector database based on algorithms including cosine similarity and Euclidean distance to recall the k most relevant encrypted data blocks. Third, integrity verification is initiated: the blockchain transaction hash value and Merkle proof path corresponding to the encrypted data block are obtained from the vector database, including the sibling node hash and parent node hash of the data block hash. The Merkle tree root hash value recorded in the transaction is queried through the blockchain evidence storage module. On the local machine or verification server, the hash of the encrypted data block and the hash in the proof path are calculated layer by layer upwards according to the Merkle tree calculation rules to obtain the local root hash. If the local root hash is consistent with the on-chain root hash, the verification is successful; otherwise, the data is determined to have been tampered with, and the data block is discarded or marked as untrustworthy.

[0057] The decryption and generation module follows a verification-before-decryption principle: it only receives encrypted data blocks that have passed verification as filtered by the retrieval and verification module, sends them to the security management module, and the security management module calls the corresponding decryption key based on the key management strategy to decrypt and restore the original text block. In the generation stage, the decrypted original text block is integrated with the user's original query context and fed as input to the Large Language Model (LLMs). The model generates an answer based on this trusted context, ensuring that the output content comes entirely from tamper-proof factual data, fundamentally eliminating illusions or erroneous information caused by data problems. Finally, the generated trusted answer is fed back to the user.

[0058] Second Embodiment This embodiment provides two specific examples to further illustrate the technical solution of the present invention: Example 1: Enterprise-grade RAG system based on consortium blockchain This embodiment addresses scenarios with high requirements for data security, access control, and retrieval performance, such as internal enterprise knowledge management and cross-institutional collaboration (e.g., financial institution alliances, medical consortia). It employs a permissioned consortium blockchain as the blockchain evidence storage layer, combined with the "on-chain evidence storage + off-chain storage" architecture of this invention, to construct an enterprise-level RAG system. The specific implementation scheme is as follows: (1) System architecture adaptation Consortium Blockchain Selection and Deployment: Hyperledger Fabric was chosen as the underlying framework for the consortium blockchain. Participating institutions (such as multiple hospitals or bank branches) jointly act as consortium nodes. Node identities must be authenticated through PKI (Public Key Infrastructure) before joining the network to ensure node trustworthiness. Compared to public blockchains, this consortium blockchain adopts the PBFT (Practical Byzantine Fault Tolerance) consensus mechanism, achieving a transaction throughput (TPS) of hundreds of transactions per second. This significantly reduces the confirmation latency of evidence storage transactions (typically in the second range), perfectly matching the performance requirements of enterprise-level RAG systems for high-frequency data retrieval and real-time evidence storage.

[0059] Off-chain storage collaborates with the RAG core module: The off-chain storage layer uses the Milvus vector database as the primary storage, storing AES-CTR-256 encrypted text blocks and DCPE encrypted vector data, supporting millisecond-level semantic similarity retrieval; simultaneously, an enterprise-grade private file system is deployed to back up original knowledge documents (such as hospital electronic medical record templates and bank risk control rule manuals). The indexer of the RAG core module periodically collects new documents from the enterprise OA system and business databases, automatically completing block segmentation, vectorization, and encryption processing to ensure real-time updates to the knowledge base.

[0060] (2) Access control and data security Fine-grained access control driven by smart contracts: Access management smart contracts are deployed on the consortium blockchain, pre-defining access rules (ACLs) for each participating institution and user role. For example, in a cross-hospital medical knowledge-sharing scenario, a chief physician at a tertiary hospital can access all specialist case text blocks, while doctors at community hospitals can only access basic common disease case text blocks, and patients can only view their own associated medical record fragments. When a user initiates a search request, the security management module calls the on-chain smart contract to verify the user's identity and permissions, allowing the retrieval of only encrypted data blocks within the authorized scope, thus preventing unauthorized access at the source.

[0061] End-to-end auditing and traceability: All data operations (such as document entry and on-chain processing, user retrieval, and permission changes) are triggered by smart contracts, and transaction records (including operator, timestamp, and data identifier) ​​are permanently written to the consortium blockchain ledger. Enterprise auditors can use on-chain query tools to trace the on-chain node of a specific text block (such as the information system of a hospital) and retrieval records (such as the query time of a doctor), ensuring that the entire data flow is compliant and meets industry regulatory requirements such as the "Medical Data Security Guidelines" and the "Financial Data Security Standards".

[0062] (3) Application effect After deployment in this embodiment, the enterprise-level RAG system maintains a high-frequency retrieval response of dozens of times per second while achieving zero data tampering and zero privacy leakage: In financial risk control scenarios, risk control rule text blocks based on consortium blockchain notarization can effectively avoid the risk of misjudgment caused by rule tampering, and the retrieval verification accuracy rate reaches 100%; In medical knowledge sharing scenarios, access control ensures that sensitive medical record data can only be accessed by authorized personnel, improving the privacy protection compliance rate to 100%, while the retrieval response time is controlled within 500 milliseconds, meeting the clinical real-time query needs.

[0063] Example 2: RAG system based on decentralized storage This embodiment addresses scenarios requiring enhanced data censorship resistance and reduced reliance on centralized storage, such as knowledge management in open-source communities and cross-regional distributed collaboration. It stores knowledge base data on a decentralized storage network (IPFS) and combines it with a blockchain-based evidence layer to overcome the inherent limitations of IPFS, constructing a highly trustworthy and reliable RAG system. The specific implementation scheme is as follows: (1) Storage architecture design IPFS serves as the primary off-chain storage: Original knowledge documents (such as open-source project manuals and academic papers) and block-encrypted text blocks (AES-CTR-256 encryption) are uploaded to the IPFS network. IPFS generates a unique Content ID (CID) for each data block through a content addressing mechanism—the CID is calculated from the hash of the data content. If the data is tampered with, the CID will change accordingly, thus initially ensuring data integrity. Simultaneously, to avoid the problem of "data loss if not pinned" in IPFS, the system deploys multiple distributed nodes (such as community servers distributed in different regions) to perform "pinned storage" of the core knowledge base data, ensuring data persistence.

[0064] Vector database and IPFS collaboration: Deploy the FAISS lightweight vector database locally or on edge nodes to store vector data encrypted by DCPE. The vector data is associated with the corresponding text block CID on IPFS. When the retrieval tool obtains the relevant vector, it can quickly retrieve the corresponding encrypted text block from IPFS through the CID, achieving a seamless connection between "vector retrieval and text retrieval" and balancing decentralized storage with retrieval efficiency.

[0065] (2) Blockchain-based evidence storage addresses the limitations of IPFS. On-chain CID Enhances Integrity Proof: A smart contract for data storage is deployed at the blockchain's notarization layer (using the Ethereum sidechain Polygon, balancing low cost and high performance). When data is uploaded to IPFS, the system automatically encapsulates the CID of the text block, its corresponding cryptographic hash value, data upload timestamp, and upload node identifier into a notarization transaction and submits it to the blockchain. If data on IPFS is maliciously tampered with (e.g., replacing code snippets in the open-source manual), inconsistencies can be immediately detected by comparing the on-chain CID with the tampered data's CID, determining the data as untrustworthy. Simultaneously, the on-chain notarized cryptographic hash value serves as a secondary verification basis, further ensuring data integrity.

[0066] Data Availability Traceability: In the IPFS network, data availability depends on the nodes' willingness to store data, and traditional methods cannot trace whether data has been effectively stored. This embodiment records the storage proof of "fixed nodes" through a blockchain notarization layer—fixed nodes periodically submit a list of CIDs of their stored data and the storage time to a smart contract. After contract verification, a storage proof transaction is generated and uploaded to the blockchain. When a retrieval reveals that a certain IPFS data block cannot be retrieved, the historical fixed nodes of that data block can be traced through the on-chain storage proof, helping to locate the cause of data loss and improving system reliability.

[0067] (3) Application effect After being applied in the knowledge management scenario of the open source community, this embodiment demonstrated significant resistance to censorship and reliability: the retrieval response time of open source project manuals was controlled within 1 second, meeting the real-time query needs of community users; even if some IPFS nodes went offline, core data could still be retrieved normally due to fixed storage on multiple nodes and on-chain CID traceability, with data availability reaching 99.9%; at the same time, blockchain notarization prevented malicious tampering of open source documents, and the data credibility was improved by 100% compared to the traditional IPFS storage solution, effectively ensuring the authenticity and inheritance of open source knowledge.

[0068] Third Embodiment This embodiment provides a blockchain-based data security guarantee retrieval enhancement generation method executed using the blockchain-based data security guarantee retrieval enhancement generation system as described in the first embodiment, characterized by including the following steps: S1: Data entry and notarization, specifically: raw data is collected from structured or unstructured external knowledge sources, including PDF documents, databases, and API interfaces; the raw data is segmented into text blocks of appropriate size and semantics and transformed into high-dimensional numerical vectors through a pre-trained embedding model; the text blocks are encrypted using the AES-CTR-256 symmetric encryption algorithm, and the vectors are encrypted using the DCPE encrypted state computation algorithm; the hash value of each encrypted text block is calculated, and a Merkle tree is constructed with each hash value as a leaf node to generate a root hash value; the root hash value, document version number, timestamp, and access control-related metadata are submitted as transactions to the blockchain notarization layer, verified by the consensus mechanism, and packaged into a block; simultaneously, the encrypted text blocks and vectors are stored in a high-performance vector database, and the hash value or block number of the on-chain transaction is associated with the vector database index.

[0069] In this embodiment, as Figure 2 As shown, step S1 specifically involves: Step 1: Data Acquisition and Preprocessing: The system collects raw data from various structured or unstructured external knowledge sources (such as PDF documents, databases, API interfaces, etc.).

[0070] Step 2: Data Chunking and Vectorization: The collected raw data is processed by the indexer. First, the document is segmented into text chunks of appropriate size and semantics. Then, using a pre-trained embedding model, each text chunk is transformed into a high-dimensional numerical vector.

[0071] Step 3: Data Encryption: This is one of the key security steps of this invention. The generated text blocks and corresponding vectors are encrypted. The text blocks can be encrypted using industry-standard symmetric encryption algorithms, such as AES-CTR-256, to protect their content. The vectors can be encrypted using encryption algorithms that support encrypted similarity calculation, such as DCPE. Even if an unauthorized third party obtains the encrypted vector database, they cannot directly read or utilize the data, thus providing an additional, stronger layer of privacy protection.

[0072] Step 4: Generate Integrity Evidence: After encryption, the system calculates the cryptographic hash value for each encrypted text block. Then, using the hash values ​​of all text blocks as leaf nodes, a Merkle tree is constructed (e.g., ...). Figure 4 This generates a unique root hash value. This root hash value represents the integrity of the entire document collection.

[0073] Step 5: On-chain Notification: The root hash value of the Merkle tree, the document version number, the timestamp, and other metadata related to access control are submitted as a transaction to the blockchain notification layer. After verification by the consensus mechanism, the transaction is packaged into a block and obtains a permanent and tamper-proof notification record.

[0074] Step 6: Storage: The encrypted text blocks and vectors are stored in a high-performance vector database. Simultaneously, the hash value or block number of the on-chain transaction is associated with the index in the vector database for verification during subsequent retrieval.

[0075] S2: Query Response, Verification, and Answer Generation. Specifically: The system receives user queries and converts them into high-dimensional vectors using a pre-trained embedding model. It then uses these query vectors to perform a similarity search in an encrypted vector database, returning the k most relevant encrypted data blocks. Next, it retrieves the blockchain transaction hash value and Merkle proof path corresponding to each encrypted data block from the vector database. It queries the Merkle tree root hash value stored in the blockchain's notarization layer and compares the locally generated root hash with the on-chain root hash using cryptographic calculations. If the verification fails, the data block is discarded. Finally, it sends the verified encrypted data block to the security management module for decryption and restoration to the original text. The original text and the user query are used as context input to a large language model to generate an answer based on credible facts, which is then returned to the user.

[0076] In this embodiment, as Figure 3 As shown, step S2 specifically involves: Step 1: User Query and Vectorization: The user initiates a query request, which is received by the RAG system and converted into a vector.

[0077] Step 2: Encrypted Retrieval: The RAG system's retrieval engine uses query vectors to perform similarity searches in an encrypted vector database, returning the k most relevant encrypted data blocks. Because it employs an encryption algorithm that supports encrypted computation, this retrieval process does not require decryption, ensuring data privacy during the retrieval process.

[0078] Step 3: On-chain Integrity Verification: This is the core innovation of this invention. For each retrieved encrypted data block, the system performs the following operations: Retrieves the corresponding blockchain transaction hash value and Merkle proof path from the vector database. Queryes and retrieves the Merkle root hash value recorded in the transaction through the blockchain evidence storage layer. Performs cryptographic verification locally or on the verification server using the retrieved encrypted data block, the corresponding proof path, and the on-chain root hash value. If verification fails, the data block is deemed tampered with and will be discarded or marked as untrustworthy.

[0079] Step 4: Data Decryption: Only data blocks that pass the integrity verification will be sent to the security management module for decryption and restoration to the original text.

[0080] Step 5: Enhanced Generation: The decrypted, verified real text, along with the original user query, is fed as contextual input into the large language model, which generates the final answer using LLM. This process ensures that the generated content is entirely based on credible and tamper-proof sources, fundamentally eliminating false or erroneous information caused by problems with the knowledge base data.

[0081] Step 6: Return Results: Return the final answer generated by LLM to the user.

[0082] A computer-readable storage medium stores computer code that, when executed, performs the methods described above. Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. This program can be stored in a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0083] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.

[0084] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0085] It should be noted that the above embodiments can be freely combined as needed. The above description is only a preferred embodiment of the present invention. It should be pointed out that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A blockchain-based data security guarantee retrieval enhancement generation system, characterized in that, It includes a data processing module, a blockchain evidence storage module, a retrieval and verification module, a decryption and generation module, and a security management module; The data processing module is used to segment and vectorize the original external knowledge document, and encrypt the segment and / or the vector to generate integrity evidence of the segment, while storing the encrypted segment and encrypted vector in an off-chain database. The blockchain evidence storage module is used to store the integrity evidence generated by the data processing module and the metadata associated with the original knowledge document on the blockchain, providing an immutable trust anchor for the off-chain database. The retrieval and verification module is used to receive user queries, retrieve relevant encrypted data from the off-chain database based on the queries, and verify the integrity of the retrieved encrypted data using the integrity evidence stored in the blockchain evidence storage module. The decryption and generation module is used to decrypt the encrypted data verified by the retrieval and verification module, and input the decrypted data and the user query as context into the large language model to generate a credible answer. The security management module is used to authenticate users and control access, restrict access permissions to various modules of the system, and is also responsible for key management and data encryption / decryption operations to ensure data security throughout its entire lifecycle. It also works in conjunction with the blockchain evidence storage module to achieve fine-grained access control through on-chain smart contracts.

2. The blockchain-based data security guarantee retrieval enhancement generation system according to claim 1, characterized in that, The integrity evidence generated by the data processing module includes the cryptographic hash value of the cryptographic block and / or the root hash value of a Merkle tree constructed from the cryptographic hash values ​​of multiple cryptographic blocks as leaf nodes; The data processing module performs a block segmentation operation on the original knowledge document, dividing the document into text blocks of appropriate size and semantics. The vectorization operation uses a pre-trained embedding model to convert each text block into a high-dimensional numerical vector. The original knowledge document processed by the data processing module comes from various structured or unstructured external knowledge sources, including file data such as PDF documents, database files, and API interface data.

3. The blockchain-based data security guarantee retrieval enhancement generation system according to claim 1, characterized in that, The off-chain database adopts a hybrid storage mode, including a high-performance vector database and an optional decentralized storage network; The vector database is used to store the encrypted blocks and the encrypted vectors to support high-speed, low-latency similarity retrieval. The decentralized storage network is used to store the original knowledge documents or the encrypted blocks, further enhancing the decentralization and censorship resistance of the data. The vector database is selected from databases including Milvus and FAISS, and the decentralized storage network is selected from databases including IPFS. Furthermore, when the off-chain database stores the encrypted blocks and the encrypted vectors, it associates the hash value or block number of the on-chain transaction with the index of the vector database so as to quickly match the on-chain evidence information during subsequent retrieval.

4. The blockchain-based data security guarantee retrieval enhancement generation system according to claim 1, characterized in that, The data processing module employs a differentiated encryption strategy for the blocks and the vectors: The text blocks are encrypted using an industry-standard symmetric encryption algorithm, specifically AES-CTR-256, to protect the privacy of the text content. For the vector in high-dimensional numerical form, an encryption algorithm that supports encrypted computation, specifically DCPE, is used. This algorithm allows similarity calculation without decrypting the vector, ensuring that vector data is not leaked during the retrieval process, thus forming a double privacy protection.

5. The blockchain-based data security guarantee retrieval enhancement generation system according to claim 1, characterized in that, The blockchain evidence storage module uses a permissioned consortium blockchain or a public blockchain as the evidence storage layer, storing only key information to avoid performance and storage bottlenecks. The stored content includes: The integrity evidence includes cryptographic hash values, the root hash value of the Merkle tree, the unique identifier and version number of the original knowledge document, the timestamp of the on-chain operation, metadata related to data access permissions, and the system's full lifecycle operation logs of the knowledge base data; When data is uploaded to the blockchain, the root hash value of the Merkle tree, the document version number, the timestamp, and the access control metadata are encapsulated into a transaction and submitted to the blockchain's evidence storage layer. After verification by network consensus mechanisms, including PBFT and PoS, the transaction is packaged into a block to form a permanent and tamper-proof evidence record, which serves as the sole credible basis for data integrity and authenticity.

6. The blockchain-based data security guarantee retrieval enhancement generation system according to claim 1, characterized in that, The workflow and verification logic of the retrieval and verification module are as follows: The first step is to receive the user query and then transform the query into a high-dimensional query vector using a pre-trained embedding model consistent with the data processing module. The second step involves using the query vector to perform a closed-state similarity retrieval in the encrypted vector database based on algorithms including cosine similarity and Euclidean distance, and recalling the k most relevant encrypted data blocks. The third step is to initiate integrity verification: retrieve the blockchain transaction hash value and Merkle proof path corresponding to the encrypted data block from the vector database, including the sibling node hash and parent node hash of the data block hash. Query the Merkle tree root hash value recorded in the transaction through the blockchain evidence storage module. On the local machine or verification server, calculate the encrypted data block hash and the hash in the proof path layer by layer upwards according to the Merkle tree calculation rules to obtain the local root hash. If the local root hash is consistent with the on-chain root hash, the verification is successful; otherwise, it is determined that the data has been tampered with, and the data block is discarded or marked as untrustworthy.

7. The blockchain-based data security guarantee retrieval enhancement generation system according to claim 1, characterized in that, The decryption and generation module follows the principle of verification before decryption: Only encrypted data blocks that have passed verification and are filtered by the retrieval and verification module are received and sent to the security management module. The security management module then calls the corresponding decryption key based on the key management strategy to decrypt the data and restore it to the original text block. During the generation phase, the decrypted original text block is integrated with the user's original query in context and fed as input to the Large Language Model (LLM). The model generates a response based on this credible context, ensuring that the output content comes entirely from tamper-proof factual data, fundamentally eliminating illusions or misinformation caused by data issues. Finally, the generated credible response is fed back to the user.

8. A blockchain-based data security guarantee retrieval enhancement generation method executed by the blockchain-based data security guarantee retrieval enhancement generation system as described in any one of claims 1-7, characterized in that, Includes the following steps: S1: Data entry and storage, specifically: raw data is collected from structured or unstructured external knowledge sources, including PDF documents, databases, and API interfaces; the raw data is segmented into text blocks of appropriate size and semantics and transformed into high-dimensional numerical vectors through a pre-trained embedding model; the text blocks are encrypted using the AES-CTR-256 symmetric encryption algorithm, and the vectors are encrypted using the DCPE encrypted state computation algorithm; the hash value of each encrypted text block is calculated, and a Merkle tree is constructed with each hash value as a leaf node to generate the root hash value; the root hash value, document version number, timestamp, and access control-related metadata are submitted as transactions to the blockchain storage layer, verified by the consensus mechanism, and packaged into a block; simultaneously, the encrypted text blocks and vectors are stored in a high-performance vector database, and the hash value or block number of the on-chain transaction is associated with the vector database index; S2: Query response, verification and answer generation, specifically: receiving user queries and converting them into high-dimensional vectors through a pre-trained embedding model, using the query vector to perform similarity retrieval in an encrypted vector database, and returning the k most relevant encrypted data blocks; The system retrieves the blockchain transaction hash value and Merkle proof path corresponding to the encrypted data block from the vector database, queries the Merkle tree root hash value stored in the blockchain evidence storage layer, compares the locally generated root hash with the on-chain root hash through cryptographic calculation, and discards the data block if the verification fails. The verified encrypted data block is sent to the security management module for decryption and restoration to the original text. The original text and the user query are used as context input for the large language model to generate a response based on credible facts, and finally the response is returned to the user.

9. A computer device, characterized in that, The device includes a memory and one or more processors, wherein the memory stores computer code that, when executed by the one or more processors, causes the one or more processors to perform the method as described in claim 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer code, and when the computer code is executed, the method of claim 8 is performed.