What’s a Digital Signature?
Alice wants to send a message to Bob. But how does Bob know it’s really from Alice?
A digital signature proves two things:
- The message came from Alice (not an imposter)
- The message wasn’t tampered with
Bitcoin and Ethereum use ECDSA to sign every transaction.
The Setup
Alice has her ECC key pair:
- Private key: (a secret number only she knows)
- Public key: (a point everyone can see)
She wants to sign a message so anyone can verify it came from her.
How Signing Works
Alice has a message. Here’s what she does:
1. Hash the message
Any message becomes a fixed-size number . This is the message’s fingerprint.
2. Pick a random number
This is a one-time secret. It must be random and never reused.
3. Compute
Multiply: (a point on the curve)
Take just the x-coordinate: = x-coordinate of
4. Compute
This mixes together the message hash (), her private key (), and the random value ().
5. The signature is
Two numbers. Alice sends these along with her message.
How Verification Works
Bob receives the message and signature . He also knows Alice’s public key .
1. Hash the message
Bob computes the same hash from the message.
2. Compute a check point
Using only public information:
3. Compare x-coordinates
If the x-coordinate of equals , the signature is valid.
Bob never needed Alice’s private key. He verified using only public information.
Why Only Alice Can Sign
The signature formula uses Alice’s private key :
To forge a signature, an attacker would need to find from .
That’s ECDLP. Practically impossible.
The Random is Critical
If Alice ever uses the same for two different messages, an attacker can compute her private key.
In 2010, Sony’s PlayStation 3 signing key was stolen because they used the same every time.
The random number must be truly random and never repeated.