Blockchain file-based processing method and apparatus, processor, and electronic device
By performing block processing and multiple hash algorithm transformation on the target file, combined with storage strategies that consider data security level and access efficiency, the problem of low efficiency in off-chain storage of target files is solved, and more efficient data acquisition is achieved.
Patent Information
- Application Number
- CN202210297182.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-24
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2042-03-24
AI Technical Summary
In existing technologies, storing target files off-chain and retrieving them via on-chain data hash fingerprints is inefficient and affects the processing efficiency of business systems.
The target file is divided into blocks by the storage node. The initial data blocks are converted into target key-value pairs using a multi-hash algorithm. The target storage strategy is determined based on the data security level and access efficiency, and the target key-value pairs are stored in the target storage node.
It improves the efficiency of acquiring target files, solves the inefficiency problem of storing target files off-chain, and optimizes the data storage and access process.
Smart Images

Figure CN114880300B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of blockchains, in particular to a blockchain file-based processing method and device, a processor and an electronic device. BACKGROUND
[0002] With the wide application of blockchain technology, the amount of data stored on the chain is increasing, and the types are rich, and the blockchain storage technology is becoming a bottleneck. The current common on-chain method of blockchain includes content on-chain, hash on-chain, link on-chain and the like. Due to the characteristics of the blockchain itself, the storage cost of the blockchain storage often increases exponentially with the increase of nodes. When using off-chain storage data, the data is obtained through the data hash fingerprint on the chain. Such a way has the problem of low efficiency of obtaining data, and this also affects the processing efficiency of the actual business system.
[0003] In view of the problem in the related art that the off-chain storage target file is obtained through the data hash fingerprint on the chain, resulting in low efficiency of obtaining the target file, no effective solution has been proposed so far. SUMMARY
[0004] The main purpose of the present application is to provide a blockchain file-based processing method and device, a processor and an electronic device, to solve the problem in the related art that the off-chain storage target file is obtained through the data hash fingerprint on the chain, resulting in low efficiency of obtaining the target file.
[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a blockchain file-based processing method is provided. The method comprises: obtaining a transaction request for indicating storage of a target file; performing block processing on the target file through a storage node one according to the space size occupied by the target file and the data security level, to obtain an initial data block, wherein the storage node one is a storage node corresponding to the initiator of the transaction request, and the data security level is used to represent the security level of the data in the target file; processing the initial data block through the storage node one by calling a multi-hash algorithm to obtain a target key-value pair; determining a target storage strategy of the target file according to the data security level and the access efficiency of the target file; and storing the target key-value pair to a target storage node according to the target storage strategy, wherein the target storage node at least includes the storage node one.
[0006] Further, the initial data block is processed by the storage node one calling the multi-hash algorithm to obtain a target key-value pair, including: the initial data block is processed by the storage node one calling the multi-hash algorithm to obtain an initial key-value pair; a private key of the initiator is obtained, and the initial key-value pair is encrypted according to the private key to obtain the target key-value pair.
[0007] Further, after the initial data block is processed by the storage node one calling the multi-hash algorithm to obtain a target key-value pair, the method further includes: a target hash index of the target file is calculated by the multi-hash algorithm, wherein the target hash index is used to identify the target file.
[0008] Further, according to the target storage strategy, the target key-value pair is stored in the target storage node, including: metadata information of the target file is obtained, wherein the metadata information represents the attributes of the target file; according to the target storage strategy, the metadata information, the target hash index and the target key-value pair are stored in the target storage node by calling the smart contract.
[0009] Further, before the transaction request for storing the target file is obtained, the method further includes: a user certificate and a key are obtained, wherein the user certificate and the key represent the legal identity of the initiator; according to the user certificate and the key, access credentials are obtained by performing permission verification on the blockchain, wherein the access credentials are used for storage of the target file and access of the target file; according to the access credentials, IP and address information of all storage nodes in the blockchain node are obtained by calling a storage resource interface of the blockchain.
[0010] Further, after the target key-value pair is stored in the target storage node according to the target storage strategy, the method further includes: the transaction behavior of storing the target file is anchored by a consensus node to complete consensus work; a signal that the target file is successfully stored is returned to the initiator by the consensus node.
[0011] Further, after the transaction behavior of storing the target file is anchored by a consensus node to complete consensus work, the method further includes: an index key-value pair is formed with the target hash index as a key and the IP of the target storage node as a value; the index key-value pair is stored in a target hash table of the blockchain.
[0012] In order to achieve the above object, according to another aspect of the present application, a blockchain file-based processing device is provided. The device comprises: a first acquisition unit configured to acquire a transaction request for indicating a target file to be stored; a first processing unit configured to perform block processing on the target file by a storage node one to obtain initial data blocks according to a space size occupied by the target file and a data security level, wherein the storage node one is a storage node corresponding to an initiator of the transaction request, and the data security level is used to represent a security level of data in the target file; a second processing unit configured to perform processing on the initial data blocks by the storage node one calling a multi-hash algorithm to obtain a target key-value pair; a determination unit configured to determine a target storage strategy of the target file according to the data security level and an access efficiency of the target file; and a first storage unit configured to store the target key-value pair to a target storage node according to the target storage strategy, wherein the target storage node at least includes the storage node one.
[0013] Further, the second processing unit comprises: a calculation module configured to perform hash calculation on the initial data blocks by the storage node one calling the multi-hash algorithm to obtain an initial key-value pair; and an encryption module configured to acquire a private key of the initiator and perform encryption processing on the initial key-value pair according to the private key to obtain the target key-value pair.
[0014] Further, the device further comprises: a calculation unit configured to, after obtaining the target key-value pair by performing processing on the initial data blocks by the storage node one calling the multi-hash algorithm, calculate a target hash index of the target file by the multi-hash algorithm, wherein the target hash index is used to identify the target file.
[0015] Further, the first storage unit comprises: an acquisition module configured to acquire metadata information of the target file, wherein the metadata information represents attributes of the target file; and a calling module configured to call a smart contract to store the metadata information, the target hash index and the target key-value pair to the target storage node according to the target storage strategy.
[0016] Further, the apparatus further includes: a second acquisition unit, configured to acquire a user certificate and a key before acquiring a transaction request for indicating storage of a target file, wherein the user certificate and the key represent a legal identity of the initiator; a verification unit, configured to perform authority verification on the blockchain according to the user certificate and the key, to obtain an access credential, wherein the access credential is used for storage of the target file and access of the target file; and a calling unit, configured to call a storage resource interface of the blockchain according to the access credential, to obtain IP and address information of all storage nodes in the blockchain node.
[0017] Further, the apparatus further includes: a third processing unit, configured to, after storing the target key-value pair to a target storage node according to the target storage strategy, perform hash anchoring on a transaction behavior of the target file storage by a consensus node, to complete consensus work; and a returning unit, configured to return a signal of successful storage of the target file to the initiator by the consensus node.
[0018] Further, the apparatus further includes: a building unit, configured to, after performing hash anchoring on the transaction behavior of the target file storage by the consensus node, to complete the consensus work, build an index key-value pair with the target hash index as a key and IP of the target storage node as a value; and a second storage unit, configured to store the index key-value pair to a target hash table of the blockchain.
[0019] In order to achieve the above-mentioned purpose, according to an aspect of the present application, a processor is provided, and the processor is used to run a program, wherein the program performs any one of the above-mentioned file processing methods based on a blockchain when running.
[0020] In order to achieve the above-mentioned purpose, according to an aspect of the present application, an electronic device is provided, and the electronic device includes one or more processors and a memory, and the memory is used to store the one or more processors to implement any one of the above-mentioned file processing methods based on a blockchain.
[0021] According to the application, the following steps are adopted: a transaction request for indicating a storage target file is acquired; a target file is processed in blocks by a storage node one according to a space size occupied by the target file and a data security level, to obtain an initial data block, wherein the storage node one is a storage node corresponding to an initiator of the transaction request, and the data security level is used to represent a security level of data in the target file; the initial data block is processed by calling a multi-hash algorithm by the storage node one, to obtain a target key-value pair; a target storage strategy of the target file is determined according to the data security level and an access efficiency of the target file; and the target key-value pair is stored to a target storage node according to the target storage strategy, wherein the target storage node at least includes the storage node one, thereby solving the problem in the related art that the target file is stored off-chain, and the target file is acquired through a data hash fingerprint on the chain, which leads to a relatively low efficiency of acquiring the target file. By dividing the target file into blocks to obtain the initial data block, then converting the initial data block into the target key-value pair by using the multi-hash algorithm, determining the target storage strategy according to the data security level and the access efficiency of the target file, and storing the target key-value pair on the target storage node according to the target storage strategy, the efficiency of acquiring the target file is improved. BRIEF DESCRIPTION OF DRAWINGS
[0022] The accompanying drawings, which form a part of the present application, are intended to provide further understanding of the present application, and are used to interpret the application and its specification, and do not constitute improper limitations to the present application. In the drawings:
[0023] Figure 1 is a flowchart of a processing method based on a blockchain file according to an embodiment of the present application;
[0024] Figure 2 is a flowchart of an optional processing method based on a blockchain file according to an embodiment of the present application;
[0025] Figure 3 is a schematic diagram of a processing device based on a blockchain file according to an embodiment of the present application;
[0026] Figure 4 is a schematic diagram of an optional processing system based on a blockchain file according to an embodiment of the present application;
[0027] Figure 5 is a schematic diagram of an optional storage node according to an embodiment of the present application;
[0028] Figure 6 is a schematic diagram of an optional storage data according to an embodiment of the present application;
[0029] Figure 7 is a schematic diagram of an optional consensus node according to an embodiment of the present application;
[0030] Figure 8 is a schematic view of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0031] It should be noted that the embodiments and features of the present application can be combined with each other if there is no conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
[0032] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.
[0033] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units need not be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0034] The present application will be described below in conjunction with preferred implementation steps, Figure 1 is a flowchart of a processing method based on a blockchain file according to an embodiment of the present application, as shown in the figure, the method comprises the following steps: Figure 1
[0035] Step S101, obtaining a transaction request for indicating storage of a target file.
[0036] Specifically, the initiator initiates a transaction request for storing the target file through the blockchain node corresponding to itself.
[0037] Step S102, according to the space size occupied by the target file and the data security level, the target file is processed by the storage node one to obtain the initial data block, wherein the storage node one is the storage node corresponding to the initiator of the transaction request, and the data security level is used to represent the security level of the data in the target file.
[0038] Specifically, the storage node on the blockchain node receives the transaction request, and then performs block processing on the target file according to the space size occupied by the target file and the data security level to obtain initial data blocks. For example, if the target file is 100M, the target file can be divided into four initial data blocks of 25M. If the data security level is relatively high, the target file can be divided into more data blocks to ensure security.
[0039] In step S103, the storage node one calls a multi-hash algorithm to process the initial data block to obtain a target key-value pair.
[0040] Specifically, after obtaining the initial data block, the storage node one calls a multi-hash algorithm to process the initial data block to obtain a target key-value pair. Generally, the hash value of the business data is taken as the key, and the business data is taken as the value.
[0041] In step S104, a target storage strategy of the target file is determined according to the data security level and the access efficiency of the target file.
[0042] Specifically, the storage strategy is determined according to the data security level and the access efficiency of the target file. For example, the initiator wants to access the target file as quickly as possible, and can select to store multiple target key-value pairs on the storage node corresponding to the initiator. Alternatively, for the sake of data security, backup storage can be performed on each storage node.
[0043] In step S105, the target key-value pair is stored in the target storage node according to the target storage strategy, wherein the target storage node at least includes the storage node one.
[0044] Specifically, the target key-value pair is stored in the corresponding target storage node according to the obtained target storage strategy.
[0045] As described above, by dividing the target file into blocks to obtain initial data blocks, then converting the initial data blocks into target key-value pairs by using a multi-hash algorithm, determining a target storage strategy according to the data security level and the access efficiency of the target file, and storing the target key-value pair in the target storage node according to the target storage strategy, the efficiency of obtaining the target file is improved.
[0046] Optionally, in the method for processing a blockchain file provided in the embodiments of the present application, the storage node one calls a multi-hash algorithm to process the initial data block to obtain a target key-value pair, including: the storage node one calls a multi-hash algorithm to perform hash calculation on the initial data block to obtain an initial key-value pair; a private key of the initiator is obtained, and the initial key-value pair is encrypted according to the private key to obtain the target key-value pair.
[0047] Specifically, a multi-hash operation is called, and a block hash security operation is performed according to the data size and the data security level to obtain an initial data key-value pair. Then, the initial key-value pair is encrypted according to a private key of the initiator to obtain a target key-value pair. The initial data block is converted into a key-value pair, storage space is saved, and the key-value pair is encrypted to ensure the security of the data.
[0048] Optionally, in the method for processing a blockchain file provided in the embodiments of the present application, after the initial data block is processed by the storage node through the multi-hash algorithm to obtain the target key-value pair, the method further includes: obtaining a target hash index of the target file through the multi-hash algorithm, wherein the target hash index is used to identify the target file.
[0049] Specifically, in addition to obtaining the key-value pair through the multi-hash algorithm, the target hash index of the target file is also obtained through the multi-hash algorithm, and the target file can be accurately obtained through the target hash index when the target file is subsequently queried and accessed.
[0050] Optionally, in the method for processing a blockchain file provided in the embodiments of the present application, storing the target key-value pair to the target storage node according to the target storage strategy includes: obtaining metadata information of the target file, wherein the metadata information represents the attributes of the target file; and storing the metadata information, the target hash index and the target key-value pair to the target storage node through the smart contract according to the target storage strategy.
[0051] Specifically, the metadata information of the target file is obtained, and the metadata information is used to represent the attribute information of the target file. The metadata information, the target hash index and the target key-value pair are stored to the target storage node through the smart contract on the blockchain node according to the target storage strategy. Through the above steps, each target storage node includes the target hash index, and the target file can be obtained through the target hash index when the target file is queried.
[0052] Optionally, in the method for processing a blockchain file provided in the embodiments of the present application, before obtaining the transaction request for indicating the storage of the target file, the method further includes: obtaining a user certificate and a key, wherein the user certificate and the key represent the legal identity of the initiator; performing permission verification on the blockchain according to the user certificate and the key to obtain an access credential, wherein the access credential is used for the storage of the target file and the access of the target file; and calling a storage resource interface of the blockchain according to the access credential to obtain IP and address information of all storage nodes in the blockchain node.
[0053] Specifically, the initiator can obtain a user certificate and a key through a blockchain storage management console, call a blockchain node for blockchain permission authentication through the user certificate and the key, return access credentials, call a storage resource interface in a blockchain smart contract through the access credentials, confirm whether a storage node exists in a blockchain network, and if the storage node exists, return IP and address information of all storage nodes. Through the above steps, the legality of the initiator operation is ensured, and the accuracy of the storage is ensured through the IP and address information of the storage nodes.
[0054] Optionally, in the blockchain file-based processing method provided in the embodiments of the present application, after the target key-value pair is stored in the target storage node according to the target storage strategy, the method further includes: performing hash anchoring on the transaction behavior of the target file storage by the consensus node to complete the consensus work; and returning a signal of successful storage of the target file to the initiator by the consensus node.
[0055] Specifically, after the target key-value pair is stored, the transaction behavior of the target file storage needs to be securely anchored by the consensus node of the blockchain node through hash, and after leaving a mark, the storage success result is returned to the initiator. Through the above steps, the legality of the storage transaction is determined.
[0056] Optionally, in the blockchain file-based processing method provided in the embodiments of the present application, after the transaction behavior of the target file storage is anchored by the consensus node through hash to complete the consensus work, the method further includes: taking the target hash index as a key and the IP of the target storage node as a value to form an index key-value pair; and storing the index key-value pair in a target hash table of the blockchain.
[0057] Specifically, the blockchain network maintains a file index hash table, which is composed of key-value pairs. Here, the key is the hash index of the target file under the hash algorithm, and the value is the IP address of the storage file (that is, the IP of the target storage node described above). When querying, only the key (that is, the target hash index described above) needs to be provided to query the address of the storage node from the table and return it to the querying node. Therefore, the index key-value pair is formed by taking the target hash index as the key and the IP of the target storage node as the value, and the index key-value pair is stored in the target hash table of the blockchain. Through the above steps, when querying the file, only the target hash index needs to be provided to quickly obtain the target file, thereby improving the efficiency of obtaining the target file.
[0058] The blockchain-based file processing method provided in this application involves: obtaining a transaction request indicating the storage of a target file; dividing the target file into blocks using a storage node 1 based on the target file's size and data security level to obtain initial data blocks, where storage node 1 is the storage node corresponding to the initiator of the transaction request, and the data security level characterizes the security level of the data in the target file; processing the initial data blocks using a multi-hash algorithm via storage node 1 to obtain target key-value pairs; determining a target storage strategy for the target file based on the data security level and the access efficiency of the target file; and storing the target key-value pairs on a target storage node, where the target storage node includes at least storage node 1. This method solves the problem of low efficiency in retrieving target files when using off-chain storage and retrieving them via on-chain data hash fingerprints in related technologies. By dividing the target file into blocks to obtain initial data blocks, then using a multi-hash algorithm to convert the initial data blocks into target key-value pairs, determining the target storage strategy based on the data security level and the access efficiency of the target file, and storing the target key-value pairs on the target storage node according to the target storage strategy, the method improves the efficiency of retrieving target files.
[0059] like Figure 2 As shown in the flowchart of the optional blockchain-based file processing method provided in this application embodiment, the user obtains the user certificate and key for blockchain access and transaction initiation through the blockchain storage management console; performs blockchain permission authentication through the blockchain node and returns the access credential; calls the storage resource interface in the blockchain smart contract through the access credential to confirm whether there is a storage node in the blockchain network, and if so, returns the IP and address information of all storage nodes; the user initiates a data asset storage request to the storage node, performs data blocking according to the data size and data security level, and calls multiple hash operations to perform block hash security operations to obtain the initial key-value pair; uses the user's private key to encrypt the initial key-value pair to obtain the target key-value pair, and calls the smart contract to store the metadata information, the target key-value pair and the target hash index on the chain; after storage, performs hash security anchoring, and after the blockchain successfully records the storage operation, returns the storage success result to the user.
[0060] It should be noted that the steps shown in the flowchart in 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 may be executed in a different order than that shown here.
[0061] The embodiment of the present application further provides a processing device based on a blockchain file. It should be noted that the processing device based on the blockchain file can be used to execute the processing method based on the blockchain file provided by the embodiment of the present application. The processing device based on the blockchain file provided by the embodiment of the present application is introduced as follows.
[0062] Figure 3 is a schematic diagram of the processing device based on the blockchain file according to the embodiment of the present application. As shown in the figure, Figure 3 the device comprises a first acquisition unit 301, a first processing unit 302, a second processing unit 303, a determination unit 304 and a first storage unit 305.
[0063] The first acquisition unit 301 is configured to acquire a transaction request used for indicating a storage target file.
[0064] The first processing unit 302 is configured to perform block processing on the target file through a storage node one according to a space size occupied by the target file and a data security level, to obtain an initial data block, wherein the storage node one is a storage node corresponding to an initiator of the transaction request, and the data security level is used to represent a security level of data in the target file.
[0065] The second processing unit 303 is configured to call a multi-hash algorithm to process the initial data block through the storage node one, to obtain a target key-value pair.
[0066] The determination unit 304 is configured to determine a target storage strategy of the target file according to the data security level and an access efficiency of the target file.
[0067] The first storage unit 305 is configured to store the target key-value pair to a target storage node according to the target storage strategy, wherein the target storage node at least comprises the storage node one.
[0068] The processing apparatus based on a blockchain file provided in the embodiments of the present application obtains a transaction request for indicating a storage target file through a first obtaining unit 301. A first processing unit 302 performs block processing on the target file through a storage node one according to a space size occupied by the target file and a data security level, to obtain an initial data block, wherein the storage node one is a storage node corresponding to an initiator of the transaction request, and the data security level is used to represent a security level of data in the target file. A second processing unit 303 calls a multi-hash algorithm to process the initial data block through the storage node one, to obtain a target key-value pair. A determining unit 304 determines a target storage strategy of the target file according to the data security level and an access efficiency of the target file. A first storage unit 305 stores the target key-value pair to a target storage node according to the target storage strategy, wherein the target storage node at least includes the storage node one, thereby solving the problem in the related art that a target file is stored off-chain, and the target file is obtained through a data hash fingerprint on the chain, which results in a relatively low efficiency of obtaining the target file. The target file is divided into blocks to obtain the initial data block, and then the initial data block is converted into the target key-value pair by using the multi-hash algorithm. According to the data security level and the access efficiency of the target file, the target storage strategy is determined, and the target key-value pair is stored on the target storage node according to the target storage strategy, thereby achieving the effect of improving the efficiency of obtaining the target file.
[0069] Optionally, in the processing apparatus based on a blockchain file provided in the embodiments of the present application, the second processing unit 303 includes: a calculation module, configured to call a multi-hash algorithm to perform hash calculation on the initial data block through the storage node one, to obtain an initial key-value pair; and an encryption module, configured to obtain a private key of the initiator, and perform encryption processing on the initial key-value pair according to the private key, to obtain the target key-value pair.
[0070] Optionally, in the processing apparatus based on a blockchain file provided in the embodiments of the present application, the apparatus further includes: a calculation unit, configured to, after the target key-value pair is obtained by processing the initial data block through the storage node one by using the multi-hash algorithm, calculate a target hash index of the target file by using the multi-hash algorithm, wherein the target hash index is used to identify the target file.
[0071] Optionally, in the processing apparatus based on a blockchain file provided in the embodiments of the present application, the first storage unit 305 includes: an obtaining module, configured to obtain metadata information of the target file, wherein the metadata information represents attributes of the target file; and a calling module, configured to call an intelligent contract to store the metadata information, the target hash index and the target key-value pair to the target storage node according to the target storage strategy.
[0072] Optionally, in the blockchain-based file processing apparatus provided in this application embodiment, the apparatus further includes: a second acquisition unit, configured to acquire a user certificate and key before acquiring a transaction request for instructing the storage of a target file, wherein the user certificate and key represent the legitimate identity of the initiator; a verification unit, configured to perform permission verification on the blockchain based on the user certificate and key to obtain an access credential, wherein the access credential is used for the storage and access of the target file; and a calling unit, configured to call the storage resource interface of the blockchain based on the access credential to obtain the IP and address information of all storage nodes in the blockchain nodes.
[0073] Optionally, in the blockchain-based file processing apparatus provided in this application embodiment, the apparatus further includes: a third processing unit, used to perform hash anchoring on the transaction behavior of the target file storage through a consensus node after storing the target key-value pair to the target storage node according to the target storage strategy, so as to complete the consensus work; and a return unit, used to return a signal of successful storage of the target file to the initiator through the consensus node.
[0074] Optionally, in the blockchain-based file processing apparatus provided in this application embodiment, the apparatus further includes: a component unit, used to construct an index key-value pair using the target hash index as the key and the IP of the target storage node as the value after the transaction behavior stored in the target file is hash-anchored by the consensus node to complete the consensus work; and a second storage unit, used to store the index key-value pair in the target hash table of the blockchain.
[0075] The blockchain-based file processing device includes a processor and a memory. The first acquisition unit 301, the first processing unit 302, the second processing unit 303, the determination unit 304, and the first storage unit 305 are all stored in the memory as program units. The processor executes the program units stored in the memory to achieve the corresponding functions.
[0076] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and the storage of object files can be achieved by adjusting kernel parameters.
[0077] The memory may include non-permanent memory in computer-readable media, such as 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 memory chip.
[0078] like Figure 4 The diagram illustrates an optional blockchain-based file processing system according to an embodiment of this application. The system includes a user terminal 1, a management console 2, storage nodes 3, consensus nodes 4, and a storage contract 5.
[0079] User terminal 1, including various terminals held by users, including PC terminal, mobile terminal, edge device, cloud server, etc., users can have full access and control access to other users, users based on this to manage digital assets, make data asset files, and store keys according to security scenarios.
[0080] Management console 2 is an interactive management platform that supports management of blockchain consensus nodes and storage nodes in a decentralized blockchain scenario.
[0081] Storage node 3 is a decentralized trusted data storage system based on blockchain. The system is a decentralized, peer-to-peer distributed blockchain storage system that provides a high-throughput, content-addressed block storage model that supports flexible expansion of storage, multi-storage protocol adaptation support, peer-to-peer block security encryption, and can provide a secure, efficient, open, and low-cost multi-party shared storage network.
[0082] Consensus node 4 is a blockchain alliance chain network with efficient multi-party consensus, strong security contract engine, reliable privacy protection, and cross-chain interconnection and intercommunication.
[0083] Storage smart contract 5 is the core implementation of the blockchain network, which makes the decentralized (distributed) blockchain system programmable. The smart contract defines the rules between different organizations in the executable code, and is also a computer protocol designed to disseminate, verify, or execute contracts in an information-based way. By generating transaction records to the blockchain ledger through the smart contract, transactions can be conducted without a third party, ensuring that transactions can be tracked, tamper-proof, and irreversible.
[0084] As shown in Figure 5 The optional storage node schematic diagram provided by the embodiment of the application. The storage node includes a service interface module 21, a core API module 22, an interactive operation module 23, a data service subsystem 24, a multi-hash subsystem 25, and a data routing subsystem 26.
[0085] The data service subsystem 24 includes a storage access gateway 241, a data operation module 242, a data monitoring module 243, and a data storage module 244. It mainly realizes storage protocol conversion, data synchronization, data performance capacity monitoring, and data persistent storage functions.
[0086] The multi-hash subsystem 25 includes a data classification module 251, a multi-hash module 252, an on-chain anchoring module 253, and a certificate management module 254. It mainly realizes data security registration classification, multi-hash algorithm implementation, multi-blockchain underlying product and smart contract interface adaptation, certificate generation and management functions.
[0087] The data routing subsystem 26 includes modules such as security verification 261, queue management 262, subscription and publication 263, and data block exchange 264, which implement functions such as hash security detection, hash indexing, data block exchange, and subscription and publication.
[0088] like Figure 6 The diagram illustrates optional data storage according to an embodiment of this application. Typically, the hash value of the business data serves as the Key, and the business data itself is the Value. For example... Figure 7 The diagram shows an optional consensus node provided according to an embodiment of this application. The consensus node 3 stores state data 31 and block data 32. The state data 31 includes the index hash A of the data asset generated through multiple hashing, the hashes A1, A2, etc. of the data blocks.
[0089] This invention provides a processor for running a program, wherein the program executes a blockchain file-based processing method during runtime.
[0090] like Figure 8 As shown, this embodiment of the invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: obtaining a transaction request for instructing the storage of a target file; dividing the target file into blocks using a storage node one based on the space occupied by the target file and the data security level, to obtain an initial data block, wherein the storage node one is the storage node corresponding to the initiator of the transaction request, and the data security level is used to characterize the security level of the data in the target file; processing the initial data block using a multi-hash algorithm through the storage node one to obtain target key-value pairs; determining the target storage strategy for the target file based on the data security level and the access efficiency of the target file; and storing the target key-value pairs to the target storage node according to the target storage strategy, wherein the target storage node includes at least the storage node one.
[0091] Optionally, processing the initial data block by calling a multi-hash algorithm through storage node one to obtain the target key-value pair includes: performing hash calculation on the initial data block by calling a multi-hash algorithm through storage node one to obtain the initial key-value pair; obtaining the initiator's private key, and encrypting the initial key-value pair according to the private key to obtain the target key-value pair.
[0092] Optionally, after processing the initial data block by calling the multi-hash algorithm through storage node one to obtain the target key-value pair, the method further includes: calculating the target hash index of the target file through the multi-hash algorithm, wherein the target hash index is used to identify the target file.
[0093] Optionally, storing the target key-value pair to the target storage node according to the target storage strategy comprises: obtaining metadata information of the target file, wherein the metadata information represents attributes of the target file; and calling the smart contract to store the metadata information, the target hash index and the target key-value pair to the target storage node according to the target storage strategy.
[0094] Optionally, before obtaining the transaction request for indicating storage of the target file, the method further comprises: obtaining a user certificate and a key, wherein the user certificate and the key represent a legal identity of the initiator; performing permission verification on the blockchain according to the user certificate and the key to obtain an access credential, wherein the access credential is used for storage of the target file and access to the target file; and calling a storage resource interface of the blockchain according to the access credential to obtain IP and address information of all storage nodes in the blockchain node.
[0095] Optionally, after storing the target key-value pair to the target storage node according to the target storage strategy, the method further comprises: performing hash anchoring on a transaction behavior of the target file storage by the consensus node to complete consensus work; and returning a signal of successful storage of the target file to the initiator by the consensus node.
[0096] Optionally, after performing hash anchoring on the transaction behavior of the target file storage by the consensus node to complete the consensus work, the method further comprises: taking the target hash index as a key and the IP of the target storage node as a value to form an index key-value pair; and storing the index key-value pair to a target hash table of the blockchain. The device in the present application can be a server, a PC, a PAD, a mobile phone, etc.
[0097] The present application also provides a computer program product adapted to execute the program of the following method steps when executed on a data processing device: obtaining a transaction request for indicating storage of a target file; performing block processing on the target file by a storage node one according to a space size occupied by the target file and a data security level to obtain an initial data block, wherein the storage node one is a storage node corresponding to an initiator of the transaction request, and the data security level represents a security level of data in the target file; processing the initial data block by the storage node one to obtain a target key-value pair by using a multi-hash algorithm; determining a target storage strategy of the target file according to the data security level and an access efficiency of the target file; and storing the target key-value pair to a target storage node according to the target storage strategy, wherein the target storage node at least comprises the storage node one.
[0098] Optionally, the processing of the initial data block by the storage node one calling the multi-hash algorithm comprises: performing hash calculation on the initial data block by the storage node one calling the multi-hash algorithm to obtain an initial key-value pair; obtaining a private key of the initiator, and performing encryption processing on the initial key-value pair according to the private key to obtain the target key-value pair.
[0099] Optionally, after the processing of the initial data block by the storage node one calling the multi-hash algorithm to obtain the target key-value pair, the method further comprises: calculating a target hash index of the target file by the multi-hash algorithm, wherein the target hash index is used to identify the target file.
[0100] Optionally, the storing of the target key-value pair into the target storage node according to the target storage strategy comprises: obtaining metadata information of the target file, wherein the metadata information represents attributes of the target file; and storing the metadata information, the target hash index and the target key-value pair into the target storage node by calling the smart contract according to the target storage strategy.
[0101] Optionally, before the obtaining of the transaction request for indicating the storage of the target file, the method further comprises: obtaining user credentials and a key, wherein the user credentials and the key represent a legal identity of the initiator; performing permission verification on the blockchain according to the user credentials and the key to obtain an access credential, wherein the access credential is used for the storage of the target file and the access of the target file; and obtaining IP and address information of all storage nodes in the blockchain node by calling a storage resource interface of the blockchain according to the access credential.
[0102] Optionally, after the storing of the target key-value pair into the target storage node according to the target storage strategy, the method further comprises: performing hash anchoring on the transaction behavior of the target file storage by the consensus node to complete consensus work; and returning a signal of the successful storage of the target file to the initiator by the consensus node.
[0103] Optionally, after the performing of the hash anchoring on the transaction behavior of the target file storage by the consensus node to complete the consensus work, the method further comprises: assembling an index key-value pair with the target hash index as a key and the IP of the target storage node as a value; and storing the index key-value pair into a target hash table of the blockchain.
[0104] Those skilled in the art should understand that embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0105] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0106] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0107] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps listed in the flowchart block or blocks.
[0108] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0109] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, for storing instructions and data. The memory can also include non-volatile memory, such as read only memory (ROM), electrically programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), flash memory, or other non-volatile memory. The memory can be a memory of a computer-readable medium.
[0110] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0111] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusions, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0112] Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system or computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) containing computer usable program code.
[0113] The above merely provides embodiments of the present application and is not intended to limit the present application. Various modifications and changes can be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the scope of the claims of the present application.
Claims
1. A method for processing a blockchain file, characterized in that, The method comprises: obtaining a transaction request for indicating storage of a target file; performing block processing on the target file by a storage node one according to a space size occupied by the target file and a data security level, to obtain an initial data block, wherein the storage node one is a storage node corresponding to an initiator of the transaction request, and the data security level is used to represent a security level of data in the target file; processing the initial data block by the storage node one to obtain a target key-value pair by calling a multi-hash algorithm, wherein the target key-value pair comprises a key and a value, the key is a hash value of business data, and the value is business data; determining a target storage strategy of the target file according to the data security level and an access efficiency of the target file; storing the target key-value pair to a target storage node according to the target storage strategy, wherein the target storage node at least comprises the storage node one; processing the initial data block by the storage node one to obtain a target key-value pair comprises: performing hash calculation on the initial data block by the storage node one to obtain an initial key-value pair by calling the multi-hash algorithm; obtaining a private key of the initiator, and performing encryption processing on the initial key-value pair according to the private key to obtain the target key-value pair; after processing the initial data block by the storage node one to obtain a target key-value pair by calling a multi-hash algorithm, the method further comprises: calculating a target hash index of the target file by the multi-hash algorithm, wherein the target hash index is used to identify the target file.
2. The method of claim 1, wherein, storing the target key-value pair to a target storage node according to the target storage strategy comprises: obtaining metadata information of the target file, wherein the metadata information represents attributes of the target file; storing the metadata information, the target hash index and the target key-value pair to a target storage node by calling a smart contract according to the target storage strategy.
3. The method of claim 2, wherein, Before obtaining a transaction request for indicating storage of a target file, the method further comprises: obtaining user credentials and a key, wherein the user credentials and the key represent a legal identity of the initiator; performing permission verification on the blockchain according to the user credentials and the key to obtain an access credential, wherein the access credential is used for storage of the target file and access of the target file; calling a storage resource interface of the blockchain according to the access credential to obtain IP and address information of all storage nodes in the blockchain node.
4. The method of claim 3, wherein, After storing the target key-value pair to a target storage node according to the target storage strategy, the method further comprises: performing hash anchoring on a transaction behavior of the target file storage by a consensus node to complete consensus work; returning a signal of successful storage of the target file to the initiator by the consensus node.
5. The method of claim 4, wherein, After performing hash anchoring on a transaction behavior of the target file storage by a consensus node to complete consensus work, the method further comprises: Assembling an index key-value pair with the target hash index as a key and an IP of the target storage node as a value; Storing the index key-value pair into a target hash table of the blockchain. 6.A processing apparatus based on a blockchain file, characterized in that, The method comprises: A first obtaining unit is configured to obtain a transaction request for indicating a target file to be stored; A first processing unit is configured to perform block processing on the target file by a storage node one, to obtain initial data blocks, according to a space size occupied by the target file and a data security level, wherein the storage node one is a storage node corresponding to an initiator of the transaction request, and the data security level is used to represent a security level of data in the target file; A second processing unit is configured to perform processing on the initial data blocks by the storage node one, to obtain a target key-value pair, by calling a multi-hash algorithm, wherein the target key-value pair comprises a key and a value, the key is a hash value of business data, and the value is the business data; A determining unit is configured to determine a target storage strategy of the target file, according to the data security level and an access efficiency of the target file; A first storage unit is configured to store the target key-value pair into a target storage node according to the target storage strategy, wherein the target storage node at least comprises the storage node one; The second processing unit comprises: a calculation module configured to perform hash calculation on the initial data blocks by the storage node one, to obtain an initial key-value pair, by calling the multi-hash algorithm; and an encryption module configured to obtain a private key of the initiator, and perform encryption processing on the initial key-value pair according to the private key, to obtain the target key-value pair. The apparatus further comprises a calculation unit configured to calculate a target hash index of the target file by the multi-hash algorithm, after the target key-value pair is obtained by performing processing on the initial data blocks by the storage node one, by calling the multi-hash algorithm, wherein the target hash index is used to identify the target file.
7. A processor, comprising: The processor is configured to run a program, wherein the program performs the processing method based on the blockchain file according to any one of claims 1 to 5 when the program is run.
8. An electronic device, comprising: The apparatus comprises one or more processors and a memory, and the memory is configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the processing method based on the blockchain file according to any one of claims 1 to 5.
Citation Information
Patent Citations
File system implementation method and device based on key value pairs, device and storage medium
CN109656886A
File storage method based on block chain and electronic equipment
CN111611622A
Distributed file classified storage system and method based on block chain
CN111966657A