Overview
Pay-to-Public-Key-Hash (P2PKH) was the first widely used Bitcoin address format and remains supported by all Bitcoin software. A P2PKH output locks funds to the hash of a public key, requiring the spender to reveal the full public key and produce a valid signature to unlock the funds.
How P2PKH Works
The locking script (scriptPubKey) contains the hash of the recipient's public key. To spend, the owner provides the actual public key and a signature in the unlocking script (scriptSig).
Locking Script (scriptPubKey):
OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
Unlocking Script (scriptSig):
<signature> <publicKey>
Validation Flow:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Duplicate │───>│ Hash the │───>│ Compare to │
│ public key │ │ public key │ │ stored hash │
└──────────────┘ └──────────────┘ └──────┬───────┘
│ Match?
┌──────▼───────┐
│ Verify sig │
│ against key │
└──────────────┘
Address Format
P2PKH addresses are encoded using Base58Check and always begin with the character 1 on mainnet. For example: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa (the Genesis Block address).
Why P2PKH Over P2PK
Early Bitcoin transactions used Pay-to-Public-Key (P2PK), which locked directly to the full public key. P2PKH improved on this by hashing the public key, providing two benefits: shorter addresses and an additional layer of quantum resistance, since the public key is only revealed when spending.
Modern Usage
While P2PKH still works perfectly, newer formats like P2WPKH (native SegWit) and P2TR (Taproot) are preferred because they offer lower transaction fees and better privacy. Most wallet software now defaults to SegWit or Taproot addresses, but P2PKH remains important for backward compatibility.