Information storage method and device

By uploading the target file to the IPFS system and generating identification information, the problem of high pressure on blockchain storage is solved, and information is efficiently stored in blockchain and IPFS systems is realized, and the storage trust is enhanced.

CN112965980BActive Publication Date: 2025-02-18SAI ANDY TECHNOLOGY (HONG KONG) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110268604.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-12
Publication Date
2025-02-18
Estimated Expiration
2041-03-12

AI Technical Summary

Technical Problem

Due to the block size limitation, the blockchain storage system cannot effectively store large files or large data volumes, resulting in increased storage pressure.

Method used

By uploading the target file to the IPFS system, corresponding identification information is generated, and these identification information is synchronized to the local database, and then uploaded to the blockchain network through a message queue to complete the chaining operation.

Benefits of technology

Store identification information in the blockchain, while storing actual files in the IPFS system reduces the pressure of block storage, and improves the trust of information storage through the immutability of blockchain and the high throughput data storage of IPFS .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112965980B_ABST
    Figure CN112965980B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses an information storage method and device, which is applied to a server, and the method includes: obtaining a target file, uploading the target file to an IPFS system, and generating identification information corresponding to the target file through the IPFS system; receiving identification information sent by an IFPS system, and synchronously storing the identification information in a local database; uploading the identification information to a blockchain network through a message queue to complete the chain operation. The use of the embodiment of the present application is conducive to reducing the pressure of block storage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to an information storage method and device. Background Art

[0002] Blockchain is a peer-to-peer distributed trusted ledger based on message encryption and identity consensus, and uses cryptography and time sequence to ensure that blocks cannot be tampered with, forged, and traced. The storage system of blockchain can be built based on some databases, for example, Key / Value databases (such as LevelDB), which can store large amounts of data or large files in blocks. However, each block has a corresponding block capacity, which can refer to the number of bytes that can be stored in the block. Due to the block size limit, the above-mentioned large files or large amounts of data cannot be stored, which increases the pressure on block storage. Summary of the invention

[0003] The embodiments of the present application provide an information storage method and device, which are helpful to reduce the pressure of block storage.

[0004] A first aspect of an embodiment of the present application provides an information storage method, which is applied to a server, comprising:

[0005] The server obtains the target file, uploads the target file to the IPFS system, and generates identification information corresponding to the target file through the IPFS system;

[0006] Receiving the identification information sent by the IFPS system, and synchronously storing the identification information in a local database;

[0007] The identification information is uploaded to the blockchain network through the message queue to complete the chain operation.

[0008] A second aspect of the embodiments of the present application provides an information storage device, which is applied to a server. The device includes: a generation unit, a synchronization unit, and an uplink operation unit, wherein:

[0009] The generating unit is used to obtain a target file, upload the target file to the IPFS system, and generate identification information corresponding to the target file through the IPFS system;

[0010] The synchronization unit is used to receive the identification information sent by the IFPS system and synchronously store the identification information into a local database;

[0011] The on-chain operation unit is used to upload the identification information to the blockchain network through a message queue to complete the on-chain operation.

[0012] A third aspect of an embodiment of the present application provides a server, comprising a processor, an input device, an output device and a memory, wherein the processor, the input device, the output device and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method described in the first aspect of the embodiment of the present application.

[0013] The fourth aspect of the embodiments of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program enables a computer to execute part or all of the steps described in the first aspect of the embodiments of the present application.

[0014] A fifth aspect of the embodiments of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.

[0015] Implementing the embodiments of the present application has at least the following beneficial effects: obtaining the target file, uploading the target file to the IPFS system, and generating identification information corresponding to the target file through the IPFS system; receiving the identification information sent by the IFPS system, and synchronously storing the identification information in the local database; uploading the identification information to the blockchain network through the message queue to complete the chain operation. In this way, the above identification information can be stored in the blockchain, and the above target file can be stored in the IPFS system. Since the identification information occupies less block memory space, it is conducive to reducing the pressure of block storage; combined with the immutability of the blockchain network and the high-throughput data storage of the IPFS system, it is conducive to improving the trust of information storage. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1A A schematic diagram of the architecture of an information storage system is provided for an embodiment of the present application;

[0018] Figure 1B A flowchart of an information storage method is provided for an embodiment of the present application;

[0019] Figure 1CA timing diagram of an information storage method is provided for an embodiment of the present application;

[0020] Figure 2 A schematic diagram of the architecture of an information storage system is provided for an embodiment of the present application;

[0021] Figure 3 A schematic diagram of the architecture of an information storage system is provided for an embodiment of the present application;

