Pay-to-Public-Key-Hash (P2PKH)

2 min read

Pay-to-Public-Key-Hash (P2PKH) is a method used in Bitcoin transactions that allows bitcoin to be sent to the hash of the public key of another wallet’s public key, rather than directly to the public key. In a P2PKH transaction, the sender does not need to know the recipient’s actual public key. Instead, the sender uses a hash of the recipient’s public key. This hash acts as the address to which the sender will transfer the bitcoin. This address is what you commonly see and use in Bitcoin transactions. Additionally, the use of addresses makes transactions more user-friendly, as addresses are shorter than public keys. 

P2PKH is a type of ScriptPubKey that specifies that these bitcoin can only be spent by presenting a public key that matches the hash and a signature created by the corresponding private key. A public key hash is also known as an address, and P2PKH is the most common script type at present. P2PKH is similar to P2PK transactions, except that the bitcoin is locked to the hash of the public key rather than the public key itself.

An infographic comparing Pay-to-Public-Key-Hash (P2PKH) and Pay-to-Public-Key (P2PK) processes in cryptocurrency transactions.

If Alice wants to send 1 BTC to Bob in a P2PKH transaction, Bob provides Alice with an address from his wallet. Bob’s address is included in the transaction. When Bob tries to spend the bitcoin he receives, he must sign the transaction with the private key corresponding to the public key whose hash matches the hash provided in Alice’s transaction.