BOMBARCHIVE
Explore

A living reference collection. Written in the wiki, preserved in Git.

The archiveBitcoin

Pay-to-public-key-hash

Pay-to-public-key-hash (P2PKH) is a Bitcoin output-script form that commits to the 20-byte hash of a public key rather than placing the key in the output. A typical P2PKH spend supplies a public key matching that hash and a valid signature. This mechanism and its Base58Check receiving-address representation are visible in the early Bitcoin client, alongside the distinct pay-to-public-key (P2PK) form. Original script templates and signing routine · Original address encoding

The spending condition

The standard legacy pattern is:

P2PKH output: OP_DUP OP_HASH160 <20-byte key hash> OP_EQUALVERIFY OP_CHECKSIG
P2PKH input:  <signature> <public key>

In serialized form a conventional P2PKH locking script is 25 bytes: 76 a9 14, the 20-byte hash, then 88 ac. The hash is RIPEMD160(SHA256(public key bytes)), often called HASH160. The early source implements this composition explicitly. Original HASH160 function · Original template recogniser

When the spender supplies a signature and public key, OP_DUP copies the key, OP_HASH160 hashes the copy, and OP_EQUALVERIFY demands that the result equal the committed 20-byte value. OP_CHECKSIG then verifies the signature against the supplied key and the signed transaction data. The hash comparison alone is not spending authorization. The original wallet's signing solver distinguishes P2PK's signature-only input from P2PKH's signature-and-public-key input. Original signing paths · Bitcoin developer guide — later explanation

The output does not contain a Bitcoin address as text, and a public-key hash is not a username or a person's name. Its purpose is to specify a cryptographic spending condition.

A receiving address in the early client

Bitcoin v0.1.5's base58.h defines PubKeyToAddress() as a hash of the public key followed by Hash160ToAddress(). That second function prepends a version byte of zero to the 20-byte hash and applies Base58Check, including a four-byte checksum. This accounts for the familiar legacy mainnet addresses beginning with 1. The version byte and checksum belong to the wallet-facing encoding; they are not included in the P2PKH output script. Bitcoin v0.1.5 — address functions · Original Base58Check implementation

The original Base58 comments explain the alphabet's avoidance of visually confusable characters and punctuation awkward in email or text selection. They also call the receiving strings account numbers. That is the software's own period terminology, not evidence that Bitcoin stored account balances rather than outputs. Bitcoin address follows the larger history of address encodings. Original design comments

Most importantly, this was not merely an unused format recognised by a script parser. The v0.1.5 interface populated its main receiving-address field from the default wallet public key, and its New Bitcoin Address control generated a new key and derived a receiving address. The send dialog explicitly invited users to enter a Bitcoin address if the recipient was offline. On that path, ui.cpp decoded the address to its 20-byte hash and constructed a P2PKH output script before calling SendMoney(). This is direct implementation evidence for a user-facing P2PKH payment path in the early client. Default receiving address · Address-payment construction · New-address control · Send-dialog text

The early interface presented another route, sending to a recipient's IP address while the recipient was online. In that route the sender connected to the recipient and requested a scriptPubKey through a message exchange rather than decoding a Base58 address. The existence of two interface paths must not be collapsed into two separate consensus currencies, nor does surviving interface code establish how frequently either route was used. Address versus IP path · Network-assisted payment path

IP transactions follows that separate route through its checkorder and submitorder messages, the 2010 decision to make receiving opt-in, and the 2011–2013 withdrawal of its wallet and protocol components. The recipient's original response was a P2PK locking script, not an ordinary P2PKH output, and the network connection did not authenticate the key's intended owner. Original receive path · Contemporary security discussion

Why the early chain can still show P2PK

The same tagged software built coinbase outputs using <public key> OP_CHECKSIG. Its ordinary transaction builder also sent change back through a P2PK output, selecting a public key from the wallet's existing coins. A comment suggested later randomisation of output ordering and a fresh change key, but the code shown did not yet implement that plan. Original mining output · Original change construction

