Skip to main content

Code characteristics

"The design and coding started in 2007."

-- Satoshi Nakamoto

What about the Bitcoin source code?

Careful analysis of the code reveals it to be most likely the work of one individual rather than the result of collaboration or teamwork.

Language

Nakamoto authored original versions of Bitcoin in the C++ language, most likely under Microsoft Visual C++ (MSVC 2005 SP1 specifically mentioned in source comment).

Clues in source code comments point to development in a Microsoft Widows environment along with testing on Linux, MacOS, and Windows.

Comments

While code is one focus area, the comments within the code are also valuable metadata, which you can study separated from their context to quickly pick out details. Depending on how you capture outputs from the files which make up the source, you could accidentally pull in comments from third-party libraries which just add noise to Satoshi's actual comments.

You can extract C style comments from source code with an awk one-liner like this:

awk '/\/\*.*\*\// || /\/\/.*/ {print $0}' "${C_SOURCE_FILE}"

Example from within the Bitcoin version 0.1.0 codebase root.

for f in $(find ./src/ -type f \( -name "*.cpp" -o -name "*.h" \))
do
awk '/\/\*.*\*\// || /\/\/.*/ {print $0}' "${f}" >> comments.txt
done

This should yield a comments.txt file with a little over 3k lines of comments.

Interesting features

The code contains some interesting features and peculiarities.

Peculiar comment styles.

for example this comment fragment and shorthand for 'delete me' is super peculiar: ////// delme. A search of GitHub C++ repositories for similar references produces only results which occur after the target timeline.

 /// satoshi: tell the types by name instead of by number
//// todo: add something to note what created it (user, getnewaddress, change)

Social commentary

Some reviewers have formed contestable opinions on Bitcoin source code quality, ranging from "It's brilliant code. It's production-grade C++." to "So weird to see how shitty the code is."

Others have pointed out that the code is of the quality expected by academic researchers or scientists from fields possibly other than Computer Science.

Wild observations:

Most CIA and NSA code that has been leaked has been developed on Windows using Visual Studio IIRC. The bitcoin code looks and feels a lot like of their projects but could easily be some NSA programmers side project.

Any hacker can tell this was a one person project from looking at the code. —nadapkoe commenting on HN

Interesting commentary, and even more interestingly, this comment by user nadapkoe is their only comment at all, so perhaps from a throwaway.