Cryptography & Addresses Last reviewed: October 2026 • 9 min read

Bitcoin Address Generation: From Secret to Public Identifier

A Bitcoin address is a cryptographic fingerprint of an elliptic curve public key paired with a four-byte error-checking checksum. Rather than publishing raw 65-byte public keys on the blockchain, Bitcoin routes funds through double hashes (SHA-256 followed by RIPEMD-160) to keep transactions compact and safeguard quantum privacy until funds are spent.

💡
In short

Your private key derives a public point on the secp256k1 curve, which is double-hashed into a 20-byte public key hash (HASH160). Appending a version byte and a 4-byte double-SHA-256 checksum prevents typing mistakes before Base58 encoding formats it into an address starting with "1".

01. The Plain-Language Analogy: The Postal Drop Box

Think of your private key as the physical brass key in your pocket. Your public key is the internal locking cylinder installed inside the box. Your Bitcoin address is the mailbox slot on the street with your address number stenciled on the front.

Anyone walking down the street can drop a letter or cash envelope through the mailbox slot. If someone tries to send a letter with a botched zip code, the postal sorting scanner rejects it before it leaves the origin facility - that is the address checksum in action. But no matter how many envelopes pile up inside the slot, only the person with the physical brass key can open the back door and retrieve the contents.

02. Step-by-Step Mechanics: The 7-Stage Pipeline

Every standard legacy Pay-to-Public-Key-Hash (P2PKH) Bitcoin address follows an exact mathematical pipeline:

Step 1
Generate 256-Bit Private Key

A cryptographically secure random number between 1 and 1.15 × 1077 (2^256 - 1). This secret must never be exposed or generated using predictable seeds.

Step 2
Derive secp256k1 Public Key

Multiply the private key scalar by the curve generator point G using elliptic curve point multiplication: K = k × G. In modern wallets, compressed public keys (33 bytes) store the 32-byte x-coordinate prefixed with 02 (if y is even) or 03 (if y is odd).

Step 3
SHA-256 Hash of Public Key

Hash the 33-byte public key using SHA-256, returning a 32-byte (256-bit) digest.

Step 4
RIPEMD-160 Hash (HASH160)

Hash the 32-byte SHA-256 result with RIPEMD-160. This produces a compact 20-byte (160-bit) hash. Known in Bitcoin Script as HASH160, this dual-hash layer provides defense-in-depth against potential vulnerabilities in either single algorithm.

Step 5
Prepend Network Version Byte

Add byte 0x00 to the front for Bitcoin Mainnet P2PKH addresses (or 0x05 for P2SH script addresses, 0x6F for Testnet). The payload is now 21 bytes.

Step 6
Calculate 4-Byte Checksum

Compute SHA-256(SHA-256(versionedPayload)) and take the first 4 bytes. Append these 4 bytes to the 21-byte payload, producing a 25-byte serialized structure.

Step 7
Base58Check Encoding

Encode the 25-byte structure into Base58 characters. The Base58 alphabet excludes characters that look identical in common fonts (0, O, I, l). The result is the final address string (26–35 characters).

TypeScript / Node.js Implementation:
import crypto from 'node:crypto';

// 1. Given a compressed public key (33 bytes hex)
const pubKeyHex = '0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352';
const pubKeyBytes = Buffer.from(pubKeyHex, 'hex');

// 2. SHA-256 hash
const sha256Hash = crypto.createHash('sha256').update(pubKeyBytes).digest();

// 3. RIPEMD-160 hash (HASH160)
const ripemd160Hash = crypto.createHash('ripemd160').update(sha256Hash).digest();

// 4. Prepend Mainnet Version Byte (0x00 for P2PKH)
const versionedPayload = Buffer.concat([Buffer.from([0x00]), ripemd160Hash]);

// 5. Compute 4-byte checksum via Double SHA-256
const firstSHA = crypto.createHash('sha256').update(versionedPayload).digest();
const secondSHA = crypto.createHash('sha256').update(firstSHA).digest();
const checksum = secondSHA.subarray(0, 4);

// 6. Append checksum to versioned payload (25 bytes total)
const binaryAddress = Buffer.concat([versionedPayload, checksum]);

console.log('HASH160:', ripemd160Hash.toString('hex'));
console.log('Checksum:', checksum.toString('hex'));
console.log('25-byte payload ready for Base58 encoding:', binaryAddress.toString('hex'));

03. Worked Example: Hal Finney's Address (Block #170)

This is the actual address belonging to computer scientist Hal Finney that received the 10 BTC transaction from Satoshi Nakamoto on January 12, 2009:

Bitcoin Address (P2PKH) 1Q2TWHE3GMdB6BZKafqwxXtWAWgFt5Jvm3
Network Prefix 0x00 (Mainnet P2PKH → starts with '1')
RIPEMD-160 Hash (HASH160) a4325c9cc598000bc14f5fb24446b7db091c7c95
First Received Transaction f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16
Historical Significance Recipient of the first Bitcoin transaction in history

You can inspect this address on any block explorer to see every satoshi ever sent or spent from it since 2009.

04. Common Misconceptions Corrected

✕ Misconception: "A Bitcoin address is the same thing as a public key."

Reality: A Bitcoin address is not a public key; it is a double-hash of the public key with version and checksum metadata. The raw public key is never published to the blockchain until the address spends coins for the first time.

✕ Misconception: "If you make a single typo entering an address, your coins get sent to a stranger."

Reality: Base58Check contains an embedded 4-byte double-SHA-256 checksum. The probability of an accidental typo yielding a valid checksum is 1 in 4,294,967,296 (~0.00000002%). Any standard wallet immediately rejects the typo before the transaction can be created.

✕ Misconception: "Addresses must be registered on the network before they can receive funds."

Reality: Addresses do not exist on the network prior to receiving funds. Any computer offline with zero internet access can generate billions of addresses right now; the blockchain only records an address when a transaction sends funds to its hash.

05. Modern Bitcoin Address Formats

Legacy (P2PKH) Starts with 1

Original 2009 format. Encodes public key hash via Base58Check.

1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
Script Hash (P2SH) Starts with 3

Introduced in BIP 16. Encodes redeem script hash for multisig and SegWit.

3J98t1WpEZ73CNmYviecrnyiWrnqRhWNLy
Native SegWit (Bech32) Starts with bc1q

BIP 173. All lowercase, 30–40% lower miner fees, error-correcting BCH codes.

bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
Taproot (Bech32m) Starts with bc1p

BIP 341 / BIP 350. Schnorr signatures, enhanced privacy, complex contracts.

bc1p5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs20cac6yqjjwudpxqkedrcr

06. Primary Sources & Official References