CN115408046A - Decentralized file version control method, computer equipment and storage medium - Google Patents

Decentralized file version control method, computer equipment and storage medium Download PDF

Info

Publication number
CN115408046A
CN115408046A CN202210928820.1A CN202210928820A CN115408046A CN 115408046 A CN115408046 A CN 115408046A CN 202210928820 A CN202210928820 A CN 202210928820A CN 115408046 A CN115408046 A CN 115408046A
Authority
CN
China
Prior art keywords
file
version
updating
file version
update
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.)
Pending
Application number
CN202210928820.1A
Other languages
Chinese (zh)
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.)
Chongqing Yitong College
Original Assignee
Chongqing Yitong College
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 Chongqing Yitong College filed Critical Chongqing Yitong College
Priority to CN202210928820.1A priority Critical patent/CN115408046A/en
Publication of CN115408046A publication Critical patent/CN115408046A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • 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/6209Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself

Landscapes

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

Abstract

The invention requests to protect a decentralized file version control method, which comprises the following steps: uploading the first version of the file to an IPFS file system to obtain a first hash address of the first version of the file; executing a file version control registration transaction through a file version control contract, and recording a first public key and a first hash address of a first version of a file on a block chain: encrypting the file update record by a Diffie-Hellman algorithm to generate first encrypted file version update information; generating a first file update transaction comprising first encrypted file version update information and sending the first file update transaction to a blockchain network; executing a first file version update transaction; executing a file version update settlement transaction including a first private key corresponding to the first public key: decrypting according to the first encrypted file version updating information to obtain corresponding file version updating information; and updating the file version according to the acquired file version updating information.

Description

