CN113259494A - File storage method and device, electronic equipment and storage medium - Google Patents

File storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113259494A
CN113259494A CN202110783409.5A CN202110783409A CN113259494A CN 113259494 A CN113259494 A CN 113259494A CN 202110783409 A CN202110783409 A CN 202110783409A CN 113259494 A CN113259494 A CN 113259494A
Authority
CN
China
Prior art keywords
file
node
hash value
terminal
uploaded
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.)
Granted
Application number
CN202110783409.5A
Other languages
Chinese (zh)
Other versions
CN113259494B (en
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.)
Shenzhen Huahai Tongchuang Technology Co ltd
Original Assignee
Shenzhen Huahai Tongchuang 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 Shenzhen Huahai Tongchuang Technology Co ltd filed Critical Shenzhen Huahai Tongchuang Technology Co ltd
Priority to CN202110783409.5A priority Critical patent/CN113259494B/en
Publication of CN113259494A publication Critical patent/CN113259494A/en
Application granted granted Critical
Publication of CN113259494B publication Critical patent/CN113259494B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • 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/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • 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/18File system types
    • G06F16/182Distributed file systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application is applicable to the field of block chains, and provides a file storage method, a file storage device, electronic equipment and a storage medium. The file storage method comprises the following steps: the file uploading method includes the steps that a file uploading request sent by a first terminal is obtained, the file to be uploaded is stored through an interplanetary file system, a first hash value corresponding to the file to be uploaded is generated, the first hash value is sent to the first terminal, the first terminal is instructed to send the first hash value to a block chain, so that a second node records the first hash value, the second node is a node different from the first node on the block chain, and if the first hash value sent by the second node is received, the file to be uploaded is sent to the second node, so that the second node synchronizes the file to be uploaded, and therefore the file storage safety can be improved.

Description

File storage method and device, electronic equipment and storage medium
Technical Field
The present application belongs to the field of block chains, and in particular, relates to a file storage method and apparatus, an electronic device, and a storage medium.
Background
With the development of computer technology and network technology, electronic devices are increasingly used, and accordingly more and more information resources are generated, and for redundant information resources, the redundant information resources are generally stored on a centralized server. For example, pictures and videos in a mobile phone or application software are generally stored in a cloud server provided by a provider, and therefore, the risk of file loss and file tampering exists, and the security is low.
Disclosure of Invention
In view of this, embodiments of the present application provide a file storage method and apparatus, an electronic device, and a storage medium, which can improve the security of file storage.
A first aspect of the embodiments of the present application provides a file storage method, which is applied to a first node on a block chain, and includes:
acquiring a file uploading request sent by a first terminal, wherein the file uploading request comprises a file to be uploaded;
storing the file to be uploaded by adopting an interplanetary file system;
generating a first hash value corresponding to the file to be uploaded;
sending the first hash value to the first terminal, and instructing the first terminal to send the first hash value to a block chain so that a second node records the first hash value, wherein the second node is a node on the block chain, and the node is different from the first node;
and if a first hash value sent by the second node is received, sending the file to be uploaded to the second node so that the second node synchronizes the file to be uploaded.
In a possible implementation manner, the generating a first hash value corresponding to the file to be uploaded includes:
determining a first storage path of the file to be uploaded, and generating a first hash value corresponding to the first storage path;
correspondingly, if the first hash value sent by the second node is received, sending the file to be uploaded to the second node includes:
if a first hash value sent by the second node is received, determining a first storage path corresponding to the first hash value;
and sending the file to be uploaded to the second node according to the first storage path.
In a possible implementation manner, before the obtaining of the file upload request sent by the first terminal, the method further includes:
acquiring an application downloading request sent by the first terminal;
sending an application program package to the first terminal according to the application downloading request, wherein the application program package comprises a first transmission protocol;
correspondingly, the acquiring a file uploading request sent by the first terminal includes:
and acquiring a file uploading request sent by the first terminal by adopting the first transmission protocol.
In a possible implementation manner, the application package further includes a second transmission protocol, and the first terminal is configured to access the centralized server according to the second transmission protocol.
In a possible implementation manner, the file storage method further includes:
acquiring a file access request sent by a second terminal, wherein the file access request comprises a file identifier;
downloading a file corresponding to the file identifier from the interplanetary file system according to the file identifier;
and sending the file corresponding to the file identifier to the second terminal.
In a possible implementation manner, the downloading a file corresponding to the file identifier from the interplanetary file system according to the file identifier includes:
determining a second hash value corresponding to the file identifier;
and downloading the file corresponding to the file identifier from the interplanetary file system according to the second hash value.
In a possible implementation manner, the file storage method further includes:
acquiring a transaction query request sent by a third terminal, wherein the transaction query request comprises a transaction identifier;
determining transaction data corresponding to the transaction identification according to the transaction identification;
and sending the transaction data to the third terminal.
A second aspect of the embodiments of the present application provides a file storage apparatus, which is applied to a first node on a block chain, and includes:
the file uploading system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a file uploading request sent by a first terminal, and the file uploading request comprises a file to be uploaded;
the storage module is used for storing the file to be uploaded by adopting an interplanetary file system;
the generating module is used for generating a first hash value corresponding to the file to be uploaded;
a sending module, configured to send the first hash value to the first terminal, and instruct the first terminal to send the first hash value to a block chain, so that a second node records the first hash value, where the second node is a node on the block chain different from the first node;
and the synchronization module is used for sending the file to be uploaded to the second node if the first hash value sent by the second node is received, so that the second node synchronizes the file to be uploaded.
A third aspect of embodiments 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, when executing the computer program, implements the method according to the first aspect.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, in which a computer program is stored, which, when executed by a processor, implements the method according to the first aspect as described above.
A fifth aspect of embodiments of the present application provides a computer program product, which, when run on a terminal device, causes the terminal device to perform the method of any one of the first aspect.
Compared with the prior art, the embodiment of the application has the advantages that: when the first node acquires a file uploading request sent by the first terminal, the interplanetary file system is adopted to store the file to be uploaded, and the interplanetary file system is a distributed file system, so that the file can be stored in a distributed mode, and the file to be uploaded can be prevented from being tampered. After the file to be uploaded is stored in the first node, a first hash value corresponding to the file to be uploaded is generated, the first hash value is sent to the first terminal, the first terminal is instructed to send the first hash value to the block chain, the second node on the block chain records the first hash value, the file to be uploaded is synchronized from the first node through the first hash value, and therefore the file to be uploaded can be stored to the block chain, and the file storage safety is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly described below.
Fig. 1 is a schematic flowchart illustrating an implementation process of a file storage method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a file storage process provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of a file storage device provided by an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
In addition, in the description of the present application, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
In the prior art, files are generally stored in a centralized server, so that the risk of file loss and file tampering exists, and the security is low. Therefore, the file storage method is provided, when the first node obtains the file uploading request sent by the first terminal, the file to be uploaded is stored by adopting the interplanetary file system, and the file can be stored in a distributed mode due to the fact that the interplanetary file system is a distributed file system, and therefore the file to be uploaded can be prevented from being tampered. After the file to be uploaded is stored in the first node, a first hash value corresponding to the file to be uploaded is generated, the first hash value is sent to the first terminal, the first terminal is instructed to send the first hash value to the block chain, the second node on the block chain records the first hash value, the file to be uploaded is synchronized from the first node through the first hash value, and therefore the file to be uploaded can be stored to the block chain, and the file storage safety is improved.
The following provides an exemplary description of a control method of an electronic device provided in the present application.
Referring to fig. 1, a file storage method provided in an embodiment of the present application is applied to a first node on a block chain, and includes:
s101: the method comprises the steps of obtaining a file uploading request sent by a first terminal, wherein the file uploading request comprises a file to be uploaded.
Illustratively, the first terminal may be a mobile phone, a computer, a notebook, a palm computer, or the like.
The file to be uploaded may be a hypertext Markup Language (HTML) file, a document, a picture, audio, video, or other types of files.
In a possible implementation manner, the first terminal sends the file upload request through a first transport protocol, where the first transport protocol is a pre-agreed data transport protocol between the first terminal and the blockchain, and may be named FXTP, for example, and the first terminal sends the file upload request through the FXTP protocol.
In an embodiment, before acquiring the file upload request, the first node further includes acquiring an application download request sent by the first terminal, and sending an application package to the first terminal according to the application download request, where the application package includes the first transport protocol. After the application package is installed on the first terminal, the intelligent contract deployed in the application package is obtained, the first transmission protocol is determined according to the intelligent contract, and a file uploading request can be sent to the first node through the first transmission protocol. For example, if the first terminal is a mobile phone, the application package may be an Android Application Package (APK), and after the APK is installed in the mobile phone, the first node may be accessed through corresponding application software.
In an embodiment, the application package further comprises a second transport protocol, the first terminal being adapted to access the centralized server according to the second transport protocol. The second Transmission Protocol may be a hypertext Transfer Protocol (HTTP), a Transmission Control Protocol (TCP), or the like. After the application package is installed, the first terminal can access the node on the blockchain and also can access the centralized server, so that switching between a blockchain system and a system (such as an android system and a Windows system) corresponding to the centralized server is realized, different requirements can be met, and user experience is improved.
In an embodiment, the file uploading request is a file to be uploaded after a private key of the first terminal is used for digital signature, the first node verifies the digital signature by using a public key of the first terminal after acquiring the file uploading request sent by the first terminal, and after the verification is passed, the step S102 is executed to improve the security of data transmission.
S102: and storing the file to be uploaded by adopting an interplanetary file system.
Wherein, The Inter Platform File System (IPFS) and The intelligent contract are deployed on The first node. And after the first node acquires the file uploading request, the IPFS stores the file to be uploaded.
S103: and generating a first hash value corresponding to the file to be uploaded.
The first hash value corresponds to the first node and the file to be uploaded, other nodes on the block chain are used for determining the file to be uploaded according to the first hash value and storing the file to be uploaded in the first node, and the first node is used for determining the corresponding file to be uploaded according to the first hash value. After the first node determines that the file to be uploaded is successfully stored, the first node calls an intelligent contract to generate a first hash value corresponding to the file to be uploaded.
S104: and sending the first hash value to the first terminal, and instructing the first terminal to send the first hash value to the block chain so that a second node records the first hash value, wherein the second node is a node different from the first node on the block chain.
The second node and the nodes except the first node in the time zone block chain. After receiving the first hash value, the first terminal sends the first hash value to the blockchain by using a first transmission protocol, one node (which may be the first node or any one of the second nodes) on the blockchain records the first hash value, and broadcasts and synchronizes the first hash value to other nodes on the blockchain, and at this time, the second nodes on the blockchain all record the first hash value.
In a possible implementation manner, after receiving the first hash value, the first terminal performs digital signature on the first hash value by using a private key of the first terminal, calls an intelligent contract to send the digitally signed first hash value to the blockchain, after receiving the digitally signed first hash value, one node on the blockchain verifies the digital signature by using a public key of the first terminal, after the verification is passed, records the first hash value, and synchronizes the broadcast of the first hash value to other nodes on the blockchain, so that the first hash value can be prevented from being tampered, and the security of data storage is improved.
S105: and if a first hash value sent by the second node is received, sending the file to be uploaded to the second node so that the second node synchronizes the file to be uploaded.
Specifically, after recording the first hash value, the second node sends the first hash value to the first node, after obtaining the hash value, the first node sends the file to be uploaded to the second node, and the second node downloads the file to be uploaded, so that the file to be uploaded is recorded in the block chain. In an embodiment, in the file storage process as shown in fig. 2, after receiving a file upload request, a first node stores a file to be uploaded by using an IPFS, and after the file is stored, invokes an intelligent contract to generate a first hash value, and sends the first hash value to a first terminal through a first transmission protocol. After the first hash value is obtained, the first hash value is sent to the block chain through a first transmission protocol by the first terminal, one node on the block chain records the first hash value, the first hash value is broadcasted and synchronized to other nodes on the block chain, then the second node obtains the first hash value, and the second node downloads the file to be uploaded from the first node through the first hash value, so that the file to be uploaded is stored to all nodes on the block chain.
In a possible implementation manner, after the first node stores the file to be uploaded to the IPFS, a first storage path of the file to be uploaded is determined, and a first hash value corresponding to the first storage path is generated. Correspondingly, after the first node receives the first hash value sent by the second node, the first storage path of the file to be uploaded is determined according to the first hash value, the file to be uploaded is obtained from the first storage path, and the file to be uploaded is sent to the second node.
In an embodiment, the file upload request further includes a first identifier corresponding to the file to be uploaded, and after the first node obtains the file upload request, the file to be uploaded and the first identifier are stored by using an IPFS, and meanwhile, the IPFS stores a first hash value corresponding to the first identifier. After receiving the first hash value sent by the second node, the first node determines the first identifier according to the first hash value, determines the file to be uploaded according to the first identifier, and sends the file to be uploaded to the second node, so that the file synchronization efficiency is improved.
In an embodiment, after receiving a first hash value sent by a second node, a first node determines a first identifier according to the first hash value, determines a file to be uploaded according to the first identifier, and sends the file to be uploaded and the first identifier to the second node, that is, all nodes on a block chain store the file to be uploaded and the corresponding first hash value and first identifier, when a user accesses the file to be uploaded, the nodes on the block chain can determine the file to be uploaded according to the first identifier or the first hash value, so as to send the file to the user.
In the embodiment, when the first node acquires the file uploading request sent by the first terminal, the interplanetary file system is used for storing the file to be uploaded, and the interplanetary file system is a distributed file system, so that the file can be stored in a distributed manner, and the file to be uploaded can be prevented from being tampered. After the file to be uploaded is stored in the first node, a first hash value corresponding to the file to be uploaded is generated, the first hash value is sent to the first terminal, the first terminal is instructed to send the first hash value to the block chain, the second node on the block chain records the first hash value, the file to be uploaded is synchronized from the first node through the first hash value, and therefore the file to be uploaded can be stored to the block chain, and the file storage safety is improved.
In a possible implementation manner, the first node stores the file and the corresponding file identifier, and the first node may obtain the file access request sent by the second terminal, where the file access request includes the file identifier of the file to be accessed, and the file identifier may be a name of the file to be accessed. The second terminal may be the same as or different from the first terminal. The second terminal may send a file access request via the first transport protocol, for example, the file access request is FXTP:// file identification, so that browsing and downloading of files may be implemented by means of a browser. The file access request may also include an identity of the second terminal, the identity of the second terminal may be a communication address of the second terminal or an account number of the second terminal on the blockchain, the first node verifies the identity of the second terminal after acquiring the file access request sent by the second terminal, responds to the file access request after the verification is passed, downloads a file corresponding to the file identity, that is, a file to be accessed, from the IPFS, and sends the file corresponding to the file identity to the second terminal through a first transmission protocol. Because the IPFS is a distributed file system, files are downloaded from the IPFS, and the file downloading speed is improved.
In other possible implementation manners, after obtaining an access request sent by the second terminal, the first node sends a file list to the second terminal, the file list is displayed on a display interface of the second terminal, the file list comprises a file identifier of a file uploaded by a user, the user selects the file identifier of the file to be accessed on the second terminal, the second terminal sends the file identifier to the first node, and the first node downloads the file corresponding to the file identifier from the IPFS according to the file identifier.
In a possible implementation manner, after obtaining the file identifier, the first node determines a second hash value according to the file identifier, and downloads a file corresponding to the file identifier from the IPFS according to the second hash value. The first node can determine a second hash value corresponding to the file identifier by calling an intelligent contract, and can also determine the second hash value according to the corresponding relation between the stored file identifier and the second hash value.
In a possible implementation manner, the first node stores the corresponding relationship between the hash value and the storage path, after the first node determines the second hash value, the first node determines the storage path corresponding to the second hash value according to the corresponding relationship between the hash value and the storage path, and downloads the file corresponding to the file identifier from the IPFS according to the corresponding storage path, so that the file downloading speed is increased.
In an embodiment, if the first node acquires a transaction query request sent by the third terminal, the transaction query request includes a transaction identifier, determines transaction data corresponding to the transaction identifier according to the transaction identifier, and sends the transaction data to the third terminal. The third terminal and the first node can communicate through an HTTP protocol, so that inquiry of transactions and downloading of files can be simultaneously realized on the first terminal.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Fig. 3 shows a block diagram of a file storage apparatus provided in an embodiment of the present application, corresponding to the file storage method described in the foregoing embodiment, and only shows portions related to the embodiment of the present application for convenience of description.
As shown in fig. 3, the file storage device is applied to a first node on the block chain, and includes:
the file uploading method includes that an obtaining module 10 is used for obtaining a file uploading request sent by a first terminal, wherein the file uploading request comprises a file to be uploaded;
the storage module 20 is configured to store the file to be uploaded by using an interplanetary file system;
a generating module 30, configured to generate a first hash value corresponding to the file to be uploaded;
a sending module 40, configured to send the first hash value to the first terminal, and instruct the first terminal to send the first hash value to a block chain, so that a second node records the first hash value, where the second node is a node on the block chain that is different from the first node;
and the synchronization module 50 is configured to send the file to be uploaded to the second node if the first hash value sent by the second node is received, so that the second node synchronizes the file to be uploaded.
In a possible implementation manner, the generating module 30 is specifically configured to:
determining a first storage path of the file to be uploaded, and generating a first hash value corresponding to the first storage path;
correspondingly, if the first hash value sent by the second node is received, sending the file to be uploaded to the second node includes:
if a first hash value sent by the second node is received, determining a first storage path corresponding to the first hash value;
and sending the file to be uploaded to the second node according to the first storage path.
In a possible implementation manner, the obtaining module 10 is further configured to:
acquiring an application downloading request sent by the first terminal;
sending an application program package to the first terminal according to the application downloading request, wherein the application program package comprises a first transmission protocol;
and acquiring a file uploading request sent by the first terminal by adopting the first transmission protocol.
In a possible implementation manner, the application package further includes a second transmission protocol, and the first terminal is configured to access the centralized server according to the second transmission protocol.
In a possible implementation manner, the obtaining module 10 is further configured to:
acquiring a file access request sent by a second terminal, wherein the file access request comprises a file identifier;
downloading a file corresponding to the file identifier from the interplanetary file system according to the file identifier;
and sending the file corresponding to the file identifier to the second terminal.
In a possible implementation manner, the obtaining module 10 is further configured to:
determining a second hash value corresponding to the file identifier;
and downloading the file corresponding to the file identifier from the interplanetary file system according to the second hash value.
In a possible implementation manner, the obtaining module 10 is further configured to:
acquiring a transaction query request sent by a third terminal, wherein the transaction query request comprises a transaction identifier;
determining transaction data corresponding to the transaction identification according to the transaction identification;
and sending the transaction data to the third terminal.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. The electronic device may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing device.
As shown in fig. 4, the electronic apparatus of this embodiment includes: a processor 11, a memory 12 and a computer program 13 stored in said memory 12 and executable on said processor 11. The processor 11, when executing the computer program 13, implements the steps in the above-described file storage method embodiment, such as steps S101 to S105 shown in fig. 1. Alternatively, the processor 11 executes the computer program 13 to implement the functions of the modules/units in the device embodiments, such as the functions of the acquisition module 10 to the synchronization module 50 shown in fig. 3.
Illustratively, the computer program 13 may be partitioned into one or more modules/units, which are stored in the memory 12 and executed by the processor 11 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 13 in the terminal device.
Those skilled in the art will appreciate that fig. 4 is merely an example of an electronic device and is not limiting and may include more or fewer components than those shown, or some components may be combined, or different components, e.g., the electronic device may also include input output devices, network access devices, buses, etc.
The Processor 11 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, a discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 12 may be an internal storage unit of the electronic device, such as a hard disk or a memory of the electronic device. The memory 12 may also be an external storage device of the electronic device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the electronic device. Further, the memory 12 may also include both an internal storage unit and an external storage device of the electronic device. The memory 12 is used for storing the computer program and other programs and files required by the electronic device. The memory 12 may also be used to temporarily store files that have been or will be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, 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, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
Those of ordinary skill in the art will appreciate that the various illustrative elements 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 application.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A file storage method is applied to a first node on a block chain, and is characterized by comprising the following steps:
acquiring a file uploading request sent by a first terminal, wherein the file uploading request comprises a file to be uploaded;
storing the file to be uploaded by adopting an interplanetary file system;
generating a first hash value corresponding to the file to be uploaded;
sending the first hash value to the first terminal, and instructing the first terminal to send the first hash value to a block chain so that a second node records the first hash value, wherein the second node is a node on the block chain, and the node is different from the first node;
and if a first hash value sent by the second node is received, sending the file to be uploaded to the second node so that the second node synchronizes the file to be uploaded.
2. The file storage method according to claim 1, wherein the generating a first hash value corresponding to the file to be uploaded comprises:
determining a first storage path of the file to be uploaded, and generating a first hash value corresponding to the first storage path;
correspondingly, if the first hash value sent by the second node is received, sending the file to be uploaded to the second node includes:
if a first hash value sent by the second node is received, determining a first storage path corresponding to the first hash value;
and sending the file to be uploaded to the second node according to the first storage path.
3. The file storage method according to claim 1, wherein before the acquiring the file upload request sent by the first terminal, the method further comprises:
acquiring an application downloading request sent by the first terminal;
sending an application program package to the first terminal according to the application downloading request, wherein the application program package comprises a first transmission protocol;
correspondingly, the acquiring a file uploading request sent by the first terminal includes:
and acquiring a file uploading request sent by the first terminal by adopting the first transmission protocol.
4. The file storage method of claim 3 wherein the application package further comprises a second transport protocol, the first terminal for accessing a centralized server according to the second transport protocol.
5. The file storage method according to claim 1, further comprising:
acquiring a file access request sent by a second terminal, wherein the file access request comprises a file identifier;
downloading a file corresponding to the file identifier from the interplanetary file system according to the file identifier;
and sending the file corresponding to the file identifier to the second terminal.
6. The file storage method according to claim 5, wherein said downloading the file corresponding to the file identifier from the interplanetary file system according to the file identifier comprises:
determining a second hash value corresponding to the file identifier;
and downloading the file corresponding to the file identifier from the interplanetary file system according to the second hash value.
7. The file storage method according to claim 1, further comprising:
acquiring a transaction query request sent by a third terminal, wherein the transaction query request comprises a transaction identifier;
determining transaction data corresponding to the transaction identification according to the transaction identification;
and sending the transaction data to the third terminal.
8. A file storage apparatus applied to a first node on a block chain, comprising:
the file uploading system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a file uploading request sent by a first terminal, and the file uploading request comprises a file to be uploaded;
the storage module is used for storing the file to be uploaded by adopting an interplanetary file system;
the generating module is used for generating a first hash value corresponding to the file to be uploaded;
a sending module, configured to send the first hash value to the first terminal, and instruct the first terminal to send the first hash value to a block chain, so that a second node records the first hash value, where the second node is a node on the block chain different from the first node;
and the synchronization module is used for sending the file to be uploaded to the second node if the first hash value sent by the second node is received, so that the second node synchronizes the file to be uploaded.
9. 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 file storage method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the file storage method according to any one of claims 1 to 7.
CN202110783409.5A 2021-07-12 2021-07-12 File storage method and device, electronic equipment and storage medium Active CN113259494B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110783409.5A CN113259494B (en) 2021-07-12 2021-07-12 File storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110783409.5A CN113259494B (en) 2021-07-12 2021-07-12 File storage method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113259494A true CN113259494A (en) 2021-08-13
CN113259494B CN113259494B (en) 2021-11-12

