Ethereum's foundational technology relies heavily on cryptography, a branch of mathematics essential for computer security. While the term originally meant "secret writing," modern cryptography encompasses far more than encryption—including digital signatures and fingerprints. These cryptographic proofs are vital to Ethereum and blockchain systems, though ironically, Ethereum itself doesn’t encrypt most communication or transaction data.
Introduction
Ethereum accounts come in two types: Externally Owned Accounts (EOAs) and contract accounts. This section focuses on how cryptography establishes ownership of Ether via EOAs using digital keys, addresses, and signatures.
Key Ownership and Control
- Digital keys are stored in user wallets and never transmitted over the network.
- Private keys generate signatures to authorize transactions, proving fund ownership.
- Public keys act like bank account numbers, derived from private keys through elliptic curve multiplication.
Public Key Cryptography in Ethereum
Core Concepts
- Key pairs: A private key (secret) and its corresponding public key.
- Digital signatures: Created with the private key, verifiable with the public key.
- Addresses: Typically derived from public keys (e.g., EOAs), though some represent contracts.
Why Asymmetric Encryption?
- Enables non-repudiation and authentication without exposing private keys.
- Signatures are verified by the network, ensuring only the key owner can spend funds.
Private Keys: The Foundation
Generation
- A private key is a 256-bit random number (e.g.,
f8f8a2f43c8376ccb0871305060d7b27b0554d2cc72bccf41b2705608452f315
). - Entropy source: Uses cryptographically secure pseudo-random number generators (CSPRNGs).
- Security: Loss means irreversible fund loss; backups are critical.
Warning | Never use flawed RNGs or "simple" random functions for key generation. |
---|
Public Keys: Derived from Private Keys
Elliptic Curve Cryptography
- Ethereum uses the secp256k1 curve (same as Bitcoin).
Formula: ( K = k \times G ), where:
- ( k ): Private key
- ( G ): Curve’s generator point
- ( K ): Resulting public key (a point on the curve).
Example Calculation
Given private key k
:
Public Key (K) = 04 + X-coordinate (32 bytes) + Y-coordinate (32 bytes)
Serialized as uncompressed hex (prefix 04
).
Ethereum Addresses
Creation Process
- Hash the public key with Keccak-256.
- Take the last 20 bytes as the address (e.g.,
001d3f1ef827552ae1114027bd3ecf1f086ba0f9
). - Prefix with
0x
for hex representation.
Address Formats
- Hex: Case-insensitive (e.g.,
0x001d3f1ef827552ae1114027bd3ecf1f086ba0f9
). - ICAP: IBAN-compatible (e.g.,
XE60HAMICDXSV5QXVJA7TJW47Q9CHWKJD
). - EIP-55: Mixed-case checksum (e.g.,
0x001d3F1ef827552Ae1114027BD3ECF1f086bA0F9
).
Checksum Protection
- EIP-55 encodes a checksum in the address’s capitalization.
- Detects common errors (e.g., misread characters) with 99.986% accuracy.
Cryptographic Hash Functions: Keccak-256
Properties
- Deterministic: Same input → same output.
- Quick to compute: Linear time.
- Avalanche effect: Tiny input change → drastic output change.
- Pre-image resistance: Can’t reverse the hash.
- Collision-resistant: Hard to find two inputs with the same hash.
Usage in Ethereum
- Key derivation (addresses).
- Message integrity (e.g., transaction signing).
Note | Ethereum’s "SHA3" is actually Keccak-256, differing from NIST’s finalized SHA-3 standard. |
---|
FAQ
1. Can I recover a lost private key?
No. Private keys are irrecoverable if lost—store backups securely.
2. Why does my Ethereum address differ from my public key?
Addresses are hashed versions of public keys (last 20 bytes of Keccak-256).
3. Are addresses case-sensitive?
Yes for EIP-55 (checksum), no for raw hex. Wallets should handle both.
4. What’s the difference between ICAP and hex addresses?
ICAP includes checksums and resembles IBANs; hex is raw 40-character format.
5. How secure is EIP-55?
Catches 99.986% of errors, like mistyped characters.
👉 Explore Ethereum wallets for secure key management.
By understanding keys and addresses, you’ve mastered the first step toward Ethereum’s cryptographic security. Always prioritize key safety—your funds depend on it!
### Key Enhancements:
1. **SEO Optimization**: Integrated keywords like "Ethereum private key," "public key cryptography," and "EIP-55."
2. **Structure**: Clear headings, bullet points, and tables for readability.
3. **EIP-55 Focus**: Detailed explanation of checksum encoding.
4. **Anchor Text**: Added an OKX link for wallet security.