Application of the field “Solving problems of mathematical statistics on a personal computer” (Svirid, Makarenko, Shevchenko, 1996) to the cryptanalysis of ECDSA in Bitcoin transactions

27.10.2026

Abstract.  This paper examines the feasibility of using classical mathematical statistics methods, systematized in the textbook by G. P. Svirid, Ya. S. Makarenko, and L. I. Shevchenko, to conduct a cryptanalytic attack on the ECDSA scheme used in the Bitcoin blockchain. It demonstrates how statistical hypothesis testing, distribution parameter estimation, and correlation analysis can detect bias in the generation of a hidden number (nonce)  k. Based on the detected bias, a lattice attack (Hidden Number Problem) is constructed using the LLL algorithm, ultimately enabling the recovery of a long-term private signature key. Practical steps are presented, including collecting data from the blockchain, preprocessing, statistical tests, and lattice construction. The “Solving Mathematical Statistics Problems on a Personal Computer” (Svirid, Makarenko, Shevchenko, 1996) is not just a textbook, but a comprehensive methodological foundation for the cryptanalyst. Methods of hypothesis testing, parameter estimation, and correlation analysis allow:

  1. Detect statistical anomalies in ECDSA nonce generation that are not visible by simple visual inspection of the signatures.
  2. Quantify the magnitude of the displacement, which is critical for selecting lattice parameters.
  3. Justify the sufficiency of the collected data for a successful attack.
  4. Construct an efficient lattice attack (HNP) using the LLL algorithm.

Thus, the classical mathematical statistics presented in this textbook remains a relevant and powerful tool in the arsenal of a modern cryptanalyst working with blockchain data.

1. Introduction

The ECDSA (Elliptic Curve Digital Signature Algorithm) scheme underlies Bitcoin transaction signing. A critical security parameter is  the nonce  —a secret number  kthat must be uniformly random and used only once per signature. Violating this requirement—through reuse, low entropy, or statistical bias—leads to the leakage of private key information  d.

Over the past few years, researchers have repeatedly demonstrated the mass recovery of private keys from public blockchains by analyzing nonce anomalies. Specifically, in the paper “Biased Nonce Sense,” the authors calculated hundreds of Bitcoin private keys using lattice algorithms to solve the hidden number problem (HNP) on signatures with biased nonces.[reference:0] Similar results were obtained by analyzing nonce reuse: in one paper alone, 3,620 private keys were recovered across multiple blockchains.[reference:1]

However, detecting nonce bias itself is a statistical problem. This is where the bridge between classical mathematical statistics and cryptanalysis emerges. The textbook by Svirid, Makarenko, and Shevchenko (1996) provides a systematic presentation of methods that can be directly applied to identifying statistical patterns in nonce sequences extracted from transactions.

2. Brief description of the field “Solving problems of mathematical statistics on a personal computer”

This manual focuses on the practical application of statistical methods using personal computers. Typically, such manuals include the following sections, each of which has direct application in ECDSA cryptanalysis:

Statistics sectionApplication to ECDSA nonce analysis
Descriptive statistics (sample mean, variance, moments)Primary characterization of the distribution of recovered or estimated nonces; detection of deviations from a uniform distribution.
Testing statistical hypotheses (χ², Kolmogorov–Smirnov goodness-of-fit tests)Formal test of the nonce uniformity hypothesis. Deviation from uniformity indicates vulnerability.
Estimation of distribution parameters (method of moments, maximum likelihood)An estimate of the amount of bias (e.g., bias of the high-order bits of the nonce) if the nonce distribution is not uniform.
Correlation and regression analysisFinding linear relationships between nonce and publicly available signature parameters (message hash,  r,  s), which may reveal a leak.
Time series analysisDetection of periodicity or trends in the nonce sequence, which is typical of poor quality random number generators.
Statistical modeling (Monte Carlo method)Estimating the probability of an attack’s success given the bias level and the number of signatures.

Thus, the book provides a complete toolkit for moving from raw blockchain data to a statistically sound conclusion about the presence of a vulnerability.

3. Theoretical Foundations of ECDSA Vulnerability

3.1 Signature Equation

For each ECDSA signature, the following relations hold:

s = k −1  (z + r d) mod n,

where  z is the message hash,  r is the x-coordinate of the point  k·G,  n is the order of the base point,  d is the private key. From here:

k = s −1  (z + r d) mod n.

If nonce  k is known at least partially, the equation can be transformed into a linear equation with respect to  d.

3.2 Hidden Number Problem (HNP)

Let  m the signatures be approximated   to   with an error bounded in absolute value by some  . Then the problem reduces to HNP: find   such thataikiBd

| (a i  − s i −1  z i ) · (s i −1  r i ) −1  − d | n  ≤ B / |s i −1  r i | n .

This problem is effectively solved by lattice-based methods, in particular the LLL (Lenstra–Lenstra–Lovász) algorithm [reference:2]. The key to success is knowledge of the magnitude and nature of the nonce bias.

3.3 Statistical Attacks (Bleichenbacher’s Approach)

An alternative to lattice methods is a statistical attack proposed by Bleichenbacher, based on Fourier analysis. It allows key recovery even with very small offsets, but requires a large number of signatures [reference:3]. Both approaches (lattice and statistical) complement each other, and the choice between them depends on the amount of available data and computing resources.

4. Practical application of statistical methods from the manual

4.1. Data collection and preprocessing

The first step is to extract all ECDSA signatures from the Bitcoin blockchain. For each transaction, the values  r​​,  s and the message hash  are available z. The nonce  k is unknown, but it can be indirectly estimated if the random number generator is known to be flawed (for example, the high-order bits are always zero). Otherwise, statistical recovery methods are used.

With tools like  ecdsa-break, it is possible to automate the collection of signatures and their initial filtering[reference:4].

4.2 Testing the hypothesis of uniformity of nonce

Using the χ² (chi-square) goodness-of-fit test, we test the hypothesis  that nonces are uniformly distributed over the interval  . To do this, we divide the range into   intervals and compare the observed frequencies with the expected ones. If   the observed frequencies are below the significance level (e.g., 0.01), the hypothesis is rejected, indicating bias.H0[0, n−1]Mp-value

Similarly, the Kolmogorov–Smirnov test is used to compare the empirical distribution function of nonce with the uniform one.

4.3. Estimation of bias parameters

If the nonce distribution deviates from uniform, it is necessary to estimate the parameters of this deviation. For example, if it is known that the high-order  b bits of the nonce are always zero, then the effective length of the nonce is reduced to  n − b bits. The maximum likelihood method allows us to estimate the bounds of possible nonce values.

In more complex cases, where the bias is probabilistic, the method of moments is used to estimate the mean and variance of the nonce distribution.

4.4 Correlation analysis

We calculate the Pearson correlation coefficient between the estimated nonce values ​​and the publicly available parameters:  z,  r,  s, and their combinations. The presence of a significant correlation may indicate a linear relationship that can be used to construct a grid.

4.5. Lattice construction and key recovery

Once statistical analysis has confirmed the presence of bias and estimated its magnitude, we proceed to constructing the lattice.  m A lattice basis of dimension is formed for the signatures  m + 1:

L = { (k 1  − a 1 , …, k m  − a m , d / B) : k i  ∈ ℤ, d ∈ ℤ }.

The LLL algorithm is then used to find a short vector containing  d. In practice, a combination of LLL and BKZ is often used to improve efficiency [reference:5].

An example implementation in Python using the library  fpylll might look like this:

from fpylll import IntegerMatrix, LLL
import numpy as np

def build_lattice(signatures, bias_bits):
    """
    signatures: список кортежей (r, s, z)
    bias_bits: количество известных нулевых старших битов nonce
    """
    m = len(signatures)
    n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141  # порядок secp256k1
    B = 2 ** (256 - bias_bits)  # граница ошибки
    # Построение матрицы (m+1)x(m+1)
    M = IntegerMatrix(m + 1, m + 1)
    for i in range(m):
        r, s, z = signatures[i]
        inv_s = pow(s, -1, n)
        M[i, i] = n
        M[m, i] = (inv_s * r) % n
    M[m, m] = B
    return M

# Применение LLL
M = build_lattice(sigs, bias_bits=4)
LLL.reduction(M)
# Анализ коротких векторов для извлечения d

After reduction, one of the vectors will contain the value  d / B, which allows us to recover the private key.

5. Conclusion

The “Solving Mathematical Statistics Problems on a Personal Computer” (Svirid, Makarenko, Shevchenko, 1996) is not just a textbook, but a comprehensive methodological foundation for the cryptanalyst. Methods of hypothesis testing, parameter estimation, and correlation analysis allow:

  1. Detect statistical anomalies in ECDSA nonce generation that are not visible by simple visual inspection of the signatures.
  2. Quantify the magnitude of the displacement, which is critical for selecting lattice parameters.
  3. Justify the sufficiency of the collected data for a successful attack.
  4. Construct an efficient lattice attack (HNP) using the LLL algorithm.

Thus, the classical mathematical statistics presented in this textbook remains a relevant and powerful tool in the arsenal of a modern cryptanalyst working with blockchain data.

Directions for further research for cryptanalysis based on this area

  1. Adaptive statistical tests for streaming blockchain analysis.  Developing methods to analyze new transactions in real time and automatically identify signatures with anomalous nonces using sequential likelihood ratio tests.
  2. Application of Bayesian bias estimation methods.  Using prior distributions for nonces and Bayesian inference can improve estimation accuracy for small samples.
  3. Multivariate statistical analysis.  Application of principal component analysis (PCA) and factor analysis to identify hidden relationships between nonce and signature parameters.
  4. Machine learning for nonce bit prediction.  Training models (e.g., gradient boosting or neural networks) on historical data to predict the next nonce bits and subsequently recover the key.
  5. Hybrid statistical-lattice attacks.  Combining statistical bias estimates with lattice methods to reduce the number of signatures and computational costs.
  6. Nonce time series analysis.  Investigation of autocorrelation functions and spectral characteristics of nonce sequences to detect periodicity caused by poor-quality RNGs.
  7. Extension to other cryptocurrencies and protocols.  Application of the developed statistical methods to ECDSA in Ethereum, Ripple, as well as to Schnorr and EdDSA schemes.
  8. Developing security measures based on statistical monitoring.  Creating systems that check generated nonces in real time for uniform distribution and block signatures if anomalies are detected.

List of sources

  1. Svirid G. P., Makarenko Ya. S., Shevchenko L. I. Solving problems of mathematical statistics on a PC. – Mn.: Higher. school, 1996.
  2. Breitner J., Heninger N. Biased Nonce Sense: Lattice Attacks against Weak ECDSA Signatures in Cryptocurrencies. IACR ePrint, 2019. URL: https://eprint.iacr.org/2019/023.pdf[reference:6].
  3. Bleichenbacher, D. A Fourier Analysis-Based Attack on DSA. Reviewed in: Bias from Uniform Nonce: Revised Fourier Analysis-Based Attack on ECDSA. SAC 2024 [reference: 7].
  4. A Study of ECDSA Vulnerabilities Using LLL on Bitcoin Curves. IEEE Xplore, 2023[reference:8].
  5. Nonce reuse in blockchains: Analysis and recovery of 3620 keys. ORBi, 2024[reference:9].
  6. A tool  ecdsa-break for recovering keys via HNP and LLL. PyPI, 2026[reference:10].