P2PKH Overview
P2PKH: Pay-to-Public-Key-Hash (Legacy Addresses)
P2PKH (Pay-to-Public-Key-Hash) was the second major script type introduced to Bitcoin. It quickly became the standard for almost a decade and is the reason why most "Legacy" Bitcoin addresses start with the number 1.
1. Why Hash the Public Key?
As we saw in the P2PK module, locking coins directly to a public key had drawbacks:
-
Space: Public keys are 33-65 bytes.
-
Exposure: The public key is visible on the ledger before the coins are spent. P2PKH solves this by locking the coins to a 20-byte hash of the public key instead.
2. The Privacy Advantage
With P2PKH, your public key is only revealed to the world at the moment you spend your coins. Until then, anyone looking at the blockchain only sees a random-looking 20-byte hash. This adds a layer of "Quantum Resistance" and makes it slightly harder to link transactions before they occur.
3. Human-Readable Addresses
P2PKH introduced the concept of the Base58Check Address.
-
The 20-byte hash is combined with a version byte (
0x00) and a checksum. -
This is then encoded into a string that humans can easily copy and paste, such as
1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2.
4. The Standard for a Decade
From 2010 until the activation of SegWit in 2017, P2PKH was the dominant way to send and receive Bitcoin. Even today, billions of dollars worth of Bitcoin are stored in these legacy outputs.
| Feature | P2PK (Old) | P2PKH (Standard) |
|---|---|---|
| Identifier | Raw Public Key | 20-byte Hash (RIPEMD160) |
| Address Prefix | None | 1 |
| Data Size | ~65 Bytes | ~25 Bytes |
| Reveals Key on Receipt? | Yes | No |
In the next section, we will break down the ScriptPubKey Structure of P2PKH.
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: