Applying Probability Theory to the ECDSA Private Key Recovery Problem in Bitcoin Transactions

27.10.2026

Textbook:  Nathan A.A., Gorbachev O.G., Guz S.A.  Probability Theory : a textbook. – M.: MZ Press – MIPT, 2007. – 253 p. – ISBN 5-94073-099-X. The textbook by Nathan, Gorbachev and Guz provides a complete apparatus for analyzing ECDSA as a probabilistic scheme. Main conclusions:

Practical significance.  Hundreds of private keys were recovered using real Bitcoin data, confirming the relevance of probability theory for blockchain cryptanalysis.

The nonce’s probabilistic model is critical.  Any deviation  k from a uniform distribution  Z_q creates a statistical vulnerability.

HNP is a central probability problem.  Recovering a private key boils down to estimating a hidden parameter  d from noisy observations, which is classically solved using mathematical statistics.

Two complementary approaches.  Frequentist methods (Bleichenbacher) are robust to noise but require a lot of data; lattice methods are effective for small numbers of signatures but are sensitive to errors.

Content

1. Introduction

The Elliptic Curve Digital Signature Algorithm (ECDSA) underlies the security of Bitcoin transactions. Its security relies on the assumption of uniform randomness of the  nonce  (denoted by  k) generated for each signature.[reference:0] If this nonce deviates from the uniform distribution—becomes short, predictable, or repeats—an attacker can recover the long-term private key.

The purpose of this paper is to demonstrate how the probability theory framework outlined in Nathan, Gorbachev, and Guz’s textbook applies to the analysis and practical use of such deviations. We will consider, in sequence:

  • probabilistic model of  nonce generation ;
  • reducing the key recovery problem to  a hidden number problem  (HNP);
  • two classes of attacks: statistical (frequency) and lattice;
  • Practical results obtained on real Bitcoin blockchain data.

The key idea is  that any statistical bias  k relative to a uniform distribution  Z_q does not reduce the signature’s entropy, and with a sufficient number of observations, it allows the private key to be estimated using probability theory and mathematical statistics.

2. Probabilistic Foundations of ECDSA

2.1. Signature scheme

Let  q be the order of the base point  G of the elliptic curve secp256k1. When signing a message with a hash  , a noncez  is generated  , the point   with the abscissa  is calculated , and the signature is formed: k ∈ Z_qR = kGr = (R)_x mod q

s = k⁻¹ (z + r d) mod q, (1)

where  d is the private key, and  (r, s) is the published signature[reference:1].

2.2. Probabilistic nonce model

In an ideal system  k , is an independent random variable uniformly distributed over  Z_q. However, in practice, deviations are possible:

  • Offset of high bits  –  k generated from a narrowed range (e.g.  k < 2^ℓ from  ℓ < log₂ q).
  • Reuse  – the same one  k in multiple signatures.
  • Partial leakage  – side channels reveal some high or low bits  k[reference:2].

From a probability theory perspective, each of these cases is described by its own distribution. For example, when shifting the most significant bits,  k it can be represented as

k = 2^{n−ℓ} · u + w, (2)

where  u is a random variable with small support (e.g.,  u ∈ {0, …, 2^ℓ − 1}), and  w is “noise” modeling the unknown least significant bits. The task of cryptanalysis is to estimate ,  d based on observations,  (z_i, r_i, s_i) with a known (or assumed) distribution  k_i.

2.3. The role of characteristic functions

The Nathan-Gorbachev-Guz textbook focuses on  characteristic functions  of random variables. For a discrete variable  X ,  Z_q the characteristic function is defined as

φ_X(t) = E[e^{2πi t X / q}] = Σ_{x ∈ Z_q} P(X = x) e^{2πi tx / q}. (3)

The deviation of the distribution  k from uniformity is manifested in the fact that  φ_k(t) ≠ 0 for  t ≠ 0. It is these non-zero Fourier coefficients that underlie the statistical attacks discussed in Section 4.

3. Hidden Number Problem (HNP) as a Probability Problem

3.1. HNP setting

The hidden number problem introduced by Boneh and Venkatesan is formulated as follows. Given:

  • simple  q;
  • unknown  α ∈ Z_q;
  • a set of pairs  (t_i, a_i)where  t_i ∈ Z_q are chosen uniformly and  a_i satisfy

|α − t_i · β_i|_q ≤ B, (4)

where  β_i are known random variables, and  |·|_q denotes the distance modulo  q. It is required to find  α.

3.2. Reduction of ECDSA to HNP

From equation (1) we express  k_i:

k_i = s_i⁻¹ · (z_i + r_i · d) mod q. (5)

