Reviewed Aug 2026
DE
BA-06 · LESSON 09

P2PK, P2PKH, P2MS, P2SH, and OP_RETURN

KEY DEFINITIONS

Terms used in this lesson

P2PK
Pay to Public Key, an early Bitcoin output template that places a complete public key in the locking script.
P2PKH
Pay to Public Key Hash, a legacy Bitcoin output template that commits to the hash of a public key.
P2MS
Pay to Multisig, a Bitcoin Script template that requires a stated number of signatures from a list of public keys.
P2SH
Pay to Script Hash, a legacy Bitcoin output template that commits to a redeem script.
OP_RETURN
A Bitcoin Script operation commonly used to create an unspendable output carrying a small amount of data.
ASM
Assembly-style text that writes Bitcoin Script operations and pushed data in a human-readable order.
Hash160
SHA-256 followed by RIPEMD-160, producing the 20-byte hash used by several Bitcoin spending conditions.
CHECKSIG
The Bitcoin Script operation that checks whether a signature is valid for the required public key and transaction message.
DUP
The short operation name for copying the top Bitcoin Script stack item.
EQUALVERIFY
The short operation name for comparing two Bitcoin Script values and failing immediately when they differ.
CHECKMULTISIG
The Bitcoin Script operation that checks a threshold number of ordered signatures against a list of public keys.
EQUAL
The short operation name for comparing two Bitcoin Script byte strings and pushing true or false.
UTXO
Unspent transaction output: one discrete chunk of bitcoin that can be used as a transaction input.

Compare the exact assembly, serialized bytes, spend data, standard uses, and failure boundary for Bitcoin's classic Script templates.

35 min Difficulty 2/5 Not started

Loading lesson visuals...

01

Learn the idea

Bitcoin's classic output templates are exact scripts, not address labels. P2PK locks directly to a public key. P2PKH commits to a public-key hash. P2MS places a visible multisignature threshold in Script. P2SH commits to the HASH160 of a redeem script. OP_RETURN makes its output provably unspendable and carries bounded application data under relay policy.

GUIDED EXPLANATION1/5 ideas inspected
1

Execute P2PK and P2PKH

P2PK is <pubkey> CHECKSIG. P2PKH is DUP HASH160 <20-byte key hash> EQUALVERIFY CHECKSIG and is spent with a signature plus matching public key.

Inspect each idea before the worked example.
The worked example follows the explanation

Inspect every idea above to open it.

Important distinctionP2SH makes any redeem script valid as long as its address checksum is correct.

The address helps construct a hash commitment. Spending still requires the exact redeem script to match that hash and then execute successfully.

02
FINISH LEARNING FIRST

The questions unlock after every required learning activity

Inspect every guided idea, open the worked example, rebuild its mechanism, and complete the deterministic lesson tool. Your progress is saved automatically.