[0022] Figure 4 A schematic diagram of the structure of a server is provided for an embodiment of the present application;

[0023] Figure 5 A structural schematic diagram of an information storage device is provided for an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0026] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0027] In order to better understand the embodiments of the present application, the method of applying the embodiments of the present application will be introduced below.

[0028] The servers mentioned in the embodiments of the present application may include but are not limited to background servers, component servers, cloud servers, data distribution system servers or information storage software servers, etc. The above are only examples and not exhaustive, including but not limited to the above devices.

[0029] See also Figure 1A , Figure 1A It is an architectural diagram of an information storage system provided in an embodiment of the present application. As shown in the figure, the information storage system may include multiple application servers, message queues, blockchain networks, IPFS systems and users, wherein the application server is the server in the embodiment of the present application. In a specific implementation, it may include multiple application servers, each of which may correspond to a business requirement, for example, it may correspond to drug procurement, project bidding, project bidding, etc., which is not limited here. Then, the corresponding server is a drug procurement server, a project bidding server, a project bidding server, etc.

[0030] Among them, the blockchain referred to in the embodiments of the present application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods, each of which contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer. The above-mentioned blockchain network can be used to store the identification information corresponding to the target file, which can be generated by the application server.

[0031] Among them, the above-mentioned IPFS (InterPlanetary File System) system is a peer-to-peer distributed file system, which is used to store the above-mentioned target file and generate identification information based on the target file to mark the target file. The identification information is also used to verify whether the target file has been tampered with.

[0032] Among them, the above-mentioned message queue is used to transmit the identification information generated by the IPFS system to the above-mentioned blockchain network to complete the chain operation of the identification information, and when the above-mentioned target file is tampered with, the message queue can also be used to send prompt information to the user, and the prompt information is used to remind the user that the above-mentioned target file has been tampered with.

[0033] It can be seen that, by using the embodiment of the present application, the server can obtain the target file, upload the target file to the IPFS system, generate identification information corresponding to the target file through the IPFS system; receive the identification information sent by the IFPS system, and store the identification information synchronously in the local database; upload the identification information to the blockchain network through the message queue to complete the chain operation. In this way, the above identification information can be stored in the blockchain, and the above target file can be stored in the IPFS system. Since the identification information occupies less block memory space, it is conducive to reducing the pressure of block storage; combined with the immutability of the blockchain network and the high-throughput data storage of the IPFS system, it is conducive to improving the trust of information storage.

[0034] See also Figure 1B , Figure 1B : is a flow chart of an information storage method provided in an embodiment of the present application, which is applied to a server. The method comprises the following steps:

[0035] 101. The server obtains a target file, uploads the target file to an IPFS system, and generates identification information corresponding to the target file through the IPFS system;

[0036] Among them, the above-mentioned server may include an application server, which may include a drug procurement server, a project bidding server, etc., which is not limited here; the above-mentioned IPFS (InterPlanetary File System) is a point-to-point distributed file system, and the corresponding data structure of the system can be built based on Merkle DAG (Merkle directed acyclic graph), which ensures content-based addressing, tamper-proofing and duplicate data deletion, and based on block exchange strategy, object locking, object encryption and version control to ensure high-throughput data storage distribution, data security and historical version traceability.

[0037] Among them, in the embodiment of the present application, it can be applied to the drug procurement information storage system. The above-mentioned target file may include a large memory file that occupies CPU memory exceeding a certain size. The target file may include a bidding document, a bidding document, etc.; the above-mentioned identification information may include at least one of the following: IPFS hash value, self-certification naming, etc., which is not limited here.

[0038] In a specific implementation, after obtaining the above-mentioned target file, when the server uploads the target file to the IPFS system, it can carry information such as the file name and project number corresponding to the target file. Then, the IPFS system can generate identification information corresponding to the target file based on the above-mentioned file name and project number and the content information of the target file.

[0039] In a possible example, the above-mentioned generation of identification information corresponding to the target file through the IPFS system may include the following steps: identifying the target file through the ipfs system to obtain content information in the target file; splitting the content information to obtain multiple sub-file content blocks; processing the multiple sub-file content blocks through the IPFS system to generate identification information corresponding to the target file.

[0040] Among them, since the target file is a large file that occupies a large amount of memory, the target file may include multiple sub-files. Therefore, based on the content information in the target file, the target file can be split to obtain multiple sub-file content blocks, and then the sub-file content blocks can be processed to generate identification information for identifying the target file.

