9

Is there a documentation somewhere to understand the C++ code of Bitcoin Core (available on Github) "from a to z" and being able to recreate it ?

3
  • 2
    You mean other than the source itself (github.com/bitcoin/bitcoin) or the developer documentation (bitcoin.org/en/developer-documentation)? Also, this SE site is a wonderful resource for specific questions :)
    – Jestin
    Jun 20, 2016 at 18:59
  • @Jestin: That should be an answer, not a comment. ;) Perhaps add in the Princeton Bitcoin Book.
    – Murch
    Jun 20, 2016 at 21:01
  • I wasn't sure this was precisely what @smoumou was looking for, but I'll post it as an answer just in case.
    – Jestin
    Jun 20, 2016 at 21:22

2 Answers 2

11

To understand Bitcoin Core, the best resource is probably the source code itself:

https://github.com/bitcoin/bitcoin

To help understand what is going on in the code, try the developer documentation and the Princeton Bitcoin Book. Keep in mind that the code gets updated faster than the documentation, so the code should be your source of truth.

Some interesting places to start:

https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp - this is the source file that contains the code for interpretting script, and therefore checks for transaction validity

https://en.bitcoin.it/wiki/Protocol_documentation - the docs for the network protocol, such as message definitions and data structures

https://bitcoin.org/en/developer-reference#transactions - transaction reference describing the content and construction of transactions

For any clarifications and questions, I highly recommend this very StackExchange site :)

3
  • First thanks for the answer, I have to say I was looking for a documentation about the C++ code available on Github, I already looked at the developper documentation and read the book "Mastering bitcoin" wrote by Mr. Andreas Antonopoulos and it gave me detailed explanations about the protocols but my purpose is to go as deep as I can taking the source code to understand each line to be sure of what this software really does with my computer and I really don't know how to start (I am currently ready all classes starting from bitcoin-cli.cpp but it is not really efficient).
    – smoumou
    Jun 21, 2016 at 10:08
  • I've edited my answer to specify a few of the places I recommend diving into. This is basically just my opinion of what's interesting, so keep in mind that others would tell you to start elsewhere. Personally, I think the encumbering and unencumbering of transaction outputs are the heart of Bitcoin, so I've pointed you to the script part of the code. I've also singled out the network protocol, since communication between peers is another fundamental aspect. Again, just my opinion.
    – Jestin
    Jun 21, 2016 at 13:41
  • @smoumou: Please also edit clarifications back into your original question, so that other answeres don't have to check all answers before adding one.
    – Murch
    Jun 21, 2016 at 15:06
0

Couple of years ago, i created a few articles on bitcoin core code analysis. It is here: http://embedded-design-vic.blogspot.com/2017/07/bitcoin-core-tutorial-and-source-code.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.