— —
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 9
BY THE END YOU WILL BE ABLE TO ANSWER
  • What does an address encode?
  • What distinguishes bc1p from bc1q?
  • Which address types are cheapest in fees and best for privacy today?
  • Which address type begins with bc1p: (1) legacy, (2) native SegWit, (3) Taproot? Enter the number.

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

After this lesson you can: read any address prefix and say what it is.

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.

Four steps from public key to legacy address: hash, version byte, checksum, Base58.
Public key to legacy address.

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

Table of the four address formats with their encoding, witness program and typical length.
Every format you will meet.

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.

MINI CHALLENGERead the prefix

Which address type begins with bc1p: (1) legacy, (2) native SegWit, (3) Taproot? Enter the number.

CHECK YOURSELF
1/3 What does an address encode?
2/3 What distinguishes bc1p from bc1q?
3/3 Which address types are cheapest in fees and best for privacy today?
pick an answer for each question

SOURCES

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