Public and Private Keys in Crypto Wallets Explained
In cryptocurrency there is a saying: "not your keys, not your coins." It captures a literal technical truth. A crypto wallet does not store money the way a physical wallet stores cash; it stores cryptographic keys that authorize movements on a public ledger. Understanding public and private keys in crypto wallets is the difference between genuinely controlling assets and merely trusting someone else to. These keys rest on the same asymmetric cryptography that secures much of the internet.
Asymmetric Keys in a Nutshell
Every wallet is built around a key pair:
- The private key is a secret number that must never be shared. Whoever holds it controls the associated funds.
- The public key is derived from the private key and can be shared freely. It lets anyone verify signatures and receive funds.
The relationship is deliberately one-way: it is trivial to compute the public key from the private key, but computing the private key from the public key is infeasible. This asymmetry is what makes it safe to publish one half of the pair.
How a Key Pair Is Generated
Generating a key pair begins with randomness. A private key is essentially just a very large random number, 256 bits for the curves most blockchains use. The security of everything downstream depends on this number being generated with a strong source of entropy; a predictable private key means predictable loss of funds.
The public key is then computed by elliptic-curve scalar multiplication of a fixed generator point by the private key. On Bitcoin and Ethereum this uses the secp256k1 curve.
private_key = random_256_bit_integer() # keep secret
public_key = private_key * G # G = curve generator point
Reversing that last line, recovering the private key from the public key, requires solving the elliptic-curve discrete logarithm problem, which is believed to be computationally infeasible.
From Public Key to Wallet Address
Users rarely share a raw public key. Instead they share an address, which is derived by hashing the public key. Bitcoin hashes the public key with SHA-256 then RIPEMD-160; Ethereum takes the last twenty bytes of the Keccak-256 hash of the public key. This shortens the identifier, adds a checksum against typos, and provides an extra one-way layer between the world and the public key. For more on this flow, see how Bitcoin uses cryptography.
Signing Transactions Proves Ownership
To move funds, a wallet builds a transaction and produces a digital signature over it using the private key. The network verifies the signature against the public key. A valid signature proves two things at once: that the signer holds the private key, and that the transaction has not been altered since signing.
The private key itself is never transmitted or revealed during this process. This is the core mechanism of self-custody: control is exercised by proving knowledge of a secret, not by sending the secret anywhere.
Seed Phrases and HD Wallets
Managing many individual private keys would be unwieldy, so modern wallets are hierarchical deterministic (HD) wallets. They start from a single random seed, usually presented to the user as a mnemonic seed phrase of twelve or twenty-four words defined by the BIP-39 standard.
From that one seed, the BIP-32 standard deterministically derives an entire tree of key pairs, and BIP-44 defines standard derivation paths so that different wallets can recreate the same accounts. The practical consequences are significant:
- Backing up the seed phrase backs up every key the wallet will ever derive.
- Anyone who learns the seed phrase controls all of those funds.
- A wallet can generate a fresh address per transaction for privacy while still being restorable from one phrase.
Protecting Keys: Custody and Threats
Because keys are the assets, key management is the whole security problem:
- Hot wallets keep keys on internet-connected devices for convenience but expose them to malware and phishing.
- Cold wallets and hardware wallets keep the private key on an offline device that signs transactions internally, so the secret never touches a networked computer.
- Custodial services hold keys on a user's behalf, trading self-custody for convenience and reintroducing counterparty trust.
Two properties make this unforgiving. First, transactions are irreversible, so a fraudulent transfer cannot be clawed back. Second, there is no password-reset authority: lose the seed phrase and the funds are gone permanently, while leaking it hands them to an attacker. Sound entropy, careful backups, and offline signing are therefore not optional extras but the foundation of wallet security.
Key Takeaways
- A crypto wallet stores keys, not coins; the private key authorizes spending and the public key verifies it.
- The public key is derived one-way from the private key by elliptic-curve multiplication, and the address is a hash of the public key.
- Signing proves ownership and integrity without ever revealing the private key.
- HD wallets derive every key from a single BIP-39 seed phrase, so protecting that phrase protects all funds.
- Keys demand rigorous handling because transactions are irreversible and lost or leaked keys cannot be recovered.