Blockchain data sharing encryption and decryption method and system

By creating a source verification pair for user terminals and an encryption public key system in the blockchain, the problem of blockchain data privacy protection is solved, and the data source is trusted, tamper-proof, and decryption access control is achieved, thereby improving the security of data storage and access.

CN121502825BActive Publication Date: 2026-04-21HUNAN VOCATIONAL & TECH COLLEGE OF NAT DEFENSE IND
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUNAN VOCATIONAL & TECH COLLEGE OF NAT DEFENSE IND
Filing Date
2026-01-14
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

During the storage of blockchain data, the open and transparent consensus method affects the privacy protection of sensitive information, which may lead to unauthorized nodes accessing or analyzing personal privacy and trade secrets, and the data cannot be revoked.

Method used

By creating a source verification pair for the user terminal, encrypting the data using a hash function, and setting up a public and private key pair, combined with a zero-knowledge proof mechanism and a shared encryption key management system, the system ensures that the data source is trustworthy and tamper-proof, and controls decryption permissions.

Benefits of technology

It significantly improves the security of blockchain data storage, prevents plaintext data exposure, ensures that transaction data is kept under minimal exposure management in a multi-node environment, and improves access security and decryption permission control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121502825B_ABST
    Figure CN121502825B_ABST
Patent Text Reader

Abstract

This invention relates to the field of data encryption and decryption technology, and particularly to a blockchain data sharing encryption and decryption method and system. The method includes: creating a blockchain composed of several nodes; obtaining the user terminal corresponding to the blockchain; creating a source verification pair corresponding one-to-one with the user terminal, wherein the source verification pair consists of a registry and an identification code; storing the identification code in the user terminal; writing all registry entries into the blockchain; and reading transaction data between the blockchain and the user terminal to obtain at least first data and second data. This invention, by setting encryption key pairs, can encrypt and manage transaction data, avoiding the exposure of plaintext data and improving the security of sensitive information storage. It not only effectively prevents transaction data from being tampered with and illegally decrypted, but also ensures that the transaction data uploaded to the blockchain maintains minimal exposure management in a multi-node environment, significantly improving the secure storage capability of blockchain data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data encryption and decryption technology, and in particular to a method and system for encrypting and decrypting blockchain data sharing. Background Technology

[0002] While blockchain data storage achieves decentralization, immutability, and traceability through distributed ledger technology, its transparent consensus mechanism also impacts the privacy protection of sensitive information. Specifically, on the one hand, blockchain requires all participating nodes to verify the data uploaded to the chain to ensure consistency and trustworthiness; on the other hand, any plaintext data recorded on the chain is typically visible to all nodes in the network, meaning that data involving personal privacy, trade secrets, or other sensitive information may be directly accessed or analyzed by unauthorized nodes after uploading, and it may even be impossible to retract sensitive data.

[0003] Therefore, "how to encrypt and decrypt blockchain data" is the technical problem that this invention aims to solve. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for encrypting and decrypting blockchain data sharing, in order to solve the problem of "how to encrypt and decrypt blockchain data" mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides the following technical solution:

[0006] A blockchain data sharing encryption and decryption method, the method comprising:

[0007] Create a blockchain consisting of several nodes, obtain the user terminal corresponding to the blockchain, create a source verification pair that corresponds one-to-one with the user terminal, wherein the source verification pair consists of a registry and an identification code, store the identification code in the user terminal, and write all the registry entries into the blockchain.

[0008] Read the transaction data between the blockchain and the user terminal to obtain at least the first data and the second data. Select a hash function to hash the identification code in the user terminal to obtain an initial value. Write the initial value to the end of the first data and hash the first data to obtain the first hash value. Write the first hash value to the end of the second data, and so on.

[0009] Real-time data that needs to be encrypted during the collection of transaction data is included. The real-time data contains the hash value of the previous data. An encryption key pair consisting of an encryption public key and an encryption private key is set. The real-time data is encrypted using the encryption public key and uploaded to the blockchain. A shared management system for encryption private keys is created.

[0010] Upon receiving a decryption request uploaded by a user terminal, the target data is identified, the hash value is extracted and sent to the user terminal, the identification code in the user terminal is extracted, the hash value is verified, and decryption permission is granted to the corresponding user terminal after successful verification.

