A file sharing method, electronic device, storage medium and program product

By splitting files into multiple file blocks on the client side and using a blockchain network to generate storage strategies, the problems of redundant storage and insufficient data security in file sharing are solved, achieving efficient file sharing and secure transmission.

CN122457591APending Publication Date: 2026-07-24INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2026-03-19
Publication Date
2026-07-24

Smart Images

  • Figure CN122457591A_ABST
    Figure CN122457591A_ABST
Patent Text Reader

Abstract

The application discloses a file sharing method, an electronic device, a storage medium and a program product, and comprises the following steps: in response to a file sharing request, a client splits a file to obtain a plurality of file blocks, determines a hash value of each file block, and determines at least one target file block to be shared according to the hash value; attribute information and the hash value of each target file block are sent to a server corresponding to a target service system, so that the server determines a target storage strategy according to a state index of each storage node in a block chain network and the attribute information of each target file block, and broadcasts the target storage strategy to the block chain network; the target storage strategy sent by the server is received, and each target file block is uploaded to a corresponding target storage node according to the target storage strategy. The technical scheme of the embodiment of the application can avoid file redundant transmission, improve file sharing efficiency, and ensure data security in the file sharing process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain technology, and in particular to a file sharing method, electronic device, storage medium, and program product. Background Technology

[0002] Business systems are typically the core platform for multi-role collaboration. After a client shares a file with the business system, multiple different business processing nodes within the system can access the file on a unified platform, thereby improving the operational efficiency of the business system.

[0003] In existing technologies, clients typically use third-party cloud services to share files with business systems. Because cloud services cannot distinguish between multiple files, each sharing process directly transmits the entire new file, resulting in redundant file storage, low transmission efficiency, and the risk of file tampering. Summary of the Invention

[0004] This invention provides a file sharing method, electronic device, storage medium, and program product, which can avoid redundant file transmission, improve file sharing efficiency, and ensure data security during the file sharing process.

[0005] According to one aspect of the present invention, a file sharing method is provided, the method being applied to a client, comprising: In response to a file sharing request, the file is split into multiple file blocks, the hash value of each file block is determined, and at least one target file block to be shared is determined based on the hash value. The attribute information and hash value of each target file block are sent to the server corresponding to the target business system, so that the server can determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and broadcast the target storage strategy to the blockchain network. The target storage strategy includes the target file block hash value corresponding to the target storage node; The system receives the target storage policy sent by the server and uploads each target file block to the corresponding target storage node according to the target storage policy.

[0006] According to another aspect of the present invention, a file sharing method is provided, the method being applied to a server corresponding to a target business system, comprising: Receive the attribute information and hash value of each target file block sent by the client, and determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block. The target storage strategy includes the target file block hash value corresponding to the target storage node; The target storage policy is sent to the client so that the client uploads each target file block to the corresponding target storage node according to the target storage policy.

[0007] According to another aspect of the present invention, a file sharing device is provided, the device being applied to a client, comprising: The file splitting module is used to split a file into multiple file blocks in response to a file sharing request, determine the hash value of each file block, and determine at least one target file block to be shared based on the hash value. The file information sending module is used to send the attribute information and hash value of each target file block to the server corresponding to the target business system, so that the server can determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and broadcast the target storage strategy to the blockchain network. The target storage strategy includes the target file block hash value corresponding to the target storage node; The file upload module is used to receive the target storage policy sent by the server and upload each target file block to the corresponding target storage node according to the target storage policy.

[0008] According to another aspect of the present invention, a file sharing device is provided, the device being applied to a server corresponding to a target business system, comprising: The file information receiving module is used to receive the attribute information and hash value of each target file block sent by the client, and determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block. The target storage strategy includes the target file block hash value corresponding to the target storage node; The storage policy sending module is used to send the target storage policy to the client, so that the client uploads each target file block to the corresponding target storage node according to the target storage policy.

[0009] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, which is then executed by the at least one processor to enable the at least one processor to perform the file sharing method described in any embodiment of the present invention.

