How do Bitcoin address types work: legacy, SegWit and Taproot? · Jumpstart Blockchain
How do Bitcoin address types work: legacy, SegWit and Taproot?
Addresses starting with 1 are legacy P2PKH, 3 are P2SH, bc1q are native SegWit (Bech32) and bc1p are Taproot (Bech32m). All can pay each other; newer types make smaller inputs, so they cost less to spend and add features.
A Bitcoin address is a short, checksummed encoding of a locking script: the condition someone must satisfy to spend the coins sent to it. There are four types in common use. Legacy addresses start with 1 (P2PKH, pay to public key hash). Script addresses start with 3 (P2SH, often wrapping SegWit). Native SegWit addresses start with bc1q (P2WPKH or P2WSH, Bech32 encoding). Taproot addresses start with bc1p (P2TR, Bech32m encoding). All of them hold the same bitcoin and can send to each other. What changes is how big the spending transaction is, and therefore the fee, plus privacy and which scripting features are available. Newer types are cheaper to spend, so modern wallets default to bc1q or bc1p.
What is an address, really?
Bitcoin has no accounts with balances. It has outputs, each holding an amount and a small program called the scriptPubKey. Your "balance" is the sum of outputs whose scripts your keys can satisfy; the UTXO model explains this in detail.
An address is just a human-friendly way to tell a sender which script to put in the output. The sender's wallet decodes the address, rebuilds the script and puts it in the transaction. The address itself never appears on-chain; only the script does.
Each type is a standard script template plus some data, usually a hash of your public key or of a larger script:
Two parties lock BTC in a 2-of-2 output and trade signed commitment transactions off chain, revoking old states with penalty secrets. HTLCs tied to one payment hash route payments across channels atomically.
The original format. The address is a version byte (0x00 on mainnet), the 20-byte HASH160 (SHA-256 then RIPEMD-160) of your public key, and a 4-byte checksum, all in Base58, which drops look-alike characters such as 0, O, I and l.
To spend, you provide your public key and a signature in the input's scriptSig. That data counts at full weight, which makes legacy inputs the most expensive to spend. Legacy addresses still work everywhere, but there is no good reason to create new ones.
P2SH: addresses starting with 3
Pay to Script Hash lets the receiver define any script (say, a 2-of-3 multisig) and hand out only its hash. The sender pays to the hash, and the spender reveals the full script, called the redeem script, plus whatever satisfies it. That moved the cost and complexity of complex scripts from sender to receiver.
A 3 address tells you nothing about what is inside. Most common today is nested SegWit (P2SH-P2WPKH), where the redeem script is a SegWit program. It was the compatibility bridge in 2017 for wallets and exchanges that couldn't yet send to bc1 addresses: you got most of SegWit's fee savings while looking like an ordinary 3 address.
Native SegWit: bc1q addresses
Segregated Witness (BIP-141, activated in August 2017) moved signatures and public keys out of the scriptSig into a separate witness field. Witness bytes count as one weight unit each instead of four, so spending a SegWit input costs much less. It also fixed third-party transaction malleability, which the Lightning Network's payment channels depend on.
Native SegWit outputs are encoded with Bech32 (BIP-173):
bc is the human-readable part for mainnet, 1 is the separator, and q encodes witness version 0.
The character set is 32 lower-case letters and digits, and the format is case-insensitive (but never mixed case), so it reads aloud and fits QR codes well.
The checksum is a BCH code that detects typos far more reliably than the Base58Check checksum does.
A 42-character bc1q address is P2WPKH (a single key). A 62-character one is P2WSH (a script, typically multisig).
Taproot: bc1p addresses
Taproot (BIP-340, 341 and 342) activated in November 2021 at block 709,632. The output holds a 32-byte output key, and it can be spent in two ways:
Key path: one Schnorr signature for the output key. This is the cheapest input type of all.
Script path: reveal one branch of a Merkle tree of alternative scripts (timelocks, multisig, recovery rules) plus a proof that it was committed to the key. Unused branches stay hidden.
Because a multisig built with MuSig2 or a complex contract can still spend through the key path, a Taproot spend often looks identical to a single-signature payment, which improves privacy for everyone using the type. For the cryptography, see what Taproot and Schnorr signatures change.
Taproot addresses use Bech32m (BIP-350), and p encodes witness version 1. Bech32m exists because of a flaw found in Bech32: if an address ends in p, inserting or deleting q characters right before it may not invalidate the checksum. That was harmless for version 0, whose lengths are fixed, but unsafe for future versions, so every witness version from 1 onwards uses the corrected constant.
How much does each type cost to spend?
Fees are charged per virtual byte (vB), and most of a transaction's size comes from its inputs. Approximate sizes for a single-key spend:
Input type
Size per input
Output size
P2PKH (legacy)
~148 vB
34 vB
P2SH-P2WPKH (nested SegWit)
~91 vB
32 vB
P2WPKH (native SegWit)
~68 vB
31 vB
P2TR (Taproot, key path)
~57.5 vB
43 vB
Spending ten legacy inputs costs roughly 2.5 times as much as spending ten Taproot inputs at the same fee rate. Taproot outputs are slightly larger than P2WPKH outputs because they carry a full 32-byte key instead of a 20-byte hash, so for a wallet that receives once and spends once the two are close; Taproot wins clearly for multisig and scripts. If a low-fee transaction gets stuck, RBF and CPFP are the tools for bumping it.
Why does one seed phrase give several addresses?
Wallets derive keys from your seed along a derivation path, and the path conventionally signals the address type:
Standard
Path
Address type
Descriptor
BIP-44
m/44'/0'/0'
P2PKH (1...)
pkh(...)
BIP-49
m/49'/0'/0'
P2SH-P2WPKH (3...)
sh(wpkh(...))
BIP-84
m/84'/0'/0'
P2WPKH (bc1q...)
wpkh(...)
BIP-86
m/86'/0'/0'
P2TR (bc1p...)
tr(...)
For the well-known test mnemonic abandon abandon ... about (eleven abandons then about; it is public, so never send real funds to it), the first receiving address on each path is:
This is the usual reason a restored wallet shows zero balance: the seed is right but the new wallet scans a different path or address type. Check which type the old wallet used and pick the matching option, or import an output descriptor. How seed phrases work covers backups, and for shared wallets, team custody with multisig explains why you must also back up the full descriptor.
Testnet and lookalike prefixes
Network
Legacy
Script
SegWit / Taproot
Mainnet
1
3
bc1q / bc1p
Testnet and signet
m or n
2
tb1q / tb1p
Regtest
m or n
2
bcrt1q / bcrt1p
Other chains reuse the same formats with their own prefixes; Litecoin, for example, uses L, M and ltc1. A valid checksum on one network is invalid on another, which is exactly what you want.
What does this mean for developers?
Generate addresses with your node or a library, never by hand. Bitcoin Core takes the type as an argument:
Validate by decoding, not by regex. A pattern like ^(bc1|[13]) accepts typos and rejects valid future types. Decode the address and build the script, which checks the checksum and network:
import * as bitcoin from"bitcoinjs-lib";
functiontoScript(address: string): Uint8Array | null {
try {
return bitcoin.address.toOutputScript(address, bitcoin.networks.bitcoin);
} catch {
returnnull; // bad checksum, wrong network, or unknown format
}
}
Accept every type when sending. Some services were slow to support sending to bc1p. If you run one, test payouts to all five types listed above. Bitcoin Core also understands future witness versions so that new address types can be paid before every wallet knows how to spend them.
Don't reuse addresses. Each address should receive once. Reuse links your payments together publicly and, for P2PKH and P2WPKH, exposes the public key after the first spend.
Store the script, not just the string. For indexing and accounting, the scriptPubKey is the canonical identity of an output. Some outputs have no standard address at all, such as bare multisig, OP_RETURN data outputs and some of the inscription patterns described in what Ordinals and Runes are.
Summary
If you see
It is
Spend cost
Notes
1...
Legacy P2PKH
Highest
Universally supported, avoid for new wallets
3...
P2SH, often nested SegWit
Medium
Contents unknown from the address
bc1q... (42 chars)
Native SegWit P2WPKH
Low
Bech32, the common default
bc1q... (62 chars)
Native SegWit P2WSH
Low per signature
Usually multisig
bc1p...
Taproot P2TR
Lowest for key-path spends
Bech32m, best privacy and scripting
Any type can pay any other. Choose Taproot or native SegWit for new wallets, keep the derivation path and descriptor with your backup, and validate addresses by decoding them.
Taproot (BIP-340/341/342, 2021) adds 64-byte Schnorr signatures and P2TR outputs: one tweaked key spendable by a single signature or a hidden Merkle tree of scripts, so multisig can look like a normal payment.
Ordinals number every sat and track it first-in-first-out; inscriptions put files in Taproot witness data on a sat; Runes are UTXO-based tokens in OP_RETURN. Indexers, not nodes, interpret all of them.