Block file storage method and device, storage medium and electronic equipment
By deploying a target network based on a distributed file system in the consortium chain and slicing block files, the problems of data security and storage efficiency in centralized management mode are solved, and the effect of reducing node storage pressure and improving data security is achieved.
Patent Information
- Application Number
- CN202411706843.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When storing block files, the alliance chain system adopts a centralized management model to cause a high risk of data loss, and increases the storage pressure of the server and reduces storage efficiency.
Through the high-availability cluster management tool in the target network, block files generated by the consortium chain are received, and distributed storage strategies are adopted to store block files into storage devices associated with multiple blockchain nodes in the target network.
It realizes reducing node storage pressure in the consortium chain, avoiding the pressure of storing complete block files in a single node, and greatly improving data security and storage efficiency.
Smart Images

Figure CN119583577A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a method, device, storage medium and electronic device for storing block files. Background Art
[0002] A consortium chain is a blockchain system jointly participated and maintained by multiple commercial organizations or enterprises. Compared with a public chain, a consortium chain is jointly built by multiple enterprises or institutions, which can create a more secure, efficient and reliable internal or cross-organizational blockchain network for enterprises. For example, enterprises can use consortium chains for transactions, and enterprises can use consortium chains for data sharing. The reliability of a consortium chain is higher than that of a public chain, because each enterprise or institution will store the status information of the consortium chain locally, and the enterprise has a stricter privacy protection mechanism.
[0003] However, the alliance chain system in the related art adopts a centralized management mode when storing block files, that is, the alliance chain system (or node management tool) records all block file contents. Since all block files are centrally stored in the server in the centralized management mode, when the server fails, it is easy to cause data loss and affect data security. At the same time, the centralized management mode will increase the storage pressure of the server and reduce the storage efficiency of the server.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a block file storage method, device, storage medium and electronic device to at least solve the technical problem in the related art that all block files of the alliance chain are completely stored in all nodes in the alliance chain, resulting in high storage pressure on a single node.
[0006] According to one aspect of an embodiment of the present invention, a block file storage method is provided, comprising: receiving a block file generated by a consortium chain through a high-availability cluster management tool in a target network, wherein the nodes in the target network include: blockchain nodes in the consortium chain, and the target network refers to a network built based on a distributed file system; and using the high-availability cluster management tool, adopting a distributed storage strategy to store the block file shards in storage devices associated with multiple blockchain nodes in the target network.
[0007] Furthermore, after the block file is distributedly stored in the storage devices associated with multiple blockchain nodes of the target network through the high-availability cluster management tool, it also includes: converting the content of the block file into a hash value through the high-availability cluster management tool to obtain a target hash value; broadcasting the target hash value to all blockchain nodes in the target network, so that the blockchain nodes in the target network can verify the integrity of the block file.
[0008] Furthermore, the types of blockchain nodes in the target network include: servers. Before receiving the block files generated by the alliance chain through the high-availability cluster management tool in the target network, it also includes: installing the distributed file system on the target server, and configuring target parameters on the target server to obtain the configured target server, wherein the target parameters include: parameters required for the target server to communicate in the target network; connecting the configured target server to the target network, and using the configured target server as a blockchain node in the alliance chain.
[0009] Furthermore, connecting the configured target server to the target network includes: acquiring a secret key of the configured target server to obtain a target secret key; verifying the configured target server based on the target secret key to obtain a verification result; and connecting the configured target server to the target network when the verification result indicates that the configured target server has passed the verification.
[0010] Furthermore, before receiving the block file generated by the alliance chain through the high-availability cluster management tool in the target network, it also includes: when the block file is generated in the alliance chain, uploading the block file to the target network based on the application programming interface of the target network; before uploading the block file to the target network, it also includes: encrypting the block file using an encryption algorithm.
[0011] Furthermore, the block file storage method also includes: during the operation of the target network, collecting log data generated by the target network to obtain target log data; based on the target log data, analyzing whether there is a fault in the target network to obtain an analysis result.
[0012] Furthermore, the distributed file system includes: InterPlanetary File System.
[0013] According to another aspect of an embodiment of the present invention, a storage device for block files is also provided, including: a receiving unit, used to receive block files generated by a consortium chain through a high-availability cluster management tool in a target network, wherein the nodes in the target network include: blockchain nodes in the consortium chain, and the target network refers to a network built based on a distributed file system; a storage unit, used to store the block file shards in storage devices associated with multiple blockchain nodes in the target network using a distributed storage strategy through the high-availability cluster management tool.
[0014] Furthermore, the storage device of the block file also includes: a conversion unit, which is used to convert the content of the block file into a hash value through the high-availability cluster management tool to obtain a target hash value after the block file is distributedly stored in the storage devices associated with multiple blockchain nodes of the target network through the high-availability cluster management tool; and a broadcasting unit, which is used to broadcast the target hash value to all blockchain nodes in the target network so that the blockchain nodes in the target network can verify the integrity of the block file.
[0015] Furthermore, the types of blockchain nodes in the target network include: servers, and the storage device of block files also includes: a first processing unit, used to install the distributed file system on the target server before receiving the block file generated by the alliance chain through the high-availability cluster management tool in the target network, and configure the target parameters on the target server to obtain the configured target server, wherein the target parameters include: parameters required for the target server to communicate in the target network; a second processing unit, used to connect the configured target server to the target network, and use the configured target server as a blockchain node in the alliance chain.
[0016] Furthermore, the second processing unit includes: an acquisition subunit, used to acquire the secret key of the configured target server to obtain the target secret key; a verification subunit, used to verify the configured target server based on the target secret key to obtain a verification result; and an access subunit, used to connect the configured target server to the target network when the verification result indicates that the configured target server has passed the verification.
[0017] Furthermore, the storage device of the block file also includes: an uploading unit, which, before receiving the block file generated by the alliance chain through the high-availability cluster management tool in the target network, uploads the block file to the target network based on the application programming interface of the target network when the block file is generated in the alliance chain; and an encryption unit, which is used to encrypt the block file using an encryption algorithm before uploading the block file to the target network.
[0018] Furthermore, the storage device of the block file also includes: a collection unit, which is used to collect log data generated by the target network during the operation of the target network to obtain target log data; and an analysis unit, which is used to analyze whether there is a fault in the target network based on the target log data to obtain an analysis result.
[0019] Furthermore, the distributed file system includes: InterPlanetary File System.
[0020] According to another aspect of an embodiment of the present invention, an electronic device is provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any of the above-mentioned block file storage methods by executing the executable instructions.
[0021] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned block file storage methods.
[0022] In the present invention, the block files generated by the alliance chain are received through the high-availability cluster management tool in the target network, wherein the nodes in the target network include: the blockchain nodes in the alliance chain, and the target network refers to a network built based on a distributed file system; through the high-availability cluster management tool, a distributed storage strategy is adopted to store the block files in pieces in the storage devices associated with multiple blockchain nodes in the target network. This solves the technical problem in the related art that all block files of the alliance chain are completely stored in all nodes in the alliance chain, resulting in high storage pressure on a single node.
[0023] In the present invention, a target network built based on a distributed file system is deployed in the alliance chain. After the alliance chain generates a new block file, the block file can be fragmented and stored in multiple nodes in the target network, avoiding the situation where all nodes in the alliance chain need to store complete block files and the storage pressure of a single node is large, thereby achieving the technical effect of reducing the storage pressure of nodes in the alliance chain. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0025] Figure 1 is a flowchart of an optional block file storage method according to an embodiment of the present invention;
[0026] Figure 2 is an architecture diagram of an optional target network according to an embodiment of the present invention;
[0027] Figure 3 is a schematic diagram of an optional storage device for block files according to an embodiment of the present invention;
[0028] Figure 4 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. 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 necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] It should be noted that the user information (including but not limited to user device information, user personal information, etc.), collected information and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0032] Embodiment 1
[0033] According to an embodiment of the present invention, a method embodiment of an optional block file storage method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0034] Figure 1 is a flowchart of an optional block file storage method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0035] Step S101, receiving the block file generated by the alliance chain through the high-availability cluster management tool in the target network, wherein the nodes in the target network include: the blockchain nodes in the alliance chain, and the target network refers to a network built based on a distributed file system.
[0036] The above-mentioned consortium chain is a semi-private blockchain form that allows a group of authorized participants to jointly maintain the blockchain network and conduct transactions and data sharing in the network. It can be applied to the financial industry, supply chain management, copyright protection and other fields.
[0037] The above-mentioned target network may include a network built on a distributed file system, such as the Interplanetary File System (IPFS), which uses a new decentralized storage solution with high throughput, content addressing, distributed storage and other characteristics. The Interplanetary File System can achieve global decentralized storage and fast access to files by converting file content into hash values and using the hash values as the unique identifier of the file. The target network refers to a network composed of some or all nodes in the alliance chain and running a private IPFS protocol. These nodes can be selected and configured as storage nodes for storing and backing up shards of block files.
[0038] The above-mentioned high-availability cluster management tool can be IPFS-Cluster, which can allocate, replicate and track pins (the location of fixed files in the Interstellar File System) across a group of Interstellar File System daemons to ensure data redundancy and availability. By deploying IPFS-Cluster, distributed storage and efficient management of block files can be achieved.
[0039] In this embodiment, a part (or all) of the existing nodes in the alliance chain can be selected as participants in the private IPFS network (corresponding to the target network). These participants generally need to undergo strict identity authentication and authorization to ensure that they have sufficient trust and reliability. The authentication process can include steps such as digital certificate verification and key exchange to ensure secure communication between nodes.
[0040] In this embodiment, the block file generated by the alliance chain is received through the high-availability cluster management tool in the target network.
[0041] Step S102, through a high-availability cluster management tool, a distributed storage strategy is adopted to store block file fragments in storage devices associated with multiple blockchain nodes in the target network.
[0042] Through high-availability cluster management tools, a distributed storage strategy is used to store block files in fragments in storage devices associated with multiple blockchain nodes in the target network. For example, smart contracts can be used to fragment block files and then store them in distributed form on blockchain nodes. Using the decentralized nature of IPFS, block files are stored in multiple nodes in a distributed manner, effectively avoiding the risk of single point failure and data loss.
[0043] In this embodiment, block file sharding refers to dividing a larger block file into multiple smaller fragments, which can be stored independently on different storage devices to improve the efficiency and security of data storage. The sharding strategy can be adjusted according to factors such as file size, network bandwidth, and available space on storage nodes. After the alliance chain generates a new block file, the data sharding function in IPFS-Cluster can be used to divide the block file into multiple fragments. The size and number of shards can be dynamically adjusted according to actual needs and network conditions to ensure that data can be efficiently stored and quickly accessed.
[0044] In IPFS-Cluster, a distributed storage strategy can be set, such as a data redundancy strategy and a node selection strategy. The data redundancy strategy ensures that each block file shard is backed up on multiple nodes, so that even if a node fails, the data is still accessible. The node selection strategy automatically selects the best node to store the data shard based on indicators such as the node's health, storage capacity, and network latency. In this embodiment, the data shards can be automatically allocated to storage devices associated with multiple blockchain nodes in the target network for storage. In an optional example, redundant copies can also be automatically created for each data shard on multiple nodes to ensure high availability and persistence of the data.
[0045] In this embodiment, through the above steps, a target network built based on a distributed file system is deployed in the alliance chain. After the alliance chain generates a new block file, the block file can be fragmented and stored in multiple nodes in the target network, avoiding the situation where all nodes in the alliance chain need to store complete block files and the storage pressure of a single node is large, thereby achieving the technical effect of reducing the storage pressure of nodes in the alliance chain. In addition, the technical problem that all block files of the alliance chain are completely stored in all nodes in the alliance chain and the storage pressure of a single node is large in the related technology is solved.
[0046] Figure 2 is an optional architecture diagram of a target network according to an embodiment of the present invention, such as Figure 2 As shown, it includes multiple chain nodes (i.e., blockchain nodes) and IPFS-Cluster (a high-availability cluster management tool) deployed in multiple storage spaces in the IPFS network. After generating block files, the chain nodes can upload them to the IPFS-Cluster, and the IPFS-Cluster will store the block files in pieces in the storage spaces of multiple storage devices in the IPFS network.
[0047] Optionally, after the block file is distributedly stored in storage devices associated with multiple blockchain nodes of the target network through a high-availability cluster management tool, it also includes: converting the content of the block file into a hash value through the high-availability cluster management tool to obtain a target hash value; broadcasting the target hash value to all blockchain nodes in the target network, so that the blockchain nodes in the target network can verify the integrity of the block file.
[0048] In this embodiment, when a blockchain node in a target network successfully uploads a block file, the hash value of the file can be broadcast to other nodes in the network. After receiving this information, other nodes will actively download and verify the integrity and correctness of the block file from the network. In this way, the consistency and up-to-dateness of the block data in the entire network can be ensured.
[0049] For example, after generating a target hash value, IPFS-Cluster can encapsulate the target hash value and some necessary metadata (such as file size, creation time, etc.) into a message, and broadcast the message to all blockchain nodes through the communication protocol of the private IPFS network (corresponding to the target network).
[0050] When other nodes receive the target hash value, they can record the target hash value and compare it with the locally stored target hash value list to determine whether they need to obtain a new block file from the network.
[0051] If the broadcast target hash value does not exist in the local target hash value list, the node will actively download the block file from the node storing the block file and perform integrity verification.
[0052] When a blockchain node downloads a block file from the IPFS network, it recalculates the content hash value of the file.
[0053] Compare the calculated hash value with the previously broadcast target hash value. If the two hash values are consistent, it means that the block file has not been tampered with or damaged during the transmission process, and the integrity verification has passed.
[0054] If the hash values are inconsistent, it means that there may be a problem with the block file during the transmission process.
[0055] Through this series of processing, the technical solution of the present invention not only realizes the distributed storage of block files, but also ensures the integrity and security of data, and improves the reliability and efficiency of the alliance chain. At the same time, through the high-availability cluster management tool of IPFS-Cluster, this process can be automated, reducing human intervention and improving the stability and maintainability of the system.
[0056] Optionally, the types of blockchain nodes in the target network include: servers. Before receiving the block files generated by the alliance chain through the high-availability cluster management tool in the target network, it also includes: installing a distributed file system on the target server, and configuring target parameters on the target server to obtain a configured target server, wherein the target parameters include: parameters required for the target server to communicate in the target network; connecting the configured target server to the target network, and using the configured target server as a blockchain node in the alliance chain.
[0057] In this embodiment, after the node (target server) selection is completed, the private IPFS network can be built and configured, including installing the IPFS software, configuring network parameters (such as private network keys, inter-node communication protocols, etc.), and setting access control policies, etc. By generating and distributing shared keys, it is ensured that only authorized nodes can join the network and participate in data storage and sharing.
[0058] For example, before implementing the method of storing block files on a private IPFS network based on alliance chain nodes of the present invention, a series of environmental preparations can be performed. These preparations include the purchase and configuration of hardware equipment, the construction of the software environment, and the planning of the network environment, as follows:
[0059] 1. Environmental preparation:
[0060] (1) Hardware equipment:
[0061] Server: You can choose a server with stable performance and sufficient storage capacity as the node of the target network. The configuration of the server can be customized according to actual needs, including the specifications of key components such as CPU, memory, and hard disk.
[0062] Storage devices: Consider using solid-state drives or mechanical hard drives / electric hard drives to store block files. Solid-state drives have faster read and write speeds and are suitable for high-frequency access scenarios; while mechanical hard drives have higher storage capacity and cost-effectiveness and are suitable for long-term storage.
[0063] Network equipment: Ensure the stability and high speed of network equipment, including routers, switches, etc., to support fast communication and data transmission between nodes.
[0064] (2) Software environment:
[0065] Operating system: Choose a stable and reliable operating system as the basic platform of the server.
[0066] IPFS software: Install IPFS software on the server and configure the corresponding parameters to support the operation of the private network.
[0067] IPFS-Cluster: Install the IPFS-Cluster software on nodes where you need to improve system reliability and performance, and configure how it interacts with the IPFS daemon.
[0068] Encryption tool: Install and configure the encryption tool to encrypt block files.
[0069] (3) Network environment: Private network: Establish a private IPFS network within the alliance chain, and ensure the security of the network by configuring private network keys and access control policies. Network topology: Plan the network topology structure and determine the connection method and communication protocol between nodes. The network can be constructed using star, ring or mesh topologies.
[0070] 2. Private IPFS network (corresponding to the target network) construction:
[0071] (1) Node initialization: Install and start the IPFS software on each selected server, and generate the private key and public key of the node by executing the initialization command. The private key is used for node authentication and signature operations, and the public key is used to generate a unique identifier for the node.
[0072] (2) Private network configuration: Modify the IPFS configuration file and set the relevant parameters of the private network, including the private network key, inter-node communication protocol, etc. Ensure that all participating nodes use the same private network key and communication protocol.
[0073] (3) Node joining the network: Use the generated private key and public key to join the node to the private IPFS network. This usually involves key exchange and authentication between nodes to ensure that only authorized nodes can join the network. Improve the security of the target network.
[0074] Optionally, connecting the configured target server to the target network includes: obtaining a secret key of the configured target server to obtain a target secret key; verifying the configured target server based on the target secret key to obtain a verification result; and connecting the configured target server to the target network when the verification result indicates that the configured target server has passed the verification.
[0075] In this embodiment, unauthorized access and data leakage can be prevented through strict access control policies. Only authenticated nodes can join the private IPFS network (corresponding to the target network) and participate in data storage and sharing. At the same time, different access rights and role management policies can be set to further refine the access control granularity.
[0076] For example, in order to ensure the security of a private IPFS network, each server (node) joining the network needs to have its own key pair, including a private key and a public key. The private key is used for server identity authentication and data encryption and decryption, while the public key is used to generate a unique identifier (peer ID) for the server. The generation and management of keys is the basis of the IPFS network, ensuring trusted interactions between nodes and secure data transmission. Specifically, the configured target server, that is, the newly joined node, first needs to execute the IPFS initialization command to generate its own key pair. This process usually creates a directory for storing keys, which includes private and public key files. After the key of the new node is generated, its public key information can be obtained through the command line or API interface for subsequent verification and network records. After obtaining the public key of the new node, the existing nodes in the network will verify the public key to confirm whether the new node has the authority and trust to access the network. The verification process usually includes checking the digital certificate, verifying the validity of the key, and confirming the node identity.
[0077] After the existing nodes in the target network obtain the public key information from the new node, they can check whether the public key matches the preset node authorization policy, such as checking whether the public key belongs to a predefined certificate authority (CA) or is in the list of trusted nodes. If the public key of the new node passes this verification, it means that it is an authorized legal node and is eligible to access the network. The verification result indicates that the configured target server has passed the verification, and the configured target server is connected to the target network. In the process of allowing the target server to join the private IPFS network and participate in data storage and sharing, the node list of the target network can be updated to ensure that all nodes are aware of the addition of the new node for data synchronization and communication.
[0078] The process of connecting the configured target server to the target network is essentially a key verification and trust confirmation process for the newly added node, which ensures the security and reliability of the private IPFS network. It also provides flexible expansion capabilities for the network, allowing new storage nodes to be added while ensuring security to meet the growing data storage needs.
[0079] Optionally, before receiving the block file generated by the alliance chain through the high-availability cluster management tool in the target network, it also includes: when the block file is generated in the alliance chain, uploading the block file to the target network based on the application programming interface of the target network; before uploading the block file to the target network, it also includes: encrypting the block file using an encryption algorithm.
[0080] When the alliance chain generates a new block file, the block file can be uploaded to the private IPFS network. The upload process can be achieved by writing specific scripts, tools or integrating them into the blockchain node source code, and uploading the block file to the IPFS storage device through IPFS-Cluster for storage.
[0081] For example, when a consortium chain generates a new block file, you can use the script, tool, or code integrated into the blockchain node to convert the block file and upload it to the private IPFS network through the IPFS API (application programming interface of the target network). During the upload process, the encryption technology in the encryption tool can be used to encrypt the block file to enhance data security.
[0082] Before uploading the block file and during the transmission process, you can also use public key encryption algorithms such as RSA to encrypt the hash value of the block file to generate a digital signature; at the same time, during the transmission process, encryption protocols such as TLS (Transport Layer Security) / SSL (Secure Socket Layer) are used to protect the secure transmission of data.
[0083] The block files are encrypted by encryption algorithms, and the target network API (Application Programming Interface) is used to upload files to the private IPFS network, ensuring the security and integrity of the data. Encryption processing ensures the privacy of data during transmission, while uploading through the API takes advantage of the distributed storage of IPFS to achieve efficient and secure data storage. It enhances the security and privacy protection capabilities of the target network and improves the efficiency of data management.
[0084] Optionally, the block file storage method further includes: during the operation of the target network, collecting log data generated by the target network to obtain target log data; based on the target log data, analyzing whether there is a fault in the target network to obtain an analysis result.
[0085] In this embodiment, a monitoring system and log collection tools can also be deployed to monitor the operating status and performance of the target network (e.g., a private IPFS network) in real time. By collecting and analyzing log data, potential problems and failures can be discovered and resolved in a timely manner.
[0086] In this embodiment, the target network can also be optimized according to the actual operation and performance of the target network. The performance and reliability of the target network can be improved by adjusting the configuration parameters of IPFS and IPFS-Cluster, optimizing the network topology, and upgrading hardware devices.
[0087] In order to improve the security of the target network, you can also conduct regular security assessments on the target to check whether the target network has security vulnerabilities and hidden dangers. You can use security testing methods such as penetration testing and code auditing to assess the security of the target network, and perform corresponding security reinforcement and repair work based on the assessment results.
[0088] For example, the collection of target log data: Log data collection refers to recording all key operations, state changes, error messages, etc. during system operation for subsequent analysis and fault location. For a consortium chain storage network based on private IPFS, log data may include the startup and shutdown of IPFS nodes, upload and download records of block files, network communication conditions, fault alarm information, etc. Specifically, in order to collect target log data, log collection tools or services can be deployed on each IPFS node, so that log data can be automatically collected from the target network and stored centrally in a log server or log database. The format of the log data can be JSON or other parseable text formats to facilitate subsequent analysis and processing.
[0089] In this embodiment, it is also possible to determine whether the system has a fault or anomaly, as well as the specific cause and scope of the fault based on the collected log data through data mining, anomaly detection and other methods. For the alliance chain storage network, the fault may involve node failure, network communication problems, storage device failure, data integrity problems, etc. Specifically, after the log data is collected, a data analysis tool or platform can be used to perform real-time or offline analysis of the target log data, such as log search, anomaly detection, historical data trend analysis, etc. Based on the analysis of the target log data, potential faulty nodes or fault types can be quickly located. For example, if network delay problems are reported in the logs of multiple nodes, this may indicate that there is a bottleneck in the network communication; if the log of a node frequently shows records of file integrity verification failure, this may indicate that there is a problem with the storage device of the node, or that the data is damaged during transmission.
[0090] After the target log analysis is completed, the analysis results can be fed back to the system administrator or developer so that the administrator can take timely measures to fix the fault or optimize the system. In addition, the analysis results can also be used for continuous improvement of system performance. For example, by analyzing network latency, methods for optimizing network architecture can be found; by analyzing data integrity issues, encryption algorithms and redundancy strategies for data transmission and storage can be improved.
[0091] By collecting and analyzing the operation logs of the target network, system failures can be discovered and handled in a timely manner, ensuring the stable operation and data security of the alliance chain storage network based on private IPFS, achieving the purpose of active monitoring and prevention strategies in the operation and maintenance and fault handling of the target network, and realizing the technical effect of improving the reliability of the target network.
[0092] Optionally, the distributed file system includes: InterPlanetary File System.
[0093] In this embodiment, the distributed file system can be an InterPlanetary File System (IPFS). By building a private IPFS network, illegal access and data theft by external nodes are prevented, ensuring the safe storage of block files. The distributed storage characteristics of IPFS are used to achieve decentralized storage of block files, reducing the storage pressure of a single node and the overall storage cost. Through multi-node storage and synchronization mechanisms, it is ensured that even if some nodes fail or go offline, block files can still be accessed and transmitted through other nodes.
[0094] Through this embodiment, the decentralized nature of IPFS is utilized, and block files are dispersedly stored on multiple nodes, effectively avoiding the risk of single point failure and data loss. Combining encryption technology and node identity authentication mechanism, it is ensured that only authorized nodes can access and modify data, enhancing the security of data storage, and using end-to-end encryption during data transmission and storage to ensure the privacy and security of data during transmission, and prevent data from being intercepted or tampered with by unauthorized parties. Formulate strict privacy policies and access control policies to limit access to sensitive data and protect user privacy. Through distributed storage, the storage burden is dispersed to multiple nodes, reducing the storage pressure of a single node, and also reducing the overall storage cost. Using the redundant storage and caching mechanism of IPFS, data redundancy and duplicate storage are effectively reduced, and resource utilization is improved.
[0095] It should be noted that in this embodiment, since the block data is distributed on multiple nodes, users can quickly obtain the required data from the nearest node, improving the data access speed. With the expansion of the alliance chain and the addition of new nodes, the private IPFS network can easily expand the storage capacity and computing power to meet the growing data storage needs. Through the distributed storage mechanism of IPFS, redundant storage and backup of data are achieved. Even if some nodes fail or data is lost, data can be restored from other nodes. Combined with the deployment of IPFS-Cluster, automatic failover and data synchronization between nodes are achieved to ensure high availability and stability of the system.
[0096] Therefore, this embodiment provides a storage method for block files, which shows significant advantages in improving data storage security, strengthening data privacy protection, reducing storage costs, improving system efficiency and scalability, and enhancing system fault tolerance and reliability.
[0097] Embodiment 2
[0098] The second embodiment of the present invention provides an optional storage device for block files, and each implementation unit in the storage device corresponds to each implementation step in the first embodiment.
[0099] Figure 3 is a schematic diagram of an optional storage device for block files according to an embodiment of the present invention, such as Figure 3 As shown, it includes: a receiving unit 31 and a storage unit 32.
[0100] The receiving unit 31 is used to receive the block file generated by the alliance chain through the high-availability cluster management tool in the target network, wherein the nodes in the target network include: the blockchain nodes in the alliance chain, and the target network refers to a network built based on a distributed file system;
[0101] The storage unit 32 is used to store the block file fragments in the storage devices associated with multiple blockchain nodes in the target network using a distributed storage strategy through a high-availability cluster management tool.
[0102] In the storage device of block files provided in the second embodiment of the present invention, the block files generated by the alliance chain can be received by the receiving unit 31 through the high-availability cluster management tool in the target network, wherein the nodes in the target network include: blockchain nodes in the alliance chain, the target network refers to a network built based on a distributed file system, and the block files are stored in pieces in the storage devices associated with multiple blockchain nodes in the target network through the storage unit 32 through the high-availability cluster management tool, using a distributed storage strategy. Thus, the technical problem of the high storage pressure of a single node in the related technology that all block files of the alliance chain are fully stored in all nodes in the alliance chain is solved. In this embodiment, by deploying a target network built based on a distributed file system in the alliance chain, after the alliance chain generates a new block file, the block file can be stored in pieces in multiple nodes in the target network, avoiding the situation where all nodes in the alliance chain need to store complete block files and the storage pressure of a single node is high, thereby achieving the technical effect of reducing the storage pressure of nodes in the alliance chain.
[0103] Optionally, in the storage device for block files provided in Embodiment 2 of the present invention, the storage device for block files also includes: a conversion unit, which is used to convert the content of the block file into a hash value through the high-availability cluster management tool after distributing and storing the block file in storage devices associated with multiple blockchain nodes in the target network through a high-availability cluster management tool to obtain a target hash value; and a broadcasting unit, which is used to broadcast the target hash value to all blockchain nodes in the target network so that the blockchain nodes in the target network can verify the integrity of the block file.
[0104] Optionally, in the storage device for block files provided in Embodiment 2 of the present invention, the types of blockchain nodes in the target network include: servers, and the storage device for block files also includes: a first processing unit, used to install a distributed file system on the target server before receiving the block file generated by the alliance chain through a high-availability cluster management tool in the target network, and configure target parameters on the target server to obtain a configured target server, wherein the target parameters include: parameters required for the target server to communicate in the target network; a second processing unit, used to connect the configured target server to the target network, and use the configured target server as a blockchain node in the alliance chain.
[0105] Optionally, in the storage device of the block file provided in the second embodiment of the present invention, the second processing unit includes: an acquisition subunit, used to acquire the key of the configured target server to obtain the target key; a verification subunit, used to verify the configured target server based on the target key to obtain a verification result; and an access subunit, used to connect the configured target server to the target network when the verification result indicates that the configured target server has passed the verification.
[0106] Optionally, in the storage device for block files provided in Embodiment 2 of the present invention, the storage device for block files further includes: an uploading unit, which uploads the block file to the target network based on the application programming interface of the target network when the block file is generated in the alliance chain before receiving the block file generated by the alliance chain through a high-availability cluster management tool in the target network; and an encryption unit, which is used to encrypt the block file using an encryption algorithm before uploading the block file to the target network.
[0107] Optionally, in the storage device for block files provided in Embodiment 2 of the present invention, the storage device for block files further includes: a collection unit, used to collect log data generated by the target network during the operation of the target network to obtain target log data; and an analysis unit, used to analyze whether there is a fault in the target network based on the target log data to obtain an analysis result.
[0108] Optionally, in the storage device for block files provided in the second embodiment of the present invention, the distributed file system includes: an InterPlanetary File System.
[0109] The storage device of the block file may further include a processor and a memory. The receiving unit 31 and the storage unit 32 are stored in the memory as program units. The processor executes the program units stored in the memory to implement corresponding functions.
[0110] The above processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the target network built on the distributed file system can be deployed in the alliance chain by adjusting the kernel parameters. After the alliance chain generates a new block file, the block file can be fragmented and stored in multiple nodes in the target network, avoiding the situation where all nodes in the alliance chain need to store complete block files and the storage pressure of a single node is large, thereby achieving the technical effect of reducing the storage pressure of nodes in the alliance chain.
[0111] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.
[0112] According to another aspect of an embodiment of the present invention, an electronic device is provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any of the above-mentioned block file storage methods by executing the executable instructions.
[0113] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned block file storage methods.
[0114] Figure 4 is a schematic diagram of an electronic device according to an embodiment of the present invention, such as Figure 4 As shown, an embodiment of the present invention provides an electronic device 40, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, any one of the above block file storage methods is implemented.
[0115] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0116] In the above embodiments of the present invention, 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.
[0117] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, 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, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0118] 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0119] In addition, each functional unit in each embodiment of the present invention 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-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0120] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, 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 storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0121] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for storing block files, characterized in that: include: Receiving the block file generated by the alliance chain through a high-availability cluster management tool in the target network, wherein the nodes in the target network include: blockchain nodes in the alliance chain, and the target network refers to a network built based on a distributed file system; Through the high-availability cluster management tool, a distributed storage strategy is adopted to store the block file fragments in storage devices associated with multiple blockchain nodes in the target network.
2. The storage method according to claim 1, characterized in that: After the block files are distributedly stored in storage devices associated with multiple blockchain nodes of the target network through the high-availability cluster management tool, the process further includes: By using the high-availability cluster management tool, the content of the block file is converted into a hash value to obtain a target hash value; The target hash value is broadcast to all blockchain nodes in the target network, so that the blockchain nodes in the target network can verify the integrity of the block file.
3. The storage method according to claim 1, characterized in that: The types of blockchain nodes in the target network include: servers, and before receiving the block files generated by the alliance chain through the high-availability cluster management tool in the target network, the following are also included: Installing the distributed file system on a target server and configuring target parameters on the target server to obtain a configured target server, wherein the target parameters include: parameters required by the target server for communication in the target network; The configured target server is connected to the target network, and the configured target server is used as a blockchain node in the alliance chain.
4. The storage method according to claim 3, characterized in that: Connecting the configured target server to the target network includes: Obtain the secret key of the configured target server to obtain the target secret key; Verifying the configured target server based on the target key to obtain a verification result; When the verification result indicates that the configured target server passes the verification, the configured target server is connected to the target network.
5. The storage method according to claim 1, characterized in that: Before receiving the block file generated by the alliance chain through the high-availability cluster management tool in the target network, the method further includes: when the block file is generated in the alliance chain, uploading the block file to the target network based on the application programming interface of the target network; Before uploading the block file to the target network, the method further includes: encrypting the block file using an encryption algorithm.
6. The storage method according to claim 1, characterized in that: The method further comprises: During the operation of the target network, log data generated by the target network is collected to obtain target log data; Based on the target log data, analyze whether the target network has a fault and obtain an analysis result.
7. The storage method according to claim 1, characterized in that: The distributed file system includes: InterPlanetary File System.
8. A storage device for block files, characterized in that: include: A receiving unit, configured to receive a block file generated by a consortium chain through a high-availability cluster management tool in a target network, wherein the nodes in the target network include: blockchain nodes in the consortium chain, and the target network refers to a network built based on a distributed file system; A storage unit is used to store the block file fragments in storage devices associated with multiple blockchain nodes in the target network using a distributed storage strategy through the high-availability cluster management tool.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the block file storage method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: The device comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the block file storage method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-chain type block chain information storage method based on alliance chain
CN115964730A
Intelligent power grid data security interaction system
CN118118153A
Block chain-based network threat intelligence sharing method, system and device, and medium
CN118353606A
Internet of Things trusted data sharing method, system and device and storage medium
CN118713902A
Data processing method and related device
WO2024001304A1