Thus a payment to a Bitcoin address could produce a P2PKH output, while change in the same transaction could be P2PK. The availability of a receiving-address feature does not show that every output used it.

The ordinary transaction recorded in block 170 on 12 January 2009 illustrates the danger of reading modern address labels backwards: its 10 BTC and 40 BTC outputs are both 67-byte P2PK scripts, although explorers may display derived Base58 addresses for them. It is not an example of a P2PKH output. First Bitcoin transaction documents the raw-byte check and its limits. Historical transaction record · Pay-to-public-key

What became standard, and what changed later

In December 2010, Bitcoin's IsStandard() relay-and-mining policy whitelisted recognised transaction templates. Its solver still recognised both P2PK and P2PKH. The whitelist did not introduce P2PKH into consensus, and an output policy change must not be mistaken for the first possible date of a valid output script. Transaction standardness reconstructs the original change and its contested immediate rationale. Bitcoin v0.3.18 — templates · Transaction standardness

The P2PKH output is smaller than the common original 67-byte uncompressed P2PK output, but its ordinary spending input includes the public key as well as the signature. Output size alone is therefore not a complete measure of total transaction cost. Bitcoin-Qt 0.6.0, released 30 March 2012, announced that new wallets would use 33-byte compressed public keys instead of 65-byte keys. That is a dated wallet implementation and release milestone, not the creation of P2PKH. Bitcoin-Qt 0.6.0 — original release notes

P2PKH also should not be conflated with the 2012 P2SH consensus upgrade, which validates spending of a script hash through different rules. Segregated Witness later introduced P2WPKH, a witness-program form with a related public-key-hash spending requirement but different serialization and signature rules. Taproot's key-path and script-path rules are different again. The fact that these mechanisms all support key-authorized spending does not make their output encodings interchangeable. BIP 16 — P2SH · BIP 141 — witness programs · BIP 341 — Taproot

The later wallet history also has to be dated carefully. Bitcoin Core 0.20.0, released 3 June 2020, says its wallet by default uses Bech32 addresses when using RPC and creates native SegWit change outputs. That statement concerns that implementation and those interfaces; it does not measure global P2PKH usage or make existing P2PKH outputs invalid. Bitcoin Core 0.20.0 — wallet release notes

Public keys, privacy and evidence

An unspent ordinary P2PKH output contains the hash of a public key, not that public key. A normal spend reveals the public key in scriptSig. However, another transaction may already have revealed the same key, especially when an address or key has been reused. The hash by itself neither proves that the key has never been exposed nor guarantees privacy, quantum resistance, or the human identity of a controller. Those are further claims requiring their own evidence.

For Ordinals and Bitmap, an indexer can associate an inscription-bearing output or a district holding with an address-like destination. The durable Bitcoin record is still the output and its script, and the indexer's address is an interpretation of that record. The wallet's derived address labels, Bitcoin's actual spend conditions and a claim about a person's ownership are three different things. Bitcoin address explains why the distinction extends beyond P2PKH.

Source status and unresolved work

The tagged v0.1.5 source is a direct surviving implementation record, establishing what the code was written to do. It is not a measurement of network adoption, a compiled-client execution trace, or proof of the first P2PKH output actually mined. The block-170 record is on-chain historical material checked against a later serialization, while the Bitcoin-Qt and Bitcoin Core release notes are dated first-party software announcements. BIPs describe later protocol changes, not the creation date of an earlier mechanism.

Open question
Identify the earliest independently verified P2PKH output and first confirmed P2PKH spend in the canonical chain. Confirm each directly from transaction script bytes rather than address labels, and separate those milestones from the earliest published source.
Open question
Compare the earliest released Bitcoin 0.1.0 source with v0.1.5 for the complete address-payment and IP-payment flows, preserving archive provenance rather than assuming that the later tag proves every detail of the initial binary.
Open question
Trace how P2PKH, P2PK and later witness output types were actually used over time using reproducible block-level measurements, separately from wallet defaults and press accounts.