Blockchain-based Data Sharing Method and Nodes

By performing multi-layer encryption and public key verification on the data on the blockchain, the security and transparency issues in the data sharing process are solved, ensuring the security and traceability of data transmission.

CN120263543BActive Publication Date: 2025-07-29HUNAN XIANGJIANG SHUTU INFORMATION TECH INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510730871.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-07-29
Estimated Expiration
2045-06-03

AI Technical Summary

Technical Problem

During the data sharing process of existing blockchains, data is independent and security mechanism is single, which is easy to be tampered with and difficult to discover in a timely manner.

Method used

The data is encrypted in multiple layers by generating random numbers and public keys, and using smart contracts to transmit data, ensuring that the data is transmitted as ciphertext on the chain, and the integrity of the data is verified through the public key.

Benefits of technology

The security and transparency of data transmission are realized, ensuring that the data is not tampered with during transmission, and that all operations are recorded on the blockchain can be traced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120263543B_ABST
    Figure CN120263543B_ABST
Patent Text Reader

Abstract

The present invention relates to blockchain, and discloses a data sharing method and a node based on blockchain to enhance security. The method of the present invention includes: Institution B generates a data set data to be sent to Institution A and a random number b value; obtains the public key AP of Institution A, and encrypts the random number b using the public key AP of Institution A to generate b2; then encrypts b using b2 to generate b'; determines whether Institution A needs to return a response data set for the data set data. If so, first encrypts its own public key BP and the data data respectively using the random number b as the key to obtain the public key BP1 and data1, then encrypts BP1 and data1 again using b2 as the key to obtain BP2 and data2, and then performs signature encryption on BP2 and data2 respectively using the public key AP of Institution A to obtain BP' and data'; finally, inputs data', BP', b', and b2 into the smart contract to trigger Institution A to automatically obtain them.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a data sharing method and node based on blockchain. Background Art

[0002] A smart contract is an automatically executed program stored on a blockchain that runs when preset conditions are met. Among them, the way data is transmitted to the smart contract is usually by calling the contract function through a transaction, so that relevant transaction records and parameters will be recorded on the blockchain.

[0003] Generally, a smart contract can achieve data transmission in the ways of on-chain to on-chain, off-chain to on-chain (through an oracle), and on-chain to off-chain. Among them, on-chain to on-chain refers to communication between contracts. The off-chain to on-chain method can input external data into the smart contract through an oracle, and the on-chain to off-chain method can trigger an off-chain system response through a smart contract time or status change. The corresponding data storage methods also include on-chain storage and off-chain storage. Among them, the cost of on-chain storage is relatively high; while the off-chain storage method can store data in decentralized storage such as IPFS / Arweave, and store the hash value in the smart contract.

[0004] In summary, data transmission based on smart contracts relies on on-chain function calls, oracle bridging, and event listening mechanisms. Users can select corresponding solutions according to specific scenarios, and combine encryption and decentralization technologies to ensure data credibility.

[0005] In the process of data sharing in the existing blockchain, most of the data on the chain are independent of each other and there is more or less plaintext, and the overall security mechanism is relatively single, which is likely to cause some or even all of the shared data to be maliciously tampered with and difficult to detect in time, and there is room for further improvement. Summary of the Invention

[0006] The purpose of the present invention is to disclose a data sharing method and node based on blockchain to improve security.

[0007] To achieve the above object, the first data sharing method based on blockchain disclosed by the present invention includes:

[0008] Step S11, institution B uses a tool to generate a public key BP and a private key BV;

[0009] Step S12, institution B generates a data set data to be sent to institution A;

[0010] Step S13, institution B generates a random number b value;

[0011] Step S14: Institution B obtains the public key AP of Institution A, encrypts the random number b using the public key AP of Institution A to generate b2; then encrypts b using b2 through the AES algorithm to generate b'.

[0012] Step S15: Institution B determines whether the data set data requires Institution A to return the response data set responseData. If yes, go to Step S16; otherwise, go to Step S17.

