Bitcoin Forum
August 20, 2018, 02:21:20 AM *
News: Latest stable version of Bitcoin Core: 0.16.2  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Reading Bitcoin code  (Read 93 times)
108abhishek
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
January 07, 2018, 05: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!!
1534731680
Hero Member
*
Offline Offline

Posts: 1534731680

View Profile Personal Message (Offline)

Ignore
1534731680
Reply with quote  #2

1534731680
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
DannyHamilton
Legendary
*
Offline Offline

Activity: 2198
Merit: 1371



View Profile
January 07, 2018, 07: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[])

boogersguy
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile
January 08, 2018, 08: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
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!