CN114860662A - Data access method, system and storage medium based on IPFS - Google Patents

Data access method, system and storage medium based on IPFS Download PDF

Info

Publication number
CN114860662A
CN114860662A CN202210434647.XA CN202210434647A CN114860662A CN 114860662 A CN114860662 A CN 114860662A CN 202210434647 A CN202210434647 A CN 202210434647A CN 114860662 A CN114860662 A CN 114860662A
Authority
CN
China
Prior art keywords
data
ipfs
hash value
reading
summary information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210434647.XA
Other languages
Chinese (zh)
Inventor
储栋
王心禹
张�荣
赵莉
何亚运
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei Yiwu Yizheng Technology Co ltd
Original Assignee
Hefei Yiwu Yizheng Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hefei Yiwu Yizheng Technology Co ltd filed Critical Hefei Yiwu Yizheng Technology Co ltd
Priority to CN202210434647.XA priority Critical patent/CN114860662A/en
Publication of CN114860662A publication Critical patent/CN114860662A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • G06F16/152File search processing using file content signatures, e.g. hash values
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of block chains, and discloses a data access method, a system and a storage medium based on IPFS (internet protocol file system). The method comprises the steps of executing storage operation and reading operation on data, namely synchronously submitting summary information when uploading the data, storing the data based on the IPFS, generating hash values and data summary information, mapping the hash values and the data summary information one by one and recording the hash values and the data summary information in a block chain intelligent contract, reading target data summary information, retrieving and positioning the target data summary information in the block chain intelligent contract, extracting the mapped hash values, and finishing the reading or downloading operation of the target data based on the hash values.

Description

