RoadmapsProjects
Sign in./start

Learn

RoadmapsProjects

Contribute

DiscoverIssues

Account

Sign in./start-building

Become an Open Source Builder. Learn. Build. Contribute.

Learn

RoadmapsProjectsStart Building

Contribute

DiscoverIssues

Account

Sign inDashboardSettings

Legal

PrivacyTerms

© 2026 Pull // all rights reserved

PrivacyTerms

lesson // bitcoin

Cryptography Primer

Hashes, key pairs, ECDSA, and Schnorr signatures in a Bitcoin context.

beginner5 days

Public lesson — sign in to track progress on this roadmap.

./sign-in

On this page

Learning objectives

  • Explain hashing and why Bitcoin uses SHA-256 and RIPEMD-160
  • Describe public-key cryptography and digital signatures
  • Contrast ECDSA and Schnorr at a builder level

study // plan

Lessons are primers. Depth comes from required reading, interactive labs, reflection, and a hands-on check with evidence — the BOSS study pattern.

Research on Bitcoin Search
BIP340Schnorr

Required reading

  • bookMastering Bitcoin

    Ch. 4: Keys and Addresses

    Start with private keys, public keys, and address encodings.

  • bookMastering Bitcoin

    Ch. 8: Signatures

    Read ECDSA vs Schnorr sections.

  • bipBIP-340 Schnorr

Interactive lab // Decoding Bitcoin

Open these Bitcoin Dev Project modules and tools before (or alongside) the graded lab. Capture evidence from the interactive path — do not only skim Pull.

  • Decoding Bitcoin: Hash functions

    Interactive hash playground — pair with the SHA-256 visualizer.

  • BDP: SHA-256 hashes visualizer

    Step through SHA-256 rounds visually (Hash Explained).

  • Decoding Bitcoin: Schnorr signatures

    Builder-level Schnorr before BIP-340.

  • Decoding Bitcoin: Nonce reuse attack

    Why ECDSA nonce reuse is catastrophic — matches a reflection prompt.

Reflection prompts

  1. Why is a digital signature not the same thing as encryption, and how does that show up in Bitcoin transactions?
  2. What goes wrong if an ECDSA nonce is reused, and how does Schnorr change the builder mental model?
  3. After reading BIP-340, what one property of Schnorr would you explain to a wallet engineer in two sentences?

Lab // Hash demo + interactive crypto

Use Decoding Bitcoin's hash-functions tool (and/or the BDP SHA-256 visualizer), then hash a known string locally and inspect a throwaway testnet/regtest address. Never reuse that key.

evidence required

  • ·Screenshot or notes from Decoding Bitcoin hash functions (or hashes visualizer)
  • ·SHA-256 digest of a known string (show input + output)
  • ·Address or pubkey you derived for lab-only use
  • ·Note confirming the key material was discarded

Bitcoin does not “store passwords on the blockchain.” Ownership is proven with cryptography: one-way hashes and signatures that anyone can verify, but only the key holder can create.

Why this matters

Every wallet bug that loses funds usually traces back to misunderstanding keys, hashes, or signatures. You do not need a PhD, you need clear mental models.

Analogy

A hash is like a fingerprint of data: same input → same fingerprint; tiny change → totally different fingerprint; fingerprint does not reveal the original.

A digital signature is like a wax seal: anyone can check the seal matches the letter and the author’s public stamp, but only the author has the private seal.

Hashes in Bitcoin

Bitcoin leans on SHA-256 and RIPEMD-160 (often as HASH160 = RIPEMD160(SHA256(x))). Hashes identify transactions, blocks, and scripts. They also commit to data without revealing it early (for example, Lightning payment hashes).

// Conceptual, use audited libraries in production
type Hash256 = string; // 32-byte digest hex
 
function commitsTo(data: Uint8Array, digest: Hash256): boolean {
  // true if sha256(data) === digest
  return true;
}

Keys and signatures

Loading diagram…

Signing uses the private key; verification uses the public key and message.

Bitcoin historically used ECDSA on the secp256k1 curve. Taproot prefers Schnorr signatures (BIP-340): smaller, linear (friendly to aggregation), and cleaner security proofs.

Never invent crypto

Do not roll your own key derivation, RNG, or signature code. Use battle-tested libraries (secp256k1, bitcoinjs-lib, rust-bitcoin, BDK). A one-line RNG mistake can leak keys.

What builders must remember

  1. Private keys are secrets, treat them like cash and passwords combined.
  2. Public keys and addresses are safe to share for receiving.
  3. Signatures authorize specific messages (transaction sighashes), not blank checks.
  4. Hash collisions are astronomically unlikely for SHA-256 in practice; treat digests as unique IDs.

Common mistakes

  • Confusing encryption (hiding data) with signatures (proving authorship)
  • Reusing nonces in ECDSA (catastrophic key leaks historically)
  • Assuming “hashed” means “secret”, hashes of low-entropy secrets can be guessed

Worked mental model

Re-read the diagrams in this lesson once out loud in plain language. If you cannot explain the flow to a friend without jargon, pause and revisit Mastering Bitcoin / Mastering Lightning chapters linked in Resources. Chapter references are intentional, not decorative.

Hands-on habit

Every protocol idea should be paired with one local experiment:

  1. Reproduce the happy path on regtest (or Polar for Lightning)
  2. Break it on purpose (wrong fee, expired invoice, offline peer)
  3. Write down what error you saw and which layer produced it (wallet, node, mempool, peer)

That habit turns reading into builder instinct.

Glossary check

Pick three terms from this lesson and define them in one sentence each without opening notes. Weak definitions mean the lesson is not finished yet.

Resource order

Use Resources in order: narrative book chapter first, then BIP/BOLT for precision, then implementation docs for commands. Jumping straight to RPC flags without the mental model creates brittle knowledge.

Next steps

With crypto intuition in place, learn Bitcoin’s economic incentives, supply, fees, and why miners secure the chain, then dive into UTXOs.

progress // sign in

Reading is public. Sign in to mark lessons complete, sync across devices, and unlock your roadmap.

./sign-in-to-track
prevGit & Open Source WorkflownextBitcoin Economics

On this page

Press Shift + ? for keyboard shortcuts.

Press R to research on Bitcoin Search.