P2PKH

From Trezor Wiki
Jump to: navigation, search

Pay-to-Public-Key-Hash (P2PKH) is the basic type of transaction used in Bitcoin and other similar cryptocurrencies.

See also BIP44

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 Bitcoin transaction with one P2PKH input and two P2PKH outputs in blockchain explorer, or view it in script viewer

To understand how transactions work on basic technical level, check blog post Types of Bitcoin transactions: Part I, Part 2. More detailed description can be found in Bitcoin Wiki or in Bitcoin.org Developer guide.

Address and version bytes

A P2PKH address is an base58check-encoded form of a public key hash prefixed by corresponding version bytes:

P2PKH address = Base58Check ( <versionBytes> <publicKeyHash> )

Version bytes for P2PHK addresses are listed in Trezor coins definitions under address_type field of a particular JSON file. For example in Bitcoin, P2PKH addresses start with "1" (version bytes 0), while in Litecoin they start with "L" (version bytes 48) etc.

Trezor support

Trezor supports P2PKH transactions in general. In Trezor Wallet, P2PKH transactions are supported and organized using BIP44.