Decentralized file version control method, computer equipment and storage medium
Technical Field
The application relates to the technical field of internet, in particular to a decentralized file version control method, computer equipment and a storage medium.
Background
Multiparty collaboration is one of the most important aspects of file version control. Under the scenario that multiple parties participate in documentation, how to manage the correct file version and track the change of the file version becomes a major challenge for file version control.
An intelligent contract is a computer protocol aiming at propagating, verifying or executing contracts in an information mode, is used when the contracts are formulated in a block chain, and comprises code functions which can interact with other contracts, make decisions, store data and the like. The intelligent contracts primarily provide for verifying and executing conditions set within the contract. Smart contracts allow trusted transactions to be conducted without third parties, which transactions are traceable and irreversible.
The InterPlanetary File System (IPFS) is a decentralized, distributed File System. The files stored in the IPFS are unique, each uploaded file is endowed with a unique hash address, and when the content of the file is modified, the corresponding hash address is changed, so that the file and the hash address are ensured to be in one-to-one correspondence.
Most of the existing file version control systems are centralized, and once a central server fails, stored files are permanently lost. The file version is modified without authorization. Moreover, in such a centralized file version control system, the history of file version updates can be tampered with, which affects the reliability of each version of the file. Therefore, a safe, reliable, decentralized method for controlling file versions is needed to manage and control the file versions.
CN111427614A, a method and an apparatus for managing file versions, the method includes: constructing a decentralized named IPNS system, wherein the IPNS system comprises a plurality of IPFS nodes; after obtaining a new version file, storing the new version file to an IPFS node; pointing a file pointer of the IPNS system to a new version file of the IPFS node; and downloading the new edition file based on the file pointer of the IPNS system. The invention can realize file version management, and has high downloading speed and high file tracking and displaying speed.
The patent does not carry out authority control on an account for updating the file version, and anyone can update the file version. According to the invention, through configuring the file version updating right for the user, the version of the file can be updated only by the account with the file version updating right, so that illegal tampering of the version by a third party is effectively avoided. The patent does not record the file version updating history, and is not beneficial to realizing the tracing of the file version updating history. The invention carries out the associated record of the user and the file version on the update of each version of the file, can conveniently find the user corresponding to a certain version when the file version needs to be traced, and is more beneficial to managing the file version.
Disclosure of Invention
The present invention is directed to solving the above problems of the prior art. A decentralized file version control method, a computer device and a storage medium are provided. The technical scheme of the invention is as follows:
a decentralized file version control method is suitable for nodes of a block chain, and a file version control contract is configured on the block chain, and the method comprises the following steps:
uploading the first version of the file to an IPFS file system to obtain a first hash address of the first version of the file;
executing file version control registration transaction through a file version control contract, and recording a first public key and a first hash address of a first version of a file on a block chain so as to be used by each user side participating in file version updating:
acquiring a first public key;
acquiring a first hash address;
a current file version updating user queries an IPFS network according to a first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file;
updating the file by a current file version updating user to generate a second version of the file; uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file and generate a file update record;
encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
generating a first file update transaction comprising first encrypted file version update information and sending the first file update transaction to a blockchain network;
executing a first file version updating transaction through a file version control contract, and recording corresponding first encrypted file version updating information into the file version control contract when the execution is successful;
executing a file version update settlement transaction including a first private key corresponding to the first public key through a file version control contract:
decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain corresponding file version updating information;
and updating the file version according to the acquired file version updating information.
Further, the obtaining the first public key specifically includes:
the method comprises the steps that a request is initiated by a current file version updating user text through a first public key function obtained by a file version control contract, an intelligent contract automatically judges whether a current user is a user with the file updating right, if the current user has the file updating right of a file, the file version control contract sends a first public key stored in the contract to the current user, and otherwise, the user is prompted not to have the file updating right, and the request is ignored.
Acquiring a first hash address;
the current file version updating user initiates a request through a first hash address function obtained by a file version control contract, the intelligent contract automatically judges whether the current user is a user with the file updating right, if the current user has the file updating right of the file, the file version control contract sends the first hash address stored in the contract to the current user, and otherwise, the user is prompted not to have the file updating right, and the request is ignored.
Further, the encrypting the file update record by using the Diffie-Hellman algorithm according to the second private key and the first public key of the current file version update account to generate the first encrypted file version update information specifically includes:
suppose the file version control contract is A, the current file version update account is B, and the first public key of the first version of the file is p 1 The first private key is s 1 The second public key of the current file version update account is p 2 The first private key is s 2 . P is to be 1 And p 2 As two disclosed parameters.
The communication party A passes the formula
Figure BDA0003780778040000041
And calculating to obtain a public key m, and sending m to B.
The communication party B passes the formula
Figure BDA0003780778040000042
And calculating to obtain a public key n, and sending n to A.
The communication party A passes the formula
Figure BDA0003780778040000043
And calculating to obtain a shared key k.
The communication party B passes the formula
Figure BDA0003780778040000044
And calculating to obtain the same shared secret key k.
Thus, the two parties A and B obtain the shared secret key k while keeping secret the respective private keys. Thereafter, the two parties can utilize the shared secret key to carry out encrypted transmission on the two-party communication data.
After the shared key k is obtained, the current file version updating account encrypts the file updating record through the shared key k to generate first encrypted file version updating information.
Further, the file version control contract specifically includes:
a user list with file version updating authority;
updating the public key of the account by each file version;
a shared key in communication with each file version update account;
a version update record of the file;
hash addresses of versions of files in the IPFS file system.
Further, the executing, by the file version control contract, a file version update settlement transaction including a first private key corresponding to the first public key:
the file version control contract firstly uses the first private key and the second public key of each file version updating user to calculate and obtain a shared key of each file version updating user, and then uses each shared key to decrypt the encrypted file version updating information to obtain the file version updating information. The file version updating information comprises an updated account name, a file version number and a hash address of the updated file in the IPFS file system. The file version control contract records file version updating information in the contract and updates the latest version information of the file so as to continuously update the file version by a subsequent user.
A decentralized file version control method is suitable for a user side, and a block chain is configured with a file version control contract, and the method comprises the following steps:
uploading the first version of the file to an IPFS file system to obtain a first hash address of the first version of the file;
generating a first private key and a corresponding first public key for a first version of a file to be registered;
generating a file version control registration transaction comprising a first public key and sending the file version control registration transaction to a block chain network so that block chain nodes can execute through a file version control contract, and recording the first public key and a first hash address of the first version of the file on the block chain so as to be used by each user side participating in file version updating:
acquiring a first public key;
acquiring a first hash address;
a current file version updating user queries an IPFS network according to a first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file;
and updating the file by the current file version updating user to generate a second version of the file. Uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file and generate a file update record;
encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
generating a first file updating transaction comprising first encrypted file version updating information and sending the first file updating transaction to a block chain network so that block chain nodes can execute through a file version control contract, and recording the first encrypted file version updating information into the file version control contract when the execution is successful;
generating a file version update settlement transaction comprising a first private key and sending the transaction to a blockchain network for execution of blockchain nodes through a file version control contract:
decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain corresponding file version updating information;
and updating the file version according to the acquired file version updating information.
A decentralized file version control method is suitable for a user side, a block chain is configured with a file version control contract, and the method comprises the following steps:
acquiring a first public key of a first version of a file recorded on a block chain and a first hash address of the first version of the file in an IPFS system; the first public key of the first version of the file and the first hash address of the first version of the file in the IPFS system are recorded on the block chain after the file version control registration transaction is successfully executed through a file version control contract;
a current file version updating user queries an IPFS network according to a first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file;
and updating the file by the current file version updating user to generate a second version of the file. Uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file and generate a file update record;
encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
generating a first file updating transaction comprising first encrypted file version updating information and sending the first file updating transaction to a block chain network so that block chain nodes can execute through a file version control contract, and recording the corresponding first encrypted file version updating information into the file version control contract when the execution is successful;
the file version control contract is further for performing a file version update settlement transaction that includes a first private key corresponding to the first public key:
decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain corresponding file version updating information;
and updating the file version according to the acquired file version updating information.
An apparatus comprising one or more processors and memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a file versioning method in accordance with any provided.
A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, carries out the steps of any of the methods.
The invention has the following advantages and beneficial effects:
in the decentralized file version control method, the computer device and the storage medium provided by the embodiments of the present invention, the first public key and the first hash value are recorded in the block chain during the file version control registration, and the user end performing the file version update encrypts the file version update information through the Diffie-Hellman algorithm according to the private key and the first public key of the account, so as to keep the file version information secret during the file version control process, and as long as the first private key is provided through the file version update record transaction, all the file version update information can be obtained through decryption respectively according to the first private key and the public key of each file version update account, so as to realize the safe, reliable and decentralized file version control.
The invention realizes the safety control of the file version updating and effectively avoids the illegal tampering of the file version by the third party by configuring the file version updating right for the user and utilizing the Diffie-Hellman algorithm to realize the encrypted transmission between the file version control contract and the file version updating user. The advantages of a block chain, an intelligent contract and an IPFS decentralized file system are effectively utilized, and a completely decentralized, safe and reliable file version control method is realized.
Drawings
Fig. 1 is a flowchart of a decentralized file version control method according to an embodiment of the present invention.
Fig. 2 is a flowchart of another decentralized file version control method according to an embodiment of the present invention.
Fig. 3 is a flowchart of another decentralized file version control method according to an embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described in detail and clearly with reference to the accompanying drawings. The described embodiments are only some of the embodiments of the present invention.
The technical scheme for solving the technical problems is as follows:
fig. 1 is a flowchart of a decentralized file version control method according to an embodiment of the present invention.
As shown in fig. 1, in this embodiment, a method for controlling a version of a decentralized file, provided by the present invention, includes:
s11: uploading the first version of the file to an IPFS file system to obtain a first hash address of the first version of the file;
s13: executing file version control registration transaction through a file version control contract, and recording a first public key and a first hash address of a first version of a file on a block chain so as to be used by each user side participating in file version updating:
acquiring a first public key;
acquiring a first hash address;
a current file version updating user queries an IPFS network according to a first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file;
and updating the file by the current file version updating user to generate a second version of the file. Uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file and generate a file update record;
encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
generating a first file update transaction comprising first encrypted file version update information and sending the first file update transaction to a blockchain network;
s15: executing a first file version updating transaction through a file version control contract, and recording corresponding first encrypted file version updating information into the file version control contract when the execution is successful;
s17: executing a file version update settlement transaction including a first private key corresponding to the first public key through a file version control contract:
s171: decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain the corresponding file version updating information
S173: and updating the file version according to the acquired file version updating information.
The method is exemplarily described below by taking an example that the user a registers a file version control and the user BC participates in the file version control.
Firstly, the user end of the user A generates a first private key S for the version control of the file to be registered 1 And a corresponding first public key P 1
The user A uploads the first version of the file to the IPFS system to obtain a first HashAddress of the first version of the file version1
After generating the public and private key pair and the first hash address, the user end of user A generates a public key P 1 And a first HashAddress version1 File version control registration Transaction 1 And sent to the blockchain network.
In step S13, the blockchain node receives, broadcasts, packages, and executes transactions through the file version control contract 1 The version of the file is associated with a first public key P 1 And the version and the first HashAddress of the file version1 The corresponding relation of (2) is recorded on the block chain.
In this embodiment, the file version control registered by the user a is that only the account having the file update right can update the file version. After registering for file version control, the user side of user A further generates a configuration Transaction including file version update account information (e.g., account ID of file version update account, public key, etc.) of user BC 2 And Transaction 2 And sending to the blockchain network.
Block chain node receiving, broadcasting, packaging, executing Transaction through file version control contract 2 The file version update account of the user BC is recorded in the contract to have the version update right of the file.
Taking the file version update of the user B as an example:
the user end of the user B obtains the first public key P of the file from the block chain 1 And a first HashAddress version1 Through the first HashAddress version1 And downloading the first version of the file in the IPFS file system. The user B updates the file to generate a second version of the file, uploads the second version of the file to the IPFS file system to obtain a second HashAddress of the second version of the file version 2 . With P 1 *s 2 Record for file update by Diffie-Hellman algorithm as encryption key version 2 Encrypting to generate first encrypted file version update information E (Record) version 2 ) Generating a first file version update Transaction including first encrypted file version update information 3 Transfer will be 3 And sending to the blockchain network. Wherein S is 2 The private key of the account is updated for the file version of user B.
In step S15, to execute Transaction 3 For example, the following steps are carried out:
the block chain node receives, broadcasts and packs the file and executes the Transaction by the file version control contract 3 According to Transaction 3 Verifies that the file version update account has version update rights for the file:
if not, then Transaction 3 Failure to execute, no Transaction is recorded 3 Updating the file version of (2);
if yes, updating information E (Record) of version of the first encrypted file version2 ) Recorded into a file version control contract.
In step S17, the blockchain node receives, broadcasts, packages, and executes the file version update settlement Transaction through the file version control contract 4
In step S171, find out the public key P of the file version update account of user B 2 With S 1 *P 2 As decryption key by Diffie-Hellman algorithm pair E (Record) version2 ) Decrypting to obtain file version update information Record version2
In step S173, the file version is updated according to the acquired file version update information, and the file second version information is recorded in the file version control contract.
User side slave of user CAcquiring a first public key P of the file on the block chain 1 And a second HashAddress of the second file version provided by the user B in the IPFS file system version 2 . Through the second hash address HashAddress version 2 And downloading the second version of the file in the IPFS file system. The subsequent execution process is the same as that of the user B, and is not described in detail.
In the above embodiment, the registered file version control is configured to require a file update right to update the file version, a user registering the file version control needs to configure the file update right of each file version control account in a file version control contract by sending a transaction, and the file version control contract needs to verify whether the account controlled by the file version control has the file update right when executing the file version update transaction;
in another embodiment, the registered file version control can be configured to be any registered account for file version updating, the file updating right of the file version control account does not need to be configured in the file version control contract, and the file version control contract only needs to verify whether the account is the registered file version control account (to ensure that the public key can be found during decryption) when executing the file version updating transaction, and does not need to verify whether the account has the file updating right, so that the same technical effect can be achieved.
In the embodiment, the first public key is recorded on the block chain when the file version is registered, and the user end for updating the file version encrypts the file version updating information through the Diffie-Hellman algorithm according to the private key of the file version control account and the first public key, so that all the file version updating information is kept secret in the file version updating process, and the first private key is provided only when the file version updating settlement transaction is carried out, so that the corresponding file version updating information can be obtained through decryption respectively according to the first private key and the public key of each file version updating account, and the file version updating is completed.
Fig. 2 is a flowchart of another decentralized file version control method according to an embodiment of the present invention. The method illustrated in fig. 2 may be performed in conjunction with the method illustrated in fig. 1.
As shown in fig. 2, in this embodiment, the present invention further provides a decentralized file version control method applicable to a user side, where a block chain is configured with a file version control contract, and the method includes:
s21: uploading the first version of the file to an IPFS file system to obtain a first hash address of the first version of the file;
s23: generating a first private key and a corresponding first public key for a first version of a file to be registered;
s25: generating a file version control registration transaction comprising a first public key and sending the file version control registration transaction to a block chain network so that block chain nodes can execute through a file version control contract, and recording the first public key and a first hash address of the first version of the file on the block chain so as to be used by each user side participating in file version updating:
acquiring a first public key;
acquiring a first hash address;
and the current file version updating user queries the IPFS network according to the first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file.
And updating the file by the current file version updating user to generate a second version of the file. And uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file, and generating a file update record.
Encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
generating a first file updating transaction comprising first encrypted file version updating information and sending the first file updating transaction to a block chain network so that block chain nodes can execute through a file version control contract, and recording the first encrypted file version updating information into the file version control contract when the execution is successful;
s27: generating a file version update settlement transaction comprising a first private key and sending the transaction to a blockchain network for execution of blockchain nodes through a file version control contract:
decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain corresponding file version updating information;
and updating the file version according to the acquired file version updating information.
The file version control principle of the method shown in fig. 2 can refer to the method shown in fig. 1, and is not described in detail.
Fig. 3 is a flowchart of another decentralized file version control method according to an embodiment of the present invention. The method illustrated in fig. 3 may be performed in conjunction with the methods illustrated in fig. 1-2.
As shown in fig. 3, in this embodiment, the present invention further provides another decentralized file version control method for a user side, where a block chain is configured with a file version control contract, and the method includes:
s31: acquiring a first public key of a first version of a file recorded on a block chain and a first hash address of the first version of the file in an IPFS system; the first public key of the first version of the file and the first hash address of the first version of the file in the IPFS system are recorded on the block chain after the file version control registration transaction is successfully executed through a file version control contract;
and the current file version updating user queries the IPFS network according to the first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file.
And updating the file by the current file version updating user to generate a second version of the file. Uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file, and generating a file update record.
S33: encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
s35: and generating a first file updating transaction comprising first encrypted file version updating information and sending the first file updating transaction to the block chain network so that the block chain nodes can execute the first file updating transaction through a file version control contract, and recording the corresponding first encrypted file version updating information into the file version control contract when the execution is successful.
The file version control contract is further used for executing a file version update settlement transaction including a first private key corresponding to the first public key:
decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain corresponding file version updating information;
and updating the file version according to the acquired file version updating information.
The file version control principle of the method shown in fig. 3 can refer to the method shown in fig. 1, and is not described in detail.
Fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
As shown in fig. 4, as another aspect, the present application also provides a computer device comprising one or more processors 401, memory 402, bus 403, input device 404, output device 405, communication device 406. Wherein, the functional units are connected with each other and complete the communication with each other. The communication device performs communication processing via a network such as the internet. The memory stores a computer program, and the processor executes the decentralized file version control method in the above-described embodiments by executing the program in the memory.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The following is an explanation of some technical terms:
the block chain is a chain data structure formed by connecting and combining data blocks according to a time sequence, and the data blocks are guaranteed to be not falsifiable and not forged in a cryptographic mode. Each chunk in the chain of chunks is linked to the immediately preceding chunk in the chain of chunks by including a cryptographic hash of the preceding chunk. Each tile also includes a timestamp, a cryptographic hash of the tile, and one or more transactions. Transactions that have been verified by nodes of the blockchain network are hashed and form a Merkle tree. In a Merkle tree, data at leaf nodes is hashed and for each branch of the Merkle tree, all hash values of the branch are concatenated at the root of the branch. The above process is performed for the Merkle tree up to the root node of the entire Merkle tree. The root node of the Merkle tree stores a hash value representing all the data in the Merkle tree. When a hash value claims to be a transaction stored in the Merkle tree, a quick verification can be performed by determining whether the hash value is consistent with the structure of the Merkle tree.
A blockchain network is a network of computing nodes used to manage, update and maintain one or more blockchain structures. In this specification, the blockchain network may include a public blockchain network, a private blockchain network, or a federated blockchain network.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises that element.
The above examples are to be construed as merely illustrative and not limitative of the remainder of the disclosure in any way whatsoever. After reading the description of the present invention, the skilled person can make various changes or modifications to the invention, and these equivalent changes and modifications also fall into the scope of the invention defined by the claims.