[0011] Furthermore, the steps of creating a blockchain composed of several nodes, obtaining the user terminal corresponding to the blockchain, and creating a source verification pair corresponding one-to-one with the user terminal include:

[0012] Embed a zero-knowledge proof mechanism into the blockchain and edit the feedback template;

[0013] The user terminals are clustered into several types, and each type corresponds to a feedback template.

[0014] Furthermore, the steps of storing the identification code on the user terminal and writing all the registry entries into the blockchain include:

[0015] Generate snapshots of all registry entries and update them at a preset frequency;

[0016] Record the generation time of each snapshot, sort all the snapshots in chronological order of generation time, and obtain the archive set.

[0017] Furthermore, the step of reading transaction data between the blockchain and the user terminal includes:

[0018] Collect environmental data from user terminals, wherein the environmental data includes at least: geographical location and usage behavior;

[0019] Determine if the environmental data exhibits any abnormal characteristics; if so, trigger a pre-edited emergency response mechanism.

[0020] Furthermore, the steps for encrypting real-time data in the collected transaction data include:

[0021] Set the risk level of real-time data, wherein the risk level includes at least: high, medium and low;

[0022] An editing mechanism is established that corresponds one-to-one with each risk level, and the encrypted public key is dynamically updated.

[0023] Furthermore, the steps of determining the target data, extracting the hash value, and sending it to the user terminal after receiving the decryption request uploaded by the user terminal include:

[0024] A salt value is randomly inserted into the hash value, and the hash value is divided into several segments;

[0025] Set the segment order and distribute the segments to the user terminal according to the order.

[0026] Furthermore, the system includes:

[0027] The writing module is used to create a blockchain consisting of several nodes, obtain the user terminal corresponding to the blockchain, create a source verification pair that corresponds one-to-one with the user terminal, wherein the source verification pair consists of a registry and an identification code, the identification code is stored in the user terminal, and all registry entries are written into the blockchain.

[0028] The module is used to read transaction data between the blockchain and the user terminal, at least the first data and the second data. It selects a hash function, hashes the identification code in the user terminal to obtain an initial value, writes the initial value to the end of the first data, hashes the first data to obtain a first hash value, writes the first hash value to the end of the second data, and so on.

[0029] A module is created to collect real-time data that needs to be encrypted from transaction data. The real-time data contains the hash value of the previous data. An encryption key pair consisting of an encryption public key and an encryption private key is set. The real-time data is encrypted using the encryption public key and uploaded to the blockchain. A shared management system for encryption private keys is created.

[0030] The open module is used to determine the target data, extract the hash value and send it to the user terminal after receiving the decryption request uploaded by the user terminal, extract the identification code in the user terminal, verify the hash value, and grant decryption permission to the corresponding user terminal after successful verification.

[0031] Furthermore, the writing module includes:

[0032] The editing unit is used to embed a zero-knowledge proof mechanism into the blockchain and edit the feedback template;

[0033] Clustering unit, used to cluster the user terminals into several types, where each type corresponds to a feedback template;

[0034] The update unit is used to generate snapshots of all registry entries and update them at a preset frequency.

[0035] The sorting unit records the generation time of each snapshot and sorts all the snapshots in chronological order of their generation time to obtain the archive set.

[0036] Furthermore, the obtaining module includes:

[0037] A data acquisition unit is used to collect environmental data from a user terminal, wherein the environmental data includes at least: geographical location and usage behavior;

[0038] The judgment unit is used to determine whether there are abnormal characteristics in the environmental data. If so, it triggers a pre-edited emergency response mechanism.

[0039] Furthermore, the creation module includes:

[0040] The setting unit is used to set the risk level of real-time data, wherein the risk level includes at least: high, medium and low;

[0041] The switching unit is used to edit the switching mechanism corresponding to each risk level and to dynamically update the encrypted public key.

[0042] Compared with the prior art, the beneficial effects of the present invention are:

[0043] By storing the identification code on the user terminal, the source of transaction data can be ensured to be trustworthy and unforgeable, effectively preventing transaction data from being tampered with during transmission and significantly improving the security of blockchain data storage. By hashing the transaction data, the entire process of calling the transaction data can be recorded, preventing unauthorized users from constructing fake transaction chains, strengthening decryption permission control, and improving the access security of transaction data decryption. By setting encryption key pairs, transaction data can be encrypted and managed, preventing plaintext data exposure and improving the security of sensitive information storage. It can not only effectively prevent transaction data from being tampered with and illegally decrypted, but also ensure that the transaction data uploaded to the chain maintains minimal exposure management in a multi-node environment, significantly improving the secure storage capability of blockchain data. Attached Figure Description