[0041] In a possible example, the above-mentioned processing of the multiple sub-file content blocks through the IPFS system to generate identification information corresponding to the target file may include the following steps: storing the multiple sub-file content blocks in a plurality of nodes included in the IPFS system; performing hash encoding on each of the multiple sub-file content blocks to generate a plurality of hash values; storing the multiple hash values ​​in a plurality of nodes of the IPFS system, each node may correspond to a hash value, and the multiple hash values ​​constitute the identification information.

[0042] Among them, the above-mentioned IPFS system may include multiple nodes, each node may store a corresponding hash table, the hash table may store multiple hash values, and each hash value may correspond to a hash value corresponding to a sub-file content block.

[0043] Among them, the above-mentioned hash table can be used to record the location where the target file is stored, split the above-mentioned target file into multiple sub-file content blocks, and store them in multiple nodes of the IPFS system, which is conducive to saving the storage space of the block. In addition, the subsequent search for multiple sub-file content blocks of the target file can be realized based on multiple nodes of the IPFS system, which is conducive to improving the query or download speed of the file.

[0044] Optionally, after the content information is split as above to obtain multiple sub-file content blocks, the following steps may also be included: establishing a mapping relationship between the multiple sub-file content blocks and a preset self-certification naming set to obtain a relationship tree structure, in which each sub-file content block corresponds to a preset self-certification naming; and storing the multiple preset self-certification naming in the preset self-certification naming set and their corresponding hash values ​​in the IPFS system.

[0045] The preset self-authentication naming set may include a plurality of preset self-authentication namings, and the preset self-authentication namings may be characters such as numbers, letters, etc., which are not limited here.

[0046] Among them, the preset self-authentication name in the above preset self-authentication name set can also be used as identification information, which can be obtained by the user's self-authentication name.

[0047] Among them, since the above hash value is not user-friendly and difficult to understand, while the self-certification name is user-friendly, shorter and easier to understand than the hash value, the self-certification name can also be used to distinguish different sub-file contents.

[0048] In a specific implementation, the sub-file contents can be marked based on multiple preset self-certification names, each preset self-certification name can correspond to a sub-file content block, and a mapping relationship between each sub-file content block and the preset self-certification name set can be established to obtain a relationship tree structure, which can correspond to the mapping relationship between each sub-file content block. Accordingly, multiple preset self-certification names in the preset self-certification name set and their corresponding hash values ​​can be stored in the IPFS system.

[0049] Furthermore, when searching or reading files subsequently, self-certification naming matching can be implemented based on the above-mentioned preset self-certification naming set, and the required multiple target characters can be found, and based on the multiple target self-certification names, the corresponding sub-file content blocks can be extracted from the IPFS system, which is conducive to speeding up the efficiency of file searching.

[0050] Optionally, when the target file is subsequently searched or read, the specific implementation may include the following steps: when receiving a file search request initiated by a user, determine the file to be searched corresponding to the file search request and the target hash value corresponding to the file to be searched; based on the target hash value, search the IPFS system and obtain an index address; according to the index address, obtain the node position corresponding to each of the multiple sub-file blocks to be searched in the file to be searched, and obtain multiple node positions; based on the multiple node positions, obtain the hash value corresponding to each sub-file block to be searched, and obtain multiple sub-file hash values; according to the multiple sub-file hash values, determine the target self-certification naming set corresponding to the file to be searched; and based on the target self-certification naming set and the target sub-file content block corresponding to each target self-certification naming in the target self-certification naming set, replace each target self-certification naming with its corresponding target sub-file content block; obtain the target relationship tree structure corresponding to the target self-certification naming set; based on the target relationship tree structure, assemble multiple target sub-file content blocks to obtain the target file corresponding to the file to be searched.

[0051] In addition, the order of searching the nodes may be determined according to the index address, thereby obtaining a plurality of target sub-file content blocks, assembling the plurality of target sub-file content blocks, and obtaining the target file corresponding to the file to be searched.

[0052] 102. Receive the identification information sent by the IFPS system, and synchronously store the identification information into a local database;

[0053] Among them, the above-mentioned local database may refer to the database corresponding to the above-mentioned server. After the identification information is generated through the IPFS system, in order to ensure the reliability of the data and to ensure that the information in the target file uploaded to the IPFS system is consistent with the local database, the above-mentioned identification information may be synchronously stored in the local database. The identification information may include a hash table, which may include the hash value corresponding to each sub-file content block in the multiple sub-file content blocks corresponding to the above-mentioned target file.

[0054] 103. Upload the identification information to the blockchain network through the message queue to complete the on-chain operation.

[0055] Among them, the identification information corresponding to the above-mentioned target file can be stored in a block created on the blockchain network, and the information can be shared between different platforms through the blockchain. The blockchain is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.

[0056] The message queue can be set by the user or by the system default, which is not limited here; the identification information can be uploaded through the message queue, and the final consistency of the message queue ensures that the identification information sent to the server by the IPFS system can be successfully uploaded to the chain. In addition, asynchronous operation is realized, which is decoupled from other application services, improves the performance of the entire system, and solves the problem of inconsistent file upload records caused by uncertain factors such as the network.

[0057] In a possible example, the above-mentioned uploading of the identification information to the blockchain network through the message queue to complete the chain operation may include the following steps: obtaining a unique file name corresponding to the target file, and using the unique file name as block index information, and recording the identification information as ledger data; uploading the identification information to the blockchain network through the message queue, and identifying the chain operation of the target file through the identification information.

[0058] Among them, the above-mentioned unique file name can be used to identify each file uploaded to the blockchain. The unique file name can be generated when uploading the file. For example, if the target file is a bidding document, the corresponding unique file name can be "bidding project number + the file name"; the unique file name only corresponds to the target file, and each file can correspond to a unique file name; when the above-mentioned identification information is uploaded to the blockchain network, the unique file name can be used as block index information, and the above-mentioned identification information can be recorded as account book data, so that when the file is subsequently extracted or read, the sub-file block corresponding to the target file can be searched in the IPFS system based on the index information.

[0059] Optionally, after the above step 103, the following steps may be included: obtaining first identification information corresponding to the target file from the blockchain network according to the unique file name, the first identification information being uploaded by the IPFS system; obtaining second identification information stored in the local database for the target file, and matching the first identification information with the second identification information; if the first identification information and the second identification information are inconsistent, it is determined that the target file has been tampered with.

[0060] Among them, the above-mentioned identification information can be a hash value. Since when the IPFS system uploads the identification information to the blockchain, it also saves the above-mentioned identification information to the local database at the same time. Therefore, it is only necessary to compare the identification information of the target file on the blockchain with the identification information of the latest version of the local database to see whether the target file has been tampered with.

[0061] Among them, the above-mentioned first identification information may be the identification information corresponding to the target file stored in the blockchain network, and the first identification information may be generated by IPFS and sent to the blockchain network; the second identification information may be the second identification information in the local database. If the first identification information of the target file stored in the blockchain is inconsistent with the above-mentioned second identification information persisted by the IPFS system to the local database, it may indicate that the above-mentioned target file has not been stored on the chain through the normal centralized procurement process, which indicates that the target file has been tampered with.

[0062] Optionally, after the above step 103, the following steps may also be included: within a preset period, retrieving blocks from the blockchain network according to the unique file name to obtain the current account book transaction record of the target file in the blockchain network, the current account book transaction record includes the first file information uploaded to the IPFS system, the first file information includes a first hash value set; obtaining the second file information uploaded to the local database by the IPFS system in the local database, the second file information includes a second hash value set; comparing the first hash value set with the second hash value set, if the first hash value set is inconsistent with the second hash value set, it is determined that the target file in the IPFS system has been tampered with; generating a prompt message that the target file has been tampered with, and returning it to the user through the message queue to inform the user that the target file has been tampered with.

[0063] The preset period may be set by the user or by the system by default, which is not limited here; the first hash value set may include multiple first hash values, and the second hash value set may include multiple second hash values.

[0064] In a specific implementation, within a preset time period, the server can determine whether the file information corresponding to the second identification information in the local database is consistent with the second file information stored in the IPFS system to determine whether the above-mentioned target file has been tampered with.

[0065] In addition, in a specific implementation, each first hash value in the first hash value set can be compared with each second hash value in the second hash value set. If any first hash value is inconsistent with the multiple second hash values, it can be determined that the first hash value set is inconsistent with the second hash value set, and further, it can be determined that the target file has been tampered with.

[0066] The above-mentioned prompt information is used to warn the user that the file has been tampered with; the prompt information can be generated after it is determined that the target file has been tampered with.

[0067] Among them, the above-mentioned prompt message can be pushed to the user through the above-mentioned message queue. In this way, asynchronous operation can be performed in advance, decoupled from other application services in the system, improve system performance, and solve the problem of message loss caused by uncertain factors such as network.

[0068] like Figure 1CAs shown, it is a timing diagram of an information storage method provided by an embodiment of the present application, wherein the server can obtain the target file uploaded by the user and upload the target file to the IPFS system; the IPFS system can generate identification information corresponding to the target file, and send the identification information to the above-mentioned server, and persistently synchronize it to the local database corresponding to the server; the above-mentioned server can receive the identification information sent by the above-mentioned IPFS system, and upload the identification information to the blockchain network through the message queue to complete the chain operation of the identification information; in this way, the tamper-proof nature of the blockchain network and the high-throughput data storage of the IPFS system can be combined, which is conducive to improving the trust of information storage, and through asynchronous operation, that is, uploading the above-mentioned identification information in parallel through the message queue, the final consistency ensures that the identification information sent to the server by the above-mentioned IPFS system can be successfully chained.

[0069] It can be seen that the information storage method described in the embodiment of the present application is applied to the server, and the target file can be obtained, the target file is uploaded to the IPFS system, and the identification information corresponding to the target file is generated through the IPFS system; the identification information sent by the IFPS system is received, and the identification information is synchronously stored in the local database; the identification information is uploaded to the blockchain network through the message queue to complete the chain operation. In this way, the above identification information can be stored in the blockchain, and the above target file can be stored in the IPFS system. Since the identification information occupies less block memory space, it is conducive to reducing the pressure of block storage; combined with the immutability of the blockchain network and the high-throughput data storage of the IPFS system, it is conducive to improving the trust of information storage.

[0070] Consistent with the above, see Figure 2 , Figure 2 This is a flowchart of an information storage method disclosed in an embodiment of the present application, which is applied to a server. The information storage method may include the following steps:

[0071] 201. Obtain a target file, upload the target file to an IPFS system, identify the target file through the IPFS system, and obtain content information in the target file.

[0072] 202. Split the content information to obtain multiple sub-file content blocks.

[0073] 203. Store the multiple sub-file content blocks correspondingly in multiple nodes included in the IPFS system.

[0074] 204. Perform hash coding on each of the multiple sub-file content blocks to generate multiple hash values.

[0075] 205. Store the multiple hash values ​​in multiple nodes of the IPFS system accordingly, each node may correspond to a hash value, and the multiple hash values ​​constitute the identification information.

[0076] 206. Receive the identification information sent by the IFPS system, and synchronously store the identification information into a local database.

[0077] 207. Upload the identification information to the blockchain network through the message queue to complete the on-chain operation.

[0078] The information storage method described in the above steps 201 to 207 can be referred to Figure 1B Corresponding steps of the described table correction method.

[0079] It can be seen that the information storage method described in the embodiment of the present application is applied to the server, can obtain the target file, upload the target file to the IPFS system, identify the target file through the IPFS system, and obtain the content information in the target file; split the content information to obtain multiple sub-file content blocks; store the multiple sub-file content blocks in the multiple nodes contained in the IPFS system; hash encode each sub-file content block in the multiple sub-file content blocks to generate multiple hash values; store the multiple hash values ​​in the multiple nodes of the IPFS system, each node can correspond to a hash value, and the multiple hash values ​​constitute the identification information; receive the identification information sent by the IFPS system, and synchronously store the identification information in the local database; upload the identification information to the blockchain network through the message queue to complete the chain operation. In this way, the target file can be split based on the content information corresponding to the target file to obtain multiple sub-file content blocks, each sub-file content block corresponds to a hash value, which is conducive to distinguishing each sub-file content block and preventing the target file from being tampered with, so as to improve the security of the entire target file storage; further, the multiple sub-file content blocks are correspondingly stored in multiple nodes in the IPFS system, the identification information can be stored in the blockchain, and the target file is stored in the IPFS system. Since the identification information occupies less block memory space, it is conducive to reducing the pressure of block storage.

[0080] Consistent with the above, see Figure 3 , Figure 3 This is a flowchart of an information storage method disclosed in an embodiment of the present application, which is applied to a server. The information storage method may include the following steps:

[0081] 301. Obtain a target file, upload the target file to an IPFS system, and generate identification information corresponding to the target file through the IPFS system.

[0082] 302. Receive the identification information sent by the IFPS system, and synchronously store the identification information into a local database.

[0083] 303. Upload the identification information to the blockchain network through the message queue to complete the on-chain operation.

[0084] 304. Within a preset period, retrieve blocks from the blockchain network according to the unique file name to obtain a current account book transaction record of the target file in the blockchain network, wherein the current account book transaction record includes first file information uploaded to the IPFS system, and the first file information corresponds to a first hash value.

[0085] 305. Obtain second file information in the local database that is uploaded to the local database by the IPFS system, where the second file information corresponds to a second hash value.

[0086] 306. Compare the first hash value with the second hash value. If the first hash value is inconsistent with the second hash value, it is determined that the target file in the IPFS system has been tampered with.

[0087] 307. Generate prompt information that the target file has been tampered with, and return it to the user through the message queue to inform the user that the target file has been tampered with.

[0088] The information storage method described in the above steps 301 to 307 can be referred to Figure 1B Corresponding steps of the described table correction method.

[0089] It can be seen that the information storage method described in the embodiment of the present application is applied to the server, and the target file can be obtained, the target file is uploaded to the IPFS system, and the identification information corresponding to the target file is generated by the IPFS system; the identification information sent by the IFPS system is received, and the identification information is synchronously stored in the local database; the identification information is uploaded to the blockchain network through the message queue to complete the chain operation. Within the preset period, the block is retrieved from the blockchain network according to the unique file name, and the current account book transaction record of the target file in the blockchain network is obtained. The current account book transaction record includes the first file information uploaded to the IPFS system, and the first file information corresponds to the first hash value; the second file information uploaded to the local database by the IPFS system is obtained, and the second file information corresponds to the second hash value; the first hash value is compared with the second hash value. If the first hash value is inconsistent with the second hash value, it is determined that the target file in the IPFS system has been tampered with; a prompt message that the target file has been tampered with is generated, and it is returned to the user through the message queue to inform the user that the target file has been tampered with. In this way, the above-mentioned target file can be stored in combination with the immutability of the blockchain network and the high-throughput data storage characteristics of the IPFS system, which is conducive to improving the trust and high availability of information storage. And within the preset period, the target file is monitored through the second file information persisted to the local database by the IPFS system and the first file information stored in the IPFS system. If the first file information is inconsistent with the second file information, it can be determined that the target file has been tampered with, and a reminder message is sent to the user through the message queue, which is conducive to improving the user experience.

[0090] Consistent with the above, see Figure 4 , Figure 4 A schematic diagram of the structure of a server provided in an embodiment of the present application, such as Figure 4 As shown, it includes a processor, a communication interface, a memory and one or more programs, wherein the processor, the communication interface and the memory are connected to each other, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions, and the one or more programs include instructions for performing the following steps:

[0091] The server obtains the target file, uploads the target file to the IPFS system, and generates identification information corresponding to the target file through the IPFS system;

[0092] Receiving the identification information sent by the IFPS system, and synchronously storing the identification information in a local database;

[0093] The identification information is uploaded to the blockchain network through the message queue to complete the chain operation.

[0094] It can be seen that the server described in the embodiment of the present application can obtain the target file, upload the target file to the IPFS system, generate identification information corresponding to the target file through the IPFS system; receive the identification information sent by the IFPS system, and store the identification information in the local database synchronously; upload the identification information to the blockchain network through the message queue to complete the chain operation. In this way, the above identification information can be stored in the blockchain, and the above target file can be stored in the IPFS system. Since the identification information occupies less block memory space, it is conducive to reducing the pressure of block storage; combined with the immutability of the blockchain network and the high-throughput data storage of the IPFS system, it is conducive to improving the trust of information storage.

[0095] In one possible example, in terms of generating identification information corresponding to the target file through the IPFS system, the program is used to execute instructions for the following steps:

[0096] Identify the target file through the IPFS system to obtain content information in the target file;

[0097] Splitting the content information to obtain multiple sub-file content blocks;

[0098] The IPFS system processes the multiple sub-file content blocks to generate identification information corresponding to the target file.

[0099] In a possible example, in terms of processing the multiple sub-file content blocks through the IPFS system to generate identification information corresponding to the target file, the program is used to execute instructions for the following steps:

[0100] The plurality of sub-file content blocks are stored correspondingly in a plurality of nodes included in the IPFS system;

[0101] Performing hash coding on each of the plurality of sub-file content blocks to generate a plurality of hash values;

[0102] The multiple hash values ​​are stored correspondingly in multiple nodes of the IPFS system, each node may correspond to a hash value, and the multiple hash values ​​constitute the identification information.

[0103] In a possible example, after the content information is split to obtain a plurality of sub-file content blocks, the program is used to execute instructions for the following steps:

[0104] Establishing a mapping relationship between the plurality of sub-file content blocks and a preset self-authentication naming set to obtain a relationship tree structure, wherein each sub-file content block may correspond to a preset self-authentication naming set;

[0105] Multiple preset self-certification names in the preset self-certification naming set and their corresponding hash values ​​are stored in the IPFS system in correspondence.

[0106] In one possible example, in terms of uploading the identification information to the blockchain network through a message queue to complete the on-chain operation, the program is used to execute instructions for the following steps:

[0107] Obtain a unique file name corresponding to the target file, use the unique file name as block index information, and record the identification information as account book data;

