CN116126392B - Code version management method based on blockchain and IPFS - Google Patents
Code version management method based on blockchain and IPFS Download PDFInfo
- Publication number
- CN116126392B CN116126392B CN202310410197.5A CN202310410197A CN116126392B CN 116126392 B CN116126392 B CN 116126392B CN 202310410197 A CN202310410197 A CN 202310410197A CN 116126392 B CN116126392 B CN 116126392B
- Authority
- CN
- China
- Prior art keywords
- code
- version
- ipfs
- rollback
- project
- 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
Links
- 238000007726 management method Methods 0.000 title claims abstract description 45
- 101710107944 Isopenicillin N synthase Proteins 0.000 claims abstract description 33
- 238000000034 method Methods 0.000 claims abstract description 21
- 230000008569 process Effects 0.000 claims abstract description 11
- 230000006399 behavior Effects 0.000 claims description 8
- 238000011156 evaluation Methods 0.000 claims description 8
- 238000012795 verification Methods 0.000 claims description 8
- 238000004422 calculation algorithm Methods 0.000 claims description 6
- 230000003068 static effect Effects 0.000 claims description 5
- 230000000750 progressive effect Effects 0.000 claims description 4
- 230000000977 initiatory effect Effects 0.000 claims description 3
- 239000003999 initiator Substances 0.000 claims description 2
- 230000003203 everyday effect Effects 0.000 claims 1
- 230000002085 persistent effect Effects 0.000 claims 1
- 230000007246 mechanism Effects 0.000 abstract description 3
- 238000012550 audit Methods 0.000 abstract description 2
- 238000012552 review Methods 0.000 abstract description 2
- 230000007547 defect Effects 0.000 abstract 1
- 239000011159 matrix material Substances 0.000 description 10
- 238000013507 mapping Methods 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 238000012356 Product development Methods 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000002243 precursor Substances 0.000 description 1
- 230000002265 prevention Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Storage Device Security (AREA)
Abstract
The invention discloses a code version management method based on a blockchain and an IPFS. First the project creator uploads a code audit mechanism in the form of a smart contract. When the code developer submits the project, the original code is submitted on the IPFS, and the generated content hash address is converted into an IPNS address after asymmetric encryption and is uploaded to the intelligent contract. All submitted code needs to review the contract for code checking, ensuring that there are no underlying vulnerabilities. And meanwhile, checking the contract needs to check code conflict, so that the consistency of the code version is ensured. The invention solves the defect of relying on the centralized server in the software code version management process, and can realize a code version management mode of complete decentralization and tamper resistance in the true sense.
Description
Technical Field
The invention belongs to the technical field of code version management control, and particularly relates to a code version management method based on a block chain and an IPFS.
Background
Code collaboration has been one of the most important aspects of the project development process, and after software projects increasingly tend to be large, good code version collaboration tools can improve the credibility of the relevant parties while saving a lot of time and effort for code developers. Managing accurate digital information and tracking changes in project code has become one of the major challenges faced by code version control when multiple parties participate in collaborative development.
Code versioning has been widely used in today's fast paced environment, helping to shorten product development and release cycles. The development of digitization brings about problems related to inaccurate content and document collaboration, and the problem of version management consumes 83% of productivity. Most of the existing file version control systems are centralized and have single-point faults, and are characterized by increased time consumption and error operation of file update, which allows files to be changed without knowledge of other users in the network. More importantly, with centralized systems, changes to documents and update histories can be tampered with, compromising the trustworthiness of the changes and their update histories. Thus, a completely secure and decentralized digital code version management platform is needed.
Disclosure of Invention
The technical problems to be solved are as follows: the invention discloses a code version management method based on a blockchain and an IPFS, which can provide a software project code version management method with a code version control function and a code backtracking function, thereby realizing a code version management method which is completely decentralised in a real sense.
The technical scheme is as follows:
a blockchain and IPFS-based code version management method, the code version management method comprising the steps of:
s1, uploading intelligent contracts by a project managerAnd Smart contracts->To blockchain, smart contracts->And Smart contracts->Two code version management functions for specifying the presence verification of the project code and the validity examination of the code;
s2, developerIn the interplanetary file system IPFS +.>Version, get->Version of initial content hash->;
S3, splicing initial content hashAnd the current timestamp->Generating a project code +.f using SHA256 asymmetric encryption algorithm in combination with project tuple data information>Version unique IPNS Address->And record the current timestamp +.>;
S4, five-tuple is formedUpload to Smart contracts->By intelligent contracts->Verification->Version of initial content hash->Existence of (2); />Representing the current version number,/-, and>representing the previous versionThe method comprises the steps of carrying out a first treatment on the surface of the If the verification is passed, the step S5 is entered, otherwise, the flow is ended;
s5, in intelligent contractCode legitimacy examination, intelligent contract->Checking +.>Whether the current global Head node is pointed or not, if not, checking a code file with inconsistent hash values in a progressive scanning mode, confirming and returning conflict conditions of codes, and ending the flow; if the code is consistent, running a static checking module to check the compiling type error and the potential security hole of the code, if the compiling type error and the potential security hole do not exist, turning to a step S6, otherwise, ending the flow;
s6, intelligent contractUpdating the global Head node to +.>After the new block is generated, the code is uplink to finish the updating management of the code version.
Further, in step S2, item codes are generatedVersion unique IPNS Address->Comprises the following sub-steps:
hashing initial contentAnd timestamp->The character strings are spliced and asymmetrically encrypted by an SHA256 encryption algorithm, so that hash collision is prevented in an address space:
generating 20 bits encrypted by ed25519 by an instruction ipfs key gen-type ed 25519-size 20keyname for a unique public-private key pair used when the project is issued;
will be through instruction ipfs name publish-key keynameContent hashingIssue to IPNS to obtainVersion unique IPNS Address->. To ensure that the IPNS address is continuously valid, the synchronous execution timing task script job. Cron keeps the continuous release of the IPNS. The default issue declaration period of IPNS is 24h and does not allow the setting to be permanently valid. Thus, a job. Cron timed task script is built, executing the issue instructions every 24 hours.
Further, in step S4, the intelligent contractVerification->Version of initial content hash->The presence process of (2) comprises the sub-steps of:
intelligent contractAcquiring IPNS address +.>Querying in IPFS by means of a predictor program and giving a smart contract +.>Returning the result of the content hash of the query +.>;
Will be returned after obtainingHash with content in five-tuple/>And comparing to judge the existence of the IPNS address content hash uploaded by the user.
Further, the code version management method includes the steps of:
project manager uploading smart contractsTo a blockchain for specifying code backtracking management functions;
if intelligent contractAnd receiving a version rollback request sent by an initiator, broadcasting the code rollback request to the whole network, entering an automatic consensus process, selecting a decision group by combining the project participation of all participating decision developers, and judging whether rollback behavior is allowed or not.
Further, entering an automatic consensus process, selecting a decision group by combining the project participation of all participating decision developers, and judging whether to allow rollback behavior or not, wherein the process comprises the following substeps:
s71, code rollback application:
developer(s)Intelligent contract +.>Issuing a code rollback request, rollback to version +.>The method comprises the steps of carrying out a first treatment on the surface of the The code rollback request includes a rollback reason and a specified version +.>Is->A number;
s72, initiating election:
intelligent contractBroadcasting the code rollback request to the whole network, entering an automatic consensus flow, and selecting a plurality of nodes with highest project participation degree by combining the project participation degrees of all participation decision developers, wherein the selected nodes are sequentially voted to judge whether rollback behaviors are allowed or not; the project participation degree evaluation index considers the following node states: node submission times, latest submission time, near-K-day active frequency, initial network access time and historical submission times;
s73, version rollback:
if the number of approved developers exceeds the number of approved developers in one block timeIntelligent contract->Allow developer->An initiated code rollback application, head is directed +.>Version node->Version rollback is completed.
Further, in step S72, the process of electing a plurality of nodes with highest participation in the project includes the following steps:
s721: carrying out data standardization processing on project participation degree judgment indexes of each project-related node, and mapping discrete data into a real space of [0, 1], wherein a standardization processing formula is as follows:
wherein i represents a sectionThe number of the dots is given,original value of the j-th index representing the i-th node, a ++>Normalized index value of j index representing i node,/th index representing j node>Mean value of j index +.>Standard deviation of the j-th index;
s722: calculating the correlation coefficient of each node to form a correlation coefficient matrix, wherein the correlation coefficient matrix represents the participation degree of the node:
wherein,,representing the correlation coefficient of the ith node and the jth node,>representing a correlation coefficient matrix;
s723: for correlation coefficient matrixPerforming primary equal line transformation, and calculating to obtain characteristic values of matrixAnd feature vector->;
S724: adopts the following stepsThe formula calculates to obtain the characteristic valueCorresponding information contribution rate->:
;
The accumulated contribution rate is calculated by adopting the following formula:
;
When (when)When the method is used, the first p index variables are selected as p main components to replace the original n index variables, comprehensive analysis is carried out on the n index variables, and a comprehensive evaluation value Z is obtained through calculation:
;
s725: achieving consensus;
the comprehensive evaluation value calculated in step S724 ranks the nodes according to the height, and a plurality of nodes with the highest comprehensive evaluation value are used as elected nodes to vote in turn to replace all developers to make decisions.
The beneficial effects are that:
first, the blockchain and IPFS-based code version management method of the present invention organizes version metadata information of software project codes through blockchain and intelligent contract systems. The decentralization characteristic of the block chain system and the voting function of the intelligent contract program are fully utilized, the functions of code version updating, version backtracking and the like on the complete chain are realized, and the disaster prevention capability and the robustness of the version control system are greatly improved. Tamper resistance of blockchain systems can also prevent program code from being maliciously modified.
Secondly, according to the code version management method based on the blockchain and the IPFS, original data of codes are not directly stored on the blockchain but stored in the interstellar file system, so that the blockchain only needs to store content hash addresses of the codes in the IPFS, visibility of code content is effectively controlled, safety and transparency of the codes in a team are guaranteed, and a code management system in a public chain mode is enabled to be possible.
Thirdly, the code version management method based on the blockchain and the IPFS aims at the technical problem that when a plurality of items are required to be generated by the same user, different key pairs cannot be generated to cause abnormal IPNS mapping, and the problem that the unique accessor is required to access codes of different versions in code version management is solved by adopting an improved IPNS mechanism.
Drawings
FIG. 1 is a system architecture diagram of a blockchain and IPFS based code version management method provided in accordance with a preferred embodiment of the present invention;
FIG. 2 is a flowchart of a method for blockchain and IPFS based code version management in accordance with the preferred embodiment of the present invention;
FIG. 3 is a version update flow chart of a blockchain and IPFS based code version management method provided by a preferred embodiment of the present invention;
FIG. 4 is a version rollback flowchart of a blockchain and IPFS based code version management method provided in a preferred embodiment of the present invention.
Detailed Description
The following examples will provide those skilled in the art with a more complete understanding of the invention, but are not intended to limit the invention in any way.
The embodiment discloses a code version management method based on a blockchain and an IPFS, comprising the following steps:
s1, uploading intelligent contracts by a project managerAnd Smart contracts->To blockchain, smart contracts->And Smart contracts->Two code version management functions for specifying the presence verification of the project code and the validity examination of the code;
s2, developerIn the interplanetary file system IPFS +.>Version, get->Version of initial content hash->;
S3, splicing initial content hashAnd the current timestamp->Generating a project code +.f using SHA256 asymmetric encryption algorithm in combination with project tuple data information>Version unique IPNS Address->And record the current timestamp +.>;
S4, five-tuple is formedUpload to Smart contracts->By intelligent contracts->Verification->Version of initial content hash->Existence of (2); />Representing the current version number,/-, and>representing the previous versionThe method comprises the steps of carrying out a first treatment on the surface of the If the verification is passed, the step S5 is entered, otherwise, the flow is ended;
s5, in intelligent contractCode legitimacy examination, intelligent contract->Checking +.>Whether the current global Head node is pointed or not, if not, checking a code file with inconsistent hash values in a progressive scanning mode, confirming and returning conflict conditions of codes, and ending the flow; if the code is consistent, running a static checking module to check the compiling type error and the potential security hole of the code, if the compiling type error and the potential security hole do not exist, turning to a step S6, otherwise, ending the flow;
s6, intelligent contractUpdating the global Head node to +.>After the new block is generated, the code is uplink to finish the updating management of the code version.
The overall architecture of the code version management method of the present embodiment includes a storage layer, a contract layer and an application layer as shown in fig. 1. The storage layer mainly comprises IPFS and IPNS and bears the bottom storage function of the system. The contract layer mainly comprises contract groups formed by different functional contracts such as existence verification contracts, examination contracts, rollback voting contracts and the like, and the functions of code audit merging and the like are completed together. The application layer mainly comprises a local code path of the user and finishes code submitting operation of the terminal user.
A flowchart of the code version management method of this embodiment is shown in fig. 2. The code version management method of this embodiment is shown in fig. 3 and 4, where fig. 3 is a code update flowchart, and fig. 4 is a code rollback flowchart, and specific steps of code update include:
step 1, uploading intelligent contracts
Project manager uploading smart contracts、/>、/>Onto the work blockchain. After successful deployment, three corresponding contract addresses are obtained: 0xD9145CCE52D386F254917E481eB44E9943F39138, 0xf8E81D47203a594245E36C48E151709F0C19fBe8, 0xD7ACd a9FD159E69Bb102A1ca21C9A3E3A5F771B. The three contract addresses respectively participate in three key functions of code existence verification, code conflict and examination and code backtracking in code version control.
Step 2, release the new version code
Project openingHair staffUpload item->Version code to IPFS and obtains corresponding content hash +.>(QmZdeUgomqapYKGqns 6iucd49 JUxNQsHdWZGiRUCGppUE). The address uploaded here must be the address of the root path of the item, thus ensuring that a single item has and has only one content hash address.
Since code version management requires unique accessors to access different versions of code, IPNS can be introduced here as a tool for hash mapping project addresses to content. Otherwise, extra storage space and calculation force are needed to maintain the mapping relation between the content hash and the address, which is very bulky and wastes resources. In this case, because of the nature of the IPNS address, i.e. the generation of the IPNS key pairs using host information, this makes it impossible to generate different key pairs when the same user needs to generate multiple items, resulting in an abnormal mapping of the IPNS, and hence an improved IPNS mechanism is used here to solve this problem.
After uploading the new version content hash, the content hash generated for the first time is hashedAnd timestamp->The character strings are spliced, and are asymmetrically encrypted through an SHA256 encryption algorithm, so that hash collision is prevented in an address space. The formula is shown as follows
The unique public-private key pair used in the project issue is generated by the instruction ipfs key gen keyname, specifically, the 20 bits encrypted by the instruction ipfs key gen-type ed 25519-size 20keyname are generated by the instruction ed25519 for the unique public-private key pair used in the project issue.
The content hash QmZDeUgomqapYKGqns6iucd49 JUxNQsHdWZGiRUCGppUE is issued to IPNS by an instruction ipfs name publish-key keyname to obtain a name address(k 51qzi5uqu5djq5ti4ngdy6l4p97tu2q2ssztoogjl9pn0nevzu8guqrl6 oxa). At the moment, https is/(ipfs. Io/ips/k 51qzi5uqu5djq ti4ngdy6l4p97tu2q2ssztoogjl9pn0nevzu8guqrl6oxra is the unique address accessible by the current project. This way the address is achieved +.>Is a whole network unique of (c).
To ensure that the IPNS address is continuously valid, the synchronous execution timing task script job. Cron keeps the continuous release of the IPNS. The default issue declaration period of IPNS is 24h and does not allow the setting to be permanently valid. Thus, a job. Cron timed task script is built, executing the issue instructions every 24 hours. The pseudocode is shown in table 1.
TABLE 1
Step 3, combining five-tuple information
Indexing a current nodeIPNS Address->Content hash->Current timestamp->And precursor node indexIs combined into five-tuple->. The tuple information is updated to the predictor scan location.
Step 4, intelligent contractVerifying hash presence
Intelligent contractAcquiring IPNS address +.>Querying in IPFS by means of a predictor program and giving a smart contract +.>Returning the result of the content hash of the query +.>。
Will be returned after obtainingHash with content in five-tuple ++>And comparing to judge the existence of the IPNS address content hash uploaded by the user. Otherwise reject developer->Is updated with the update request of (a).
Step 5, code validity examination
After passing the presence check, the smart contractChecking +.>Whether or not to point toAnd the current Head node ensures the continuity of the code version. If there is a problem of version inconsistency, a code conflict check is performed.
Intelligent contractAnd checking code files with inconsistent hash values in a progressive scanning mode, and confirming the conflict condition of the codes. In case of inconsistent versions and code conflicts, the developer is rejected +.>Is a request for (a).
Step 6, static inspection of codes
After passing code legitimacy review, smart contractsRunning a static check module to examine the compiling type errors and potential security vulnerabilities of the codes.
Step 7, new version uplink
After all checks are completed, smart contractsUpdate Head to the current five-tuple +.>. And waiting for a new block to be generated, and finishing the uplink operation.
The specific steps of code rollback include:
step 1, code rollback application
Developer(s)Intelligent contract +.>Issuing a code rollback request, rollback to version +.>. Opening deviceSender->Besides the rollback reason needs to be elucidated, the version +.>Is->The number is used to determine +.>Five-tuple information of (a).
Step 2, initiating election
Intelligent contractAnd broadcasting the code rollback request to the whole network, entering an automatic consensus flow, selecting a decision group by combining the project participation of all participating decision developers, and judging whether rollback behavior is allowed or not. The project participation degree evaluation index considers the following node states: node commit times, latest commit time, near-K-day active frequency, initial network access time, and historical commit times.
Step 2.1: carrying out data standardization processing on the node indexes, and mapping discrete data into a real space of [0, 1], wherein the formula is as follows:
wherein i represents the number of nodes,original value of the j-th index representing the i-th node, a ++>Normalized index value of j index representing i node,/th index representing j node>Mean value of j index +.>Represents the standard deviation of the j-th index.
Step 2.2: calculating the correlation coefficient of each node to form a correlation coefficient matrix, wherein the correlation coefficient matrix represents the participation degree of the node:
wherein,,representing the correlation coefficient of the ith node and the jth node,>representing a matrix of correlation coefficients.
Step 2.3: calculating eigenvalues and eigenvectors
For correlation coefficient matrixPerforming primary equal line transformation, and calculating to obtain characteristic values of matrixAnd feature vector->。
Step 2.4: calculating a comprehensive evaluation value
EigenvaluesCorresponding information contribution rate->The calculation method of (2) is as follows:
;
cumulative contribution rateThe calculation formula of (2) is as follows:
;
when (when)Close to 1 (e.g.)>) When the method is used, the first p index variables can be selected as p main components to replace the original n index variables, so that comprehensive analysis is performed on the index variables. The calculation formula of the comprehensive evaluation score Z is as follows:
。
step 2.5: reach consensus
The scores calculated in the step 2.4 are used for sorting the nodes according to the height, and the selected nodes are used for voting in turn to replace all developers to make decisions. The number of approved developers exceeds one block timeWhen the situation is in (1), intelligent contractWill allow the developer->The initiated code rolls back the application.
Step 3, version rollback
Directing Head toVersion node->Version rollback is completed.
The code version management method of the embodiment is a decentralised code version control method, and the project code has the characteristics of decentralisation and non-falsification by introducing a blockchain and an intelligent contract into the code version control process. The interstellar file system IPFS is used as a bottom layer storage, and the interstellar name system IPNS is used as a mapping method of content hash and fixed address. The decentralised file storage mode reduces the risk of code loss caused by the fault of a central server or hacking behavior on the one hand; on the other hand, the block chain system is decoupled from the original code content, so that the storage pressure of the block chain is reduced, and the processing performance is greatly improved.
The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above examples, and all technical solutions belonging to the concept of the present invention belong to the protection scope of the present invention. It should be noted that modifications and adaptations to the invention without departing from the principles thereof are intended to be within the scope of the invention as set forth in the following claims.
Claims (5)
1. A blockchain and IPFS-based code version management method, comprising the steps of:
s1, uploading intelligent contract C by project manager 1 Smart contracts C 2 To blockchain, smart contract C 1 Smart contracts C 2 Two code version management functions for specifying the presence verification of the project code and the validity examination of the code;
s2, developer D 1 In the interplanetary file system IPFS, the project code V is uploaded 1 Version, get V 1 Version of initial content hash H 1 ;
S3, splicing initial content hash H 1 And a current timestamp T 1 Generating items using SHA256 asymmetric encryption algorithm in combination with item tuple data informationV of code 1 Version of unique IPNS Address L 1 And record the current timestamp T 1 ;
S4, five-tuple (id, L 1 ,H 1 ,T 1 Pred) upload to Smart contract C 1 By smart contract C 1 Verify V 1 Version of initial content hash H 1 Existence of (2); id represents the current version number, prevId represents the id of the previous version; if the verification is passed, the step S5 is entered, otherwise, the flow is ended;
s5, in intelligent contract C 2 During code legitimacy examination, intelligent contract C 2 Checking whether the PrevId in the five-tuple points to the current global Head node, if not, checking a code file with inconsistent hash values in a progressive scanning mode, confirming and returning to the conflict condition of the codes, and ending the flow; if the code is consistent, running a static checking module to check the compiling type error and the potential security hole of the code, if the compiling type error and the potential security hole do not exist, turning to a step S6, otherwise, ending the flow;
s6, intelligent contract C 2 And updating the global Head node to the id of the current five-tuple, and after the new block is generated, carrying out code uplink to complete code version update management.
2. The blockchain and IPFS-based code version management method according to claim 1, wherein in step S2, V of the project code is generated 1 Version of unique IPNS Address L 1 Comprises the following sub-steps:
hash the initial content H 1 With time stamp T 1 The character strings are spliced and asymmetrically encrypted by an SHA256 encryption algorithm, so that hash collision is prevented in an address space:
keyname=SHA256(strcat(H 1 ,T 1 ))
generating 20 bits encrypted by ed25519 by an instruction ipfs key gen-type ed 25519-size 20keyname for a unique public-private key pair used when the project is issued;
content is hashed by instruction ipfs name publish-key keynameHi H 1 Release to IPNS to obtain V 1 Version of unique IPNS Address L 1 The method comprises the steps of carrying out a first treatment on the surface of the The timed task script that executes synchronously every day maintains the persistent release of the IPNS.
3. The blockchain and IPFS-based code version management method according to claim 1, wherein in step S4, the code version management method is performed by a smart contract C 1 Verify V 1 Version of initial content hash H 1 The presence process of (2) comprises the sub-steps of:
intelligent contract C 1 Acquiring IPNS address L in quintuple information uploaded by user 1 Querying in IPFS through a predictor program and directing at Smart contract C 1 Returning the results H 'of the content hash of the query' 1 ;
Will return result H' 1 Hash H with content in five-tuple 1 And comparing to judge the existence of the IPNS address content hash uploaded by the user.
4. The blockchain and IPFS-based code version management method according to claim 1, wherein the code version management method includes the steps of:
project manager upload smart contract C 3 To a blockchain for specifying code backtracking management functions;
if intelligent contract C 3 And receiving a version rollback request sent by an initiator, broadcasting the code rollback request to the whole network, entering an automatic consensus process, selecting a decision group by combining the project participation of all participating decision developers, and judging whether rollback behavior is allowed or not.
5. The blockchain and IPFS-based code version management method according to claim 4, wherein entering an automatic consensus process, electing a decision group in combination with project participation of all participating decision developers, determining whether to allow rollback behavior includes the sub-steps of:
s71, code rollback application:
developer D 2 Intelligent contract C on specified path through predictor program 3 Issuing a code rollback request, rollback to version V 2 The method comprises the steps of carrying out a first treatment on the surface of the The code rollback request includes a rollback reason and a specified version V to determine five-tuple information 2 Id number of (2);
s72, initiating election:
intelligent contract C 3 Broadcasting the code rollback request to the whole network, entering an automatic consensus flow, and selecting a plurality of nodes with highest project participation degree by combining the project participation degrees of all participation decision developers, wherein the selected nodes are sequentially voted to judge whether rollback behaviors are allowed or not; the project participation degree evaluation index considers the following node states: node submission times, latest submission time, near-K-day active frequency, initial network access time and historical submission times;
s73, version rollback:
if the number of approved developers exceeds the number of approved developers in one block timeSmart contract C 3 Allow developer D 2 Initiated code rollback application, directing Head to V 2 Version node id, finish version rollback.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310410197.5A CN116126392B (en) | 2023-04-18 | 2023-04-18 | Code version management method based on blockchain and IPFS |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310410197.5A CN116126392B (en) | 2023-04-18 | 2023-04-18 | Code version management method based on blockchain and IPFS |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116126392A CN116126392A (en) | 2023-05-16 |
CN116126392B true CN116126392B (en) | 2023-07-25 |
Family
ID=86299517
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310410197.5A Active CN116126392B (en) | 2023-04-18 | 2023-04-18 | Code version management method based on blockchain and IPFS |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116126392B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117390655B (en) * | 2023-12-06 | 2024-03-22 | 和元达信息科技有限公司 | Data encryption method and system based on database |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20190305959A1 (en) * | 2018-04-02 | 2019-10-03 | Ca, Inc. | Announcement smart contracts to announce software release |
CN111460395B (en) * | 2020-04-03 | 2024-01-30 | 北京邮电大学 | Shared data storage and copyright protection tracing method and system |
CN111641707B (en) * | 2020-05-29 | 2021-09-17 | 兰州理工大学 | Block chain-based digital copyright protection method |
CN111932215B (en) * | 2020-09-18 | 2023-09-29 | 杭州趣链科技有限公司 | Intelligent contract version management method, intelligent contract version management equipment and readable storage medium |
CN113961535A (en) * | 2021-11-26 | 2022-01-21 | 北京航空航天大学 | Data trusted storage sharing system and method based on block chain |
-
2023
- 2023-04-18 CN CN202310410197.5A patent/CN116126392B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN116126392A (en) | 2023-05-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11257073B2 (en) | Systems, methods, and apparatuses for implementing machine learning models for smart contracts using distributed ledger technologies in a cloud based computing environment | |
Nathan et al. | Blockchain meets database: Design and implementation of a blockchain relational database | |
WO2022179008A1 (en) | Supply chain finance ai daas algorithm warehouse platform based on blockchain | |
US20190303579A1 (en) | Decentralized, immutable, tamper-evident, directed acyclic graphs documenting software supply-chains with cryptographically signed records of software-development life cycle state and cryptographic digests of executable code | |
US20190305957A1 (en) | Execution smart contracts configured to establish trustworthiness of code before execution | |
US4853843A (en) | System for merging virtual partitions of a distributed database | |
CN101135989B (en) | Automatization test method and device for Web applied system | |
US20100257138A1 (en) | Data change ordering in multi-log based replication | |
US20210049715A1 (en) | Blockchain-based data procesing method, apparatus, and electronic device | |
EP3726779A1 (en) | Device for testing blockchain network | |
Verma et al. | Introduction of formal methods in blockchain consensus mechanism and its associated protocols | |
CN116126392B (en) | Code version management method based on blockchain and IPFS | |
US20090192645A1 (en) | Automatic controller relationship resolution | |
CN111444027B (en) | Transaction processing method and device, computer equipment and storage medium | |
WO2021184981A1 (en) | Blockchain-based method, apparatus, and device for reviewing originality of work | |
Amiri et al. | Permissioned blockchains: Properties, techniques and applications | |
CN113342418B (en) | Distributed machine learning task unloading method based on block chain | |
US9009675B2 (en) | Verification of complex workflows through internal assessment or community based assessment | |
Isaja et al. | A blockchain-based framework for trusted quality data sharing towards zero-defect manufacturing | |
CN111931220A (en) | Consensus processing method, device, medium and electronic equipment for block chain network | |
CN113628049A (en) | Block chain intelligent contract conflict resolution method based on group intelligence | |
CN101013426B (en) | Information management apparatus and method | |
CN118134508A (en) | Product tracing method and system based on consensus mechanism | |
CN117034284A (en) | Tracing method and related device for repairing patch corresponding to open source vulnerability | |
US20240161109A1 (en) | Distributed evaluation platform for nonfungible tokens using virtual token cloning |
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 |