If  k_i there is a bias (for example, the most significant bits are known or small), then, rewriting (5) with respect to  d, we obtain:

d ≡ t_i (k_i − w_i) mod q, (6)

where  t_i = r_i⁻¹ · s_i, and  w_i is the unknown “noise” part of  k_i. This is precisely the HNP problem:  d plays the role of  α, and  w_i are limited to a known interval.

Probabilistic interpretation.  Each observation  (z_i, r_i, s_i) yields a single realization of the random variable  k_i. If  k_i are unevenly distributed, then the conditional distribution,  d given known ,  (t_i, w_i) is concentrated around the true value. Probability theory allows one to quantify this concentration through concentration inequalities (Chernoff, Hoeffding) and limit theorems.

3.3. Estimation of the required number of signatures

Let  ε be the magnitude of the bias (for example,  k_i < 2^{n−ℓ}). Then the probability of random guessing  k_i is  2^{−ℓ}. Using Chernoff’s inequality, it can be shown that for recovery  d with probability ,  1 − δ it is required

N ≥ C (n / ε²) log(1/δ) (7)

signatures, where  C is a constant depending on the specific attack algorithm. This formula is a direct consequence of the law of large numbers and the estimate of the rate of convergence of sample means to the mathematical expectation.

4. Statistical (frequency) attacks on ECDSA

4.1 Bleichenbacher Attack Based on Fourier Analysis

Bleichenbacher proposed a key recovery method based on the calculation of the empirical characteristic function  k[reference:3]. The idea is as follows.

From (5) it follows that

d ≡ (k_i · s_i − z_i) · r_i⁻¹ mod q. (8)

If  k_i they are biased, the distribution of the value,  u_i = s_i⁻¹ · (z_i + r_i · d) if correct,  d will be concentrated in a narrow range. For each candidate,  d' an empirical characteristic function can be calculated.

Φ_N(t; d’) = (1/N) · Σ_{i=1}^{N} e^{2πi t · u_i(d’) / q}. (9)

True  d maximizes  |Φ_N(t; d')| for some  t ≠ 0. Finding the maximum reduces to the list sum problem, which is solved using the fast Fourier transform and Wagner-type algorithms.

Probabilistic essence.  Bleichenbacher’s method is essentially a statistical hypothesis test: for each,  d' the hypothesis is tested  H₀: d' = d against  H₁: d' ≠ d. The power of the test is determined by the magnitude of the non-zero Fourier coefficients of the distribution  k.

4.2. Error tolerance

An important advantage of frequency-domain methods is their robustness to noise. As shown in [10], even with a bit error probability  k of about 0.1, the Bleichenbacher method recovers the key for 128-bit curves. This is explained by the fact that the characteristic function “smooths out” independent errors: if the errors are symmetrical, their contribution to  Φ_N(t) the average is reduced, while the signal from the true value  d is preserved.

5. Lattice attacks as problems in probability theory

5.1. Construction of the lattice

The lattice approach to HNP is based on constructing a lattice containing a short vector corresponding to  (d, k_1, …, k_N). A typical construction is:

B = ⎡ q 0 … 0 ⎤ ⎢ 0 q … 0 ⎥ ⎢ ⋮ ⋮ ⋱ ⋮ ⎥ ⎢ 0 0 … q ⎥ ⎣ t_1 t_2 … t_N ⎦ (10)

where  t_i = r_i · s_i⁻¹ mod q, and the last row is scaled. The desired vector has the form  (k_1, …, k_N, d/q · B) and is “short” in this lattice, since  k_i are small (shifted).

5.2 Probability Analysis of Success

The success of a lattice attack depends on how short the target vector is compared to typical lattice vectors. Let  λ₁ be the length of the shortest lattice vector. Then the probability of success can be estimated as

P_success ≈ P(‖v_target‖ < λ₁ / γ), (11)

where  γ is the approximation coefficient achieved by the LLL/BKZ algorithm. In terms of probability theory, this is the probability that a random vector from the “background” distribution will be longer than the target one.

In the work [6] the existence of a constant  c > 0that gives a lower bound for the probability of success was proven:

P_success ≥ c exp(−C N ε² / n), (12)

where  ε is the relative bias,  N and is the number of signatures. This Chernoff-type inequality shows that the error probability decreases exponentially with increasing  N.

5.3 Lattices with predicates

Modern improvements to lattice attacks use  predicates  —probabilistic conditions on candidates that allow us to filter out obviously false vectors before costly sifting [reference:4]. The predicate is formulated as

P(k_i ∈ S | d’) > θ, (13)

where  S is a subset of acceptable values, and  θ is the threshold. The probabilistic nature of the predicate allows it to be applied to noisy data, significantly expanding the class of attacks.

6. Practical application to the Bitcoin blockchain

6.1 Blockchain data

The Bitcoin blockchain provides an ideal testing ground for the described methods: all signatures  (r, s) and message hashes  z are publicly available. A study [8] analyzed about 100  2³⁰ signatures and identified several classes of vulnerabilities:

Vulnerability classDescriptionNumber of compromised keys
Short noncesk < 2^ℓ, ℓ < n~150
Common prefixThe most significant bits  k match~100
Common suffixThe least significant bits  k match~50
ReuseThe same  k in two signaturesSet

6.2. Example of key recovery

Let’s consider the simplest case: two signatures with the same  k. From (1) for two messages  z₁ and  z₂ we have:

s₁ = k⁻¹(z₁ + r · d) mod q, s₂ = k⁻¹(z₂ + r · d) mod q.

Subtracting, we get

k = (z₁ − z₂) · (s₁ − s₂)⁻¹ mod q. (14)

After calculation,  k the private key is found from (1):

d = (s₁ · k − z₁) · r⁻¹ mod q. (15)

Probabilistic interpretation.  Reuse  k is a degenerate case where the distribution  k has a single point mass. The probability of such an event with a perfect generator is negligible ( q⁻¹), but implementation errors (e.g., a deterministic generator without a counter) make it quite possible [reference:5].

6.3. Offset of the least significant bits

A more subtle case is when  k the bias is only in the least significant bits. For example, if a random number generator returns  k = k_high · 2^m + w, where  w α is small, then this provides information about α  d through the least significant bits  d. The attack described in [10] shows that 1 bit of leakage is sufficient to recover the key of a 131-bit curve, while the number of required signatures is halved compared to the case without leakage.

7. Conclusion

The textbook by Nathan, Gorbachev, and Guz provides a complete framework for analyzing ECDSA as a probabilistic scheme. Key findings:

  1. The nonce’s probabilistic model is critical.  Any deviation  k from a uniform distribution  Z_q creates a statistical vulnerability.
  2. HNP is a central probability problem.  Recovering a private key boils down to estimating a hidden parameter  d from noisy observations, which is classically solved using mathematical statistics.
  3. Two complementary approaches.  Frequentist methods (Bleichenbacher) are robust to noise but require a lot of data; lattice methods are effective for small numbers of signatures but are sensitive to errors.
  4. Practical significance.  Hundreds of private keys were recovered using real Bitcoin data, confirming the relevance of probability theory for blockchain cryptanalysis.

8. Directions for further research for cryptanalysis based on this area

  1. Adaptive statistical tests.  Development of sequential likelihood ratio tests for real-time online signature monitoring, enabling the detection of bias  k before a critical mass of data is accumulated.
  2. Bayesian estimation methods  d.  Constructing a posterior distribution for a private key, taking into account prior knowledge about the random number generator. The Bayesian approach can yield more accurate interval estimates and reduce the requirement for the number of signatures.
  3. Accounting for correlations between  k_i.  In real-world implementations,  nonces  may be weakly correlated (for example, when using a PRNG with a linear recurrence). Modeling such correlations through multivariate characteristic functions opens up new attack surfaces.
  4. Limit theorems for HNP with errors.  Proof of functional limit theorems for estimation  d under unknown error distributions. This will enable robust attacks that do not require precise knowledge of the noise model.
  5. Application of large deviation theory.  Estimating the probability of attack success for small  ε (ultra-weak) biases using large deviation theory methods (Cramer, Chernov). This will provide precise asymptotic bounds on the number of required signatures.
  6. Cross-blockchain analysis.  Extending probabilistic methods to other cryptocurrencies (Ethereum, Ripple) and comparing distributions  k across different ecosystems will help identify systemic errors in  nonce generation libraries .
  7. Quantum-resistant modifications.  Investigation of how probabilistic attacks on ECDSA change when transitioning to post-quantum signature schemes (e.g., lattice-based). Probability theory may play a key role in analyzing their security.

Bottom line.  Probability theory is not an abstract tool, but a cryptanalyst’s working tool. Nathan, Gorbachev, and Guz’s textbook provides the necessary foundation: from axiomatics and characteristic functions to limit theorems and statistical estimates. It is this knowledge that allows one to move from blockchain observations to recovering secret keys.


This document is based on an analysis of open sources on ECDSA cryptanalysis, including [6–11, 14–16]. The formulas and estimates provided are illustrative and intended to demonstrate the applicability of probabilistic methods. Practical use of the described attacks without the consent of the key owner is a violation of the law.