CN112257087B - File chaining method and system of block chain - Google Patents

File chaining method and system of block chain Download PDF

Info

Publication number
CN112257087B
CN112257087B CN202011152401.0A CN202011152401A CN112257087B CN 112257087 B CN112257087 B CN 112257087B CN 202011152401 A CN202011152401 A CN 202011152401A CN 112257087 B CN112257087 B CN 112257087B
Authority
CN
China
Prior art keywords
file
copy
metadata
intelligent contract
node list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011152401.0A
Other languages
Chinese (zh)
Other versions
CN112257087A (en
Inventor
张曙华
杨安荣
杨铁党
路斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Xinlian Information Development Co ltd
Original Assignee
Shanghai Xinlian Information Development Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Xinlian Information Development Co ltd filed Critical Shanghai Xinlian Information Development Co ltd
Priority to CN202011152401.0A priority Critical patent/CN112257087B/en
Publication of CN112257087A publication Critical patent/CN112257087A/en
Application granted granted Critical
Publication of CN112257087B publication Critical patent/CN112257087B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • G06F16/137Hash-based
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a file uplink method and a system of a block chain, which are applied to a system intelligent contract and comprise the following steps: receiving file data information sent by a user intelligent contract; extracting file data information to obtain first file metadata; transmitting the file data information to an interstellar file system so that the interstellar file system stores the file data information and extracts the file data information to obtain second file metadata; receiving second file metadata sent by an interstellar file system; the method comprises the steps that a file copy node list is subjected to a copy policy control algorithm, so that the number of copies in the file copy node list meets the condition of a pre-stored copy policy; combining the first file metadata and the second file metadata to obtain combined metadata; the combined metadata is uplink and sent to a user intelligent contract; the system intelligent contract is used for calculating the file data in the interstellar file system, so that the calculation safety and reliability are improved, and the file data can be permanently stored.

Description

File chaining method and system of block chain
Technical Field
The invention relates to the technical field of blockchains, in particular to a file uplink method and a system of a blockchain.
Background
At present, an interstellar file system stores original file data, and belongs to out-of-chain storage; metadata of the original file data is stored on the blockchain. Because the original file data belong to the out-of-chain storage, the system intelligent contracts running on the blockchain cannot access the original file data, and therefore the original file data cannot be calculated to ensure the safety and reliability of calculation.
In addition, when original file data stored outside the chain is lost or maliciously deleted, the system intelligent contract cannot solve the problem, so that the original file data cannot be permanently stored.
Disclosure of Invention
In view of the above, the present invention aims to provide a method and a system for linking files of a blockchain, which integrate an interstellar file system into a peer node of the blockchain, and calculate file data in an interstellar file system through a system intelligent contract, so as to improve the security and reliability of the calculation, and enable the file data to be permanently stored.
In a first aspect, an embodiment of the present invention provides a method for linking files of a blockchain, which is applied to a system intelligent contract, and the method includes:
receiving file data information sent by a user intelligent contract;
extracting the file data information to obtain first file metadata;
the file data information is sent to an interstellar file system, so that the interstellar file system stores the file data information and extracts the file data information to obtain second file metadata;
receiving the second file metadata sent by the interstellar file system, wherein the second file metadata comprises a file content identifier and at least one file copy node list corresponding to the file content identifier;
the file copy node list is subjected to a copy policy control algorithm, so that the number of copies in the file copy node list meets the condition of a pre-stored copy policy;
combining the first file metadata and the second file metadata to obtain combined metadata;
the combined metadata is uplink and sent to the user intelligent contract;
wherein the system intelligence contract, the interplanetary file system, and the user intelligence contract are all disposed in peer nodes of a blockchain.
Further, the step of enabling the number of the copies in the file copy node list to meet the condition of a pre-stored copy policy through a copy policy control algorithm includes repeatedly executing the following processes until the number of the copies in the file copy node list is greater than or equal to the number of the copies in the pre-stored copy policy:
when the number of copies in the file copy node list is smaller than the number of copies in the pre-stored copy strategy, selecting a first node from the file copy node list;
and reserving the file data information through the first node.
Further, the selecting the first node from the file copy node list includes:
judging whether the number of the file copy node list is smaller than the number of all nodes of a alliance chain in a blockchain;
if the file copy node list is smaller than the file copy node list, selecting a copy which is not stored in the alliance chain, and adding the copy into a to-be-selected organization list;
if the number of the organization lists to be selected is equal to 0, adding all organizations in the alliance chain into the organization lists to be selected;
selecting a first organization from the list of to-be-selected organizations;
acquiring a node list corresponding to the first organization, and forming a node list to be selected;
and if the number of the node list to be selected is greater than 0, selecting the first node from the node list to be selected.
Further, the method further comprises:
receiving file retrieval request information sent by the user intelligent contract, wherein the file retrieval request information comprises file identification information;
searching whether the file identification information exists or not from a state database;
if so, acquiring file metadata corresponding to the file identification information from the state database;
transmitting file metadata corresponding to the file identification information to a user intelligent contract;
and if the intelligent contract does not exist, sending error prompt information to the intelligent contract of the user.
Further, the method further comprises:
receiving first abstract information and on-chain credential information sent by a user intelligent contract;
searching corresponding third file metadata from a state database according to the on-chain credential information;
and sending the third file metadata to the user intelligent contract so that the user intelligent contract extracts the third file metadata to obtain second abstract information, and matching the first abstract information with the second abstract information to obtain a matching result.
Further, the first summary information is obtained by extracting verification file information through a client or the user intelligent contract, wherein the first summary information comprises a first hash, and the second summary information comprises a second hash.
In a second aspect, embodiments of the present invention provide a blockchain file chaining system, the system including at least one peer node, the peer node including a system intelligence contract, an interstellar file system, and a user intelligence contract; the interstellar file system and the user intelligent contract are respectively connected with the system intelligent contract;
the user intelligent contract is used for sending file data information to the system intelligent contract;
the interstellar file system is used for storing the file data information and extracting the file data information to obtain second file metadata;
the system intelligent contract is used for extracting the file data information to obtain first file metadata; receiving the second file metadata sent by the interstellar file system, wherein the second file metadata comprises a file content identifier and at least one file copy node list corresponding to the file content identifier; the file copy node list is subjected to a copy policy control algorithm, so that the number of copies in the file copy node list meets the condition of a pre-stored copy policy; combining the first file metadata and the second file metadata to obtain combined metadata; and the combined metadata is uplink and sent to the user intelligent contract.
Further, the system intelligence contract is specifically configured to repeatedly perform the following processes until the number of copies in the file copy node list is greater than or equal to the number of copies in the pre-stored copy policy:
when the number of copies in the file copy node list is smaller than the number of copies in the pre-stored copy strategy, selecting a first node from the file copy node list;
and reserving the file data information through the first node.
In a third aspect, an embodiment of the present invention provides an electronic device, including a memory, and a processor, where the memory stores a computer program executable on the processor, and where the processor implements a method as described above when executing the computer program.
In a fourth aspect, embodiments of the present invention provide a computer readable medium having non-volatile program code executable by a processor, the program code causing the processor to perform the method as described above.
The embodiment of the invention provides a file uplink method and a system of a block chain, which are applied to a system intelligent contract and comprise the following steps: receiving file data information sent by a user intelligent contract; extracting file data information to obtain first file metadata; transmitting the file data information to an interstellar file system so that the interstellar file system stores the file data information and extracts the file data information to obtain second file metadata; receiving second file metadata sent by an interstellar file system, wherein the second file metadata comprises a file content identifier and at least one file copy node list corresponding to the file content identifier; the method comprises the steps that a file copy node list is subjected to a copy policy control algorithm, so that the number of copies in the file copy node list meets the condition of a pre-stored copy policy; combining the first file metadata with the second file metadata to obtain combined metadata; the combined metadata is uplink and sent to a user intelligent contract; the system intelligent contracts, the interstellar file system and the user intelligent contracts are all arranged in the peer-to-peer nodes of the block chain, and the file data in the interstellar file system is calculated through the system intelligent contracts, so that the safety and reliability of calculation are improved, and the file data can be permanently stored.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the above objects, features and advantages of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for file chaining of a blockchain provided in accordance with an embodiment of the present invention;
FIG. 2 is a flowchart of a method for storing and uploading file data information according to a first embodiment of the present invention;
FIG. 3 is a schematic diagram of a copy policy control algorithm according to a first embodiment of the present invention;
FIG. 4 is a flowchart of a method for retrieving file data information according to an embodiment of the present invention;
FIG. 5 is a flowchart of a method for verifying file data information according to an embodiment of the present invention;
FIG. 6 is a block chain system diagram of a second embodiment of the present invention.
Icon:
1-peer nodes; 2-system smart contracts; 3-interstellar file system; 4-user intelligence contracts; 5-state database.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The interplanetary file system IPFS (Inter-Planetary File System) is a global, point-to-point distributed version of the file system, with the principle of replacing domain name based addresses with content based addresses. The file system supports efficient and persistent storage of files and supports historical version backtracking.
The federation chain, also known as a license chain, is provided by members participating in the federation for members of a particular community and for limited third parties, with the generation of blocks being determined by all nodes through a consensus algorithm. The alliance chain has a certain admittance mechanism to the configuration of the consensus or verification node and the network environment, and can flexibly control the scale of the members and the nodes, thereby easily obtaining better performance.
The system intelligence contracts are intelligent contracts maintained and run by the blockchain, which do not require user deployment and provide system level services to all peer nodes and user intelligence contracts.
The interstellar file system is separated from the blockchain, original file data is stored in the interstellar file system, and metadata of the original file data is stored in the blockchain. Whereas the original file data stored in the interstellar file system is actually an off-chain resource.
Because the original file data belong to the out-of-chain storage, the system intelligent contracts running on the blockchain cannot access the original file data, and therefore the original file data cannot be calculated to ensure the safety and reliability of calculation.
In addition, when original file data stored outside the chain is lost or maliciously deleted, the system intelligent contract cannot solve the problem, so that the original file data cannot be permanently stored.
In the application, an interstellar file system is integrated into a peer node of a alliance chain, the number of file storage copies and distribution in the peer node are controlled by adopting a system intelligent contract, a file metadata state library is maintained, and an interface of the interstellar file system is provided for a user. The storage of file data on peer nodes is controlled by a system intelligence contract, thereby achieving efficient, secure and permanent storage, and enabling the system intelligence contract to provide an access interface for the file system for the user intelligence contract.
In order to facilitate understanding of the present embodiment, the following describes embodiments of the present invention in detail.
Embodiment one:
FIG. 1 is a flowchart of a method for file chaining of a blockchain according to an embodiment of the present invention.
Referring to fig. 1, applied to a system intelligence contract, the method includes the steps of:
step S101, receiving file data information sent by a user intelligent contract;
step S102, extracting file data information to obtain first file metadata;
step S103, the file data information is sent to an interstellar file system, so that the interstellar file system stores the file data information and extracts the file data information to obtain second file metadata;
step S104, receiving second file metadata sent by an interstellar file system, wherein the second file metadata comprises a file content identifier and at least one file copy node list corresponding to the file content identifier;
step S105, the number of copies in the file copy node list meets the condition of a pre-stored copy strategy through a copy strategy control algorithm;
step S106, combining the first file metadata and the second file metadata to obtain combined metadata;
step S107, the combined metadata is uplink and sent to the intelligent contract of the user;
wherein the system intelligence contracts, the interplanetary file system, and the user intelligence contracts are all disposed in peer nodes of the blockchain.
Specifically, the execution subject of the method is a system intelligent contract, which introduces file system services for the user intelligent contract, thereby providing files stored on peer nodes to the user intelligent contract access in the manner of on-link resources, and providing standard file services for the user intelligent contract. If the file metadata is automatically extracted and submitted to the uplink service, the development of intelligent contracts of users is simplified. In order to ensure that file data can be safely and permanently stored and quickly accessed, the system intelligent contract realizes control of file copies according to a copy policy control algorithm, and ensures that a copy control policy is executed when organization nodes join and exit.
Referring to a flowchart of a method of storing and uploading file data information as shown in fig. 2, the method comprises the steps of:
step S201, a client sends file data information to a user intelligent contract, wherein the file data information is a binary data packet or a data stream;
step S202, the user intelligent contract can directly send file data information to the system intelligent contract through the system intelligent contract interface;
step S203, the system intelligent contract extracts file data information to obtain first file metadata;
step S204, selecting any node to send the file data information to the interstellar file system so that the interstellar file system extracts the file data information to obtain second file metadata; the node is set to execute PIN operation so as to ensure that the node keeps file data information from being cleared;
step S205, the interstellar file system sends second file metadata to the system intelligent contract, wherein the second file metadata comprises file content identifiers, at least one file copy node list corresponding to the file content identifiers, hash address and other information;
step S206, the intelligent contract of the system executes a copy policy control algorithm to ensure that the number of copies in the node list of the file copy meets the condition of a pre-stored copy policy;
step S207, combining the first file metadata and the second file metadata to obtain combined metadata, and executing an endorsement process on the combined metadata to link and account the combined metadata;
step S208, writing the combined metadata into a state database in a billing stage;
step S209, the system intelligent contract sends the combined metadata to the user intelligent contract;
in step S210, the user smart contract returns the combined metadata to the client.
Further, step S105 includes repeatedly executing the following processes until the number of copies in the file copy node list is greater than or equal to the number of copies in the pre-stored copy policy:
step S1051, when the number of copies in the file copy node list is smaller than the number of copies in the pre-stored copy strategy, selecting a first node from the file copy node list;
step S1052, the file data information is retained by the first node.
In particular, to enable persistent storage of file data information, it is desirable to control the storage of multiple copies of a file on multiple peer nodes. This ensures that any changes to a single peer node will not result in the loss of file data information. The number of copies affects the file storage efficiency of the overall system, so the copy policy control algorithm is used as part of the on-chain configuration, which is commonly known and submitted to the chain by the coalition members, and its changes. The system intelligence contract is a secure means of ensuring that the copy policy control algorithm is executed. Referring to the replica policy control algorithm as shown in fig. 3, it comprises the steps of:
step S301, loading a pre-stored copy strategy;
step S302, checking whether a file Content Identifier (CID) exists in the interstellar file system, if not, reporting that the file content identifier does not exist, and ending the flow; if so, step S303 is performed.
Step S303, obtaining a file copy node list; the file copy node list is obtained from the second file metadata of the interstellar file system, the file copy node list is a PIN node list, and file data information is ensured not to be deleted by a garbage disposal program of the interstellar file system on the PIN node list.
Step S304, detecting whether the number of copies in the file copy node list is smaller than the number of copies in the pre-stored copy policy according to the file copy node list and the pre-stored copy policy, and if so, executing step S305; otherwise, the flow ends;
step S305, selecting a first node from a file copy node list in order to distribute file copies to organization nodes of different alliance chains as much as possible;
step S306, checking whether the selected first node exists, if not, ending the flow; otherwise, step S307 is executed;
step S307, the file data information is reserved through the first node, namely PIN operation is executed on the selected first node, and the PIN operation is used for reserving the file data information on the first node for a long time so as to avoid the recovery and deletion of the file data information;
step S308, repeatedly executing step S304 until the number of copies in the file copy node list is greater than or equal to the number of copies in the pre-stored copy policy.
Further, step S201 includes the steps of:
step S401, judging whether the number of the file copy node list is smaller than the number of all nodes of the alliance chain in the blockchain;
step S402, if the file copy node list is smaller than the file copy node list, selecting a copy which is not stored in the alliance chain, and adding the copy into a to-be-selected organization list; if yes, selecting the node to be empty, and executing step S304;
step S403, if the number of the organization list to be selected is equal to 0, adding all organizations in the alliance chain into the organization list to be selected;
step S404, selecting a first organization from a list of to-be-selected organizations;
step S405, a node list corresponding to a first organization is obtained, and a node list to be selected is formed;
here, all node lists of the first organization are acquired, the lists are formed into a list of nodes to be selected, and nodes already existing in the list of nodes of the file copy are deleted from the list of nodes to be selected.
Step S406, checking the number of the node list to be selected, and if the number of the node list to be selected is greater than 0, selecting a first node from the node list to be selected; otherwise, step S401 is performed.
Here, the first node is any node in the list of candidate nodes.
The automatic triggering system intelligent contract executes a copy policy control algorithm when the following events occur, specifically: 1) When a new file is submitted, the intelligent contract of the system firstly selects one node at will and submits the file to the interstellar file system, and then a copy strategy control algorithm is executed to control the number of copies and the distribution on the node to accord with the prestoring copy strategy condition; 2) When a new organization node is added, the system does not make any changes to the existing copy of the file. The new file is stored on the newly added node according to the copy policy control algorithm; 3) When an organization node exits, the system intelligent contract checks a pre-stored copy strategy, and executes a copy strategy control algorithm on all files stored on the organization node; 4) When the pre-stored copy policy is changed, the performance problem is considered, the change of the pre-stored copy policy only affects the submitted new file, and the submitted file and the copy thereof are not affected.
Further, the method comprises the following steps:
step S501, receiving file retrieval request information sent by a user intelligent contract, wherein the file retrieval request information comprises file identification information;
step S502, searching whether file identification information exists from a state database;
step S503, if yes, acquiring file metadata corresponding to the file identification information from a state database;
step S504, file metadata corresponding to the file identification information is sent to a user intelligent contract;
in step S505, if not, an error prompt message is sent to the user' S smart contract.
Specifically, referring to a retrieval method of file data information as shown in fig. 4, a retrieval service is used to acquire file metadata or file data information itself, the method comprising the steps of:
in step S601, the client sends file retrieval request information to the user smart contract, the file retrieval request information including file identification information. The file identification information may be a unique ID of a file given by a user, or may be an identification from metadata of a file, for example, an uplink transaction ID (Identity, user identification), a Content ID (CID) stored in an interstellar file system, or the like;
step S602, the user intelligent contract sends file retrieval request information to the system intelligent contract (the system intelligent contract can maintain metadata information about the file);
step S603, the intelligent contract of the system inquires whether file identification information exists or not through a state database, namely, the record on the chain of the related file;
step S604, if yes, acquiring file metadata corresponding to the file identification information from a state database; if not, sending error prompt information to the intelligent contract of the user, namely returning corresponding error codes and messages;
step S605, the system intelligent contract returns a file retrieval result to the user intelligent contract, wherein the file retrieval result is file metadata corresponding to the file identification information;
in step S606, if present, the user-agent contract may obtain file metadata through the system-agent contract. In most cases, only file metadata information needs to be returned for performance considerations;
in step S607, the user smart contract returns the file retrieval result to the client.
Further, the method comprises the following steps:
step S701, receiving first abstract information and on-chain credential information sent by a user intelligent contract;
step S702, searching corresponding third file metadata from a state database according to the on-chain credential information;
in step S703, the third file metadata is sent to the user smart contract, so that the user smart contract extracts the third file metadata to obtain second summary information, and the first summary information and the second summary information are matched to obtain a matching result.
Further, the first summary information is obtained by extracting verification file information through a client or a user intelligent contract, wherein the first summary information comprises a first hash, and the second summary information comprises a second hash.
Specifically, referring to the verification method of file data information as shown in fig. 5, in the process of the file data information uplink, the system is already independently calculated, and the summary information of the file data information is stored as a part of the file metadata on the chain, and the summary information is used in the verification process. The method comprises the following steps:
step S801, a client submits an original file and on-chain credential information;
here, the on-chain credential information is used to obtain on-chain information about the file on the chain. In this step, if the client is a trusted client (e.g., a trusted business system), for performance considerations, the first summary information of the original file may be calculated by the client and sent to the user's smart contract along with the on-chain credential information;
in step S802, the user smart contract performs digest calculation based on the received original file. The step can be chosen and removed according to the requirement, and if the client directly transmits the first abstract information, the step is not needed;
step S803, retrieving the third file metadata from the system intelligent contract according to the on-chain credential information;
step S804, the system intelligent contract retrieves the third file metadata from the state database;
step S805, returning the third file metadata by the status database;
step S806, the system intelligent contract returns the third file metadata to the user intelligent contract;
step S807, the user intelligent contract analyzes the third file metadata, obtains second abstract information stored on the chain, and matches the first abstract information with the second abstract information to obtain a matching result;
step S808, returning the matching result to the client.
In the application, the system intelligent contracts, the interstellar file system and the user intelligent contracts are all arranged in the peer-to-peer nodes of the blockchain, and the interstellar file system is integrated into a part of the alliance node service of the blockchain, so that the file storage service becomes a basic service of the alliance chain. Storing file metadata in a state database is supported by a system intelligence contract and a corresponding interface is provided for a user intelligence contract. By setting a pre-stored copy strategy, the safety and the efficiency of file storage are considered, and the safe, permanent and effective storage of files on a chain is realized, so that the application scene of alliance nodes is expanded.
Embodiment two:
FIG. 6 is a block chain system diagram of a second embodiment of the present invention.
Referring to fig. 6, the system includes at least one peer node 1, the peer node 1 including a system intelligence contract 2, an interplanetary file system 3, and a user intelligence contract 4; the interstellar file system 3 and the user intelligent contract 4 are respectively connected with the system intelligent contract 2;
introducing an interstellar file system 3 into the peer node 1 as a file database system other than a state database; peer 1 of each federation chain is also the serving node of the interstellar file system 3; providing a default state database of the system to store file metadata, such as abstract information, interstellar file system content addresses and other necessary metadata information; the system intelligence contract 2 executes a copy policy control algorithm and is also used for maintaining the interstellar file system 3 and the state database and providing a file service access interface for the user intelligence contract 4.
The user intelligent contract 4 is used for sending file data information to the system intelligent contract 2;
the interstellar file system 3 is used for storing the file data information and extracting the file data information to obtain second file metadata;
the system intelligent contract 2 is used for extracting file data information to obtain first file metadata; receiving second file metadata sent by an interstellar file system, wherein the second file metadata comprises a file content identifier and at least one file copy node list corresponding to the file content identifier; the method comprises the steps that a file copy node list is subjected to a copy policy control algorithm, so that the number of copies in the file copy node list meets the condition of a pre-stored copy policy; combining the first file metadata with the second file metadata to obtain combined metadata; and (4) the combined metadata is uplink and sent to the user intelligent contract 4.
Further, the system intelligent contract 2 is specifically configured to repeatedly execute the following processes until the number of copies in the file copy node list is greater than or equal to the number of copies in the pre-stored copy policy:
when the number of copies in the file copy node list is smaller than the number of copies in a pre-stored copy strategy, selecting a first node from the file copy node list;
the file data information is maintained by the first node.
The embodiment of the invention provides a file uplink method and a system of a block chain, which are applied to a system intelligent contract and comprise the following steps: receiving file data information sent by a user intelligent contract; extracting file data information to obtain first file metadata; transmitting the file data information to an interstellar file system so that the interstellar file system stores the file data information and extracts the file data information to obtain second file metadata; receiving second file metadata sent by an interstellar file system, wherein the second file metadata comprises a file content identifier and at least one file copy node list corresponding to the file content identifier; the method comprises the steps that a file copy node list is subjected to a copy policy control algorithm, so that the number of copies in the file copy node list meets the condition of a pre-stored copy policy; combining the first file metadata with the second file metadata to obtain combined metadata; the combined metadata is uplink and sent to a user intelligent contract; the system intelligent contracts, the interstellar file system and the user intelligent contracts are all arranged in the peer-to-peer nodes of the block chain, and the file data in the interstellar file system is calculated through the system intelligent contracts, so that the safety and reliability of calculation are improved, and the file data can be permanently stored.
The embodiment of the invention also provides electronic equipment, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the steps of the file chaining method of the blockchain provided by the embodiment when executing the computer program.
The present invention also provides a computer readable medium having non-volatile program code executable by a processor, the computer readable medium having a computer program stored thereon, which when executed by the processor performs the steps of the blockchain file chaining method of the above embodiments.
The computer program product provided by the embodiment of the present invention includes a computer readable storage medium storing a program code, where instructions included in the program code may be used to perform the method described in the foregoing method embodiment, and specific implementation may refer to the method embodiment and will not be described herein.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
In addition, in the description of embodiments of the present invention, unless explicitly stated and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above examples are only specific embodiments of the present invention, and are not intended to limit the scope of the present invention, but it should be understood by those skilled in the art that the present invention is not limited thereto, and that the present invention is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of file chaining for a blockchain, applied to a system intelligence contract, the method comprising:
receiving file data information sent by a user intelligent contract;
extracting the file data information to obtain first file metadata;
the file data information is sent to an interstellar file system, so that the interstellar file system stores the file data information and extracts the file data information to obtain second file metadata;
receiving the second file metadata sent by the interstellar file system, wherein the second file metadata comprises a file content identifier and at least one file copy node list corresponding to the file content identifier;
the file copy node list is subjected to a copy policy control algorithm, so that the number of copies in the file copy node list meets the condition of a pre-stored copy policy;
combining the first file metadata and the second file metadata to obtain combined metadata;
the combined metadata is uplink and sent to the user intelligent contract;
wherein the system intelligence contract, the interplanetary file system, and the user intelligence contract are all disposed in peer nodes of a blockchain.
2. The blockchain file uplink method according to claim 1, wherein the step of enabling the number of copies in the file copy node list to meet the condition of a pre-stored copy policy through a copy policy control algorithm includes repeatedly performing the following processes until the number of copies in the file copy node list is greater than or equal to the number of copies in the pre-stored copy policy:
when the number of copies in the file copy node list is smaller than the number of copies in the pre-stored copy strategy, selecting a first node from the file copy node list;
and reserving the file data information through the first node.
3. The blockchain file chaining method of claim 2, wherein the selecting the first node from the list of file copy nodes comprises:
judging whether the number of the file copy node list is smaller than the number of all nodes of a alliance chain in a blockchain;
if the file copy node list is smaller than the file copy node list, selecting a copy which is not stored in the alliance chain, and adding the copy into a to-be-selected organization list;
if the number of the organization lists to be selected is equal to 0, adding all organizations in the alliance chain into the organization lists to be selected;
selecting a first organization from the list of to-be-selected organizations;
acquiring a node list corresponding to the first organization, and forming a node list to be selected;
and if the number of the node list to be selected is greater than 0, selecting the first node from the node list to be selected.
4. The blockchain file chaining method of claim 1, further comprising:
receiving file retrieval request information sent by the user intelligent contract, wherein the file retrieval request information comprises file identification information;
searching whether the file identification information exists or not from a state database;
if so, acquiring file metadata corresponding to the file identification information from the state database;
transmitting file metadata corresponding to the file identification information to a user intelligent contract;
and if the intelligent contract does not exist, sending error prompt information to the intelligent contract of the user.
5. The blockchain file chaining method of claim 1, further comprising:
receiving first abstract information and on-chain credential information sent by the user intelligent contract;
searching corresponding third file metadata from a state database according to the on-chain credential information;
and sending the third file metadata to the user intelligent contract so that the user intelligent contract extracts the third file metadata to obtain second abstract information, and matching the first abstract information with the second abstract information to obtain a matching result.
6. The blockchain file chaining method of claim 5, wherein the first digest information is extracted from the verification file information by a client or the user intelligence contract, wherein the first digest information includes a first hash and the second digest information includes a second hash.
7. A file system for a blockchain, the system comprising at least one peer node, the peer node comprising a system intelligence contract, an interstellar file system, and a user intelligence contract; the interstellar file system and the user intelligent contract are respectively connected with the system intelligent contract;
the user intelligent contract is used for sending file data information to the system intelligent contract;
the interstellar file system is used for storing the file data information and extracting the file data information to obtain second file metadata;
the system intelligent contract is used for extracting the file data information to obtain first file metadata; receiving the second file metadata sent by the interstellar file system, wherein the second file metadata comprises a file content identifier and at least one file copy node list corresponding to the file content identifier; the file copy node list is subjected to a copy policy control algorithm, so that the number of copies in the file copy node list meets the condition of a pre-stored copy policy; combining the first file metadata and the second file metadata to obtain combined metadata; and the combined metadata is uplink and sent to the user intelligent contract.
8. The blockchain file system of claim 7, wherein the system intelligence contract is specifically configured to repeat the following until the number of copies in the file copy node list is greater than or equal to the number of copies in the pre-stored copy policy:
when the number of copies in the file copy node list is smaller than the number of copies in the pre-stored copy strategy, selecting a first node from the file copy node list;
and reserving the file data information through the first node.
9. An electronic device comprising a memory, a processor, the memory having stored thereon a computer program executable on the processor, characterized in that the processor implements the method of any of the preceding claims 1 to 6 when the computer program is executed.
10. A computer readable medium having non-volatile program code executable by a processor, the program code causing the processor to perform the method of any one of claims 1 to 6.
CN202011152401.0A 2020-10-23 2020-10-23 File chaining method and system of block chain Active CN112257087B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011152401.0A CN112257087B (en) 2020-10-23 2020-10-23 File chaining method and system of block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011152401.0A CN112257087B (en) 2020-10-23 2020-10-23 File chaining method and system of block chain

