# Sources for "Did Satoshi's First Bitcoin Code Have a 21 Million Cap?"

This file is the sources companion published with the article. It names the files I compared, the public posts and e-mails I cited, the checksums of the 2008 preview, and the short script that adds up both money schedules. Every money claim in the article was checked against this script and against the source files in the [research mirror](/satoshi/mirror/).

## The two trees

- November 2008 preview (four files, 5,005 lines), as posted by Cryddit (widely identified as Ray Dillinger) on 23 December 2013 in [Bitcoin source from November 2008](https://bitcointalk.org/index.php?topic=382374.0). The text of those four files, ignoring whitespace, matches the code blocks in posts #2 to #6 of that thread (checked 3 December 2026, Europe/Bucharest). Mirror: [/satoshi/mirror/files/corpus/satoshi_nov2008/](/satoshi/mirror/files/corpus/satoshi_nov2008/main.cpp).
- Bitcoin v0.1.0, from the original `bitcoin-0.1.0.tgz` release archive (readme: "BitCoin v0.01 ALPHA", `VERSION = 101` in `serialize.h`). Mirror: [/satoshi/mirror/files/corpus/satoshi_v0.1.0/](/satoshi/mirror/files/corpus/satoshi_v0.1.0/main.cpp). The official rar is also [mirrored](/satoshi/mirror/files/satoshi/bitcoin-0.1.0.rar).

SHA-256 of the four 2008 files in the mirror:

```
b15744d2478999fd3fd646f505a72e28752a9a0a9fb87e5d9dd3e379250dd498  main.cpp (66,174 bytes)
47983339faeef9af50ad1b77bfaf649ac3b320506cb15bb7ad2f9824ec678816  main.h (29,219 bytes)
f2f3ec5440b6832fe4a23b8e8898d336e77af54b17d384c738e0cbe68050cf62  node.cpp (28,112 bytes)
ce5102021cb0f9ad63a154d8fb86e07c117762f2bd5b550f52fe47e833335649  node.h (18,491 bytes)
```

SHA-256 of the v0.1.0 tarball used: `ce9da46516e3042741224a7f9061e3181a5a4d17abba72b6e82922af3753d756`.

## Public documents cited

- Satoshi, cryptography mailing list, 17 November 2008: [I sent you the main files](https://www.metzdowd.com/pipermail/cryptography/2008-November/014863.html).
- Satoshi, [Bitcoin v0.1 released](https://www.metzdowd.com/pipermail/cryptography/2009-January/014994.html), 8 January 2009: "Total circulation will be 21,000,000 coins."
- Satoshi to Martti Malmi, 3 May 2009, [e-mail 3 in the Sirius archive](https://mmalmi.github.io/satoshi/#email-3): "an educated guess" and "I ended up picking something in the middle."
- The Bitcoin whitepaper ([bitcoin.org/bitcoin.pdf](https://bitcoin.org/bitcoin.pdf)): "a predetermined number of coins," no 21 million figure.
- Fiach_Dubh, [Part I](https://medium.com/@Fiach_dubh/1-99-billion-bitcoin-not-21-million-fad9f5550659) (9 March 2024) and [Part II](https://medium.com/@Fiach_dubh/satoshis-2008-bitcoin-source-code-v0-0-had-less-bitcoin-4db33fd0e6c9) (21 November 2024).

## Supply script

This is the loop I ran. It copies the constants and the integer maths from `GetBlockValue` in each tree (integer division by 2 in 2008, a right shift in v0.1.0). It prints 19,999,998,800,000 units (19,999,998.8 coins) for the 2008 schedule and 2,099,999,997,690,000 units (20,999,999.9769 coins) for v0.1.0.

```python
#!/usr/bin/env python3
"""Reproduce the money-supply arithmetic for the Nov 2008 preview and v0.1.0.

Constants are copied from the source files named in the comments.
Integer maths mirrors the C++ (int64 division by 2 for 2008, right shift for v0.1.0).
"""
# --- Nov 2008 preview (main.h 34-35, main.cpp 652-658) ---
COIN08, CENT08 = 1_000_000, 10_000
BLOCKS08 = 100_000           # `for (i = 100000; i <= nBestHeight; i += 100000) nSubsidy /= 2;`
sub = 10000 * CENT08         # nSubsidy = 10000 * CENT
total08 = 0
epochs08 = 0
s = sub
while s > 0:
    total08 += s * BLOCKS08
    epochs08 += 1
    s //= 2
print("2008 reward units:", sub, "=", sub / COIN08, "COIN")
print("2008 epochs until reward is 0:", epochs08)
print("2008 sum of per-block rewards (units):", sum_ := total08 // BLOCKS08)
print("2008 total units from blocks 1..:", total08)
print("2008 total in COIN:", total08 / COIN08)
print("2008 genesis txout (units):", 10_000, "=", 10_000 / COIN08, "COIN")
print("2008 shortfall vs 20,000,000 COIN:", 20_000_000 - total08 / COIN08)
print("2008 epoch length at 15 min:", BLOCKS08 * 15 / 60 / 24, "days =", BLOCKS08 * 15 / 60 / 24 / 365.25, "years")
print("2008 all epochs at 15 min:", epochs08 * BLOCKS08 * 15 / 60 / 24 / 365.25, "years")
print("2008 retarget window blocks:", 30 * 24 * 60 * 60 // (15 * 60))
# Medium Part I addendum says 19,999,898,800,000 units:
print("Medium addendum figure:", 19_999_898_800_000, " diff to mine:", total08 - 19_999_898_800_000, "units = ", (total08 - 19_999_898_800_000) / sub, "full-reward blocks")
print("Medium 'bitcoin' figure (units / CENT):", total08 / CENT08)
print("Same units / CENT / 100 (what FormatMoney shows):", total08 / CENT08 / 100)

# --- v0.1.0 (main.h 18-19, main.cpp 675-682) ---
COIN, CENT = 100_000_000, 1_000_000
BLOCKS = 210_000
s = 50 * COIN
total = 0
epochs = 0
while s > 0:
    total += s * BLOCKS
    epochs += 1
    s >>= 1
print()
print("v0.1.0 reward units:", 50 * COIN, "= 50 COIN")
print("v0.1.0 epochs until reward is 0:", epochs)
print("v0.1.0 total units:", total)
print("v0.1.0 total COIN:", total / COIN)
print("v0.1.0 shortfall vs 21,000,000:", 21_000_000 - total / COIN)
print("v0.1.0 epoch length at 10 min:", BLOCKS * 10 / 60 / 24, "days =", BLOCKS * 10 / 60 / 24 / 365.25, "years")
print("ratio raw units v0.1.0 / 2008:", total / total08)
print("ratio COIN 2008 / v0.1.0:", (total08 / COIN08) / (total / COIN))
print("difference in COIN:", total / COIN - total08 / COIN08)
# difficulty
print()
print("2008 MINPROOFOFWORK 20 bits -> target 2^236; v0.1.0 difficulty-1 target 0xffff * 2^208")
print("ratio:", 2**236 / (0xFFFF * 2**208))
print("generic: 100*100000*2 =", 100 * 100000 * 2, " 50*210000*2 =", 50 * 210000 * 2)
```

A copy of the script also lives at [supply.py](/satoshi-2008-bitcoin-code/supply.py).
