A blockchain-based method and system for automatic data sharing
By using the coordinated work of demand clients, data clients and relay nodes in the blockchain network, the automatic distribution and encryption and decryption of data are realized on demand, solving the problem that data sharing systems are not applicable in scenarios with high real-time requirements in the existing technology, and improving the security and flexibility of data sharing.
Patent Information
- Application Number
- CN202111405907.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2041-11-24
AI Technical Summary
The existing data sharing system is not applicable in scenarios with high real-time requirements, has low automation, and the centralized operation model has problems such as insufficient security and flexibility.
The blockchain-based automatic data sharing method is adopted to realize automatic data distribution and encryption and decryption of data by requiring the collaborative work of clients, data clients and relay nodes in the blockchain network.
Real-time data sharing is realized, security and flexibility in the data sharing process are improved, and can effectively operate in scenarios such as cluster collaborative tasks.
Smart Images

Figure CN114168997B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of blockchain, and specifically relates to a method and system for automatic data sharing based on blockchain. Background Art
[0002] At present, there are two types of data sharing systems. One is the upload and download mode. On the one hand, the data uploader uploads and marks the data. On the other hand, the downloader retrieves and downloads according to the requirements. The other is the subscription and distribution mode. After the data requester subscribes to the data, it receives the push of the data.
[0003] These two methods are mainly based on the centralized operation mode, with low automation degree, and frequent retrieval or download operations are required. Although the subscription mode realizes the automatic reception of data to a certain extent, it is not flexible and is limited to receiving the subscribed data. These two data sharing methods are not applicable in some scenarios with high real-time requirements, such as cluster collaborative tasks. Summary of the Invention
[0004] The purpose of the present invention is to provide a method and system for automatic data sharing based on blockchain. There can be multiple demand clients and data clients, which form a cluster system to realize the automatic distribution of data on demand, and at the same time improve the security in the data sharing process.
[0005] The technical solution for realizing the purpose of the present invention is: A method for automatic data sharing based on blockchain, including:
[0006] The demand client generates a data demand and sends the data demand to the smart contract. The data demand includes a first public key, the address of the demand client, and data features. The data features include data type, data label, and data collection time;
[0007] The demand client downloads a data index from the relay node. The data index includes a second key encrypted using the first public key, the address of the data client, and the uniform resource identifier of the data. The second key is used to decrypt the data. The data client is the provider of the data;
[0008] The demand client downloads the data encrypted using the second key according to the uniform resource identifier of the data, decrypts the encrypted second key using the first private key corresponding to the first public key, and decrypts the encrypted data using the second key to obtain the original data.
[0009] Preferably, it further includes:
[0010] The demand client sends a download request to the relay node;
[0011] The relay node verifies the identity of the requesting client;
[0012] After successful identity verification, perform the step of the requesting client downloading the data index from the relay node.
[0013] Preferably, it further includes:
[0014] Monitor whether the data index can be downloaded from the relay node;
[0015] If so, perform the step of the requesting client sending a download request to the relay node;
[0016] Preferably, it further includes:
[0017] Monitor whether a new data uniform resource identifier is added to the field corresponding to the data requirement in the smart contract;
[0018] If so, it means that the data index can be downloaded from the relay node.
[0019] A blockchain-based data automatic sharing method, including:
[0020] The data client collects the data;
[0021] The data client generates the second key and encrypts the data using the second key;
[0022] The data client obtains the relay public key from the smart contract and encrypts the second key using the relay public key;
[0023] The data client generates the data index, which includes the encrypted second key, the uniform resource identifier of the data, and the data characteristics of the data. The data characteristics include data type, data label, and data collection time, and uploads the data index to the smart contract;
[0024] The data client responds to the download request of the requesting client.
[0025] Preferably, it further includes:
[0026] The relay node monitors whether a new data index successfully matches the data requirement;
[0027] If so, the relay node obtains the data index and the data requirement from the smart contract, decrypts the second key in the data index using the relay private key corresponding to the relay public key, then encrypts the second key using the first public key in the data requirement, and updates the encrypted second key field in the data index;
[0028] The relay node responds to the download request of the demand client.
[0029] Preferably, it further includes:
[0030] Monitor whether there is a corresponding data demand for the field corresponding to the data index in the smart contract;
[0031] If so, it means that a new data index successfully matches the data demand.
[0032] A blockchain-based data automatic sharing system, including:
[0033] A demand client, a data client, a blockchain network, and a relay node; wherein:
[0034] The demand client is used to generate a data demand, send the data demand to the smart contract, the data demand includes a first public key, the address of the demand client, and data characteristics, and the data characteristics include data type, data label, and data collection time; download a data index from the relay node, the data index includes a second key encrypted with the first public key, the address of the data client, and the uniform resource identifier of the data, and the second key is used to decrypt the data, and the data client is the provider of the data; download the data encrypted with the second key from the data client, decrypt the encrypted second key with the first private key corresponding to the first public key, and use the second key to decrypt the encrypted data to obtain the original data;
[0035] The data client is used to collect the data; generate the second key, encrypt the data with the second key; obtain the relay public key from the smart contract, encrypt the second key with the relay public key; generate the data index, the data index includes the encrypted second key, the uniform resource identifier of the data, and the data characteristics of the data, and the data characteristics include data type, data label, and data collection time, and upload the data index to the smart contract; respond to the download request of the demand client;
[0036] When the relay node monitors that a new data index successfully matches the data demand, it obtains the data index and the data demand from the smart contract, decrypts the second key in the data index with the relay private key corresponding to the relay public key, then encrypts the second key with the first public key in the data demand, and updates the encrypted second key field in the data index; respond to the download request of the demand client.
[0037] There can be multiple demand clients, data clients, and relay nodes, and they can run on the same physical machine.
[0038] Multiple said demand clients, said data clients, and said relay nodes jointly operate and maintain a blockchain network.
[0039] Compared with the prior art, the remarkable effects of the present invention are as follows: Through automatic matching and monitoring, the present invention realizes real-time sharing of data; during the process of automatic data sharing in the present invention, both data encryption and decryption are performed locally on the client side, and the transmission of the secret key adopts the methods of asymmetric encryption and secondary encryption by the relay node, avoiding data leakage; there can be multiple demand clients, data clients, and relay nodes in the present invention, forming a cluster system to realize automatic data distribution on demand. Description of the Drawings
[0040] Figure 1 It is a flowchart of a data sharing method based on blockchain provided by an embodiment of the present invention.
[0041] Figure 2 It is a schematic structural diagram of a data sharing system based on blockchain provided by an embodiment of the present invention. Detailed Embodiments
[0042] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0043] The terms "first" and "second" etc. in the specification and claims of the present invention and the above drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0044] Next, the implementation process in the embodiments of the present invention will be described. Refer to Figure 1 , which shows the process of a data automatic sharing method based on blockchain. The method includes:
[0045] Step S101, the demand client submits a data demand and a first public key to the smart contract.
[0046] In this step, the demand client, that is, the data requester, completes subscription and registration. The data demand mainly refers to data characteristics such as data type, data label, and data collection time; the first public key is generated using an asymmetric encryption algorithm such as elliptic curve or RSA and is bound to the address of the demand client in the blockchain network.
[0047] Step S102: The data client encrypts the data using the second key, obtains the relay public key from the smart contract, encrypts the second key using the relay public key, and generates a data index to upload to the smart contract.
[0048] Among them, the second key is a one-time symmetric key, generated using a symmetric encryption algorithm such as AES or SM4. Each second key is generated when encrypting data and is used only once; the relay public key is the public key of the relay node, generated using an asymmetric encryption algorithm, not bound to the blockchain address of the relay node, but published by the relay node through the smart contract and updated periodically to enhance security; the data index includes data features for matching with data requirements, and also includes the uniform resource identifier of the data for downloading the data.
[0049] Step S103: The smart contract automatically matches the data index and data requirements. After successful matching, it sends the data index and the first public key to the relay node.
[0050] Among them, the smart contract is pre-deployed in the blockchain network. The matching basis includes all fields in the data index and data requirements. The matching algorithm is written in the smart contract and can be optimized and updated regularly. The way of sending the successfully matched data index to the relay node is not limited, and it can be in the way of the relay node polling, etc. The relay node is a trusted node in the system.
[0051] Step S104: The relay node decrypts the encrypted second key using the relay private key corresponding to the relay public key, re-encrypts the second key using the first public key, generates a data index, and sends it to the demand client.
[0052] All second keys are encrypted using the latest relay public key. After the relay node decrypts the second key, it re-encrypts the second key using the first public key of the data requester and updates the data index so that the demand client can decrypt the second key and decrypt the data.
[0053] Step S105: The demand client downloads the encrypted data according to the data index, decrypts the encrypted second key using the first private key corresponding to the first public key, and then decrypts the encrypted data using the second key to obtain the data.
[0054] Among them, the data index includes the unique resource identifier of the data. This method does not limit the storage method of the data, and only needs to ensure that the data requester can download the data through the unique resource identifier of the data.
[0055] In an embodiment of the present invention, a blockchain-based data sharing system is provided. This system is built on the decentralized network of the blockchain and consists of multiple blockchain node clients and smart contracts.
[0056] As Figure 2 , the system includes multiple demand clients, multiple data clients, a smart contract, a relay node, etc. The system has the following characteristics:
[0057] The demand client, the data client, and the relay node are all blockchain nodes;
[0058] There is no limit to the number of demand clients and data clients;
[0059] The distinction between the demand client and the data client is only the identity feature in a sharing process. In the actual system, the same blockchain node may be both a demand client and a data client, and the two types of clients can run simultaneously;
[0060] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for automatic data sharing based on blockchain, characterized in that, it includes steps: The demand client submits data requirements and the first public key to the smart contract; The data client encrypts the data using the second key, obtains the relay public key from the smart contract, encrypts the second key using the relay public key, and generates a data index to upload to the smart contract; The smart contract automatically matches the data index and data requirements. After successful matching, it sends the data index and the first public key to the relay node; The relay node decrypts the encrypted second key in the data index using the relay private key corresponding to the relay public key, re-encrypts the second key using the first public key, generates a new data index, and sends it to the demand client; Based on the new data index, the demand client decrypts the encrypted second key using the first private key corresponding to the first public key, and then decrypts the encrypted data using the second key to obtain the required data.
2. The method for automatic data sharing according to claim 1, characterized in that, The data requirements include the address of the demand client and data characteristics. The data characteristics include data type, data label, and data collection time; the data index includes the encrypted second key, the uniform resource identifier of the data, and the data characteristics.
3. The method for automatic data sharing according to claim 1, characterized in that, The first public key is generated using an elliptic curve or an asymmetric encryption algorithm and is bound to the address of the demand client in the blockchain network.
4. The method for automatic data sharing according to claim 1, characterized in that, The second key is a one-time symmetric key, generated using a symmetric encryption algorithm. The second key is regenerated when encrypting data and is used only once.
5. The method for automatic data sharing according to claim 1, characterized in that, The relay public key is generated using an asymmetric encryption algorithm, is not bound to the blockchain address of the relay node, and is published through the smart contract.
6. The method for automatic data sharing according to claim 1, characterized in that, it further includes: The demand client sends a download request to the relay node; The relay node confirms the identity of the demand client; After successful identity confirmation, it responds to the download request of the demand client.
7. The method for automatic data sharing according to claim 6, characterized in that, Before the demand client sends a download request to the relay node, it monitors whether a new data uniform resource identifier is added to the field corresponding to the data requirements in the smart contract. If so, the demand client sends a download request to the relay node.
8. The method for automatic data sharing according to claim 6, characterized in that, it further includes: The relay node monitors whether there is a new data index that successfully matches the data requirements in the smart contract: monitors whether there is a corresponding data requirement in the field corresponding to the data index in the smart contract. If so, it means that there is a new data index that successfully matches the data requirements; If there is, the relay node obtains the data index and the data requirements from the smart contract and generates a new data index; The relay node responds to the download request of the demand client.
9. A system for the data automatic sharing method based on blockchain according to any one of claims 1 to 8, characterized in that, it includes: a demand client, a data client, a smart contract of the blockchain, and a relay node; wherein: the demand client is used to generate a data demand, submit the data demand and the first public key to the smart contract, and at the same time, the demand client sends a download request to the relay node, downloads the encrypted data according to the new data index generated by the relay node, decrypts the encrypted second key using the first private key corresponding to the first public key, and then decrypts the encrypted data using the second key to obtain the demand data; the data client is used to collect data, encrypt the data using the second key, obtain the relay public key from the smart contract, encrypt the second key using the relay public key, and generate a data index to upload to the smart contract; the smart contract is used to automatically match the data index and the data demand, and after successful matching, send the data index and the first public key to the relay node; the relay node is used to decrypt the encrypted second key in the data index using the relay private key corresponding to the relay public key, re-encrypt the second key using the first public key, and generate a new data index; or when it monitors that the new data index successfully matches the data demand, obtain the data index and the data demand from the smart contract, generate a new data index, and respond to the download request of the demand client.
10. The system according to claim 9, characterized in that, there are multiple demand clients, data clients, and relay nodes, and they can run on the same physical machine, and there is one smart contract.
Citation Information
Patent Citations
Systems and methods for encryption of data on a blockchain
US20200084027A1
Data transmission method and device and network node
WO2019157810A1