Bitcoin Forum
April 25, 2024, 03:30:20 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Reading Bitcoin code  (Read 212 times)
108abhishek (OP)
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!!
1714059020
Hero Member
*
Offline Offline

Posts: 1714059020

View Profile Personal Message (Offline)

Ignore
1714059020
Reply with quote  #2

1714059020
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714059020
Hero Member
*
Offline Offline

Posts: 1714059020

View Profile Personal Message (Offline)

Ignore
1714059020
Reply with quote  #2

1714059020
Report to moderator
1714059020
Hero Member
*
Offline Offline

Posts: 1714059020

View Profile Personal Message (Offline)

Ignore
1714059020
Reply with quote  #2

1714059020
Report to moderator
1714059020
Hero Member
*
Offline Offline

Posts: 1714059020

View Profile Personal Message (Offline)

Ignore
1714059020
Reply with quote  #2

1714059020
Report to moderator
DannyHamilton
Legendary
*
Offline Offline

Activity: 3374
Merit: 4606



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: 21
Merit: 2


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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!