10

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 ?

  • 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 '16 at 18:59
  • @Jestin: That should be an answer, not a comment. ;) Perhaps add in the Princeton Bitcoin Book. – Murch Jun 20 '16 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 '16 at 21:22
10

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 :)

  • 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 '16 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 '16 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 '16 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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