— —
Follow on X
LESSONS

Private keys: 256 bits of randomness

A private key is a random number between 1 and about 1.16 × 10⁷⁷. Its security rests entirely on the randomness that made it.

6 MIN READ
There are 2 to the 256 possible private keys.
LEVEL · Advanced
IN THIS LESSON · 1 OF 8
BY THE END YOU WILL BE ABLE TO ANSWER
  • What is a private key, fundamentally?
  • What is the realistic threat to a private key?
  • A private key is 256 bits. How many hexadecimal characters is that? (Each hex character is 4 bits.)

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

A private key is nothing more than a number: a random integer between 1 and n − 1, where n is the order of the secp256k1 curve, just under 2²⁵⁶. Written in hexadecimal it is 64 characters. That is all. There is no registry of keys; nobody issues them. You pick a number, and if it is random enough, nobody else will ever pick the same one.

Why 256 bits is enough

2²⁵⁶ is about 1.16 × 10⁷⁷. If every computer on Earth tried a billion keys a second for the age of the universe, it would cover a negligible fraction of the space. Brute force is not a threat. Bad randomness is. A key generated from a weak source (a predictable function, a phrase you chose, a website) can be found by guessing what the source produced. Several thefts have come from exactly that.

Generating one

  • Coin flips. 256 flips, written as binary, converted to hex. Slow and genuinely random.
  • Dice. 99 rolls of a six-sided die gives enough entropy for a 24-word seed; some hardware wallets accept dice input.
  • A hardware wallet's secure chip, which combines a hardware random source with other inputs. This is the normal case.
  • Never a website or a brain wallet. Anything typed by a human is guessable.

Formats you will see

  • Hex: 64 characters, e9873d79c6d87dc0....
  • WIF (Wallet Import Format): Base58 with a version byte and checksum, starting with 5, K or L. Used for importing single keys.
  • Seed phrase: not a key, but the entropy from which many keys are derived (lesson 6).
99
dice rolls: enough entropy for a 24-word seed, with no computer involved
MINI CHALLENGEBits to hex

A private key is 256 bits. How many hexadecimal characters is that? (Each hex character is 4 bits.)

characters
CHECK YOURSELF
1/2 What is a private key, fundamentally?
2/2 What is the realistic threat to a private key?
pick an answer for each question

SOURCES

  1. Learn Me A Bitcoin: Private key
Progress is saved in this browser only.