A resource sharing method, device, and medium based on blockchain and IPFS

By using blockchain and IPFS technologies, data fragments are split and compared to remove duplicate data, solving the problem of duplicate data in resource-sharing systems, improving storage efficiency and security, and facilitating user access.

CN114490598BActive Publication Date: 2026-01-30浪潮工业互联网股份有限公司
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111612353.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2026-01-30
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

In resource-sharing systems, users generate a large amount of duplicate data when sharing, which increases storage costs and hinders content retrieval.

Method used

By using blockchain and IPFS technologies, the data to be shared and the data already stored are split, fragment feature identifiers are compared, duplicate fragments are removed, and the deduplicated data is stored in a distributed database, while only the code and address are stored on the blockchain.

Benefits of technology

It reduces duplicate uploads, lowers storage costs, improves storage efficiency, and ensures data security through the immutability of blockchain, making it easy for users to view and locate data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490598B_ABST
    Figure CN114490598B_ABST
Patent Text Reader

Abstract

This specification discloses a resource sharing method, device, and medium based on blockchain and IPFS. The method includes: identifying stored data of the same type as the data to be shared in a data sharing system; splitting the data to be shared and the stored data to determine multiple corresponding data fragments; identifying overlapping fragments between the multiple data fragments of the data to be shared and the multiple data fragments of the stored data; removing overlapping fragments from the multiple data fragments of the data to be shared; storing the deduplicated shared data in the distributed database IPFS of the data sharing system to generate a unique data code and data storage address corresponding to the shared data; and storing the data code and data storage address in the blockchain to retrieve the shared data content through the data code and data storage address, thereby realizing data sharing.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present specification relates to the technical field of blockchains, and in particular to a resource sharing method and device based on a blockchain and IPFS, and a medium. BACKGROUND

[0002] With the advent of the network sharing era, in order to provide learning efficiency, more and more social groups will share resources, such as learning materials, to the network so that internal or external personnel can learn and use them.

[0003] When people share their own resources, users belonging to the same social group may have repeated shared content, which leads to repeated shared resources being uploaded to the sharing system, resulting in a large amount of repeated data in the sharing system, increasing storage costs and being not conducive to user content retrieval. SUMMARY

[0004] One or more embodiments of the present specification provide a resource sharing method and device based on a blockchain and IPFS, and a medium, to solve the technical problem that repeated shared data occurs when users share resources, resulting in a large amount of repeated data in the sharing system, increasing storage costs.

[0005] One or more embodiments of the present specification adopt the following technical solutions:

[0006] One or more embodiments of the present specification provide a resource sharing method based on a blockchain and IPFS, the method comprising: obtaining data to be shared, and determining the type of the data to be shared; determining stored data of the same type as the data to be shared in the resource sharing system; splitting the data to be shared and the stored data according to a pre-set rule, and determining a plurality of corresponding data segments; comparing the plurality of data segments of the data to be shared with the plurality of data segments of the stored data, and determining overlapping segments that are the same in the plurality of data segments of the data to be shared and the plurality of data segments of the stored data; removing the overlapping segments from the plurality of data segments of the data to be shared to generate shared data; storing the deduplicated shared data in a distributed database IPFS of the resource sharing system, so as to generate a unique data code and a data storage address corresponding to the shared data according to the shared data; storing the data code and the data storage address in a blockchain of the resource sharing system, so that a user to be viewed can obtain shared data content through the data code and the data storage address, and realize data sharing.

[0007] Further, the comparing the plurality of data segments of the to-be-shared data with the plurality of data segments of the stored data to determine the coincident segments of the plurality of data segments of the to-be-shared data and the plurality of data segments of the stored data comprises: extracting a plurality of field features of each specified data segment of the plurality of data segments of the to-be-shared data, generating a corresponding specified feature identifier according to the plurality of field features, and determining the specified feature identifier corresponding to each of the plurality of data segments of the to-be-shared data; generating a specified feature identifier library according to the plurality of specified feature identifiers, wherein the specified feature identifier library includes the plurality of specified feature identifiers and the specified data segment corresponding to each specified feature identifier; extracting a plurality of field features of each current data segment of the plurality of data segments of the stored data, generating a corresponding current feature identifier according to the plurality of field features, and determining the current feature identifier corresponding to each of the plurality of current data; calculating the matching degree of each current feature identifier and each specified feature identifier, determining that the current feature identifier and the specified feature identifier are the same when the matching degree exceeds a preset threshold; determining the repeated feature identifier of the current feature identifier and the specified feature identifier according to the matching degree of each current feature identifier and each specified feature identifier; and determining the coincident segments of the plurality of data segments of the to-be-shared data and the plurality of data segments of the stored data according to the repeated feature identifier.

