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?
- Start with public key
- Hash it (SHA-256 β RIPEMD-160)
- Add version byte
- Add checksum
- 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.
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.