[0010] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the file sharing method described in any embodiment of the present invention.

[0011] According to another aspect of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, implements the file sharing method described in any embodiment of the present invention.

[0012] The technical solution provided by this invention involves a client responding to a file sharing request by splitting a file into multiple file blocks, determining the hash value of each file block, identifying at least one target file block to be shared based on the hash value, and sending the attribute information and hash value of each target file block to the server corresponding to the target business system. This allows the server to determine a target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and broadcast the target storage strategy to the blockchain network. The method of receiving the target storage strategy sent by the server and uploading each target file block to the corresponding target storage node according to the target storage strategy can avoid redundant file transmission, improve file sharing efficiency, and ensure data security during the file sharing process.

[0013] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0015] Figure 1a This is a flowchart of a file sharing method provided according to an embodiment of the present invention; Figure 1b This is a schematic diagram illustrating a scenario applicable to a file sharing method provided by an embodiment of the present invention; Figure 2a This is a flowchart of another file sharing method provided according to an embodiment of the present invention; Figure 2b This is a schematic diagram of a hash tree structure corresponding to a storage node according to an embodiment of the present invention; Figure 2cThis is a schematic diagram of a hash tree structure corresponding to another storage node provided in an embodiment of the present invention; Figure 3 This is a flowchart of another file sharing method provided according to an embodiment of the present invention; Figure 4 This is a flowchart of another file sharing method provided according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of a file sharing device according to an embodiment of the present invention; Figure 6 This is a schematic diagram of another file sharing device provided according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of an electronic device that implements the file sharing method of this invention. Detailed Implementation

[0016] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0017] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0018] Figure 1a This is a flowchart illustrating a file-sharing method provided in an embodiment of the present invention. This embodiment is applicable to clients sharing files to storage nodes corresponding to target business systems. The method can be executed by a file-sharing device, which can be implemented in hardware and / or software and configured in the client, such as... Figure 1a As shown, the method includes: Step 110: In response to the file sharing request, the file is split into multiple file blocks, the hash value of each file block is determined, and at least one target file block to be shared is determined based on the hash value.

[0019] In this embodiment, a user can trigger a file sharing request through a client. The file sharing request includes the identifier of the file to be shared and the identifier of the target business system to be shared.

[0020] Specifically, Figure 1b This can be a schematic diagram illustrating a scenario applicable to a file sharing method in this embodiment, such as... Figure 1b As shown, users can share files to multiple business systems (e.g., business system A, business system B, business system C, and business system D) via a client. Each business system's server can connect to blockchain nodes and storage nodes in the local blockchain network. The number of blockchain nodes and storage nodes can be configured according to actual business needs; this implementation does not impose any limitations on this. The blockchain nodes corresponding to each business system can form a blockchain network used to store the storage information of each storage node. The storage nodes corresponding to each business system are used to store files uploaded by the client.

[0021] In this step, after the user triggers a file sharing request through the client, the client can divide the file to be shared into multiple file blocks according to the preset file block storage capacity. For example, assuming the file to be shared is 2.2MB in size and the preset file block storage capacity is 512KB, the file to be shared can be divided into 5 file blocks, of which 4 file blocks are 512KB in size and 1 file block is approximately 205KB in size.

[0022] In one specific embodiment, optionally, after splitting the file into multiple file blocks, a hash function can be used to determine the hash value of each file block. Then, the hash value of each file block is compared with the hash values ​​of each file block in the historical file sharing process, and the target file block that has changed is selected based on the comparison results.

[0023] Step 120: Send the attribute information and hash value of each target file block to the server corresponding to the target business system, so that the server can determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and broadcast the target storage strategy to the blockchain network.

[0024] In this step, the attribute information of the target file block may include information such as file name, file size, author, creation time, and modification time. After the client sends the attribute information and hash value of each target file block to the server corresponding to the target business system, the server can obtain the status indicators of each storage node through the local blockchain network, such as network bandwidth, network latency, storage node busyness, distance between storage nodes, and performance configuration information. Then, based on these status indicators and the attribute information of the target file blocks, it filters out the storage nodes with good operating conditions (i.e., the target storage nodes) and generates a target storage strategy. The target storage strategy includes the hash value of the target file block corresponding to the target storage node.

