Glossary

Key Pair

A key pair is a matched public key and private key used for encryption, signing, and identity in cryptocurrency.

Key Takeaways

  • A key pair consists of a private key (kept secret) and a mathematically linked public key (shared freely). Together they enable ownership, signing, and verification across all cryptocurrency systems.
  • Key pairs are generated using elliptic curve cryptography: the private key is a random 256-bit number, and the public key is derived from it via a one-way mathematical function that cannot be reversed.
  • Every cryptocurrency transaction depends on key pairs for digital signatures: the private key signs transactions to prove ownership, and the public key lets anyone verify that signature without learning the secret.

What Is a Key Pair?

A key pair is the foundational cryptographic unit behind all cryptocurrency ownership and transactions. It consists of two mathematically related values: a private key that only the owner knows, and a public key that can be shared with anyone. The private key proves you own funds; the public key lets others verify that proof without ever seeing the secret.

In Bitcoin and most cryptocurrencies, key pairs replace the username-and-password model of traditional finance. There is no central authority that stores your credentials or can reset your access. Your private key is your identity: whoever holds it controls the associated funds. Your public key (or an address derived from it) is how others send you payments.

The relationship between the two keys is asymmetric: generating the public key from the private key is trivial, but reversing the process is computationally infeasible. This one-way property is what makes the entire system secure.

How It Works

Key pair generation in Bitcoin relies on the secp256k1 elliptic curve, defined by the equation y² = x³ + 7 over a large finite field. The process has two steps:

  1. Generate a private key: select a cryptographically random 256-bit integer between 1 and the curve order (n ≈ 1.158 × 10⁷⁷). Good entropy is critical: if the random number generator is weak or predictable, the private key can be guessed.
  2. Derive the public key: multiply the generator point G on the secp256k1 curve by the private key using elliptic curve scalar multiplication (Q = d × G). This produces a point on the curve that serves as the public key.

The security of this scheme rests on the elliptic curve discrete logarithm problem: given the public key Q and the generator point G, there is no efficient algorithm to recover the private key d. With a 256-bit key, the system provides approximately 128 bits of security, meaning an attacker would need roughly 2¹²⁸ operations to break it.

Key Formats and Encoding

Private and public keys can be represented in several formats depending on the context:

Key TypeFormatSizeDetails
Private keyRaw hex32 bytes256-bit integer in hexadecimal
Private keyWIF (compressed)52 charactersBase58Check encoding, prefix K or L
Public keyUncompressed65 bytes04 prefix + full x and y coordinates
Public keyCompressed33 bytes02 or 03 prefix + x coordinate only
Public keyx-only (BIP-340)32 bytesUsed by Schnorr signatures

Compressed public keys are the modern standard: since the y-coordinate can be derived from x using the curve equation, only the x value and a single prefix byte (indicating which of two possible y values to use) need to be stored. This halves the public key size and reduces transaction fees.

From Key Pair to Address

A Bitcoin address is not the public key itself but a hash derived from it. The public key is processed through SHA-256 and RIPEMD-160 to produce a shorter, checksum-protected address. Different address types (P2PKH, P2WPKH, P2TR) use different encoding schemes, but all originate from the same key pair.

Signing and Verification

Key pairs enable two core cryptographic operations that power every transaction:

  1. Signing: the private key holder creates a digital signature over the transaction data. This proves they authorized the spending of specific funds without revealing the private key itself.
  2. Verification: anyone with the public key can mathematically verify that the signature was produced by the corresponding private key. If the signature is valid, the transaction is accepted by the network.

Bitcoin originally used ECDSA signatures (70-72 bytes). The Taproot upgrade (activated November 2021) introduced Schnorr signatures via BIP-340, which produce 64-byte signatures with 32-byte x-only public keys. Schnorr's linearity property enables advanced features like key aggregation (MuSig2) and threshold signatures (FROST), making multisig transactions indistinguishable from single-key spends on chain.

