A software development testing method and apparatus based on blockchain smart contracts

CN116185876BActive Publication Date: 2026-08-14INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-28
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

即使满足上述条件的情况下,在开发人员提交代码后,仍然存在大量迭代及沟通成本才能保证开发内容与设计内容保持一致,并可能存在工作分配和制定计划不合理的情况

Benefits of technology

[0049]1、从传统的设计文档转换为智能合约代码使得产品需求明确,产品需求与设计人员开发人员能力脱钩。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116185876B_ABST
    Figure CN116185876B_ABST
Patent Text Reader

Abstract

This invention relates to the technical field of blockchain technology applications in finance. It provides a software development testing method and apparatus based on blockchain smart contracts. The method includes: receiving software development code to be tested through a blockchain node; broadcasting the software development code to be tested to other blockchain nodes on the local blockchain; and testing the software development code according to a pre-set smart contract to generate a testing result. The testing result characterizes the degree to which the software development code conforms to pre-set design requirements. This invention, by analyzing and verifying submitted code based on blockchain smart contract technology, can effectively prevent discrepancies between code and design caused by developers' misunderstandings of design documents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer data processing technology, and in particular relates to the field of blockchain technology, specifically to a software development testing method and apparatus based on blockchain smart contracts. Background Technology

[0002] Current software development models typically employ a centralized approach. This involves product managers, architects, and development team leaders defining project goals, milestones, and acceptance criteria. Developers then interpret the functionalities based on the product manager's descriptions in the development documentation. This model requires stable core personnel and heavily relies on the product manager's communication skills and the developers' comprehension abilities. Even when these conditions are met, significant iteration and communication costs remain after developers submit their code to ensure consistency between the development and design, and there is a possibility of inappropriate work allocation and planning. Summary of the Invention

[0003] This invention can be used in the technical field of blockchain technology application in finance, and can also be used in any field other than finance. The software development testing method and device based on blockchain smart contracts provided by this invention analyzes and verifies the submitted code based on blockchain smart contract technology, thereby effectively preventing the problem of code not matching design caused by developers' misunderstanding of design documents.

[0004] To address the technical problems in the background section of this application, the present invention provides the following technical solutions:

[0005] In a first aspect, the present invention provides a software development testing method based on blockchain smart contracts, comprising:

[0006] Receive the software development code to be tested via blockchain nodes;

[0007] Broadcast the development code of the software to be tested to other blockchain nodes of the local blockchain;

[0008] The software development code to be tested is tested according to a pre-set smart contract to generate a test result for the software development code to be tested; wherein, the test result is used to characterize the degree of conformity of the software development code to be tested with the pre-set design requirements.

[0009] In one embodiment of the present invention, before broadcasting the software development code to be tested to other blockchain nodes, the method further includes:

[0010] Determine whether the software development code to be tested was issued by the blockchain node;

[0011] If so, calculate the block corresponding to the software development code to be detected in the local blockchain to generate the first block calculation result.

[0012] In one embodiment of the present invention, broadcasting the software development code to be detected to other blockchain nodes of the local blockchain includes:

[0013] Send a broadcast request to the other blockchain nodes;

[0014] When a permission notification corresponding to the broadcast request sent by the other blockchain node is received, the calculation result of the first block is broadcast to the other blockchain node.

[0015] In one embodiment of the present invention, after broadcasting the software development code to be detected to other blockchain nodes of the local blockchain, the method further includes:

[0016] Receive the second block calculation result calculated by the other blockchain nodes based on the development code of the software to be tested;

[0017] When the calculation result of the first block is consistent with the calculation result of the second block, the calculation result of the first block or the calculation result of the second block is uploaded to the blockchain.

[0018] In one embodiment of the present invention, the step of detecting the software development code to be detected according to a pre-set smart contract to generate a detection result of the software development code to be detected includes:

[0019] The software development code to be tested is parsed to determine the tree structure of the software development code to be tested;

[0020] The detection result is generated based on the smart contract and the structure tree.

[0021] In one embodiment of the present invention, the step of detecting the software development code to be detected according to a pre-set smart contract to generate a detection result of the software development code to be detected includes:

[0022] The software development code to be tested is parsed to generate parsing results, and the code tags of the software development code to be tested are determined.

[0023] Based on the code tags, find the text corresponding to the software development code to be detected in the parsing results;

[0024] The detection result is generated based on the smart contract and the text corresponding to the development code of the software to be tested.

[0025] Secondly, the present invention provides a software development testing device based on blockchain smart contracts, the device comprising:

[0026] Develop a code receiving module to receive the development code of the software to be tested through a blockchain node;