[0008] Further, the data code is used to represent the summary information of the shared data, and the data storage address is used to represent the address information of the shared data in the distributed database IPFS; and the obtaining the shared data according to the data code and the data storage address comprises: generating a query table of the plurality of shared data according to the plurality of data codes and the storage addresses corresponding to the plurality of shared data of a plurality of sharing users; obtaining a data viewing request of the to-be-viewed user, wherein the data viewing request includes summary information of to-be-viewed data; screening out, in the query table, a data code matched with the summary information in the data viewing request according to the summary information in the data viewing request; determining the shared data to be viewed according to the data code; and locating the position of the shared data to be viewed in the distributed database IPFS through the data storage address corresponding to the data code in the query table.

[0009] Further, when the to-be-shared material data is personal scientific research data, the generating of the unique material code and the material storage address corresponding to the shared material data according to the shared material data specifically comprises: presetting a plurality of distribution information according to the to-be-shared material data, wherein the distribution information includes the applicable objects corresponding to a plurality of data in the to-be-shared material data; dividing the shared material data into a plurality of sub-data, and setting the organization identifier of the applicable objects for the plurality of sub-data according to the distribution information; generating the unique material code corresponding to the shared material data according to the plurality of sub-data; storing the sub-data with the same organization identifier in the distributed database IPFS with the same address, generating a plurality of sub-data addresses corresponding to the plurality of sub-data, and taking the plurality of sub-data addresses as the material storage addresses.

[0010] Further, the to-be-viewed user acquires the shared material data through the material code and the material storage address, specifically comprising: receiving a material viewing request of a to-be-viewed user, the material viewing request including organization information of the to-be-viewed user and to-be-viewed material data, the organization information being used to indicate the organization and organization level to which the to-be-viewed user belongs; determining the viewing authority of the to-be-viewed user according to the organization information of the to-be-viewed user; determining a plurality of specified sub-data within the viewing authority in the shared material data according to the viewing authority of the to-be-viewed user; matching the organization identifier of the plurality of specified sub-data with the organization information of the to-be-viewed user, and determining the specified shared material data shared with the to-be-viewed user according to the matching result.

[0011] Further, the generating of the query table of the plurality of shared materials according to the plurality of shared materials corresponding to the plurality of shared materials specifically comprises: storing the viewing history of the plurality of shared materials in the smart contract, and generating the viewing frequency of each shared material; sorting the plurality of shared materials according to the viewing frequency to determine the order of the plurality of shared materials; placing the material code and the storage address corresponding to the shared material at the corresponding position of the shared material according to the order of the plurality of shared materials, and generating the query table of the plurality of shared materials.

[0012] Further, the extracting the field features of each specified data segment in the plurality of data segments of the to-be-shared material data specifically comprises: dividing the each specified data segment into a plurality of sentence sets, performing word segmentation processing on the sentences in the sentence sets to obtain a plurality of segmented words with actual meaning; inputting the plurality of segmented words with actual meaning into a pre-trained feature extraction model to obtain segmented word features corresponding to the plurality of segmented words; setting a weight for each segmented word feature according to the occurrence frequency and occurrence position of the segmented word in the sentence set; and determining a plurality of field features in the sentence set according to the weight of each segmented word feature.

[0013] Further, the blockchain is a consortium chain, and the blockchain includes a plurality of blockchain nodes; the blockchain nodes include a plurality of sharing nodes corresponding to a plurality of to-be-shared users respectively and a management node corresponding to the resource sharing system.

[0014] One or more embodiments of the present specification provide a resource sharing device based on a blockchain and an IPFS, comprising:

[0015] at least one processor; and

[0016] a memory in communication connection with the at least one processor; wherein

[0017] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:

[0018] obtain to-be-shared material data and determine the type of the to-be-shared material data; determine stored material data of the same type as the to-be-shared material data in the material sharing system; split the to-be-shared material data and the stored material data according to a pre-set rule to respectively determine a plurality of corresponding data segments; compare the plurality of data segments of the to-be-shared material data with the plurality of data segments of the stored material data to determine overlapping segments that are the same as the plurality of data segments of the to-be-shared material data and the plurality of data segments of the stored material data; remove the overlapping segments from the plurality of data segments of the to-be-shared material data to generate shared material data; store the de-duplicated shared material data in a distributed database IPFS of the material sharing system, so as to generate a unique material code and a material storage address corresponding to the shared material data according to the shared material data; and store the material code and the material storage address in a blockchain of the material sharing system, so that a to-be-viewed user can obtain shared material data content through the material code and the material storage address, and realize material sharing.

