BitcoinMachine
TECHNICAL_DOC // KEYS / PRIVATE-KEY
PRIVATE
KEY
A Bitcoin private key is a 256-bit (32-byte) random integer in the range 1 to n-1 (where n is the secp256k1 curve order). It is the sole proof of ownership of any funds locked to its corresponding public key. Anyone who possesses it can spend those funds unconditionally. It is generated once, from cryptographically secure entropy, and should never be transmitted or shared.
PRIVATE KEY PROPERTIES
Raw form: 32 bytes = 64 hex characters Example private key (hex): 0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d Valid range: 1 to n-1 where n = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 Invalid keys (astronomically rare): 0x00...00 (zero) — invalid ≥ n — invalid (must reduce mod n) Probability of generating an invalid key: ≈ 2 / 2^256 ≈ 10^-77 (effectively impossible) Generation: Source: OS CSPRNG (getrandom(), BCryptGenRandom()) Generate 32 random bytes → check 1 ≤ k < n → done
From Private Key to Everything
DERIVATION CHAIN
The private key is the root of all Bitcoin cryptographic operations. Everything else is derived from it deterministically.
private key (32 bytes) ↓ × G (EC scalar multiplication) public key (33 bytes compressed) ↓ SHA256 → RIPEMD160 pubkey hash (20 bytes) ↓ add version byte + checksum + Base58Check P2PKH address (1xxx... format) For Taproot: ↓ x-only pubkey (32 bytes) ↓ key tweak (tap tweak) output key → P2TR address (bc1p...) For signing: ↓ + message hash + nonce ECDSA or Schnorr signature
Storage and Security
CRITICAL
The private key must be stored securely and backed up reliably. Loss means permanent loss of funds. Exposure means immediate theft risk.
Secure storage options: Hardware wallet: key never leaves secure element Encrypted file: AES-256 encrypted, passphrase-protected Paper wallet: printed, physically secured Metal backup: stamped/engraved, fireproof Never: ✗ Store in plain text files ✗ Email or message to yourself ✗ Store in cloud services ✗ Type into untrusted websites ✗ Share with anyone for any reason Modern approach: BIP39 mnemonic seed instead of raw key → 12–24 words encode 128–256 bits of entropy → Derives HD wallet (all keys from one backup)
In modern HD wallets, you never see a raw private key — only the 12 or 24 word mnemonic that deterministically generates all keys.
TERMINOLOGY_INDEX
Private Key
A 256-bit integer in [1, n-1]. Root of all Bitcoin ownership. Must be kept secret and backed up.
ECDLP
Elliptic Curve Discrete Logarithm Problem. Given pubkey = privkey × G, computing privkey is infeasible.
WIF
Wallet Import Format. Base58Check encoding of a private key for human-readable storage and import.
Key Sweep
Moving all funds from a private key to a new address. Recommended after any key exposure risk.