[0108] The identification information is uploaded to the blockchain network through the message queue, and the on-chain operation of the target file is identified by the identification information.

[0109] In one possible example, the program is also used to execute instructions for the following steps:

[0110] Acquire first identification information corresponding to the target file from the blockchain network according to the unique file name, where the first identification information is uploaded by the IPFS system;

[0111] Acquire second identification information stored in the local database for the target file, and match the first identification information with the second identification information;

[0112] If the first identification information and the second identification information are inconsistent, it is determined that the target file has been tampered with.

[0113] In one possible example, the program is also used to execute instructions for the following steps:

[0114] Within a preset period, a block is retrieved from the blockchain network according to the unique file name to obtain a current account book transaction record of the target file in the blockchain network, wherein the current account book transaction record includes first file information uploaded to the IPFS system, and the first file information includes a first hash value set;

[0115] Obtaining second file information in the local database uploaded by the IPFS system to the local database, wherein the second file information includes a second hash value set;

[0116] Comparing the first hash value set with the second hash value set, if the first hash value set is inconsistent with the second hash value set, determining that the target file in the IPFS system has been tampered with;

[0117] Generate a prompt message indicating that the target file has been tampered with, and return the prompt message to the user through the message queue to inform the user that the target file has been tampered with.

[0118] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the execution process on the method side. It is understandable that, in order to realize the above functions, the server includes a hardware structure and / or software module corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments provided herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0119] The embodiment of the present application can divide the server into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.

[0120] Consistent with the above, see Figure 5 , Figure 5 is a structural diagram of an information storage device disclosed in an embodiment of the present application, which is applied to a server. The device includes: a generation unit 501, a synchronization unit 502 and an uplink operation unit 503, wherein:

[0121] The generating unit 501 is used to obtain a target file, upload the target file to the IPFS system, and generate identification information corresponding to the target file through the IPFS system;

[0122] The synchronization unit 502 is used to receive the identification information sent by the IFPS system and synchronously store the identification information into a local database;

[0123] The on-chain operation unit 503 is used to upload the identification information to the blockchain network through a message queue to complete the on-chain operation.

[0124] It can be seen that the information storage device described in the embodiment of the present application is applied to the server, can obtain the target file, upload the target file to the IPFS system, generate the identification information corresponding to the target file through the IPFS system; receive the identification information sent by the IFPS system, and store the identification information synchronously in the local database; upload the identification information to the blockchain network through the message queue to complete the chain operation. In this way, the above identification information can be stored in the blockchain, and the above target file can be stored in the IPFS system. Since the identification information occupies less block memory space, it is conducive to reducing the pressure of block storage; combined with the immutability of the blockchain network and the high-throughput data storage of the IPFS system, it is conducive to improving the trust of information storage.

[0125] In a possible example, in terms of generating identification information corresponding to the target file through the IPFS system, the generating unit 501 is used to perform the following steps:

[0126] Identify the target file through the IPFS system to obtain content information in the target file;

[0127] Splitting the content information to obtain multiple sub-file content blocks;

[0128] The IPFS system processes the multiple sub-file content blocks to generate identification information corresponding to the target file.

[0129] In a possible example, in processing the multiple sub-file content blocks through the IPFS system to generate identification information corresponding to the target file, the generating unit 501 is further used to perform the following steps:

[0130] The plurality of sub-file content blocks are stored correspondingly in a plurality of nodes included in the IPFS system;

[0131] Performing hash coding on each of the plurality of sub-file content blocks to generate a plurality of hash values;

[0132] The multiple hash values ​​are stored correspondingly in multiple nodes of the IPFS system, each node may correspond to a hash value, and the multiple hash values ​​constitute the identification information.

[0133] In a possible example, in uploading the identification information to the blockchain network through a message queue to complete the on-chain operation, the on-chain operation unit 503 is used to perform the following steps:

[0134] Obtain a unique file name corresponding to the target file, use the unique file name as block index information, and record the identification information as account book data;

[0135] The identification information is uploaded to the blockchain network through the message queue, and the on-chain operation of the target file is identified by the identification information.

[0136] An embodiment of the present application also provides a computer-readable storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any information storage method recorded in the above method embodiments.

[0137] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any information storage method recorded in the above method embodiments.

[0138] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0139] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0140] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0141] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0142] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software program module.

[0143] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.

[0144] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the relevant hardware through a program, and the program may be stored in a computer-readable memory, which may include a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.

