Quantum Security: P2PK vs. P2PKH
Quantum Security: P2PK vs. P2PKH
One of the most fascinating technical differences between P2PK and the later P2PKH standard is how they handle the visibility of the public key. This has significant implications for Quantum Resistance.
1. The Elliptic Curve Weakness
Bitcoin uses the secp256k1 elliptic curve. While extremely secure today, a powerful enough quantum computer could theoretically use Shor's Algorithm to derive a private key from a public key.
- To do this, the quantum computer must know your public key.
2. P2PK: Exposed from Birth
In P2PK, the public key is written directly into the ScriptPubKey.
-
As soon as you receive a P2PK payment, your public key is published to every node in the world.
-
A quantum attacker would have years to work on breaking your specific key while the coins sit unspent.
3. P2PKH: Hidden Behind the Hash
In P2PKH, the ScriptPubKey contains a Hash of your public key.
-
Bitcoin uses SHA256 and RIPEMD160 for this hash.
-
Hashing is considered "Quantum Resistant." Even a quantum computer cannot easily reverse a hash to find the original public key.
-
Your public key is only revealed to the network at the moment you spend the coins.
4. The Race to Spend
In a quantum world, a P2PKH user only faces a "Race Condition."
-
User broadcasts a transaction, revealing their public key.
-
A quantum attacker sees the public key and tries to derive the private key before the transaction is mined (usually within 10 minutes). For a P2PK user, the attacker doesn't have to race; they can take as long as they want.
| Script Type | Public Key Reveal | Quantum Risk Level |
|---|---|---|
| P2PK | At time of Receipt | High |
| P2PKH | At time of Spending | Moderate |
In the next section, we will look at P2PK in Coinbase Transactions.
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: