2

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?

  • Did you mean P2SH instead of P2KH? – Adam Nov 29 '17 at 3:17
  • 1
    Or did you mean "P2PKH instead of P2PK"? – Pieter Wuille Nov 29 '17 at 3:32
5

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, which is no longer possible in Bitcoin Core since version 0.8.0

  • 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). – Pieter Wuille Nov 29 '17 at 3:37
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.