Chapter IV · key derivation
Scalar multiplication and keypairs
If you know the secret scalar, computing the public point is fast. Reversing the operation is hard.
Derive a public key from a private scalar
We choose a generator point G that everyone knows and a scalar k that only the owner knows. Repeated point addition produces the public point:
This is scalar multiplication: repeated use of the curve's point-addition rule.
Ed25519 hashes secret bytes and derives a clamped scalar before computing the public point. Q=kG captures the group operation, not the full key format.
Compute scalar multiplication with double-and-add
Suppose you want to compute 13G. We avoid thirteen separate additions by writing 13 in binary:
Build 2G, 4G, and 8G by doubling, then combine the powers selected by the binary digits:
Quick check 1
Which decomposition computes 13G?
Test scalar multiplication in a small group
This toy subgroup has 18 possible nonzero scalars. Choose one and watch the workbench derive its public point.
Reverse-search attacker
The attacker knows G and Q. It tries every possible scalar until a candidate produces the same public point.
The elliptic-curve discrete logarithm problem
If you know k and G, double-and-add computes Q efficiently. If you know only G and Q, recovering k is the elliptic-curve discrete logarithm problem.
No efficient classical algorithm is known for a secure production group. A naive search through a subgroup of order N takes up to O(N) point operations. Generic attacks such as baby-step giant-step and Pollard rho reduce that to about O(√N). For Ed25519, the generic attack scale is still about 2126 curve operations. Real attackers do not need to try every scalar one by one.
k acting on G → Q is the right modelThe arrow is easy because k is known. Reversing it means solving the discrete logarithm.
This is a computational hardness assumption, not a claim that reversal is mathematically impossible. A sufficiently capable quantum computer running Shor's algorithm would break this assumption.
Quick check 2
Given the curve, G, and Q=kG, what does the attacker seek?
Solana public keys and PDAs
When you use a normal Solana signer, its Ed25519 public key decodes to an on-curve point. Its secret key produces signatures that the runtime verifies.
A PDA is derived from seeds and a program ID and must be off-curve. No scalar k can produce it as kG. The runtime authorizes the PDA by checking its derivation instead.
Check your understanding
Try to answer each question before you open the solutions.
- What information is public in the equation Q=kG?
- Why can a computer calculate a large scalar multiple without adding G one step at a time?
- What is the elliptic-curve discrete logarithm problem?
- Why did the reverse attack work against the toy group?
- What authorization rule replaces private-key signing for a Solana PDA?
Show numbered solutions
-
The curve, subgroup order, generator G, and point Q are public. Only k is secret. Production parameters make recovering it impractical.
-
Double-and-add writes k in binary, builds doubled points, and adds only the powers selected by 1-bits. It takes roughly O(log k) point operations.
-
The elliptic-curve discrete logarithm problem asks for k given G and Q=kG. A sequential search takes O(N) work. Baby-step giant-step and Pollard rho reduce generic attacks to about O(√N). For a group near 2²⁵², that is still about 2¹²⁶ curve operations.
-
The toy subgroup has only 18 nonzero scalar candidates, so a sequential search finds the key quickly.
-
During
invoke_signed, the runtime combines the seeds, bump, and calling program ID to re-derive the PDA. A match grants signer privilege for the CPI. No Ed25519 signature is involved.
Primary reading
- RFC 8032, sections 3.2 and 5.1.5 defines EdDSA keys and the exact Ed25519 key-generation procedure.
- SEC 1, section 3.2.1 specifies elliptic-curve keypair generation in the general model.
- Solana's PDA documentation explains off-curve derivation and program authorization.