Author

Topic: Reading Bitcoin code (Read 232 times)

newbie
Activity: 21
Merit: 2
January 08, 2018, 03:21:44 PM
#3
This is probably a good place to start:
https://github.com/bitcoin/bitcoin/blob/master/src/bitcoind.cpp#L188

Code:
int main(int argc, char* argv[])

Lol.  I couldn't help laugh  a little . 

You can also jump to AppInitMain() in the "init.cpp" file. Here are some notes I took once when walking through the code:

Code:
AppInitMain()  // init.cpp
 - Creates the service queue thread (CScheduler::serviceQueue()) which runs "forever" until interrupted and adds it
   to the "threadGroup" (a boost::thread_group which was created in AppInit() in bitcoind.cpp)
   - Inside serviceQueue(), it's a big while-loop, which essentially dequeues and calls the next task in the queue:
         Function f = taskQueue.begin()->second;  // "second" is like the 2nd thing in a tuple, which is a function call.
         // .. other stuff
         f();  // call the actual function
legendary
Activity: 3472
Merit: 4801
January 07, 2018, 02:10:28 PM
#2
This is probably a good place to start:
https://github.com/bitcoin/bitcoin/blob/master/src/bitcoind.cpp#L188

Code:
int main(int argc, char* argv[])
newbie
Activity: 7
Merit: 0
January 07, 2018, 12:57:10 PM
#1
I have started reading bitcoin code, I know it's too late. But does not matter for me, I want to learn.
I have basic knowlege of c++.
My main question is what is the flow ? like it start from wallet code or some other file.

The code is so huge, I am lost. I can't figure it out from where the application is started.
Can any one help me?
Just like if I wanted to develop from scratch, then which part or function should I develop first and then slowly others.


Thank you!!
Jump to: