Bitcoin Institute

Bitcoin Core v0.1 code walkthrough — Forensicxs's 31,794-line analysis

Figures: Satoshi Nakamoto

A dark navy infographic featuring a code-editor window with a magnifying glass hovering over abstract lines of code, a two-segment horizontal bar split into a larger gold portion and a smaller teal portion, five icon cards showing a padlock, two diamond shapes, connected node dots, a wallet, and stacked bars, and a horizontal timeline dotted with circular markers and one amber tick mark.

On August 6, 2024, the cybersecurity researcher known as Forensicxs published “Bitcoin Core v0.1: a code walkthrough” — a comprehensive analysis of Satoshi Nakamoto’s original Bitcoin source code released on January 8, 2009.

Scope: Forensicxs analyzed the Bitcoin v0.1 codebase as 31,794 lines across 31 files, written in C++ and released under the MIT X11 license.

Note that this archive’s own source-code analysis treats the v0.1 C++/header line count from the local primary source as approximately 19,901 lines, growing to 31,909 lines by v0.3.19. The 31,794 figure is therefore Forensicxs’s count for that article and not this archive’s reference value (the difference reflects which files / blank lines / comments / wxWidgets headers each count includes).

Key findings

  • Code distribution: The wxWidgets GUI implementation accounted for approximately 18,000 lines (the largest single component). Blockchain operations, database management, networking, and scripting comprised the remaining ~13,000 lines.

  • Architecture: The analysis organized the codebase into the following categories, each of which lines up with one of this archive’s own design-history entries for the same subsystem:

  • Technical parameters hardcoded in v0.1: Coinbase maturity of 100 blocks; difficulty adjustment constrained to 25%–400% range; 10-minute target block interval.

The line count of 31,794 is consistent with the “thirty-one thousand lines of code” that Joshua Davis’s October 2011 New Yorker profile gave for Bitcoin as Satoshi created it in January 2009. The same profile featured Dan Kaminsky’s security analysis of Bitcoin’s code, and Kaminsky came away unable to find an exploitable flaw.