[0044] Figure 1 A flowchart illustrating the blockchain data sharing encryption and decryption method provided in this embodiment of the invention;

[0045] Figure 2 This is a first sub-flowchart of the blockchain data sharing encryption and decryption method provided in an embodiment of the present invention;

[0046] Figure 3 This is a second sub-flow diagram of the blockchain data sharing encryption and decryption method provided in an embodiment of the present invention;

[0047] Figure 4 A third sub-flow diagram of the blockchain data sharing encryption and decryption method provided in an embodiment of the present invention;

[0048] Figure 5 The fourth sub-flow diagram of the blockchain data sharing encryption and decryption method provided in the embodiments of the present invention;

[0049] Figure 6 A block diagram illustrating the composition of a blockchain data sharing encryption and decryption system provided in an embodiment of the present invention;

[0050] Figure 7 A block diagram illustrating the composition of the write module in the blockchain data sharing encryption and decryption system provided in this embodiment of the invention;

[0051] Figure 8 A block diagram of the modules obtained in the blockchain data sharing encryption and decryption system provided in the embodiments of the present invention;

[0052] Figure 9 A block diagram illustrating the composition of the creation module in the blockchain data sharing encryption and decryption system provided in this embodiment of the invention;

[0053] Figure 10 A block diagram illustrating the composition of open modules in a blockchain data sharing encryption and decryption system provided in an embodiment of the present invention. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0055] In Example 1, Figure 1 The implementation flow of the blockchain data sharing encryption and decryption method provided in this embodiment of the invention is illustrated below, and is described in detail below:

[0056] S100: Create a blockchain consisting of several nodes, obtain the user terminal corresponding to the blockchain, create a source verification pair that corresponds one-to-one with the user terminal, wherein the source verification pair consists of a registry and an identification code, store the identification code in the user terminal, and write all the registry entries into the blockchain.

[0057] A blockchain consisting of several nodes is constructed. Each node is responsible for recording, verifying, and storing transaction data in a decentralized manner to ensure the immutability of the transaction data. User terminals associated with this blockchain are identified; these are any terminal devices that can access the blockchain and perform data uploads or transactions. A source verification pair is created for each user terminal, consisting of a registry and an identification code. The identification code is stored on the user terminal and is primarily used for digital signatures during data transactions with the blockchain. The registry is publicly published to the blockchain for verification by the blockchain or other nodes, ensuring that the source of each data transaction is reliable and verifiable.

[0058] The identification code here can be simply understood as the identifier of the device from which the transaction data originates. Similar to a digital verification code, a new identification code is generated with each transaction. By querying the identification code, the originating device can be identified. The digital signature process is essentially writing the identification code to the end of the transaction data, and the registry is the collection that can identify all identification codes. For example, user A transfers accounts receivable from company A to user B to offset part of the debt. User B confirms receipt and verifies the transaction through their terminal device and uploads the transaction data "A transfers its accounts receivable from company A to user B to offset the corresponding debt" to the debt management platform, writing the identification code of user B's terminal device into the transaction data. In subsequent data usage, if a user wants to check whether the transaction data source is reliable, they use the identification code to query the registry and determine that user B's terminal is a legitimate access terminal to the blockchain, meaning the source is authentic and reliable. However, it should be noted that the authenticity of the transaction data content still needs further verification using hash values.

[0059] S200: Read the transaction data between the blockchain and the user terminal, obtain at least the first data and the second data, select a hash function, hash the identification code in the user terminal to obtain an initial value, write the initial value to the end of the first data, hash the first data to obtain the first hash value, write the first hash value to the end of the second data, and so on.