Publications (2)

Publication Number Publication Date
CN112257087A CN112257087A (en) 2021-01-22
CN112257087B true CN112257087B (en) 2024-01-19

Family

ID=74261777

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011152401.0A Active CN112257087B (en) 2020-10-23 2020-10-23 File chaining method and system of block chain

Country Status (1)

Country Link
CN (1) CN112257087B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109493055A (en) * 2018-11-28 2019-03-19 深圳力维智联技术有限公司 Networking block chain equipment, data processing method and device based on block chain
CN110851796A (en) * 2019-11-12 2020-02-28 北京工商大学 Music copyright protection system based on block chain intelligent contract
CN110866273A (en) * 2019-11-09 2020-03-06 北京工业大学 Inter-enterprise standard consensus method based on block chain and interplanetary file system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10833865B2 (en) * 2018-04-30 2020-11-10 Dell Products L.P. Blockchain-based method and system for immutable resource allocation in a cloud computing environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109493055A (en) * 2018-11-28 2019-03-19 深圳力维智联技术有限公司 Networking block chain equipment, data processing method and device based on block chain
CN110866273A (en) * 2019-11-09 2020-03-06 北京工业大学 Inter-enterprise standard consensus method based on block chain and interplanetary file system
CN110851796A (en) * 2019-11-12 2020-02-28 北京工商大学 Music copyright protection system based on block chain intelligent contract

Also Published As

Publication number Publication date
CN112257087A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
CN110417844B (en) System and method for decentralized management of multiple owner nodes using blockchains
CN112926982B (en) Transaction data processing method, device, equipment and storage medium
EP3812992A1 (en) Block chain transaction method and apparatus
CN101360121B (en) Authority control method, system and terminal in apparatus management
CN110730225A (en) Data processing method of Internet of things based on block chain, Internet of things and storage medium
CN111489256B (en) Cross-chain processing method, device and system for multi-chain block chain system
CN110602108B (en) Data communication method, device, equipment and storage medium based on block chain network
Rajabi et al. Feasibility analysis for sybil attacks in shard-based permissionless blockchains
CN110266872B (en) Address book data management and control method and device, cloud address book system, computer equipment and computer readable storage medium
CN110149323B (en) Processing device with ten-million-level TPS (platform secure protocol) contract processing capacity
CN108710681A (en) File acquisition method, device, equipment and storage medium
CN114363352B (en) Cross-chain interaction method of Internet of things system based on block chain
CN112988667B (en) Data storage method and device based on block chain network
CN115114305A (en) Lock management method, device, equipment and storage medium for distributed database
CN110855688B (en) Block chain information processing method and related equipment
CN103503388B (en) A kind of distributed queue's message read method and equipment, system
CN112699136B (en) Cross-link certificate storage method and related device
CN112257087B (en) File chaining method and system of block chain
CN111597537B (en) Block chain network-based certificate issuing method, related equipment and medium
CN110519287B (en) Information management method and related equipment
JP4249605B2 (en) Client server system, cache control method, and computer program
CN113378120A (en) Version authorization control method, device, equipment and storage medium based on block chain
KR100583177B1 (en) Method of processing charging message to prevent double charging, and server therefor
KR20220056574A (en) A method and an apparatus for master key management based on sharing algorithms for block chain transactions
KR20200115786A (en) Method and system for providing data management service based on block chain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant