← Bitcoin Encyclopedia

P2PKH, P2SH, P2WPKH, P2TR

🌳 Advanced

💡 The Plain-English Definition

These are the four main Bitcoin script types — the different ways Bitcoin can be locked and unlocked — each representing a generation of technical evolution in how the protocol handles transaction security, efficiency, and privacy.

🤔 But Why Though?

Every Bitcoin transaction output is locked by a script — a set of conditions that must be satisfied to spend the funds. The script type determines what those conditions look like, how much space the transaction takes, and what information is revealed on-chain. Each generation addressed limitations of the previous one.

P2PKH (Pay to Public Key Hash — meaning payment locked to the hash, or fingerprint, of a public key) is the original format, producing addresses starting with 1. It locks funds to the hash of a public key. To spend, the owner must reveal the full public key and provide a valid signature. Secure and proven, but the largest transaction format — highest fees. P2SH (Pay to Script Hash — meaning payment locked to the hash of a spending script) produces addresses starting with 3. Instead of locking to a key directly, it locks to the hash of an arbitrary spending script — enabling complex conditions like multisig without revealing those conditions until spending. Enabled multisig to look like simple payments before the conditions are revealed.

P2WPKH (Pay to Witness Public Key Hash — the SegWit version of P2PKH) produces the bc1q addresses introduced with SegWit (Segregated Witness — the 2017 upgrade that moved signature data outside the main transaction body). The signature data is stored in the “witness” section of the transaction, which receives a weight discount under SegWit’s block size rules. Result: smaller effective transaction size, lower fees, and the transaction malleability fix (the technical bug where transaction IDs could be altered before confirmation) that enabled Lightning Network. P2TR (Pay to Taproot — the newest format) produces bc1p addresses, activated November 2021. Taproot allows either a single key spend (looking like any other transaction) or a script spend revealing complex conditions — but critically, single key and multisig transactions are indistinguishable on-chain. It uses Schnorr signatures (a newer signature scheme allowing key aggregation — combining multiple keys into one) rather than ECDSA (the older signature scheme).

🌍 The Real-World Analogy

Think of these script types like four generations of door locks. The original mortise lock (P2PKH) works reliably but requires a large, visible mechanism. The combination lock (P2SH) hides what’s inside the safe until you open it. The electronic keypad (P2WPKH) is more compact, more efficient, and fixes a flaw where someone could change the combination mid-entry. The biometric scanner (P2TR) is the most modern — you can use it as a fingerprint reader or a full access-control system, and from the outside, both look identical.

⚡ So What?

Use P2TR (bc1p) addresses if your wallet supports them — they provide the best fee efficiency, the best privacy (multisig indistinguishable from single-sig), and the best positioning for future Bitcoin upgrades. Use P2WPKH (bc1q) as the next best option. Avoid sending to legacy 1… addresses unless required by the recipient — the transaction cost is higher for you as the sender. Understanding script types also helps you understand why different wallet formats have different fee costs and privacy implications.

Part of The Bitcoin Encyclopedia 167 terms, plain English, no jargon.