Bitcoin YearsThe Atlas
Menu

Bitcoin Years › Tools › Cryptography Lab

Bitcoin Years · Interactive learning

Cryptography Lab

Learn the cryptography behind Bitcoin by experimenting. Each step is designed to be inspected, repeated, and verified against historical Bitcoin data.

Everything you enter stays in this browser tab. The experiments do not upload or store your inputs. Demonstration keys are not for funds.

  1. 01SHA-256Hash the genesis block header
  2. 02Merkle treeRebuild block 100,000’s Merkle root
  3. 03Elliptic curveCheck the numbers behind secp256k1
  4. 04KeysCheck Satoshi’s public key is on the curve
  5. 05SignaturesVerify Satoshi’s signature from block 170
  6. 06AddressesDerive the genesis address

The path ends with Satoshi’s own signature from block 170, checked in your browser.

01

SHA-256

A small change in the input creates a radically different fingerprint. Explore the hash function that secures Bitcoin's blocks.

Loading experiment…

Don't trust, verify

The genesis block header is 80 bytes. Double-hash it, reverse the digest bytes for display, and compare the result with the historical block identifier.

Technical details

SHA-256 pads a message, processes it in 512-bit blocks, and produces a 256-bit digest. Bitcoin's block identifier is the double-SHA-256 digest of the 80-byte block header, displayed with its bytes reversed.

A hash is not encryption: there is no decryption key and no practical inverse operation. A digest is deterministic, but finding an input for a chosen digest should be computationally infeasible.

References NIST FIPS 180-4 · Genesis block record

02

Merkle tree

See how transaction hashes combine into one compact commitment — and how one changed transaction changes the path to the root.

Loading experiment…

Don't trust, verify

Block 100,000 contains four transactions. Recompute its Merkle root from the four transaction IDs and compare the displayed root with the block's historical root.

Technical details

Leaves are transaction identifiers. Parent nodes are SHA256d(left || right), with child hashes in internal byte order. If a level contains an odd number of hashes, Bitcoin duplicates the final hash to make a pair.

Transaction IDs and Merkle roots are conventionally displayed byte-reversed. CVE-2012-2459 describes a duplicate-leaf ambiguity in Bitcoin's Merkle tree construction.

References Bitcoin white paper, §§7–8 · White paper archive record · CVE-2012-2459

03

Elliptic curve

Explore point addition and scalar multiplication, from a geometric curve to a small finite field.

Loading experiment…

Don't trust, verify

Bitcoin’s curve is defined by a handful of public numbers. Check two of its defining facts yourself: the prime is p = 2256 − 232 − 977, and the generator G really lies on y² = x³ + 7.

Technical details

For secp256k1, y² = x³ + 7 over the prime field modulo p. The group has order n and generator G. Public-key derivation is scalar multiplication Q = kG. The real-number drawing is only geometric intuition; finite-field points are discrete.

The small p = 97 implementation is educational code and is not Bitcoin cryptography. Its point arithmetic is isolated from the audited production API.

References SEC 2

04

Keys

Generate a temporary demonstration key and see how a public key is derived from it.

Loading experiment…

Don't trust, verify

The genesis block pays 50 BTC to a public key written in full, 65 bytes long. Check that Satoshi’s key is a genuine point on secp256k1, and that private key 1 maps exactly to G.

Technical details

A valid private key is an integer in the range 1 ≤ k < n. The public key is Q = kG. A compressed public key stores x and one parity bit for y; an uncompressed key stores both coordinates. BIP340 uses x-only public keys with an even-y convention.

The key generated here is a DEMO value. It remains in page memory and is sent to later modules only through the in-memory lab:key event. It is not suitable for funds.

References SEC 2

05

Signatures

Sign a message digest with ECDSA and Schnorr, then test both signatures and explore why nonce reuse is dangerous.

Loading experiment…

Don't trust, verify

On 12 January 2009, in block 170, Satoshi Nakamoto sent 10 BTC to Hal Finney. The signature that authorised it is still in the blockchain. Rebuild the exact bytes Satoshi signed, step by step, and check his signature with the same maths Bitcoin nodes use. Then flip one byte and watch it fail.

Technical details

ECDSA signatures are encoded as DER integers r and s. BIP340 Schnorr signatures are 64 bytes: R.x followed by s. ECDSA signing here uses RFC 6979 deterministic nonces; BIP340 signing mixes auxiliary randomness into nonce generation. Reusing or weakening a nonce can reveal a private key.

Transaction signatures commit to a sighash assembled from transaction data and the spending context. Wallet message-signing conventions such as BIP137 and BIP322 are distinct from transaction signing.

Linear Schnorr signatures enable key and signature aggregation (for example MuSig2) and batch verification. This is not a feature of ordinary ECDSA signatures.

References BIP 340 · BIP 137 · BIP 322 · MuSig2

06

Addresses

Derive familiar Bitcoin address formats, inspect every encoded part, and decode addresses offline.

Loading experiment…

Don't trust, verify

Derive the genesis P2PKH address from the public key in the historical coinbase output and compare it with the recorded address. The genesis output itself is P2PK, not P2PKH.

Technical details

P2PKH and P2SH use Base58Check. Native SegWit uses Bech32 for witness version 0 and Bech32m for later witness versions. Taproot addresses encode the tweaked output key, not the untweaked internal key.

Address encodings include checksums to detect transcription errors. They are not encryption and do not prove that an address belongs to a particular person.

Hash-based addresses hide the public key until they spend; Taproot outputs show a key from the start. How much bitcoin sits behind a visible key is tracked daily in The Quantum Ledger.

History: 1… P2PKH (2009); 3… P2SH under BIP16 (2012); bc1q… SegWit under BIP141/BIP173 (2017); bc1p… Taproot under BIP341/BIP350 (2021). See the BIP16, BIP141, BIP341, and BIP350 archive records.

References BIP 16 · BIP 141 · BIP 341 · BIP 350