A.V. Kuznetsov’s work “Application of Goodness-of-Fit Criteria in Mathematical Modeling of Economic Processes” (1991) provides a systematic framework for testing statistical hypotheses that is directly applicable to ECDSA cryptanalysis. Key findings:
- Goodness-of-fit criteria (Pearson, Kolmogorov–Smirnov, omega-square) allow one to formally test the hypothesis of uniform distribution of nonce and detect statistically significant biases with controlled errors of type I and II.
- The choice of criterion depends on the type of bias: χ² is effective for coarse biases, Kolmogorov–Smirnov for distribution shifts, and omega-square for weak distributed anomalies.
- The detected bias is transformed into a hidden number problem (HNP) , solved by lattice algorithms. The parameter
l(bias level), determined by statistical methods, is a critical input for the lattice. - The practical significance is confirmed by real attacks: Breitner and Heninger recovered hundreds of Bitcoin private keys using statistical nonce drift detection.
- A minimal bias (less than one bit) is sufficient to fully reveal the key given a sufficient number of signatures, making statistical control of the nonce generator critical to the security of blockchain systems.
Thus, the statistical goodness-of-fit criteria outlined in Kuznetsov’s work are not an abstract theoretical tool, but a powerful cryptanalytic tool that allows one to detect vulnerabilities in nonce generators before they are exploited and to recover private keys in real blockchain transactions.
Content
- Introduction: ECDSA, nonces, and the statistical nature of vulnerability
- The work of A.V. Kuznetsov and its significance for cryptanalysis
- Theoretical foundations of agreement criteria
- Application of goodness-of-fit criteria to nonce analysis
- Private Key Recovery Methodology
- Practical attacks and empirical results
- Conclusion
- Directions for further research for cryptanalysis based on this area
1. Introduction: ECDSA, nonce, and the statistical nature of vulnerability
The Elliptic Curve Digital Signature Algorithm (ECDSA) is the foundation of transaction security on the Bitcoin blockchain. Each signature is generated using a secret nonce ,k which must be uniformly distributed over the interval , where is the order of the secp256k1 elliptic curve. The cryptographic strength of ECDSA depends directly on the statistical properties of this nonce: any deviation from uniformity creates a statistically detectable bias that can be used to recover the private key .[1, n−1]nd
The ECDSA signature equation is:
s = k⁻¹ (H(m) + r d) mod n
where the private key is expressed as:
d = r⁻¹ · (k · s − H(m)) mod n
Therefore, the task of cryptanalysis boils down to recovering the unknown k or, equivalently, discovering statistical patterns in its distribution. Even a shift of less than one bit can lead to the complete disclosure of a private key given a sufficient number of signatures.[reference:0] This is where goodness-of-fit criteria come into play —a statistical tool that allows one to test the hypothesis of a uniform nonce distribution and detect anomalies that make an attack possible.
The key idea is that if the nonce generator has a statistically detectable bias, the null hypothesis of uniformity is rejected with a controlled error probability, and the bias parameters become input to lattice algorithms for solving the hidden number problem (HNP).
2. The work of A.V. Kuznetsov and its significance for cryptanalysis
A.V. Kuznetsov’s work “Application of Goodness-of-Fit Criteria in Mathematical Modeling of Economic Processes” (Minsk: BGINKh, 1991) is a systematic exposition of methods for testing statistical hypotheses about the distribution law of observed quantities. Despite its economic focus, its mathematical apparatus is universal and directly applicable to the analysis of cryptographic sequences, including the nonce in ECDSA.
The main value of the work for cryptanalysis is as follows:
| Aspect of Kuznetsov’s work | Application in ECDSA cryptanalysis |
|---|---|
| Systematization of goodness-of-fit criteria (Pearson, Kolmogorov, Smirnov, omega-square) | Selecting the optimal criterion for detecting a specific type of nonce bias (uniform, truncated, affine) |
| Analysis of the power of criteria under different alternatives | Estimation of the probability of detecting weak offsets (1–2 bits) with a limited number of signatures |
| Practical recommendations for choosing the significance level and sample size | Determining the minimum number of transactions for reliable vulnerability detection |
| Methods for testing complex hypotheses with estimated parameters | Detecting biases that depend on unknown nonce generator parameters |
Thus, Kuznetsov’s work provides a ready-made statistical apparatus for formalizing the problem of detecting nonce bias and moving from a qualitative observation (“nonces look suspicious”) to a quantitative criterion with controlled errors of type I and II.
3. Theoretical basis of agreement criteria
3.1. Statement of the problem of hypothesis testing
Let be k₁, k₂, ..., k_N a sequence of nonces extracted from ECDSA signatures in the blockchain. Two hypotheses are formulated:
- H₀ (null hypothesis): nonces are uniformly distributed on
[1, n−1], that is,F(x) = (x−1)/(n−1)forx ∈ [1, n] - H₁ (alternative hypothesis): the nonce distribution is not uniform
The goodness-of-fit criterion is a statistical test that allows one to accept or reject H₀ based on sample data with a given significance level α (probability of type I error).
3.2. Pearson chi-square test
The classical goodness-of-fit test is based on a comparison of observed and expected frequencies:
χ² = Σᵢ (Oᵢ − Eᵢ)² / Eᵢ
where Oᵢ is the number of nonces falling in ithe ith interval of the grouping, Eᵢ = N · pᵢ is the expected number under uniform distribution [reference:1]. When H₀ holds, the statistic χ² is asymptotically distributed as χ²(k−1), where k is the number of intervals. Hypothesis H₀ is rejected if χ² > χ²_{крит}(α, k−1).
Application to nonces: partitioning the nonce value space into k equal intervals (e.g., k = 256 to analyze the high-order bits) and checking for uniformity of distribution. The criterion is sensitive to biases affecting a significant portion of the distribution.
3.3 Kolmogorov–Smirnov criterion
A nonparametric test based on the maximum distance between the empirical distribution function F_N(x) and the theoretical one F(x):
D_N = sup_x |F_N(x) − F(x)|
For H₀, the statistic D_N has a Kolmogorov distribution [reference:2]. The test is particularly sensitive to differences in the shape of the distribution (e.g., shift or scale change), but is less powerful at detecting local biases in the tails.
Application to nonces: Effective for detecting systematic shifts in the nonce distribution (e.g., when using a truncated generator). Can be applied to both the full range [1, n−1]and individual bit positions.
3.4. Omega-squared criterion (Cramer–Mises–Smirnov)
An integral criterion that measures the mean square distance between the empirical and theoretical distribution functions:
ω² = ∫ [F_N(x) − F(x)]² dF(x)
Unlike the Kolmogorov criterion, which reacts to the maximum deviation, the omega-squared criterion takes into account all deviations and has increased power in detecting biases distributed over the entire range[reference:3].
Application to nonce: Preferred when detecting weak but systematic biases (e.g. when generating a nonce with several high-order zero bits) where the deviations are not concentrated at one point.
3.5. Comparative characteristics of criteria
| Criterion | The type of alternative to which it is sensitive | Advantage for nonce analysis |
|---|---|---|
| Pearson’s χ² | Biases affecting a significant proportion of the distribution | Ease of implementation, ability to analyze individual bit groups |
| Kolmogorov–Smirnov | Shift or rescale the distribution | Does not require grouping, effective for small samples |
| Omega square | Weak distributed biases | Maximum power in detecting subtle vulnerabilities |
4. Application of goodness-of-fit criteria to nonce analysis
4.1 Nonce Bias Models
In real ECDSA implementations, the following types of biases are encountered, each of which requires adaptation of the agreement criteria:
| Displacement type | Probabilistic model | Optimal criterion | Investigation for HNP |
|---|---|---|---|
| Zero high bits | k ∈ [0, 2^(ℓ−l)) | χ² (grouping by most significant bits) | Decrease nonce entropy per l bit |
| Low order zero bits | k = 2^l · k’ | Kolmogorov–Smirnov (distribution shift) | Equivalent to HNP after variable change |
| Affine dependence | k₂ = a k₁ + b (mod n) | Omega-square (residual correlation) | A system of linear equations for d |
| Short nonce | k < 2^b, where b ≪ 256 | Kolmogorov–Smirnov (truncated distribution) | Direct HNP solution with a small number of signatures |
4.2. Bias Detection Algorithm
The practical procedure for analyzing a nonce sequence includes the following steps:
Input: a set of ECDSA signatures {(rᵢ, sᵢ, H(mᵢ))} extracted from the blockchain
Output: decision on the presence of bias and its parameters
Step 1. Recovering nonce:
For each signature, calculate kᵢ = sᵢ⁻¹ · (H(mᵢ) + rᵢ · d) mod n
(if d is unknown, use statistical estimates)
Step 2. Pre-processing:
- Checking the independence of consecutive nonces (autocorrelation)
- Normalization of values to [0, 1] by dividing by n
Step 3. Applying consent criteria:
- Pearson's χ² with grouping into 256 intervals
- Kolmogorov–Smirnov for the full sample
- Omega-square for detecting distributed displacements
Step 4. P-value analysis:
If the P-value < α (e.g. α = 0.01), hypothesis H₀ is rejected
Step 5. Estimating the bias parameters:
- For zero MSBs: evaluate l as the position of the first non-zero bit
- For affine dependence: regression analysis of pairs (kᵢ, kᵢ₊₁)
Step 6. Forming an input for HNP:
Passing bias parameters to the lattice algorithm (LLL/BKZ)
4.3 Analysis of individual bit positions
For a fine-grained analysis of the nonce distribution, a bitwise testj = 0, 1, ..., 255 is used: a binary sequence is generated for each bit position b_j(i) = (k_i >> j) & 1. A single-interval χ² test (checking for the equality of the number of zeros and ones) is applied to each sequence. The combined results allow us to construct a bias profile for each bit position.
A critical observation: if the bias affects l the most significant or least significant bits, the corresponding bit positions exhibit a statistically significant deviation from uniformity with P-value ≪ 0.01. This allows not only to detect the vulnerability but also to accurately determine its parameters.
5. Private Key Recovery Methodology
5.1 Relationship of goodness-of-fit criteria to the hidden number problem (HNP)
The detected nonce offset is transformed into an instance of the Hidden Number Problem (HNP). If l the high-order bits of the nonce are known to be zero, then for each signature the following is performed:
kᵢ = k’ᵢ, where 0 ≤ k’ᵢ < 2^(256−l)
Substituting the signatures into the equation and excluding kᵢ, we obtain a system of linear inequalities with respect to d:
|sᵢ⁻¹ · (H(mᵢ) + rᵢ · d) mod n| < 2^(256−l)
This system is solved by lattice algorithms (LLL, BKZ) using the Haugrave–Graham–Smart construction [reference:4]. The key input parameter is the bias level l , which is determined by the goodness-of-fit criteria.
5.2. Construction of the lattice
Standard lattice design for HNP with l-bit bias:
Matrix B of size (m+2) × (m+2): [ n 0 ... 0 0 0 ] [ 0 n ... 0 0 0 ] [ ... ... ... ... ... ... ] [ 0 0 ... n 0 0 ] [ t₁ t₂ ... t_m B/n 0 ] [ a₁ a₂ ... a_m 0 B ] Where: tᵢ = rᵢ · sᵢ⁻¹ mod n aᵢ = H(mᵢ) · sᵢ⁻¹ mod n B = 2^(256−l) m is the number of signatures
After LLL reduction, the shortest vector contains information about the private key d. The success of the attack depends on the relationship between l, m and the parameter B: the smaller l, the more signatures are required.
5.3. Estimation of the required number of signatures
Empirical dependencies for secp256k1:
| Offset level (l bit) | Minimum number of signatures | Probability of success | Computational costs |
|---|---|---|---|
| 8 bits (MSB = 0) | ~50–100 | > 95% | Seconds (LLL) |
| 4 bits (MSB = 0) | ~200–400 | > 90% | Minutes (BKZ) |
| 2 bits (MSB = 0) | ~1000–2000 | ~80% | Clock (BKZ-40) |
| 1 bit (MSB = 0) | ~10⁶–10⁷ | ~50% | Days of the week |
Practical limitation: for real blockchain transactions, the number of signatures with the same private key may be limited. In such cases, hybrid methods are used, combining statistical analysis with partial enumeration or the use of additional sources of information leakage.
6. Practical attacks and empirical results
6.1. Research by Breitner and Heninger (2019)
In the paper “Biased Nonce Sense: Lattice Attacks Against Weak ECDSA Signatures in Cryptocurrencies,” the authors analyzed signatures in the Bitcoin, Ethereum, and Ripple blockchains [reference:5]. Using statistical criteria for bias detection and lattice algorithms for solving HNP, they:
- About 300 Bitcoin private keys have been recovered.
- Several classes of biases were found: short nonces, nonces with zero MSBs, and affinely related nonces.
- It took about 40 CPU years of computing time.
The key step was precisely the statistical detection of the bias: without a preliminary analysis of the nonce distribution, the use of lattice algorithms would have been impossible due to the lack of information about the parameter l.
6.2. Attack on PlayStation 3 (2010)
Although this case involves nonce reuse rather than statistical bias, it demonstrates the critical importance of control over generation k. Given two signatures with the same k:
k = (H(m₁) − H(m₂)) / (s₁ − s₂) mod n
After which, the private key is calculated directly. Statistical criteria are not required in this case, but they could have detected the anomaly (perfect correlation between nonces) at an early stage.
6.3. Attack on Upbit (2025)
In 2025, the Upbit exchange suffered an attack that exploited subtle statistical patterns in nonce generation rather than classic reuse. This demonstrates that even seemingly reliable generators can contain statistically detectable biases, as revealed by consensus criteria.
7. Conclusion
A.V. Kuznetsov’s work “Application of Goodness-of-Fit Criteria in Mathematical Modeling of Economic Processes” (1991) provides a systematic framework for testing statistical hypotheses that is directly applicable to ECDSA cryptanalysis. Key findings:
- Goodness-of-fit criteria (Pearson, Kolmogorov–Smirnov, omega-square) allow one to formally test the hypothesis of uniform distribution of nonce and detect statistically significant biases with controlled errors of type I and II.
- The choice of criterion depends on the type of bias: χ² is effective for coarse biases, Kolmogorov–Smirnov for distribution shifts, and omega-square for weak distributed anomalies.
- The detected bias is transformed into a hidden number problem (HNP) , solved by lattice algorithms. The parameter
l(bias level), determined by statistical methods, is a critical input for the lattice. - The practical significance is confirmed by real attacks: Breitner and Heninger recovered hundreds of Bitcoin private keys using statistical nonce drift detection.
- A minimal bias (less than one bit) is sufficient to fully reveal the key given a sufficient number of signatures, making statistical control of the nonce generator critical to the security of blockchain systems.
Thus, the statistical goodness-of-fit criteria outlined in Kuznetsov’s work are not an abstract theoretical tool, but a powerful cryptanalytic tool that allows one to detect vulnerabilities in nonce generators before they are exploited and to recover private keys in real blockchain transactions.
8. Directions for further research for cryptanalysis based on this area
The development of statistical methods for ECDSA cryptanalysis based on goodness-of-fit criteria opens up the following promising directions:
- Adaptive goodness-of-fit tests for nonstationary nonce distributions. Developing tests capable of detecting biases whose parameters change over time (e.g., when updating wallet firmware or changing the entropy source). This requires a shift from classical tests to methods of time series analysis and online anomaly detection.
- Multilevel Bayesian goodness-of-fit tests. Building hierarchical Bayesian models in which the prior distribution of the nonce is estimated based on blockchain signature statistics, and the posterior distribution is refined as new data becomes available. This allows for adaptive selection of the significance level and test power.
- Combined criteria for detecting complex biases. Developing hybrid statistics that combine the strengths of the χ², Kolmogorov–Smirnov, and omega-squared tests to simultaneously detect different types of biases (shift, truncation, affine dependence). This will increase the likelihood of detecting vulnerabilities with limited sample sizes.
- Statistical Analysis of Nonces in Post-Quantum Signature Schemes. As we move toward post-quantum algorithms (e.g., those based on lattices or hash functions), new classes of nonce biases emerge, requiring the adaptation of classical goodness-of-fit criteria to different value spaces and distributions.
- Automated real-time blockchain auditing systems. The creation of distributed monitoring systems that apply consensus criteria to the blockchain signature flow, automatically identifying statistically anomalous transactions and generating alerts for key holders. This requires the development of efficient algorithms for stream processing and visualization of results.
- Theoretical bounds on the power of consensus criteria for HNP. Obtaining strict mathematical bounds on the probability of detecting bias depending on the number of signatures
N, the bias levell, and the chosen criterion. This will allow for a formal assessment of the minimum requirements for security auditing of ECDSA implementations. - Integrating statistical criteria with machine learning methods. Using neural networks and ensemble methods to identify nonlinear relationships between nonces that are undetectable by classic goodness-of-fit criteria. Training on large samples of blockchain signatures will allow for the identification of patterns invisible to traditional statistical tests.
- Cross-blockchain analysis of nonce bias. A comparative study of the statistical properties of nonce generators across various blockchain platforms (Bitcoin, Ethereum, Ripple, Monero) to identify common vulnerabilities and develop universal recommendations for secure generation
k.
These approaches combine the classical apparatus of agreement criteria (including those from Kuznetsov’s work) with modern computational methods, creating the basis for a new generation of cryptanalysis tools capable of countering increasingly complex security threats to blockchain systems. This document is based on the work of A.V. Kuznetsov “Application of Agreement Criteria in Mathematical Modeling of Economic Processes” (Minsk: BGINKh, 1991) and current research in the field of ECDSA cryptanalysis (Breitner, Heninger, 2019; Bleichenbacher, 2000; Howgrave-Graham, Smart, 2001).
