From “Hello World” to Bitcoin Core

by Rajarshi Maitra | June 21st, 2020 | vol.3

Raj1.jpeg

Recently my first pull request to Bitcoin Core got merged.

It wasn’t any critical change to the protocol, but was a small added functionality to the testing framework, which can occasionally be useful for the developers.

This completed one of my personal milestones since I started my journey with Bitcoin on 26th October 2017.

I succinctly remember the date and even the exact time when all of it started, simply because of the impact it had on me. Since then my journey down the rabbit-hole has led me into explorations of subjects that were never part of any conceivable career path of mine. And along the way, met some amazing people and probably some friends for life.

As I come from a non-CS background, everything related to Bitcoin was brand new to me. Concepts, ideas, and terminologies popped up everywhere that I have never heard before. The first few weeks were overwhelming as I was discovering the intersection of multiple disciplines, starting from computer science and mathematics to economics and politics. The cognitive dissonance was hard, and the inevitable realization of what money is hit me even harder. I knew I had stepped onto something big and I wanted to go as deep as possible. Being a dev was never part of the plan, as I wasn’t looking for career opportunities. But the path of curiosity is serendipitous, and honestly, that’s the fun of it. The only reason I started learning to code was to have a more intimate understanding of Bitcoin. And it took 2 years 5 months from writing my first “Hello World” program in Python, to get my first PR merged in Core.

I shared my excitement of that day in a tweet and to my surprise, many people approached me saying it’s a source of inspiration for them at different stages of the same journey:

In this article, I will try to articulate my experience of the journey in the hope that it might be useful for people looking towards a similar path and wondering if the effort is worth it.

Tl;dr: It is.

I like to describe it as a “hike up the Bitcoin hill”, as opposed to the more common “falling down the rabbit hole” analogy. There is definitely a fall at the beginning, but once you overcome the initial dissonance and clear your eyesight, you realize exactly what you are looking at. Then it’s time for some action, and the “hike” begins.


The Hike

Before going on any hike, we try to find peripheral information about the journey, route, environment, along with the history and stories of the place we are about to visit. This information helps us cherish the full extent of the journey, and it becomes a proper experience rather than just a walk. The same applies to the “Bitcoin Hike”.

One can very well become an expert in “Blockchain Technology” without ever realizing the story behind it all(trust me, these people exist). But you can never be a Bitcoiner without the real story. The Bitcoin hike is ultimately part of the never-ending human struggle of freedom. The hike ends at the summit of a hyperbitcoinized world, free from the tyranny of the state and perpetual robbery of public purchasing power by the current fiat money regime.

A lot has been written, said, contemplated, and explained on what Bitcoin is throughout the last decade. Yet we still haven’t been able to come up with a definition of Bitcoin, and chances are, we might never. That’s not only because Bitcoin is way too multidisciplinary to bind it into a single definition, but also because it’s ultimately a social consensus system.

What Bitcoin is, depends on what everyone thinks Bitcoin is at this moment. And that consensus can very well change in the next moment. Bitcoin is different things to different people.

6-blind-men-hans.jpg

Depending on their current domain of expertise, world view, political motivation, and environmental situation, every individual perceives it from different perspectives.

Bitcoin is a hill with many paths to hike on.

Depending on where someone is starting from, they can trace different routes and have differing experiences. But they all ultimately reach the same peak. For someone looking to start the technical route along the hill, here’s my short attempt at explaining the Bitcoin protocol from a birds-eye level.

Bitcoin is a set of communication rules.

If you have ever played the game of ciphers in your childhood, where you and your friends would jumble up the words as you communicate in class by passing on notes, Bitcoin is almost like that. Only you and your friends knew the rules to unjumble them, and none of the other friends could read the message in transit. Bitcoin is like such a communication rule, but for computers, and unlike the cipher game, it doesn’t encrypt anything. Every computer running the Bitcoin software can talk to other computers running Bitcoin (aka nodes) over the internet. And they communicate with each other by following these set of rules, known as the Bitcoin Protocol. These rules are special, and they were designed to facilitate a special purpose. By following these rules, every computer can come into an agreement among each other about the state of a database.

This database is canonically called the Blockchain and every node keeps a local copy of it. The information inside this database if of a form of “X owns Y bitcoins”. And as every node agrees with each other about the state of this database at every instant of time, every node can answer the question of the form “Who owns What”, at every instant of time. No matter which node in the network you ask, they all will give the exact same answer.

Thus, by following these rather peculiar set of rules, the Bitcoin network simulates a global monetary system, where agreements on who owns how much money can be agreed among all the nodes, without having a central point of authority.

This last sentence is crucially important. The entire reason for doing such protocol dance among computers is to come to agreement without needing a central authority. If you have a central authority you do not need the protocol anymore, because then the authority simply keeps track of who owns what, and everyone else can just ask the authority. Thus, the Bitcoin protocol essentially solves the problem of Agreement without Authority.

This problem of agreement was quite old and was first formally described in 1982 in the context of distributed computing systems, known as the Byzantine Generals’ Problem. But deeper down, the statement and the problem is more of a socio-political nature than of computer science.

How can a group of untrusting entities, dwelling in an adversarial environment, come into agreement about any statement?

This problem has plagued human society since the very beginning of the herd settlement era.

As you can readily guess, such problems would arise when it comes to social governance. The only possible solution humans have come up with so far, is the ideation of the “State” (herd leader/monarchy/democracy). The state is entrusted with the authoritative power to “decide” on statements of true and false on behalf of the entire society, and everyone else can simply ask the state whenever in need.

When the same problem comes in the context of money and finance, we solved it with Commercial Banks and Central Banks. Where people ask the commercial banks and in turn, they ask the central bank for the resolution of such decision making questions. Glimpses of this problem can be found almost everywhere in our society, and in all of them, the only solution humans have is to place an authoritative figure to dictate the information required for individuals to come into agreement.

That’s until January 3rd 2009. When a pseudonymous entity named Satoshi Nakamoto openly published C++ code that described a communication protocol claiming to solve the Byzantine Generals’ Problem. So far Bitcoin has been solving the problem, for thousands of nodes, without fail, for the last 11 years.

Thus was born the first instance of a solution to the problem of Agreement without Authority, and the first application of it was a decentralized global monetary system, that cannot be captured, controlled, denied, inflated, or stopped.

So obviously, the Bitcoin hill is a pretty damn exciting hike to take.


The Rucksack

So as one starts on a hike up the Bitcoin hill, there are few essentials you need to gather. Unlike a real hike, most of the tools and utilities are to be picked along the road, but to start we need a few basic primitives.

Cryptography

Bitcoin is a cryptographic protocol. Even if it doesn’t use any form of encryption/decryption (this might change with BIP324), there are other cryptographic constructions extensively used inside it. The most important are the hash functions and the Digital Signature Algorithm.

Hash functions are used to simulate commitments and are the entire basis of the Proof Of Work consensus algorithm that solves the Byzantine Generals’ Problem among untrusted peers.

Digital Signature Algorithm is used to simulate ownership proof over the digital assets (bitcoins) within the protocol. So grabbing a 101 cryptography course will definitely help. There are many available online, personally I took this one.

Programming

Bitcoin is a communication protocol for computers connected over the internet. So naturally, the rules are written in a language that computers can understand. The first reference implementation, known as Bitcoin Core, was written in C++ by Satoshi Nakamoto. Translations of the same set of rules can be found in almost every other programming language out there. So to run through the trail, one definitely needs knowledge of programming.

This is by far the biggest learning curve if you are starting from scratch. There are various resources out there to get your feet dirty with programming concepts, and almost all of them can be accessed for free. I leave it up to the reader to explore suitable learning formats on their own.

If you are new to programming, probably the easiest language to start with is python. There is a good article by Pierre Rochard on the technical side of bitcoin. Justin Moen’s mooniversity is a great resource with tutorial videos to make a bitcoin-like system from scratch in python. Jimmy Song has written Programming Bitcoin where you develop a dummy bitcoin python library from scratch, giving you a good overview of how different parts of the system works. Cristopher Alen has a nice walkthrough of learning bitcoin from the command line, which will get you up to speed with Bitcoin RPC and Linux terminal. And use Mastering Bitcoin by Andreas Antonopolous as a goto reference book. Programming is quite a vast discipline, and is not only limited to Bitcoin. It can feel scary at times, but it’s doable even without a computer science degree. Remember to never quit if you want to take this quest, just keep walking.

The Club

Once you are done gathering the preliminaries in your rucksack, the next thing to do is join a club. Fortunately, there exists a Bitcoin PR Review club, started by Jhon Newberry last year. Where every Wednesday, participants analyze and discuss one Pull Request into Bitcoin Core. This is not only the best place to get familiar with the code base but a very ripe ground for new learners to quickly grab up new concepts.

It might feel a little intimidating at the start. But remember its not about knowing everything, but about figuring what you don’t know yet, then go back and learn it. Over time you will gather enough understanding and knowledge to make meaningful participation in the conversations, as well as in the GitHub review process. 

John NewberryJonatackJimmy Song, and Amity Uttarwar has created some great articles explaining the journey of contributing to Core. These are some great resources to start with once you are ready to get your hands dirty with real-world Bitcoin Programming.

Economics/Politics/Game theory

Finally, as you go on packing your rucksack, keep in mind that Bitcoin is much more than just code. Beyond technicalities, Bitcoin is a beautiful social phenomenon. The system works by a clever incentivized design, where the right amount of incentives are provided for each network participant, so everybody is better off by supporting the system instead of attacking it.