Data access method, system and storage medium based on IPFS
Technical Field
The invention relates to the technical field of block chains, in particular to a data access method, a data access system and a storage medium based on IPFS.
Background
When a user uploads or uses a File in the ipfs (internet File system), i.e. the interplanetary File system, the addressing is not based on location any more, but based on content. That is, the instruction of "which information to go" is changed to the instruction of "what content to look for". In the internet, an IP address or a domain name is needed for downloading files or browsing information, each file has a hash value in the IPFS, and one hash value only corresponds to one file, so that the problem that one file has a plurality of hash values or a plurality of hash values correspond to the same file does not exist.
However, for a user, the hash value corresponding to a file uploaded by the user or a file stored in the data is not easy to remember, and the user cannot know the hash value when the user wants to query other files on the IPFS data.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a data access method based on IPFS (Internet protocol File System) to solve the problem that the hash value cannot be recorded and stored quickly, effectively and safely in the prior art.
The technical scheme adopted by the invention for solving the technical problems is as follows:
an IPFS-based data access method, comprising the steps of:
executing a storage operation on the data, specifically comprising:
synchronously submitting data summary information when uploading data;
storing the data based on the IPFS, and generating a hash value of the associated storage address;
mapping the hash value and the data summary information one by one and recording the mapping result in a block chain intelligent contract;
executing a read operation on the target data, specifically comprising:
reading target data abstract information, and searching and positioning the target data abstract information in a block chain intelligent contract;
extracting a hash value mapped by target data abstract information in a contract;
and finishing the reading or downloading operation of the target data based on the hash value.
Preferably, the data summary information includes data attribute information, specifically including a data name, a data size, a data format, and a data timestamp.
Preferably, the data distribution is stored in the IPFS, and the hash value corresponding to the data is uniquely determined.
Preferably, the data is stored based on the IPFS, a hash value of the associated storage address is generated after the storage is successful, and otherwise, the storage operation is ended and abnormal information is returned.
Preferably, each node in the IPFS maintains a subset of a distributed hash table, and the distributed hash table employs a distributed key-value pair storage structure.
Preferably, the operation of completing reading or downloading the target data based on the hash value specifically includes:
searching a hash value of a target file in a distributed hash table of a node of the current IPFS, and determining address information of data storage;
and executing reading or downloading operation according to the address information.
Preferably, the searching the hash value of the target file in the distributed hash table of the node of the current IPFS and determining the address information of the data storage further includes:
and if the node of the current IPFS does not execute the searching operation or does not search the hash value of the target file, forwarding the node until the hash value is searched, and forwarding the node back to the initial node by the last node or according to a forwarding path or executing subsequent reading or downloading operation by the optimal selection node based on the query result.
The invention also provides a data access system based on IPFS, which comprises a storage module and a reading module, wherein,
the storage module is configured to perform storage operation on data, and specifically includes synchronously submitting data summary information when uploading data; storing the data based on the IPFS, and generating a hash value of the associated storage address; mapping the hash value and the data summary information one by one and recording the mapping result in a block chain intelligent contract;
the reading module is configured to perform a reading operation on target data, and specifically includes reading target data summary information and retrieving and locating the target data summary information in a block chain intelligent contract; extracting a hash value mapped by target data abstract information in a contract; and finishing the reading or downloading operation of the target data based on the hash value.
The present invention also provides a computer readable storage medium having stored thereon an item secure efficient transaction program, the item secure efficient transaction program being executable by one or more processors to implement the steps of the IPFS based data access method as described above.
Compared with the prior art, the invention has the following beneficial effects:
the invention is designed based on IPFS, solves the complex hash value retrieval method when a user inquires IPFS data, simultaneously avoids the data security problem caused by centralized storage, records the file abstract uploaded by the user and generates corresponding unique hash information through a block chain intelligent contract, and provides the information memorized by a provider to quickly inquire the position of a corresponding data file when the user searches a data module, so as to provide the user with the information to complete corresponding inquiry or downloading, thereby avoiding the data reading failure problem caused by forgetting the hash value, and effectively improving the reliability of the storage and reading process.
Further salient features and significant advances with respect to the present invention over the prior art are described in further detail in the examples section.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
FIG. 1 is a schematic diagram of a storage structure in an IPFS-based data access method according to embodiment 1;
FIG. 2 is a schematic view illustrating a flow of a storage operation in the data access method based on IPFS of embodiment 1;
fig. 3 is a schematic view illustrating a read operation flow in the IPFS-based data access method according to embodiment 1.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that certain names are used throughout the specification and claims to refer to particular components. It will be understood that one of ordinary skill in the art may refer to the same component by different names. The present specification and claims do not intend to distinguish between components that differ in name but not function. As used in the specification and claims of this application, the terms "comprises" and "comprising" are intended to be open-ended terms that should be interpreted as "including, but not limited to," or "including, but not limited to. The embodiments described in the detailed description are preferred embodiments of the present invention and are not intended to limit the scope of the present invention.
Moreover, those skilled in the art will appreciate that aspects of the present invention may be embodied as a system, method or computer program product. Accordingly, various aspects of the present invention may be embodied in a combination of hardware and software, which may be referred to herein generally as a "circuit," module "or" system. Furthermore, in some embodiments, various aspects of the invention may also be embodied in the form of a computer program product in one or more microcontroller-readable media having microcontroller-readable program code embodied therein.
Example 1
The IPFS integrates the existing technology, creates a point-to-point hypermedia protocol, creates a faster, safer and more open next generation internet, and realizes a global file storage system which is permanently available in the internet and can permanently store data. At the same time, the protocol has content addressing, versioning features, attempting to complement and eventually replace the hypertext transfer protocol (i.e., HTTP protocol) that has been accompanied us for more than 20 years. IPFS is a protocol, and is also a P2P network, which is similar to the BT network now, but has more powerful functions, so that IPFS has the potential to replace HTTP, as shown in fig. 1-3, the data access method based on IPFS provided by this embodiment includes the following steps:
executing a storage operation on the data, specifically comprising:
data summary information is submitted synchronously when data is uploaded, the data can also appear in the form of data blocks in the embodiment, the data summary information comprises data attribute information, specifically comprises data name, data size, data format and data time stamp, and of course, other data attribute information can also be adopted, and the data summary information can be selected by a person skilled in the art according to needs without repeated description;
the data are stored based on the IPFS, the hash value of the associated storage address is generated, the data are distributed and stored in the IPFS, and the hash value corresponding to the data is uniquely determined, so that a user only needs to input the hash value of a required file in the IPFS, and the system can generate the corresponding file. These files are stored in a distributed manner, so as long as there is a file corresponding to a user, even if a part of the nodes are disabled or not online, the reading of the file is not affected, and in the present embodiment, data is stored based on the IPFS, and after the storage is successful, a hash value associated with the storage address is generated, otherwise, the storage operation is ended and abnormal information is returned.
Mapping the hash value and the data summary information one by one and recording the mapping result in a block chain intelligent contract;
in this embodiment, each node in the IPFS maintains a subset of a distributed hash table, and the distributed hash table adopts a distributed key-value pair storage structure.
Executing a read operation on the target data, specifically comprising:
reading target data abstract information, and searching and positioning the target data abstract information in a block chain intelligent contract;
extracting a hash value mapped by target data abstract information in a contract;
finishing the reading or downloading operation of the target data based on the hash value, specifically comprising:
searching a hash value of a target file in a distributed hash table of a node of the current IPFS, and determining address information of data storage;
and executing reading or downloading operation according to the address information.
Since the DHT is a distributed key-value pair (DHT) ((DHT))<key,value>) And storing the structure. In an IPFS network, each node maintains a subset of DHTs. When a node receives a data read request, the node either replies directly or through inter-node transmission until a node is found that can reply to the request. For example, if a data read request cannot be replied by a first connected node, forwarding between nodes is performed, the last node contacts the node receiving the request, or forwarding between nodes is performed, and the reply result is forwarded back to the original node according to the same path, or the optimally selected node replies to the request. IPFS uses this strategy and offers advantages over traditional key-value pair storage due to the decentralized of DHTs, particularly: good expansibility, and only needs log at most for hash request with length of n 2 n The solution can be achieved; error tolerance is performed through redundancy, i.e., each node may join or leave the DHT, and in addition, if one node reacts slowly or is unreachable, the request may be connected to other nodes; load balancing, requests can be sent to any node, and no node processes all requests.
Example 2
The embodiment provides a symmetric encryption traceability transaction system based on a blockchain network, which comprises a storage module and a reading module, wherein,
the storage module is configured to perform storage operation on data, and specifically includes synchronously submitting data summary information when uploading data; storing the data based on the IPFS, and generating a hash value of the associated storage address; mapping the hash value and the data summary information one by one and recording the mapping result in a block chain intelligent contract;
the reading module is configured to perform a reading operation on target data, and specifically includes reading target data summary information and retrieving and locating the target data summary information in a block chain intelligent contract; extracting a hash value mapped by target data abstract information in a contract; and finishing the reading or downloading operation of the target data based on the hash value.
Example 3
A computer readable storage medium having stored thereon an item secure efficient transaction program, the item secure efficient transaction program executable by one or more processors to perform the steps of the IPFS-based data access method of embodiment 1.
Those of ordinary skill in the art will appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, and may be located in one place. Or may be distributed over multiple network elements. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
And the aforementioned storage medium includes: a U disk, a mobile hard disk, and a Read-Only Memory (ROM). Various media capable of storing program check codes, such as a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.