[0019] The one or more embodiments of the specification provide a non-volatile computer storage medium storing computer executable instructions configured to:

[0020] Obtain to-be-shared material data, determine a type of the to-be-shared material data, determine stored material data of the same type as the to-be-shared material data in the material sharing system, split the to-be-shared material data and the stored material data according to a preset rule, respectively determine a plurality of material segments corresponding to the to-be-shared material data and the stored material data, compare the plurality of material segments of the to-be-shared material data with the plurality of material segments of the stored material data, determine overlapping segments of the plurality of material segments of the to-be-shared material data and the plurality of material segments of the stored material data, remove the overlapping segments from the plurality of material segments of the to-be-shared material data to generate shared material data, store the deduplicated shared material data in a distributed database IPFS of the material sharing system, so as to generate a unique material code and a material storage address corresponding to the shared material data according to the shared material data, store the material code and the material storage address in a blockchain of the material sharing system, so that a user to be viewed can obtain shared material data content through the material code and the material storage address, and realize material sharing.

[0021] The above at least one technical solution adopted by the embodiments of the specification can achieve the following beneficial effects:

[0022] By splitting the to-be-shared material data and the stored material data, and comparing the split segments, the repeated segments are determined, the repeated segments are removed from the to-be-shared material data, and the repeated uploading of the material data is avoided. In addition, the storage efficiency of the blockchain is improved by using the on-chain and off-chain hybrid storage mode, the shared material data is stored in the distributed database IPFS in the off-chain storage, and the material code and the material storage address corresponding to the shared material data are stored on the blockchain, the security of the shared material is ensured by using the tamper-proof feature of the blockchain, and in addition, only the material code and the material storage address of the shared material data are stored on the blockchain, the storage pressure is reduced, and the user can view and locate the shared material data. BRIEF DESCRIPTION OF DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the specification or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments described in the specification, and those skilled in the art can also obtain other drawings according to these drawings without creative labor. In the drawings:

[0024] Figure 1 A flowchart of a resource sharing method based on a blockchain and an IPFS provided by an embodiment of the present specification is shown in the following figure:

[0025] Figure 2 A structural diagram of a resource sharing device based on a blockchain and an IPFS provided by an embodiment of the present specification is shown in the following figure. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the technical solutions in the present specification, the technical solutions in the present specification will be described clearly and completely in the following with reference to the drawings in the embodiments of the present specification. Obviously, the described embodiments are only part of the embodiments of the present specification, rather than all the embodiments. Based on the embodiments of the present specification, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present specification.

[0027] With the advent of the network sharing era, in order to provide learning efficiency, more and more social groups will share resources, such as learning materials, to the network so as to facilitate internal personnel or external personnel to learn and use. When people share their own resources, users belonging to the same social group may have repeated shared content, and in addition, there may be a situation that the content to be uploaded is repeated with the shared content stored in the sharing system. This results in repeated shared resources being uploaded to the sharing system, which causes a large amount of repeated data in the sharing system, increases the storage cost, and is not conducive to the user's retrieval of the content.

[0028] The embodiments of the present specification provide a resource sharing method based on a blockchain and an IPFS, which is applied to a pre-stored resource sharing system. The blockchain is a consortium chain, and the blockchain includes a plurality of blockchain nodes. The blockchain nodes are composed of a plurality of sharing nodes corresponding to a plurality of users to be shared and a management node corresponding to the resource sharing system. It should be noted that the execution subject of the embodiments of the present specification can be a sharing device or a server, which is not specifically limited here. Figure 1 A flowchart of a resource sharing method based on a blockchain and an IPFS provided by an embodiment of the present specification is shown in the following figure: Figure 1 As shown in the figure, the method mainly includes the following steps:

[0029] Step S101, obtaining data to be shared, and determining the type of data to be shared.

[0030] In an actual application scenario, when a user performs resource sharing, the user uploads to-be-shared material data through a resource sharing system. Due to different resources to be shared by the user, the material data can be in different data forms. For example, the resource to be shared by the user can be video data or picture data, and when the user is a student or a scientific researcher, the resource to be shared can be learning material data.

[0031] In an embodiment of the present specification, according to the shared resource uploaded by the user, the to-be-shared material data is obtained, and the data type of the to-be-shared material data is determined. Taking learning material data as an example, the data type here can refer to the subject type corresponding to the learning material, such as Chinese material, mathematics material, and English material, etc. If the to-be-shared material data is video data, such as a movie, the data type here can be classified according to the name of the movie. If the to-be-shared material data is scientific research data, it can be classified according to the research direction.