[0013] Step S16: Institution B first encrypts the public key BP and the data data respectively through the AES algorithm using the random number b as the key to obtain the public key BP1 and data1, then encrypts BP1 and data1 again using b2 as the key to obtain BP2 and data2, and then performs signature encryption on BP2 and data2 respectively using the public key AP of Institution A to obtain BP' and data'; finally, sends a transaction through the smart contract, and inputs data', BP', b', and b2 into the smart contract to trigger Institution A to automatically obtain them.

[0014] Step S17: Institution B first encrypts the data data through the AES algorithm using the random number b as the key to obtain data1, then encrypts data1 again using b2 as the key to obtain data2, and then performs signature encryption on data2 using the public key AP of Institution A to obtain data'; finally, sends a transaction through the smart contract, and inputs data', b', and b2 into the smart contract to trigger Institution A to automatically obtain them.

[0015] Optionally, the value of the random number b is the time stamp when generating the data set data; or the value of the random number b is a random number calculated based on the time stamp when generating the data set data and the current sharing times.

[0016] To achieve the above object, the present invention also discloses a second blockchain-based data sharing method, including:

[0017] Step S21: Institution A uses a tool to generate a public key AP and a private key AV.

[0018] Step S22: Institution A obtains the data shared by Institution B based on the smart contract, and identifies that the shared data is a three-element array composed of data', b', and b2 or a four-element array composed of data', BP', b', and b2; then decrypts b2 using the private key AV to obtain the first value, decrypts b' again using b2 as the key to obtain the second value, and then compares whether the first value and the second value are the same. If they are not the same, it is determined that the data has been tampered with, and an alarm is output while terminating the subsequent processing steps; if the first value and the second value are the same, when the shared data is a four-element array, go to Step S23, and when the shared data is a three-element array, go to Step S24.

[0019] Step S23: Institution A first uses the private key AV to decrypt data` through the RSA algorithm to obtain data2, then uses b2 as the key to decrypt data2 through the AES algorithm to obtain data1, and then uses the b value as the key to decrypt data1 to obtain data; according to the decrypted data, it is confirmed that there is no need to return the response data set responseData, and the processing of subsequent steps is terminated;

[0020] Step S24: Institution A first uses the private key AV to decrypt data` and BP` through the RSA algorithm to obtain BP2 and data2, then uses b2 as the key to decrypt BP2 and data2 through the AES algorithm to obtain BP1 and data1, and then uses the b value as the key to decrypt BP1 and data1 to obtain BP and data; according to the decrypted data, it is confirmed that the response data set responseData needs to be returned;

[0021] Step S25: Institution A generates a random number a value, obtains the public key BP of Institution B, and encrypts the random number a using the public key BP of Institution B to generate a2; then uses a2 to encrypt a through the AES algorithm to generate a`; then uses the random number a as the key to encrypt the data responseData through the AES algorithm to obtain responseData1, then uses a2 as the key to encrypt responseData1 again to obtain responseData2, and then uses the public key BP of Institution B to sign and encrypt responseData2 to obtain responseData`; finally, send a transaction through the smart contract and input responseData`, a`, and a2 into the smart contract to trigger Institution B to automatically obtain them.

[0022] Preferably, in this second method, it further includes:

[0023] Step S26: Institution B obtains the data shared by Institution A based on the smart contract and identifies that the shared data is a three-element array composed of responseData`, a`, and a2; then uses the private key BV to decrypt a2 to obtain the third value, uses a2 as the key to decrypt a` again to obtain the fourth value, and then compares whether the third value and the fourth value are the same. If they are not the same, an alarm is output while terminating the subsequent processing steps; if they are the same, Institution B first uses the private key BV to decrypt responseData` through the RSA algorithm to obtain responseData2, then uses the a2 value as the key to decrypt responseData2 through the AES algorithm to obtain responseData1, and finally uses the a value as the key to decrypt responseData1 through the AES algorithm to obtain responseData.

[0024] Similarly, the value of the random number a is the timestamp when generating the data set responsedata; alternatively, the value of the random number a is a random number calculated based on the timestamp when generating the data set responsedata and the current sharing times.

[0025] To achieve the above object, the present invention also discloses a data sharing node based on a blockchain, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the above first or second method is implemented.

[0026] The present invention has the following beneficial effects:

[0027] In the above interaction process, the initiator needs to obtain the public key of the other party. Obtaining the public key is equivalent to authorization, thus providing the first layer of screening mechanism. Moreover, the data uploaded to the blockchain is in ciphertext, and there is a strong coupling between different ciphertext data and it can be used by the recipient to judge whether the data has been tampered with, thus ensuring the security of the data from multiple dimensions; at the same time, all data access and sharing operations are recorded on the blockchain, making the entire data sharing process more transparent and traceable.

[0028] Hereinafter, the present invention will be described in further detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings constituting a part of this application are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0030] Figure 1 is a schematic flow chart corresponding to Institution B as the initiator in the data sharing method based on a blockchain disclosed in Embodiment 1 of the present invention.

[0031] Figure 2 is a schematic flow chart corresponding to Institution A as the responder in the data sharing method based on a blockchain disclosed in Embodiment 1 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0032] The following embodiments of the present invention will be described in detail with reference to the accompanying drawings, but the present invention can be implemented in many different ways defined and covered by the claims.

[0033] Embodiment 1

[0034] This embodiment discloses a data sharing method and node based on a blockchain, as Figure 1 shown, including:

[0035] Step S11: Institution B uses a tool to generate a public key BP and a private key BV.

[0036] Step S12: Organization B generates a data set data to be sent to Organization A.

[0037] Step S13: Organization B generates a random number b. Optionally, the random number b is the timestamp when generating the data set data; alternatively, the random number b is a random number calculated based on the timestamp when generating the data set data and the current sharing times.

[0038] Step S14: Organization B obtains the public key AP of Organization A, encrypts the random number b using the public key AP of Organization A to generate b2; then encrypts b using b2 through the AES algorithm to generate b`.

