Pay-to-Public-Key-Hash (P2PKH) is a method of sending bitcoin to a specific address. In this method, instead of sending money to a public key, as in P2PK transactions, a hash of the public key is used.
You know how you have an address to receive mail at your house? P2PKH is like a digital address where people can send bitcoin to, but instead of your name and address, it uses a long string of numbers and letters. This is called a "hash", and it helps keep your information private.
By using the hash of the public key rather than the public key itself, P2PKH enchances bitcoin security. This is because the hash is secured by SHA-256 encryption. Currently no known quantum algorithms can break the SHA-256 encryption. This means that even if a quantum computer were to be used to try to derive the private key from the public key, it would not be able to do so because the public key is not visible on the blockchain, only its hash is.
In the context of P2PKH, SHA-256 is used to create a hash of the public key. This hash is then used in the
ScriptPubKey of the P2PKH transaction. A scriptPubKey is a script that is included in the output of a transaction. It sets the rules that must be satisfied in order to use the funds related to that output.
In P2PKH, the scriptPubKey contains the hash of the public key, while the ScriptSig includes the signature and the public key. The public key is only visible on the blockchain when the coins are spent, and not when they are received.
It is one of the most commonly used transaction types in bitcoin transactions.
P2PKH addresses start with a "1"
A closer look at transaction scripts
An output that pays to a P2PKH scriptPubKey is spent by an input with a simple scriptSig that provides public key and the corresponding signature:
scriptPubKey: OP_DUP OP_HASH160 <publicKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig: <signature> <publicKey>
Check out the following example of a Bitcoin transaction with one P2PKH input and two P2PKH outputs on the blockchain explorer.
To learn even more about how bitcoin transactions work check out this blog post on types of bitcoin transactions: Part I, Part 2.
More detailed information can be found on the Bitcoin Wiki or in Bitcoin.org Developer guide.