[0032] In an embodiment of the present specification, the data type of the to-be-shared material data can be determined by a neural network model. The material data is input into the trained neural network model, and the data type is determined by the neural network model. Alternatively, a user upload interface can be set, and the user selects a type option in the upload interface according to the type of the to-be-shared material data. The present specification does not make specific limitations here.

[0033] Step S102, determining stored material data of the same type as the to-be-shared material data in the material sharing system.

[0034] When the user uploads shared material in the material sharing system, there are shared materials uploaded by other users in the material sharing system. There are many shared materials stored in the material sharing system, and it is difficult to obtain the same material as the to-be-shared shared resource directly from all the shared materials. Different types of material data have different contents, such as mathematics material and Chinese material, which are different material data. Generally, there is no overlapping data in the two.

[0035] In order to narrow the comparison range and reduce the work burden of the system, in an embodiment of the present specification, stored material data of the same type as the to-be-shared material data is determined in the sharing system. Type identifiers can be set for material data respectively, and material data with consistent type identifiers are regarded as material data of the same type.

[0036] Step S103, according to a pre-set rule, the to-be-shared material data and the stored material data are split to determine a plurality of corresponding material segments respectively.

[0037] After determining that the stored data data belongs to the same type as the data data to be shared, the data data to be shared is split to determine a plurality of data segments of the data data to be shared, which can be referred to as current data segments. The stored data data is split to determine a plurality of data segments corresponding to the stored data data, which can be referred to as specified data segments.

[0038] It should be noted that different splitting rules can be set according to different data data during splitting. For example, when the data data is a paper data, the paper can be split into multiple parts according to the structure framework of the paper, for example, the content of the abstract is taken as a data segment, the content of the research background is taken as a data segment, and the research content is taken as a data segment. When the data data is a picture, the picture can be split according to the image features in the picture, and the image is divided into a person feature segment and a still feature segment. The present specification is only exemplary.

[0039] Step S104, comparing the plurality of data segments of the data data to be shared with the plurality of data segments of the stored data data to determine the coincident segments of the plurality of data segments of the data data to be shared that are the same as the plurality of data segments of the stored data data.

[0040] In an embodiment of the present specification, the comparison of the plurality of data segments of the data data to be shared with the plurality of data segments of the stored data data can be achieved by extracting data segment features. Specifically, a plurality of field features of each specified data segment in the plurality of data segments of the data data to be shared are extracted. Each specified data segment is divided into a plurality of sentence sets, and the sentences in the sentence sets are processed by word segmentation to obtain a plurality of words with actual meaning. It should be noted that the words with actual meaning here refer to words with actual meaning such as nouns other than conjunctions, transition words, and the like.

[0041] In an embodiment of the present specification, the plurality of words with actual meaning are input into a pre-trained feature extraction model to obtain word features corresponding to the plurality of words. The weight of each word feature is set according to the frequency and position of the word in the sentence set. The more the number of occurrences, the greater the weight. The weight of the word at different positions is set according to the structure of the sentence, for example, the weight of the subject is higher than that of the object, and the weight of the object is higher than that of the predicate. The plurality of field features in the sentence set are determined according to the weight of each word feature, so as to generate a specified feature identifier corresponding to each data segment according to the plurality of field features. By the above method, a plurality of specified feature identifiers corresponding to a plurality of data segments are obtained, and a specified feature identifier library is generated according to the plurality of specified feature identifiers, wherein the specified feature identifier library includes a plurality of specified feature identifiers and a specified data segment corresponding to each specified feature identifier.

[0042] extracting a plurality of field features of each current data segment in the plurality of data segments of the stored data, generating a corresponding current feature identifier according to the plurality of field features, and determining a plurality of current feature identifiers corresponding to the plurality of current data segments respectively. It should be noted that the method of generating the current feature identifier can be performed according to the method of generating the specified feature identifier, or other methods can be used.

[0043] calculating the matching degree of each current feature identifier and each specified feature identifier. Here, for the convenience of operation, the matching degree can be obtained by judging whether the current feature identifier is consistent with each specified feature identifier. When they are consistent, the matching degree is 100%, and when they are not consistent, the matching degree is 0. The matching degree can also be calculated by other methods. When the matching degree exceeds a preset threshold, it is determined that the current feature identifier and the specified feature identifier are the same, and the threshold can be set according to the actual situation. According to the matching degree of each current feature identifier and each specified feature identifier, the repeated feature identifier that the current feature identifier and the specified feature identifier are the same is determined, so as to determine the overlapping segment of the plurality of data segments of the data to be shared and the plurality of data segments of the stored data according to the repeated feature identifier.

