BitcoinMachine
TECHNICAL_DOC // KEYS / PUBLIC-KEY
PUBLIC
KEY
A Bitcoin public key is an elliptic curve point derived from the private key via scalar multiplication: P = privkey × G. It can be shared publicly — it proves ownership without revealing the private key. Public keys exist in two forms: compressed (33 bytes) and uncompressed (65 bytes). Modern Bitcoin exclusively uses compressed keys. Taproot uses x-only keys (32 bytes).
PUBLIC KEY ENCODING FORMATS
A public key is an (x, y) point on secp256k1. Both coordinates are 32 bytes each. Uncompressed (65 bytes) — LEGACY: 04 || x (32 bytes) || y (32 bytes) Prefix 04 = "uncompressed" Example: 04 79BE667E... 483ADA77... Compressed (33 bytes) — STANDARD: 02 || x (if y is even) 03 || x (if y is odd) Prefix 02/03 encodes y parity; full y reconstructable Example: 02 79BE667EF9DCBBAC55A06295CE870B07... x-only (32 bytes) — TAPROOT (BIP 340): x only, no prefix Even y assumed; key negated if odd Example: 79BE667EF9DCBBAC55A06295CE870B07...
Compressed Key — Y Reconstruction
MATH
Since secp256k1 is symmetric around the x-axis, the y-coordinate can be reconstructed from x and the parity bit stored in the prefix byte.
Given compressed pubkey: 02 || x (or 03 || x) Reconstruct y: y² = x³ + 7 (mod p) y = sqrt(y²) mod p → two solutions: y and p-y 02 prefix → take even y (y % 2 == 0) 03 prefix → take odd y (y % 2 == 1) Why it works: secp256k1 is symmetric: both (x,y) and (x,-y) are valid Storing 1 bit of y parity saves 32 bytes per key Size comparison: Uncompressed: 65 bytes (P2PK input: +64 bytes vs compressed) Compressed: 33 bytes (standard, used in P2PKH, P2WPKH) x-only: 32 bytes (Taproot P2TR)
TERMINOLOGY_INDEX
Public Key
EC point P = privkey × G. Shareable. Used to verify signatures and derive addresses.
Compressed Pubkey
33-byte encoding: prefix 02 (even y) or 03 (odd y) + 32-byte x-coordinate. Standard in modern Bitcoin.
Uncompressed Pubkey
65-byte encoding: prefix 04 + 32-byte x + 32-byte y. Legacy format, not used in modern wallets.
x-only Pubkey
32-byte x-coordinate only. Used in Taproot/Schnorr (BIP 340). Even y assumed; key negated if needed.