Family

ID=77191084

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110783409.5A Active CN113259494B (en) 2021-07-12 2021-07-12 File storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113259494B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114398449A (en) * 2021-12-29 2022-04-26 深圳市海清视讯科技有限公司 Data processing method and device, video monitoring system, storage medium and product
CN115118715A (en) * 2022-06-27 2022-09-27 中国工商银行股份有限公司 File interactive transmission method and device based on block chain

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110008194A (en) * 2019-03-01 2019-07-12 上海七印信息科技有限公司 A kind of rapid file acquisition methods based on block chain and interspace file system IPFS
CA3016395A1 (en) * 2018-09-04 2020-03-04 Micky Multani Using geographically defined, private interplanetary file system clusters for the secure storage, retrieval and sharing of encrypted business data
WO2020252479A1 (en) * 2019-06-13 2020-12-17 Gutierrez Sheris Luis Eduardo System and method using a fitness-gradient blockchain consensus
CN112835612A (en) * 2021-01-26 2021-05-25 平衡机器科技(深圳)有限公司 Electronic document version management method and device based on block chain
CN112862616A (en) * 2021-04-23 2021-05-28 北京中科金财科技股份有限公司 Secure multi-party computing method, device and storage medium supporting block chain
CN113098938A (en) * 2021-03-25 2021-07-09 卓尔智联(武汉)研究院有限公司 Video sharing method and device and electronic equipment
CN113360953A (en) * 2021-06-03 2021-09-07 上海和数软件有限公司 File distributed storage management method and system based on IPFS and block chain

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA3016395A1 (en) * 2018-09-04 2020-03-04 Micky Multani Using geographically defined, private interplanetary file system clusters for the secure storage, retrieval and sharing of encrypted business data
CN110008194A (en) * 2019-03-01 2019-07-12 上海七印信息科技有限公司 A kind of rapid file acquisition methods based on block chain and interspace file system IPFS
WO2020252479A1 (en) * 2019-06-13 2020-12-17 Gutierrez Sheris Luis Eduardo System and method using a fitness-gradient blockchain consensus
CN112835612A (en) * 2021-01-26 2021-05-25 平衡机器科技(深圳)有限公司 Electronic document version management method and device based on block chain
CN113098938A (en) * 2021-03-25 2021-07-09 卓尔智联(武汉)研究院有限公司 Video sharing method and device and electronic equipment
CN112862616A (en) * 2021-04-23 2021-05-28 北京中科金财科技股份有限公司 Secure multi-party computing method, device and storage medium supporting block chain
CN113360953A (en) * 2021-06-03 2021-09-07 上海和数软件有限公司 File distributed storage management method and system based on IPFS and block chain

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李瑾等: "基于区块链的分布式电能量数据可信存储机制", 《网络与信息安全学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114398449A (en) * 2021-12-29 2022-04-26 深圳市海清视讯科技有限公司 Data processing method and device, video monitoring system, storage medium and product
CN115118715A (en) * 2022-06-27 2022-09-27 中国工商银行股份有限公司 File interactive transmission method and device based on block chain