[0027] A code broadcasting module is developed to broadcast the development code of the software to be tested to other blockchain nodes of the local blockchain;

[0028] A code detection module is developed to detect the development code of the software to be tested according to a pre-set smart contract, so as to generate a detection result of the development code of the software to be tested; wherein, the detection result is used to characterize the degree of conformity of the development code of the software to be tested to the pre-set design requirements.

[0029] In one embodiment of the present invention, the software development testing device based on blockchain smart contracts further includes:

[0030] A code judgment module is developed to determine whether the development code of the software to be tested was issued by the blockchain node;

[0031] The first calculation module is used to calculate the block corresponding to the software development code to be tested in the local blockchain if the condition is met, so as to generate the first block calculation result.

[0032] In one embodiment of the present invention, the development code receiving module includes:

[0033] A broadcast request sending unit is used to send broadcast requests to the other blockchain nodes;

[0034] The first calculation result broadcasting unit is used to broadcast the calculation result of the first block to the other blockchain nodes when it receives the permission notification corresponding to the broadcast request sent by the other blockchain nodes.

[0035] In one embodiment of the present invention, the software development testing device based on blockchain smart contracts further includes:

[0036] The second calculation module is used to receive the second block calculation result calculated by the other blockchain nodes based on the development code of the software to be tested;

[0037] The block calculation result uploading module is used to upload either the first block calculation result or the second block calculation result to the blockchain when the first block calculation result is consistent with the second block calculation result.

[0038] In one embodiment of the present invention, the code detection module includes:

[0039] The structure tree determination unit is used to parse the software development code to be tested in order to determine the structure tree of the software development code to be tested.

[0040] The development code first detection unit is used to generate the detection result based on the smart contract and the structure tree.

[0041] In one embodiment of the present invention, the code detection module includes:

[0042] The code tag determination unit is used to parse the software development code to be detected, generate parsing results, and determine the code tags of the software development code to be detected.

[0043] The text search unit is used to search for the text corresponding to the software development code to be detected in the parsing result based on the code tag;

[0044] The second code detection unit is used to generate the detection result based on the smart contract and the text corresponding to the development code of the software to be detected.

[0045] Thirdly, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of a software development testing method based on a blockchain smart contract.

[0046] Fourthly, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of a software development testing method based on blockchain smart contracts.

[0047] Fifthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a software development detection method based on blockchain smart contracts.

[0048] As described above, embodiments of the present invention provide a software development testing method and apparatus based on blockchain smart contracts, comprising: firstly, receiving software development code to be tested through a blockchain node; then, broadcasting the software development code to be tested to other blockchain nodes of the local blockchain; and finally, testing the software development code to be tested according to a pre-set smart contract to generate a testing result for the software development code to be tested; wherein the testing result is used to characterize the degree of conformity of the software development code to be tested with pre-set design requirements. The present invention, by explicitly expressing the design requirements in the design language and specifications through smart contracts, can achieve the following beneficial effects:

[0049] 1. Converting traditional design documents into smart contract code clarifies product requirements and decouples product requirements from the capabilities of designers and developers.

[0050] 2. Use smart contract-based code to define software product requirements, ensuring from a technical perspective that product requirements do not change with personnel changes.

[0051] 3. When developers submit code, they can check whether the requirements are met through smart contracts. This can intercept development errors before the code is put into the repository, reduce the amount of development content that does not conform to the design and incorporate it into the continuous integration process, thereby reducing the workload of repeated code acceptance testing. Attached Figure Description

[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0053] Figure 1 This is a flowchart illustrating the software development detection method based on blockchain smart contracts in an embodiment of the present invention. Figure 1 ;

[0054] Figure 2 This is a flowchart illustrating the software development detection method based on blockchain smart contracts in an embodiment of the present invention. Figure 2 ;

[0055] Figure 3 This is a flowchart illustrating step 200 of the software development detection method based on blockchain smart contracts in an embodiment of the present invention.

[0056] Figure 4 This is a flowchart illustrating the software development detection method based on blockchain smart contracts in an embodiment of the present invention. Figure 3 ;

[0057] Figure 5 This is a flowchart illustrating step 300 of the software development detection method based on blockchain smart contracts in an embodiment of the present invention. Figure 1 ;

[0058] Figure 6 This is a flowchart illustrating step 300 of the software development detection method based on blockchain smart contracts in an embodiment of the present invention. Figure 2 ;

[0059] Figure 7 This is a flowchart illustrating step 300 of the software development detection method based on blockchain smart contracts in an embodiment of the present invention. Figure 3 ;

[0060] Figure 8This is a schematic diagram of the structure of a software development testing system based on blockchain smart contracts in a specific embodiment of the present invention;