[0145] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An information storage method, characterized in that: Applicable to servers, including: The server obtains a target file, uploads the target file to an IPFS system, and generates identification information corresponding to the target file through the IPFS system, including: identifying the target file through the IPFS system to obtain content information in the target file; splitting the content information to obtain a plurality of sub-file content blocks; establishing a mapping relationship between the plurality of sub-file content blocks and a preset self-certification naming set to obtain a relationship tree structure, wherein each sub-file content block may correspond to a preset self-certification naming, wherein the preset self-certification naming set includes a plurality of preset self-certification namings, and the preset self-certification naming includes numeric characters and alphabetical characters; storing the plurality of preset self-certification namings in the preset self-certification naming set and their corresponding hash values ​​in the IPFS system; processing the plurality of sub-file content blocks through the IPFS system to generate identification information corresponding to the target file; Receive the identification information sent by the IPFS system, and synchronously store the identification information in a local database; Upload the identification information to the blockchain network through a message queue to complete the on-chain operation; The processing of the multiple sub-file content blocks by the IPFS system to generate identification information corresponding to the target file includes: storing the multiple sub-file content blocks in multiple nodes included in the IPFS system; performing hash coding on each of the multiple sub-file content blocks to generate multiple hash values; storing the multiple hash values ​​in multiple nodes of the IPFS system, wherein the multiple hash values ​​constitute the identification information, wherein the IPFS system includes multiple nodes, each node stores a hash table, wherein the hash table stores multiple hash values, and each hash value corresponds to a hash value corresponding to a sub-file content block; When a file search request initiated by a user is received, the to-be-searched file corresponding to the file search request and the target hash value corresponding to the to-be-searched file are determined; based on the target hash value, a search is performed in the IPFS system to obtain an index address; based on the index address, a node position corresponding to each of the multiple to-be-searched sub-file blocks in the to-be-searched file is obtained to obtain multiple node positions; based on the multiple node positions, a hash value corresponding to each sub-file block to be searched is obtained to obtain multiple sub-file hash values; based on the multiple sub-file hash values, a target self-certification naming set corresponding to the to-be-searched file is determined; and based on the target self-certification naming set and the target sub-file content blocks corresponding to each target self-certification naming in the target self-certification naming set, each target self-certification naming is replaced with its corresponding target sub-file content block; a target relationship tree structure corresponding to the target self-certification naming set is obtained; based on the target relationship tree structure, multiple target sub-file content blocks are assembled to obtain a target file corresponding to the to-be-searched file.

2. The method according to claim 1, characterized in that The uploading of the identification information to the blockchain network through a message queue to complete the on-chain operation includes: Obtain a unique file name corresponding to the target file, use the unique file name as block index information, and record the identification information as account book data; The identification information is uploaded to the blockchain network through the message queue, and the on-chain operation of the target file is identified by the identification information.

3. The method according to claim 2, characterized in that The method further comprises: Acquire first identification information corresponding to the target file from the blockchain network according to the unique file name, where the first identification information is uploaded by the IPFS system; Acquire second identification information stored in the local database for the target file, and match the first identification information with the second identification information; If the first identification information and the second identification information are inconsistent, it is determined that the target file has been tampered with.

4. The method according to claim 3, characterized in that The method further comprises: Within a preset period, a block is retrieved from the blockchain network according to the unique file name to obtain a current account book transaction record of the target file in the blockchain network, wherein the current account book transaction record includes first file information uploaded to the IPFS system, and the first file information includes a first hash value set; Obtaining second file information in the local database uploaded by the IPFS system to the local database, wherein the second file information includes a second hash value set; Comparing the first hash value set with the second hash value set, if the first hash value set is inconsistent with the second hash value set, determining that the target file in the IPFS system has been tampered with; Generate a prompt message indicating that the target file has been tampered with, and return the prompt message to the user through the message queue to inform the user that the target file has been tampered with.

5. An information storage device, the device being used to execute the method according to any one of claims 1 to 4, characterized in that: Applied to a server, the device comprises: a generation unit, a synchronization unit and an uplink operation unit, wherein: The generating unit is used to obtain a target file, upload the target file to the IPFS system, and generate identification information corresponding to the target file through the IPFS system; The synchronization unit is used to receive the identification information sent by the IPFS system and synchronously store the identification information into a local database; The on-chain operation unit is used to upload the identification information to the blockchain network through a message queue to complete the on-chain operation.

6. A server, characterized in that: The method comprises a processor, a communication interface, a memory and one or more programs, wherein the processor, the communication interface and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Contract management system and method based on block chain technology

    CN110532238A

  • Unmanned driving information storage method and device based on blockchain evidence storage

    CN110830547A

  • Invoice archiving method and device and computer readable storage medium

    CN111259217A