I am looking to understand the Bitcoin C++ source code on GitHub. The Python one is simpler, but even that is too complicated for a beginner. Could someone guide me to some good resources on the actual implementation and its details? The actual C++ techniques used seem to be quite complicated.
6 Answers
I am not aware of an extensively commented version of the Bitcoin sourcecode, but you could check out the Bitcoin Developer Reference and you can read online the book Mastering Bitcoin by Andreas M. Antonopoulos, which covers Bitcoin's technical aspects extensively. There is also Princeton's Free Online Bitcoin course, which goes into details on some technical aspects, which might in turn help you understand the sourcecode better.
Besides that, try searching Bitcoin.SE for specific questions, there are a few here that have been asked about already, if you can't find something, feel free to ask a new question here.
-
Thank you. I am reasonably comfortable with the theoretical aspects. I am looking for pure implementation details like critical sections and libraries used and such.. May 31, 2015 at 13:25
-
2It is probably the easiest if you then ask specific questions about any sections of the sourcecode you want to understand better. Alternatively, you might want to try asking advice in #bitcoin-dev on freenode, where a lot of Bitcoin contributors hang out regularly.– Murch ♦May 31, 2015 at 16:34
My new book "A Dissection of Bitcoin" examines the original Bitcoin source code written by Satoshi.
As for now, it is the first and only book available that helps you read the Bitcoin source code.
-
I've seen the book for sale online but it appears to be only four chapters. (iTunes: "The whole book has 10 chapters. This version you are about to purchase contains the first 4 chapters.") --- Where can I get the full 10-chapter version?– DanielOct 25, 2017 at 13:42
-
1
-
Can you please release new book version for 2018? I want to buy cause i am working on 2018 but your book is very very very very old. Apr 1, 2018 at 20:33
-
Aside from what @Murch♦ mentioned above (especially the developer reference), a good source for this is the Doxygen documentation. You can generate it locally or it seems to be published here:
Bitcoin: Developer documentation
Unfortunately the documentation itself is pretty sparse, but the things that Doxygen adds (especially call graphs and inheritance graphs) add a lot more than what you would get just by browsing the source in an editor.
The Bitcoin codebase is a very large today, with roughly 370,000 lines of code in the 0.17.0 release.
There is a Github project that help developers read open source projects. Check out the entry on Bitcoin:
https://github.com/CodeReaderMe/awesome-code-reading/issues/2.
It contains an overview of the Bitcoin codebase as well as some tips to get you started.
You might benefit from understanding key concepts in bitcoin before diving into the core source code. The following link teaches the technical basics of how Bitcoin works by walking you through writing a simple python script to create transactions from scratch:
http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html
Also on the site are other posts on how Bitcoin mining works and how to write a python script to mine Bitcoins (for science and understanding, PROFITABLE cpu/gpu mining days are long gone)
You might benefit from some fundamentals of what the Bitcoin blockchain actualy is. James D'Angelo is awesome at explaining concepts to everyone including beginners and more advanced users, without being boring or confusing. Watch the following video and check out his channel for more info. https://www.youtube.com/watch?v=gUwXCt1qkBU
Mastering Bitcoin by Andreas Antonopoulos is definitely a good start. It's available for free.
-
2Yeah, previous answers already mention it. Also, posting your amazon referral link here doesn't benefit you, as the Stackexchange engine automatically replaces the link with its own referral.– Murch ♦Jun 28, 2015 at 6:06