[0061] Figure 9 This is a schematic diagram of the server node structure in a specific embodiment of the present invention;

[0062] Figure 10 This is a schematic diagram of the structure of the PC node for code developers in a specific embodiment of the present invention;

[0063] Figure 11 The square is an example of a software development testing device based on blockchain smart contracts in an embodiment of the present invention. Figure 1 ;

[0064] Figure 12 The square is an example of a software development testing device based on blockchain smart contracts in an embodiment of the present invention. Figure 2 ;

[0065] Figure 13 A block diagram of the code receiving module 20 in an embodiment of the present invention;

[0066] Figure 14 The square is an example of a software development testing device based on blockchain smart contracts in an embodiment of the present invention. Figure 3 ;

[0067] Figure 15 A block for developing code detection module 30 in an embodiment of the present invention. Figure 1 ;

[0068] Figure 16 A block for developing code detection module 30 in an embodiment of the present invention. Figure 2 ;

[0069] Figure 17 This is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. Detailed Implementation

[0070] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0071] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0072] It should be noted that the terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or apparatuses. Without conflict, the embodiments and features in the embodiments of this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0073] The acquisition, storage, use, and processing of data in this application comply with relevant laws and regulations.

[0074] Existing software development testing solutions based on blockchain smart contracts suffer from the following technical pain points: They employ a centralized approach to software development. Development goals, milestones, and acceptance criteria are defined by product managers, architects, and development team leaders. Developers rely on the product manager's descriptions of features in the development documentation for comprehension. This heavily depends on the product manager's communication skills and the developers' understanding. Even after developers submit their code, significant iteration and communication costs remain to ensure consistency between the development and design, and there may be instances of unreasonable work allocation and planning. Therefore, this invention provides a specific implementation of a software development testing method based on blockchain smart contracts. See [link to relevant documentation]. Figure 1 The method specifically includes the following:

[0075] Step 100: Receive the development code of the software to be tested through the blockchain node;

[0076] Step 200: Broadcast the software development code to be tested to other blockchain nodes of the local blockchain;

[0077] Step 300: The software development code to be tested is tested according to a pre-set smart contract to generate a test result for the software development code to be tested; wherein the test result is used to characterize the degree of conformity of the software development code to be tested with the pre-set design requirements.

[0078] As can be seen from the above description, in order to prevent developers from misunderstanding the design documents during the software development process, this invention uses smart contract code to check the development code, which effectively prevents the problem of code not matching the design caused by the developers' misunderstanding of the design documents.

[0079] In some embodiments, see Figure 2 In the software development testing method based on blockchain smart contracts, before step 200, the following steps are also included:

[0080] Step 400: Determine whether the software development code to be tested was issued by the blockchain node;

[0081] Step 500: If so, calculate the block corresponding to the software development code to be detected in the local blockchain to generate the first block calculation result.

[0082] In steps 400 and 500, it is first verified whether the software development code to be tested was broadcast from a blockchain node in the blockchain network (i.e., its legitimacy is verified). If it is a broadcast from a blockchain node, a new block is calculated. If not, the received request is discarded.

[0083] Additionally, the method for generating the first block calculation result includes: forming a transaction pool from the software development code to be tested; using the hash value, difficulty value, timestamp, and other information from the latest block header as base information, adding a nonce (random number) to form a new block header; packaging the transactions in the transaction pool into a new block according to certain rules to generate a new block body; combining the new block header and block body and calculating their hash values; checking whether the new hash value meets the current difficulty target; if it does, then this new block is valid and can be added to the blockchain.

[0084] In some embodiments, see Figure 3 In the software development testing method based on blockchain smart contracts, step 200 includes:

[0085] Step 201: Send a broadcast request to the other blockchain nodes;

[0086] Step 202: When receiving the permission notification corresponding to the broadcast request sent by the other blockchain nodes, broadcast the calculation result of the first block to the other blockchain nodes.

[0087] Broadcasting in a blockchain refers to sending the computation result of the first block to all nodes in the blockchain network so that other nodes can receive the information. This ensures that all nodes can synchronize information, thus guaranteeing the security and integrity of the blockchain. The process of broadcasting in a blockchain is similar to broadcasting on the internet, but with some differences. For example, in a blockchain, broadcast information is encrypted, so only those with the correct private key can read it. Furthermore, broadcasting in a blockchain is decentralized, so there is no central server controlling broadcast traffic. Instead, each node can broadcast information, ensuring that the information is received by all nodes.

[0088] In some embodiments, see Figure 4 In the software development testing method based on blockchain smart contracts, after step 200, the following steps are also included:

