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.
Asked
Active
Viewed 192 times
1 Answers
3
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.

Ryan Reich
- 264
- 1
- 2
- 4
-
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)? – ttsazooc Aug 21 '17 at 08: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** in `main` – Caleth Aug 21 '17 at 08:29
-
So when the binaries start, it executes all functions in main.cpp in order? Not main function in bitcoind.cpp? – ttsazooc Aug 21 '17 at 08:46
-
I search for main.cpp and can only find it in bitcoind.cpp. – ttsazooc Aug 21 '17 at 08:47
-
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. – Doc Brown Aug 21 '17 at 09:11
-
Thank all your help. Last Question: Why don't the programmers put main function in main.cpp? I am really curious about it. – ttsazooc Aug 21 '17 at 09:42
-
We don't know, here is the very wrong place to ask for. Better ask at the zcash forum. – Doc Brown Aug 21 '17 at 10:08