— —
Follow on X
LESSONS

Public keys and the curve

A public key is the generator point of the secp256k1 curve multiplied by the private key. Easy to compute, infeasible to reverse, and 33 bytes when compressed.

6 MIN READ
A private key multiplies the generator point to produce a public key point, encoded as 33 bytes.
LEVEL · Advanced
IN THIS LESSON · 2 OF 8
BY THE END YOU WILL BE ABLE TO ANSWER
  • How is a public key computed?
  • Why is the compressed public key 33 bytes rather than 64?

Then prove it: a 2-question quiz. The lesson marks itself complete at 100%.

Bitcoin uses elliptic curve cryptography on a specific curve, secp256k1, defined by the equation y² = x³ + 7 over a huge finite field. Points on this curve can be "added" by a geometric rule, and a point can be multiplied by a number by adding it to itself repeatedly, using fast doubling tricks.

The one-way function

There is a fixed starting point on the curve called the generator, G. Your public key is simply:

P = k × G

where k is your private key. Multiplying is fast (a few hundred doublings and additions). Going the other way, finding k from P and G, is the discrete logarithm problem, for which no efficient classical algorithm is known. That asymmetry is the whole of Bitcoin's key security.

Encoding

A point has an x and a y coordinate, 32 bytes each. Since the curve equation gives y from x up to sign, the compressed format stores only x plus a prefix byte, 02 or 03, indicating which y: 33 bytes total. Uncompressed keys (prefix 04, 65 bytes) exist from early Bitcoin. Taproot uses "x-only" keys of 32 bytes.

What a public key can do

Anyone with your public key can verify your signatures and derive your addresses. It cannot sign, and it cannot reveal k. In the original Bitcoin design coins were paid directly to public keys (P2PK); modern outputs pay to a hash of the key, which is the next lesson.

CHECK YOURSELF
1/2 How is a public key computed?
2/2 Why is the compressed public key 33 bytes rather than 64?
pick an answer for each question

SOURCES

  1. Learn Me A Bitcoin: Public key
Progress is saved in this browser only.