[0089] Step 600: Receive the second block calculation result calculated by the other blockchain nodes based on the development code of the software to be tested;

[0090] Step 700: When the calculation result of the first block is consistent with the calculation result of the second block, upload the calculation result of the first block or the calculation result of the second block to the blockchain.

[0091] In steps 600 and 700, after other blockchain nodes have completed their calculations, they verify the calculation result of the generated second block against the received broadcast result (the calculation result of the first block). If the verification matches, the new block is uploaded to the blockchain, thus completing the process of uploading a commit record to the blockchain.

[0092] In some embodiments, see Figure 5 In the software development testing method based on blockchain smart contracts, step 300 includes:

[0093] Step 301: Parse the software development code to be tested to determine the tree structure of the software development code to be tested;

[0094] Preferably, determining the tree structure of the software development code to be tested can be done through the following steps: First, identify the components of the software development code to be tested, such as modules, classes, functions, etc. Based on these components, organize them into a tree structure, with the root node being the entry point for the entire software development code, and each node representing a component. Determine the parent-child relationships between nodes based on the calling relationships of the software development code to be tested; for example, if one function calls another, the former is the parent node of the latter. Visualize the tree structure; drawing tools or code visualization tools can be used to display the tree structure of the software development code to be tested.

[0095] Software development tools, such as IDEs and code analysis tools, can also be used to automatically generate code structure trees. These tools can automatically generate code structure trees by parsing source code and provide a visual interface to help developers understand and manage the code structure.

[0096] Step 302: Generate detection results based on the smart contract and the structure tree.

[0097] In some embodiments, see Figure 6 In the software development testing method based on blockchain smart contracts, step 300 includes:

[0098] Step 303: Parse the software development code to be tested to generate parsing results and determine the code tags of the software development code to be tested;

[0099] Step 304: Locate the text corresponding to the software development code to be detected in the parsing results based on the code tags;

[0100] Step 305: Generate detection results based on the smart contract and the text corresponding to the development code of the software to be tested.

[0101] In steps 303 to 305, specifically, firstly, the validation rules corresponding to the tags are set. For example, the tag is "Check the boundary value of input item 1". The corresponding validation rule is "condition: 'a>b'". ​​Next, the code tags are parsed based on the submission code section of the submission record. The text content of the actual code in the code parsing result is found based on the code tags. Finally, the smart contract checks whether the text content meets the preset requirements.

[0102] It's important to note that the actual code branch content is validated separately based on the code tags in the commit history. The above describes the validation of a single code tag. If there are multiple code tags, the same tag validation will be performed multiple times. Each validation will record a result 's', initially 0. If the validation is successful, 's' is incremented by 1; otherwise, it's incremented by 0.

[0103] In some embodiments, see Figure 7 In the software development testing method based on blockchain smart contracts, step 300 further includes:

[0104] Step 306: Parse the unit test cases in the code case execution results of the commit record.

[0105] Step 307: Calculate whether each unit test case was successful and calculate the success rate R of the submitted unit test cases.

[0106] Two judgment values ​​are obtained from steps 305 and 307:

[0107] 1. Code design compliance S = ∑s

[0108] 2. Unit test case success rate R

[0109] Finally, the smart contract compares the pre-defined code design compliance and unit test case success rate. Only if S >= S preset value & R >= R preset value, will the smart contract input the result that is allowed to be added to the database. The smart contract output is as follows:

[0110] When the database entry is allowed, the output is {commit:yes}.

[0111] When data entry is not allowed, the output will be {commit:no}.

[0112] In addition, software development testing methods based on blockchain smart contracts include: analyzing the code on the submission server before it is stored in the repository after submission; then matching the code with the design specifications on the server to determine whether it conforms to the design; or using a client-server (CS) model design specification development tool. First, the design specifications are downloaded to the local client, and before code submission, the local client analyzes the submitted code. Then, the client matches the code with the design specifications to determine whether it conforms to the design.

[0113] As described above, this invention addresses the problem of software development being highly dependent on the product manager's communication skills and the developer's comprehension abilities, and prevents developers from misunderstanding design documents during software development. It proposes a smart contract-based code development method that uses a code development tool based on blockchain smart contract technology to constrain software design requirements through smart contracts, analyzes and verifies submitted code, and ultimately achieves software development testing based on smart contract constraints.

[0114] In one specific embodiment, the present invention also provides a specific implementation of a software development detection method based on blockchain smart contracts, which specifically includes the following:

