Chapter IV · key derivation

Scalar multiplication and keypairs

Objective
derive a toy public key
Solana
signer keypairs
Hard problem
discrete log

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:

Q = kGPrivate input: k. Public parameters: the curve and G. Public output: Q.

This is scalar multiplication: repeated use of the curve's point-addition rule.

Keep secretscalar k
scalar multiplication
Safe to sharepoint Q

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:

13 = 8 + 4 + 1 = 1101₂

Build 2G, 4G, and 8G by doubling, then combine the powers selected by the binary digits:

13G = 8G + 4G + GThis family of methods is called double-and-add. Work grows with the number of bits in k, not with the value of k.

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.

Toy private key
compute kG
Toy public key

Reverse-search attacker

The attacker knows G and Q. It tries every possible scalar until a candidate produces the same public point.

    The attack succeeds because there are only 18 candidates. This group is educational, not secure.

    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 + G → Q is the wrong model
    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.

    Signer addressOn-curve public point. Authorization comes from a valid Ed25519 signature.
    Program addressOff-curve derived bytes. Authorization comes from the deriving program and matching seeds.

    Check your understanding

    Try to answer each question before you open the solutions.

    1. What information is public in the equation Q=kG?
    2. Why can a computer calculate a large scalar multiple without adding G one step at a time?
    3. What is the elliptic-curve discrete logarithm problem?
    4. Why did the reverse attack work against the toy group?
    5. What authorization rule replaces private-key signing for a Solana PDA?
    Show numbered solutions
    1. The curve, subgroup order, generator G, and point Q are public. Only k is secret. Production parameters make recovering it impractical.

    2. 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.

    3. 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.

    4. The toy subgroup has only 18 nonzero scalar candidates, so a sequential search finds the key quickly.

    5. 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