[0039] Step S15: Organization B determines whether the data set data requires Organization A to return a response data set responseData. If yes, go to Step S16; otherwise, go to Step S17.

[0040] In the above steps, assuming that Organization A providing property query is the real estate center, the form of the data set data that requires the return of the response data set responseData can be: {id: (430525), list: [name (name), isRoom (whether to purchase a house)]}. Correspondingly, Organization B can be other public service institutions such as banks, public security, or water, electricity, and gas. Or, when Organization B is the service provider of Organization A and the data sent is based on the change record of the property, such data usually does not require Organization A to return valuable response information.

[0041] Step S16: Organization B first encrypts the public key BP and the data data using the random number b as the key through the AES algorithm (Advanced Encryption Standard, symmetric encryption algorithm) to obtain the public key BP1 and data1, then encrypts BP1 and data1 again using b2 as the key to obtain BP2 and data2, and then signs and encrypts BP2 and data2 using the public key AP of Organization A to obtain BP` and data`; finally, sends a transaction through the smart contract, and inputs data`, BP`, b`, and b2 into the smart contract to trigger Organization A to automatically obtain them.

[0042] In this step, the encryption based on the public key usually uses the RSA algorithm. The series of encryptions in this step and the corresponding decryptions in the subsequent steps are prior arts and will not be elaborated.

[0043] Step S17: Institution B first uses the random number b as the key to encrypt the data data through the AES algorithm to obtain data1, then uses b2 as the key to encrypt data1 again to obtain data2, and then uses the public key AP of Institution A to sign and encrypt data2 to obtain data`; finally, send a transaction through the smart contract and input data`, b`, and b2 into the smart contract to trigger Institution A to automatically obtain them.

[0044] Correspondingly, as Figure 2 shown, the processing steps of Institution A include:

[0045] Step S21: Institution A uses a tool to generate the public key AP and the private key AV.

[0046] Step S22: Institution A obtains the data shared by Institution B based on the smart contract, and identifies that the shared data is a three-element array composed of data`, b`, and b2 or a four-element array composed of data`, BP`, b`, and b2; then uses the private key AV to decrypt b2 to obtain the first value, uses b2 as the key to decrypt b` again to obtain the second value, and then compares whether the first value and the second value are the same. If they are not the same, it is determined that the data has been tampered with, and an alarm is output while terminating the subsequent processing steps; if the first value and the second value are the same, when the shared data is a four-element array, go to Step S23, and when the shared data is a three-element array, go to Step S24.

