Reviewed Aug 2026
DE
BA-04 · LESSON 10

Private keys, public keys, and key hashes

KEY DEFINITIONS

Terms used in this lesson

Hash160
SHA-256 followed by RIPEMD-160, producing the 20-byte hash used by several Bitcoin spending conditions.
P2PKH
Pay to Public Key Hash, a legacy Bitcoin output template that commits to the hash of a public key.
P2WPKH
Pay to Witness Public Key Hash: a native SegWit output for one public-key hash.
SHA-256
A cryptographic hash function used throughout Bitcoin to produce fixed-size 256-bit digests.
RIPEMD-160
A 160-bit cryptographic hash function used in Bitcoin’s HASH160 construction.
Witness
Signatures, scripts, or other data supplied to satisfy a Bitcoin output’s spending condition.

Inspect valid scalar bounds, compressed curve points, public-key hashes, authorization, and the difference between a key, address, script, and spendable output.

45 min Difficulty 2/5 Not started

Loading lesson visuals...

01

Learn the idea

A Bitcoin private key is an integer from 1 through the secp256k1 group order minus 1. The corresponding public key is the curve point produced by scalar multiplication. A compressed public key is exactly 33 bytes: a 02 or 03 parity prefix followed by the 32-byte x coordinate. HASH160 of those serialized bytes is a separate 20-byte commitment commonly used by P2PKH and P2WPKH.

GUIDED EXPLANATION1/5 ideas inspected
1

Validate the private scalar

Zero, the group order, larger integers, and malformed byte lengths are invalid. Secure wallet software samples or derives a uniformly unpredictable valid scalar without modulo bias.

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

Inspect every idea above to open it.

Important distinctionA public-key hash is a shorter public key that can verify signatures by itself.

The hash is a commitment. The spend reveals a public key whose serialization must match the hash, then signature verification uses the full point.

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.