[0025] In addition, the server can also broadcast the target storage policy to the blockchain network so that each blockchain node in the blockchain network can verify the target file block in the target storage node to prevent the target file block from being tampered with.

[0026] In one specific embodiment, each blockchain node in the blockchain network can periodically (e.g., once every 5 minutes) query the status indicators of each storage node and broadcast these status indicators to the blockchain network. The performance configuration information of the storage nodes (e.g., central server configuration, memory configuration, etc.), network bandwidth, and distance information are typically preset fixed information. The blockchain nodes need to use the storage nodes' Internet Protocol (IP) addresses and port information to call the storage nodes' query information interfaces to obtain dynamic indicators such as network latency and storage node activity.

[0027] Step 130: Receive the target storage policy sent by the server, and upload each target file block to the corresponding target storage node according to the target storage policy.

[0028] In this step, the client can upload each target file block to the target storage node according to the correspondence between the hash value of each target file block and the target storage node in the target storage policy.

[0029] In this embodiment, for a file sharing request triggered by a user, it is not necessary to store the entire file to the storage node corresponding to the business system. Only the modified file blocks need to be stored, thereby avoiding redundant file transmission. Secondly, the server corresponding to the business system can improve the efficiency of file sharing by selecting storage nodes with good conditions to upload file blocks. Furthermore, by using a blockchain network to record the hash value of the file blocks on the storage nodes, it is possible to prevent the file blocks on the storage nodes from being tampered with, thereby ensuring the data security of the file sharing process.

[0030] The technical solution provided by this invention involves a client responding to a file sharing request by splitting a file into multiple file blocks, determining the hash value of each file block, identifying at least one target file block to be shared based on the hash value, and sending the attribute information and hash value of each target file block to the server corresponding to the target business system. This allows the server to determine a target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and broadcast the target storage strategy to the blockchain network. The method of receiving the target storage strategy sent by the server and uploading each target file block to the corresponding target storage node according to the target storage strategy can avoid redundant file transmission, improve file sharing efficiency, and ensure data security during the file sharing process.

[0031] Figure 2a A flowchart of another file sharing method provided in an embodiment of the present invention, such as... Figure 2a As shown, this method is applied to the client and includes: Step 210: In response to the file sharing request, the file is split into multiple file blocks, the hash value of each file block is determined, and at least one target file block to be shared is determined based on the hash value.

[0032] Step 220: Use the hash value of each target file block as the leaf node of the hash tree structure.

[0033] Step 230: Concatenate the hash values ​​corresponding to adjacent leaf nodes, then perform hash processing on the concatenation result, and use the processing result as the intermediate node.

[0034] Step 240: Take the intermediate node as the new leaf node, concatenate the hash values ​​corresponding to the adjacent leaf nodes again, and perform hash processing on the concatenation result until a unique hash value is generated.

[0035] In this step, the intermediate node can be used as a new leaf node, and then the operation of concatenating the hash values ​​corresponding to the adjacent leaf nodes is performed, and the concatenation result is hashed until a unique hash value is generated.

[0036] Step 250: Use the generated unique hash value as the root node of the hash tree structure.

[0037] The advantage of this setup is that when the shared files corresponding to the business system are very large, by constructing a hash tree structure for the files, the specific file blocks that have been tampered with can be quickly located based on the hash value of the root node. This can save the verification time of shared files in the business system and improve verification efficiency.

[0038] Step 260: Send the attribute information of each target file block, the leaf node information and the root node information of the hash tree structure to the server corresponding to the target business system, so that the server can determine the target storage strategy and broadcast the target storage strategy to the blockchain network.

[0039] In this step, specifically, the leaf node information may include the hash value, block number, and block size of the target file block corresponding to each leaf node. The root node information may include the root node hash value.