Claims (9)

1. A decentralized file version control method is suitable for nodes of a blockchain, and a file version control contract is configured on the blockchain, and is characterized by comprising the following steps:
uploading the first version of the file to an IPFS file system to obtain a first hash address of the first version of the file;
executing file version control registration transaction through a file version control contract, and recording a first public key and a first hash address of a first version of a file on a block chain so as to be used by each user side participating in file version updating:
acquiring a first public key;
acquiring a first hash address;
a current file version updating user queries an IPFS network according to a first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file;
updating the file by a current file version updating user to generate a second version of the file; uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file and generate a file update record;
encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
generating a first file update transaction comprising first encrypted file version update information and sending the first file update transaction to a blockchain network;
executing a first file version updating transaction through a file version control contract, and recording corresponding first encrypted file version updating information into the file version control contract when the execution is successful;
executing a file version update settlement transaction comprising a first private key corresponding to the first public key by a file version control contract:
decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain corresponding file version updating information;
and updating the file version according to the acquired file version updating information.
2. The method of claim 1, wherein the version control of the decentralized file,
the obtaining the first public key specifically includes:
the method comprises the steps that a request is initiated by a current file version updating user file through a first public key function obtained by a file version control contract, an intelligent contract automatically judges whether the current user is a user with the file updating right, if the current user has the file updating right of the file, the file version control contract sends a first public key stored in the contract to the current user, and otherwise, the user is prompted not to have the file updating right, and the request is ignored.
The obtaining of the first hash address specifically includes;
the current file version updating user initiates a request by acquiring a first hash address function of a file version control contract, the intelligent contract automatically judges whether the current user is a user with the file updating right, if the current user has the file updating right of the file, the file version control contract sends the first hash address stored in the contract to the current user, otherwise, the user is prompted not to have the file updating right, and the request is ignored.
3. The decentralized file version control method according to claim 1,
the encrypting the file update record according to the second private key and the first public key of the current file version update account by using a Diffie-Hellman algorithm to generate first encrypted file version update information specifically includes:
suppose that the file version control contract is A, the current file version update account is B, and the first public key of the first version of the file is p 1 The first private key is s 1 The second public key of the current file version update account is p 2 The first private key is s 2 . P is to be 1 And p 2 As two disclosed parameters.
The communication party A passes the formula
Figure FDA0003780778030000021
And calculating to obtain a public key m, and sending m to B.
The communication party B passes the formula
Figure FDA0003780778030000022
And calculating to obtain a public key n, and sending n to A.
The communication party A passes the formula
Figure FDA0003780778030000023
And calculating to obtain a shared secret key k.
The communication party B passes the formula
Figure FDA0003780778030000024
And calculating to obtain the same shared key k.
Thus, both A and B obtain a shared secret key k while keeping their private keys secret. Thereafter, both parties can utilize the shared secret key to carry out encrypted transmission on both parties communication data.
After the shared key k is obtained, the current file version updating account encrypts the file updating record through the shared key k to generate first encrypted file version updating information.
4. The method of claim 1, wherein the version control of the decentralized file,
the file version control contract specifically comprises:
a user list with file version updating authority;
updating the public key of the account by each file version;
a shared key in communication with each file version update account;
a version update record of the file;
hash addresses of versions of files in the IPFS file system.
5. The method according to claim 4, wherein the performing a file version update settlement transaction that includes a first private key corresponding to the first public key via a file version control contract comprises:
the file version control contract firstly uses the first private key and the second public key of each file version updating user to calculate and obtain a shared key of each file version updating user, and then uses each shared key to decrypt the encrypted file version updating information to obtain the file version updating information. The file version updating information comprises an updated account name, a file version number and a hash address of the updated file in the IPFS file system. The file version control contract records the file version updating information in the contract and updates the latest version information of the file so as to continuously update the file version by a subsequent user.
6. A decentralized file version control method is suitable for a user side, and a file version control contract is configured on a block chain, and is characterized by comprising the following steps:
uploading the first version of the file to an IPFS file system to obtain a first hash address of the first version of the file;
generating a first private key and a corresponding first public key for a first version of a file to be registered;
generating a file version control registration transaction comprising a first public key and sending the file version control registration transaction to a block chain network so that block chain nodes can execute through a file version control contract, and recording the first public key and a first hash address of the first version of the file on the block chain so as to be used by each user side participating in file version updating:
acquiring a first public key;
acquiring a first hash address;
a current file version updating user queries an IPFS network according to a first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file;
and updating the file by the current file version updating user to generate a second version of the file. Uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file and generate a file update record;
encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
generating a first file updating transaction comprising first encrypted file version updating information and sending the first file updating transaction to a block chain network so that block chain nodes can execute through a file version control contract, and recording the first encrypted file version updating information into the file version control contract when the execution is successful;
generating a file version update settlement transaction comprising a first private key and sending the file version update settlement transaction to a blockchain network for blockchain nodes to execute through a file version control contract:
decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain corresponding file version updating information;
and updating the file version according to the acquired file version updating information.
7. A decentralized file version control method is suitable for a user side, and a file version control contract is configured on a block chain, and is characterized by comprising the following steps:
acquiring a first public key of a first version of a file recorded on a block chain and a first hash address of the first version of the file in an IPFS system; the first public key of the first version of the file and the first hash address of the first version of the file in the IPFS system are recorded on the block chain after the file version control registration transaction is successfully executed through a file version control contract;
a current file version updating user queries an IPFS network according to a first hash address of the acquired first version of the file on the IPFS to obtain the first version of the file;
and updating the file by the current file version updating user to generate a second version of the file. Uploading the second version of the file to an IPFS file system to obtain a second hash address of the second version of the file and generate a file update record;
encrypting the file update record by a Diffie-Hellman algorithm according to a second private key and a first public key of the current file version update account to generate first encrypted file version update information;
generating a first file updating transaction comprising first encrypted file version updating information and sending the first file updating transaction to a block chain network, so that a block chain node can execute the first file updating transaction through a file version control contract, and recording the corresponding first encrypted file version updating information into the file version control contract when the execution is successful;
the file version control contract is further used for executing a file version update settlement transaction including a first private key corresponding to the first public key:
decrypting the corresponding first encrypted file version updating information according to the first private key and the second public key of each file version updating user respectively to obtain corresponding file version updating information;
and updating the file version according to the acquired file version updating information.
8. An apparatus comprising one or more processors and memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a file versioning method as provided in accordance with any of claims 1-7.
9. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202210928820.1A 2022-08-03 2022-08-03 Decentralized file version control method, computer equipment and storage medium Pending CN115408046A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210928820.1A CN115408046A (en) 2022-08-03 2022-08-03 Decentralized file version control method, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210928820.1A CN115408046A (en) 2022-08-03 2022-08-03 Decentralized file version control method, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115408046A true CN115408046A (en) 2022-11-29

Family

ID=84158873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210928820.1A Pending CN115408046A (en) 2022-08-03 2022-08-03 Decentralized file version control method, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115408046A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116074115A (en) * 2023-03-06 2023-05-05 广州市悦智计算机有限公司 Method for realizing cross-chain encryption session based on intelligent contract

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116074115A (en) * 2023-03-06 2023-05-05 广州市悦智计算机有限公司 Method for realizing cross-chain encryption session based on intelligent contract

Similar Documents

Publication Publication Date Title
JP6690066B2 (en) Validating the integrity of data stored on the consortium blockchain using the public sidechain
CN112492006B (en) Node management method and device based on block chain
JP6892513B2 (en) Off-chain smart contract service based on a reliable execution environment
US11425108B2 (en) Blockchain-based service data encryption methods and apparatuses
CN109829326B (en) Cross-domain authentication and fair audit de-duplication cloud storage system based on block chain
US20200145204A1 (en) Blockchain transaction privacy enhancement through broadcast encryption
US11483298B2 (en) Information masking using certificate authority
TW201933255A (en) Blockchain system and data processing method for blockchain system
WO2019133307A1 (en) Traceable key block-chain ledger
CN109729041B (en) Method and device for issuing and acquiring encrypted content
Thompson The preservation of digital signatures on the blockchain
JP2023504535A (en) Identity (ID) based public key generation protocol
JP6921266B2 (en) Verifying the integrity of the data stored on the consortium blockchain using the public sidechain
CN113285802B (en) Key agreement method and device based on FPGA
US8972732B2 (en) Offline data access using trusted hardware
CN111669434B (en) Method, system, device and equipment for establishing communication group
US20120213370A1 (en) Secure management and personalization of unique code signing keys
CN115408046A (en) Decentralized file version control method, computer equipment and storage medium
Chen et al. FileWallet: A File Management System Based on IPFS and Hyperledger Fabric.
KR102622665B1 (en) Method and apparatus for managing data based on blockchain
JP6901373B2 (en) User management device, user management system
CN115134136B (en) System, method, device, storage medium and computing device for socializing based on blockchain
US20220360429A1 (en) Location-key encryption system
US20220368527A1 (en) Location key search of encrypted files without decryption
CN114866409B (en) Password acceleration method and device based on password acceleration hardware

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