— —
Follow on X
LESSONS

Addresses: every format explained

An address is an encoding of a script template plus a hash or key. The prefix tells you which: 1 for P2PKH, 3 for P2SH, bc1q for SegWit, bc1p for Taproot.

7 MIN READ
A stack listing Bitcoin address types and what each pays to.
LEVEL · Advanced
IN THIS LESSON · 3 OF 8
BY THE END YOU WILL BE ABLE TO ANSWER
  • What does an address encode?
  • What distinguishes bc1p from bc1q?

Then prove it: a 2-question quiz. The lesson marks itself complete at 100%.

An address is not a thing on the blockchain. It is a human-friendly encoding of an output's locking condition, with a checksum. Decode it and you get a script.

From public key to legacy address (P2PKH)

  1. SHA-256 the public key, then RIPEMD-160 the result: a 20-byte public key hash.
  2. Prepend a version byte (0x00 for mainnet).
  3. Compute a checksum: first 4 bytes of a double SHA-256 of the above.
  4. Encode in Base58, which drops look-alike characters (0, O, I, l). Result: starts with 1, 26 to 34 characters.

Script hash addresses (P2SH, 3...)

Same recipe with a different version byte and the hash of a script instead of a key. The script (say, a 2-of-3 multisig) is revealed only when spending. Also used to "wrap" SegWit outputs so old wallets could pay them.

Native SegWit (bc1q...)

Bech32 encoding: a human-readable prefix (bc), a separator (1), then the witness version and program in a 32-character alphabet, lowercase only, with a checksum that detects up to four errors. A 20-byte program is P2WPKH (42 characters); a 32-byte program is P2WSH (62 characters).

Taproot (bc1p...)

Bech32m, a tweak of Bech32, encodes witness version 1 and a 32-byte x-only public key. P2TR. The key is "tweaked" with a hidden script tree, so a single-sig wallet and a complex multisig look identical on-chain.

Which to use

Taproot and native SegWit are cheapest in fees and best for privacy. Legacy addresses still work and cost more. Any wallet can pay any type.

Tap a card to flip it.

CHECK YOURSELF
1/2 What does an address encode?
2/2 What distinguishes bc1p from bc1q?
pick an answer for each question

SOURCES

  1. Learn Me A Bitcoin: Address
Progress is saved in this browser only.