Chapter V · digital signatures
Creating and verifying signatures
You can use a signature to prove that a private key authorized one exact message without revealing the key.
The public-key relationship used by signatures
You already know the key relationship:
Anyone can see Q, but production parameters make recovering k infeasible. Signatures use this same relationship.
Create a signature for one message
Let's build a simplified Schnorr-shaped signature to see the core EdDSA relationship:
The signer creates a one-message secret r and its public point R = rG.
A hash binds R, Q, and the message m into a challenge h.
The signer combines both secrets into s = r + hk.
The published signature is (R, s). Neither k nor r is published.
Lowercase r is the one-message secret nonce scalar. Uppercase R=rG is its public curve point. Although h and s are public, they bind the hidden scalars without exposing them. Reusing the same r for two messages creates two equations that can reveal k.
To verify the signature, we recompute h and check:
The equation works because:
sG = (r + hk)G
sG = rG + h(kG)
sG = R + hQ
Quick check 1
What gives the signer its unique ability?
Verify that the message has not changed
Sign the default message, then change send 5 SOL to send 6 SOL. You will see the hash change and the verification equation fail. The stored signature does not change; the same signature simply stops verifying against the modified message.
Signer keeps
The private scalar stays inside the signer.
Everyone knows
The public point identifies the signer.
Signer publishes
The signature contains R and s, not k.
No signature to verify yet.
Show the toy arithmetic
This uses an insecure 19-element group and a toy hash to expose the relationship.
Quick check 2
What should changing the signed message do?
Solana transaction signatures
When your wallet signs a Solana transaction, it signs the serialized message with Ed25519. If you change an instruction, account, amount, or recent blockhash, the bytes change and the signature becomes invalid.
A valid signature authorizes those exact bytes. It does not prove that a wallet's human-readable description matched the signer's intent.
A PDA has no Ed25519 private key. During invoke_signed, the runtime checks the program ID and seeds and grants signer privilege for that CPI.
Ed25519 has exact hashing, scalar derivation, encoding, and cofactor rules. Use audited libraries. The equation here explains the relationship; it is not production implementation code.
Check your understanding
Try to answer each question before you open the solutions.
- Why can Q=kG be public while k remains private?
- What does a signature prove, and what does it not hide?
- How can the verifier check sG=R+hQ without knowing k?
- Why does changing the message invalidate the signature?
- How does Solana PDA authorization differ from an Ed25519 signature?
Show numbered solutions
-
Double-and-add computes Q=kG efficiently. Recovering k from G and Q requires solving the discrete logarithm problem, which is infeasible at production scale.
-
A valid signature proves that the private-key holder authorized the exact message. It detects changes but does not encrypt the message or prove that a human-readable interpretation matched the signer's intent.
-
Lowercase r is the hidden nonce scalar, while uppercase R=rG is its public point. The signer publishes R and s=r+hk. Multiplying by G gives sG=rG+h(kG)=R+hQ, so the verifier can compute both sides from public values. Reusing r for two challenges creates two equations that can reveal k.
-
The challenge h=H(R,Q,m) binds the equation to m. A changed message produces a different challenge, so the unchanged stored signature fails against the modified message.
-
A wallet produces an Ed25519 signature. A PDA has no private key. During a CPI,
invoke_signedre-derives the PDA from its seeds, bump, and program ID and grants signer privilege when the address matches.
Primary reading
- RFC 8032, sections 3.2 through 3.4 defines EdDSA keys, signing, and verification.
- Solana's transaction documentation connects signatures to serialized transaction messages and signer public keys.
- Solana's PDA documentation explains off-curve addresses and `invoke_signed` authorization.