[0060] The process reads transaction data between the blockchain and the user terminal. This data can include various feedback information or other downloaded data obtained by the user terminal from the blockchain, as well as access requests, operation instructions, or other uploaded data submitted by the user terminal to the blockchain. Following chronological order, the transaction data is defined as "first data," "second data," etc. A hash function is selected, such as SHA-256 or MD5. Using this hash function, the identifier stored in the user terminal is hashed to generate a unique and fixed-length initial value. This initial value is written to the end of the first data, and the hash function is used again to hash the entire first data with the added initial value, yielding a first hash value. This first hash value uniquely represents the content and signature status of the first data. The first hash value is then written to the end of the second data, and the hashing process continues in the same manner. The advantages of this method are: it not only records and verifies all transactions of the user terminal but also ensures the reliability, integrity, and traceability of each transaction's origin, effectively achieving minimal management of decryption permissions and significantly improving the security of transaction data.

[0061] S300: Collect real-time data that needs to be encrypted from transaction data. The real-time data contains the hash value of the previous data. Set up an encryption key pair consisting of an encryption public key and an encryption private key. Use the encryption public key to encrypt the real-time data and upload it to the blockchain. Create a shared management system for encryption private keys.

[0062] Once the real-time data between the user terminal and the blockchain is determined, the hash value from the previous transaction data is extracted. The hash value is then verified using a hash function and all transaction data. If the verification passes, it indicates that the source of the real-time data is reliable, and the data can be uploaded, stored, or downloaded.

[0063] Each user terminal is assigned an encryption key pair consisting of a public key and a private key. The public key is used for data encryption, ensuring that transaction data is not read by unauthorized parties during storage, while the private key is used for data decryption and is held only by authorized users. When real-time data needs to be stored on the blockchain, the corresponding public key is used to encrypt the transaction data, preventing unauthorized third parties from tampering with or stealing the real-time data. A shared management system for the private keys is created. This system is mainly used for storing, distributing, and retrieving private keys, facilitating data access and management across multiple terminals, and ensuring that only authorized user terminals can use the private key for decryption.

[0064] The shared management system is similar to existing multi-key management systems, consisting of two parts: first, a single user terminal holds the encryption private key; second, multiple terminals jointly hold the encryption private key, which is divided into several subkeys with a threshold set to ensure that at least a number of subkeys greater than the threshold are required for data decryption. In creating the shared management system, the key is first divided into multiple subkeys and distributed to different user terminals. Access control determines which users can jointly use the subkeys. When data decryption is needed, more than the threshold number of subkeys are collected, reconstructed to obtain the decryption credential, and then the target data is decrypted.

[0065] S400: Upon receiving a decryption request uploaded by a user terminal, determine the target data, extract the hash value, and send it to the user terminal. Extract the identification code from the user terminal, verify the hash value, and grant decryption permission to the corresponding user terminal after successful verification.

[0066] When a user terminal needs to query and access encrypted data in the blockchain, the corresponding transaction data is defined as the target data, and a hash value is extracted from the target data. This hash value is used to verify the integrity and continuity of the data. The hash value is then sent to the user terminal for local verification to determine if the target data has been tampered with. If it has not been tampered with, the identification code is used to design the target data, granting the corresponding user terminal decryption access. Once the user terminal decrypts the data using its private key, the original content of the target data is revealed to the user terminal.

[0067] In Example 2, Figure 2 The first sub-flowchart of the blockchain data sharing encryption and decryption method provided in this embodiment of the invention is shown. The following details the steps of creating a blockchain composed of several nodes, obtaining the user terminal corresponding to the blockchain, and creating a source verification pair corresponding one-to-one with the user terminal, as follows:

[0068] S101: Embed a zero-knowledge proof mechanism into the blockchain and edit the feedback template.

[0069] A zero-knowledge proof mechanism is embedded into the blockchain. This mechanism means that when a user terminal initiates a decryption request for target data, the blockchain only records the judgment result of the decryption request and does not store the actual content. The judgment result of the decryption request is input into a completed feedback template to generate a feedback report, which is then sent to the corresponding user terminal.

[0070] S102: Cluster the user terminals into several types, where each type corresponds to a feedback template.

[0071] User terminals are categorized into several types, and a corresponding feedback template is set for each type to generate personalized feedback reports, thereby improving information accuracy and enhancing user experience.

[0072] In Example 3, Figure 2 The first sub-flowchart of the blockchain data sharing encryption and decryption method provided in this embodiment of the invention is shown. The steps of storing the identification code in the user terminal and writing all the registry entries into the blockchain are described in detail below:

