<blockquote>
  <p>Pubkey scripts are created by spenders who have little interest what
  that script does. Receivers do care about the script conditions and,
  if they want, they can ask spenders to use a particular pubkey script.
  Unfortunately, custom pubkey scripts are less convenient than short
  Bitcoin addresses and there was no standard way to communicate them
  between programs prior to widespread implementation of the BIP70
  Payment Protocol discussed later.</p>
  
  <p>To solve these problems, pay-to-script-hash (P2SH) transactions were
  created in 2012 to let a spender create a pubkey script containing a
  hash of a second script, the redeem script.</p>
  
  <p>The basic P2SH workflow, illustrated below, looks almost identical to
  the P2PKH workflow. </p>
</blockquote>

<p>Read More <a href="https://bitcoin.org/en/developer-guide#p2pkh-script-validation" rel="nofollow noreferrer">Bitcoin.org</a></p>

CC BY-SA 3.0
2017-11-29T03:25:12.880Z
2017-11-29T03:25:12.880Z
Tailer
<p>Both P2PK and P2PKH were part of the first bitcoin 0.1 release, so that second point isn't true.</p>

<p>P2PKH is theoretically safer because the pubKeyScript only reveals the hash of the public key rather than the public key itself (which only matters in the case that the elliptic curve crypto involved is broken). So as long as you don't reuse the address, no-one else will know the public key before the money is spent.</p>

<p>All bitcoin addresses encode public key hashes so only P2PKH can be used with an address, as the public key is not known. P2PK were mainly designed for <a href="https://en.bitcoin.it/wiki/IP_transaction" rel="nofollow noreferrer">IP-to-IP payments</a>, which is no longer possible in Bitcoin Core since version 0.8.0</p>

CC BY-SA 3.0
2017-11-29T03:37:47.473Z
Pay to IP was disabled by default in 0.3.20 (feb 2011!). It was only some leftover code that was removed two years later in 0.8.0 (feb 2013).
Pieter Wuille
CC BY-SA 3.0
2017-11-29T03:18:54.103Z
2018-02-19T19:54:42.423Z
2018-02-19T19:54:42.423Z
meshcollider
<p>Does P2PKH substitute P2PK in any circumstances? Why? I know address(public key hash) was invented later than the official implementation released. Is it the reason?</p>

CC BY-SA 3.0
2017-11-29T03:17:02.843Z
Did you mean P2SH instead of P2KH?
Tailer
CC BY-SA 3.0
2017-11-29T03:32:33.160Z
Or did you mean "P2PKH instead of P2PK"?
Pieter Wuille
<bitcoin-core>
Does P2PKH substitute P2PK in any circumstances? Why?
Anderson
# Does P2PKH substitute P2PK in any circumstances? Why?

(Asked by: username_0 on 2017-11-29)

Does P2PKH substitute P2PK in any circumstances? Why? I know address(public key hash) was invented later than the official implementation released. Is it the reason?

**Tags:** bitcoin-core

> **Comments:**
> **username_1**: Did you mean P2SH instead of P2KH?  
> **username_2**: Or did you mean "P2PKH instead of P2PK"?  

---

## 2 answers

### Answer by username_3 on 2017-11-29. Score: 6 | Accepted answer

Both P2PK and P2PKH were part of the first bitcoin 0.1 release, so that second point isn't true.

P2PKH is theoretically safer because the pubKeyScript only reveals the hash of the public key rather than the public key itself (which only matters in the case that the elliptic curve crypto involved is broken). So as long as you don't reuse the address, no-one else will know the public key before the money is spent.

All bitcoin addresses encode public key hashes so only P2PKH can be used with an address, as the public key is not known. P2PK were mainly designed for [IP-to-IP payments](https://en.bitcoin.it/wiki/IP_transaction), which is no longer possible in Bitcoin Core since version 0.8.0

> **Comments:**
> **username_2**: Pay to IP was disabled by default in 0.3.20 (feb 2011!). It was only some leftover code that was removed two years later in 0.8.0 (feb 2013).  

---

### Answer by username_1 on 2017-11-29. Score: 0

> Pubkey scripts are created by spenders who have little interest what
> that script does. Receivers do care about the script conditions and,
> if they want, they can ask spenders to use a particular pubkey script.
> Unfortunately, custom pubkey scripts are less convenient than short
> Bitcoin addresses and there was no standard way to communicate them
> between programs prior to widespread implementation of the BIP70
> Payment Protocol discussed later.
>
> To solve these problems, pay-to-script-hash (P2SH) transactions were
> created in 2012 to let a spender create a pubkey script containing a
> hash of a second script, the redeem script.
>
> The basic P2SH workflow, illustrated below, looks almost identical to
> the P2PKH workflow.

Read More [Bitcoin.org](https://bitcoin.org/en/developer-guide#p2pkh-script-validation)


---