[0040] The advantage of this setup is that by sending the leaf node information and root node information of the hash tree structure to the server corresponding to the target business system, the client can facilitate the server to quickly determine the target storage node corresponding to the hash tree structure, thereby improving the efficiency of generating the target storage strategy.

[0041] In this embodiment, optionally, the server can establish a first target optimization model based on the attribute information of each target file block and the status indicators of each storage node, and then solve the first target optimization model for the optimal solution; based on the solution result corresponding to the first target optimization model, the leaf node information and root node information of the hash tree structure, the hash tree structure information corresponding to the target storage node is determined, and the hash tree structure information corresponding to the target storage node is used as the target storage strategy.

[0042] Specifically, the first objective optimization model can take maximizing storage efficiency and maximizing storage resource utilization as optimization objectives. After solving the first objective optimization model, the solution result can include the mapping relationship between each target file block and the target storage node. After obtaining the mapping relationship, the server can determine the hash tree structure information corresponding to the target storage node based on the hash tree structure of the target file block.

[0043] The advantage of this setup is that by sending the hash tree structure information corresponding to the target storage node to the client as the target storage strategy, the client can quickly obtain the mapping relationship between each target file block and the target storage node, thereby improving the file upload efficiency.

[0044] In an optional implementation, assuming the client divides the file to be shared into 5 target file blocks, if a certain storage node has sufficient storage resources, all 5 target file blocks can be uploaded to that storage node. That is, the hash tree structure information corresponding to that storage node can be as follows: Figure 2b As shown.

[0045] In another alternative implementation, assuming the client divides the file to be shared into 5 target file blocks, and only two of the storage nodes corresponding to the target business system have remaining storage space, then these 5 target file blocks can be distributed and uploaded to each storage node. For example, one storage node can upload 2 target file blocks, and another storage node can upload 3 target file blocks. The hash tree structure information corresponding to this storage node can be as follows: Figure 2c As shown.

[0046] Step 270: Receive the target storage policy sent by the server, and upload each target file block to the corresponding target storage node according to the target storage policy.

[0047] Step 280: Update the completion flag corresponding to the target storage strategy in the blockchain network so that each blockchain node in the blockchain network can trace the storage status of each target file block according to the completion flag.

[0048] In this step, after the client uploads all target file blocks to the target storage node, it can update the completion flag corresponding to the target storage strategy in the blockchain network.

[0049] The advantage of this setup is that it allows each blockchain node to easily trace the storage status of each target file block, preventing the target file blocks from being tampered with, thereby improving the data integrity of shared files in the business system.

[0050] In one embodiment of this example, the method further includes: in response to a file download request, sending the root node hash value corresponding to the file to be downloaded to the server corresponding to the target business system, so that the server determines a target download strategy based on the status indicators of each storage node corresponding to the root node hash value in the blockchain network; wherein, the target download strategy includes the target download nodes corresponding to the hash values ​​of each file block in the file to be downloaded; receiving the target download strategy sent by the server, downloading each file block from each target download node according to the target download strategy, and merging the downloaded file blocks.

[0051] In this embodiment, the file download request may specifically include the identifier of the file to be downloaded and the identifier of the target business system. After the client sends the root node hash value of the file to be downloaded to the server corresponding to the target business system, the server can quickly obtain the storage node information corresponding to all file blocks based on the root node hash value. Then, it selects the storage nodes with good operating conditions (i.e., the target download nodes) based on the status indicators of each storage node and generates a target download strategy. The target download strategy includes the file block hash value corresponding to the target download node.

[0052] The advantage of this setting is that it can save time and resources consumed during the file download process and improve file download efficiency.