[0044] Step S105, removing the overlapping segment in the plurality of data segments of the data to be shared to generate shared data.

[0045] In an embodiment of the present specification, the overlapping segment is removed in the plurality of data segments of the data to be shared, for example, the data to be shared can include segment A, segment B, segment C, and the stored data can include segment A, segment D, segment E. The overlapping segment of the two is segment A, and then segment A is removed in the data to be shared to generate shared data composed of segment B and segment C.

[0046] Step S106, storing the deduplicated shared data into the distributed database IPFS of the data sharing system, so as to generate the unique data code and the data storage address corresponding to the shared data according to the shared data.

[0047] In an embodiment of the present specification, the deduplicated shared data is stored in the distributed database IPFS of the data sharing system, ensuring the uniqueness of the uploaded shared data, avoiding the duplication of the uploaded shared data and the stored shared data. In addition, the deduplicated shared data is uploaded to the distributed database IPFS, reducing the storage burden of the blockchain. After storing the deduplicated shared data in the distributed database IPFS of the data sharing system, a unique data code and a data storage address corresponding to the shared data are generated according to the shared data. The unique data code is used to identify the digest information of the shared data, which can be in the form of a string, a bar code, a two-dimensional code, or other forms, which are not limited herein. The data storage address is the location of the shared data in the distributed database IPFS. Through the data storage address, the shared resource data can be located in the distributed database IPFS.

[0048] Personal scientific research data refers to the research data generated by a scientific researcher or a scientific research team through scientific research activities. The sharing of such research data is the fundamental way to realize the potential value of scientific data, which is conducive to the development of scientific research. In the sharing of personal scientific research data, attention should be paid to the willingness of the data developer, and the scope of disclosure should also be determined by the scientific researcher. For example, in the scientific research projects of colleges and universities, the content shared by users in the same research group is relatively more, but for other research groups or external organizations, the scientific research data of the scientific researcher should be avoided to be disclosed before the scientific research data is published as a paper. Therefore, attention should also be paid to the applicable object of sharing when sharing personal scientific research data.

[0049] Specifically, when the shared data is personal scientific research data, a unique data code and a data storage address corresponding to the shared data are generated according to the shared data, which specifically includes: according to the shared data, a plurality of allocation information is preset, wherein the allocation information includes a plurality of data respectively corresponding to the applicable object in the shared data; the shared data is divided into a plurality of sub-data, and the organization identifier of the applicable object is set for the plurality of sub-data according to the allocation information; a unique data code corresponding to the shared data is generated according to the plurality of sub-data; the sub-data with the same organization identifier in the plurality of sub-data is stored in the distributed database IPFS with the same address, and a plurality of sub-data addresses corresponding to the plurality of sub-data are generated, which are used as the data storage address.

[0050] In an embodiment of the present disclosure, if the data to be shared is personal research data, a plurality of distribution information is preset according to the sharing intention of the researcher. For example, the personal research data includes research contents of A, B and C, wherein the research content of A is to be shared within the research group, the research content of B is to be shared with all research groups in the school, and the research content of C is to be shared with an organization outside the school. The distribution information includes that the applicable object of the research content of A is the users in the research group, the applicable object of the research content of B is the users of all research groups in the school, and the applicable object of the research content of C is the users of the organization outside the school. The shared data is divided into a plurality of sub-data, for example, the research content of A is the first sub-data, the research content of B is the second sub-data, and the research content of C is the third sub-data.

[0051] The organization identifier of the applicable object is set for each sub-data. The organization identifier a corresponding to the research group is set for the first sub-data, the organization identifier b corresponding to all research groups in the school is set for the second sub-data, and the organization identifier c corresponding to the organization outside the school is set for the third sub-data. A unique data code corresponding to the entire shared data is generated according to the plurality of sub-data. The unique data code is used to represent the abstract information of the shared data. The abstract information of the shared data can be obtained according to the abstract information corresponding to the plurality of sub-data. The abstract information is converted into a code form. The data code can be a string, a two-dimensional code, a bar code, etc. The embodiments of the present disclosure do not make specific limitations here.

[0052] The sub-data with the same organization identifier in the plurality of sub-data is stored in the same address of the distributed database IPFS. A plurality of sub-data addresses corresponding to the plurality of sub-data are generated. The plurality of sub-data addresses are used as the data storage address. For example, there is a fourth sub-data, and the applicable object of the fourth sub-data is other research groups in the school. The first sub-data and the fourth sub-data can be stored in the same position of the distributed database IPFS, and the first storage address is generated according to the storage position. The second sub-data is stored in another position of the distributed database IPFS, and the second storage address is generated. The third sub-data is stored in the remaining position of the distributed database IPFS, and the third storage address is generated. The first storage address, the second storage address and the third storage address are used as the data storage address of the personal research data.

