Crypto Signatures
To understand ECDSA, pairings, Diffie-Hellman, and Bitcoin key generation, it helps to connect the whole pipeline from random number to public verification.
Random Number Generator
|
v
Private Key
|
v
Public Key
|
v
Hash Function
|
v
Digital Signature
Think of this as a manufacturing pipeline.
Open the interactive signature playground
1. Random Number Generator
The purpose of the random number generator is to create something nobody else can guess.
Input:
nothing
Output:
a = 0x93F...A82
This is just a huge random integer.
For secp256k1, the curve used by Bitcoin and Ethereum account keys:
1 <= a < n
where:
n is about 2^256
This number is your entire identity.
If someone knows it, they own your wallet. Nothing cryptographic has happened yet. It is simply random bits becoming a private key:
Random bits
|
v
Private Key
2. Private Key
Now we give that random number meaning.
Suppose:
a = 713928391...
This is simply a scalar.
Nothing more.
You already know scalars from pairings:
Scalar world:
3
17
245
a
b
The private key lives entirely in this scalar world.
3. Public Key
Now elliptic-curve math begins.
Take the generator point:
G
Everyone on Earth knows G.
Then compute:
A = aG
This is scalar multiplication.
Private key
a
|
v
Public key
A = aG
Notice the input and output changed worlds:
Input:
scalar + generator point
Output:
elliptic-curve point
This is a one-way function.
Easy:
a -> aG
Hard:
aG -> ?
Finding a from aG is the discrete logarithm problem.
Why not publish the private key?
Because a lets anyone compute signatures.
Instead we publish:
A = aG
That public key is useful, but it does not reveal a.
ECDH Context: Shared Secret, No Signature
ECDH uses the same scalar-multiplication move:
public key = aG
But the goal is key agreement, not signing.
Alice computes: a(bG)
Bob computes: b(aG)
Both get: abG
More precisely, both sides compute the same elliptic-curve point:
(x_k, y_k) = a(bG) = b(aG)
In ECDH, the raw shared secret is usually the x-coordinate:
shared secret = x_k
Most standardized ECDH protocols do not use x_k directly as an encryption
key. They feed x_k into a hash-based key derivation function:
symmetric key = KDF(x_k, context)
ECDH has no signature and no signature verification equation. It is useful here as context because it shows the same private-scalar to public-point transition that signature schemes build on.
4. Hash Function
Now suppose you want to sign:
I will send 5 BTC.
You do not sign the text directly. Instead:
Message
|
v
Hash Function
|
v
32-byte digest
Example:
"I love Bitcoin"
|
v
9FA3C281...
A small message change gives a completely different output:
Hello -> A91C...
Hello! -> FF28...
Why hash?
Instead of signing a 100 KB message, you always sign a fixed-size digest, often 32 bytes. That is faster, simpler, and gives the signature algorithm a stable input size.
5. Digital Signature
Now combine the private key with the message hash to produce a signature.
Private Key
|
|
Hash(message)
|
v
Signature
Different signature systems package the result differently:
| Scheme | Signature shape |
|---|---|
| ECDSA | (r, s) |
| Ed25519 / EdDSA | (R, S) |
| Schnorr | (R, s) |
| BLS | Usually one group element, often written signature or sigma |
The important point:
signature depends on:
1. your private key
2. this particular message hash
If either changes, the signature changes.
Long-Term Keys And Per-Signature Secrets
There are two separate ideas that are easy to blur together:
- the long-term private key
- the per-signature secret value
Most signature systems need random material when the key is created. Some also need fresh randomness every time a signature is made.
That sentence separates two different moments where randomness may be needed:
Key creation randomness:
used once to make your long-term private key
Signing randomness:
used fresh for each signature, depending on the scheme
| Scheme | Long-term private key | Per-signature secret value |
|---|---|---|
| ECDSA | Random scalar d | Fresh unpredictable nonce k is required for every signature |
| Ed25519 / EdDSA | Random 32-byte seed | Deterministic nonce r, derived from private key material and the message |
| Schnorr | Random scalar d | A nonce scalar k; it may be random or deterministically derived, but it must not repeat |
| BLS | Random scalar sk | No nonce in the basic signing equation |
ECDSA
ECDSA has two separate secret values involved in signing:
ECDSA starts with one random private key:
d
Then every signature needs a fresh secret nonce:
k
Roughly:
R = kG
r = x(R) mod n
s = k^-1(z + r*d) mod n
So ECDSA has two secrets involved in signing:
d = permanent private key
k = one-time signing nonce
If the same k is reused for two ECDSA signatures, the private key d can
usually be recovered.
Ed25519 / EdDSA
Ed25519 is an EdDSA signature scheme. It also has a nonce-like scalar, but it does not ask the random number generator for that scalar during every signature. It starts with one random seed, hashes it, and derives:
a = signing scalar
prefix = secret nonce prefix
For each message M, Ed25519 / EdDSA derives:
r = H(prefix || M) mod L
Then:
R = rB
S = r + H(R || A || M) * a mod L
So Ed25519 / EdDSA does not eliminate the second scalar. It eliminates the need to rely on fresh signing randomness for every message.
That is why the interactive page gives Schnorr a manual nonce input, but does not give Ed25519 / EdDSA a manual nonce input. In the Ed25519 / EdDSA card, the nonce is derived from the seed and message. In the Schnorr card, the nonce is exposed so you can see the moving parts directly. Reusing a Schnorr or ECDSA-style nonce with the same private key is dangerous.
Formula Map
The same pipeline becomes easier to follow when each variable type has a consistent color. The reference below uses one color for private material, another for public data, another for message/hash inputs, and separate colors for nonces, signatures, derived secrets, and verification equations. ECDH is shown first as shared-secret context; the side-by-side signature comparison is ECDSA, Ed25519 / EdDSA, Schnorr, and BLS.
Color-coded formulas for each protocol step.
The colors separate private signing material, public verification data, message/hash inputs, nonce material, signatures, derived secrets, and public verification checks.
Shared secret, no signature.
ECDH computes a shared point and derives key material from its x-coordinate. It is shown as context for the scalar-to-point move, not as a signature scheme.
ECDH context / shared-secret setup
A = aG; B = bGPrivate scalars stay local. Public curve points can be sent over the network.
S = (x_k, y_k) = aB = bA = abGBoth parties reach the same hidden point. ECDH normally uses x_k, the x-coordinate, as the raw shared secret.
= SHA-256(); K = KDF(x_k) or demo SHA-256(x_k || )Standard ECDH feeds x_k into a KDF. This demo also folds in the message so message changes are visible.
aB == bAECDH verification here means both sides produced the same shared point, so they also have the same x_k.
ECDSA signature
Q = dG; = H()d is the long-term private key. Q is the public verification key.
R = kG; r = x(R) mod nECDSA needs a fresh unpredictable k for every signature. Reusing k can expose d.
s = k^-1( + rd) mod nThe signature is (r, s). It depends on the private key, message hash, and one-time nonce.
verify (r, s) using Q, z, and curve arithmeticThe verifier uses public data only, but the signer must protect both d and each k.
Ed25519 / EdDSA signature
SHA-512(seed) -> a, prefixThe seed expands into a clamped private scalar and a private prefix for nonce derivation.
A = aBB is the fixed Ed25519 / EdDSA base point. A is the public verification key.
r = H(prefix || ); R = rB; = H(R || A || ); S = r + aThe signature is R || S and is tied to both the private scalar and the exact message.
S*B == R + k*AThe verifier recomputes k from public data and checks the public point equation.
Schnorr signature
P = dG; = SHA-256()d is the private signing key. P and the message digest z are public verification inputs.
R = kGThe nonce scalar k must stay secret. Reusing it can reveal the private key.
= H(R || P || ); s = k + dThe signature is R plus s. The challenge binds the nonce point, public key, and message hash.
sG == R + ePSchnorr verification is a direct public linear equation.
BLS pairing signature
PK = skQ; in G1The real scheme hashes the message to a curve point. This demo uses a tiny scalar model.
sigma = sk * The signature is the message point scaled by the private key.
e(sigma, Q) and e(, PK)The verifier maps both sides into the pairing target group.
e(sigma, Q) == e(H(m), PK)Both pairings hide the same product: sk times the message hash point.
Verification
Someone else has:
Public Key
Message
Signature
They compute:
Hash(message)
Then they verify:
Public Key
+
Hash(message)
+
Signature
|
v
Valid?
The verifier never needs the private key.
Putting It Together
Here is the complete flow:
Random Number Generator
|
v
Private Key (scalar)
|
scalar multiplication
|
v
Public Key = aG
|
-----------------------------
| |
| |
Message Public Key
| |
v |
Hash(message) |
| |
+------> Sign using a <-----+
|
v
Digital Signature
|
Send:
Message
Signature
Public Key
Think of each stage as changing worlds:
| Stage | Input | Output | World |
|---|---|---|---|
| RNG | Entropy | Random integer | Random bits |
| Private key | Random integer | Scalar | Finite field |
| Public key | Scalar + G | Elliptic-curve point | Elliptic-curve group |
| Hash | Message | Fixed-size digest | Hash function output |
| Signature | Private key + hash | Signature | Signature algorithm |
| Verification | Public key + message + signature | Valid or invalid | Public verification |
Bitcoin And Ethereum
This pipeline is exactly what happens in Bitcoin and Ethereum:
Random bits
|
v
Private key (a)
|
v
Public key (A = aG)
|
v
Address derived from the public key
|
v
Create transaction
|
v
Hash transaction
|
v
Sign hash with private key
|
v
Broadcast
|
v
Everyone verifies using the public key
That is the complete lifecycle from generating your cryptographic identity to authorizing a transaction.
Where The Schemes Differ
ECDSA, Schnorr, Ed25519 / EdDSA, and BLS all fit the same broad pipeline, but they use different internal equations.
| Scheme | Core intuition |
|---|---|
| ECDSA | Uses a nonce point and modular arithmetic so the verifier can recover/check r. |
| Schnorr | Uses the cleaner linear equation sG = R + eP. |
| Ed25519 / EdDSA | An EdDSA scheme with deterministic nonce derivation from the seed and message. |
| BLS | Uses pairings so verification checks e(signature, Q) == e(H(message), public_key). |
Pairings add another world. They let a verifier compare hidden scalar products through a target-group equation:
e(aP, bQ) = e(P, Q)^(a*b)
That is why BLS signatures can verify with a pairing equation:
e(signature, Q) == e(H(message), public_key)
Once this pipeline is second nature, the next layer is understanding how ECDSA, Schnorr, Ed25519 / EdDSA, and BLS internally transform the private key and message hash into a signature, and why each scheme does it differently.