[0053] The technical solution provided by this invention, in response to a file sharing request, splits a file into multiple file blocks, determines the hash value of each file block, identifies at least one target file block to be shared based on the hash value, uses the hash value of each target file block as a leaf node of a hash tree structure, concatenates the hash values ​​corresponding to adjacent leaf nodes, hashes the concatenation result, uses the intermediate node as a new leaf node, and concatenates the hash values ​​corresponding to adjacent leaf nodes again until a unique hash value is generated. This unique hash value is used as the root node of the hash tree structure. The attribute information of each target file block, the leaf node information of the hash tree structure, and the root node information are sent to the server corresponding to the target business system. This allows the server to determine the target storage strategy and broadcast the target storage strategy to the blockchain network. Upon receiving the target storage strategy from the server, the system uploads each target file block to the corresponding target storage node according to the target storage strategy and updates the completion flag corresponding to the target storage strategy in the blockchain network. This technical approach avoids redundant file transmission, improves file sharing efficiency, and ensures data security during the file sharing process.

[0054] Figure 3 This is a flowchart illustrating a file-sharing method provided in an embodiment of the present invention. This embodiment is applicable to sharing files between a storage node corresponding to a target business system and a client. The method can be executed by a file-sharing device, which can be implemented in hardware and / or software and configured in the server corresponding to the target business system, such as... Figure 3 As shown, the method includes: Step 310: Receive the attribute information and hash value of each target file block sent by the client, and determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block. The target storage strategy includes the target file block hash value corresponding to the target storage node.

[0055] Step 320: Send the target storage policy to the client so that the client uploads each target file block to the corresponding target storage node according to the target storage policy.

[0056] The technical solution provided by this invention involves a server receiving attribute information and hash values ​​of each target file block sent by a client, determining a target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and sending the target storage strategy to the client. This allows the client to upload each target file block to the corresponding target storage node according to the target storage strategy. This approach avoids redundant file transmission, improves file sharing efficiency, and ensures data security during the file sharing process.

[0057] Figure 4 A flowchart of another file sharing method provided in an embodiment of the present invention, such as... Figure 4 As shown, this method is applied to the server side corresponding to the target business system, including: Step 410: Receive the attribute information of each target file block, the leaf node information and the root node information of the hash tree structure sent by the client, and obtain the status indicators of each storage node in the blockchain network.

[0058] Step 420: Based on the attribute information of each target file block and the status indicators of each storage node, establish a first target optimization model and solve the optimal solution for the first target optimization model.

[0059] Step 430: Based on the solution results corresponding to the first target optimization model, the leaf node information and root node information of the hash tree structure, determine the hash tree structure information corresponding to the target storage node.

[0060] Step 440: Send the hash tree structure information corresponding to the target storage node to the client so that the client can upload each target file block to the corresponding target storage node.

[0061] In this embodiment, the client can upload each target file block to the corresponding target storage node according to the hash tree structure information corresponding to the target storage node.

[0062] Step 450: Broadcast the hash tree structure information corresponding to the target storage node to the blockchain network so that each blockchain node in the blockchain network can verify the target file block in the target storage node.

[0063] The advantage of this setup is that by broadcasting the hash tree structure information corresponding to the target storage node to the blockchain network, each blockchain node can quickly verify the target file blocks on each target storage node based on the hash tree structure information, thereby improving the verification efficiency of shared files in the business system and ensuring the data security of shared files.

[0064] In one embodiment of this example, the method further includes: receiving the root node hash value corresponding to the file to be downloaded sent by the client; querying the status indicators of each storage node corresponding to the root node hash value in the blockchain network, as well as the attribute information of each file block in the file to be downloaded; establishing a second objective optimization model based on the attribute information of each file block in the file to be downloaded and the status indicators of each storage node, and solving the second objective optimization model for the optimal solution; determining the hash tree structure information corresponding to the target download node based on the solution result corresponding to the second objective optimization model, and sending the hash tree structure information corresponding to the target download node to the client.

[0065] In one specific embodiment, the second objective optimization model can take maximizing download efficiency and maximizing storage resource utilization as optimization objectives. After solving the second objective optimization model, the solution result can include the mapping relationship between each file block and the target download node. After obtaining the mapping relationship, the server can determine the hash tree structure information corresponding to the target download node based on the hash tree structure of each file block. After receiving the hash tree structure information corresponding to the target download node, the client can download each file block from each target download node and merge the downloaded file blocks.

[0066] The advantage of this setup is that by combining the attribute information of each file block in the file to be downloaded with the status indicators of each storage node, a second objective optimization model can be established. This model can accurately and effectively determine the optimal download method for each file block, thereby improving file download efficiency with minimal impact on the current running data of the storage node.

[0067] In one specific embodiment, after determining the hash tree structure information corresponding to the target download node, the method further includes: broadcasting the hash tree structure information corresponding to the target download node to the blockchain network, so that each blockchain node in the blockchain network can trace the storage status of each file block.

[0068] The advantage of this setup is that by broadcasting the hash tree structure information corresponding to the target download node to the blockchain network, each blockchain node can quickly verify the file blocks on each target download node based on the hash tree structure information, thereby ensuring the data security of files in the business system.

[0069] The technical solution provided by this invention involves a server receiving attribute information of each target file block, leaf node information, and root node information of a hash tree structure from a client, and obtaining status indicators of each storage node in the blockchain network. Based on the attribute information of each target file block and the status indicators of each storage node, a first target optimization model is established, and the optimal solution is obtained from the first target optimization model. Based on the solution result of the first target optimization model and the leaf node and root node information of the hash tree structure, the hash tree structure information corresponding to the target storage node is determined. The hash tree structure information corresponding to the target storage node is then sent to the client, enabling the client to upload each target file block to the corresponding target storage node. Broadcasting the hash tree structure information corresponding to the target storage node to the blockchain network avoids redundant file transmission, improves file sharing efficiency, and ensures data security during the file sharing process.

[0070] Figure 5 This is a schematic diagram of a file-sharing device provided in an embodiment of the present invention. The device is applied to a client, such as... Figure 5 As shown, it includes: a file splitting module 510, a file information sending module 520, and a file uploading module 530.

[0071] The file splitting module 510 is used to split a file into multiple file blocks in response to a file sharing request, determine the hash value of each file block, and determine at least one target file block to be shared based on the hash value. The file information sending module 520 is used to send the attribute information and hash value of each target file block to the server corresponding to the target business system, so that the server can determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and broadcast the target storage strategy to the blockchain network. The target storage strategy includes the target file block hash value corresponding to the target storage node; The file upload module 530 is used to receive the target storage policy sent by the server and upload each target file block to the corresponding target storage node according to the target storage policy.

[0072] The technical solution provided by this invention involves a client responding to a file sharing request by splitting a file into multiple file blocks, determining the hash value of each file block, identifying at least one target file block to be shared based on the hash value, and sending the attribute information and hash value of each target file block to the server corresponding to the target business system. This allows the server to determine a target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and broadcast the target storage strategy to the blockchain network. The method of receiving the target storage strategy sent by the server and uploading each target file block to the corresponding target storage node according to the target storage strategy can avoid redundant file transmission, improve file sharing efficiency, and ensure data security during the file sharing process.

[0073] Based on the above embodiments, the file splitting module 510 includes: The hash tree building unit is used to take the hash value of each target file block as the leaf node of the hash tree structure; concatenate the hash values ​​corresponding to adjacent leaf nodes, then perform hash processing on the concatenation result, and take the processing result as the intermediate node; take the intermediate node as the new leaf node, and then return to perform the operation of concatenating the hash values ​​corresponding to adjacent leaf nodes until a unique hash value is generated, and take the unique hash value as the root node of the hash tree structure.

[0074] The file information sending module 520 includes: The hash tree information sending unit is used to send the attribute information of each target file block, the leaf node information and the root node information of the hash tree structure to the server corresponding to the target business system.

[0075] The file upload module 530 includes: The flag update unit is used to update the completion flag corresponding to the target storage strategy in the blockchain network, so that each blockchain node in the blockchain network can trace the storage status of each target file block according to the completion flag.