Claims (9)

1. A data access method based on IPFS, comprising the steps of:
executing a storage operation on the data, specifically comprising:
synchronously submitting data summary information when uploading data;
storing the data based on the IPFS, and generating a hash value of the associated storage address;
mapping the hash value and the data summary information one by one and recording the mapping result in a block chain intelligent contract;
executing a read operation on the target data, specifically comprising:
reading target data summary information, and retrieving and positioning the target data summary information in a block chain intelligent contract;
extracting a hash value mapped by target data abstract information in a contract;
and finishing the reading or downloading operation of the target data based on the hash value.
2. The IPFS-based data access method according to claim 1, wherein the data summary information comprises data attribute information, specifically comprising a data name, a data size, a data format and a data time stamp.
3. The IPFS-based data access method according to claim 1, wherein the data distribution is stored in the IPFS, and the hash value corresponding to the data is uniquely determined.
4. The IPFS-based data access method according to claim 1, wherein the data is stored based on the IPFS, a hash value of an associated storage address is generated after the storage is successful, and otherwise, the storage operation is ended and exception information is returned.
5. The IPFS-based data access method of claim 1, wherein each node in the IPFS maintains a subset of a DHT, and the DHT employs a distributed key-value pair storage structure.
6. The IPFS-based data access method according to claim 5, wherein the completing the reading or downloading operation of the target data based on the hash value specifically comprises:
searching a hash value of a target file in a distributed hash table of a node of the current IPFS, and determining address information of data storage;
and executing reading or downloading operation according to the address information.
7. The IPFS-based data access method according to claim 6, wherein the searching the DHT of the node of the current IPFS for the hash value of the destination file and determining the address information of the data storage further comprises:
and if the node of the current IPFS does not execute the searching operation or does not search the hash value of the target file, forwarding the node until the hash value is searched, and forwarding the node back to the initial node by the last node or according to a forwarding path or executing subsequent reading or downloading operation by the optimal selection node based on the query result.
8. An IPFS-based data access system is characterized by comprising a storage module and a reading module, wherein,
the storage module is configured to perform storage operation on data, and specifically includes synchronously submitting data summary information when uploading data; storing the data based on the IPFS, and generating a hash value of the associated storage address; mapping the hash value and the data summary information one by one and recording the mapping result in a block chain intelligent contract;
the reading module is configured to perform a reading operation on target data, and specifically includes reading target data summary information and retrieving and locating the target data summary information in a block chain intelligent contract; extracting a hash value mapped by target data abstract information in a contract; and finishing the reading or downloading operation of the target data based on the hash value.
9. A computer readable storage medium having stored thereon an item secure efficient transaction program, the item secure efficient transaction program executable by one or more processors to perform the steps of the IPFS based data access method according to any one of claims 1 to 7.
CN202210434647.XA 2022-04-24 2022-04-24 Data access method, system and storage medium based on IPFS Pending CN114860662A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210434647.XA CN114860662A (en) 2022-04-24 2022-04-24 Data access method, system and storage medium based on IPFS

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210434647.XA CN114860662A (en) 2022-04-24 2022-04-24 Data access method, system and storage medium based on IPFS