[0053] By classifying the personal research data according to the applicable object, the intention of the sharer is fully considered, and appropriate sharing is realized. The complete disclosure of the specified data is ensured, and the disclosure within the scope of the private data is ensured.

[0054] In step S107, the data code and the data storage address are stored in the blockchain of the data sharing system, so that the user to be viewed can obtain the shared data content through the data code and the data storage address, and the data sharing is realized.

[0055] In an embodiment of the present specification, the data code is used to represent the summary information of the shared data, and the summary of the shared data can be viewed through the data code, so that the user can determine whether the shared data is the data needed by himself according to the summary of the shared data. The data storage address is used to represent the address information of the shared data in the distributed database IPFS, and through the data storage address, the location of the shared data in the distributed database IPFS can be located.

[0056] When the data to be viewed by the user to be viewed is personal research data, the sub-data in the shared data that can be viewed needs to be determined according to the organization identifier of the user to be viewed.

[0057] Specifically, the user to be viewed obtains the shared data through the data code and the data storage address, specifically including: receiving a data viewing request of the user to be viewed, the data viewing request including organization information of the user to be viewed and data to be viewed, the organization information being used to represent the organization institution and organization level to which the user to be viewed belongs; determining the viewing authority of the user to be viewed according to the organization information of the user to be viewed; determining a plurality of specified sub-data within the viewing authority in the shared data according to the viewing authority of the user to be viewed; matching the organization identifier corresponding to the plurality of specified sub-data with the organization information of the user to be viewed, and determining the specified shared data to be viewed by the user to be viewed according to the matching result.

[0058] In an embodiment of the present specification, when the user to be viewed needs to query personal research data, a data viewing request is sent, and the viewing request includes the organization information of the user to be viewed and the data to be viewed. For example, the organization institution of the user to be viewed is A college, and the organization level is A project group, so the organization information of the user to be viewed is A project group of A college, and the data to be viewed is personal research data. According to the organization information of the user to be viewed, the viewing authority of the user is determined, and the specified sub-data within the viewing authority in the plurality of stored data is screened. In order to ensure the accuracy of the screening, the organization identifier in the specified sub-data and the organization information of the user are matched, and if the matching is passed, the specified sub-data is determined as the specified shared resource data that can be viewed by the user.

[0059] When the user to be viewed views the shared data, there can be a plurality of shared data in the sharing system. In view of this situation, in order to facilitate the user to view, the plurality of shared data can be organized in the form of a query table.

[0060] In an embodiment of the present specification, the viewing history of the plurality of shared materials is stored in the smart contract, and the viewing frequency of each shared material is generated, for example, A material is viewed 200 times, B material is viewed 50 times, and C material is viewed 1 time. The plurality of shared materials are sorted according to the viewing frequency, and the order of the plurality of shared materials is determined. That is, the order of the plurality of shared materials is A material, B material, and C material. According to the order of the plurality of shared materials, the material code and the storage address corresponding to the shared material are placed in the corresponding position of the shared material, and the query table of the plurality of shared materials is generated, as shown in the following table.

[0061] A data A code A address B data B code B address C data C code C address

[0062] In an embodiment of the present specification, a material viewing request of a to-be-viewed user is obtained, wherein the material viewing request includes abstract information of a to-be-viewed material. According to the abstract information in the material viewing request, the material code matching the abstract information in the material viewing request is screened out in the query table. According to the material code, the shared material to be viewed is determined. Through the material storage address corresponding to the material code in the query table, the position of the shared material to be viewed in the distributed database IPFS is located. That is, according to the abstract information in the material viewing request, it is judged that the abstract information corresponding to the A code in the A code, the B code and the C code is the same as the abstract information in the material viewing request, and the abstract information in the material request information can also be converted into the material code. Compared with the existing code, the corresponding material code is determined in order to further determine the shared material according to the material code. After obtaining the corresponding material code, the position of the shared material to be viewed in the distributed database IPFS is located according to the material storage address corresponding to the material code in the query table.

[0063] By splitting the to-be-shared material data and the stored material data, and comparing the split segments, the repeated segments are determined and removed from the to-be-shared material data, avoiding the repeated uploading of material data. In addition, the storage efficiency of the blockchain is improved by using the on-chain and off-chain hybrid storage method. The distributed database IPFS is used for storing the shared material data in the off-chain storage, and the material code and the material storage address corresponding to the shared material are stored on the blockchain. The security of the shared material is ensured by using the tamper-proof feature of the blockchain. In addition, only the material code and the material storage address of the shared material data are stored on the blockchain, which reduces the storage pressure and facilitates the user to view and locate the shared material data.