[0073] S103: Generate a snapshot of all registry entries and update them at a preset frequency.

[0074] The system periodically records the complete registry status of all current user terminals and generates snapshots. These snapshots can be used to verify, audit, or backtrack the registry. The snapshots are updated at a preset frequency.

[0075] S104: Record the generation time of each snapshot, sort all snapshots in order of generation time from earliest to latest, and obtain the archive set.

[0076] Embed timestamps into snapshots and record their creation times. Sort all snapshots in chronological order of their creation times to obtain an archive set, which is a collection of snapshots arranged in chronological order.

[0077] In Example 4, Figure 3 The second sub-flowchart of the blockchain data sharing encryption and decryption method provided in this embodiment of the invention is shown. The steps for reading transaction data between the blockchain and the user terminal are described in detail below:

[0078] S201: Collect environmental data of the user terminal, wherein the environmental data includes at least: geographical location and usage behavior.

[0079] Collect environmental data for each user terminal when encrypting or decrypting blockchain data, including geographical location and usage behavior.

[0080] S202: Determine whether the environmental data has any abnormal characteristics. If so, trigger the pre-edited emergency response mechanism.

[0081] Determine if there are any abnormal features in the environmental data, such as abnormal login locations, abnormal operation frequencies, or abnormal data fluctuations; if abnormal features are detected, trigger a pre-edited emergency response mechanism, which includes sending warning notifications, restricting user operations, and initiating multi-factor authentication.

[0082] In Example 5, Figure 4 The diagram illustrates the third sub-flow flowchart of the blockchain data sharing encryption and decryption method provided in this embodiment of the invention. The following details the steps for collecting real-time data that needs to be encrypted from the transaction data:

[0083] S301: Set the risk level of real-time data, wherein the risk level includes at least: high, medium and low.

[0084] Based on the type of real-time data or environmental data, a risk level is set for each real-time data point, including high, medium, and low risk levels.

[0085] S302: Edit the switching mechanism that corresponds one-to-one with each risk level, and dynamically update the encrypted public key.

[0086] A corresponding switching mechanism is set up for each risk level. The switching mechanism is as follows: when the risk level is high, a zero-trust public key is used, which is used only once; when the risk level is medium, a region-specific public key is used; and when the risk level is low, a regular encryption public key is used.

[0087] In Example 6, Figure 5 The fourth sub-flow diagram of the blockchain data sharing encryption and decryption method provided in this embodiment of the invention is shown. The following details the steps of determining the target data, extracting the hash value, and sending it to the user terminal after receiving the decryption request uploaded by the user terminal:

[0088] S401: Randomly insert a salt value into the hash value and divide the hash value into several segments.

[0089] A salt value is randomly inserted into the hash value, and the hash value with the salt value is divided into several segments. A segment can be simply understood as several character segments in the hash value.

[0090] S402: Set the sorting of the segments, and send the segments to the user terminal according to the sorting.

[0091] The segments are sorted according to their order of appearance in the hash value, and each segment is sent to the user terminal in sequence. Each segment is verified and assembled locally on the user terminal. Only when all segments are received and verified in the correct order can the user terminal reconstruct the complete salted hash value, providing a reference for subsequent signature verification and decryption operations.

[0092] Figure 6 This diagram illustrates the structural composition of a blockchain data sharing encryption and decryption system provided in an embodiment of the present invention. The blockchain data sharing encryption and decryption system 1 includes:

[0093] The writing module 11 is used to create a blockchain composed of several nodes, obtain the user terminal corresponding to the blockchain, create a source verification pair that corresponds one-to-one with the user terminal, wherein the source verification pair consists of a registry and an identification code, the identification code is stored in the user terminal, and all the registry entries are written into the blockchain.

[0094] Module 12 is used to read transaction data between the blockchain and the user terminal, at least obtaining the first data and the second data. A hash function is selected to hash the identification code in the user terminal to obtain an initial value. The initial value is written to the end of the first data, and the first data is hashed to obtain a first hash value. The first hash value is written to the end of the second data, and so on.

[0095] Create module 13 to collect real-time data that needs to be encrypted from transaction data. The real-time data contains the hash value of the previous data. Set up an encryption key pair consisting of an encryption public key and an encryption private key. Use the encryption public key to encrypt the real-time data and upload it to the blockchain. Create a shared management system for encryption private keys.

[0096] The open module 14 is used to determine the target data, extract the hash value and send it to the user terminal after receiving the decryption request uploaded by the user terminal, extract the identification code in the user terminal, verify the hash value, and grant decryption permission to the corresponding user terminal after successful verification.

[0097] Figure 7 This diagram illustrates the composition of the writing module 11 in the blockchain data sharing encryption and decryption system provided by an embodiment of the present invention. The writing module 11 includes:

[0098] Editing unit 111 is used to embed a zero-knowledge proof mechanism into the blockchain and edit the feedback template;

[0099] Clustering unit 112 is used to cluster the user terminals into several types, wherein each type corresponds to a feedback template;

[0100] Update unit 113 is used to generate snapshots of all registry entries and update them at a preset frequency;

[0101] The sorting unit 114 is used to record the generation time of each snapshot and sort all the snapshots in order of generation time to obtain the archive set.

[0102] Figure 8 This diagram illustrates the structural composition of module 12 in the blockchain data sharing encryption and decryption system provided in an embodiment of the present invention. Module 12 includes:

[0103] The acquisition unit 121 is used to acquire environmental data of the user terminal, wherein the environmental data includes at least: geographical location and usage behavior;

[0104] The judgment unit 122 is used to determine whether there are abnormal characteristics in the environmental data. If so, it triggers a pre-edited emergency response mechanism.

[0105] Figure 9 This diagram illustrates the structural composition of the creation module 13 in the blockchain data sharing encryption and decryption system provided in an embodiment of the present invention. The creation module 13 includes:

[0106] Setting unit 131 is used to set the risk level of real-time data, wherein the risk level includes at least: high, medium and low.

[0107] The switching unit 132 is used to edit the switching mechanism corresponding to each risk level and to dynamically update the encrypted public key.

[0108] Figure 10 This diagram illustrates the structural composition of the open module 14 in the blockchain data sharing encryption and decryption system provided in an embodiment of the present invention. The open module 14 includes:

[0109] The insertion unit 141 is used to randomly insert a salt value into the hash value and divide the hash value into several segments;

[0110] The sending unit 142 is used to set the sorting of the segments and send the segments to the user terminal according to the sorting.

[0111] The writing module 11 is mainly used to complete step S100, the obtaining module 12 is mainly used to complete step S200, the creating module 13 is mainly used to complete step S300, and the opening module 14 is mainly used to complete step S400.

[0112] Editing unit 111 is mainly used to complete step S101, clustering unit 112 is mainly used to complete step S102, updating unit 113 is mainly used to complete step S103, and sorting unit 114 is mainly used to complete step S104.

[0113] The acquisition unit 121 is mainly used to complete step S201, and the judgment unit 122 is mainly used to complete step S202.

[0114] The setting unit 131 is mainly used to complete step S301, and the switching unit 132 is mainly used to complete step S302.

[0115] The insertion unit 141 is mainly used to complete step S401, and the sending unit 142 is mainly used to complete step S402.

[0116] 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.

[0117] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

[0118] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A blockchain data sharing encryption and decryption method, characterized in that, The method includes: Create a blockchain consisting of several nodes, obtain the user terminal corresponding to the blockchain, create a source verification pair that corresponds one-to-one with the user terminal, wherein the source verification pair consists of a registry and an identification code, store the identification code in the user terminal, and write all the registry entries into the blockchain. Read the transaction data between the blockchain and the user terminal to obtain at least the first data and the second data. Select a hash function to hash the identification code in the user terminal to obtain an initial value. Write the initial value to the end of the first data. Continue to use the hash function to perform hash calculation on the first data with the added initial value to obtain the first hash value. Write the first hash value to the end of the second data, and so on. Real-time data that needs to be encrypted during the collection of transaction data is included. The real-time data contains the hash value of the previous data. An encryption key pair consisting of an encryption public key and an encryption private key is set. The real-time data is encrypted using the encryption public key and uploaded to the blockchain. A shared management system for encryption private keys is created. Upon receiving a decryption request from a user terminal, the system identifies the target data, extracts the hash value, sends it to the user terminal, extracts the identification code from the user terminal, verifies the hash value, and grants decryption access to the corresponding user terminal upon successful verification.

