Overview

3 Addresses

This chapter explains how Bitcoin replaces human names with cryptographic identifiers and introduces addresses to balance privacy, efficiency, and user safety. Using the cookie-token spreadsheet narrative, it motivates why visible identities leak sensitive behavior, how pseudonymous identifiers help, and why users need protection against costly typing mistakes when sharing payment details.

The system first swaps names for public keys so payments become pseudonymous and verifiable by signatures. To shrink data and add a security margin, public keys in the ledger are then replaced by 20-byte public key hashes produced as RIPEMD160(SHA256(pubkey)), known as pay-to-public-key-hash (P2PKH). The sender still includes a public key (to verify the signature), while the ledger stores and matches on hashes; this saves space and limits exposure of raw keys but doesn’t by itself improve privacy. To prevent catastrophic typos, users exchange Base58Check-encoded versions of public key hashes called addresses: a version byte + PKH + a 4-byte checksum (double-SHA256) is encoded in a human-friendly alphabet. Wallets decode the address back to the PKH and validate the checksum before creating a payment, making unnoticed errors extremely unlikely.

Even with hashes and addresses, transaction patterns can reveal behavior, so the chapter stresses using a new address for each payment to reduce linkability. Practically, this lets the “Lisa” role verify signatures and balances without managing a names-to-keys registry, while users safely exchange addresses that detect mistakes before funds are sent. The result mirrors real Bitcoin: pseudonymous accounting via PKH, compact identifiers, Base58Check addresses for human use, and the operational best practice of address reuse avoidance to enhance privacy.

   Cookie token addresses are exactly the same as Bitcoin addresses. They are mainly used by wallet software.
visual toc addresses.png
  Replacing the names with public keys. The spreadsheet is now much more unreadable, which is good from a privacy perspective.
replace names with public keys.png
   New style payment using public keys instead of names.
payment with pubkey.png
  Faiza creates her public key and gives it to the company. The company creates a payment with Faiza’s public key as the recipient.
  . Replace the public keys with the RIPEMD160 hash of the SHA256 hash of the public key.
hash public key.png
replace public keys with hashes.png
pay to pubkey note.png
7. John buys a cookie. The sender is still a public key, but the recipient is a public key hash instead of a public key. Lisa needs to create the public key hash from the public key in order to verify the balance and execute the payment.
payment with pubkey hash.png
   Bitcoin addresses.
periscope digital signatures bitcoin addresses.png
10   Overview of the base58check encoding which transforms a public key hash into a cookie token address
base58check encoding simple.png
base58check encode decode.png
  Base58check encoding John’s public key hash. A version is added to the hash, and then a checksum is created and appended to the versioned hash. Last, the checksummed, versioned hash is base58 encoded.
address encoding.png
checksum.png
  Encoding John’s versioned and checksummed public key hash with base58. The essential part is where you divide the number by 58 and keep the remainders. The remainders are then mapped one by one in the lookup table.
base58.png
  Base58check decoding is basically done by reversing the base58check encoding. Typing errors are detected when the checksums don’t match.
address decoding.png
  The names in the spreadsheet has been replaced with public key hashes.
summary replace names with pkh.png
base58.png
exercise johns money.png
exercise deduce address or pubkey.png
address creation exercise.png

    Recap

In this chapter you learned that

  • Privacy is important for you, not just for criminals.
  • Using public key hashes instead of personal names as recipient for payments is important for privacy and more secure.
  • Encoding a PKH as a Bitcoin address, or cookie token address, reduces the risk of sending money into void. The checksum in the address will prevent that.
  • Only users care about Bitcoin addresses. The Bitcoin network, or Lisa, deals with plain public key hashes.
  • You can have as many Bitcoin addresses as you like. Using multiple addresses, preferably one per received payment, improves your privacy.

FAQ

Why were names replaced with public keys and then with public key hashes?To improve privacy and simplify operations. Replacing names with public keys hides identities from observers and lets Lisa (the “miner”) avoid maintaining a name-to-key table. Hashing the public keys further shortens what’s stored without losing functionality.
What is a public key hash (PKH) and how is it computed?A PKH is a 20‑byte identifier created as RIPEMD160(SHA256(public key)). It’s a compact representation of a public key used as the receiver identifier in most payments (P2PKH).
Why use both SHA256 and RIPEMD160 for the PKH?Two reasons: size and defense in depth. RIPEMD160 shortens the identifier to 20 bytes, and combining two different hash functions reduces risk if one suffers a preimage weakness. Note: if either function’s effective output space were drastically reduced, overall security could suffer.
How does a payment change when using public key hashes?The message includes amount, the sender’s public key, the recipient’s PKH, and a signature. Lisa verifies the signature with the sender’s public key, derives the sender’s PKH to check balance, and records the recipient’s PKH as provided.
Do public key hashes improve privacy compared to public keys?No. There’s a practical one‑to‑one mapping between a public key and its hash. Observers can still cluster activity if the same PKH is reused.
What is a Bitcoin (cookie token) address and who uses it?An address is a base58check‑encoded public key hash. It’s a user‑friendly, typo‑detecting way to share a PKH. Users and wallets exchange addresses; Lisa/the network only sees PKHs, not addresses.
How does base58check encoding create an address?Start with the 20‑byte PKH, prepend a version byte (0x00 for the common type), compute a 4‑byte checksum as the first 4 bytes of SHA256(SHA256(version||PKH)), append the checksum, then Base58‑encode the result.
How are typing errors detected, and how reliable is the check?On decode, the checksum is recomputed and compared. A mismatch signals corruption, so wallets refuse the address. The false‑accept rate is about 1 in 2³². The Base58 alphabet also omits look‑alike characters to reduce mistakes.
What happens if you pay to a mistyped PKH or invalid address?The coins are effectively burned—nobody can spend them because there’s no corresponding known private key. That’s why decoding and verifying addresses before sending is essential.
What practical steps improve privacy when using addresses?Use a fresh address (new PKH) for every payment. Address reuse enables observers to link transactions and infer behavior; unique addresses make such clustering much harder.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Grokking Bitcoin ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Grokking Bitcoin ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Grokking Bitcoin ebook for free