Monday, July 29, 2019

Understanding the Technical Side of Bitcoin

Source: https://medium.com/@pierre_rochard/understanding-the-technical-side-of-bitcoin-2c212dd65c09

Computer Literacy

Read an overview of different computer hardware components, the physical objects you will be accessing: https://www.explainingcomputers.com/hardware.html
Read the book Code: The Hidden Language of Computer Hardware and Software by Charles Petzold, recommended by Lightning protocol engineer Lisa Neigut. I haven’t read it (yet!) but the Amazon reviews look very promising.
To get a high-level overview of operating systems from a user’s perspective, get the latest “For Dummies” book for the operating system you are using: Linux, macOS, or Windows. If you have the time and inclination, have all three operating systems installed on the same or on different computers to see which you prefer and to access software that is exclusive to that operating system.

Command Line

As a user you could stop here, but if you want to get technical you’ll have to get comfortable with the command line, a text-only interface where your mouse is (usually) useless! The command line interface (CLI) is the opposite of what you’re probably used to interacting with, the graphical user interface (GUI). I know just enough about the CLI to get by, but there are folks out there who are CLI wizards. Windows has a very different CLI from Linux and macOS, so I would recommend installing the Windows Subsystem for Linux (WSL). It will allow you to learn the command line in a way that is generally portable to macOS and Linux.
There are lots of guides online, and documentation inside the command line itself. Christopher Allen wrote up a tutorial that is macOS focused https://github.com/ChristopherA/intro-mac-command-line and Codecademy has an in-browser course: https://www.codecademy.com/learn/learn-the-command-line

Git

git is a distributed version control system that is widely used in software development. I think git is important to learn because it is used by all of the Bitcoin and Lightning projects I have encountered (correct me if I’m wrong!), and technical documentation often uses git and it would be great if you contribute typos, corrections, improvements, and additions “upstream” as you work through the docs. GitHub.com is a web service that is built on top of git with a GUI, but git is generally interacted with locally (on your computer/laptop) using the CLI. Here are resources and tutorials for getting started with git: https://try.github.io/

Command Line + Bitcoin + Lightning

Work through Programming with Bitcoin Core and Lightning by Christopher Allen: https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line/blob/master/README.md
Bitcoin Improvement Proposals (BIPs) are a hodgepodge, so maybe focus on the ones that seem to crop up often in your readings. I wouldn’t necessarily recommend trying to sit down and reading them all from beginning to end. Here they all are: https://github.com/bitcoin/bips/blob/master/README.mediawiki
Mastering Bitcoin has a brief section on the LN. Read Joe Kendzicky’s LN Technical Primer: https://blog.usejournal.com/the-bitcoin-lightning-network-a-technical-primer-d8e073f2a82f recommended by Billy Garrison.
The LN in-progress specifications are here: https://github.com/lightningnetwork/lightning-rfc 

I highly recommend carefully reading through these BOLTs from beginning to end, a couple of times if needed! They are, or should be, understandable for non-developers (if something is not clear, research to reword the BOLT and submit a pull request!).

I would recommend watching the Chaincode Labs Lightning Residency video series here https://www.youtube.com/watch?v=aX7lOqf83h0&list=PLpLH33TRghT1SbxinAsNDS6L7RkAjC8ME, read Lighting Labs’ overview https://dev.lightning.community/overview/ and work through the Lightning Labs CLI tutorial https://dev.lightning.community/tutorial/
If you want A LOT more links about Bitcoin / blockchain / Lightning see Oded Leiba’s guide https://github.com/oleiba/blockchain-getting-started
If you stopped here you would have a very solid amount of computer experience, at least a basic understanding of the technical side of BTC/LN, and a clear path to experimenting with other people’s software. But maybe you want to write your own software!

Programming

