Bitcoin_commit_analysis

Bitcoin Codebase Deep Dive

First Bitcoin preview code posted by Satoshi had 4 files. Now, after more than 10 years, Bitcoin codebase contains around half a million lines of code. In this post, we look into Bitcoin’s protocol codebase and its different characteristics.

The nature of Bitcoin is such that once version 0.1 was released, the core design was set in stone for the rest of its lifetime. — Satoshi

Terminology

Bitcoin codebase is hosted on Github, which uses Git software to provide codebase management. Here is some basic terminology which we will use throughout this post. 

Github Repository — A folder hosted on Github containing the entire codebase of a project. 

Commit– A commit is saving some code changes (or File changes) into Github repository.

Merge– Combining two different version of the codebase.

Bitcoin repository Numbers

Commit Analysis

As you can see, most of the commits are on weekdays, but Bitcoin developers push code on Saturday and Sunday too 😃

Bitcoin never sleeps, nor its developers.

Bitcoin Commits by Day of the week

Bitcoin’s master branch(Main branch) has around ~21k commits, and the development activity is continuously growing over time. 

Bitcoin Burndown Analysis

Bitcoin codebase burndown analysis

Burndown analysis shows lines of code surviving throughout the time in the codebase. One might expect more code decay because of Bitcoin’s introduction of a completely new technology, which is changing rapidly. Instead, we can see that a lot of old code still surviving. You can compare it with Linux’s codebase, which is the largest open-source codebase in existence today.

Linux burndown analysis

We can also visualize how individual commits are decaying over time. This analysis can be done by aligning all commits on X-axis and measuring the aggregate decay of the overall code. Even after 9 years, ~25% code is still surviving. 

Bitcoin commit decay

Added vs Changed Line

Below chart shows how many lines of code were added and how many existing changed (deleted or replaced) through time in Bitcoin codebase. You can see there was a lot of activity from 2011–15.

Bitcoin — Added vs Changed lines of code over time

Bitcoin File extension Distribution

Most of Bitcoin’s codebase is written in C++, but it also uses Qt (.ts file extension), a cross-platform C++ framework mostly used for building GUIs. Almost half of the code in .ts (QT) files, but Bitcoin protocol codebase is in C++.

Lines of code in different files extension

Developer Effort

We also plotted how many lines have been changed (added or removed) by each developer. The upper part of the plot is an accumulated (integrated) lower part. The upper part is showing overall changed lines and the lower part is showing developer contribution(effort) for that time period. It is impossible to have the same scale for both parts, so the lower values are scaled, and hence there are no lower Y-axis ticks. There is a difference between the efforts plot and the ownership plot, although changing lines correlate with owning lines.

Bitcoin Developers Analysis

Below chart shows the Code ownership, that is, how many lines of code are alive over time for each identified developer. By far, Wladimir is one of the top Bitcoin developers, owning around half of the Bitcoin codebase. 

Bitcoin top 20 devs — Code Ownership throughout the Time

Overwrites matrix

Below is the overwrite matrix based on added and deleted line statistics per developer. Using this, we can visualize how lines of code by developer A are removed by developer B. This indicates collaboration between people. 

The format is the matrix with N rows and (N+2) columns, where N is the number of developers.

  1. The first column is how many lines were written by the developer and deleted by unidentified developers.
  2. The rest of the columns show how many lines were written by the developer and deleted by identified developers.

Top Developers 

Currently, Bitcoin has around 49 active contributors, An active contributor is anyone who has committed code over the past three months to the codebases you want to analyze. This time period is a sliding window that always starts at the date of the most recent commit in your repositories. Each author is only counted once.

Wladimir is one of Bitcoin’s maintainers and top contributors. Every contributor on the list gave their significant time to help the Bitcoin project. Their continuous effort made Bitcoin possible.

Here, I want to emphasize an important point, unfunded open source development. “The World runs on open-source technologies,” every tech company on Earth uses open-source software, and many of these companies never contribute back.

Bitcoin is rewarding in nature but even a $160bn asset doesn’t have a proper setup to fund its development. It is cringe-worthy that no one talks about it. The Ethereum community trying/attempting to support Ethereum development by experimenting with DAOs. It is an exciting approach, and Bitcoin development can experiment with something similar.

Bitcoin itself is entirely built on top of open source technologies. I urge all those Hodlers, Businesses, VCs and Capital Mangement funds: when you earn a dollar in technology, keep a penny aside for open source development. A penny is enough, 1% contribution will provide enough funding for developers building technology for everyone to use without getting burnt out. To understand how open source suffers from lack of funding, read “Roads and Bridges: The Unseen Labor Behind Our Digital Infrastructure” by Nadia Eghbal.

Bitcoin Contributors Visualization

Let’s look some cool visualization, we have created a visualization of changes made by Bitcoin contributors in the past two years (Arp-17 to Aug-19).

Here different colors show their contribution in the respective languages (See there is a language classification at top left)

  • Each particle is a file. It moves from developer to developer.
  • The size of the particle depends on the degree of changes.
  • Each user gathers files which he used.
  • If files leave a user orbit, it means that they were deleted.

Bitcoin’s 10-year development

Here is another cool visualization of Bitcoin’s last 10-year development.

  • It shows file changes in every commit by different bitcoin contributors throughout the time.

CoinCodeCap

We at CoinCodeCap rank cryptocurrencies based on their Github activity. We believe investors should aware of cryptocurrency development progress. We provide multiple services, you can reach us at gaurav@coinmonks.com.

Subscribe our newsletter to get more information about Cryptocurrency development.

2 Comments:

  1. Joy Dutta

    Good post., I like the unaware fact that Bitcoin is open source…
    How I can contribute to BitCodeMap.?

Leave a Reply:

Your email address will not be published. Required fields are marked *