Data sharing method and electronic device
A data sharing method may be applied to a server side, and the method includes: receiving a data access request sent by a first client side, where the data access request includes first data-sharing information, and the first data-sharing information is used to describe to-be-accessed data; and sending first storage information to the first client side in a case that the first client side meets a first access condition in a first smart contract, where the first smart contract belongs to a first block in a blockchain, and the first storage information is used to represent information that is corresponding to the to-be-accessed data and that is stored in a storage server.
1 . A data sharing method, wherein the method is applied to a server side and comprises:
receiving a data access request sent by a first client side, wherein the data access request comprises first data-sharing information, and the first data-sharing information is used to describe to-be-accessed data; and
sending first storage information to the first client side in a case that the first client side meets a first access condition in a first smart contract, wherein
the first smart contract belongs to a first block in a blockchain, and the first storage information is used to represent information that is corresponding to the to-be-accessed data and that is stored in a storage server,
wherein the data access request further comprises identity information of the first client side and a digital signature of the first client side, and before the step of sending first storage information to the first client side, the method further comprises:
in a case that the first client side meets the first access condition in the first smart contract, generating a third block in the blockchain according to the identity information of the first client side, the first data-sharing information, and the digital signature of the first client side, wherein the third block comprises a second smart contract, and the second smart contract is associated with the first smart contract and is used to instruct to send the first storage information to the first client side in a case that payment information sent by the first client side is received;
sending billing information associated with the to-be-accessed data to the first client side; and
after the payment information sent by the first client side is received, generating a fourth block in the blockchain according to the payment information and the digital signature of the first client side, wherein the fourth block comprises a payment record corresponding to the payment information; and
the sending first storage information to the first client side in a case that the first client side meets a first access condition in a first smart contract comprises:
sending the first storage information to the first client side in a case that the first client side meets the first access condition in the first smart contract and the payment information sent by the first client side is received.
2 . The method according to claim 1 , wherein the data access request further comprises identity information of the first client side and a digital signature of the first client side, and before the step of sending first storage information to the first client side, the method further comprises:
in a case that the first client side meets the first access condition in the first smart contract, generating a second block according to the identity information of the first client side, the first data-sharing information, and the digital signature of the first client side, wherein the second block comprises an access record corresponding to the to-be-accessed data.
3 . The method according to claim 1 , wherein the first storage information comprises first key information and first address information, and the sending first storage information to the first client side in a case that the first client side meets a first access condition in a first smart contract comprises:
in a case that the first client side meets the first access condition in the first smart contract, generating the first key information corresponding to the to-be-accessed data, and obtaining the first address information; and
sending the first key information and the first address information to the first client side, wherein
the first key information is used to obtain an access permission of the storage server, and the first address information is used to indicate a storage address of the to-be-accessed data.
4 . A server side, comprising a processor, a memory, and a program or an instruction that is stored in the memory and that can be run on the processor, wherein the program or the instruction is executed by the processor to:
receive a data access request sent by a first client side, wherein the data access request comprises first data-sharing information, and the first data-sharing information is used to describe to-be-accessed data; and
send first storage information to the first client side in a case that the first client side meets a first access condition in a first smart contract, wherein
the first smart contract belongs to a first block in a blockchain, and the first storage information is used to represent information that is corresponding to the to-be-accessed data and that is stored in a storage server,
wherein the data access request further comprises identity information of the first client side and a digital signature of the first client side, and
wherein the processor is further caused to:
in a case that the first client side meets the first access condition in the first smart contract, generate a third block in the blockchain according to the identity information of the first client side, the first data-sharing information, and the digital signature of the first client side, wherein the third block comprises a second smart contract, and the second smart contract is associated with the first smart contract and is used to instruct to send the first storage information to the first client side in a case that payment information sent by the first client side is received;
send billing information associated with the to-be-accessed data to the first client side; and
after the payment information sent by the first client side is received, generate a fourth block in the blockchain according to the payment information and the digital signature of the first client side, wherein the fourth block comprises a payment record corresponding to the payment information; and
wherein the processor is further caused to:
send the first storage information to the first client side in a case that the first client side meets the first access condition in the first smart contract and the payment information sent by the first client side is received.
5 . The server side according to claim 4 , wherein the data access request further comprises identity information of the first client side and a digital signature of the first client side, and the program or the instruction is further executed by the processor to implement:
before the step of sending first storage information to the first client side,
in a case that the first client side meets the first access condition in the first smart contract, generating a second block according to the identity information of the first client side, the first data-sharing information, and the digital signature of the first client side, wherein the second block comprises an access record corresponding to the to-be-accessed data.
6 . The server side according to claim 4 , wherein the first storage information comprises first key information and first address information, and the sending first storage information to the first client side in a case that the first client side meets a first access condition in a first smart contract comprises:
in a case that the first client side meets the first access condition in the first smart contract, generating the first key information corresponding to the to-be-accessed data, and obtaining the first address information; and
sending the first key information and the first address information to the first client side, wherein
the first key information is used to obtain an access permission of the storage server, and the first address information is used to indicate a storage address of the to-be-accessed data.
7 . The server side according to claim 4 , wherein the data access request further comprises identity information of the first client side and a digital signature of the first client side, and the program or the instruction is further executed by the processor to implement:
before the step of sending first storage information to the first client side,
in a case that the first client side meets the first access condition in the first smart contract, generating a third block according to the identity information of the first client side, the first data-sharing information, and the digital signature of the first client side, wherein the third block comprises a second smart contract, and the second smart contract is associated with the first smart contract and is used to instruct to send the first storage information to the first client side in a case that payment information sent by the first client side is received;
sending billing information associated with the to-be-accessed data to the first client side; and
after the payment information sent by the first client side is received, generating a fourth block according to the payment information and the digital signature of the first client side, wherein the fourth block comprises a payment record corresponding to the payment information; and
the sending first storage information to the first client side in a case that the first client side meets a first access condition in a first smart contract comprises:
sending the first storage information to the first client side in a case that the first client side meets the first access condition in the first smart contract and the payment information sent by the first client side is received.