[0064] The embodiment of the present specification also provides a resource sharing device based on a blockchain and IPFS, as shown in Figure 2 The device includes:

[0065] at least one processor; and,

[0066] a memory in communication connection with the at least one processor; wherein

[0067] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:

[0068] Obtain the to-be-shared material data, and determine the type of the to-be-shared material data; determine the stored material data of the same type as the to-be-shared material data in the material sharing system; split the to-be-shared material data and the stored material data according to a preset rule, and respectively determine a plurality of corresponding material segments; compare the plurality of material segments of the to-be-shared material data with the plurality of material segments of the stored material data, and determine the coincident segments of the plurality of material segments of the to-be-shared material data and the plurality of material segments of the stored material data; remove the coincident segments from the plurality of material segments of the to-be-shared material data to generate shared material data; store the deduplicated shared material data into a distributed database IPFS of the material sharing system, so as to generate a unique material code and a material storage address corresponding to the shared material data according to the shared material data; and store the material code and the material storage address in a blockchain of the material sharing system, so that a to-be-viewed user can obtain the content of the shared material data through the material code and the material storage address, and realize material sharing.

[0069] One or more embodiments of the present specification provide a non-volatile computer storage medium, which stores computer executable instructions, and the computer executable instructions are set to:

[0070] Obtain the to-be-shared material data, and determine the type of the to-be-shared material data; determine the stored material data of the same type as the to-be-shared material data in the material sharing system; split the to-be-shared material data and the stored material data according to a preset rule, and respectively determine a plurality of corresponding material segments; compare the plurality of material segments of the to-be-shared material data with the plurality of material segments of the stored material data, and determine the coincident segments of the plurality of material segments of the to-be-shared material data and the plurality of material segments of the stored material data; remove the coincident segments from the plurality of material segments of the to-be-shared material data to generate shared material data; store the deduplicated shared material data into a distributed database IPFS of the material sharing system, so as to generate a unique material code and a material storage address corresponding to the shared material data according to the shared material data; and store the material code and the material storage address in a blockchain of the material sharing system, so that a to-be-viewed user can obtain the content of the shared material data through the material code and the material storage address, and realize material sharing.

[0071] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and non-volatile computer storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0072] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0073] The above description is merely one or more embodiments of this specification and is not intended to limit this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of one or more embodiments of this specification should be included within the scope of the claims of this specification.

Claims

