# Application of Blockchain Technologies in Verification of Software Metrics
## 3 Methodology
### Validation of the Metrics  
Verification will show that our metrics can use smart contracts for monitoring software metrics throughout the development process. In order to fully utilize metrics, we need to validate them and prove that our metrics can actually be used to enhance software reliability. To ensure the integrity and transparency of software metric evaluation, we introduce a formal model named the Blockchain-Based Metric Validation Scheme (BMVS) [34]. This scheme provides a structured approach to validate code quality metrics using the immutable properties of blockchain technology, specifically through smart contracts on the Ethereum network. The BMVS can be represented as a 6-tuple:  
\[\text{BMVS}=(\Sigma,\text{M},\text{C},\text{V},\text{B},\text{R})\]  
In this metric value, \(\Sigma\) is a set of source files \(\sigma_{i}\) written in scripting languages. M represents a set of metric functions for computing specific software metrics: \(\text{LOC}(\sigma)\) (Lines of Code), \(\text{CC}(\sigma)\) (Cyclomatic Complexity), \(\text{LCOM}(\sigma)\) (Lack of Cohesion), and \(\text{DIT}(\sigma)\) (Depth of the Inheritance Tree). The verification module, which calculates the cryptographic digest \(\text{h}=\text{H}(\text{m}(\sigma))\) and interacts with the blockchain for secure validation, is denoted as V. The blockchain environment is represented by B, and R is the result interpretation function that maps the outcomes of the metrics. Since this is a basic validation process, we aimed to innovate and develop a more robust system for validation. We will use zero-knowledge proofs to demonstrate that a metric lies within acceptable bounds without revealing the actual values. This will be achieved by delivering to the system a zero-knowledge proof whose cyclomatic complexity is lower than 10. This approach enables third-party validators to verify software without accessing the source code or exact metric values. Figure 4: System architecture. In order to implement this approach, we define a new Blockchain-Based Metric Validation Scheme (BMVS) with zero-knowledge proofs (ZKPs) as an internal and formal structural component [35]. \[\text{BMVS}=(\Sigma,\text{M}^{+},\text{T}^{+},\text{P},\text{V},\text{B},\text{R})\]  
We now examine the modified and newly introduced elements of the validation process. A new element is the extended metric vector, \(\text{M}^{+}\), defined for each file \(\sigma\). For every file, we introduce the following metric values: size and complexity, inheritance, coupling, and cohesion. For size and complexity, we use the following metrics: Lines of Code (LOC), Cyclomatic Complexity at the method level (CCm), Cyclomatic Complexity at the class level (CCc), and Total Methods per Class (TMC). Inheritance metrics are evaluated using the Depth of Inheritance Tree (DIT), Number of Children (NOC), Method Inheritance Factor (MIF), and Attribute Inheritance Factor (AIF). Finally, we incorporate metrics for coupling and cohesion, including Coupling Factor (CF), Inheritance Coupling (IC), and Lack of Cohesion of Methods (\(\text{LCOM}_{\text{i}}\)), where i represents the variant index. We then define threshold constraints, which are vectors of predefined limits for metric validity, denoted as  
\[\text{T}^{+}=\{\text{LOC}<\Theta_{1},\text{CC}_{\text{m}}\leq\Theta_{2},\ldots,\text{LCOM}_{1}\leq\Theta_{\text{k}}\}.\]  
Each defined constraint is a Boolean formula \(\tau_{\text{j}}\): \(\text{m}_{\text{j}}(\sigma)\bullet\Theta_{\text{j}}\), where \(\bullet\) represents a comparison operator such as \(<\), \(>\), \(\leq\), or \(\geq\). A zero-knowledge proof function provides a cryptographic attestation  
\[\text{P}:=\text{M}+\text{T}^{+}\rightarrow\pi,\]  
where \(\pi\) is a non-interactive zero-knowledge proof that satisfies metric validity without revealing the actual metric values. The blockchain-deployed verification function V outputs a Boolean value: true if \(\pi\) is valid for the declared threshold, and false otherwise.