Publications (1)

Publication Number Publication Date
CN114860662A true CN114860662A (en) 2022-08-05

Family

ID=82633698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210434647.XA Pending CN114860662A (en) 2022-04-24 2022-04-24 Data access method, system and storage medium based on IPFS

Country Status (1)

Country Link
CN (1) CN114860662A (en)

Similar Documents

Publication Publication Date Title
US10878052B2 (en) Blockchain-based cross-chain data operation method and apparatus
US10958752B2 (en) Providing access to managed content
US11403262B2 (en) Local networked storage linked to remote networked storage system
JP4538454B2 (en) Search for electronic document replicas in computer networks
US8176061B2 (en) Tracking digital assets on a distributed network
EP3776249A1 (en) Blockchain-based cross-chain data access method and apparatus
US9935919B2 (en) Directory partitioned system and method
EP1759312B1 (en) Method and apparatus for loading data into an alternate evaluator for directory operations
US20070106815A1 (en) System and method for routing directory service operations in a directory service network
CN114860662A (en) Data access method, system and storage medium based on IPFS
US9922031B2 (en) System and method for efficient directory performance using non-persistent storage
WO2003052636A2 (en) System and method for processing a request using multiple database units
WO2002084528A1 (en) System and method for searching in a distributed computing environment
CN117112526A (en) Method for realizing distributed file system
CN117407404A (en) Method and device for realizing strong data consistency
CN116627989A (en) Information query method and related device for topic subscription relation
WO2007056766A2 (en) System and method for efficient directory performance using non-persistent storage

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination