Jan 12, 2026

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:

SchemeSignature shape
ECDSA(r, s)
Ed25519 / EdDSA(R, S)
Schnorr(R, s)
BLSUsually 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:

  1. the long-term private key
  2. 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
SchemeLong-term private keyPer-signature secret value
ECDSARandom scalar dFresh unpredictable nonce k is required for every signature
Ed25519 / EdDSARandom 32-byte seedDeterministic nonce r, derived from private key material and the message
SchnorrRandom scalar dA nonce scalar k; it may be random or deterministically derived, but it must not repeat
BLSRandom scalar skNo 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.

Formula reference

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.

Privatesecret scalars, seeds, and signing keys
Publiccurve generators, public keys, and published points
Message / hashmessage bytes, digests, and challenges
Nonceone-time signing randomness and nonce points
Signaturesignature scalars or signature points
Derived secretshared/session values derived from secrets
Verificationpublic equality checks
ECDH context

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.

Button formulas

ECDH context / shared-secret setup

1public keys
A = aG; B = bG

Private scalars stay local. Public curve points can be sent over the network.

2shared point
S = (x_k, y_k) = aB = bA = abG

Both parties reach the same hidden point. ECDH normally uses x_k, the x-coordinate, as the raw shared secret.

3bind message
h = SHA-256(message); K = KDF(x_k) or demo SHA-256(x_k || message)

Standard ECDH feeds x_k into a KDF. This demo also folds in the message so message changes are visible.

4verify
aB == bA

ECDH verification here means both sides produced the same shared point, so they also have the same x_k.

Button formulas

ECDSA signature

1public key
Q = dG; z = H(message)

d is the long-term private key. Q is the public verification key.

2fresh nonce
R = kG; r = x(R) mod n

ECDSA needs a fresh unpredictable k for every signature. Reusing k can expose d.

3sign
s = k^-1(z + rd) mod n

The signature is (r, s). It depends on the private key, message hash, and one-time nonce.

4verify
verify (r, s) using Q, z, and curve arithmetic

The verifier uses public data only, but the signer must protect both d and each k.

Button formulas

Ed25519 / EdDSA signature

1expand seed
SHA-512(seed) -> a, prefix

The seed expands into a clamped private scalar and a private prefix for nonce derivation.

2public key
A = aB

B is the fixed Ed25519 / EdDSA base point. A is the public verification key.

3sign
r = H(prefix || m); R = rB; k = H(R || A || m); S = r + ka

The signature is R || S and is tied to both the private scalar and the exact message.

4verify
S*B == R + k*A

The verifier recomputes k from public data and checks the public point equation.

Button formulas

Schnorr signature

1public key
P = dG; z = SHA-256(message)

d is the private signing key. P and the message digest z are public verification inputs.

2nonce point
R = kG

The nonce scalar k must stay secret. Reusing it can reveal the private key.

3sign
e = H(R || P || z); s = k + ed

The signature is R plus s. The challenge binds the nonce point, public key, and message hash.

4verify
sG == R + eP

Schnorr verification is a direct public linear equation.

Button formulas

BLS pairing signature

1keys + hash
PK = skQ; H(m) in G1

The real scheme hashes the message to a curve point. This demo uses a tiny scalar model.

2sign
sigma = sk * H(m)

The signature is the message point scaled by the private key.

3pair
e(sigma, Q) and e(H(m), PK)

The verifier maps both sides into the pairing target group.

4verify
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:

StageInputOutputWorld
RNGEntropyRandom integerRandom bits
Private keyRandom integerScalarFinite field
Public keyScalar + GElliptic-curve pointElliptic-curve group
HashMessageFixed-size digestHash function output
SignaturePrivate key + hashSignatureSignature algorithm
VerificationPublic key + message + signatureValid or invalidPublic 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.

SchemeCore intuition
ECDSAUses a nonce point and modular arithmetic so the verifier can recover/check r.
SchnorrUses the cleaner linear equation sG = R + eP.
Ed25519 / EdDSAAn EdDSA scheme with deterministic nonce derivation from the seed and message.
BLSUses 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.


Thanks for reading! If you want to see future content, you can follow me on Twitter or get connected over at LinkedIn.


Support My Content

If you find my content helpful, consider supporting a humanitarian cause (building homes for elderly people in rural Terai region of Nepal) that I am planning with your donation:

Ethereum (ETH)

0xB62409A5B227D2aE7D8C66fdaA5EEf4eB4E37959

Thank you for your support!