[0076] The device further includes: The file download module is used to respond to a file download request by sending the root node hash value corresponding to the file to be downloaded to the server corresponding to the target business system. This allows the server to determine the target download strategy based on the status indicators of each storage node corresponding to the root node hash value in the blockchain network. The target download strategy includes the target download nodes corresponding to the hash values ​​of each file block in the file to be downloaded. The module receives the target download strategy sent by the server, downloads each file block from each target download node according to the target download strategy, and merges the downloaded file blocks.

[0077] The above-described apparatus can execute the methods provided in all the foregoing embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the above methods. Technical details not described in detail in the embodiments of the present invention can be found in the methods provided in all the foregoing embodiments of the present invention.

[0078] Figure 6 This is a schematic diagram of another file sharing device provided in an embodiment of the present invention. The device is applied to the server corresponding to the target business system and includes: a file information receiving module 610 and a storage policy sending module 620.

[0079] The file information receiving module 610 is used to receive the attribute information and hash value of each target file block sent by the client, and determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block. The target storage strategy includes the target file block hash value corresponding to the target storage node; The storage policy sending module 620 is used to send the target storage policy to the client, so that the client uploads each target file block to the corresponding target storage node according to the target storage policy.

[0080] The technical solution provided by this invention involves a server receiving attribute information and hash values ​​of each target file block sent by a client, determining a target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and sending the target storage strategy to the client. This allows the client to upload each target file block to the corresponding target storage node according to the target storage strategy. This approach avoids redundant file transmission, improves file sharing efficiency, and ensures data security during the file sharing process.

[0081] Based on the above embodiments, the file information receiving module 610 includes: The optimization model building unit is used to receive attribute information of each target file block, leaf node information and root node information of the hash tree structure sent by the client, and obtain the status indicators of each storage node in the blockchain network; based on the attribute information of each target file block and the status indicators of each storage node, a first target optimization model is established, and the optimal solution is obtained for the first target optimization model; based on the solution result corresponding to the first target optimization model, the leaf node information and root node information of the hash tree structure, the hash tree structure information corresponding to the target storage node is determined. The hash tree information broadcasting unit is used to broadcast the hash tree structure information corresponding to the target storage node to the blockchain network, so that each blockchain node in the blockchain network can verify the target file block in the target storage node.

[0082] The device further includes: The download strategy determination module receives the root node hash value corresponding to the file to be downloaded sent by the client, queries the status indicators of each storage node corresponding to the root node hash value in the blockchain network, and the attribute information of each file block in the file to be downloaded; based on the attribute information of each file block in the file to be downloaded and the status indicators of each storage node, it establishes a second objective optimization model and solves the optimal solution of the second objective optimization model; based on the solution result of the second objective optimization model, it determines the hash tree structure information corresponding to the target download node and sends the hash tree structure information corresponding to the target download node to the client.

[0083] The download strategy determination module includes: The download strategy broadcasting unit is used to broadcast the hash tree structure information corresponding to the target download node to the blockchain network, so that each blockchain node in the blockchain network can trace the storage status of each file block.

[0084] The above-described apparatus can execute the methods provided in all the foregoing embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the above methods. Technical details not described in detail in the embodiments of the present invention can be found in the methods provided in all the foregoing embodiments of the present invention.

[0085] Figure 7 A schematic diagram of the structure of an electronic device 10 that can be used to implement embodiments of the present invention is shown. For example... Figure 7 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from the storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0086] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0087] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processing (DSP) processors, and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as file sharing methods.

[0088] In some embodiments, the file-sharing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the file-sharing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the file-sharing method by any other suitable means (e.g., by means of firmware).

[0089] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chips (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0090] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0091] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0092] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD)) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0093] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0094] A computing system can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system. It addresses the shortcomings of traditional physical hosts and Virtual Private Servers (VPS) in terms of management difficulty and weak business scalability.

[0095] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0096] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A file sharing method, characterized in that, The method is applied to the client and includes: In response to a file sharing request, the file is split into multiple file blocks, the hash value of each file block is determined, and at least one target file block to be shared is determined based on the hash value. The attribute information and hash value of each target file block are sent to the server corresponding to the target business system, so that the server can determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, and broadcast the target storage strategy to the blockchain network. The target storage strategy includes the target file block hash value corresponding to the target storage node; The system receives the target storage policy sent by the server and uploads each target file block to the corresponding target storage node according to the target storage policy.

