SysTutorials

ECDSA: The Elliptic Curve Digital Signature Algorithm

ECDSA is the elliptic-curve variant of the Digital Signature Algorithm, standardized in FIPS 186-5 and SEC 1. It is the workhorse signature of Bitcoin and Ethereum (both use the secp256k1 curve), and of TLS certificates worldwide (mostly P-256). It is also the signature type with the most operational failure stories, and one of the classical algorithms on NIST’s post-quantum deprecation schedule.

How it works

The private key is a scalar d; the public key is the curve point Q = dG, where G is the curve’s base point. To sign a message hash h:

  1. Pick a secret, unpredictable nonce k
  2. Compute r = (kG).x mod n (n is the curve order); reject r = 0
  3. Compute s = k⁻¹(h + r·d) mod n; reject s = 0

The signature is the pair (r, s), 64 bytes for a 256-bit curve. Verification recomputes a point from Q, G, r, and s and checks its x-coordinate equals r.

The nonce is the danger

If the nonce k is reused across two messages, simple algebra recovers the private key; if it is merely biased across many signatures, lattice attacks do the same. This is not hypothetical:

The modern mitigation is RFC 6979 deterministic nonces, which derive k from the key and message hash, eliminating randomness failures. Ed25519 builds determinism into the scheme itself.

Sizes and malleability

A secp256k1 signature is 64 bytes (two 32-byte scalars), and the compressed public key is 33 bytes. The raw scheme is malleable: (r, s) and (r, n−s) are both valid signatures for the same message, which let third parties mutate Bitcoin transaction IDs until Bitcoin Core adopted the low-s rule, first proposed in BIP 62, as a relay policy in 2015 (SegWit later took signatures out of the transaction ID entirely).

The post-quantum clock

ECDSA’s security rests on the elliptic-curve discrete logarithm problem, which Shor’s algorithm solves on a sufficiently large quantum computer. NIST plans to deprecate ECDSA by 2030 and disallow it by 2035. Its replacements are the lattice and hash-based schemes: ML-DSA, FN-DSA (Falcon), and SLH-DSA (SPHINCS+). For blockchains, the migration path runs through new address types and signature agility rather than in-place replacement.

← All posts