MASTERING-BITCOIN

The Unbreakable Math Behind Bitcoin

IKey Formulas Reference

Formula Name Meaning
y2=x3+7(modp)y^2 = x^3 + 7 \pmod{p} secp256k1 curve Bitcoin's elliptic curve over a finite field
K=kβ‹…GK = k \cdot G Public key from private key Scalar multiply the generator GG by private scalar kk
2256β‰ˆ10772^{256} \approx 10^{77} Private key space size Comparable to the number of atoms in the observable universe (∼1080\sim 10^{80})
P3=P1+P2P_3 = P_1 + P_2 Elliptic curve point addition Line through P1,P2P_1, P_2 hits curve at a third point; reflect across x-axis

IIVisualization 1: The Elliptic Curve Shape

Bitcoin's curve is secp256k1, defined by y2=x3+ax+by^2 = x^3 + ax + b with a=0,b=7a = 0, b = 7.

Explore how the curve's shape changes as you vary aa and bb. Bitcoin's choice of a=0,b=7a=0, b=7 gives a clean, symmetric shape.

βš™ interactive visualization β€” coming to this page format soon

Notice: The curve is always symmetric about the x-axis (because of the y2y^2 term). For Bitcoin's choice a=0,b=7a=0, b=7, the curve has no "bump" or extra component β€” it's a single smooth branch going to infinity.

In the real Bitcoin curve, all arithmetic is done modulo a very large prime pp. That turns this smooth shape into a scatter of discrete points β€” but the algebraic rules stay the same.

IIIVisualization 2: Point Addition β€” The Geometric Rule

On an elliptic curve we define a special "addition" of points:

  1. Draw a straight line through two points P1P_1 and P2P_2.
  2. The line hits the curve at exactly one more point (shown as Γ—).
  3. Reflect that third point across the x-axis β€” that's P1+P2P_1 + P_2.

Use the sliders to choose the x-coordinates of P1P_1 and P2P_2 (both on the upper branch), and watch the addition happen.

βš™ interactive visualization β€” coming to this page format soon

Reflect: The orange Γ— is where the line hits the curve a third time. The purple dot (the sum) is that third point reflected across the x-axis.

Repeating this rule β€” adding GG to itself over and over β€” is how we get 2G,3G,…,kG2G, 3G, \ldots, kG. For a 256-bit kk, naively doing kk additions is impossible, but double-and-add lets us compute kGkG in about 256 doubling steps. That's why signing is fast.

IVVisualization 3: How Big Is 22562^{256}?

A Bitcoin private key is a random 256-bit number. That means it's one of 2256β‰ˆ10772^{256} \approx 10^{77} possible values.

Slide the key size and compare the resulting key-space against familiar astronomical quantities (shown on a logarithmic scale).

βš™ interactive visualization β€” coming to this page format soon

Notice: At 256 bits, the key space (β‰ˆ1077\approx 10^{77}) is within a few orders of magnitude of the total number of atoms in the observable universe (β‰ˆ1080\approx 10^{80}). This isn't a computing problem β€” it's a physics problem. No amount of hardware can brute-force this.

VQuiz Questions

Question 1

A common misconception is that Bitcoin encrypts transactions to keep them private. What does Bitcoin actually do?

βœ… Correct! Bitcoin uses signatures, not encryption. Transactions are public; what's proven is authorship.

❌ Not quite. Every Bitcoin transaction is fully visible on the public ledger β€” nothing is encrypted. What matters is who authored it.

Show solution

Solution:

Bitcoin transactions are fully public β€” amounts, sender addresses, and receiver addresses are all visible on the blockchain. Bitcoin does not encrypt them.

What Bitcoin uses is a digital signature: Alice signs the transaction with her private key, and anyone can verify β€” using her public key β€” that the signature is valid.

  • Encryption hides information.
  • Signatures prove authorship.

Bitcoin needs the second, not the first. That's precisely why the network can be simultaneously open (everyone sees everything) and secure (only the key-owner can spend).

Question 2

A Bitcoin private key is a random 256-bit number. Approximately how many possible private keys exist?

βœ… Correct! 2256β‰ˆ10772^{256} \approx 10^{77}, putting it within a few orders of magnitude of every atom in the observable universe.

❌ Not quite. Remember: 256 bits means 22562^{256} possibilities. Convert via log⁑10(2)β‰ˆ0.301\log_{10}(2) \approx 0.301.

Show solution

Solution:

A 256-bit key means 256 binary digits, each independently 0 or 1. The total count of possibilities is:

2256β‰ˆ1.16Γ—10772^{256} \approx 1.16 \times 10^{77}

Converting powers of 2 to powers of 10: log⁑10(2256)=256β‹…log⁑10(2)β‰ˆ256β‹…0.301β‰ˆ77.1\log_{10}(2^{256}) = 256 \cdot \log_{10}(2) \approx 256 \cdot 0.301 \approx 77.1

For comparison, the observable universe contains roughly 108010^{80} atoms β€” just a few orders of magnitude larger. This is why brute-forcing is physically impossible.

  • ❌ 1025610^{256}: a common mistake β€” this would be if each digit had 10 options, not 2.
  • ❌ 256256 itself is just the number of bits, not the number of keys.
  • ❌ 101810^{18} is only about 2602^{60} β€” that's how big a typical password-strength space is, nowhere near a 256-bit key.

Question 3

Bitcoin's public key is computed as K=kβ‹…GK = k \cdot G, where kk is the private scalar and GG is the fixed generator point. Which direction of this equation is hard (the trap-door), and why?

βœ… Correct! Forward (kβ†’Kk \to K) takes milliseconds. Reverse (Kβ†’kK \to k) is the ECDLP β€” no known shortcut.

❌ Not quite. Think about the 'trap-door' idea: one direction must be easy (signing), the other must be impossible (stealing the key).

Show solution

Solution:

The forward direction k→K=k⋅Gk \to K = k \cdot G is fast thanks to the double-and-add algorithm, which computes kGkG in roughly 256 point-doublings — milliseconds on any laptop.

The reverse direction β€” recovering kk from KK β€” is the Elliptic Curve Discrete Logarithm Problem (ECDLP). No algorithm is known that solves it faster than brute force. This asymmetry is the trap-door:

kβ†’easyK⏟millisecondsKβ†’infeasiblek⏟ECDLPΒ β€”Β noΒ knownΒ shortcut\underbrace{k \xrightarrow{\text{easy}} K}_{\text{milliseconds}} \qquad \underbrace{K \xrightarrow{\text{infeasible}} k}_{\text{ECDLP β€” no known shortcut}}

This is what lets Alice publish her public key to the whole world. Anyone can verify it came from some private key, but nobody can figure out which one.

Question 4

True or False: For Alice to send a valid, verifiable transaction to Bob, she must transmit her private key to the Bitcoin network so nodes can check her identity.

βœ… Correct! The private key never leaves Alice's device. Only the signature and public key are broadcast β€” verification uses only public information.

❌ Not quite. If Alice transmitted her private key, anyone could steal her coins. Signatures are designed so nodes verify using only the public key.

Show solution

Solution: False.

Alice's private key never leaves her device. Here's the actual flow:

  1. Alice uses her private key kk to produce a signature over the transaction data.
  2. She broadcasts only the transaction + signature (and her public key KK).
  3. Every node verifies the signature using the public key KK β€” no private key required.

If she ever transmitted her private key, anyone intercepting it could steal all her coins. The whole point of public-key cryptography is that verification uses only the public half.

This same principle secures TLS (HTTPS), SSH logins, and encrypted messaging.

Solved: 0 / 4