Block chain data processing method and system
By performing sharded homomorphic encryption of blockchain data and building an improved storage structure, combining smart contracts and consensus mechanisms, the security, privacy protection and efficiency issues in blockchain data processing are solved, and data security sharing and value mining are realized.
Patent Information
- Application Number
- CN202510198361.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-22
- Publication Date
- 2025-05-30
AI Technical Summary
Blockchain faces problems such as data security, privacy protection, and decentralization in data processing. As the amount of data increases, storage pressure increases, data verification is inefficient, resource consumption is high, and data analysis is difficult to carry out.
By sharding the original data and homomorphically encrypting the data after sharding, building an M_H+ tree to improve the blockchain storage structure, storing the encrypted data on the off-chain server, and storing relevant data on the blockchain, verifying the data using smart contracts and consensus mechanisms to realize dynamic permission management and data analysis.
It improves the security and privacy protection of data processing, reduces the risk of data leakage, enhances the integrity and traceability of data, realizes efficient sharing of data and value mining, and promotes the circulation and utilization of data.
Smart Images

Figure CN120074790A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain data processing method and system. Background Art
[0002] As a distributed ledger technology, blockchain provides characteristics such as decentralization, immutability, and transparency in data processing. These characteristics make it have potential application value in the field of data processing. With the continuous maturity of technology, more and more industries have begun to explore the application of blockchain technology in their own fields, such as supply chain management, financial services, Internet of Things, and so on.
[0003] The blockchain technology itself is publicly transparent. Most current blockchain applications focus on data deposit, and smart contracts mainly involve simple deposit and query. However, with the continuous in-depth application, many challenges are still faced, such as data security, privacy protection, decentralization and other issues. With the continuous growth of blockchain data volume, the storage pressure is increasing day by day; the data verification process may have problems of low efficiency and high resource consumption; and data analysis is also difficult to effectively carry out due to the complex data structure and privacy protection requirements. These all affect the further application of blockchain.
[0004] In view of the above problems, it is necessary to provide a blockchain data processing method to improve the security and efficiency of blockchain in data processing. Summary of the Invention
[0005] The purpose of the present invention is to provide a blockchain data processing method for solving at least one or more of the above-mentioned technical problems.
[0006] In the first aspect, the present invention provides a blockchain data processing method, including: slicing the original data into multiple small pieces greater than or equal to 1, where the size of the small pieces conforms to the block size of the blockchain; performing homomorphic encryption processing on the sliced original data to obtain encrypted data; constructing an M_H+ tree to improve the blockchain storage structure using the M_H+ tree; storing the encrypted data in an off-chain server and storing the relevant data of the encrypted data on the blockchain; where the relevant data includes the hash value of the encrypted data, transaction records, and smart contract execution results; verifying the encrypted data using a smart contract and a consensus mechanism; performing dynamic permission management through the blockchain storage structure; analyzing the relevant data on the blockchain according to the encrypted data of multiple nodes to obtain an analysis result; and providing feedback information according to the analysis result.
[0007] In some embodiments, the original data after fragmentation is subjected to homomorphic encryption processing to obtain encrypted data. The steps include: generating a public-private key pair for homomorphic encryption; wherein the public key is used to encrypt data, and the private key is used to decrypt the calculation result; using the homomorphic encryption algorithm to encrypt the fragmented original data with the public key to generate encrypted data.
[0008] In some embodiments, the calculation steps of the homomorphic encryption algorithm include: converting the original data into encrypted data, where the conversion process formula is: , where c is the encrypted data; m is the original data, g(x) is the base polynomial for generating the basic structure of the encrypted data; f(x): a random polynomial for introducing randomness to increase the complexity and security of encryption; n is a large prime number for modular arithmetic to ensure the security of the encrypted data.
[0009] In some embodiments, the steps of constructing the M_H+ tree include: confirming the data within the block; constructing a B+ tree using the numerical size of the user identity address as the index; starting from the bottom layer, merging the leaf node hash values, calculating a new hash value, and recording the maximum and minimum values of the address; repeating until the root hash value is generated, and the root hash value is saved as part of the block header; the M_H+ tree formula includes: H(x)=hash(x⊕λ), where x is the transaction data in the block, ⊕ represents the bitwise exclusive OR operation to increase the randomness of the data; λ is a dynamic adjustment factor; hash(x) is a one-way hash function for generating the hash value of the data.
[0010] In some embodiments, constructing a B+ tree using the numerical size of the user identity address as the index includes: using the public key of the user to generate the user identity address through a hash algorithm; using the numerical value of the user identity address as the key to store the relevant block data in the B+ tree.
[0011] In a second aspect, the present invention provides a blockchain data processing system, comprising: a data preprocessing module: configured to slice the original data into a plurality of small pieces greater than or equal to 1, where the size of the small pieces conforms to the block size of the blockchain; a homomorphic encryption module: configured to perform homomorphic encryption processing on the sliced original data to obtain encrypted data; a storage structure construction module: configured to construct an M_H+ tree and create a blockchain storage structure using the M_H+ tree; a data storage module: configured to store the encrypted data in an off-chain server and store the relevant data of the encrypted data on the blockchain; where the relevant data includes the hash value of the encrypted data, transaction records, and smart contract execution results; a data verification module: configured to verify the encrypted data using a smart contract and a consensus mechanism; a blockchain permission module: configured to perform dynamic permission management of the blockchain through the blockchain storage structure; a data analysis module: configured to interact based on the encrypted data of multiple nodes and analyze the relevant data on the blockchain to obtain an analysis result; and an information feedback module: configured to provide feedback information based on the analysis result.
[0012] Through the method provided by the present invention, the embodiments of the present invention combine homomorphic encryption and blockchain technology. By constructing an M_H+ tree, the encrypted storage and secure calculation of data are realized, while improving the privacy and query efficiency of data. Using a smart contract and a consensus mechanism, the automated verification and processing of data are realized, improving efficiency and transparency. Through dynamic permission management, a flexible authorization access model is provided for data sharing, enhancing the controllability of data. Brief Description of the Drawings
[0013] The present invention will be further described below with reference to the accompanying drawings.
[0014] Figure 1 is a flowchart of a blockchain data processing method according to some embodiments of the present invention; Figure 2 is a schematic structural diagram of a blockchain data processing system according to some embodiments of the present invention. Detailed Embodiments
[0015] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0016] Figure 1 is a flowchart of a blockchain data processing method 100 according to some embodiments of the present invention.
[0017] As Figure 1As shown, in method 100, it includes step S101: fragment the original data into multiple small pieces greater than or equal to 1, and the size of the small pieces conforms to the block size of the blockchain.
[0018] In one embodiment, fragmenting the original data into multiple small pieces greater than or equal to 1, where the size of the small pieces conforms to the block size of the blockchain, includes: independently storing and processing each small piece after fragmenting the original data according to the block size of the blockchain; allowing the small pieces to overlap according to the cross-shard transaction consensus protocol.
[0019] The overlap between small pieces means allowing some nodes to belong to multiple shards (small pieces) simultaneously. These nodes can directly process cross-shard transactions involving multiple shards on them without the need to transmit messages between shards, thereby reducing the latency of transaction processing and improving system performance.
[0020] By using the sharding technology, the data is split into multiple parts (shards), and each shard can independently process transactions, thereby increasing the throughput of the overall blockchain. The system can dynamically adjust the shard configuration according to the transaction load and the blockchain network conditions, enabling the system to more flexibly handle different workloads and being suitable for large-scale data applications. Especially when some shards cannot work properly due to node failures or other reasons, the nodes in the overlapping shards can take over part of the work, thereby improving the robustness and fault tolerance of the system.
[0021] When processing cross-shard transactions, a unified framework such as Byshard can be adopted, and various cross-shard transaction consensus protocols provided by the framework can be utilized to adapt to different transaction isolation levels. To reduce the cross-shard transaction latency, the Pyramid model can be adopted to reduce the processing latency of cross-shard transactions by allowing shard overlap, so as to improve system performance.
[0022] Through sharding processing, the blockchain network can process more transactions while maintaining the decentralized characteristics of the network.
[0023] Further, in step S102: perform homomorphic encryption processing on the fragmented original data to obtain encrypted data.
[0024] Homomorphic encryption is an encryption technology that allows computations to be performed on encrypted data without decrypting the data. The result of the computation is the same as the result obtained by directly computing on the original data after decryption. This feature enables homomorphic encryption to still perform effective data processing while protecting data privacy.
[0025] In one embodiment, performing homomorphic encryption processing on the fragmented original data to obtain encrypted data, the steps include: Generate a public-private key pair for homomorphic encryption; among them, the public key is used to encrypt data, and the private key is used to decrypt the calculation result. Use the homomorphic encryption algorithm to encrypt the sharded original data with the public key to generate encrypted data.
[0026] In an embodiment scenario, the calculation steps of the homomorphic encryption algorithm may include: Convert the original data into encrypted data, where the conversion process formula is: , where c is the encrypted data; m is the original data, g(x) is the base polynomial used to generate the basic structure of the encrypted data; f(x) is the random polynomial used to introduce randomness to increase the complexity and security of encryption; n is a large prime number used for modular arithmetic to ensure the security of the encrypted data.
[0027] The above embodiment can support both additive homomorphic and multiplicative homomorphic.
[0028] Additive homomorphic means that after performing a certain form of addition operation on two encrypted data, the decrypted encrypted result is equal to the result of adding the original data. For two encrypted data c 1 and c 2 , the corresponding plaintexts are m 1 and m 2 . The formula for additive homomorphic is: , After decryption, we get: .
[0029] For two encrypted data c 1 and c 2 , the corresponding plaintexts are m 1 and m 2 . The formula for multiplicative homomorphic is: , where L is a linear transformation to ensure multiplicative homomorphism.
[0030] After decryption, we get:
[0031] Through the above embodiments provided by the present invention, combined with polynomial encryption technology, the complexity of the encryption algorithm is increased, making it more difficult for attackers to crack through mathematical methods.
[0032] By introducing the random polynomial f(x), the randomness of the encrypted data is increased, improving the security. At the same time, the computing power of the data in the encrypted state is improved, enabling applications such as blockchains to handle more complex data operations.
[0033] In addition, based on homomorphic encryption, technologies such as zero-knowledge proofs can be introduced to further enhance data privacy protection while verifying the validity of data without revealing the data itself.
[0034] In another embodiment, the implementation steps of homomorphic encryption may include: First, generate a public-private key pair for homomorphic encryption. The public key is used to encrypt data, and the private key is used to decrypt the calculation result. Then, any original data after fragmentation is encrypted using a homomorphic encryption algorithm to generate encrypted data. Taking the Paillier encryption algorithm as an example, the user can call the corresponding library for encryption to ensure the security of data during transmission and storage. Then, on the blockchain, a smart contract is used to execute the calculation on the encrypted data. For example, the smart contract can call functions in the homomorphic encryption library to perform addition or multiplication operations and return the ciphertext of the calculation result. Finally, after the calculation is completed, the ciphertext result is sent to the data owner, and the private key is used for decryption to obtain the final calculation result.
[0035] Inspired by the embodiments provided by the present invention, homomorphic encryption can be widely applied in multiple fields, especially in scenarios where data privacy needs to be protected, such as financial transactions, medical data analysis, and federated learning. In these scenarios, data can be processed in an encrypted state to ensure that sensitive information is not leaked. Therefore, homomorphic encryption can ensure the privacy of data during processing, and even in a cloud computing or blockchain environment, the data will not be exposed. And by performing calculations on encrypted data, the risk of data leakage is reduced, and the security of the system is enhanced. Homomorphic encryption allows complex calculations to be performed without decryption, thus improving the flexibility and efficiency of data processing.
[0036] Therefore, the solution mentioned in the present invention fragments the original data and performs homomorphic encryption. This ensures the security of data during transmission and storage, and at the same time, homomorphic encryption allows calculations to be performed on encrypted data without decryption, increasing the flexibility of data processing.
[0037] Further, in step S103: Construct an M_H+ tree and use the M_H+ tree to improve the blockchain storage structure.
[0038] The solution provided by the present invention combines the characteristics of B+ trees and Merkle trees, enabling the M_H+ tree to introduce the fast retrieval and range query capabilities of B+ trees while maintaining the efficient verification of Merkle trees.
[0039] In one embodiment, the steps of constructing an M_H+ tree include: Confirm the data within the block; Construct a B+ tree using the numerical size of the user identity address as the index; Starting from the bottom layer, merge the leaf node hash values, calculate the new hash value, and record the maximum and minimum values of the addresses; Repeat until the root hash value is generated, and the root hash value is saved as part of the block header; To adjust the calculation of the hash value to adapt to different data distributions and query loads. By introducing a dynamic adjustment factor λ to construct the M_H+ tree, the formula includes: H(x)=hash(x⊕λ), where x is the transaction data in the block, ⊕: represents the bitwise exclusive OR operation to increase the randomness of the data; λ is the dynamic adjustment factor; hash(x) is a one-way hash function used to generate the hash value of the data.
[0040] The M_H+ tree structure provided by the present invention significantly improves the query efficiency, especially in the scenarios of range queries and large amounts of data. Through the dynamic adjustment factor λ, the M_H+ tree can adapt to changes in data distribution and optimize the storage and query performance. Thus, combining the efficient verification of the Merkle tree and the fast retrieval of the B+ tree, the M_H+ tree improves the data security while ensuring data integrity. By improving the storage structure, the communication volume with the external database is reduced, and the system complexity and cost are also reduced.
[0041] Regarding the user identity address described above, for a clearer understanding of the embodiment solution provided by the present invention, the following is an explanation. The user identity address value usually refers to the unique identifier of the user on the network platform, which can be a digital ID for identifying and distinguishing different users. This value can be automatically generated by the system after the user registers on the network platform and is used to index user information in the background database. For example, a user may obtain a UID23 after registering on a forum, and this UID is the user identity address value for identifying the user. In the context of the blockchain, the user identity address value can refer to the hash of the user's public key, which is a fixed-length digital string and serves as the unique address of the user on the blockchain network. The user can receive and send encrypted data or other assets through this address. This address is generated by hashing the user's public key through a hashing algorithm, ensuring the uniqueness and security of the address.
[0042] In an embodiment scenario, a B+ tree is constructed using the user identity address value size as the index. It includes: Using the user's public key, generate the user identity address through a hashing algorithm; Using the user identity address value as the key, store the relevant block data in the B+ tree.
[0043] In the solution of the blockchain storage structure provided by the present invention, the user identity address value can be used as a key parameter for indexing and retrieving data on the blockchain. Combining the storage structures of B+ tree and Merkle tree, the user identity address value can be utilized to optimize the storage and query efficiency of data. For example, using the user identity address value as a key, the relevant block data can be stored in the B+ tree. Each node of the B+ tree can store multiple key-value pairs, which can improve the storage efficiency and support fast data retrieval and range queries. For each transaction related to the user identity address value, the hash value of the transaction can be stored in the Merkle tree. The root hash value of the Merkle tree is included in the block header, which can quickly verify the existence and integrity of the transaction.
[0044] In an embodiment of the present invention, in order to adapt to different data distributions and query loads, by introducing a dynamic adjustment factor λ, dynamic adjustment is performed based on the distribution of the user identity address value and other network parameters (such as transaction frequency, network congestion). Therefore, the factor λ can affect the output of the hash function, thereby optimizing the distribution of data in the B+ tree and Merkle tree. The blockchain storage structure provided by the present invention can improve the data retrieval efficiency and ensure the integrity and verifiability of data.
[0045] Further, step S104: Store the encrypted data in an off-chain server and store the relevant data of the encrypted data on the blockchain. Among them, the relevant data includes the hash value of the encrypted data, transaction records, smart contract execution results, etc.
[0046] Storing the encrypted data in an off-chain server can be achieved through a distributed file system (such as IPFS) or a traditional cloud storage service. Store relevant information data such as the hash value of the encrypted data, transaction records, and smart contract execution results on the blockchain.
[0047] The calculation formula for the hash value of the encrypted data can be: H(c) = hash(c), where c is the encrypted data and hash(c) is the hash function, such as SHA-256, used to generate the hash value of the encrypted data.
[0048] The formula involved in storing the transaction record is: T=(H(c),S,R), where H(c) is the hash value of the encrypted data. S is the sender address and R is the recipient address.
[0049] The formula involved in storing the smart contract execution result is: O=(H(c),E), where H(c) is the hash value of the encrypted data. E is the smart contract execution result, which can be a state change or a calculation result.
[0050] According to the embodiment solution provided by the present invention, by storing encrypted data in an off-chain server, only users with the correct key can access the original data, enhancing the security of the data. Storing the hash value of the encrypted data on the blockchain can ensure the integrity and verifiability of the data. Any tampering with the data will change its hash value and thus be detected. The smart contract can also automatically execute data processing tasks and generate results. These results are stored on the blockchain in the form of hash values and can be used to provide decision support.
[0051] Through the above solution, not only the security and efficiency of blockchain data processing are improved, but also the integrity and verifiability of the data are enhanced. The improved storage structure of the present invention is of great significance for processing large-scale data and improving the performance of the blockchain system.
[0052] Further, in step S105: Use a smart contract and a consensus mechanism to verify the encrypted data.
[0053] In one embodiment, using a smart contract and a consensus mechanism to verify the encrypted data includes: When it is necessary to verify the encrypted data, call the verifyData function of the smart contract, and pass in the hash value of the encrypted data and the hash value stored on the chain for comparison; and during the verification process, if an abnormality is detected, the smart contract will trigger the consensus mechanism to achieve consistency in the blockchain.
[0054] The following further explains step S105 through technical implementation steps.
[0055] First, design a smart contract that can verify the integrity and correctness of the encrypted data. The smart contract will include the following functions: 1) Verification function: used to verify whether the hash value of the encrypted data matches the hash value stored on the chain. 2) Consensus trigger: During the verification process, if an abnormality is detected, the smart contract will trigger the consensus mechanism to achieve consistency in the network.
[0056] Secondly, store the encrypted data in an off-chain server, such as using IPFS or a cloud storage service. Each encrypted data block generates a hash value, and this hash value will be stored on the blockchain.
[0057] Finally, on the blockchain, store the hash value of the encrypted data, transaction records, and the execution result of the smart contract. Specifically, it can be implemented through the storeEncryptedDataHash function of the smart contract.
[0058] In the above solution, when it is necessary to verify encrypted data, the verifyData function of the smart contract is called, and the hash value of the encrypted data and the hash value stored on the chain are passed in for comparison. If the smart contract detects that the hash values do not match or other abnormal situations, it will trigger the consensus mechanism. For example, in PoW (Proof of Work), nodes in the network will compete to solve complex mathematical problems to verify transactions. Further, in order to enhance privacy protection, zero-knowledge proof (ZKP) technology can be integrated into the smart contract. In this way, the smart contract can verify the correctness of the data without exposing the data content.
[0059] In data interaction and smart contract verification, another embodiment scenario is that, first, the data owner encrypts the original data using a randomly generated symmetric key to generate ciphertext, and then generates an access permission MPT storage structure using the public key of the authorized user. The ciphertext, ciphertext-related information, and MPT are uploaded to the server, and at the same time, a data publishing transaction is submitted to the blockchain, with the MPT root value attached to the transaction. Then, the data requester sends a data access request to the blockchain, and the blockchain calls the smart contract to apply to the server for relevant data in the MPT that verifies the data requester's permissions. The smart contract verifies whether the calculation result is equal to the corresponding MPT hash value in the block. If the verification passes, the authorized server sends the ciphertext and the encrypted decryption key to the data requester.
[0060] Finally, after the data requester receives the ciphertext and the encrypted decryption key sent by the server, it first calculates the hash value of the ciphertext and compares it with the data hash value recorded in the blockchain. If they are consistent, the data has not been tampered with, and further decrypts the ciphertext on the server to obtain the data plaintext.
[0061] Inspired by the above embodiments, those skilled in the art can understand that the security of the smart contract can be ensured through encryption technology, access control, and audit monitoring. At the same time, technologies such as zero-knowledge proof can be used to protect the privacy of data.
[0062] Therefore, through the above technical implementation, the security and integrity of the encrypted data can be ensured, and at the same time, the smart contract and the consensus mechanism are used to verify the data to ensure the security and reliability of the blockchain system.
[0063] Further, in step S106: Through the blockchain storage structure, dynamic blockchain permission management is performed.
[0064] In one embodiment, through the blockchain storage structure, dynamic blockchain permission management is performed, including: using digital certificates and CA authentication mechanisms to control node access permissions, role permissions, and client access permissions through admission certificates, role certificates, and transaction certificates.
[0065] The following further describes the implementation steps: First, define the permission control rules. Configure the minimum granularity of permission control as the table, and control it based on external accounts. Use the whitelist mechanism. For tables without configured permissions, they are default fully open, that is, all external accounts have read and write permissions.
[0066] Secondly, use the permission table for permission control. If the table name and the external account address are set in the permission table (_sys_table_access_), it indicates that this account has read and write permissions for this table. Accounts other than those set only have read permissions for this table.
[0067] In a blockchain based on distributed storage, a mechanism for distributed storage permission control can be provided, and effective permission control can be carried out through flexible and fine-grained verification methods. In the generation of digital certificates and the signature and verification of security messages, use the elliptic curve digital signature algorithm or the national cryptographic digital signature algorithm to implement the generation of digital certificates and the signature and verification of security messages, solve the defects of large permission granularity or even no access control function in traditional blockchains, and provide anonymous transaction characteristics for blockchain users.
[0068] In a scenario, when the client applies for a transaction certificate (tcert), it needs to provide its own identity information. The requested node records the information and issues the tcert. When applying for the tcert again, it needs to provide the identity fingerprint. During permission authentication, all nodes can use a unified eaca for verification during access authentication. All nodes will use a unified raca for verification during role authentication.
[0069] Through the dynamic permission management of the blockchain storage structure provided by the present invention in the embodiment, it allows the data owner to flexibly control the data access permissions. By managing the data access permissions of the blockchain accordingly, it meets the security guarantee of confidential information or key information. All clients or nodes requesting access to the consortium chain need to be authenticated, and finally, all access behaviors can be controlled and audited. Furthermore, in step S107: Interact based on the encrypted data of multiple nodes, and analyze the relevant data on the blockchain to obtain an analysis result.
[0070] In an embodiment, interacting based on the encrypted data of multiple nodes and analyzing the relevant data on the blockchain to obtain an analysis result includes: The nodes transmit encrypted data through a preset communication channel.
[0071] When each node receives the data, it decrypts it using its own private key.
[0072] After processing the decrypted data, encrypt the result and send it to the next node.
[0073] The node uses a smart contract to execute data analysis and stores the analysis result in encrypted form on the blockchain.
[0074] In the multi-node encrypted data interaction of another embodiment, the specific implementation steps may include: First, each node encrypts the data using a symmetric encryption algorithm (such as AES). This can be achieved by dividing the data into 128-bit blocks and then encrypting them using a key.
[0075] Then, each node generates a pair of asymmetric keys (public key and private key). The public key can be made public, while the private key is kept secret. When transmitting data, the public key of the recipient is used for encryption to ensure that only the recipient holding the corresponding private key can decrypt the data.
[0076] Then, in data transmission, the nodes transmit the encrypted data through a secure communication channel. After each node receives the data, it decrypts it using its own private key, then processes the data as needed, and then encrypts the result and sends it to the next node.
[0077] In the data analysis on the blockchain in another embodiment, the specific implementation steps may include: First, store relevant information such as the hash value of the encrypted data, transaction records, and smart contract execution results on the blockchain. Specifically, a blockchain structure can be constructed, where each block contains multiple transaction records, and a Merkle tree is used to organize these records.
[0078] Then, use a smart contract to automatically execute data analysis tasks. The smart contract can contain the logic of data analysis, such as statistical analysis, pattern recognition, etc., and automatically execute these tasks on the blockchain.
[0079] Finally, store the analysis result in encrypted form on the blockchain, or store the hash value to verify the integrity and consistency of the data.
[0080] In some embodiments, graph neural networks can also be used in blockchain data analysis. The specific implementation steps may include: First, construct the blockchain transaction data into a graph structure, where each address is regarded as a node and each transaction is regarded as an edge. Such a graph structure can reveal the relationships and patterns between transactions.
[0081] Secondly, use a graph neural network (GNN) to learn and predict the patterns in the graph. The GNN can directly learn and predict on the graph, effectively capturing the complex relationships between nodes.
[0082] Finally, by analyzing the graph features, the nodes of abnormal trading behaviors can be identified, thereby enhancing the security and transparency of blockchain transactions.
[0083] In addition, when performing data analysis tasks, the smart contract can embed data analysis logic, which automatically executes the analysis tasks when specific conditions are triggered or specific transactions are received. The smart contract reads data on the blockchain, such as the hash values of encrypted data, transaction records, etc., as the input for analysis. The analysis results can be stored on the blockchain in a certain form, such as the hash value of the stored result or directly store the result (if the data volume is small). Therefore, through the smart contract, not only can the contract terms be automatically executed, but also complex data processing and analysis tasks can be carried out, realizing automated and intelligent data management. This mechanism enables the blockchain network to handle more complex business logics, improving the flexibility and practicality of blockchain applications.
[0084] Through the implementation manners provided by the present invention as described above, the secure interaction of encrypted data among multiple nodes can be realized, and the relevant data can be analyzed by using blockchain technology to obtain analysis results, which can improve data sharing and data value mining in the blockchain. At the same time, the security of the data and the flexibility of access control are ensured.
[0085] Further, in step S108: according to the analysis results, feedback information is provided. In the analysis results, the data analysis results of the execution of the smart contract are collected from the blockchain network, and these results may include transaction patterns, market trends, behavior analysis, etc. By checking the consistency of the results, detecting outliers, and verifying the accuracy, it is ensured that the collected analysis results are accurate and reliable.
[0086] After obtaining the analysis results, the complex analysis results are converted into an easy-to-understand format, such as charts, reports, or summaries. Decision-making support is provided based on the analysis results, such as risk assessment, market prediction, or optimization suggestions.
[0087] Subsequently, through the event subscription mechanism of the blockchain network, notifications are sent to relevant stakeholders in real time, such as through the event listening function of Web3.js or the Ethereum client. Reports can also be customized according to the needs of users and sent through secure channels (such as encrypted emails, blockchain messaging systems).
[0088] In some cases, the feedback information can directly trigger an automated response, such as the conditional execution in the smart contract. In cases where human intervention is required, a detailed analysis report is provided to assist decision-makers in making more correct choices.
[0089] Provide feedback information based on the analysis results, which helps to achieve real-time monitoring of data and decision support. At the same time, store the hash value of the feedback information on the blockchain to ensure the immutability and traceability of the information. Record the application status of the feedback information, including who received the information and when actions were taken, etc., for future auditing and traceability.
[0090] After the user receives the feedback information, the user can also collect the feedback on the feedback information to evaluate the effectiveness and impact of the information. And adjust the analysis model and algorithm according to the feedback to improve the accuracy and relevance of future analysis results.
[0091] Through the above-provided embodiment solutions, the results of blockchain data analysis can be effectively transformed into feedback information useful to users, thereby improving the practicality and value of blockchain applications. This feedback mechanism not only enhances the transparency and trust of the blockchain system but also provides practical business value to users.
[0092] In summary, according to the blockchain data processing method provided by the present invention above, by performing sharding homomorphic encryption on the original data, the security of data processing and privacy protection are improved, and the risk of data leakage is reduced. By constructing the data storage structure of the blockchain, the integrity and traceability of the data are enhanced. The efficient sharing and value mining of data are realized, promoting the circulation and utilization of data.
[0093] Furthermore, the embodiments of the present invention combine homomorphic encryption and blockchain technology to achieve encrypted storage and secure computing of data while maintaining the privacy of the data. Using smart contracts and consensus mechanisms, automated verification and processing of data are realized, improving efficiency and transparency. Through blockchain dynamic permission management, a flexible authorization access model is provided for data sharing, enhancing the controllability of the data.
[0094] Figure 2 It is a schematic structural diagram of a blockchain data processing system 200 according to some embodiments of the present invention.
[0095] As Figure 2 shown, in the system 200, a blockchain data processing system is provided, including: a data preprocessing module 201: used to shard the original data into multiple small pieces greater than or equal to 1, and the size of the small pieces conforms to the block size of the blockchain.
[0096] A homomorphic encryption module 202: used to perform homomorphic encryption processing on the sharded original data to obtain encrypted data.
[0097] A storage structure construction module 203: used to construct an M_H+ tree and create a blockchain storage structure using the M_H+ tree; Data storage module 204: used to store the encrypted data in an off-chain server and store the relevant data of the encrypted data on the blockchain; wherein, the relevant data includes the hash value of the encrypted data, transaction records, and smart contract execution results; Data verification module 205: used to verify the encrypted data by using smart contracts and consensus mechanisms.
[0098] Blockchain permission module 206: used to perform dynamic blockchain permission management through the blockchain storage structure.
[0099] Data analysis module 207: used to interact based on the encrypted data of multiple nodes and analyze the relevant data on the blockchain to obtain an analysis result.
[0100] Information feedback module 208: used to provide feedback information based on the analysis result.
[0101] Those skilled in the art can understand that the blockchain data processing system 200 is a specific implementation of the foregoing Figure 1 data processing method 100 shown, so the features described above in conjunction with Figure 1 can be similarly applied herein. And for the sake of clarity and conciseness, the same content will not be repeated.
[0102] Through the system 200 provided by the present invention, the embodiments of the present invention improve the security and privacy protection of data processing and reduce the risk of data leakage by performing sharding homomorphic encryption on the original data. By constructing the data storage structure of the blockchain, the integrity and traceability of the data are enhanced. The efficient sharing and value mining of data are realized, and the circulation and utilization of data are promoted.
[0103] The above has described in detail an embodiment of the present invention, but the content described above is only a preferred embodiment of the present invention and cannot be considered as limiting the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the application of the present invention shall still fall within the scope covered by the patent of the present invention.
Claims
1. A blockchain data processing method, characterized in that: include: The original data is sharded into a number of smaller pieces greater than or equal to 1, where the size of the smaller pieces conforms to the block size of the blockchain; Perform homomorphic encryption on the original data after sharding to obtain encrypted data; Constructing an M_H+ tree and using the M_H+ tree to improve the blockchain storage structure; The encrypted data is stored in an off-chain server, and the related data of the encrypted data is stored on the blockchain; wherein the related data includes the hash value of the encrypted data, transaction records, and smart contract execution results; Verifying the encrypted data using smart contracts and consensus mechanisms; Through the blockchain storage structure, dynamic blockchain authority management is performed; Interacting according to the encrypted data of multiple nodes, analyzing the relevant data on the blockchain to obtain analysis results; and Based on the analysis results, feedback information is provided.
2. The method according to claim 1, characterized in that The sharding of the original data into a plurality of small pieces greater than or equal to 1, wherein the size of the small pieces conforms to the block size of the blockchain, includes: According to the block size of the blockchain, each small piece of the original data after sharding is independently stored and processed; According to the cross-shard transaction consensus protocol, overlapping between the shards is allowed.
3. The method according to claim 1, characterized in that The steps of performing homomorphic encryption processing on the original data after sharding to obtain encrypted data include: Generate a homomorphic encrypted public-private key pair; the public key is used to encrypt data, and the private key is used to decrypt the calculation results; The original data after sharding is encrypted using the homomorphic encryption algorithm and the public key to generate encrypted data.
4. The method according to claim 3, characterized in that The calculation steps of the homomorphic encryption algorithm include: The original data is converted into encrypted data, where the conversion process formula is: , Among them, c is the encrypted data; m is the original data, g(x) is the base polynomial used to generate the basic structure of the encrypted data; f(x): random polynomial, used to introduce randomness to increase the complexity and security of encryption; n is a large prime number used for modular operations to ensure the security of encrypted data.
5. The method according to claim 1, characterized in that The steps of constructing the M_H+ tree include: Confirm the data in the block; Use the user identity address value as the index to build a B+ tree; Starting from the bottom layer, merge the leaf node hash values, calculate the new hash value, and record the maximum and minimum values of the address; Repeat until the root hash of the tree is generated, and the root hash is saved as part of the block header; The M_H+ tree formula includes: H(x)=hash(x⊕λ), where x is the transaction data in the block, ⊕ represents a bitwise XOR operation to increase the randomness of the data; λ is a dynamic adjustment factor; hash(x) is a one-way hash function used to generate the hash value of the data.
6. The method according to claim 5, characterized in that The method of constructing a B+ tree using the numerical value of the user identity address as an index includes: Using the user's public key, the user identity address is generated through a hash algorithm; Using the user identity address value as the key, the related block data is stored in the B+ tree.
7. The method according to claim 1, characterized in that The use of smart contracts and consensus mechanisms to verify encrypted data includes: When encrypted data needs to be verified, the verifyData function of the smart contract is called to compare the hash value of the incoming encrypted data with the hash value stored on the chain; and During the verification process, if an anomaly is detected, the smart contract will trigger the consensus mechanism to reach consistency in the blockchain.
8. The method according to claim 1, characterized in that The blockchain storage structure is used to perform dynamic blockchain authority management, including: using digital certificates and CA authentication mechanisms to control node access permissions, role permissions, and client access permissions through access certificates, role certificates, and transaction certificates.
9. The method according to claim 1, characterized in that: The interacting according to the encrypted data of multiple nodes and analyzing the relevant data on the blockchain to obtain analysis results include: Nodes transmit encrypted data through preset communication channels; When each node receives the data, it decrypts it using its own private key; After processing the decrypted data, the result is encrypted and sent to the next node; The nodes perform data analysis using smart contracts and store the analysis results in encrypted form on the blockchain.
10. A blockchain data processing system, characterized in that: include: Data preprocessing module: used to shard the original data into multiple small pieces greater than or equal to 1, where the size of the small pieces conforms to the block size of the blockchain; Homomorphic encryption module: used to perform homomorphic encryption on the original data after sharding to obtain encrypted data; Storage structure building module: used to build an M_H+ tree and use the M_H+ tree to create a blockchain storage structure; Data storage module: used to store the encrypted data in the off-chain server and store the related data of the encrypted data on the blockchain; wherein the related data includes the hash value of the encrypted data, transaction records, and smart contract execution results; Data verification module: used to verify encrypted data using smart contracts and consensus mechanisms; Blockchain authority module: used to perform blockchain dynamic authority management through the blockchain storage structure; Data analysis module: used to interact according to the encrypted data of multiple nodes and analyze the relevant data on the blockchain to obtain analysis results; and Information feedback module: used to provide feedback information based on the analysis results.