[0115] First, a specific embodiment of the present invention provides a software development testing system based on blockchain smart contracts, see [link to relevant documentation]. Figure 8The system includes at least one server node 1 and multiple code developer PC nodes 2. Server node 1 is responsible for providing uninterrupted blockchain computing power, blockchain network management, and executing smart contracts. Code developer PC nodes 2 are responsible for providing blockchain computing power, consensus mechanisms, executing smart contracts, and generating code commit records when accessing the blockchain. When code is committed, the code developer PC node generates a commit record, which is broadcast to all nodes via the blockchain. After receiving a new commit record, each node checks it through a smart contract to generate a new block. The node that first determines the result conforms to the design broadcasts the result to the network. After each node verifies its correctness, it adds the new block to the blockchain, completing the process of adding a usage record to the blockchain.

[0116] In the blockchain network, server node 1 acts as the network management node and issues blockchain network certificates to each node.

[0117] When the code development tool generates a code commit record, the code developer's PC node 2 broadcasts the current code commit record to the blockchain network by sending an HTTPS request. After receiving the broadcast HTTPS request from the elevator node, a network node first verifies whether it was indeed sent by the code developer's PC node 2. If it was, the node begins calculating a new block. If it wasn't sent by the code developer's PC node 2, the received request is discarded. After completing the above checks and passing the verification, the node begins calculating a new block. Once the block is calculated, the node broadcasts the result to other nodes in the blockchain network. After other nodes have completed their calculations, they verify their results against the received broadcast results. If the verification matches, the new block is added to the blockchain, completing one commit record on-chain process.

[0118] Next, the code commit records of developers are shared with network nodes through the blockchain network, leveraging the characteristics of the blockchain data structure to make the code commit records difficult to modify. Smart contracts are used to constrain the submitted code, ensuring consistency with design requirements. Even when development team members change, the smart contracts can maintain consistency between the code and the original design intent. Ultimately, this solves the problem in software engineering that heavily relies on the product manager's communication skills and the developer's comprehension abilities.

[0119] See Figure 9 As shown in Table 1, the server node consists of blockchain network management, code parsing, feature code matching, feature code storage, smart contract virtual machine, and manual voting functions. A network includes one server node ensuring uninterrupted computing power, at least one code developer PC node 2, and all nodes connected to form the blockchain network.

[0120] Table 1 Server Node Function Table

[0121]

[0122] The server nodes have blockchain management functionality, owned by the network administrator. This administrator has authority over all network nodes, including network startup / shutdown, node addition / exit, and granting / revoking node permissions. When the network is not started, the network administrator starts it via the management node. When the network needs to be stopped, the network administrator stops it via the management node. When a new node needs to be added, the node owner submits a join request to the administrator. Once approved, the network administrator adds the node to the network via the management node. When a node needs to leave the network, the node owner submits a leave request to the administrator. Once approved, the network administrator removes the node from the network via the management node. When a node needs new network permissions, the node owner submits a permission addition request to the administrator. Once approved, the network administrator adds the node's network permissions via the management node. When a node needs its network permissions revoked or reduced, the node owner submits a permission reduction request to the administrator. Once approved, the network administrator reduces the node's network permissions via the management node, or directly revokes the node's network permissions via the management node.

[0123] See Figure 10 The code developer's PC node is the computer used by code developers for code development. It resides on the same local area network as the service node, and the nodes are interconnected. In the blockchain network, the code developer's PC node lacks the blockchain network management functionality compared to the code development tool server node; all other functions are identical. The commit record format is as follows:

[0124] Development tasks

[0125] Task Number

[0126] Tags: Tag 1, Tag 2, Tag 3.....

[0127] Key packages: package name 1, package name 2, ...

[0128] Key code: Code 1, Code 2, Code 3...

[0129] Task completed version: Version number

[0130] Estimated completion time for the task: YYYY-MM-DD-SS

[0131] Task-related branches: Branch 1

[0132] Submit code

[0133] Code 1: Tag 1, Tag 2, Tag 3...

[0134] Code 2: Tag 1, Tag 2, Tag 3... ......

[0136] Code n: tag1, tag2, tag3...

[0137] Submitting to branch: Branch 1

[0138] Code example execution results

[0139] Unit test examples:

[0140] Case Name: Case 1

[0141] Result: Result 1

[0142] Case Name: Case 2

[0143] Result: Result 2

[0144] Case Name: Case 3

[0145] Result: Result 3 ......

[0147] Case Name: Case n

[0148] Result: Result n

[0149] Submission Date: YYYY-MM-DD-SS

[0150] Submitted by: 0123456

[0151] Code parsing function: This function is used to parse the submitted code when a blockchain network node receives it. Taking Java code submission as an example, it analyzes the code structure by matching and analyzing the methods and branches used in the submitted code to generate an analysis result.