[0047] Step S23: Institution A first uses the private key AV to decrypt data` through the RSA algorithm (an asymmetric encryption algorithm proposed by Ron Rivest, Adi Shamir, and Leonard Adleman) to obtain data2, then uses b2 as the key to decrypt data2 through the AES algorithm to obtain data1, and then uses the b value as the key to decrypt data1 to obtain data; according to the decrypted data, it is confirmed that there is no need to return the response data set responseData, and the subsequent steps of the processing are terminated.

[0048] Step S24: Institution A first uses the private key AV to decrypt data` and BP` through the RSA algorithm to obtain BP2 and data2, then uses b2 as the key to decrypt BP2 and data2 through the AES algorithm to obtain BP1 and data1, and then uses the b value as the key to decrypt BP1 and data1 to obtain BP and data; according to the decrypted data, it is confirmed that the response data set responseData needs to be returned.

[0049] In this step, the manifestation form of the data set responseData can be: {id:430525, list[Zhang San, has purchased a house]}.

[0050] Step S25: The A institution generates a random number a, obtains the public key BP of the B institution, encrypts the random number a using the public key BP of the B institution to generate a2; then encrypts a using the AES algorithm with a2 to generate a`; then encrypts the data responseData using the random number a as the key to obtain responseData1, and then encrypts responseData1 again using a2 as the key to obtain responseData2. Then, sign and encrypt responseData2 using the public key BP of the B institution to obtain responseData`; finally, send a transaction through the smart contract, and input responseData`, a`, and a2 into the smart contract to trigger the B institution to automatically obtain them.

[0051] In this step, similar to the above Step S13, the random number a is the timestamp when generating the data set responsedata; or the random number a is a random number calculated based on the timestamp when generating the data set responsedata and the current sharing times. Among them, when the random number corresponds to a unique timestamp, it can be used to mutually verify with the transaction records on the blockchain.

[0052] Step S26: The B institution obtains the data shared by the A institution based on the smart contract, and identifies that the shared data is a triple array composed of responseData`, a`, and a2; then decrypts a2 using the private key BV to obtain the third value, decrypts a` again using a2 as the key to obtain the fourth value, and then compares whether the third value and the fourth value are the same. If they are not the same, an alarm is output while terminating the subsequent processing steps; if they are the same, the B institution first decrypts responseData` using the private key BV through the RSA algorithm to obtain responseData2, then decrypts responseData2 using a2 as the key through the AES algorithm to obtain responseData1, and finally decrypts responseData1 using a as the key through the AES algorithm to obtain responseData.

[0053] Embodiment 2

[0054] This embodiment discloses a data sharing node based on the blockchain, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the methods corresponding to the above A institution or B institution. Among them, any node can act as both the A institution and the B institution when interacting with different institutional parties for different contents.

[0055] In summary, the methods and nodes disclosed in the embodiments of the present invention have the following beneficial effects:

[0056] In the above interaction process, the initiator needs to obtain the public key of the other party. Obtaining the public key is equivalent to authorization, thus providing the first layer of screening mechanism. Moreover, the data uploaded to the blockchain is in ciphertext, and there is a strong coupling between different ciphertext data and it can be used by the recipient to judge whether the data has been tampered with, thus ensuring the security of the data from multiple dimensions. At the same time, all operations of data access and sharing are recorded on the blockchain, making the entire data sharing process more transparent and traceable.

[0057] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A data sharing method based on blockchain, characterized in that Including: Step S11: Organization B uses a tool to generate a public key BP and a private key BV; Step S12: Organization B generates a data set data to be sent to Organization A; Step S13: Organization B generates a random number b value; Step S14: Organization B obtains the public key AP of Organization A, and encrypts the random number b using the public key AP of Organization A to generate b2; Then use b2 to encrypt b through the AES algorithm to generate b`; Step S15: Organization B determines whether the data set data requires Organization A to return a response data set responseData. If so, go to Step S16; Otherwise, go to Step S17; Step S16: Organization B first encrypts the public key BP and the data data through the AES algorithm using the random number b as the key to obtain the public key BP1 and data1, then encrypts BP1 and data1 again using b2 as the key to obtain BP2 and data2, and then uses the public key AP of Organization A to sign and encrypt BP2 and data2 respectively to obtain BP` and data`; Finally, send a transaction through the smart contract, and input data`, BP`, b`, b2 into the smart contract to trigger Organization A to automatically obtain them; Step S17: Organization B first encrypts the data data through the AES algorithm using the random number b as the key to obtain data1, then encrypts data1 again using b2 as the key to obtain data2, and then uses the public key AP of Organization A to sign and encrypt data2 to obtain data`; Finally, send a transaction through the smart contract, and input data`, b`, b2 into the smart contract to trigger Organization A to automatically obtain them.

