Bitcoin is a peer-to-peer decentralized digital currency and protocol that allows online payments to be sent directly from one party to another without the need for a trusted third party (like banks).
Bitcoin Key Generation Process
In the Bitcoin network, cryptographic key pairs (private + public keys) are essential for ownership and transaction security.
Bitcoin uses Elliptic Curve Cryptography (ECC) with the secp256k1 curve.
1. Private Key
- A private key is a randomly generated 256-bit number
- It is the secret key known only to the wallet owner
- Used to digitally sign Bitcoin transactions (proves ownership)
Private Key Formats
Wallet Import Format (WIF)
Used to encode private key in a user-friendly format.
Mini Key Format
- A short (30-character) private key
- Used in physical bitcoins (e.g., Casascius coins)
- Begins with the letter
S
- Compact and QR-friendly
2. Public Key
- The public key is derived mathematically from the private key:
Public Key = Private Key × Generator Point (G)
- Generator point
G
is a fixed point on the secp256k1 elliptic curve - The public key is used to:
- Verify signatures
- Generate Bitcoin addresses
- Allow others to send funds to the user
Public Key Formats
Format | Description | Size |
---|---|---|
Uncompressed | Prefix 0x04 + 32-byte x + 32-byte y | 65 bytes |
Compressed | Prefix 0x02 (even y) or 0x03 (odd y) + 32-byte x | 33 bytes |
Example:
- Uncompressed: 04 + x (32 bytes) + y (32 bytes)
- Compressed: 02/03 + x (32 bytes)
Why Compressed Public Keys?
- Bitcoin clients use compressed keys since version 0.6
- Saves blockchain storage space (almost 50%)
- Still allows full derivation of the public key due to ECC symmetry