I am interested in zcash (https://github.com/zcash/zcash) and the theory behind it. Therefore, I download the source codes of zcash to trace it. The codes comprise C++,python and shell scripts. How to determine the behavior of these codes quickly? I tried UML revere engineering, but doesn't really help.
1 Answer
If you're interested in the theory, then read the papers written for it. If you're interested in how the code runs, then hopefully someone wrote documentation for that. If you want a quick, automatic way of learning this, you are out of luck because static analysis cannot, in general, describe the behavior of a computer program (the halting problem). Finally, if you want a quick way to determine the behavior for yourself, I can only give general advice like "work backwards from the main function" and "figure out what each function or class does". Program design is an art.
-
Is there any possibility of multiple main fuctions(may be one from C++ ,one from python)? I examine the main function in bitcoind.cpp. That's too simple. It only starts connection. How about other functions( proof of work,ledger)?– ttsazoocAug 21, 2017 at 8:04
-
@aswe2277 "It only starts connection" no, by definition the whole program depends on what happens in
main
. Try applying the "figure out what each function or class does" to everything inmain
– CalethAug 21, 2017 at 8:29 -
So when the binaries start, it executes all functions in main.cpp in order? Not main function in bitcoind.cpp?– ttsazoocAug 21, 2017 at 8:46
-
-
1@aswe2277: FWIW, "It only starts connection" - seems to me it does far more than that. The last line in main calls
AppInit
, which calls a lot of other functions. I recommend to use a debugger, set a break point at a suitable line in the code and step through it. Aug 21, 2017 at 9:11