Also Published As

Publication number Publication date
CN113259494B (en) 2021-11-12

Similar Documents

Publication Publication Date Title
CN109391673B (en) Method, system and terminal equipment for managing update file
CN109471653B (en) Application program updating method, electronic device, server and storage medium
CN113259494B (en) File storage method and device, electronic equipment and storage medium
WO2017071207A1 (en) Application installation method, corresponding apparatus, and application installation system
CN107015870B (en) Method and device for realizing communication between web page and local application and electronic equipment
CN111163130B (en) Network service system and data transmission method thereof
WO2019015272A1 (en) Information processing method and device
CN105516246A (en) Method for preventing application program downloading hijacking and server
CN106257879B (en) Method and device for downloading application
CN113434249A (en) Mirror image synchronization method and device, docker host and storage medium
CN114090033A (en) OTA (over the air) upgrading method and device, electronic equipment and readable medium
CN112702336A (en) Security control method and device for government affair service, security gateway and storage medium
CN114327710B (en) Function management method, management device, terminal equipment and readable storage medium
CN111176685A (en) Upgrading method and device
CN112748962B (en) Application loading method, device, electronic equipment and computer readable medium
CN111209205B (en) Configuration method, configuration device and electronic equipment
CN111182527B (en) OTA (over the air) firmware upgrading method and device, terminal equipment and storage medium thereof
CN112818270A (en) Data cross-domain transfer method and device and computer equipment
CN111343220B (en) Repeater, distributed file transmission method, distributed file transmission system, medium and electronic equipment
CN112887362B (en) Equipment access method, equipment access device and server
CN113395326B (en) Network service-based login method, device and computer-readable storage medium
CN115695416A (en) File downloading method, device, medium and equipment based on cloud storage service
CN115269063A (en) Process creation method, system, device and medium
CN114912097A (en) Certificate verification method and device, electronic equipment and storage medium
CN114780124A (en) Differential upgrading method, device, medium and electronic equipment

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
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40051262

Country of ref document: HK