— —
Follow on X
LESSONS

Keys, hashes and signatures

Outputs are locked to keys. A signature proves the holder authorised one exact transaction without revealing the key. Hashes tie everything together.

6 MIN READ
An output locked to a public key hash is unlocked by a signature that nodes verify with the public key.
LEVEL · Intermediate
IN THIS LESSON · 3 OF 9
BY THE END YOU WILL BE ABLE TO ANSWER
  • What does a digital signature prove?
  • Can a public key be used to derive the private key?

Then prove it: a 2-question quiz. The lesson marks itself complete at 100%.

Two pieces of cryptography do almost all the work in Bitcoin: hash functions and digital signatures. Neither is encryption; nothing on the chain is hidden.

Hashes

A hash function turns any input into a fixed-size fingerprint. Bitcoin uses SHA-256, which produces 256 bits (64 hex characters). Change one character of the input and the whole output changes. You cannot work backwards from a hash to its input. Hashes give every transaction and block an ID, link blocks together, and set the mining puzzle.

Keys

A private key is a random 256-bit number. From it, elliptic-curve math (the curve is called secp256k1) produces a public key. The step is one-way: easy forward, infeasible backward. An address is a hashed, encoded form of the public key.

Signatures

When you spend an output, your wallet signs the transaction with the private key. The signature is specific to that exact transaction: change one byte and it fails. Anyone can verify the signature using only the public key, which is why nodes can check your payment without knowing your key. Bitcoin used ECDSA from the start and added Schnorr signatures with Taproot in 2021.

Locks

Each output carries a small script, the locking script, that says how it may be spent. The common one says "whoever provides a signature matching this public key hash". Other scripts require several signatures, or a timelock, or a secret. Script is deliberately simple so nodes can always evaluate it quickly and predictably.

Bitcoin Explained Simply · Keys and signatures in contextWatch on YouTube ↗

Tap a card to flip it.

CHECK YOURSELF
1/2 What does a digital signature prove?
2/2 Can a public key be used to derive the private key?
pick an answer for each question

SOURCES

  1. Learn Me A Bitcoin: How does Bitcoin work?
Progress is saved in this browser only.