1. A resource sharing method based on blockchain and IPFS, applied to a pre-stored resource sharing system, characterized in that, The method comprises: obtaining to-be-shared material data and determining the type of the to-be-shared material data; determining stored material data of the same type as the to-be-shared material data in the resource sharing system; splitting the to-be-shared material data and the stored material data according to a preset rule to respectively determine a plurality of material segments corresponding to the to-be-shared material data and the stored material data; comparing the plurality of material segments of the to-be-shared material data with the plurality of material segments of the stored material data to determine overlapping segments that are the same as the plurality of material segments of the to-be-shared material data and the plurality of material segments of the stored material data; removing the overlapping segments from the plurality of material segments of the to-be-shared material data to generate shared material data; storing the deduplicated shared material data in a distributed database IPFS of the resource sharing system, so as to generate a unique material code and a material storage address corresponding to the shared material data according to the shared material data; storing the material code and the material storage address in a blockchain of the resource sharing system, so that a to-be-viewed user can obtain shared material data content through the material code and the material storage address, and realize material sharing; when the to-be-shared material data is personal scientific research data, the generation of the unique material code and the material storage address corresponding to the shared material data according to the shared material data specifically comprises: presetting a plurality of distribution information according to the to-be-shared material data, wherein the distribution information includes applicable objects corresponding to a plurality of data in the to-be-shared material data; dividing the shared material data into a plurality of sub-data, and setting organization identifiers of applicable objects for the plurality of sub-data according to the distribution information; generating a unique material code corresponding to the shared material data according to the plurality of sub-data; storing sub-data with the same organization identifier in the plurality of sub-data in the distributed database IPFS of the same address to generate a plurality of sub-data addresses corresponding to the plurality of sub-data, and taking the plurality of sub-data addresses as material storage addresses; the to-be-viewed user obtaining shared material data through the material code and the material storage address specifically comprises: receiving a material viewing request of a to-be-viewed user, the material viewing request including organization information of the to-be-viewed user and to-be-viewed material data, and the organization information being used to indicate an organization and an organization level to which the to-be-viewed user belongs; determining the viewing authority of the to-be-viewed user according to the organization information of the to-be-viewed user; determining a plurality of specified sub-data within the viewing authority in the shared material data according to the viewing authority of the to-be-viewed user; The organization identifier corresponding to the plurality of specified sub-data is matched with the organization information of the user to be viewed, and the specified shared profile data shared by the user to be viewed is determined according to the matching result; the plurality of profile segments of the shared profile data to be shared are compared with the plurality of profile segments of the stored profile data, and the coincident segments of the plurality of profile segments of the shared profile data to be shared and the plurality of profile segments of the stored profile data are determined, specifically comprising: Extracting a plurality of field features of each specified profile segment in the plurality of profile segments of the shared profile data to be shared, generating a corresponding specified feature identifier according to the plurality of field features, and determining the specified feature identifier corresponding to each of the plurality of profile segments of the shared profile data to be shared; According to the plurality of specified feature identifiers, a specified feature identifier library is generated, wherein the specified feature identifier library includes the plurality of specified feature identifiers, and each specified feature identifier corresponds to a specified profile segment; Extracting a plurality of field features of each current profile segment in the plurality of profile segments of the stored profile data, generating a corresponding current feature identifier according to the plurality of field features, and determining the current feature identifier corresponding to each of the plurality of current profile data; Calculating the matching degree of each current feature identifier and each specified feature identifier, and determining that the current feature identifier and the specified feature identifier are the same when the matching degree exceeds a preset threshold; According to the matching degree of each current feature identifier and each specified feature identifier, the repeated feature identifier of the current feature identifier and the specified feature identifier is determined; According to the repeated feature identifier, the coincident segments of the plurality of profile segments of the shared profile data to be shared and the plurality of profile segments of the stored profile data are determined; the profile encoding is used to represent the abstract information of the shared profile, and the profile storage address is used to represent the address information of the shared profile in the distributed database IPFS; The shared profile data is obtained through the profile encoding and the profile storage address, specifically comprising: According to the plurality of shared profiles corresponding to the plurality of sharing users, the profile encoding and the storage address corresponding to the plurality of shared profiles are used to generate a query table of the plurality of shared profiles; Obtaining a profile viewing request of the user to be viewed, wherein the profile viewing request includes abstract information of the profile to be viewed; According to the abstract information in the profile viewing request, the profile encoding matched with the abstract information in the profile viewing request is screened out in the query table; According to the profile encoding, the shared profile to be viewed is determined; The position of the shared profile to be viewed in the distributed database IPFS is located through the profile storage address corresponding to the profile encoding in the query table; according to the plurality of shared profiles corresponding to the plurality of sharing users, the profile encoding and the storage address corresponding to the plurality of shared profiles are used to generate a query table of the plurality of shared profiles, specifically comprising: The viewing history of the plurality of shared profiles is stored in the smart contract, and the viewing frequency of each shared profile is generated; According to the viewing frequency, the plurality of shared materials are sorted to determine the order of the plurality of shared materials; According to the order of the plurality of shared materials, the material code and storage address of the corresponding shared material are placed at the corresponding position of the shared material to generate a query table of the plurality of shared materials; the extracting of the plurality of field features of each specified data segment of the data data to be shared, specifically includes: Divide each specified data segment into a plurality of sentence sets, and perform word segmentation processing on the sentences in the sentence set to obtain a plurality of segmented words with actual meaning; Input the plurality of segmented words with actual meaning into a pre-trained feature extraction model to obtain segmented word features corresponding to the plurality of segmented words; According to the frequency and position of the plurality of segmented words in the sentence set, a weight is set for each segmented word feature; According to the weight of each segmented word feature, a plurality of field features in the sentence set are determined. 2.The resource sharing method based on blockchain and IPFS according to claim 1, characterized in that, The blockchain is a consortium chain, and the blockchain includes a plurality of blockchain nodes; The blockchain node includes a plurality of sharing nodes corresponding to a plurality of users to be shared and a management node corresponding to the resource sharing system.

3. A resource sharing device based on blockchain and IPFS, characterized in that, The device includes: At least one processor; and The memory is in communication connection with the at least one processor; wherein The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1-2.

4. A non-volatile computer storage medium, storing computer executable instructions, the computer executable instructions are configured to execute the method of any one of claims 1-2.

Citation Information

Patent Citations

  • Data sharing method and device based on block chain, computer equipment and storage medium

    CN110868424A

  • Resource sharing method and device based on block chain

    CN112328565A

  • Secure sharing method and system for cultural relic digital resources, and information data processing terminal

    CN113127811A

  • Distributed data storage method and system based on block chain

    CN113360501A