This economic design simulates a game-theoretic convergence of the state of the Blockchain among all its participants. An order emerges out of the seemingly random events of SHA256 hashing operation in Proof Of Work mechanism. Bitcoin is termed as the first human created instance of deterministic anarchy. But the ethos behind this idea is political, and the seed has been growing for at least the last 30 years in an activism known as the Cypherpunk movement.

This was essentially underground academic activism, aimed at using mathematics and tools of cryptography to demolish encroachment of the State on human freedom worldwide. Bitcoin is the fruit of the Cypherpunk movement. Moreover, the idea neatly ties up with a completely independent field of contrarians in the domain of economics known as the Austrian School of Economics.

Where academicians have been debunking the serious flaws of the current fiat money regime since at least 1920s. A lot has been said and explored about the history and politics of Bitcoin the idea, and it’s much more important to learn about them than just learning to code.

Dan Held wrote an elaborate account of the principles and activism behind Bitcoin in his series Planting Bitcoin.

Saifdean Ammous gave a complete account of the implication of a hard sound monetary standard on our economics, society, and personal lives in his book The Bitcoin Standard.

Parker Lewis gave an intellectual walkthrough of how the implication of a hard money standard is almost inevitable in his series Gradually, Then Suddenly.

An enormous but not exhaustive list of resources from various disciplines tied with Bitcoin can be found hereherehere and here.

Conclusion

The amount of resources out there can feel overwhelming.

It’s possible that this could be the biggest intellectual journey you have ever pursued. But don’t be overwhelmed, because you don’t have to learn it all in one go. If you are here for the right reasons, you would know that this is a journey of a lifetime. Bitcoin is not a get rich quick scheme. It’s a get free quick idea. The first thing — at least some ounces of the above Bitcoin knowledge — will do is to reduce your time preference drastically. And that itself is an enormous personal improvement. Learning the subject of Bitcoin is like eating a giant elephant, you can’t eat it in a go, you have take one bite at a time.

And I cannot stress it enough that it’s more important to understand the “Why” of Bitcoin than the “How”. If you have glimpsed a hyperbitcoinized world; free from the tyranny of dictatorships, free from massive doses of inequality stemming from Cantillon effect, free from central banks routinely robbing you of your purchasing power to feed the Wall Streets of the world, free from financial exclusion, free from torturing trade embargoes placed to satisfy the sick ego of the State, free from never-ending wars and human rights violations all over the world.. If you have glimpsed this, you have already packed your rucksack. The only thing left is to get out of your comfort zone and start walking. Once you are walking, you have already gained the more valuable answers to “Why”, and the “How” is all out there, waiting to be digested, for free.

If you have reached so far, its kind of your moral duty to invest any excess intellectual capability you can spare in the betterment of Bitcoin, in whatever shape or form. To take part in this peaceful voluntary movement, created by the people, for the people, to bring in freedom not only in your country but in the entire world. The movement doesn’t recognize culture, borders, or race as the extortion of tyranny also doesn’t recognize any of them. Bitcoin is possibly the most effective first step to fix our world, which is utterly broken from every aspect of a functional society. But Bitcoin is more than just code. It’s an idea virus. And if you are infected with it, you will know in your gut what you need to do to spread it among unsuspecting minds.

Beneath this mask there is more than flesh, Beneath this mask there is an idea, Mr. Creedy, and ideas are bulletproof.
— V for Vendetta

It doesn’t matter if you can’t code, or if you don’t have the tenacity or fascination to learn it.

Even thinking and contemplating about Bitcoin, sitting in the corner of your room is a positive contribution towards the idea. Be the annoying friend in your group who can’t stop talking about Bitcoin. Be the technical facilitator for your friends, family, and neighbors who can’t access this asset class on their own. Be the Bitcoin educator.

Honestly, there is no “Bitcoin Expert” in this world. 
Be the expert that your own folks need.

I hope this piece gives some useful clues on how to start your hike up the Bitcoin hill. Even though there isn’t any perfect trail to follow, you can always make up your own trail. In fact, that’s probably the most correct way to enjoy this journey. Take a detour, get lost for a few months, then come back again stronger. Even though I have just merely started my hike, surely this is the most rewarding intellectual endeavor I have undertaken.

I hope this mumbling made some sense, and I shall see you at the peak of hyperbitcoinization.

Off to the moon!!

Rajarshi Maitra is an Indian Bitcoiner, fascinated with the subjects of natural and political science since early student life. He is a PostGrad in Structural Engineering, but has been exploring a wide array of subjects, like theoretical physics, astrophysics, number theory, and finally Bitcoin and Austrian Economics. He strives to be an academic outside of the framework of institutional academia, and Bitcoin is his personal quest of validating the possibility of freelance research work. Currently, he spends most of his free time researching privacy avenues in LNP/BP, and contributing to Bitcoin Core.