[0152] The smart contract virtual machine (VM) functions to create a smart contract execution space and execute smart contract content. The smart contract content primarily checks whether the submitted code meets design requirements. Based on these requirements, designers write corresponding smart contracts. Smart contract checks involve two parts: code tag checks and unit test case execution checks.

[0153] Manual voting function: When developers submit non-business code, or when there is a dispute over the results of smart contract inspections, they can use the manual voting function to request other developers in the blockchain network to manually vote on the code submission for inclusion in the repository. The manual voting process is as follows:

[0154] 1. The developer received a result indicating that the smart contract did not allow data to be stored in the database.

[0155] 2. Developers use the manual voting function to request manual review from other developers in the network.

[0156] 3. Other developers review the results and then pass them to the smart contract.

[0157] 4. When the smart contract receives two-thirds of the network's permission to add the data, it returns the permission result to the voting initiator.

[0158] Alternatively, the code can be analyzed on the commit server before being stored in the repository. Then, the code is matched against the design specifications on the server to determine if it conforms to the design. Another approach is to use a client-server (CS) design specification development tool. The design specifications are first downloaded to the local client, and the submitted code is analyzed on the local client before submission. Then, the code is matched against the design specifications on the client to determine if it conforms to the design.

[0159] As can be seen from the above description, the embodiments of the present invention provide a software development testing method based on blockchain smart contracts. By expressing the design requirements clearly in the design language and specifications through smart contracts, the following beneficial effects can be achieved:

[0160] 1. Converting traditional design documents into smart contract code clarifies product requirements and decouples product requirements from the capabilities of designers and developers.

[0161] 2. Use smart contract-based code to define software product requirements, ensuring from a technical perspective that product requirements do not change with personnel changes.

[0162] 3. When developers submit code, they can check whether the requirements are met through smart contracts. This can intercept development errors before the code is put into the repository, reduce the amount of development content that does not conform to the design and incorporate it into the continuous integration process, thereby reducing the workload of repeated code acceptance testing.

[0163] Based on the same inventive concept, this application also provides a software development testing device based on blockchain smart contracts, which can be used to implement the methods described in the above embodiments, as shown in the following embodiments. Since the principle of the software development testing device based on blockchain smart contracts is similar to that of the software development testing method based on blockchain smart contracts, the implementation of the software development testing device based on blockchain smart contracts can refer to the implementation of the software development testing method based on blockchain smart contracts, and repeated details will not be elaborated further. As used below, the terms "unit" or "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0164] Embodiments of the present invention provide a specific implementation of a software development detection device based on blockchain smart contracts, capable of implementing a software development detection method based on blockchain smart contracts. See [link to specific implementation details]. Figure 11 The software development testing device based on blockchain smart contracts specifically includes the following components:

[0165] The code receiving module 10 is used to receive the development code of the software to be tested through a blockchain node.

[0166] The code broadcasting module 20 is used to broadcast the development code of the software to be tested to other blockchain nodes of the local blockchain.

[0167] The development code detection module 30 is used to detect the development code of the software to be tested according to a pre-set smart contract, so as to generate a detection result of the development code of the software to be tested; wherein, the detection result is used to characterize the degree of conformity of the development code of the software to be tested to the pre-set design requirements.

[0168] In one embodiment of the present invention, see Figure 12 The software development testing device based on blockchain smart contracts also includes:

[0169] The code judgment module 40 is used to determine whether the development code of the software to be tested was issued by the blockchain node;

[0170] The first calculation module 50 is used to calculate the block corresponding to the software development code to be detected in the local blockchain if the condition is met, so as to generate the first block calculation result.

[0171] In one embodiment of the present invention, see Figure 13 The development code receiving module 20 includes:

[0172] Broadcast request sending unit 201 is used to send broadcast requests to the other blockchain nodes;

[0173] The first calculation result broadcasting unit 202 is used to broadcast the calculation result of the first block to the other blockchain nodes when it receives the permission notification corresponding to the broadcast request sent by the other blockchain nodes.

[0174] In one embodiment of the present invention, see Figure 14 The software development testing device based on blockchain smart contracts also includes:

[0175] The second calculation module 60 is used to receive the second block calculation result calculated by the other blockchain nodes based on the development code of the software to be tested;

[0176] The block calculation result up-to-chain module 70 is used to up-to-chain either the first block calculation result or the second block calculation result when the first block calculation result is consistent with the second block calculation result.

[0177] In one embodiment of the present invention, see Figure 15 The code detection module 30 includes:

[0178] The structure tree determination unit 301 is used to parse the software development code to be tested in order to determine the structure tree of the software development code to be tested;