2. The data sharing method based on blockchain according to claim 1, characterized in that The random number b value is the timestamp when the data set data is generated.

3. The data sharing method based on blockchain according to claim 1, characterized in that, The random number b value is a random number calculated based on the timestamp when the data set data is generated and the current sharing times.

4. A blockchain-based data sharing node, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method described in any one of claims 1 to 3 above.

5. A blockchain-based data sharing method, characterized in that, Including: Step S21: Organization A uses a tool to generate a public key AP and a private key AV; Step S22: Organization A obtains the data shared by Organization B based on the smart contract, and identifies that the shared data is a three-element array composed of data`, b`, b2 or a four-element array composed of data`, BP`, b`, b2; Then use the private key AV to decrypt b2 to obtain a first value, use b2 as the key to decrypt b` again to obtain a second value, and then compare whether the first value and the second value are the same. If they are not the same, it is determined that the data has been tampered with, and an alarm is output while terminating the subsequent processing steps; If the first value and the second value are the same, when the shared data is a four-element array, go to Step S23, and when the shared data is a three-element array, go to Step S24; Step S23: Organization A first decrypts data` through the RSA algorithm using the private key AV to obtain data2, then decrypts data2 through the AES algorithm using b2 as the key to obtain data1, and then decrypts data1 using b as the key to obtain data; According to the decrypted data, it is confirmed that there is no need to return the response data set responseData, and the processing of subsequent steps is terminated; Step S24: Institution A first uses its private key AV to decrypt data` and BP` through the RSA algorithm to obtain BP2 and data2, then uses b2 as the key to decrypt BP2 and data2 through the AES algorithm to obtain BP1 and data1, and then uses the b value as the key to decrypt BP1 and data1 to obtain BP and data; confirm the response data set responseData according to the decrypted data; Step S25: Institution A generates a random number a value, obtains the public key BP of Institution B, and encrypts the random number a using the public key BP of Institution B to generate a2; then encrypts a using a2 through the AES algorithm to generate a`; then uses the random number a as the key to encrypt the data responseData through the AES algorithm to obtain responseData1, and then uses a2 as the key to encrypt responseData1 again to obtain responseData2, and then uses the public key BP of Institution B to sign and encrypt responseData2 to obtain responseData`; finally, send a transaction through the smart contract, and input responseData`, a`, and a2 into the smart contract to trigger Institution B to automatically obtain them.

6. The data sharing method based on blockchain according to claim 5, characterized in that, It further includes: Step S26: Institution B obtains the data shared by Institution A based on the smart contract, and identifies that the shared data is a triple array composed of responseData`, a`, and a2; then uses its private key BV to decrypt a2 to obtain the third value, uses a2 as the key to decrypt a` again to obtain the fourth value, and then compares whether the third value and the fourth value are the same. If they are not the same, an alarm is output while terminating the subsequent processing steps; if they are the same, Institution B first uses its private key BV to decrypt responseData` through the RSA algorithm to obtain responseData2, then uses the a2 value as the key to decrypt responseData2 through the AES algorithm to obtain responseData1, and finally uses the a value as the key to decrypt responseData1 through the AES algorithm to obtain responseData.

7. The data sharing method based on blockchain according to claim 5 or 6, characterized in that, The random number a value is the timestamp when generating the data set responsedata.

8. The data sharing method based on blockchain according to claim 5 or 6, characterized in that The random number a value is a random number calculated based on the timestamp when generating the data set responsedata and the current sharing times.

9. A data sharing node based on blockchain, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method described in any one of claims 5 to 8 above.

Citation Information

Patent Citations

  • Method and system for ensuring search completeness of searchable public key encryption

    US20220255739A1

  • Method and apparatus for sharing blockchain data

    WO2020259635A1