Code Example

Generating a key pair and deriving a Bitcoin address using common libraries:

// Generate a key pair using secp256k1
const { randomBytes } = require('crypto');
const secp256k1 = require('secp256k1');

// Step 1: Generate a random 256-bit private key
let privateKey;
do {
  privateKey = randomBytes(32);
} while (!secp256k1.privateKeyVerify(privateKey));

// Step 2: Derive the compressed public key
const publicKey = secp256k1.publicKeyCreate(privateKey, true);

console.log('Private key:', privateKey.toString('hex'));
console.log('Public key:', publicKey.toString('hex'));
// Public key will be 33 bytes (compressed format)

HD Wallets and Key Derivation

Modern wallets do not manage individual key pairs in isolation. Instead, they use hierarchical deterministic (HD) wallets defined by BIP-32. A single master seed (typically encoded as a seed phrase) generates an entire tree of key pairs through a deterministic derivation process using HMAC-SHA512.

BIP-44 standardizes the derivation path structure:

m / purpose' / coin_type' / account' / change / address_index

// Bitcoin example:
m/84'/0'/0'/0/0    // First receiving address (native SegWit)
m/84'/0'/0'/0/1    // Second receiving address
m/84'/0'/0'/1/0    // First change address

This approach means users only need to back up a single seed phrase to recover all their key pairs and associated funds. Each address in the wallet corresponds to a unique key pair derived from the same root.

Use Cases

Transaction Authorization

Every Bitcoin transaction requires a valid signature from the private key controlling the spent outputs. The network verifies this signature against the public key before including the transaction in a block. Without the correct key pair, funds cannot be moved.

Multi-Signature Security

Multisig wallets combine multiple key pairs into a single spending policy (for example, 2-of-3). This distributes trust across multiple keys so that no single compromised key pair can authorize a transaction. Threshold signature schemes like FROST take this further by aggregating multiple key pairs into a single on-chain public key using protocols like FROST threshold signatures.

Identity and Authentication

Beyond transactions, key pairs serve as identity anchors across cryptocurrency protocols. Lightning Network nodes identify themselves by their public keys. Nostr uses secp256k1 key pairs for decentralized identity. Decentralized identity systems use key pairs to issue and verify credentials without centralized authorities.

Layer 2 Protocols

Layer 2 systems like Spark rely on key pairs for off-chain transaction signing and ownership verification. In Spark, key pairs enable users to hold and transfer virtual UTXOs with full self-custody: the user's private key remains the ultimate authority over their funds, even though transactions settle off the base layer. For more on how this works, see the Spark layer 2 deep dive.

Risks and Considerations

Key Loss

If a private key is lost and no backup exists, the associated funds are permanently inaccessible. There is no password reset, no customer support, and no recovery mechanism at the protocol level. This is why seed phrase backups and proper key management practices are essential.

Key Compromise

If an attacker obtains a private key, they gain full control over the associated funds. Common attack vectors include malware, phishing, insecure storage, and weak random number generation during key creation. Hardware wallets and air-gapped signing devices mitigate this by keeping private keys isolated from internet-connected systems.

Quantum Computing Threats

Quantum computers running Shor's algorithm could theoretically solve the elliptic curve discrete logarithm problem, recovering private keys from public keys. As of 2026, no quantum computer is close to the scale required (estimated at hundreds of thousands of physical qubits for secp256k1), but the threat has motivated research into post-quantum cryptography for future Bitcoin upgrades. Addresses that have never had their public key exposed on chain (those that have only received, never spent) have an additional layer of protection, since attackers would need to break both the hash function and the elliptic curve.

Address Reuse

Reusing the same key pair for multiple transactions reduces privacy by linking activity to a single public key. It also increases quantum exposure: once a transaction is broadcast, the public key is revealed on chain. Address reuse should be avoided by generating a fresh key pair (via HD derivation) for each transaction.

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.