[0179] The development code first detection unit 302 is used to generate the detection result based on the smart contract and the structure tree.

[0180] In one embodiment of the present invention, see Figure 16 The code detection module 30 also includes:

[0181] The code tag determination unit 303 is used to parse the software development code to be detected, generate a parsing result, and determine the code tag of the software development code to be detected.

[0182] The text search unit 304 is used to search for the text corresponding to the software development code to be detected in the parsing result based on the code tag;

[0183] The second code detection unit 305 is used to generate the detection result based on the smart contract and the text corresponding to the development code of the software to be detected.

[0184] As described above, this invention provides a software development testing device based on blockchain smart contracts, comprising: first, receiving software development code to be tested through a blockchain node; then, broadcasting the software development code to be tested to other blockchain nodes in the local blockchain; and finally, testing the software development code to be tested according to a pre-set smart contract to generate a testing result for the software development code to be tested; wherein the testing result is used to characterize the degree of conformity of the software development code to be tested with pre-set design requirements. This invention, by explicitly expressing the design requirements in the design language and specifications through smart contracts, can achieve the following beneficial effects:

[0185] 1. Converting traditional design documents into smart contract code clarifies product requirements and decouples product requirements from the capabilities of designers and developers.

[0186] 2. Use smart contract-based code to define software product requirements, ensuring from a technical perspective that product requirements do not change with personnel changes.

[0187] 3. When developers submit code, they can check whether the requirements are met through smart contracts. This can intercept development errors before the code is put into the repository, reduce the amount of development content that does not conform to the design and incorporate it into the continuous integration process, thereby reducing the workload of repeated code acceptance testing.

[0188] The embodiments of this application also provide a specific implementation of an electronic device capable of implementing all the steps in the software development testing method based on blockchain smart contracts in the above embodiments. See [link to implementation details]. Figure 17 The electronic devices specifically include the following:

[0189] Processor 1201, memory 1202, communications interface 1203, and bus 1204;

[0190] The processor 1201, memory 1202, and communication interface 1203 communicate with each other via bus 1204; the communication interface 1203 is used to realize information transmission between server-side devices and client-side devices and other related devices.

[0191] The processor 1201 is used to call the computer program in the memory 1202. When the processor executes the computer program, it implements all the steps in the software development detection method based on blockchain smart contracts in the above embodiments. For example, when the processor executes the computer program, it implements the following steps:

[0192] Step 100: Receive the development code of the software to be tested through the blockchain node;

[0193] Step 200: Broadcast the software development code to be tested to other blockchain nodes of the local blockchain;

[0194] Step 300: The software development code to be tested is tested according to a pre-set smart contract to generate a test result for the software development code to be tested; wherein the test result is used to characterize the degree of conformity of the software development code to be tested with the pre-set design requirements.

[0195] Embodiments of this application also provide a computer-readable storage medium capable of implementing all steps of the software development detection method based on blockchain smart contracts in the above embodiments. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements all steps of the software development detection method based on blockchain smart contracts in the above embodiments. For example, when the processor executes the computer program, it implements the following steps:

[0196] Step 100: Receive the development code of the software to be tested through the blockchain node;

[0197] Step 200: Broadcast the software development code to be tested to other blockchain nodes of the local blockchain;

[0198] Step 300: The software development code to be tested is tested according to a pre-set smart contract to generate a test result for the software development code to be tested; wherein the test result is used to characterize the degree of conformity of the software development code to be tested with the pre-set design requirements.

[0199] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, hardware + program embodiments are relatively simple in description because they are fundamentally similar to method embodiments; relevant parts can be referred to the descriptions in the method embodiments.

[0200] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0201] While this application provides method operation steps as shown in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-inventive labor. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only execution order. In actual device or client product execution, the method can be executed sequentially as shown in the embodiments or drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment).

[0202] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing the embodiments of this specification, the functions of each module can be implemented in one or more software and / or hardware components, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.

[0203] Those skilled in the art will also know that, besides implementing the controller using purely computer-readable program code, the same functions can be achieved by logically programming the method steps, making the controller function as logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers (PLCs), and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the devices within it used to implement various functions can also be considered structures within that hardware component. Alternatively, the devices used to implement various functions can be considered as both software modules implementing the method and structures within a hardware component.

[0204] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0205] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0206] The embodiments described in this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. The embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0207] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, system embodiments are basically similar to method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. In the description of this specification, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the embodiments in this specification. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0208] The above description is merely an embodiment of the present specification and is not intended to limit the embodiments of the present specification. For those skilled in the art, various modifications and variations can be made to the embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the embodiments of the present specification should be included within the scope of the claims of the embodiments of the present specification.

