Data sharing method and device, electronic equipment and computer readable storage medium
By acquiring and sending feature description information in the blockchain, the problem of inaccurate data acquisition in the blockchain is solved, and the accuracy of data and transaction possibilities are improved.
Patent Information
- Application Number
- CN202310664719.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-06
- Publication Date
- 2024-12-06
AI Technical Summary
The prior art is difficult to accurately obtain the required data from the blockchain, making it difficult for data requesters to confirm whether the acquired data is the data they actually need.
By obtaining the data to be shared and its feature description information, determining the data to be linked and sending it to the device connected to the blockchain, it ensures that the data requester can analyze the required data through the feature description information on the blockchain, thereby Improve data accuracy and transaction possibilities.
Improve the accuracy of data acquisition from blockchain and the possibility of data requesters and providers trading, ensuring accurate data storage and acquisition.
Smart Images

Figure CN119088774A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data sharing technology, and in particular, relates to a data sharing method, a data sharing device, a data reading method, a data reading device, an electronic device, and a computer-readable storage medium. Background Art
[0002] The blockchain is a chain of blocks that is stored in all servers. The data stored in the blockchain is difficult to be tampered with by a large area (such as more than half of the nodes) at the same time.
[0003] Since the data in the blockchain is difficult to be tampered with, storing data in the blockchain can solve the problem of people not trusting each other. However, in the existing methods, it is still difficult to ensure that people can accurately obtain the data they need from the blockchain. Therefore, it is necessary to provide a new method to solve the above technical problems. Summary of the invention
[0004] The embodiments of the present application provide a data sharing method, device, electronic device and computer-readable storage medium, which can solve the problem that it is difficult to accurately obtain data from the blockchain in existing methods.
[0005] In a first aspect, an embodiment of the present application provides a data sharing method, which is applied to a first device, including:
[0006] Acquire data to be shared and feature description information corresponding to the data to be shared;
[0007] Determine the data to be uploaded to the chain according to the data to be shared and the feature description information corresponding to the data to be shared;
[0008] The data to be uploaded to the chain is sent to a second device, where the second device is a device connected to the blockchain.
[0009] Since the second device is a device connected to the blockchain, the second device can publish the data to be uploaded to the blockchain that it receives from the first device. Since the data to be uploaded to the blockchain is determined based on the data to be shared and the corresponding feature description information, the data requester can analyze which data he wants to obtain through the feature description information on the blockchain, thereby improving the accuracy of the data obtained by the data requester from the blockchain and increasing the possibility of transactions between the data requester and the data provider.
[0010] In another possible implementation manner of the first aspect, before determining the data to be uploaded to the chain, the method further includes:
[0011] Obtaining a feature description list on the blockchain, wherein the feature description list includes feature description information;
[0012] Comparing the feature description information in the feature description list with the feature description information corresponding to the data to be shared;
[0013] When the feature description list does not contain feature description information identical to the feature description information corresponding to the data to be shared, the feature description information corresponding to the data to be shared is sent to the second device.
[0014] Before sharing the data to the blockchain, it is first determined whether feature description information identical to the feature description information corresponding to the data to be shared already exists in the blockchain. Therefore, when the corresponding feature description information does not exist in the blockchain, the feature description information can be broadcast on the blockchain through the second device. Therefore, when the second device stores the data to be shared in the blockchain, the correspondence between the data to be shared and the feature description information can be accurately established, thereby improving the accuracy of the stored data to be shared.
[0015] In another possible implementation manner of the first aspect, after obtaining the feature description list on the blockchain, the method further includes:
[0016] Calculating the summary of each feature description information in the feature description list, and calculating the summary of the feature description information corresponding to the data to be shared;
[0017] The comparing the feature description information in the feature description list with the feature description information corresponding to the data to be shared includes:
[0018] The summary of the feature description information in the feature description list is compared with the summary of the feature description information corresponding to the data to be shared.
[0019] Since the amount of data corresponding to the summary of the feature description information is much smaller than the amount of data of the feature description information itself, comparing the summaries to determine whether the corresponding feature description information is the same can greatly improve the speed of obtaining the determination result.
[0020] In another possible implementation manner of the first aspect, determining the data to be uploaded to the chain according to the data to be shared and feature description information corresponding to the data to be shared includes:
[0021] Generating a ciphertext of the data to be shared;
[0022] The data to be uploaded to the chain is determined according to the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared.
[0023] In another possible implementation manner of the first aspect, before determining the data to be uploaded to the chain according to the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared, the method further includes:
[0024] Determine the data index of the data to be shared;
[0025] The determining the data to be uploaded to the chain according to the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared includes:
[0026] The data to be uploaded to the chain is determined according to the ciphertext of the data to be shared, the feature description information corresponding to the data to be shared, and the data index of the data to be shared.
[0027] Since the data to be uploaded to the chain is also determined based on the data index, it is helpful for users to verify the correctness and integrity of the blockchain data.
[0028] In a second aspect, an embodiment of the present application provides a data sharing method, which is applied to a second device accessing a blockchain, including:
[0029] Receiving data to be uploaded sent by the first device, where the data to be uploaded is determined according to the data to be shared by the first device and feature description information corresponding to the data to be shared;
[0030] Broadcast the data to be uploaded to the blockchain.
[0031] Since the second device broadcasts the data to be uploaded to the blockchain based on the data to be shared and the feature description information corresponding to the data to be shared, each user can obtain summary information of the data to be shared based on the feature description information on the blockchain, so that they can quickly determine whether the data to be shared corresponding to the feature description information is the data they actually need to obtain, thereby increasing the possibility of transactions between data requesters and data providers, and improving the accuracy of data obtained by data requesters from the blockchain.
[0032] In a possible implementation manner of the second aspect, before the receiving the to-be-uplinked data sent by the first device, the method further includes:
[0033] Receiving feature description information corresponding to the data to be shared sent by the first device;
[0034] comparing the received feature description information with the feature description information stored in the second device;
[0035] In the event that it is determined that the feature description information stored in the second device does not contain feature description information that is identical to the received feature description information, the received feature description information is broadcast to the blockchain.
[0036] In a possible implementation manner of the second aspect, after the receiving, from the first device, feature description information corresponding to the to-be-shared data, the method further includes:
[0037] Calculating a summary of the received feature description information to obtain a first summary;
[0038] Calculating a summary of the feature description information stored in the second device to obtain a second summary;
[0039] The comparing the received feature description information with the feature description information stored in the second device includes:
[0040] The first digest is compared to the second digest.
[0041] In a possible implementation manner of the second aspect, the data to be uploaded to the chain is determined according to the ciphertext of the data to be shared and feature description information corresponding to the data to be shared, and before the data to be uploaded to the chain is broadcasted to the blockchain, the method further includes:
[0042] Determine the ciphertext of the data to be shared from the data to be uploaded to the chain;
[0043] Comparing the ciphertext of the data to be shared with the ciphertext of the data stored in the second device;
[0044] The step of broadcasting the data to be uploaded to the blockchain includes:
[0045] In the event that the ciphertext of the stored data does not contain the same ciphertext as the ciphertext of the data to be shared, the data to be uploaded to the chain determined based on the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared will be broadcast to the blockchain.
[0046] In a possible implementation manner of the second aspect, the data to be uploaded to the chain is determined according to the ciphertext of the data to be shared, feature description information corresponding to the data to be shared, and a data index of the data to be shared, and when there is no ciphertext of the stored data that is the same as the ciphertext of the data to be shared, broadcasting the data to be uploaded to the blockchain includes:
[0047] When the ciphertext of the stored data does not have the same ciphertext as the ciphertext of the data to be shared, compare the data index of the data to be shared parsed from the data to be uploaded with the data index of the ciphertext of the data stored in the second device;
[0048] When the data index of the data to be shared is different from the data index of the ciphertext of the data stored in the second device, the data to be uploaded to the blockchain is broadcasted.
[0049] In a third aspect, an embodiment of the present application provides a data reading method, which is applied to a third device, including:
[0050] Receiving first shared data sent by a first device;
[0051] Acquire second shared data shared by the first device on the blockchain;
[0052] Verify whether the first shared data is equal to the second shared data; if they are equal, store the second shared data.
[0053] Specifically, when the third device determines that the first shared data and the second shared data are equal, it considers that the data shared by the first device on the blockchain is complete and accurate. At this time, storing the second shared data (or the first shared data) can ensure the integrity and accuracy of the stored data.
[0054] In a fourth aspect, an embodiment of the present application provides a data sharing device, applied to a first device, including:
[0055] A feature description information acquisition module, used to acquire the data to be shared and the feature description information corresponding to the data to be shared;
[0056] A module for determining data to be uploaded, configured to determine the data to be uploaded according to the data to be shared and feature description information corresponding to the data to be shared;
[0057] The module for sending data to be uploaded to the chain is used to send the data to be uploaded to the chain to the second device, where the second device is a device connected to the blockchain.
[0058] In a fifth aspect, an embodiment of the present application provides a data sharing device, which is applied to a second device accessing a blockchain, including:
[0059] A to-be-uplinked data receiving module, configured to receive the to-be-uplinked data sent by the first device, wherein the to-be-uplinked data is determined according to the to-be-shared data of the first device and feature description information corresponding to the to-be-shared data;
[0060] The module for broadcasting data to be uploaded to the chain is used to broadcast the data to be uploaded to the blockchain.
[0061] In a sixth aspect, an embodiment of the present application provides a data reading device, applied to a third device, including:
[0062] A first shared data acquisition module, used to acquire first shared data sent by a first device;
[0063] A second shared data acquisition module, used to acquire second shared data shared by the first device on the blockchain;
[0064] The data verification module is used to verify whether the first shared data is equal to the second shared data, and if they are equal, store the second shared data.
[0065] In the seventh aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any one of the first aspect when executing the computer program, or implements the method described in any one of the second aspect when executing the computer program, or implements the method described in the third aspect when executing the computer program.
[0066] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the method as described in any one of the first aspect, or the method as described in any one of the second aspect, or the method as described in the third aspect.
[0067] In the ninth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes a method as described in any one of the first aspect, or executes a method as described in any one of the second aspect, or executes a method as described in the third aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art.
[0069] Figure 1 This is a schematic diagram of storing and reading data in a blockchain provided by an embodiment of the present application;
[0070] Figure 2 It is a flowchart of a data sharing method provided by an embodiment of the present application;
[0071] Figure 3 It is a flowchart of another data sharing method provided by an embodiment of the present application;
[0072] Figure 4 This is a schematic diagram of a process of uploading data to a chain through a first device and a second device, provided in an embodiment of the present application;
[0073] Figure 5 is a flow chart of a data reading method provided by another embodiment of the present application;
[0074] Figure 6 This is a schematic diagram of a process for verifying shared data provided by an embodiment of the present application;
[0075] Figure 7 is a structural schematic diagram of a data sharing device provided by another embodiment of the present application;
[0076] Figure 8 is a structural diagram of another data sharing device provided in an embodiment of the present application;
[0077] Fig. 9 is a structural schematic diagram of a data reading device provided in an embodiment of the present application;
[0078] Fig.10 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0079] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0080] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0081] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0082] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0083] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.
[0084] Embodiment 1:
[0085] In order to solve the problem of people not trusting each other, data is usually shared in the blockchain. The schematic diagram of storing and reading data in the blockchain is as follows: Figure 1As shown in the figure, (1) the data provider requests the blockchain (blockchain includes smart contracts) to publish a data set; (2) after the data provider generates the shared data ciphertext and uploads it to the Inter Planetary File System (IPFS), it will obtain the data storage address, set the attribute access policy and the symmetric key ciphertext encrypted by the symmetric encryption key, write the symmetric key ciphertext and the data storage address into the smart contract, and write the hash value of the data storage address into the blockchain through the consensus node; (3) the data requester generates the attribute key and identity information according to its own attribute set and submits them to the blockchain so that the blockchain can perform attribute verification and identity information verification; (4) the blockchain sends the information sent by the data requester to the data provider; (5) the blockchain receives the feedback information from the data provider; (6) after the blockchain verifies the data requester, it sends the symmetric encryption key and data storage address to the data requester; (7) the data requester then obtains the shared data ciphertext from IPFS and decrypts it to obtain the shared data.
[0086] refer to Figure 1 It can be seen that when the data provider only uploads the symmetric key ciphertext and data to IPFS to realize data sharing, the data requester can only obtain the data shared by the data provider from the blockchain. Since the data requester cannot obtain information other than the shared data, it is difficult for the data requester to confirm whether the data obtained from the blockchain is the data he actually needs to obtain, that is, it is difficult to ensure the accuracy of the data obtained from the blockchain.
[0087] In order to improve the accuracy of data obtained from the blockchain, an embodiment of the present application provides a data sharing method.
[0088] In this data sharing method, the first device determines the data to be uploaded to the chain based on the shared data it wants to share and the corresponding feature description information, and sends the data to be uploaded to the chain to the second device. Since the second device is a device connected to the blockchain, the second device can broadcast the received data to be uploaded to the chain on the blockchain. At the same time, since the data sent to the second device includes the feature description information corresponding to the shared data in addition to the shared data, the data requester can determine whether the corresponding shared data is the data he actually needs to obtain based on the feature description information on the blockchain, thereby improving the accuracy of the shared data obtained from the blockchain.
[0089] The data sharing method provided in the embodiment of the present application is described below with reference to the accompanying drawings.
[0090] Figure 2 A flow chart of a data sharing method provided in an embodiment of the present application is shown. The data sharing method is applied to a first device, which is a device that owns data. The details are as follows:
[0091] Step S21: Acquire the data to be shared and the feature description information corresponding to the data to be shared.
[0092] The data to be shared refers to the data that the data owner wants to share with others. The type of data to be shared is related to the product. For example, if the product is a battery, the data to be shared can be the battery voltage, capacity, available range, etc. If the product is an electric car, the data to be shared can be vehicle information, cell information, real-time collected temperature, current, collection time, etc. In some embodiments, since a product will generate a lot of data during the production process or during the operation process, and only certain data are the data that the manufacturer wants to share, after obtaining the data corresponding to the product, combined with the pre-set filtering conditions, the data that the manufacturer wants to share with others can be filtered out from the obtained data, that is, the above-mentioned data to be shared can be filtered out. Among them, the above-mentioned pre-set filtering conditions can be a data index range. For example, when the data index corresponding to the acquired data is [1,10], and the data index range of the pre-set filtering conditions is [5,6], the two data corresponding to the data index 5 and the data index 6 are used as the above-mentioned data to be shared.
[0093] The feature description information corresponding to the data to be shared refers to the description information used to describe the features of the data to be shared. For example, the feature description information may be device model information, such as the model version number of the sensor that collects the data. For another example, when the data to be shared is data corresponding to an electric vehicle, the feature description information corresponding to the data to be shared may be the vehicle's production time, manufacturer, number of battery packs, manufacturer of the battery packs, etc.
[0094] It should be pointed out that since feature description information is usually unchanged over a period of time, and a product usually generates multiple data during the production or operation process, one feature description information usually corresponds to multiple data to be shared.
[0095] Step S22: Determine the data to be uploaded to the chain based on the data to be shared and the feature description information corresponding to the data to be shared.
[0096] The data to be uploaded here refers to the data that will be stored in the blockchain.
[0097] In an embodiment of the present application, the data to be uploaded can be directly determined based on the data to be shared and the corresponding feature description information, or the data to be shared can be encrypted first and then determined in combination with the feature description information. It is only necessary to determine the data to be uploaded in combination with the feature description information, and no limitation is made here.
[0098] Step S23: Send the data to be uploaded to the chain to the second device, where the second device is a device connected to the blockchain.
[0099] Specifically, the first device can send the data to be uploaded to the chain that it has determined to the second device through wired communication or wireless communication. After receiving the data to be uploaded to the chain, the second device can broadcast the data to the blockchain, so that the first device can share the corresponding data on the blockchain.
[0100] In the embodiment of the present application, the first device determines the data to be put on the chain based on the data to be shared and the corresponding feature description information, and sends the data to be put on the chain to the second device. Since the second device is a device connected to the blockchain, the second device can publish the data to be put on the chain received from the first device in the blockchain. Since the data to be put on the chain is determined based on the data to be shared and the corresponding feature description information, the data requester can analyze which data he wants to obtain through the feature description information on the blockchain, thereby improving the accuracy of the data obtained by the data requester from the blockchain, and increasing the possibility of transactions between the data requester and the data provider.
[0101] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0102] Embodiment 2:
[0103] In some embodiments, in order to accurately share data on the blockchain, before the above step S22, it also includes:
[0104] A1. Obtain a feature description list on the blockchain, wherein the feature description list includes feature description information.
[0105] Specifically, the first device can obtain a feature description list on the blockchain through any device (such as the second device) that can access the blockchain, and the feature description list is a feature description list corresponding to the data shared by the first device on the blockchain. For example, assuming that the data shared by the first device on the blockchain includes: data 1 and data 2 (data 1 and data 2 may be data stored in the blockchain at different times), and the feature description information corresponding to data 1 and data 2 are feature description information 1 and feature description information 2, respectively, then the first device can obtain the feature description list corresponding to the first device by sending its identity information to the device accessing the blockchain, and the feature description list obtained by the first device includes feature description information 1 and feature description information 2.
[0106] A2. Compare the feature description information in the feature description list with the feature description information corresponding to the data to be shared.
[0107] Specifically, the feature description information corresponding to the data to be shared is compared with the feature description information in the feature description list one by one. If it is determined that there is feature description information in the feature description list that is the same as the feature description information corresponding to the data to be shared, the comparison is stopped. Otherwise, the feature description information corresponding to the data to be shared is compared with the next feature description information in the feature description list until all the feature description information in the feature description list are compared.
[0108] A3. When the feature description list does not contain feature description information identical to the feature description information corresponding to the data to be shared, send the feature description information corresponding to the data to be shared to the second device.
[0109] Specifically, when the feature description list does not contain feature description information identical to the feature description information corresponding to the data to be shared, it usually indicates that the feature description information does not exist in the blockchain, that is, there is no shared data corresponding to the feature description information. Therefore, sending the feature description information corresponding to the data to be shared to the second device can enable the second device to broadcast the received feature description information to the blockchain in a timely manner. Of course, if the feature description list already contains feature description information identical to the feature description information corresponding to the data to be shared, there is no need to send the feature description information corresponding to the data to be shared to the second device, that is, there is no need to store the feature description information in the blockchain.
[0110] In the embodiment of the present application, considering that the data stored in the blockchain by the first device includes shared data and corresponding feature description information, before sharing the data to the blockchain, it is first determined whether feature description information identical to the feature description information corresponding to the data to be shared already exists in the blockchain, so that when the corresponding feature description information does not exist in the blockchain, the feature description information is broadcast on the blockchain through the second device, so that when the second device stores the data to be shared in the blockchain, the correspondence between the data to be shared and the feature description information can be accurately established, thereby improving the accuracy of the stored data to be shared.
[0111] In some embodiments, in order to improve the comparison speed of feature description information, after the above A1, the following is further included:
[0112] The summary of each feature description information in the feature description list is calculated, and the summary of the feature description information corresponding to the data to be shared is calculated.
[0113] Correspondingly, the above A2 includes:
[0114] The summary of the feature description information in the feature description list is compared with the summary of the feature description information corresponding to the data to be shared.
[0115] Specifically, the summaries of the feature description information in the feature description list are compared with the summaries of the feature description information corresponding to the data to be shared one by one, until it is determined that there is a summary in the feature description list that is identical to the summary of the feature description information corresponding to the data to be shared, or until the summary of each feature description information in the feature description list is compared with the feature description information corresponding to the data to be shared.
[0116] In the embodiment of the present application, after obtaining the feature description list, the first device calculates the hash value of each feature description information in the feature description list to obtain the corresponding digest, and calculates the hash value of the feature description information corresponding to the data to be shared to obtain the corresponding digest, and then compares the two digests to determine whether the two corresponding feature description information are the same. Since the amount of data corresponding to the digest of the feature description information is much smaller than the amount of data of the feature description information itself, comparing the digests to determine whether the corresponding feature description information is the same can greatly improve the speed of obtaining the judgment result.
[0117] Embodiment three:
[0118] In some embodiments, in order to improve the security of shared data, the above step S22 includes:
[0119] B1. Generate the ciphertext of the data to be shared.
[0120] The first device may encrypt the data to be shared by a preset encryption algorithm, such as using an irreversible encryption algorithm to encrypt the data to be shared, so as to improve the security of the obtained ciphertext. In some embodiments, the encryption algorithm includes a hash algorithm.
[0121] In some embodiments, when the shared data includes multiple pieces of data, the ciphertext of each piece of data is generated separately. For example, if the ciphertext of the data is calculated using a hash algorithm, a summary of each piece of data is generated, and then the ciphertext of the data to be shared is obtained based on the summary of each piece of data. Since the corresponding ciphertext is generated separately for each piece of data to be shared, it is helpful to ensure the accuracy of each piece of data.
[0122] B2. Determine the data to be uploaded to the chain based on the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared.
[0123] For example, the ciphertext of the data to be shared is directly combined with the corresponding feature description information to obtain the data to be uploaded to the chain.
[0124] In the embodiment of the present application, since the data to be shared is first encrypted and then the data to be uploaded to the chain is generated based on the obtained ciphertext and the characteristic description information corresponding to the data to be shared, the data subsequently stored in the blockchain is the ciphertext of the data to be shared, that is, the data requester cannot directly view the data to be shared itself from the blockchain, thereby improving the security of the data to be shared in the blockchain.
[0125] In some embodiments, considering that the data to be shared usually includes multiple pieces of data, in order to facilitate the subsequent verification of the data on the blockchain, before the above B2, it also includes:
[0126] Determine the data index of the data to be shared.
[0127] Correspondingly, the above B2 includes:
[0128] The data to be uploaded to the chain is determined based on the ciphertext of the data to be shared, the feature description information corresponding to the data to be shared, and the data index of the data to be shared.
[0129] Specifically, a one-to-one correspondence between the data index and each piece of data can be established in chronological order, for example, the first piece of data generated is corresponded to the data index "1", and the second piece of data generated is corresponded to the data index "2". In an embodiment of the present application, the data index corresponding to each piece of data in the data to be shared can be obtained when the data to be shared is obtained, or the data index corresponding to each piece of data in the data to be shared can be obtained before the data to be uploaded needs to be determined, which is not limited here. After obtaining the data index of the data to be shared, the ciphertext of the data to be shared (such as the summary of the data to be shared), the feature description information and the data index of the data to be uploaded can be combined into the data to be uploaded according to the preset combination rule. For example, assuming that the combination rule is: the ciphertext of the data to be shared is stored in the first preset field, the feature description information is stored in the second preset field, and the data index is stored in the third preset field, and the first preset field is at the front and the third preset field is at the back, that is, the arrangement is: the first preset field, the second preset field and the third preset field, and the contents of these fields are combined to obtain the above-mentioned data to be uploaded.
[0130] Since the data to be uploaded is also determined based on the data index of the data to be shared, after the data to be uploaded is stored in the blockchain, the data provider can verify whether the data stored in the blockchain is correct based on the data index stored in the blockchain, and the data requester can also verify whether the data obtained from the blockchain is the data he actually wants to obtain based on the data index. That is, in the embodiment of the present application, the data to be uploaded is also determined based on the data index, which is conducive to users verifying the correctness and integrity of the data in the blockchain.
[0131] Embodiment 4:
[0132] Figure 3A flow chart of a data sharing method provided in an embodiment of the present application is shown. The data sharing method is applied to a second device, which is a device connected to a blockchain, and is described in detail as follows:
[0133] Step S31: receiving data to be uploaded sent by a first device, where the data to be uploaded is determined according to data to be shared by the first device and feature description information corresponding to the data to be shared.
[0134] The first device is the first device in the above-mentioned Embodiment 1 to Embodiment 3.
[0135] Specifically, the second device receives the data to be uploaded from the first device via wired communication or wireless communication. The specific determination process of the data to be shared, the feature description information and the data to be uploaded is detailed in Embodiments 1 to 3, which will not be repeated here.
[0136] Step S32: broadcast the data to be uploaded to the blockchain.
[0137] Specifically, the second device submits the data to be uploaded to the blockchain to write the data to be uploaded to the distributed ledger. Further, after the data to be uploaded is written to the distributed ledger, the feature description information corresponding to the data to be shared is broadcast to the entire network so that other devices in the blockchain can obtain the feature description information in a timely manner.
[0138] In the embodiment of the present application, since the second device broadcasts the data to be uploaded to the blockchain based on the data to be shared and the feature description information corresponding to the data to be shared, each user can obtain summary information of the data to be shared based on the feature description information on the blockchain, thereby being able to quickly determine whether the data to be shared corresponding to the feature description information is the data they actually need to obtain, thereby increasing the possibility of transactions between data requesters and data providers, and improving the accuracy of data obtained by data requesters from the blockchain.
[0139] In some embodiments, in order to update the feature description information in the blockchain in a timely manner, before the above step S31, it also includes:
[0140] C1. Receive feature description information corresponding to the data to be shared sent by the first device.
[0141] Specifically, the first device may directly send the feature description information corresponding to the data to be shared to the second device, that is, the first device sends the feature description information corresponding to the data to be shared to the second device without pre-judging whether the feature description information corresponding to the data to be shared exists in the blockchain. Of course, in order to reduce the judgment process of the second device, the first device may also send the feature description information corresponding to the data to be shared to the second device after pre-judging that the feature description information corresponding to the data to be shared does not exist in the blockchain.
[0142] C2. Compare the received feature description information with the feature description information stored in the second device.
[0143] Since the second device is a device connected to the blockchain, the second device will store information in the blockchain, such as the feature description information corresponding to each piece of data shared by the first device in the blockchain. Of course, in order to facilitate comparison, the feature description information corresponding to each piece of data shared by the first device in the blockchain can be displayed in a feature description list, that is, the feature description information corresponding to each piece of data shared by the first device in the blockchain is recorded in the feature description list.
[0144] In the embodiment of the present application, after receiving the feature description information sent by the first device, the second device obtains all the feature description information stored therein corresponding to the first device, and then compares the received feature description information with each of the feature description information stored therein.
[0145] C3. When it is determined that the feature description information stored in the second device does not contain feature description information that is identical to the received feature description information, broadcast the received feature description information to the blockchain.
[0146] Specifically, if the second device determines that it does not store the same feature description information as the received feature description information, that is, the blockchain does not store the same feature description information as the feature description information received by the second device, then the second device broadcasts the received feature description information to the blockchain, so that the blockchain can update the feature description information of the first device in a timely manner before storing the shared data of the first device. For example, when the feature description information is a model version number, since the second device updates the model version number corresponding to the first device to the blockchain in a timely manner, the probability of the data requester obtaining shared data with an incorrect version number from the blockchain can be reduced.
[0147] In some embodiments, in order to improve the speed of comparing feature description information, after the above C1, the following is further included:
[0148] D1. Calculate the summary of the received feature description information to obtain a first summary.
[0149] D2. Calculate the summary of the feature description information stored in the second device to obtain a second summary.
[0150] Correspondingly, the above C1 includes:
[0151] Compare the first digest to the second digest.
[0152] Specifically, considering that the data volume of the summary of the feature description information is smaller than the data volume of the feature description information itself, the hash value of the feature description information sent from the first device is first calculated to obtain the first summary, and then the hash value of the feature description information stored by the second device is calculated to obtain the second summary. Of course, if the second device stores multiple feature description information corresponding to the first device, it is necessary to calculate the hash values of these feature description information separately. After obtaining the first summary and the second summary, the first summary is compared with each summary in the second summary. If the first summary is the same as any summary in the second summary, it indicates that the second device stores the same feature description information as the feature description information sent by the first device. Otherwise, if the first summary is different from each summary in the second summary, it indicates that the second device does not store the same feature description information as the feature description information sent by the first device.
[0153] In the embodiment of the present application, since it is determined whether the first summary and the second summary are the same to determine whether there is feature description information stored in the second device that is identical to the received feature description information, and the amount of data contained in the summary of the feature description information is smaller than the amount of data contained in the feature description information itself, the above-mentioned comparison method can effectively improve the comparison speed of the two feature description information.
[0154] In some embodiments, the data to be uploaded received by the second device is determined based on the ciphertext of the data to be shared and the characteristic description information corresponding to the data to be shared. At this time, the data to be uploaded broadcast by the second device includes the ciphertext of the data to be shared, thereby improving the security of the data to be shared.
[0155] In some embodiments, in order to avoid repeatedly uploading the data of the first device to the chain, before the above step S32, the method further includes:
[0156] E1. Determine the ciphertext of the data to be shared from the data to be uploaded to the chain.
[0157] E2. Compare the ciphertext of the data to be shared with the ciphertext of the data stored in the second device.
[0158] Correspondingly, the above step S32 includes:
[0159] In the event that the ciphertext of the stored data does not contain the same ciphertext as the ciphertext of the data to be shared, the data to be uploaded to the blockchain will be broadcasted.
[0160] Of course, if the ciphertext of the data stored in the second device is the same as the ciphertext of the data to be shared, a prompt indicating that the data submission failed is returned to the first device, so that the first device is informed of the failure of the data submitted in time.
[0161] Since the second device is a device connected to the blockchain, if the ciphertext of the data to be shared of the first device has been published in the blockchain, the second device must also store the ciphertext. In an embodiment of the present application, if the data to be uploaded is obtained by combining the ciphertext of the data to be shared with the corresponding feature description information, the second device can parse the ciphertext of the data to be shared from the data to be uploaded according to the pre-acquired combination method, and compare the ciphertext of the data to be shared obtained by parsing with the ciphertext of each data corresponding to the first device stored in it, so as to determine whether the second device stores the same ciphertext as the ciphertext of the data to be shared. If not, it will be broadcast to the blockchain, thereby avoiding the data to be shared from being broadcasted repeatedly on the blockchain.
[0162] In some embodiments, the data to be uploaded to the chain received by the second device is determined based on the ciphertext of the data to be shared, feature description information corresponding to the data to be shared, and a data index of the data to be shared.
[0163] In some embodiments, when the ciphertext of the stored data does not have the same ciphertext as the ciphertext of the data to be shared, broadcasting the data to be uploaded to the blockchain includes:
[0164] F1. When the ciphertext of the stored data does not contain the same ciphertext as the ciphertext of the data to be shared, compare the data index of the data to be shared parsed from the data to be uploaded with the data index of the ciphertext of the data stored in the second device.
[0165] Specifically, the second device determines the combination rule of the data to be shared on the chain according to the ciphertext of the data to be shared, the feature description information corresponding to the data to be shared, and the data index of the data to be shared, and parses the data index of the data to be shared from the data to be shared. For example, assuming that the combination rule is: the ciphertext of the data to be shared is stored in the first preset field, the feature description information is stored in the second preset field, and the data index is stored in the third preset field, and the first preset field is at the front and the third preset field is at the back, that is, the arrangement is: the first preset field, the second preset field and the third preset field, and the contents of these fields are combined to obtain the above-mentioned data to be shared. Then the second device directly reads the data index of the data to be shared from the third preset field according to the combination rule. The second device obtains the data index of the ciphertext of the data corresponding to the feature description information stored by it that is the same as the feature description information of the data to be shared (assuming that these data indexes are standard data indexes), and compares the read data index of the data to be shared with the standard data index one by one to determine whether the data index of the data to be shared conflicts with the data index of the ciphertext in the blockchain.
[0166] F2. When the data index of the data to be shared is different from the data index of the ciphertext of the data stored in the second device, the data to be uploaded to the blockchain is broadcasted.
[0167] In an embodiment of the present application, the second device first determines whether the ciphertext of the data to be shared already exists in the blockchain. If not, the second device continues to determine whether the data index of the ciphertext already existing in the blockchain conflicts with the data index of the data to be shared. That is, the second device determines whether the blockchain has stored the data to be shared currently submitted by the first device by adopting different judgment conditions. Only when the results of two judgments indicate that the blockchain does not store the data to be shared currently submitted by the first device, the data to be uploaded to the chain currently submitted by the first device is broadcast to the blockchain, thereby effectively avoiding repeated uploading of the same data.
[0168] In order to more clearly describe the process of interaction between the first device and the second device, Figure 4 Give a description.
[0169] Step S401, obtaining local data according to the local data set.
[0170] Specifically, the first device obtains local data from the local data set. The local data here is determined according to the properties of the product itself. For example, if the product is a battery, the local data may be data such as the battery voltage, capacity, and collection time.
[0171] Step S402: Acquire feature description information corresponding to local data.
[0172] Specifically, the first device obtains feature description information corresponding to the local data based on the local data, and the feature description information may be a model version number or the like.
[0173] Step S403: Calculate the hash value of the feature description information of the local data.
[0174] Specifically, the first device calculates a hash value of the feature description information according to a preset hash algorithm.
[0175] Step S404, calling the smart contract to obtain the feature description list on the blockchain.
[0176] Specifically, the first device obtains feature description information corresponding to the data shared by the first device on the blockchain from the blockchain by calling the smart contract, and each feature description information forms a feature description list.
[0177] Step S405, calculating the hash value of each feature description information in the feature description list.
[0178] Specifically, the first device calculates the hash value of each feature description information in the feature description list respectively.
[0179] Step S406, determine whether there is a hash value in the feature description list that is equal to the hash value corresponding to the local data, if so, execute step S414, if not, execute step S409.
[0180] Specifically, the first device compares the hash value of the feature description information of the local data with the hash value of each feature description information in the feature description list, to determine whether there is a hash value in the feature description list that is equal to the hash value of the feature description information of the local data.
[0181] Step S407: filter out the data to be shared according to the specified data index range.
[0182] The designated data index range is set according to actual conditions, and the designated data index range may be a data index range where data indexes of all local data are located, or may be a data index range where data indexes of some local data are located.
[0183] Specifically, the first device filters out data corresponding to a data index matching the specified data index range from local data according to a preset specified data index range, to obtain the data to be shared.
[0184] Step S408, calculating the hash value of each piece of data in the data to be shared.
[0185] Specifically, the first device calculates the hash value of each piece of data in the data to be shared, and obtains a corresponding digest.
[0186] Step S409, calling the smart contract to upload the feature description information corresponding to the local data to the chain.
[0187] Specifically, the first device calls the smart contract to send feature description information corresponding to the local data to the second device connected to the blockchain.
[0188] Step S410, calculating the hash value of the feature description information on the chain.
[0189] Specifically, the second device calculates a hash value of the received feature description information.
[0190] Step S411, determine whether there is a hash value on the blockchain that is equal to the hash value calculated in step S410. If not, execute step S412; if so, execute step S414.
[0191] Specifically, the second device calculates the hash value of the feature description information corresponding to the first device on the blockchain, and then compares the hash value of the feature description information corresponding to the blockchain with the hash value calculated in step S410. If they are different, it indicates that there is no feature description information on the blockchain that is the same as the feature description information of the data to be shared.
[0192] Step S412: submit the feature description information corresponding to the data to be shared to the blockchain and write it into the distributed ledger.
[0193] Specifically, if the second device determines that there is no feature description information identical to the feature description information of the data to be shared on the blockchain, the feature description information is written into the distributed ledger. In this way, the user can learn that the feature description information of the first device has been updated when the ledger is subsequently broadcast.
[0194] Step S413: broadcast the ledger update to the entire network.
[0195] Step S414, combining the data to be uploaded to the chain according to the hash value, feature description information and data index corresponding to the data to be shared.
[0196] Specifically, the first device combines the hash value, feature description information and data index corresponding to the data to be shared into the data to be uploaded to the chain according to a preset combination rule.
[0197] Step S415, calling the smart contract to upload the data to be uploaded to the chain.
[0198] Specifically, the first device calls the smart contract and sends the data to be uploaded to the chain to the second device.
[0199] Step S416, determine whether the hash value corresponding to the data to be shared exists, if not, execute step S417, if yes, execute step S418.
[0200] Specifically, the second device parses the hash value of the data to be shared from the data to be uploaded to the chain, and compares the parsed hash value with the hash value of the data stored by the second device. If the parsed hash value is different from the hash value of each data stored by the second device, it is determined that the data to be shared is not stored in the blockchain.
[0201] Step S417, verifying whether there is any conflict in the data range according to the data index.
[0202] Specifically, the second device parses the data index of the data to be shared from the data to be uploaded, and compares the parsed data index with the data index corresponding to the data of the first device stored in the second device; if part or all of the parsed data index is the same as the data index stored in the second device, it is determined that there is a conflict in the data range.
[0203] Step S418, returning a prompt indicating that data submission failed.
[0204] Specifically, the second device returns a prompt indicating that the data submission failed to the first device.
[0205] Step S419: submit to the blockchain and write into the distributed ledger.
[0206] Specifically, the second device submits the data to be uploaded to the blockchain and writes it into the distributed ledger.
[0207] Step S420: broadcast the ledger update to the entire network.
[0208] Specifically, the second device broadcasts the updated content of the distributed ledger to the entire network so that users can promptly learn about the data to be uploaded to the chain that is uploaded by the first device.
[0209] Step S421, returns a prompt indicating that the data submission is successful.
[0210] Specifically, the second device returns a prompt indicating that the data submission is successful to the first device.
[0211] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0212] Embodiment five:
[0213] After the first device stores the data it wants to share in the blockchain, other devices can obtain the data shared by the first device from the blockchain based on the smart contract. The following is an example of a third device obtaining the data shared by the first device in the blockchain.
[0214] Figure 5A flow chart of a data reading method provided in an embodiment of the present application is shown, and the data reading method is applied to a third device, and is described in detail as follows:
[0215] Step S51: Acquire first shared data sent by a first device.
[0216] Specifically, when the user corresponding to the third device wants to use the data shared on the blockchain by the first device, in order to ensure the accuracy of the data it obtains, the third device first obtains the corresponding data from the first device by wired or wireless means to obtain the first shared data. Of course, if the data received by the third device from the first device also includes data that the third device does not need, the received data can be filtered, such as filtering the received data by data index to obtain the above-mentioned first shared data.
[0217] The above-mentioned first shared data may be only the data itself, that is, it does not include the feature description information corresponding to the data nor the data index of the data. Of course, it may also include feature description information and / or data index. The following is an example of the first shared data including the data itself and the data index.
[0218] It should be pointed out that in this step, the third device does not obtain the data shared by the first device on the blockchain from the blockchain, but directly obtains it from the first device.
[0219] Of course, before the third device obtains the first shared data, the third device may send characteristic description information of the data it wants to obtain to the first device, or send characteristic description information and data index and other information of the data it wants to obtain, so that the first device can clearly understand the scope of the first shared data it needs to send to the third device.
[0220] Step S52: Obtain the second shared data shared by the first device on the blockchain.
[0221] It should be pointed out that the above-mentioned second shared data is the data shared by the first device on the blockchain. When the data shared by the first device on the blockchain is the data to be shared itself and the characteristic description information of the data to be shared, the above-mentioned second shared data is the data to be shared itself (that is, the data itself that has not been encrypted) and the characteristic description information of the data to be shared.
[0222] When the data shared by the first device on the blockchain is the ciphertext of the data to be shared and the characteristic description information of the data to be shared, the second shared data is the ciphertext of the data to be shared (i.e., the encrypted data) and the characteristic description information of the data to be shared.
[0223] When the data shared by the first device on the blockchain is the ciphertext of the data to be shared, the characteristic description information of the data to be shared and the data index of the data to be shared, the second shared data is the ciphertext of the data to be shared (i.e., the encrypted data) and the characteristic description information of the data to be shared.
[0224] In the embodiment of the present application, the third device can obtain the data shared by the first device from the blockchain by calling the smart contract to obtain the above-mentioned second shared data. For example, assuming that the user of the third device wants to use the battery data corresponding to the feature description information 1 shared by the first device on the blockchain, the third device can receive the battery data corresponding to the feature description information 1 sent to it by the first device, and obtain the battery data corresponding to the feature description information 1 shared by the first device from the blockchain.
[0225] Step S53, verifying whether the first shared data is equal to the second shared data, and if so, storing the second shared data.
[0226] Specifically, when the second shared data includes the data to be shared and the feature description information, the third device may directly compare the data to be shared in the second shared data with the data to be shared in the first shared data to determine whether the first shared data and the second shared data are equal.
[0227] When the second shared data includes the ciphertext and feature description information of the data to be shared, the third device first extracts the corresponding data to be shared from the first shared data, and calculates the ciphertext (such as a hash value) of the data to be shared, and then compares the calculated ciphertext with the ciphertext of the data to be shared of the second shared data to determine whether the first shared data and the second shared data are equal.
[0228] When the second shared data includes a data index, a ciphertext of the data to be shared, and feature description information, the third device extracts the data corresponding to the data index from the first shared data according to the data index of the second shared data, obtains the data to be shared in the first shared data, calculates the ciphertext of the data to be shared in the first shared data, and compares the calculated ciphertext with the ciphertext of the data to be shared in the second shared data to determine whether the first shared data and the second shared data are equal.
[0229] In the embodiment of the present application, when the third device determines that the first shared data and the second shared data are equal, it is considered that the data shared by the first device on the blockchain is complete and accurate. At this time, storing the second shared data (or the first shared data) can ensure the integrity and accuracy of the stored data.
[0230] In some embodiments, in order to avoid repeatedly storing the same feature description information locally, after determining that the first shared data is equal to the second shared data, the method further includes:
[0231] It is determined whether feature description information identical to the feature description information corresponding to the second shared data is stored locally. If so, the feature description information corresponding to the second shared data is stored. If not, the feature description information corresponding to the second shared data is no longer stored.
[0232] Specifically, if the second shared data includes feature description information corresponding to the data to be shared, the feature description information corresponding to the second shared data is the feature description information corresponding to the data to be shared. If the second shared data does not include feature description information corresponding to the data to be shared, the third device calls the smart contract to obtain the feature description information corresponding to the second shared data, and then compares the obtained feature description information with the locally stored feature description information, and determines whether the feature description information corresponding to the second shared data has been stored locally based on the comparison result.
[0233] In some embodiments, in order to improve the comparison speed, the hash values corresponding to the acquired feature description information and the locally stored feature description information can be calculated respectively, and then the hash values can be compared to determine whether there is feature description information in the locally stored feature description information that is the same as the acquired feature description information.
[0234] In order to more clearly describe how to verify the accuracy and completeness of the shared data obtained, the following Figure 6 Give a description.
[0235] Step S601: Acquire data from a first device.
[0236] Specifically, the third device obtains data from the first device in a wireless or wired manner, and the data generally includes data that the third device wishes to use.
[0237] Step S602: calling the smart contract to obtain the second shared data from the blockchain.
[0238] The third device obtains the second shared data stored on the blockchain by the first device by calling the smart contract of the blockchain, wherein the second shared data includes a summary of the data (i.e., the encrypted data) and a data index corresponding to the data.
[0239] Step S603: determine a data range according to the second shared data.
[0240] Specifically, the third device determines the data range according to the data index in the second shared data. For example, assuming that in the second shared data, the data index corresponding to the data summary is [1, 100], then the data range is [1, 100].
[0241] Step S604: Filter data corresponding to the data range from the data acquired by the first device according to the determined data range to obtain first shared data.
[0242] Specifically, the third device compares the determined data range with the data index corresponding to the data obtained from the first device to filter out the data corresponding to the data index matching the data range from the data obtained from the first device. For example, assuming that the determined data range is [10,100] and the data index corresponding to the data obtained from the first device is [1,200], only the data corresponding to the data index [10,100] is used as the first shared data.
[0243] Step S605: Calculate the digest of the first shared data.
[0244] Specifically, the third device calculates a hash value of the first shared data to obtain a summary of the first shared data.
[0245] Step S606, compare the digest of the first shared data with the digest of the data in the second shared data, if the two are equal, execute step S607, otherwise, execute step S608.
[0246] Specifically, whether the data in the first shared data and the second shared data are the same is determined by comparing whether the digest of the first shared data and the digest of the data in the second shared data are the same.
[0247] Step S607, storing the second shared data in the database.
[0248] When it is determined that the data in the first shared data and the second shared data are the same, it indicates that the data on the blockchain is complete and accurate. At this time, the second shared data can be stored in the local database, or the first shared data can be stored in the local database.
[0249] Step S608: do not store the second shared data.
[0250] When it is determined that the data in the first shared data and the second shared data are not the same, it indicates that the data on the blockchain is incomplete or inaccurate, and at this time, the second shared data will not be stored in the local database. Further, the third device re-acquires new data from the first device.
[0251] Step S609: calling the smart contract to obtain feature description information corresponding to the second shared data from the blockchain.
[0252] Specifically, when the second shared data does not include feature description information, the third device obtains the feature description information corresponding to the second shared data on the blockchain by calling the smart contract.
[0253] Step S610, confirm whether the feature description information already exists locally based on the summary of the acquired feature description information, if not, execute step S611, otherwise, execute step S612.
[0254] Specifically, the hash value of the feature description information obtained from the blockchain is calculated to obtain a summary of the feature description information, and the summary of the feature description information is checked to see if it is the same as the summary of each feature description information stored locally. If they are not the same, it indicates that the summary of the feature description information corresponding to the second shared data is not stored locally.
[0255] Step S611, storing feature description information in a local database.
[0256] When the summary of the feature description information corresponding to the second shared data is not stored locally, the feature description information corresponding to the second shared data is stored, such as storing the feature description information in correspondence with the second shared data, so that the user can calculate and consult.
[0257] Step S612: do not store the feature description information in the local database.
[0258] When the summary of the feature description information corresponding to the second shared data has been stored locally, there is no need to store the feature description information again, so as to avoid the problem of memory waste caused by repeated storage.
[0259] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0260] Embodiment six:
[0261] Corresponding to the data sharing method described in the above embodiments 1 to 3, Figure 7 A structural block diagram of a data sharing device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0262] Reference Figure 7 The data sharing device 7 is applied to the first device, and includes: a feature description information acquisition module 71, a to-be-uplinked data determination module 72, and a to-be-uplinked data sending module 73. Among them:
[0263] The feature description information acquisition module 71 is used to acquire the data to be shared and the feature description information corresponding to the data to be shared.
[0264] The module 72 for determining data to be uploaded is used to determine the data to be uploaded according to the data to be shared and the feature description information corresponding to the data to be shared.
[0265] The module 73 for sending data to be uploaded to the chain is used to send the data to be uploaded to the second device, where the second device is a device connected to the blockchain.
[0266] In the embodiment of the present application, since the second device is a device connected to the blockchain, the second device can publish the data to be uploaded to the blockchain that it receives from the first device. Since the data to be uploaded to the blockchain is determined based on the data to be shared and the corresponding feature description information, the data requester can analyze which data he wants to obtain through the feature description information on the blockchain, thereby improving the accuracy of the data obtained by the data requester from the blockchain and increasing the possibility of transactions between the data requester and the data provider.
[0267] In some embodiments, the data sharing device 7 further includes:
[0268] The feature description list acquisition module is used to obtain the feature description list on the above-mentioned blockchain before determining the data to be uploaded to the chain, wherein the above-mentioned feature description list includes feature description information.
[0269] The feature description information comparison module is used to compare the feature description information in the feature description list with the feature description information corresponding to the data to be shared.
[0270] The feature description information sending module is used to send the feature description information corresponding to the data to be shared to the second device when the feature description list does not contain the same feature description information as the feature description information corresponding to the data to be shared.
[0271] In some embodiments, the data sharing device 7 further includes:
[0272] The feature description information summary calculation module is used to calculate the summary of each feature description information in the feature description list after obtaining the feature description list on the blockchain, and calculate the summary of the feature description information corresponding to the data to be shared.
[0273] Correspondingly, the feature description information comparison module includes:
[0274] The summary of the feature description information in the feature description list is compared with the summary of the feature description information corresponding to the data to be shared.
[0275] In some embodiments, the module 72 for determining the data to be uploaded includes:
[0276] The ciphertext generating unit of the data to be shared is used to generate the ciphertext of the data to be shared.
[0277] The to-be-linked data generating unit is used to determine the to-be-linked data according to the ciphertext of the to-be-shared data and the feature description information corresponding to the to-be-shared data.
[0278] In some embodiments, the data sharing device 7 further includes:
[0279] The data index determination module is used to determine the data index of the above-mentioned data to be shared before determining the above-mentioned data to be uploaded to the chain based on the ciphertext of the above-mentioned data to be shared and the characteristic description information corresponding to the above-mentioned data to be shared.
[0280] Correspondingly, the above-mentioned data generation unit to be uploaded includes:
[0281] The data to be uploaded to the chain is determined according to the ciphertext of the data to be shared, the feature description information corresponding to the data to be shared, and the data index of the data to be shared.
[0282] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0283] Embodiment seven:
[0284] Corresponding to the data sharing method described in the fourth embodiment above, Figure 8 A structural block diagram of a data sharing device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0285] The data sharing device 8 is applied to a second device connected to the blockchain, and includes: a data receiving module 81 to be uploaded and a data broadcasting module 82 to be uploaded.
[0286] The data to be uploaded receiving module 81 is used to receive the data to be uploaded sent by the first device, where the data to be uploaded is determined according to the data to be shared by the first device and the feature description information corresponding to the data to be shared.
[0287] The data to be uploaded to the chain broadcast module 82 is used to broadcast the above-mentioned data to be uploaded to the blockchain.
[0288] In the embodiment of the present application, since the second device broadcasts the data to be uploaded to the blockchain based on the data to be shared and the feature description information corresponding to the data to be shared, each user can obtain summary information of the data to be shared based on the feature description information on the blockchain, thereby being able to quickly determine whether the data to be shared corresponding to the feature description information is the data they actually need to obtain, thereby increasing the possibility of transactions between data requesters and data providers, and improving the accuracy of data obtained by data requesters from the blockchain.
[0289] In some embodiments, the data sharing device 8 further includes:
[0290] The feature description information receiving module is used to receive feature description information corresponding to the data to be shared sent by the first device before receiving the data to be uploaded sent by the first device.
[0291] The received feature description information comparison module is used to compare the received feature description information with the feature description information stored in the second device.
[0292] The feature description information chain-up module is used to broadcast the received feature description information to the above-mentioned blockchain when it is determined that the feature description information stored in the above-mentioned second device does not contain feature description information that is identical to the received feature description information.
[0293] In some embodiments, the data sharing device 8 further includes:
[0294] The first summary generation module is used to calculate the summary of the received feature description information to obtain a first summary after receiving the feature description information corresponding to the data to be shared sent by the first device.
[0295] The second summary generation module is used to calculate the summary of the feature description information stored in the second device to obtain a second summary.
[0296] Correspondingly, the received feature description information comparison module includes:
[0297] Compare the above first summary with the above second summary.
[0298] In some embodiments, the data to be uploaded is determined according to the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared, and the data sharing device 8 further includes:
[0299] The ciphertext determination module of the data to be shared is used to determine the ciphertext of the data to be shared from the data to be put on the chain before broadcasting the data to be put on the chain to the blockchain.
[0300] The ciphertext comparison module is used to compare the ciphertext of the data to be shared with the ciphertext of the data stored in the second device.
[0301] Correspondingly, the above-mentioned data broadcast module 82 to be uploaded includes:
[0302] In the event that the ciphertext of the stored data does not contain the same ciphertext as the ciphertext of the data to be shared, the data to be uploaded to the chain determined based on the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared will be broadcast to the blockchain.
[0303] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0304] Embodiment eight:
[0305] Corresponding to the data reading method described in the fifth embodiment above, Fig. 9 A structural block diagram of a data reading device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0306] The data reading device 9, applied to the third device, comprises: a first shared data acquisition module 91, a second shared data acquisition module 92, and a data verification module 93. Among them:
[0307] The first shared data acquisition module 91 is configured to acquire first shared data sent by a first device.
[0308] The second shared data acquisition module 92 is used to acquire the second shared data shared by the first device on the blockchain.
[0309] The data verification module 93 is used to verify whether the first shared data is equal to the second shared data. If they are equal, the second shared data is stored.
[0310] In the embodiment of the present application, when the third device determines that the first shared data and the second shared data are equal, it is considered that the data shared by the first device on the blockchain is complete and accurate. At this time, storing the second shared data (or the first shared data) can ensure the integrity and accuracy of the stored data.
[0311] In some embodiments, in order to avoid repeated storage of the same feature description information locally, after determining that the first shared data is equal to the second shared data, the data reading device 9 further includes:
[0312] The feature description information existence judgment module is used to judge whether the feature description information identical to the feature description information corresponding to the second shared data is stored locally. If so, the feature description information corresponding to the second shared data is stored; if not, the feature description information corresponding to the second shared data is no longer stored.
[0313] In some embodiments, in order to improve the comparison speed, the hash values corresponding to the acquired feature description information and the locally stored feature description information can be calculated respectively, and then the hash values can be compared to determine whether there is feature description information in the locally stored feature description information that is the same as the acquired feature description information.
[0314] Embodiment nine:
[0315] Fig.10 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Fig.10 As shown, the electronic device 10 of this embodiment includes: at least one processor 100 ( Fig.10 Only one processor is shown in the figure), a memory 101, and a computer program 102 stored in the memory 101 and executable on the at least one processor 100, wherein the processor 100 implements the steps of any of the above-mentioned method embodiments when executing the computer program 102.
[0316] The electronic device 10 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device may include, but is not limited to, a processor 100 and a memory 101. Those skilled in the art will appreciate that Fig.10 This is only an example of the electronic device 10 and does not constitute a limitation on the electronic device 10 . The electronic device 10 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0317] The processor 100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0318] In some embodiments, the memory 101 may be an internal storage unit of the electronic device 10, such as a hard disk or memory of the electronic device 10. In other embodiments, the memory 101 may also be an external storage device of the electronic device 10, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 10. Further, the memory 101 may also include both an internal storage unit of the electronic device 10 and an external storage device. The memory 101 is used to store an operating system, an application program, a boot loader (BootLoader), data and other programs, such as the program code of the computer program, etc. The memory 101 may also be used to temporarily store data that has been output or is to be output.
[0319] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0320] An embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the above-mentioned method embodiments when executing the computer program.
[0321] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0322] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0323] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0324] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0325] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0326] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0327] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0328] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data sharing method, characterized in that: Applied to a first device, comprising: Acquire data to be shared and feature description information corresponding to the data to be shared; Determine the data to be uploaded to the chain according to the data to be shared and the feature description information corresponding to the data to be shared; The data to be uploaded to the chain is sent to a second device, where the second device is a device connected to the blockchain.
2. The data sharing method according to claim 1, characterized in that: Before determining the data to be uploaded, the method further includes: Obtaining a feature description list on the blockchain, wherein the feature description list includes feature description information; Comparing the feature description information in the feature description list with the feature description information corresponding to the data to be shared; When the feature description list does not contain feature description information identical to the feature description information corresponding to the data to be shared, the feature description information corresponding to the data to be shared is sent to the second device.
3. The data sharing method according to claim 2, characterized in that: After obtaining the feature description list on the blockchain, the method further includes: Calculating the summary of each feature description information in the feature description list, and calculating the summary of the feature description information corresponding to the data to be shared; The comparing the feature description information in the feature description list with the feature description information corresponding to the data to be shared includes: The summary of the feature description information in the feature description list is compared with the summary of the feature description information corresponding to the data to be shared.
4. The data sharing method according to any one of claims 1 to 3, characterized in that: The determining the data to be uploaded to the chain according to the data to be shared and the feature description information corresponding to the data to be shared includes: Generate a ciphertext of the data to be shared; The data to be uploaded to the chain is determined according to the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared.
5. The data sharing method according to claim 4, characterized in that: Before determining the data to be uploaded to the chain according to the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared, the method further includes: Determine the data index of the data to be shared; The determining the data to be uploaded to the chain according to the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared includes: The data to be uploaded to the chain is determined according to the ciphertext of the data to be shared, the feature description information corresponding to the data to be shared, and the data index of the data to be shared.
6. A data sharing method, characterized in that: The second device used to access the blockchain includes: Receiving data to be uploaded sent by the first device, where the data to be uploaded is determined according to the data to be shared by the first device and feature description information corresponding to the data to be shared; Broadcast the data to be uploaded to the blockchain.
7. The data sharing method according to claim 6, characterized in that: Before receiving the to-be-uplinked data sent by the first device, the method further includes: Receiving feature description information corresponding to the data to be shared sent by the first device; comparing the received feature description information with the feature description information stored in the second device; In the event that it is determined that the feature description information stored in the second device does not contain feature description information that is identical to the received feature description information, the received feature description information is broadcast to the blockchain.
8. The data sharing method according to claim 7, characterized in that: After receiving the feature description information corresponding to the to-be-shared data sent by the first device, the method further includes: Calculating a summary of the received feature description information to obtain a first summary; Calculating a summary of the feature description information stored in the second device to obtain a second summary; The comparing the received feature description information with the feature description information stored in the second device includes: The first digest is compared to the second digest.
9. The data sharing method according to any one of claims 6 to 8, characterized in that: The data to be uploaded to the chain is determined according to the ciphertext of the data to be shared and the characteristic description information corresponding to the data to be shared. Before broadcasting the data to be uploaded to the chain to the blockchain, the method further includes: Determine the ciphertext of the data to be shared from the data to be uploaded to the chain; Comparing the ciphertext of the data to be shared with the ciphertext of the data stored in the second device; The step of broadcasting the data to be uploaded to the blockchain includes: In the event that the ciphertext of the stored data does not contain the same ciphertext as the ciphertext of the data to be shared, the data to be uploaded to the chain determined based on the ciphertext of the data to be shared and the feature description information corresponding to the data to be shared will be broadcast to the blockchain.
10. The data sharing method according to claim 9, characterized in that: The data to be uploaded to the chain is determined according to the ciphertext of the data to be shared, the feature description information corresponding to the data to be shared, and the data index of the data to be shared, and when the ciphertext of the stored data does not exist and the ciphertext of the data to be shared does not have the same ciphertext as the ciphertext of the data to be shared, the data to be uploaded to the chain is broadcasted to the blockchain, including: When the ciphertext of the stored data does not have the same ciphertext as the ciphertext of the data to be shared, compare the data index of the data to be shared parsed from the data to be uploaded with the data index of the ciphertext of the data stored in the second device; When the data index of the data to be shared is different from the data index of the ciphertext of the data stored in the second device, the data to be uploaded to the blockchain is broadcasted.
11. A data reading method, characterized in that: Applicable to third-party devices, including: Receiving first shared data sent by a first device; Acquire second shared data shared by the first device on the blockchain; Verify whether the first shared data is equal to the second shared data; if they are equal, store the second shared data.
12. A data sharing device, characterized in that: Applied to a first device, comprising: A feature description information acquisition module, used to acquire the data to be shared and the feature description information corresponding to the data to be shared; A module for determining data to be uploaded, configured to determine the data to be uploaded according to the data to be shared and feature description information corresponding to the data to be shared; The module for sending data to be uploaded to the chain is used to send the data to be uploaded to the chain to the second device, where the second device is a device connected to the blockchain.
13. A data sharing device, characterized in that: The second device used to access the blockchain includes: A to-be-uplinked data receiving module, configured to receive the to-be-uplinked data sent by the first device, wherein the to-be-uplinked data is determined according to the to-be-shared data of the first device and feature description information corresponding to the to-be-shared data; The module for broadcasting data to be uploaded to the chain is used to broadcast the data to be uploaded to the blockchain.
14. A data reading device, characterized in that: Applicable to third-party devices, including: A first shared data acquisition module, used to acquire first shared data sent by a first device; A second shared data acquisition module, used to acquire second shared data shared by the first device on the blockchain; The data verification module is used to verify whether the first shared data is equal to the second shared data, and if they are equal, store the second shared data.
15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented; or, when the processor executes the computer program, the method according to any one of claims 6 to 10 is implemented; or, when the processor executes the computer program, the method according to claim 11 is implemented.
16. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the method according to any one of claims 1 to 5, or the method according to any one of claims 6 to 10, or the method according to claim 11.
