Standard Script Types
Standard Script Types
While Bitcoin Script is flexible, most nodes will only relay "Standard" transactions. There are five main types of ScriptPubKey patterns used today.
1. P2PKH (Pay-to-Public-Key-Hash)
The most common legacy format (Addresses starting with 1).
-
Pattern:
OP_DUP OP_HASH160 <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG -
Logic: It hashes the provided public key and checks if it matches the hash in the lock, then verifies the signature.
2. P2SH (Pay-to-Script-Hash)
Used for Multi-sig and SegWit (Addresses starting with 3).
-
Pattern:
OP_HASH160 <ScriptHash> OP_EQUAL -
Logic: Instead of locking to a public key, it locks to the hash of a different script. The spender must provide that original script to unlock it.
3. P2WPKH (Pay-to-Witness-Public-Key-Hash)
Native SegWit (Addresses starting with bc1q).
-
Pattern:
0 <PubkeyHash> -
Logic: A very short script. The
0is the "Witness Version," and the hash follows it. This signals nodes to look in the Witness Field for the key.
4. P2TR (Pay-to-Taproot)
The latest upgrade (Addresses starting with bc1p).
-
Pattern:
1 <32-byte Schnorr Pubkey> -
Logic: Uses Schnorr signatures and Merkleized Abstract Syntax Trees (MAST) to hide complex scripts as simple keys.
Summary Table
| Type | Script Pattern (Simplified) | Address Prefix |
|---|---|---|
| P2PKH | 76a914...88ac |
1 |
| P2SH | a914...87 |
3 |
| P2WPKH | 0014... |
bc1q |
| P2TR | 5120... |
bc1p |
In the next section, we will discuss the special OP_RETURN script used for data.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: