My First Bitcoin Donate

Empowering Educators

How a Private Key is Born

Every Bitcoin wallet starts with one random number, 256 bits pulled straight from your operating system's entropy pool. Watch the full journey, step by step.

secp256k1 curve order

n = FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

Your private key must be in range [1, n−1]. That's 2256 − ~4 billion possible values.

01
OS Entropy Pool
getRandomValues(buffer)
CPU jitter Keystrokes Mouse timing Thermal noise Interrupt timing

Your OS collects true physical randomness from hardware events and feeds it into a CSPRNG, a Cryptographically Secure Pseudo-Random Number Generator. The same source Bitcoin wallets rely on.

02
Sample 32 Bytes
crypto.getRandomValues(new Uint8Array(32))

256 bits of raw entropy: one byte per cell. Brighter orange = higher value.

32 bytes × 8 bits = 256 bits of entropy

02
Sample 4 Bytes
crypto.getRandomValues(new Uint8Array(4))

32 bits of raw entropy, enough to map into any range up to ~4 billion values.

03
Assemble 256-Bit Integer
BigInt('0x' + hexString)

Concatenate all 32 bytes into one enormous number. In hex: 64 characters. In binary: 256 cells.

—
Decimal —
03
Read as 32-Bit Integer
DataView.getUint32(0, false)

The 4 raw bytes are read as one big-endian unsigned 32-bit integer (0–4,294,967,295).

Hex

—

Decimal

—

04
Validate vs secp256k1
1 ≤ k < n

The number must be at least 1 and less than the curve order n. Probability of failure is ~1 in 2128, wallets simply retry if it ever happens.

04
Scale to Your Range
u32 % range + min

Modulo maps the large uint32 into your chosen range, giving a uniform distribution.

05
Your Private Key
k (64-char hex)
—

Do not use this key. It was generated in your browser for this demo only, not with a secure, audited process, and is for educational purposes only. In a real wallet, a private key is stored encrypted, never shared, and anyone with it controls all funds at derived addresses forever.

05
Your Number
result = min + (u32 % range)
—

Hex

—

Binary

—

06
What Comes Next
pubKey = privKey × G (mod p)

Public Key

Multiply private key by generator point G on the curve. One-way, impossible to reverse.

Address

Hash the public key (RIPEMD160 ∘ SHA256). Share this with the world to receive Bitcoin.

HD Wallets

BIP32/BIP39 derives all keys from one root seed via HMAC-SHA512. Your 12-word phrase encodes this seed.

Why 256 Bits?

A 256-bit key has 2256 possible values: roughly 1077. If every computer ever built ran for the age of the universe guessing keys, they'd cover a tiny fraction of the space. Security comes from the size of the search space, not from hiding the algorithm.

Bitcoin uses secp256k1 elliptic curve cryptography. Your private key is the exponent; your public key is a point on the curve. The math is one-way, trivial forward, impossible backward.

2256

Possible Keys

More than atoms in the observable universe

~1050

Atoms on Earth

For scale: the search space dwarfs this

CSPRNG

OS Supplied

Not Math.random(), real hardware entropy

secp256k1

The Curve

Chosen by Satoshi; used in every Bitcoin wallet

Classroom Demo Ideas

Raffle

Random Draw

Switch to Custom Range, set 1–30 (class size), hit Generate. The result is provably fair: no teacher influence possible.

Key Sim

Private Key Demo

Run Bitcoin mode. Ask students: "If I generate again, will any of those 64 hex chars repeat?" (Almost certainly not, ever.)

Entropy

What is Randomness?

List hardware events that feed entropy. Compare to dice, why are dice weak entropy? (Only 2.6 bits per roll.)