2. The method according to claim 1, characterized in that, After identifying at least one target file block to be shared, the process includes: Use the hash value of each target file block as a leaf node in the hash tree structure; The hash values ​​corresponding to adjacent leaf nodes are concatenated, the concatenation result is hashed, and the result is used as the intermediate node. The intermediate node is used as a new leaf node, and then the operation of concatenating the hash values ​​corresponding to adjacent leaf nodes is performed until a unique hash value is generated, and the unique hash value is used as the root node of the hash tree structure.

3. The method according to claim 2, characterized in that, Send the attribute information and hash value of each target file block to the server corresponding to the target business system, including: The attribute information of each target file block, the leaf node information and the root node information of the hash tree structure are sent to the server corresponding to the target business system.

4. The method according to claim 1, characterized in that, After uploading each target file block to the corresponding target storage node according to the target storage strategy, the method further includes: The completion flag corresponding to the target storage strategy in the blockchain network is updated so that each blockchain node in the blockchain network can trace the storage status of each target file block according to the completion flag.

5. The method according to claim 2, characterized in that, The method further includes: In response to a file download request, the root node hash value corresponding to the file to be downloaded is sent to the server corresponding to the target business system, so that the server can determine the target download strategy based on the status indicators of each storage node corresponding to the root node hash value in the blockchain network. The target download strategy includes the target download node corresponding to the hash value of each file block in the file to be downloaded; The system receives the target download strategy sent by the server, downloads each file block from each target download node according to the target download strategy, and merges the downloaded file blocks.

6. A file sharing method, characterized in that, The method is applied to the server-side corresponding to the target business system, including: Receive the attribute information and hash value of each target file block sent by the client, and determine the target storage strategy based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block. The target storage strategy includes the target file block hash value corresponding to the target storage node; The target storage policy is sent to the client so that the client uploads each target file block to the corresponding target storage node according to the target storage policy.

7. The method according to claim 6, characterized in that, The system receives attribute information and hash values ​​of each target file block sent by the client. Based on the status indicators of each storage node in the blockchain network and the attribute information of each target file block, it determines the target storage strategy, including: It receives attribute information of each target file block, leaf node information and root node information of the hash tree structure sent by the client, and obtains the status indicators of each storage node in the blockchain network. Based on the attribute information of each target file block and the status indicators of each storage node, a first target optimization model is established, and the optimal solution is obtained from the first target optimization model. Based on the solution results corresponding to the first objective optimization model, the leaf node information and root node information of the hash tree structure, the hash tree structure information corresponding to the target storage node is determined.

8. The method according to claim 7, characterized in that, After determining the hash tree structure information corresponding to the target storage node, the following is also included: The hash tree structure information corresponding to the target storage node is broadcast to the blockchain network so that each blockchain node in the blockchain network can verify the target file block in the target storage node.

9. The method according to claim 6, characterized in that, The method further includes: The system receives the root node hash value corresponding to the file to be downloaded sent by the client, queries the status indicators of each storage node corresponding to the root node hash value in the blockchain network, and the attribute information of each file block in the file to be downloaded. Based on the attribute information of each file block in the file to be downloaded and the status indicators of each storage node, a second objective optimization model is established, and the optimal solution of the second objective optimization model is obtained. Based on the solution results of the second objective optimization model, determine the hash tree structure information corresponding to the target download node, and send the hash tree structure information corresponding to the target download node to the client.

10. The method according to claim 9, characterized in that, After determining the hash tree structure information corresponding to the target download node, the following is also included: The hash tree structure information corresponding to the target download node is broadcast to the blockchain network so that each blockchain node in the blockchain network can trace the storage status of each file block.

11. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the file sharing method according to any one of claims 1-5 or 6-10.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the file-sharing method according to any one of claims 1-5 or 6-10.

13. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the file sharing method according to any one of claims 1-5 or 6-10.