While developing a wallet application, I realized it's essential to have a solid understanding of how private and public keys work. These fundamentals are not just academic — they directly influence how securely and efficiently a wallet operates.

🔑 What Is a Private Key?

A private key is a randomly generated 256-bit (32-byte) number. It gives full control over a wallet’s funds.

Example:

0C28FCA386C7A2276AC8192E9F6DDEDC6D1E2C140C3C7A75A2B708F3EDF5BE59

There are 2^256 possible keys — more than atoms in the universe — making it virtually unguessable.


🔓 What Is a Public Key?

The public key is derived from the private key using elliptic curve cryptography (ECC). In Bitcoin, this is done with the secp256k1 curve. It's a one-way process — safe and irreversible.


🧾 How Is an Address Created?

  1. Start with public key
  2. Hash it (SHA-256 → RIPEMD-160)
  3. Add version byte
  4. Add checksum
  5. Base58Check encode the result

This becomes a Bitcoin address.


🔄 Key Derivation Diagram

[ Private Key ]
     ↓
[ Public Key ]
     ↓
[ Public Key Hash ]
     ↓
[ Address ]

🌲 HD Wallets in a Nutshell

Later in this journey, we’ll explore HD Wallets in more depth — especially how they're implemented in Rust and used to generate secure, deterministic key hierarchies for modern wallet applications.

HD (Hierarchical Deterministic) wallets generate thousands of addresses from a single seed using a structured path like:

m / 44' / 0' / 0' / 0 / 0

Only the seed phrase needs to be backed up.


💡 Why Different Formats Exist

Format Blockchain Purpose
WIF Bitcoin Encodes private keys with checksum and compression flag
Hex Ethereum Raw private keys, no metadata
JSON Solana Full Ed25519 keypair stored as JSON array
SS58 Polkadot Includes network prefix + checksum

Each format is optimized for the platform’s cryptography and UX.