Claims

1. A software development testing method based on blockchain smart contracts, characterized in that, include: Receive the software development code to be tested via blockchain nodes; Broadcast the development code of the software to be tested to other blockchain nodes of the local blockchain; The software development code to be tested is tested according to a pre-set smart contract to generate a test result for the software development code to be tested; wherein, the test result is used to characterize the degree to which the software development code to be tested conforms to the pre-set design requirements; Before broadcasting the software development code to be tested to other blockchain nodes, the method further includes: Determine whether the software development code to be tested was issued by the blockchain node; If so, calculate the block corresponding to the software development code to be detected in the local blockchain to generate the first block calculation result; The method for generating the calculation result of the first block includes: The software development code to be tested is formed into a transaction pool. The hash value, difficulty value and timestamp in the latest block header information are used as the basic information. A random number is added to the basic information to form a new block header. Transactions in the transaction pool are packaged into a new block according to certain rules to generate a new block body. The new block header and the block body are combined, and the hash value of the result obtained by combining the new block header and the block body is calculated. If the hash value meets the difficulty target, the new block formed by combining the new block header and the block body is valid and added to the blockchain. Broadcasting the software development code to be tested to other blockchain nodes on the local blockchain includes: Send a broadcast request to the other blockchain nodes; When a permission notification corresponding to the broadcast request sent by the other blockchain node is received, the calculation result of the first block is broadcast to the other blockchain node.

2. The software development testing method according to claim 1, characterized in that, After broadcasting the software development code to be tested to other blockchain nodes on the local blockchain, the method further includes: Receive the second block calculation result calculated by the other blockchain nodes based on the development code of the software to be tested; When the calculation result of the first block is consistent with the calculation result of the second block, the calculation result of the first block or the calculation result of the second block is uploaded to the blockchain.

3. The software development testing method according to any one of claims 1 to 2, characterized in that, The step of detecting the software development code to be tested according to a pre-set smart contract to generate a detection result for the software development code to be tested includes: The software development code to be tested is parsed to determine the tree structure of the software development code to be tested; The detection result is generated based on the smart contract and the structure tree.

4. The software development testing method according to claim 1, characterized in that, The step of detecting the software development code to be tested according to a pre-set smart contract to generate a detection result for the software development code to be tested includes: The software development code to be tested is parsed to generate parsing results, and the code tags of the software development code to be tested are determined. Based on the code tags, find the text corresponding to the software development code to be detected in the parsing results; The detection result is generated based on the smart contract and the text corresponding to the development code of the software to be tested.

5. A software development testing device based on blockchain smart contracts, characterized in that, include: Develop a code receiving module to receive the development code of the software to be tested through a blockchain node; A code broadcasting module is developed to broadcast the development code of the software to be tested to other blockchain nodes of the local blockchain; A code detection module is developed to detect the development code of the software to be tested according to a pre-set smart contract, so as to generate a detection result of the development code of the software to be tested; wherein, the detection result is used to characterize the degree of conformity of the development code of the software to be tested to the pre-set design requirements; The software development testing device based on blockchain smart contracts also includes: A code judgment module is developed to determine whether the development code of the software to be tested was issued by the blockchain node; The first calculation module is used to calculate the block corresponding to the software development code to be detected in the local blockchain if the condition is met, so as to generate the first block calculation result. The method for generating the calculation result of the first block includes: The software development code to be tested is formed into a transaction pool. The hash value, difficulty value and timestamp in the latest block header information are used as the basic information. A random number is added to the basic information to form a new block header. Transactions in the transaction pool are packaged into a new block according to certain rules to generate a new block body. The new block header and the block body are combined, and the hash value of the result obtained by combining the new block header and the block body is calculated. If the hash value meets the difficulty target, the new block formed by combining the new block header and the block body is valid and added to the blockchain. The development code receiving module includes: A broadcast request sending unit is used to send broadcast requests to the other blockchain nodes; The first calculation result broadcasting unit is used to broadcast the calculation result of the first block to the other blockchain nodes when it receives the permission notification corresponding to the broadcast request sent by the other blockchain nodes.

6. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the software development detection method based on blockchain smart contracts as described in any one of claims 1 to 4.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the software development detection method based on blockchain smart contracts as described in any one of claims 1 to 4.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the software development detection method based on blockchain smart contracts as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Equipment safety detection method and system based on intelligent contract

    CN112926057A

  • Code library construction method, device and equipment based on block chain

    CN115081029A

  • Block chain smart contract generation method and device, and electronic equipment

    CN115268847A