I think that if you try to learn programming topics that are directly related to the most popular Bitcoin implementation (“Bitcoin Core”, also called “bitcoind”) then you’ll probably overwhelmed. To my knowledge there are no smooth learning curves for learning C++. I think its easier to learn a language like Python first, as it hides a lot of complexity and allows you to focus on mastering the basics of programming logic first. Coincidentally, the Bitcoin Core test suite is written in Python.
There’s a lot that has been written about learning how to code. My route was to start with Python on Codecademy https://www.codecademy.com/learn/learn-python
My friend Michael Goldstein got started with a Ruby on Rails tutorial book written by Michael Hartl, who has lots of great free and paid resources here: https://www.learnenough.com/ Find Hartl on Twitter here: https://twitter.com/mhartl

Warning: Programming is a notoriously frustrating experience. You will *repeatedly* have errors that take you hours to figure out (and the cause was “dumb”, maybe a typo). Please understand that this is everyone’s experience, you are not alone! Aggressively use Google early and often when you run into errors. If you solve the problem with a Google search, think about how you could have avoided the error in the first place and how you can detect the cause and fix it without Google. This will allow you to get faster at “debugging”. Eventually, you’ll write large amounts of code that don’t have too many “simple” obvious bugs, the code will just have really complicated and insidious bugs!
Often, an integrated development environment (IDE) can automatically point out problems to you so you have decades of programmer experience helping you out. Personally I’ve enjoyed using the IDE maker JetBrains over the years in all languages. For Python they have PyCharm (the community edition is free, the pro edition is free for college students) https://www.jetbrains.com/pycharm/.
You can also recreate a Codecademy-like environment that is web-based and highly interactive with Jupyter IPython https://ipython.org/ I really recommend this for rapidly iterating with experiments.
If after that experience you get addicted to programming and Python like I did, check out https://docs.python-guide.org/
I learned basic web development by following Miguel Grinberg’s Flask Mega-Tutorial: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
You can probably find the same combination of interactive tutorial + simple web framework tutorial for any modern programming language. A popular programming language is JavaScript because it can be used both inside a user’s web browser as well as on the server hosting the web content.
“Full stack” web development led to me learning about relational and document databases, key/value stores , message queues, concurrency, networking, etcetera that are either somewhat or completely applicable to BTC/LN programming. Having said that, you can learn all about these concepts by working on BTC/LN itself instead of unrelated web development like I did!
When you become proficient and comfortable with “hobbyist scripting”, start challenging yourself. Whatever modern programming language you’re using, there are “intermediate” and “advanced” books on topics like object-oriented and functional programming. There are also very interesting books that are generically about software architecture, code quality, development methodology, testing, and so on. You can always improve your programming chops by learning shiny new languages, reading code that is widely seen as high quality, and asking for a code review on StackExchange: https://codereview.stackexchange.com/

Programming + Bitcoin

Experiment with James O’Beirne’s minimalist Tinychain: https://github.com/jamesob/tinychain
If you choose to learn JavaScript, you’re in luck! Stéphane Roche recently wrote a very extensive guide on BitcoinJS: https://github.com/bitcoin-studio/Programming-Bitcoin-with-BitcoinJS
At this point, if you want to hack inside of Bitcoin Core, you’re going to have to learn C++! Alternatives are btcd which is written in go and is generally considered to be easier to read, or bcoin which is written in JavaScript.
Before you start on your C++ adventure, consider doing a detour to Rust as it may smooth the learning curve.
I found it helpful to build examples using xeus-cling https://github.com/QuantStack/xeus-cling which is IPython but for C++. I found this helpful to make iteration faster than the traditional C++ environment of having to constantly recompile.
Read through recent meeting notes to see what others are working on: https://bitcoincore.org/en/meetings/
I built a website for seeing all the Bitcoin Core pull requests that can give you an idea of what’s in the pipeline and how far along it is in the review process: https://bitcoinacks.com/

Programming + Bitcoin Bootcamps

Each bootcamp has a different focus, visit their websites for topics, dates, and pricing:

Programming + Lightning

There are several full implementations to look at, in alphabetical order:
Work through André Neves’ in-depth guide to help you kickstart and streamline your Lightning Application development workflow: https://medium.com/lightwork/lightning-network-development-for-modern-applications-e4dd012dac82

BlackRock has big influence in the Bitcoin ecosystem, but who owns BlackRock?

BlackRock has big influence in the Bitcoin ecosystem. For example with the development of the Bitcoin ETF (IBIT) and investments within the ...