Chapter Overview
In this chapter, we explore the fundamental cryptographic components that enable Bitcoin ownership and transactions: digital keys, Bitcoin addresses, and wallets. You'll learn how these elements interact to establish secure control over bitcoin funds.
4.1 Introduction to Bitcoin Ownership
Bitcoin ownership isn't determined by physical possession but through digital cryptography:
- Digital keys (private/public key pairs) serve as the basis for ownership
- Bitcoin addresses act as public identifiers for receiving payments
- Wallets securely store and manage these cryptographic credentials
Ownership is established through mathematical proof rather than physical control. The Bitcoin protocol never stores keys directly—they're generated and managed by users' wallet software independently of the blockchain network.
4.1.1 Public Key Cryptography Fundamentals
Bitcoin utilizes elliptic curve cryptography (ECC) for its security model:
- Private keys generate corresponding public keys via one-way mathematical functions
The relationship enables:
- Decentralized trust models
- Ownership verification
- Cryptographic security proofs
👉 Learn more about elliptic curve cryptography
4.1.2 Private and Public Keys
Each Bitcoin wallet contains cryptographic key pairs:
- Private Key (k): A randomly generated 256-bit number serving as ultimate control
- Public Key (K): Derived from private key via elliptic curve multiplication (K = k*G)
The public key acts like a bank account number, while the private key functions like a PIN or signature authority.
4.1.3 Private Key Generation
Private keys are simply random numbers within a specific range (1 to n-1, where n ≈ 1.158×10^77). Secure generation requires:
- Cryptographically secure entropy sources
- Proper implementation of CSPRNGs (Cryptographically Secure Pseudorandom Number Generators)
Example private key in hexadecimal:
1E99423A4ED27608A15A2616A2B0E9E52CED330AC530EDCC32C8FFC6A526AEDD4.1.4 Public Key Derivation
Public keys are computed from private keys using elliptic curve multiplication:
K = k * GWhere:
- k = private key
- G = constant generator point on secp256k1 curve
- K = resulting public key point (x,y coordinates)
4.1.5 Elliptic Curve Cryptography Explained
Bitcoin uses the secp256k1 elliptic curve defined by:
y² = (x³ + 7) mod pKey properties:
- Based on discrete logarithm problem
- Operations are easy to compute one way but intractable to reverse
- Enables secure digital signatures
4.2 Bitcoin Addresses
A Bitcoin address is a base58check-encoded string representing a public key hash. Address generation involves:
- SHA-256 hashing the public key
- RIPEMD-160 hashing that result
- Adding version byte + checksum
- Base58Check encoding
Example address: 1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy
4.2.1 Base58Check Encoding
Base58Check provides:
- Improved readability (avoids ambiguous characters like 0/O/I/l)
- Built-in error detection via checksum
- Version prefixes identifying address types
Common version prefixes:
| Prefix | Address Type |
|---|---|
| 0x00 | P2PKH (Pay-to-Pubkey-Hash) |
| 0x05 | P2SH (Pay-to-Script-Hash) |
4.2.2 Key Formats
Private keys have multiple representation formats:
| Format | Example |
|---|---|
| Hexadecimal | 1E99423A4ED27608A15A2616A2B0E9E52CED330AC530EDCC32C8FFC6A526AEDD |
| WIF | 5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn |
| WIF-Compressed | KxFC1jmwwCoACiCAWZ3eXa96mBM6tb3TYzGmf6YwgdGWZgawvrtJ |
4.3 Wallet Technologies
4.3.1 Non-Deterministic (Random) Wallets
- Collections of randomly generated keys
- Challenging to manage/backup (each key independent)
- Called "JBOK" (Just a Bunch Of Keys) wallets
4.3.2 Deterministic (Seed) Wallets
- All keys derived from single master seed
- Enables easy backup/recovery
- Hierarchical variants (HD wallets) provide organizational structure
4.3.3 Mnemonic Code Words
- Human-readable seed phrases (typically 12-24 words)
- Defined in BIP39 standard
- Example:
army van defense carry jealous true garbage claim echo media make crunch
4.3.4 Hierarchical Deterministic Wallets (BIP32/BIP44)
- Tree-structured key derivation from master seed
- Supports organizational hierarchies (accounts/subaccounts)
- Standard path format:
m/purpose'/coin_type'/account'/change/address_index
4.4 Advanced Key & Address Types
4.4.1 Encrypted Private Keys (BIP38)
- Password-protected private key storage
- Example:
6PRTHL6mWa48xSopbU1cKrVjpKbBZxcLRRCdctLJ3z5yxE87MobKoXdTsJ
4.4.2 P2SH (Pay-to-Script-Hash)
- Enables complex scripting conditions
- Addresses begin with "3"
- Supports multi-signature transactions
4.4.3 Vanity Addresses
- Custom addresses containing readable patterns
- Generated through computational brute force
- Example:
1LoveBPzzD72PUXLzCkYAtGFYmK5vYNR33
4.4.4 Paper Wallets
- Physical cold storage solution
- Keys printed on paper (often with BIP38 encryption)
Example security features:
- Tamper-evident seals
- Scratch-off privacy layers
- Multi-copy backups
FAQ Section
Q: What's the difference between private and public keys?
A: Private keys (256-bit numbers) generate corresponding public keys via elliptic curve multiplication. Public keys can be freely shared to receive payments, while private keys must remain secret to spend funds.
Q: How are Bitcoin addresses created from public keys?
A: Addresses are RIPEMD160(SHA256(public_key)) hashes encoded in Base58Check format with version prefix and checksum.
Q: What makes HD wallets better than random key wallets?
A: HD wallets derive all keys from a single master seed, enabling:
- Simplified backups (only seed needs protection)
- Organizational key hierarchies
- Watch-only wallet functionality
Q: Are vanity addresses less secure?
A: No—they provide equivalent cryptographic security. However, shorter patterns are easier to brute force, so longer vanity strings (7+ characters) are recommended.
Q: Why use paper wallets?
A: Paper wallets provide:
- Complete air-gapped security (never online)
- Protection against digital theft/hacking
- Physical backup durability