2. The blockchain data sharing encryption and decryption method according to claim 1, characterized in that, The steps of creating a blockchain consisting of several nodes, obtaining the user terminal corresponding to the blockchain, and creating a source verification pair that corresponds one-to-one with the user terminal include: Embed a zero-knowledge proof mechanism into the blockchain and edit the feedback template; The user terminals are clustered into several types, and each type corresponds to a feedback template.

3. The blockchain data sharing encryption and decryption method according to claim 1, characterized in that, The steps of storing the identification code in the user terminal and writing all the registry entries into the blockchain include: Generate snapshots of all registry entries and update them at a preset frequency; Record the generation time of each snapshot, sort all the snapshots in chronological order of generation time, and obtain the archive set.

4. The blockchain data sharing encryption and decryption method according to claim 1, characterized in that, The steps for reading transaction data between the blockchain and the user terminal include: Collect environmental data from user terminals, wherein the environmental data includes at least: geographical location and usage behavior; Determine if the environmental data exhibits any abnormal characteristics; if so, trigger a pre-edited emergency response mechanism.

5. The blockchain data sharing encryption and decryption method according to claim 1, characterized in that, The steps for collecting real-time data that needs to be encrypted from transaction data include: Set the risk level of real-time data, where the risk level includes: high, medium and low; An editing mechanism is established that corresponds one-to-one with each risk level, and the encrypted public key is dynamically updated.

6. The blockchain data sharing encryption and decryption method according to claim 5, characterized in that, The steps of determining the target data, extracting the hash value, and sending it to the user terminal after receiving the decryption request uploaded by the user terminal include: A salt value is randomly inserted into the hash value, and the hash value is divided into several segments; Set the segment order and distribute the segments to the user terminal according to the order.

7. A blockchain data sharing encryption and decryption system, characterized in that, The system includes: The writing module is used to create a blockchain consisting of several nodes, obtain the user terminal corresponding to the blockchain, create a source verification pair that corresponds one-to-one with the user terminal, wherein the source verification pair consists of a registry and an identification code, the identification code is stored in the user terminal, and all registry entries are written into the blockchain. The module is used to read transaction data between the blockchain and the user terminal, at least obtaining the first data and the second data. A hash function is selected to hash the identification code in the user terminal to obtain an initial value. The initial value is written to the end of the first data, and the hash function is used to perform hash calculation on the first data with the initial value added to obtain the first hash value. The first hash value is written to the end of the second data, and so on. A module is created to collect real-time data that needs to be encrypted from transaction data. The real-time data contains the hash value of the previous data. An encryption key pair consisting of an encryption public key and an encryption private key is set. The real-time data is encrypted using the encryption public key and uploaded to the blockchain. A shared management system for encryption private keys is created. The open module is used to determine the target data, extract the hash value and send it to the user terminal after receiving the decryption request uploaded by the user terminal, extract the identification code in the user terminal, verify the hash value, and grant decryption permission to the corresponding user terminal after successful verification.

8. The blockchain data sharing encryption and decryption system according to claim 7, characterized in that, The writing module includes: The editing unit is used to embed a zero-knowledge proof mechanism into the blockchain and edit the feedback template; Clustering unit, used to cluster the user terminals into several types, where each type corresponds to a feedback template; The update unit is used to generate snapshots of all registry entries and update them at a preset frequency. The sorting unit records the generation time of each snapshot and sorts all the snapshots in chronological order of their generation time to obtain the archive set.

9. The blockchain data sharing encryption and decryption system according to claim 7, characterized in that, The obtained module includes: A data acquisition unit is used to collect environmental data from a user terminal, wherein the environmental data includes at least: geographical location and usage behavior; The judgment unit is used to determine whether there are abnormal characteristics in the environmental data. If so, it triggers a pre-edited emergency response mechanism.

10. The blockchain data sharing encryption and decryption system according to claim 7, characterized in that, The creation module includes: The setting unit is used to set the risk level of real-time data, wherein the risk level includes: high, medium and low; The switching unit is used to edit the switching mechanism corresponding to each risk level and to dynamically update the encrypted public key.

Citation Information

Patent Citations

  • Block chain-based updatable and revocable distributed digital identity system and method

    CN119885130A

  • Law evidence storage and verification method and system based on block chain technology, and medium

    CN120372688A